qianxinyu 3 月之前
父节点
当前提交
e72b5a18e7
共有 2 个文件被更改,包括 35 次插入33 次删除
  1. 20 19
      pages/recruitment/index.vue
  2. 15 14
      pages/score/lottery.vue

+ 20 - 19
pages/recruitment/index.vue

@@ -3,7 +3,7 @@
     <view class="main_view">
       <image v-if="action_info.banner_img" :src="action_info.banner_img" class="banner_img"></image>
       <view class="active_title"> 活动内容 </view>
-      <view class="clockin_box" v-if="active_rule.length > 0">
+      <view class="clockin_box" v-if="active_rule?.length > 0">
         <view class="box_title"> 邀请好友成功注册,即可获得奖励 </view>
         <view class="box_time_text"> 三步奖励到账 </view>
         <view class="box_text">
@@ -65,27 +65,28 @@ export default {
       param = "?share_uid=" + userInfo.uid;
     }
     console.log(222, param);
-    // 获取分享信息
-    let shareList = getApp().globalData.shareList;
-    // 获取分享信息
-    let shareObj = {
+    // 返回分享信息
+    return {
       title: "999智控终端平台\n药优惠 得积分 兑豪礼",
       path: "/pages/recruitment/index",
       imageUrl: "",
+      promise: new Promise((resolve, reject) => {
+        this.$http.request("api/share_message/get_item", { item_id: this.action_info.id, pages: "/pages/recruitment/index" }).then((callback) => {
+          console.log(callback, "api/share_message/get_item");
+          let obj = {
+            title: callback.data?.title == "" ? "999智控终端平台\n药优惠 得积分 兑豪礼" : callback.data.title,
+            path: "/pages/recruitment/index",
+          };
+          if (callback.data?.image_url !== "") {
+            obj.imageUrl = callback.data.image_url;
+          }
+          if (param) {
+            obj.path += param;
+          }
+          resolve(obj);
+        });
+      }),
     };
-    // 循环列表
-    for (let i in shareList) {
-      if (shareList[i].pages == "pages/recruitment/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;
-      }
-    }
-    if (param) {
-      shareObj.path += param;
-    }
-    // 返回分享信息
-    return shareObj;
   },
   onShow() {
     // 登录提示
@@ -102,7 +103,7 @@ export default {
       if (re.code == "success") {
         this.action_info = re.data;
         this.active_rule = this.action_info.active_rule;
-        console.log(this.action_info.length);
+        console.log(this.action_info?.length);
       }
     });
   },

+ 15 - 14
pages/score/lottery.vue

@@ -139,24 +139,25 @@ export default {
     // #endif
   },
   onShareAppMessage(obj) {
-    // 获取分享信息
-    let shareList = getApp().globalData.shareList;
-    // 获取分享信息
-    let shareObj = {
+    // 返回分享信息
+    return {
       title: "999智控终端平台\n药优惠 得积分 兑豪礼",
       path: "/pages/score/lottery",
       imageUrl: "",
+      promise: new Promise((resolve, reject) => {
+        this.$http.request("api/share_message/get_item", { item_id: this.lotteryInfo.id, pages: "/pages/score/lottery" }).then((callback) => {
+          console.log(callback, "api/share_message/get_item");
+          let obj = {
+            title: callback.data?.title == "" ? "999智控终端平台\n药优惠 得积分 兑豪礼" : callback.data.title,
+            path: "/pages/score/lottery",
+          };
+          if (callback.data?.image_url !== "") {
+            obj.imageUrl = callback.data.image_url;
+          }
+          resolve(obj);
+        });
+      }),
     };
-    // 循环列表
-    for (let i in shareList) {
-      if (shareList[i].pages == "pages/score/lottery") {
-        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;
-      }
-    }
-    // 返回分享信息
-    return shareObj;
   },
   onShow() {
     // 没有数据的话,或者请求中,不允许刷新