钱新宇 преди 2 месеца
родител
ревизия
b893e6f146
променени са 2 файла, в които са добавени 101 реда и са изтрити 56 реда
  1. 62 19
      pages/redPacket/active.vue
  2. 39 37
      pages/video/detail.vue

+ 62 - 19
pages/redPacket/active.vue

@@ -25,15 +25,12 @@
       class="active"
       v-if="pageIndex == 1"
       :style="
-        isGetReward
-          ? 'background-image:url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/get-reward-background.png)'
-          : product_list.length == 0
-          ? 'background-image:url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/no-product-background.png)'
-          : 'background-image:url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/active-background.png)'
+        product_list.length == 0
+          ? 'background-image:url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/no-product-background.png);background-size: cover;'
+          : 'background-image:url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/active-background.png);background-size: contain;'
       "
     >
-      <view class="active-text" v-if="isGetReward">{{ rewardInfo?.money || 0 }}&nbsp;<text style="font-size: 36rpx">元</text></view>
-      <view class="active_btn" v-if="!isGetReward" :style="product_list.length == 0 ? 'top:285rpx' : 'top: 280rpx'" @click="get_reward"> </view>
+      <view class="active_btn" :style="product_list.length == 0 ? 'top:442rpx' : 'top: 280rpx'" @click="get_reward"> </view>
       <view class="active_rule_btn" @click="showRule">活动规则</view>
       <view class="active_record_btn" @click="showRecord">领取记录</view>
       <view class="left-number">领取机会剩余 {{ activeInfo.number }} 次</view>
@@ -72,9 +69,26 @@
       </uni-popup>
       <uni-popup ref="rewardDialog" type="center">
         <view class="active_rule_box">
-          <view class="activity-reward">
-            <view class="reward-text">{{ rewardInfo?.money || 0 }}&nbsp;<text style="font-size: 36rpx">元</text></view>
-            <view class="reward-btn" @click="closeReward"></view>
+          <view
+            class="activity-reward"
+            :style="
+              rewardInfo.money !== 0
+                ? 'background-image: url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/reward-dialog.png);'
+                : 'background-image: url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/no_money.png)'
+            "
+          >
+            <view v-if="rewardInfo?.money !== 0" class="reward-text">{{ rewardInfo?.money || 0 }}&nbsp;<text style="font-size: 36rpx">元</text></view>
+            <view class="reward-text" style="font-size: 32rpx">手气不是很好</view>
+
+            <view
+              class="reward-btn"
+              :style="
+                rewardInfo.money !== 0
+                  ? 'background-image: url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/happy-get.png)'
+                  : 'background-image: url(https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/no_money_btn.png)'
+              "
+              @click="closeReward"
+            ></view>
           </view>
           <view class="close-btn" @click="closeReward"></view>
         </view>
@@ -121,7 +135,6 @@ export default {
       pageIndex: 0,
       product_list: [],
       rewardInfo: {},
-      isGetReward: false, //记录本次是否领取
       recordList: [],
     };
   },
@@ -278,8 +291,38 @@ export default {
       this.$refs.rewardDialog.open('center');
     },
     closeReward() {
-      this.isGetReward = true;
       this.$refs.rewardDialog.close();
+      // 如果存在产品ID的话
+      if (this.requestParam?.id > 0) {
+        // 设置请求中
+        this.isReqing = true;
+        // 请求
+        this.$http.request('api/redpacket_active/get_detail', this.requestParam).then((re) => {
+          // 设置非请求中
+          this.isReqing = false;
+          // 成功结果
+          if (re.code == 'success') {
+            this.activeInfo = re.data;
+            this.prizeList = re.data.reward_list;
+
+            this.product_list = Object.values(re.data.product_list || {});
+
+            this._getRecordList();
+          } else {
+            if (re.code != 'no_login') {
+              uni.showModal({
+                content: re.msg,
+                showCancel: false,
+              });
+            }
+          }
+        });
+      } else {
+        uni.showModal({
+          content: '未知的活动ID',
+          showCancel: false,
+        });
+      }
     },
     closeRecord() {
       this.$refs.activeRecord.close();
@@ -308,6 +351,8 @@ export default {
   box-sizing: border-box;
   position: relative;
   height: 100vh;
+  display: flex;
+  flex-direction: column;
   .activity-info {
     padding-top: 60rpx;
     display: flex;
@@ -408,15 +453,16 @@ export default {
     }
   }
   .active {
-    background-size: contain;
+    background-size: cover;
     background-repeat: no-repeat;
     width: 100vw;
-    min-height: 100vh;
     position: relative;
     background-color: #db1101;
     padding: 0 32rpx;
     box-sizing: border-box;
     padding-top: 702rpx;
+    flex: 1;
+    padding-bottom: 32rpx;
     .left-number {
       position: absolute;
       width: 100%;
@@ -460,8 +506,7 @@ export default {
       line-height: 60rpx;
     }
     .active_record_btn {
-      left: 0rpx;
-      border-radius: 0 500rpx 500rpx 0;
+      top: 120rpx;
     }
     .active_rule_box {
       display: flex;
@@ -469,7 +514,6 @@ export default {
       justify-content: center;
       align-items: center;
       .activity-reward {
-        background-image: url('https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/reward-dialog.png');
         background-repeat: no-repeat;
         background-size: 100% 100%;
         width: 671rpx;
@@ -484,7 +528,6 @@ export default {
           text-align: center;
         }
         .reward-btn {
-          background-image: url('https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/redpacket/happy-get.png');
           background-repeat: no-repeat;
           background-size: 100% 100%;
           width: 258rpx;
@@ -507,7 +550,7 @@ export default {
         box-sizing: border-box;
       }
       .product_list {
-        display: block;
+        display: flex;
         overflow: hidden;
         margin: 0rpx auto;
         .product_item {

+ 39 - 37
pages/video/detail.vue

@@ -97,6 +97,44 @@ export default {
   onLoad(param) {
     // 参数接收
     this.requestParam.id = param.id;
+    // 如果存在产品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();
+          // #ifdef MP-WEIXIN
+          uni.enableAlertBeforeUnload({
+            message: '您确定要退出学习吗?',
+            success: function (res) {
+              console.log('方法注册成功:', res);
+            },
+            fail: function (errMsg) {
+              console.log('方法注册失败:', errMsg);
+            },
+          });
+          // #endif
+        } else {
+          if (re.code != 'no_login') {
+            this.isVip = false;
+            _isVip = false;
+            // uni.showModal({
+            //   content: re.msg,
+            //   showCancel: false,
+            // });
+          }
+        }
+      });
+    }
     // #ifdef MP-WEIXIN
     //分享按钮
     uni.showShareMenu({
@@ -104,15 +142,6 @@ export default {
       menus: ['shareAppMessage', 'shareTimeline'],
     });
     // #endif
-    uni.enableAlertBeforeUnload({
-      message: '您确定要退出学习吗?',
-      success: function (res) {
-        console.log('方法注册成功:', res);
-      },
-      fail: function (errMsg) {
-        console.log('方法注册失败:', errMsg);
-      },
-    });
   },
   onUnload() {
     console.log('页面卸载');
@@ -143,34 +172,7 @@ export default {
     };
   },
   onReady: function (res) {},
-  onShow() {
-    // 如果存在产品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') {
-            this.isVip = false;
-            // uni.showModal({
-            //   content: re.msg,
-            //   showCancel: false,
-            // });
-          }
-        }
-      });
-    }
-  },
+  onShow() {},
   methods: {
     openCustomer() {
       // #ifdef MP-WEIXIN