Browse Source

抽盒机,last锁相完善

chenrong 1 year ago
parent
commit
40aa98ef14

+ 8 - 0
api/drawCard.js

@@ -104,3 +104,11 @@ export function getLockInfoApi(data) {
     data: data,
   })
 }
+// 箱中盒子列表
+export function getBoxList(data) {
+  return request({
+    url: '/wx/bkm/boxExtractor/box/list',
+    method: 'get',
+    data: data,
+  })
+}

+ 244 - 231
pages.json

@@ -1,232 +1,245 @@
 {
-  "window": {
-    "initialRenderingCache": "dynamic"
-  },
-  "pages": [
-    {
-      "path": "pages/index/index",
-      "style": {
-        "navigationBarTitleText": "宝可梦"
-      }
-    },
-    {
-      "path": "pages/index2/index",
-      "style": {
-        "navigationBarTitleText": "宝可梦",
-        //  自定义导航栏
-        "navigationStyle": "custom"
-      }
-    },
-    {
-      "path": "pages/mine/mine",
-      "style": {
-        "navigationBarTitleText": "我的",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/shoppingMall/shoppingMall",
-      "style": {
-        "navigationBarTitleText": "积分商城",
-        "enablePullDownRefresh": false,
-        "navigationBarBackgroundColor": "#171520",
-        "navigationBarTextStyle": "white"
-      }
-    },
-    {
-      "path": "pages/knapsack/knapsack",
-      "style": {
-        "navigationBarTitleText": "背包",
-        "enablePullDownRefresh": false
-      }
-    },
-    //给tab页的背包
-    {
-      "path": "pages/knapsackTab/knapsack",
-      "style": {
-        "navigationBarTitleText": "背包",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/addressManage/addressManage",
-      "style": {
-        "navigationBarTitleText": "我的收货地址",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/login/login",
-      "style": {
-        "navigationBarTitleText": "授权登录",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/addressEdit/addressEdit",
-      "style": {
-        "navigationBarTitleText": "新增收货地址",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/invite/invite",
-      "style": {
-        "navigationBarTitleText": "邀请好友",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/excellentValue/excellentValue",
-      "style": {
-        "navigationBarTitleText": "超值挑战",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/drawCard_first/drawCard_first",
-      "style": {
-        "navigationBarTitleText": "FIRST赏",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/winningRecord/winningRecord",
-      "style": {
-        "navigationBarTitleText": "中奖记录",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/orderConfirm/orderConfirm",
-      "style": {
-        "navigationBarTitleText": "订单确认",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/coupon/coupon",
-      "style": {
-        "navigationBarTitleText": "我的优惠券",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/rule/rule",
-      "style": {
-        "navigationBarTitleText": "规则与说明",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/user/user",
-      "style": {
-        "navigationBarTitleText": "编辑个人资料",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/raffle/raffle",
-      "style": {
-        "navigationBarTitleText": "抽赏",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/drawCard_last/drawCard_last",
-      "style": {
-        "navigationBarTitleText": "LAST赏",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/message/message",
-      "style": {
-        "navigationBarTitleText": "消息",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/user/editUser/editUser",
-      "style": {
-        "navigationBarTitleText": "编辑个人信息",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/consumptionRecords/consumptionRecords",
-      "style": {
-        "navigationBarTitleText": "消费记录",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/drawCard_fullSet/drawCard_fullSet",
-      "style": {
-        "navigationBarTitleText": "全套赏",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/drawCard_fullSet/winningList",
-      "style": {
-        "navigationBarTitleText": "开奖记录",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/drawCard_fullSet/goods",
-      "style": {
-        "navigationBarTitleText": "奖品预览",
-        "enablePullDownRefresh": false
-      }
-    },
-    {
-      "path": "pages/drawCard_infinite/drawCard_infinite",
-      "style": {
-        "navigationBarTitleText": "无限赏",
-        "enablePullDownRefresh": false
-      }
-    }
-  ],
-  "globalStyle": {
-    "navigationBarTextStyle": "black",
-    "navigationBarTitleText": "uni-app",
-    "navigationBarBackgroundColor": "#F8F8F8",
-    "backgroundColor": "#F8F8F8",
-    "app-plus": {
-      "background": "#efeff4"
-    }
-  },
-  "tabBar": {
-    "color": "#B4C9DA",
-    "selectedColor": "#FBB434",
-    "height": "220px",
-    "list": [
-      {
-        "pagePath": "pages/index/index",
-        "iconPath": "/static/img/tabBar1.png",
-        "selectedIconPath": "/static/img/tabBar1_s.png",
-        "text": "首页"
-      },
-      {
-        "pagePath": "pages/shoppingMall/shoppingMall",
-        "iconPath": "/static/img/tabBar2.png",
-        "selectedIconPath": "/static/img/tabBar2_s.png",
-        "text": "商城"
-      },
-      {
-        "pagePath": "pages/knapsackTab/knapsack",
-        "iconPath": "/static/img/tabBar3.png",
-        "selectedIconPath": "/static/img/tabBar3_s.png",
-        "text": "背包"
-      },
-      {
-        "pagePath": "pages/mine/mine",
-        "iconPath": "/static/img/tabBar4.png",
-        "selectedIconPath": "/static/img/tabBar4_s.png",
-        "text": "我的"
-      }
-    ]
-  }
-}
+	"window": {
+		"initialRenderingCache": "dynamic"
+	},
+	"pages": [{
+			"path": "pages/index/index",
+			"style": {
+				"navigationBarTitleText": "宝可梦"
+			}
+		},
+		{
+			"path": "pages/index2/index",
+			"style": {
+				"navigationBarTitleText": "宝可梦",
+				//  自定义导航栏
+				"navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/mine/mine",
+			"style": {
+				"navigationBarTitleText": "我的",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/shoppingMall/shoppingMall",
+			"style": {
+				"navigationBarTitleText": "积分商城",
+				"enablePullDownRefresh": false,
+				"navigationBarBackgroundColor": "#171520",
+				"navigationBarTextStyle": "white"
+			}
+		},
+		{
+			"path": "pages/knapsack/knapsack",
+			"style": {
+				"navigationBarTitleText": "背包",
+				"enablePullDownRefresh": false
+			}
+		},
+		//给tab页的背包
+		{
+			"path": "pages/knapsackTab/knapsack",
+			"style": {
+				"navigationBarTitleText": "背包",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/addressManage/addressManage",
+			"style": {
+				"navigationBarTitleText": "我的收货地址",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/login/login",
+			"style": {
+				"navigationBarTitleText": "授权登录",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/addressEdit/addressEdit",
+			"style": {
+				"navigationBarTitleText": "新增收货地址",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/invite/invite",
+			"style": {
+				"navigationBarTitleText": "邀请好友",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/excellentValue/excellentValue",
+			"style": {
+				"navigationBarTitleText": "超值挑战",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/drawCard_first/drawCard_first",
+			"style": {
+				"navigationBarTitleText": "FIRST赏",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/winningRecord/winningRecord",
+			"style": {
+				"navigationBarTitleText": "中奖记录",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/orderConfirm/orderConfirm",
+			"style": {
+				"navigationBarTitleText": "订单确认",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/coupon/coupon",
+			"style": {
+				"navigationBarTitleText": "我的优惠券",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/rule/rule",
+			"style": {
+				"navigationBarTitleText": "规则与说明",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/user/user",
+			"style": {
+				"navigationBarTitleText": "编辑个人资料",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/raffle/raffle",
+			"style": {
+				"navigationBarTitleText": "抽赏",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/drawCard_last/drawCard_last",
+			"style": {
+				"navigationBarTitleText": "LAST赏",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/message/message",
+			"style": {
+				"navigationBarTitleText": "消息",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/user/editUser/editUser",
+			"style": {
+				"navigationBarTitleText": "编辑个人信息",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/consumptionRecords/consumptionRecords",
+			"style": {
+				"navigationBarTitleText": "消费记录",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/drawCard_fullSet/drawCard_fullSet",
+			"style": {
+				"navigationBarTitleText": "全套赏",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/drawCard_fullSet/winningList",
+			"style": {
+				"navigationBarTitleText": "开奖记录",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/drawCard_fullSet/goods",
+			"style": {
+				"navigationBarTitleText": "奖品预览",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/drawCard_infinite/drawCard_infinite",
+			"style": {
+				"navigationBarTitleText": "无限赏",
+				"enablePullDownRefresh": false
+			}
+		}, {
+			"path": "pages/drawCard_box/drawCard_box",
+			"style": {
+				"navigationBarTitleText": "抽盒机",
+				"enablePullDownRefresh": false
+			}
+
+		},
+		{
+			"path": "pages/drawCard_box/drawCard_boxDetail",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		}
+	],
+	"globalStyle": {
+		"navigationBarTextStyle": "black",
+		"navigationBarTitleText": "uni-app",
+		"navigationBarBackgroundColor": "#F8F8F8",
+		"backgroundColor": "#F8F8F8",
+		"app-plus": {
+			"background": "#efeff4"
+		}
+	},
+	"tabBar": {
+		"color": "#B4C9DA",
+		"selectedColor": "#FBB434",
+		"height": "220px",
+		"list": [{
+				"pagePath": "pages/index/index",
+				"iconPath": "/static/img/tabBar1.png",
+				"selectedIconPath": "/static/img/tabBar1_s.png",
+				"text": "首页"
+			},
+			{
+				"pagePath": "pages/shoppingMall/shoppingMall",
+				"iconPath": "/static/img/tabBar2.png",
+				"selectedIconPath": "/static/img/tabBar2_s.png",
+				"text": "商城"
+			},
+			{
+				"pagePath": "pages/knapsackTab/knapsack",
+				"iconPath": "/static/img/tabBar3.png",
+				"selectedIconPath": "/static/img/tabBar3_s.png",
+				"text": "背包"
+			},
+			{
+				"pagePath": "pages/mine/mine",
+				"iconPath": "/static/img/tabBar4.png",
+				"selectedIconPath": "/static/img/tabBar4_s.png",
+				"text": "我的"
+			}
+		]
+	}
+}

+ 209 - 0
pages/drawCard_box/drawCard_box.vue

@@ -0,0 +1,209 @@
+<template>
+  <view class="container">
+    <view class="title">
+      {{ detail.name }}
+    </view>
+    <view class="boxsBr">
+      <view class="boxs">
+        <view class="box" v-for="(item, index) in bosList" @click="toDrawCard_boxDetail(item)">
+          <span v-if="item.boxLeft == 0">已抽完</span>
+          <span v-if="item.boxLeft != 0 && item.boxStatus == 1">已爆头</span>
+        </view>
+      </view>
+    </view>
+    <view class="number">{{ num }} / {{ detail.roundNum }} 箱</view>
+    <view class="buttons">
+      <view class="button" @click="boxChange(-1)">上一箱</view>
+      <view class="button" @click="boxChange(1)">下一箱</view>
+    </view>
+
+    <view class="buttons">
+      <view class="button" @click="toKnapsack">背包</view>
+      <view class="button" @click="toWinningRecord">中奖记录</view>
+    </view>
+    <view class="rightButtons">
+      <view class="button">规则</view>
+    </view>
+  </view>
+</template>
+
+<script>
+import { raffleDetailApi, getBoxList } from '@/api/drawCard.js'
+export default {
+  data() {
+    return {
+      raffleId: null,
+      detail: null,
+      num: 1,
+      bosList: [],
+    }
+  },
+  onLoad(query) {
+    if (query.id) {
+      this.raffleId = query.id
+      this.init()
+    }
+  },
+  methods: {
+    init() {
+      // 获取抽盒机详情
+      this.getDetail()
+      //获取盒子列表
+      this.getBoxs()
+    },
+    getDetail() {
+      let params = {
+        raffleId: this.raffleId,
+      }
+      raffleDetailApi(params).then(res => {
+        console.log(res, '详情')
+        this.detail = res.data
+      })
+    },
+    boxChange(value) {
+      let num = this.num + value
+      console.log(num, 'num')
+      if (num > 0 && num <= this.detail.roundNum) {
+        this.num = num
+        this.getBoxs()
+      } else {
+        wx.showToast({
+          title: '没有更多',
+          icon: 'none',
+        })
+      }
+    },
+    getBoxs() {
+      let params = {
+        raffleId: this.raffleId,
+        roundId: this.num,
+      }
+      getBoxList(params).then(res => {
+        console.log(res, 'res盒子数量')
+        this.bosList = res.data
+      })
+    },
+    toKnapsack() {
+      // 跳转背包界面
+      wx.navigateTo({
+        url: '/pages/knapsack/knapsack',
+      })
+    },
+    toWinningRecord() {
+      let params = {
+        raffleId: this.raffleId,
+      }
+      this.$navigateTo('/pages/winningRecord/winningRecord', params)
+    },
+    toDrawCard_boxDetail(item) {
+      let params = {
+        raffleId: this.raffleId, //抽盒机id
+        roundId: this.num, //箱id
+        boxId: item.boxId, //盒id
+      }
+      this.$navigateTo('/pages/drawCard_box/drawCard_boxDetail', params)
+    },
+  },
+}
+</script>
+
+<style scoped lang="scss">
+.container {
+  background: #9ec8f9;
+  overflow: inherit;
+
+  .title {
+    padding: 20px 0;
+    text-align: center;
+    font-weight: 600;
+  }
+  .boxsBr {
+    margin: 20vw auto 0 auto;
+    width: 70vw;
+    height: 70vw;
+    background: linear-gradient(180deg, #f29b9b 0%, #e5bfb9 100%);
+    border-radius: 8px 8px 8px 8px;
+    padding: 4px;
+
+    .boxs {
+      width: 100%;
+      height: 100%;
+      background: linear-gradient(180deg, #829bfb 0%, #9cdbfc 100%);
+      border-radius: 6px;
+      display: grid;
+      grid-template-columns: 1fr 1fr 1fr;
+      grid-template-rows: 1fr 1fr 1fr;
+      grid-gap: 2px;
+
+      .box {
+        background: linear-gradient(139deg, #a292e9 0%, #a0dfff 100%);
+        border-radius: 4px 4px 4px 4px;
+        opacity: 1;
+        border: 1px solid #ffffff;
+        display: inline-flex;
+        justify-content: center;
+        align-items: center;
+        color: #ffffff;
+        text-shadow: 2px 2px 2px #829bfb;
+        font-weight: 600;
+      }
+    }
+  }
+
+  .number {
+    margin-top: 8vw;
+    text-align: center;
+    color: #ffffff;
+    text-shadow: 2px 2px 2px #829bfb;
+    font-weight: 600;
+  }
+
+  .buttons {
+    margin-top: 10px;
+    display: flex;
+    justify-content: space-around;
+
+    .button {
+      color: #fff;
+      font-weight: 600;
+      background: linear-gradient(180deg, #89a9fa 0%, #716ff5 100%);
+      height: 40px;
+      border-radius: 20px;
+      padding: 0 30px;
+      line-height: 40px;
+      width: 20vw;
+      text-align: center;
+    }
+
+    .button1 {
+      width: 25vw;
+    }
+
+    .button2 {
+      width: 35vw;
+      margin-bottom: 5px;
+    }
+  }
+
+  .rightButtons {
+    position: fixed;
+    right: 0;
+    width: 50px;
+    height: 70vh;
+    top: 50%;
+    transform: translateY(-50%);
+
+    .button {
+      position: absolute;
+      right: 0;
+      background: rgba(255, 255, 255, 0.7);
+      font-size: 10px;
+      text-align: center;
+      height: 24px;
+      line-height: 24px;
+      border-radius: 12px 0 0 12px;
+      width: 46px;
+    }
+  }
+}
+</style>

+ 39 - 0
pages/drawCard_box/drawCard_boxDetail.vue

@@ -0,0 +1,39 @@
+<template>
+  <view class="container">
+    <view class="rightButtons">
+      <view class="button">规则</view>
+      <view class="button" @click="toKnapsack" style="top: 44px">背包</view>
+      <view class="button" @click="toWinningRecord" style="bottom: 0">中奖记录</view>
+    </view>
+  </view>
+</template>
+
+<script></script>
+
+<style scoped lang="scss">
+.container {
+  background: #9ec8f9;
+  overflow: inherit;
+
+  .rightButtons {
+    position: fixed;
+    right: 0;
+    width: 50px;
+    height: 70vh;
+    top: 50%;
+    transform: translateY(-50%);
+
+    .button {
+      position: absolute;
+      right: 0;
+      background: rgba(255, 255, 255, 0.7);
+      font-size: 10px;
+      text-align: center;
+      height: 24px;
+      line-height: 24px;
+      border-radius: 12px 0 0 12px;
+      width: 46px;
+    }
+  }
+}
+</style>

+ 4 - 4
pages/drawCard_infinite/drawCard_infinite.vue

@@ -9,7 +9,7 @@
         <view class="row">
           <view class="price">
             ¥{{ detail.price }}
-            <span class="text">/张明信片</span>
+            <span class="text fontPFR">/张明信片</span>
           </view>
           <image
             @click="$navigateTo('/pages/rule/rule', { type: 1 })"
@@ -34,7 +34,7 @@
       <div class="flex items-center" @click="showList">
         <img src="https://file.rongcyl.cn/festatic/bkm/ouking_a.png" class="w-10 h-10" />
         <div class="ml-1">
-          <div class="bold" style="font-size: 15px">欧王奖励</div>
+          <div class="fontPFSCS" style="font-size: 15px">欧王奖励</div>
           <div style="font-size: 12px">{{ ouCount }}届欧王</div>
         </div>
       </div>
@@ -46,7 +46,7 @@
         />
         <img src="https://file.rongcyl.cn/festatic/bkm/x.png" class="w-10 h-10" v-else />
         <div class="ml-1" :style="{ color: detail.subType.includes('111') ? '' : '#a9bcd1' }">
-          <div class="bold" style="font-size: 15px">随机掉落</div>
+          <div class="fontPFSCS" style="font-size: 15px">随机掉落</div>
           <div style="font-size: 12px">未开启</div>
         </div>
       </div>
@@ -58,7 +58,7 @@
         />
         <img src="https://file.rongcyl.cn/festatic/bkm/free.png" class="w-10 h-10" v-else />
         <div class="ml-1" :style="{ color: detail.subType.includes('112') ? '' : '#a9bcd1' }">
-          <div class="bold" style="font-size: 15px">随机免单</div>
+          <div class="fontPFSCS" style="font-size: 15px">随机免单</div>
           <div style="font-size: 12px">未开启</div>
         </div>
       </div>

+ 46 - 25
pages/drawCard_last/drawCard_last.vue

@@ -62,7 +62,7 @@
       <image @click="toWinningRecord" class="button1" :src="$fileUrl() + '/first/button3.png'" mode="widthFix"></image>
     </view>
     <view class="lockBox">
-      <view class="text" v-if="false">本福袋连续购买10发,即开启保护机制</view>
+      <view class="text" v-if="!lockData.userId">本福袋连续购买10发,即开启保护机制</view>
       <view class="info" v-else>
         <image class="photo" :src="lockData.userAvtar" mode="aspectFill"></image>
         <view class="right">
@@ -157,13 +157,10 @@ export default {
     this.paymentSuccess()
   },
   onHide() {
-    // 离开页面
-    // 关闭倒计时
-    clearInterval(this.lockTimeCountdown)
-    // 关闭心跳
-    clearInterval(this.socketTimer)
-    // 关闭对话连接
-    wx.closeSocket()
+    this.leave()
+  },
+  onUnload() {
+    this.leave()
   },
   computed: {
     // 锁箱小时
@@ -201,6 +198,16 @@ export default {
       // 连接锁箱Socket
       this.connectSocket()
     },
+    leave() {
+      console.log('离开页面')
+      // 离开页面
+      // 关闭倒计时
+      clearInterval(this.lockTimeCountdown)
+      // 关闭心跳测试
+      clearInterval(this.socketTimer)
+      // 关闭对话连接
+      wx.closeSocket()
+    },
     initLock() {
       // 获取锁箱信息
       let _this = this
@@ -212,21 +219,31 @@ export default {
         if (res.data.userId) {
           _this.lockData = res.data
           _this.lockTime = res.data.expireTime
-
-          if (_this.lockTimeCountdown) {
-            clearInterval(_this.lockTimeCountdown)
-            _this.lockTimeCountdown = null
-          }
-
-          _this.lockTimeCountdown = setInterval(() => {
-            _this.lockTime = _this.lockTime - 1
-          }, 1000)
+          _this.initLockTimeCountdown()
+        } else {
+          _this.lockData = {}
+          _this.lockTime = ''
         }
       })
     },
-    connectSocket() {
-      // wss://mall.rongtongh.cn/websocket/raffleId38:uuid1122
+    initLockTimeCountdown() {
+      let _this = this
+      if (_this.lockTimeCountdown) {
+        clearInterval(_this.lockTimeCountdown)
+        _this.lockTimeCountdown = null
+      }
 
+      _this.lockTimeCountdown = setInterval(() => {
+        console.log('22')
+        _this.lockTime = _this.lockTime - 1
+        if (_this.lockTime <= 0) {
+          clearInterval(_this.lockTimeCountdown)
+          _this.lockTimeCountdown = null
+          _this.initLock()
+        }
+      }, 1000)
+    },
+    connectSocket() {
       let _this = this
       let uuid = uuidv4()
       let url = 'wss://mall.rongtongh.cn/websocket/raffleId' + this.params.raffleId + ':' + uuid
@@ -242,16 +259,20 @@ export default {
           // 	data: JSON.stringify(user),
           // })
           _this.socketTimer = setInterval(function () {
+            console.log('发送消息')
             wx.sendSocketMessage({
-              data: '1',
+              data: '12313',
             })
-          }, 50 * 1000)
+          }, 30 * 1000)
         })
         wx.onSocketMessage(function (res) {
-          let data = JSON.parse(res.data)
           console.log(data, 'WebSocket接受信息')
-          _this.lockData = res.data
-          _this.lockTime = res.data.expireTime
+          let data = JSON.parse(res.data)
+          if (res.data.userId) {
+            _this.lockData = data
+            _this.lockTime = data.expireTime
+            _this.initLockTimeCountdown()
+          }
         })
         wx.onSocketClose(function (res) {
           console.log('WebSocket连接已关闭!')
@@ -316,7 +337,7 @@ export default {
     },
     submit() {
       // 购买时判断锁箱
-      if (this.lockData.userId && this.userId != this.lockData) {
+      if (this.lockData?.userId && this.userId != this.lockData.userId) {
         wx.showToast({
           title: '锁箱中无法购买。',
           icon: 'none',

+ 1 - 1
pages/raffle/raffle.vue

@@ -137,7 +137,7 @@ export default {
       } else if (this.tabActive == 3) {
         url = '/pages/drawCard_fullSet/drawCard_fullSet'
       } else if (this.tabActive == 4) {
-        url = '/pages/drawCard_fullSet/drawCard_fullSet'
+        url = '/pages/drawCard_box/drawCard_box'
       }
       this.$navigateTo(url, params)
     },