liyongli 2 rokov pred
rodič
commit
a1ee75dc39

+ 46 - 47
src/view/SilkRoadSpringFestivalGala/pages/eight.vue

@@ -80,6 +80,27 @@
         src="https://cxzx.smcic.net/topic/tool/img/videoImg.jpg"
       />
     </div>
+
+    <van-dialog
+      :before-close="before"
+      v-model:show="gift.show"
+      :title="'获得'+gift.name"
+      show-cancel-button
+    >
+      <img :src="show.url" style="width: 5em" />
+      <van-field
+        required
+        v-model="address"
+        label="地址"
+        placeholder="请输入地址"
+      />
+      <van-field
+        required
+        v-model="nickName"
+        label="昵称"
+        placeholder="请输入昵称"
+      />
+    </van-dialog>
   </div>
 </template>
 <script setup>
@@ -119,6 +140,7 @@ const img = reactive({
 });
 
 let T = undefined;
+const gift = ref({});
 function draw() {
   const phone = localStorage.getItem("silkRoadPhone");
   if (!phone) return emits("showTitleFunc");
@@ -127,7 +149,9 @@ function draw() {
     getDrawOri({
       phone,
       code: window.$shanshipin && window.$shanshipin.UserId ? 76767676 : "",
-    }).then(r => {
+    }).then(res => {
+      const r = res || {};
+      console.log("-------->", r);
       let isdraw = r.prizeId !== 1; // 接入接口后直接由接口提供是否中将
       if (!isdraw)
         return showDialog({
@@ -135,66 +159,41 @@ function draw() {
           message:
             "很遗憾哟,新年礼物擦肩而过啦!点击下方刷个小视频吧,给手气充能,获取额外抽奖机会!",
         });
-      const field = (
-        <van-field
-          required
-          v-model={address.value}
-          label="地址"
-          placeholder="请输入地址"
-        />
-      );
-      const nickNameEle = (
-        <van-field
-          required
-          v-model={nickName.value}
-          label="昵称"
-          placeholder="请输入昵称"
-        />
-      );
-      showConfirmDialog({
-        title: "获得" + r.name,
-        message: () => {
-          return (
-            <div>
-              <img src={r.url} style="width: 5em" />
-              { nickNameEle }
-              {field}
-            </div>
-          );
-        },
-        showCancelButton: false,
-        beforeClose: type => {
-          if (type !== "confirm") return true;
-          getUpdateOri({
-            phone: localStorage.getItem("silkRoadPhone"),
-            userName: phone,
-            addr: address.value,
-          }).then(() => {
-            localStorage.setItem("silkRoadAddress", address.value);
-            localStorage.setItem("silkRoadName", nickName.value);
-            showToast("奖品已打包,静等您收货哦!");
-          });
-          return true;
-        },
-      });
+      gift.value.url = r.url;
+      gift.value.name = r.name;
+      gift.value.show = true;
     });
   }, 200);
 }
 
+function before(type) {
+  if (type !== "confirm") return true;
+  const phone = localStorage.getItem("silkRoadPhone");
+  getUpdateOri({
+    phone: localStorage.getItem("silkRoadPhone"),
+    userName: phone,
+    addr: address.value,
+  }).then(() => {
+    localStorage.setItem("silkRoadAddress", address.value);
+    localStorage.setItem("silkRoadName", nickName.value);
+    showToast("奖品已打包,静等您收货哦!");
+  });
+  return true;
+}
+
 function mygift() {
   getGiftList({
     phone: localStorage.getItem("silkRoadPhone"),
   }).then(r => {
-    console.log(r);
     const giftList = r || [];
     const cardList = [];
     for (let i = 0; i < giftList.length; i++) {
       const v = giftList[i];
       cardList.push(
         <van-card
-          num={ v.winNum || 1 }
-          title={ v.name || ""}
-          thumb={ v.url || ""}
+          num={v.winNum || 1}
+          title={v.name || ""}
+          thumb={v.url || ""}
         />
       );
     }