123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- <template>
- <view style="padding: 24rpx">
- <nav-bar title="所有课程"></nav-bar>
- <view v-if="!courseList.length">
- <u-empty text="暂无课程" mode="list"></u-empty>
- </view>
- <view
- v-else
- @click="jump(item, index)"
- v-for="(item, index) in courseList"
- :key="index"
- style="margin-bottom: 30rpx"
- >
- <view class="class_item">
- <image
- :src="$method.splitImgHost(item.coverUrl, true)"
- style="height: 316rpx; width: 100%; border-radius: 24rpx"
- ></image>
- <view style="color: #333333; font-weight: bold; font-size: 32rpx">{{
- item.courseName
- }}</view>
- </view>
- <view class="bottomBox">
- <view class="content_box">
- <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
- 学习进度:{{ item.stuAllNum + item.recordNum }}/{{
- item.secAllNum + item.examNum
- }}
- </view>
- <view class="box_progress">
- <view style="width: 60%"
- ><u-line-progress
- height="32"
- :show-percent="false"
- active-color="#ff9900"
- :percent="
- ((item.stuAllNum + item.recordNum) /
- (item.secAllNum + item.examNum)) *
- 100
- "
- ></u-line-progress
- ></view>
- <view class="learing_bt" @click.stop="jump(item, index)">
- 进入学习
- <!-- <u-button
- type="warning"
- size="mini"
- @click.stop="jump(item, index)"
- >进入学习</u-button> -->
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- goodsId: 0,
- gradeId: 0,
- courseList: [],
- orderGoodsId: 0,
- param: {
- pageNum: 1,
- pageSize: 10,
- total: 0,
- },
- businessData: {},
- itemIndex: "",
- informId: '', //消息id,从公众号消息模板进来的才有
- options: {},
- };
- },
- onLoad(option) {
- console.log('onload的', option)
- this.options = option
- this.goodsId = Number(option.id);
- this.gradeId = Number(option.gid);
- this.orderGoodsId = Number(option.orderGoodsId);
- // 公众号模板消息的数据埋点
- if (option.informId) { // 从公众号消息点击进来上报一次,其他地方进来和没登录需要跳到登录页,登录后返回的不需要上报
- this.informId = option.informId
- this.clickOfficial()
- }
- if (this.$method.isGoLogin()) { // 从公众号消息进来的没登录需要跳到登录页,登录后返回
- return;
- }
- this.courseCourseList();
- this.$store.getters.dictObj;
- },
- onShow(option) {
- if (this.itemIndex !== "") {
- this.refreshByIndex();
- }
- },
- onReachBottom() {
- if (this.courseList.length < this.param.total) {
- this.param.pageNum++;
- this.courseCourseList();
- }
- },
- methods: {
- // 新增微信公众号模板消息点击数据
- clickOfficial() {
- this.$http({
- url: '/data/click',
- method: 'post',
- data: { informId: this.informId }
- }).then((res) => {
- if (res.data.code == 200) {
- console.log('埋点')
- }
- })
- },
- /**
- * 返回刷新之前进入的课程数据
- */
- refreshByIndex() {
- this.$api
- .courseCourseList({
- pageNum: this.itemIndex + 1,
- pageSize: 1,
- goodsId: this.goodsId,
- gradeId: this.gradeId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- this.$set(this.courseList, this.itemIndex, res.data.rows[0]);
- }
- });
- },
- /**
- * 获取业务层次详情
- */
- courseBusiness(businessId) {
- this.$api.courseBusiness(businessId).then((res) => {
- this.businessData = res.data.data;
- });
- },
- jump(item, index) {
- console.log('00000000')
- this.itemIndex = index;
- if (index == 0) {
- if (item.rebuild === 0) {
- //未重修
- this.$navTo.togo("/pages2/learn/details", {
- id: item.courseId,
- gradeId: item.gradeId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- return;
- }
- this.$api.courseDetail(item.courseId).then((res) => {
- if (res.data.code == 200) {
- // if (res.data.data.educationName == "继续教育") {
- this.$api
- .lockLockStatus({
- action: "jxjy",
- uuid: this.$method.getUuid(),
- })
- .then((res) => {
- if (res.data.code == 200) {
- //有其他端在操作,不能学习
- uni.showToast({
- icon: "none",
- title: res.data.msg,
- mask: true,
- duration: 3000,
- });
- } else if (res.data.code == 500) {
- //可以学习
- this.$navTo.togo("/pages3/polyv/detail", {
- id: item.courseId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- }
- });
- // websocket.sendMsg("doCourse");
- // } else {
- // this.$navTo.togo("/pages3/polyv/detail", {
- // id: item.courseId,
- // goodsId: this.goodsId,
- // orderGoodsId: this.orderGoodsId,
- // });
- // }
- }
- });
- } else {
- if (this.businessData.goodsLearningOrder == 2) {
- //学习顺序是从头到尾学习,没学完上一课不能学习下一课
- let prevItem = this.courseList[index - 1]; //上一课
- if (
- prevItem.stuAllNum + prevItem.recordNum ==
- prevItem.secAllNum + prevItem.examNum
- ) {
- if (item.rebuild === 0) {
- //未重修
- this.$navTo.togo("/pages2/learn/details", {
- id: item.courseId,
- gradeId: item.gradeId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- return;
- }
- this.$api.courseDetail(item.courseId).then((res) => {
- if (res.data.code == 200) {
- // if (res.data.data.educationName == "继续教育") {
- this.$api
- .lockLockStatus({
- action: "jxjy",
- uuid: this.$method.getUuid(),
- })
- .then((res) => {
- if (res.data.code == 200) {
- //有其他端在操作,不能学习
- uni.showToast({
- icon: "none",
- title: res.data.msg,
- duration: 2000,
- });
- } else if (res.data.code == 500) {
- //可以学习
- this.$navTo.togo("/pages3/polyv/detail", {
- id: item.courseId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- }
- });
- // websocket.sendMsg("doCourse");
- // } else {
- // this.$navTo.togo("/pages3/polyv/detail", {
- // id: item.courseId,
- // goodsId: this.goodsId,
- // orderGoodsId: this.orderGoodsId,
- // });
- // }
- }
- });
- } else {
- uni.showToast({
- icon: "none",
- title: "请按顺序学完上一课再学习这一课",
- });
- }
- } else {
- if (item.rebuild === 0) {
- //未重修
- this.$navTo.togo("/pages2/learn/details", {
- id: item.courseId,
- gradeId: item.gradeId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- return;
- }
- this.$api.courseDetail(item.courseId).then((res) => {
- if (res.data.code == 200) {
- // if (res.data.data.educationName == "继续教育") {
- this.$api
- .lockLockStatus({
- action: "jxjy",
- uuid: this.$method.getUuid(),
- })
- .then((res) => {
- if (res.data.code == 200) {
- //有其他端在操作,不能学习
- uni.showToast({
- icon: "none",
- title: res.data.msg,
- duration: 2000,
- });
- } else if (res.data.code == 500) {
- //可以学习
- this.$navTo.togo("/pages3/polyv/detail", {
- id: item.courseId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- }
- });
- // websocket.sendMsg("doCourse");
- // } else {
- // this.$navTo.togo("/pages3/polyv/detail", {
- // id: item.courseId,
- // goodsId: this.goodsId,
- // orderGoodsId: this.orderGoodsId,
- // });
- // }
- }
- });
- }
- }
- },
- courseCourseList() {
- let self = this;
- this.param.goodsId = this.goodsId;
- this.param.gradeId = this.gradeId;
- // /course/courseList查询商品下的课程列表
- this.$api.courseCourseList(this.param).then((res) => {
- if (res.data.code == 200) {
- self.courseList.push.apply(self.courseList, res.data.rows);
- self.param.total = res.data.total;
- console.log(res.data.rows.length, "res.data.rows.length");
- if (res.data.rows.length) {
- this.courseBusiness(res.data.rows[0].businessId);
- }
- }
- });
- },
- appointment() {
- this.$navTo.togo(
- "/pages2/appointment/index?orderGoodsId=" + this.orderGoodsId
- );
- },
- },
- };
- </script>
- <style>
- page {
- background: #eaeef1;
- }
- </style>
- <style lang="scss" scope>
- .box_progress {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 20rpx;
- }
- .bottomBox {
- background: #ffffff;
- width: 94%;
- border-bottom-left-radius: 24rpx;
- border-bottom-right-radius: 24rpx;
- margin: 0 auto;
- padding: 20rpx;
- .learing_bt {
- width: 165rpx;
- height: 48rpx;
- line-height: 48rpx;
- background: #FFB102;
- border-radius: 16rpx;
- font-size: 24rpx;
- font-weight: 400;
- color: #FFFFFF;
- text-align: center;
- }
- }
- .content_box {
- display: flex;
- align-items: center;
- color: #999999;
- margin-top: 8rpx;
- }
- .content {
- color: #000000;
- margin: 0 8rpx;
- }
- .wk_icon {
- width: 24rpx;
- height: 24rpx;
- margin-right: 8rpx;
- }
- .class_item {
- width: 100%;
- background: #ffffff;
- border-radius: 24rpx;
- padding: 20rpx 20rpx 30rpx 20rpx;
- z-index: 999;
- position: relative;
- background: #FFFFFF;
- box-shadow: 0px 0px 20px 1px rgba(1,99,235,0.1000);
- }
- </style>
|