瀏覽代碼

fix:更新

钱新宇 2 月之前
父節點
當前提交
8f074af524
共有 4 個文件被更改,包括 158 次插入175 次删除
  1. 20 1
      pages/recruitment/lottery_new.vue
  2. 26 22
      pages/user/index.vue
  3. 99 101
      pages/video/detail.vue
  4. 13 51
      pages/video/index.vue

+ 20 - 1
pages/recruitment/lottery_new.vue

@@ -63,7 +63,8 @@
           <view class="reward_box">
             <view :class="['reward_title', reward_info.id == 0 ? 'noGet' : 'get']">{{ reward_info.id == 0 ? '很遗憾' : '恭喜您' }}</view>
             <view>
-              <view :class="['reward_image', reward_info.id == 0 ? 'noget' : reward_info.reward_type == 1 ? 'score' : 'redpacket']"></view>
+              <img class="reward_image" v-if="reward_info.reward_type == 5" :src="reward_info.img" />
+              <view v-else :class="['reward_image', reward_info.id == 0 ? 'noget' : reward_enum[reward_info.reward_type]]"></view>
               <view class="reward_name"> {{ reward_info.id == 0 ? '谢谢参与' : reward_info.name }}</view>
             </view>
             <view class="reward_btn" @click="closeReward">{{ reward_info.id == 0 ? '我知道了' : '开心收下' }}</view>
@@ -108,6 +109,14 @@ export default {
       reward_info: {
         id: 0,
       },
+      reward_enum: {
+        1: 'score',
+        2: 'coupon',
+        3: 'redpacket',
+        4: 'virtual_good',
+        5: 'goods',
+        6: 'others',
+      },
     };
   },
   onLoad(param) {
@@ -291,6 +300,7 @@ export default {
     },
     closeReward() {
       this.$refs.lotteryReward.close();
+      this.reward_info = {};
     },
     showRule() {
       this.$refs.lotteryRule.open('center');
@@ -638,6 +648,15 @@ export default {
         &.redpacket {
           background-image: url('https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/lottery/redpacket.png');
         }
+        &.coupon {
+          background-image: url('https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/lottery/coupon.png');
+        }
+        &.virtual_good {
+          background-image: url('https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/lottery/virtual_good.png');
+        }
+        &.others {
+          background-image: url('https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/lottery/others.png');
+        }
       }
       .reward_name {
         color: #333;

+ 26 - 22
pages/user/index.vue

@@ -57,6 +57,10 @@
         <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/article.png" mode=""></image>
         <view class="navigator_title">资讯</view>
       </navigator>
+      <!-- <navigator class="navigator_item" url="/pages/video/index">
+        <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/article.png" mode=""></image>
+        <view class="navigator_title">学习</view>
+      </navigator> -->
     </view>
     <view class="alter_info">本程序暂不提供在线交易以及支付功能,您所提交的预约,我们将验证您的购药资质并交由有售卖药品资质的商业公司与您联系确认并提供线下后续服务。</view>
     <view class="packet_content" v-if="show_packet">
@@ -71,9 +75,9 @@ export default {
   data() {
     return {
       userInfo: {
-        username: "请登录",
-        userpic: "https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png",
-        phone: "kailin",
+        username: '请登录',
+        userpic: 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png',
+        phone: 'kailin',
         status: 0,
         city_id: 0,
       },
@@ -84,36 +88,36 @@ export default {
   onLoad(param) {
     // 存储分享标识
     if (param.share_uid) {
-      uni.setStorageSync("share_uid", param.share_uid);
-      console.log("share_uid", param.share_uid);
+      uni.setStorageSync('share_uid', param.share_uid);
+      console.log('share_uid', param.share_uid);
     }
     // #ifdef MP-WEIXIN
     //分享按钮
     uni.showShareMenu({
       withShareTicket: true,
-      menus: ["shareAppMessage", "shareTimeline"],
+      menus: ['shareAppMessage', 'shareTimeline'],
     });
     // #endif
   },
   onShareAppMessage(obj) {
     //获取当前用户信息
-    let userInfo = uni.getStorageSync("userInfo");
-    let param = "";
+    let userInfo = uni.getStorageSync('userInfo');
+    let param = '';
     if (userInfo.uid) {
-      param = "?share_uid=" + userInfo.uid;
+      param = '?share_uid=' + userInfo.uid;
     }
     // 获取分享信息
     let shareList = getApp().globalData.shareList;
     // 获取分享信息
     let shareObj = {
-      title: "999智控终端平台\n药优惠 得积分 兑豪礼",
+      title: '999智控终端平台\n药优惠 得积分 兑豪礼',
       //path: '/pages/score/lottery',
-      path: "/pages/user/index",
-      imageUrl: "",
+      path: '/pages/user/index',
+      imageUrl: '',
     };
     // 循环列表
     for (let i in shareList) {
-      if (shareList[i].pages == "pages/user/index") {
+      if (shareList[i].pages == 'pages/user/index') {
         shareObj.path = shareList[i].path ? shareList[i].path : shareObj.path;
         shareObj.title = shareList[i].title ? `999智控终端平台\n${shareList[i].title}` : shareObj.title;
         shareObj.imageUrl = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl;
@@ -129,20 +133,20 @@ export default {
     // 登录提示
     if (!this.$checkAccess.alterLogin()) return;
     // 判断数据
-    this.$http.request("api/custom/get_info").then((callback) => {
-      if (callback.code == "success") {
-        if (!callback.data.userpic) callback.data.userpic = "https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png";
+    this.$http.request('api/custom/get_info').then((callback) => {
+      if (callback.code == 'success') {
+        if (!callback.data.userpic) callback.data.userpic = 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png';
         // 赋值
         this.userInfo = callback.data;
         // 存储登录标识
-        uni.setStorageSync("userInfo", callback.data);
+        uni.setStorageSync('userInfo', callback.data);
       }
     });
     this._getPacketNum();
   },
   methods: {
     _getredpacket() {
-      let url = "/pages/redpacket/list";
+      let url = '/pages/redpacket/list';
       if (this.packetList.length == 1) {
         url = `/pages/redpacket/index?packet_id=${this.packetList[0].custom_redpacket_id}`;
       }
@@ -152,18 +156,18 @@ export default {
     },
     _goWithdraw() {
       uni.navigateTo({
-        url: "/pages/user/withdraw",
+        url: '/pages/user/withdraw',
       });
     },
     _goBalance() {
       uni.navigateTo({
-        url: "/pages/balance/index",
+        url: '/pages/balance/index',
       });
     },
     //获取红包数量是否展示红包领取页面
     _getPacketNum() {
-      this.$http.request("api/redpacket/get_list").then((callback) => {
-        if (callback.code == "success") {
+      this.$http.request('api/redpacket/get_list').then((callback) => {
+        if (callback.code == 'success') {
           this.packetList = callback.data.data || [];
           if (callback.data.data.length > 0) {
             this.show_packet = true;

+ 99 - 101
pages/video/detail.vue

@@ -15,15 +15,17 @@
         @ended="_videoEnd"
         @fullscreenchange="screenChange"
       ></video>
-      <cover-view
-        v-if="videoInfo.learn_status == 0"
-        :class="bigsScreen ? 'bigScreen' : 'cover'"
-      ></cover-view>
+      <cover-view v-if="videoInfo.learn_status == 0" :class="bigsScreen ? 'bigScreen' : 'cover'"></cover-view>
     </view>
     <view class="video_title">{{ videoInfo.name }}</view>
     <view class="rich_text">
       <rich-text :nodes="videoInfo.content"></rich-text>
     </view>
+    <view class="contact_follow" v-if="videoInfo.service?.url">
+      <button class="contact_btn" @click.stop="openCustomer()">
+        <uni-icons type="headphones" size="30" color="#FFFFFF"></uni-icons>
+      </button>
+    </view>
     <uni-popup ref="questionRef" type="center" :is-mask-click="false">
       <view class="popup_content">
         <!-- 答题区域 -->
@@ -32,45 +34,22 @@
           <view class="question_content">{{ questinInfo.question_title }}</view>
           <!-- 问题选项 -->
           <view class="question_options">
-            <view
-              v-for="(option, index) in questinInfo.answer_list"
-              :key="index"
-              :class="['question_answer', { active: answer_id == option.id }]"
-              @click="_selectAnswer(option.id)"
-            >
+            <view v-for="(option, index) in questinInfo.answer_list" :key="index" :class="['question_answer', { active: answer_id == option.id }]" @click="_selectAnswer(option.id)">
               {{ option.value }}
             </view>
           </view>
-          <view
-            :class="['submit_btn', { active: answer_id }]"
-            @click="_submitAnswer"
-            >提交</view
-          >
+          <view :class="['submit_btn', { active: answer_id }]" @click="_submitAnswer">提交</view>
         </view>
         <!-- 结果区域 -->
         <view class="content" v-else>
-          <icon
-            :type="answerInfo.is_answer == 1 ? 'success' : 'cancel'"
-            size="64"
-          />
-          <view class="title">{{
-            answerInfo.is_answer == 1 ? "恭喜您,答对啦!" : "很遗憾,答错了"
-          }}</view>
-          <view class="tip">{{
-            answerInfo.is_answer == 1
-              ? "继续保持,你正在进步!"
-              : "别灰心,再接再厉!"
-          }}</view>
+          <icon :type="answerInfo.is_answer == 1 ? 'success' : 'cancel'" size="64" />
+          <view class="title">{{ answerInfo.is_answer == 1 ? '恭喜您,答对啦!' : '很遗憾,答错了' }}</view>
+          <view class="tip">{{ answerInfo.is_answer == 1 ? '继续保持,你正在进步!' : '别灰心,再接再厉!' }}</view>
           <view class="score_content">
             <view>得分</view>
-            <view
-              :style="answerInfo.get_score == 0 ? 'color:red' : 'color:green'"
-              >+{{ answerInfo.get_score }}</view
-            >
+            <view :style="answerInfo.get_score == 0 ? 'color:red' : 'color:green'">+{{ answerInfo.get_score }}</view>
           </view>
-          <view class="submit_btn active" @click="_goPlayVedio"
-            >继续学习视频</view
-          >
+          <view class="submit_btn active" @click="_goPlayVedio">继续学习视频</view>
         </view>
       </view>
     </uni-popup>
@@ -83,9 +62,9 @@ export default {
     return {
       videoInfo: {
         id: 0,
-        name: "",
-        content: "",
-        video_src: "",
+        name: '',
+        content: '',
+        video_src: '',
       },
       // 请求参数
       requestParam: {
@@ -113,43 +92,40 @@ export default {
     //分享按钮
     uni.showShareMenu({
       withShareTicket: true,
-      menus: ["shareAppMessage", "shareTimeline"],
+      menus: ['shareAppMessage', 'shareTimeline'],
     });
     // #endif
     uni.enableAlertBeforeUnload({
-      message: "您确定要退出学习吗?",
+      message: '您确定要退出学习吗?',
       success: function (res) {
-        console.log("方法注册成功:", res);
+        console.log('方法注册成功:', res);
       },
       fail: function (errMsg) {
-        console.log("方法注册失败:", errMsg);
+        console.log('方法注册失败:', errMsg);
       },
     });
   },
   onUnload() {
-    console.log("页面卸载");
+    console.log('页面卸载');
     clearInterval(this.timer);
   },
   onShareAppMessage(obj) {
     return {
       title: `999智控终端平台\n${this.videoInfo.title}`,
-      path: "/pages/video/detail?id=" + this.videoInfo.id,
+      path: '/pages/video/detail?id=' + this.videoInfo.id,
       promise: new Promise((resolve, reject) => {
         this.$http
-          .request("api/share_message/get_item", {
+          .request('api/share_message/get_item', {
             item_id: this.videoInfo.id,
-            pages: "/pages/video/detail",
+            pages: '/pages/video/detail',
           })
           .then((callback) => {
-            console.log(callback, "api/share_message/get_item");
+            console.log(callback, 'api/share_message/get_item');
             let obj = {
-              title:
-                callback.data?.title == ""
-                  ? `999智控终端平台\n${this.videoInfo.title}`
-                  : callback.data.title,
-              path: "/pages/video/detail?id=" + this.videoInfo.id,
+              title: callback.data?.title == '' ? `999智控终端平台\n${this.videoInfo.title}` : callback.data.title,
+              path: '/pages/video/detail?id=' + this.videoInfo.id,
             };
-            if (callback.data?.image_url !== "") {
+            if (callback.data?.image_url !== '') {
               obj.imageUrl = callback.data.image_url;
             }
             resolve(obj);
@@ -162,34 +138,40 @@ export default {
     // 如果存在产品ID的话
     if (this.requestParam.id > 0) {
       // 请求详情
-      this.$http
-        .request("api/video_course/get_detail", this.requestParam)
-        .then((re) => {
-          // 成功渲染数据
-          if (re.code == "success") {
-            // 刷新数据
-            this.videoInfo = re.data;
-            if (re.data.question_list) {
-              this.questionTime_list = re.data?.question_list.map(
-                (item) => item.play_time
-              );
-            }
-            // 获取视频容器的上下文
-            this.videoContext = uni.createVideoContext("myVideo");
-            // 暂停播放
-            this.videoContext.stop();
-          } else {
-            if (re.code != "no_login") {
-              uni.showModal({
-                content: re.msg,
-                showCancel: false,
-              });
-            }
+      this.$http.request('api/video_course/get_detail', this.requestParam).then((re) => {
+        // 成功渲染数据
+        if (re.code == 'success') {
+          // 刷新数据
+          this.videoInfo = re.data;
+          if (re.data.question_list) {
+            this.questionTime_list = re.data?.question_list.map((item) => item.play_time);
           }
-        });
+          // 获取视频容器的上下文
+          this.videoContext = uni.createVideoContext('myVideo');
+          // 暂停播放
+          this.videoContext.stop();
+        } else {
+          if (re.code != 'no_login') {
+            uni.showModal({
+              content: re.msg,
+              showCancel: false,
+            });
+          }
+        }
+      });
     }
   },
   methods: {
+    openCustomer() {
+      // #ifdef MP-WEIXIN
+      console.log(1);
+      wx.openCustomerServiceChat({
+        extInfo: { url: this.videoInfo.service?.url },
+        corpId: this.videoInfo.service?.corpid,
+        success(res) {},
+      });
+      // #endif
+    },
     timeUpdate(event) {
       this.currentTime = event.detail.currentTime; // 更新当前播放时间
 
@@ -204,23 +186,15 @@ export default {
           this._postVideoDuration(this.currentTime, 1);
         }
         // 判断当前时间是否接近答题时间,并且该问题尚未回答
-        if (
-          this.questionTime_list.includes(parseInt(this.currentTime) + 3) &&
-          !this.answeredQuestions.has(parseInt(this.currentTime) + 3)
-        ) {
+        if (this.questionTime_list.includes(parseInt(this.currentTime) + 3) && !this.answeredQuestions.has(parseInt(this.currentTime) + 3)) {
           this.countdown = 3;
           this._startCountdown();
         }
-        if (
-          this.questionTime_list.includes(parseInt(this.currentTime)) &&
-          !this.answeredQuestions.has(parseInt(this.currentTime))
-        ) {
-          this.questinInfo = this.videoInfo.question_list.find(
-            (item) => item.play_time == parseInt(this.currentTime)
-          );
+        if (this.questionTime_list.includes(parseInt(this.currentTime)) && !this.answeredQuestions.has(parseInt(this.currentTime))) {
+          this.questinInfo = this.videoInfo.question_list.find((item) => item.play_time == parseInt(this.currentTime));
           this.videoContext.pause();
           this.videoContext.exitFullScreen();
-          this.$refs.questionRef.open("center");
+          this.$refs.questionRef.open('center');
           //答题时间停止上报
           clearInterval(this.timer);
           this.timer = null;
@@ -228,7 +202,7 @@ export default {
       }
     },
     _videoPlay() {
-      console.log("开始播放");
+      console.log('开始播放');
       this.videoContext.requestFullScreen();
     },
     //上报视频播放时间
@@ -238,14 +212,14 @@ export default {
         this.timer = null;
       }
       this.$http
-        .request("api/video_learn_record/update_playtime", {
+        .request('api/video_learn_record/update_playtime', {
           record_id: this.videoInfo.record_id,
           video_playtime,
           status,
         })
         .then((re) => {
-          if (re.code == "success") {
-            console.log("上报成功", video_playtime, status);
+          if (re.code == 'success') {
+            console.log('上报成功', video_playtime, status);
           }
         });
     },
@@ -254,14 +228,14 @@ export default {
     },
     _submitAnswer() {
       this.$http
-        .request("api/video_learn_answer/play_exam", {
+        .request('api/video_learn_answer/play_exam', {
           record_id: this.videoInfo.record_id,
           course_id: this.questinInfo.course_id,
           question_id: this.questinInfo.question_id,
           answer_id: this.answer_id,
         })
         .then((re) => {
-          if (re.code == "success") {
+          if (re.code == 'success') {
             this.show_answer = true;
             this.answerInfo = re.data;
             // 将当前问题标记为已回答
@@ -274,8 +248,8 @@ export default {
       this.show_answer = false;
       this.$refs.questionRef.close();
       uni.showToast({
-        title: "2秒后切换横屏",
-        icon: "none",
+        title: '2秒后切换横屏',
+        icon: 'none',
         duration: 2000,
       });
       setTimeout(() => {
@@ -287,7 +261,7 @@ export default {
         if (this.countdown > 0) {
           uni.showToast({
             title: `${this.countdown}秒后进入答题`,
-            icon: "none",
+            icon: 'none',
             duration: 1000,
           });
           this.countdown--;
@@ -302,9 +276,9 @@ export default {
       this.videoContext.exitFullScreen();
       this._postVideoDuration(this.currentTime, 1);
       uni.showModal({
-        title: "学习结束",
-        content: "恭喜您学习结束,是否查看报告?",
-        cancelText: "重新学习",
+        title: '学习结束',
+        content: '恭喜您学习结束,是否查看报告?',
+        cancelText: '重新学习',
         success: (res) => {
           if (res.confirm) {
             uni.redirectTo({
@@ -323,7 +297,7 @@ export default {
     },
     screenChange(event) {
       let fullScreen = event.detail.fullScreen;
-      console.log("fullScreen", fullScreen);
+      console.log('fullScreen', fullScreen);
       this.bigsScreen = fullScreen;
     },
   },
@@ -527,4 +501,28 @@ export default {
     }
   }
 }
+.contact_follow {
+  bottom: 30%;
+  right: 20rpx;
+  width: 100rpx;
+  height: 100rpx;
+  display: block;
+  position: fixed;
+  border-radius: 50%;
+  background-color: #1296db;
+  .contact_btn {
+    border: none;
+    width: 100rpx;
+    color: #ffffff;
+    height: 100rpx;
+    padding: 0rpx 0rpx;
+    line-height: 100rpx;
+    text-align: center;
+    border-radius: 50%;
+    background-color: #1296db;
+  }
+  .contact_btn::after {
+    border: none;
+  }
+}
 </style>

+ 13 - 51
pages/video/index.vue

@@ -16,18 +16,13 @@
         </view>
         <view class="video_btn">
           <button class="after_exam" @click="goExam(item.id, item.report_id, item.learn_status)">
-            {{ item.report_id > 0 ? "查看报告" : "课后评测" }}
+            {{ item.report_id > 0 ? '查看报告' : '课后评测' }}
           </button>
           <button class="to_learn" @click.stop="goDetail(item.id)">开始学习</button>
         </view>
       </view>
     </view>
     <view class="to_bottom" v-if="!videoList.length"> -----您还没有可学习课程-----</view>
-    <view class="contact_follow">
-      <button class="contact_btn" @click.stop="openCustomer()">
-        <uni-icons type="headphones" size="30" color="#FFFFFF"></uni-icons>
-      </button>
-    </view>
   </view>
 </template>
 
@@ -59,11 +54,11 @@ export default {
     // 设置请求中
     this.isReqing = true;
     // 请求列表
-    this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+    this.$http.request('api/video_course/get_list', this.requestParam).then((re) => {
       // 设置非请求中
       this.isReqing = false;
       // 成功结果
-      if (re.code == "success") {
+      if (re.code == 'success') {
         if (re.data.last_page <= this.requestParam.page) this.isLast = true;
         this.videoList = re.data.data;
       }
@@ -79,11 +74,11 @@ export default {
     // 设置请求中
     this.isReqing = true;
     // 请求列表
-    this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+    this.$http.request('api/video_course/get_list', this.requestParam).then((re) => {
       // 设置非请求中
       this.isReqing = false;
       // 成功结果
-      if (re.code == "success") {
+      if (re.code == 'success') {
         if (re.data.last_page <= this.requestParam.page) this.isLast = true;
         this.videoList = re.data.data;
       }
@@ -102,11 +97,11 @@ export default {
     // 设置请求中
     this.isReqing = true;
     // 请求列表
-    this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+    this.$http.request('api/video_course/get_list', this.requestParam).then((re) => {
       // 设置非请求中
       this.isReqing = false;
       // 成功结果
-      if (re.code == "success") {
+      if (re.code == 'success') {
         // 数据
         if (re.data.last_page <= this.requestParam.page) this.isLast = true;
         // 追加数据
@@ -117,36 +112,27 @@ export default {
   methods: {
     goDetail(id) {
       uni.navigateTo({
-        url: "/pages/video/detail?id=" + id,
+        url: '/pages/video/detail?id=' + id,
       });
     },
-	openCustomer(){
-		// #ifdef MP-WEIXIN
-		console.log(1);
-		wx.openCustomerServiceChat({
-		  extInfo: {url: 'https://work.weixin.qq.com/kfid/kfc5de89f024f0b8678'},
-		  corpId: 'wwcdbc686326b51a89',
-		  success(res) {}
-		})
-		// #endif
-	},
+
     goExam(id, report_id, status) {
       if (status < 0) {
         uni.showToast({
-          title: "请先完成课程再来答题吧",
-          icon: "none",
+          title: '请先完成课程再来答题吧',
+          icon: 'none',
           duration: 2000,
         });
         return;
       }
       if (report_id > 0) {
         uni.navigateTo({
-          url: "/pages/video/record?type=exam&record_id=" + report_id,
+          url: '/pages/video/record?type=exam&record_id=' + report_id,
         });
         return;
       }
       uni.navigateTo({
-        url: "/pages/video/exam?id=" + id,
+        url: '/pages/video/exam?id=' + id,
       });
     },
   },
@@ -244,28 +230,4 @@ export default {
     }
   }
 }
-.contact_follow {
-  bottom: 30%;
-  right: 20rpx;
-  width: 100rpx;
-  height: 100rpx;
-  display: block;
-  position: fixed;
-  border-radius: 50%;
-  background-color: #1296db;
-  .contact_btn {
-    border: none;
-    width: 100rpx;
-    color: #ffffff;
-    height: 100rpx;
-    padding: 0rpx 0rpx;
-    line-height: 100rpx;
-    text-align: center;
-    border-radius: 50%;
-    background-color: #1296db;
-  }
-  .contact_btn::after {
-    border: none;
-  }
-}
 </style>