فهرست منبع

用户模板消息订阅

15102826049 1 ماه پیش
والد
کامیت
a3da924487
2فایلهای تغییر یافته به همراه25 افزوده شده و 18 حذف شده
  1. 11 9
      dist/dev/mp-weixin/pagesOne/winner/uploadImage.js
  2. 14 9
      src/pagesOne/winner/uploadImage.vue

+ 11 - 9
dist/dev/mp-weixin/pagesOne/winner/uploadImage.js

@@ -65,15 +65,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           common_vendor.wx$1.requestSubscribeMessage({
             tmplIds: ["ZZhiUAFnGXkIIIId6W9mBbf16DGC-OtX1sT_d5TWNUU"],
             success(response) {
-              services_ams.subscribeToMessage(openid).then((res2) => {
-                if (res2.code === 200) {
-                  common_vendor.index.showToast({ title: "订阅成功", icon: "success" });
-                  common_vendor.index.navigateBack();
-                } else {
-                  common_vendor.index.showToast({ title: "订阅失败", icon: "error" });
-                  common_vendor.index.navigateBack();
-                }
-              });
+              if (response["ZZhiUAFnGXkIIIId6W9mBbf16DGC-OtX1sT_d5TWNUU"] === "accept") {
+                services_ams.subscribeToMessage(openid).then((res2) => {
+                  if (res2.code === 200) {
+                    common_vendor.index.showToast({ title: "订阅成功", icon: "success" });
+                    common_vendor.index.navigateBack();
+                  } else {
+                    common_vendor.index.showToast({ title: "订阅失败", icon: "error" });
+                    common_vendor.index.navigateBack();
+                  }
+                });
+              }
             },
             fail(err) {
               common_vendor.index.showToast({ title: "订阅失败", icon: "error" });

+ 14 - 9
src/pagesOne/winner/uploadImage.vue

@@ -79,19 +79,24 @@ const onAdd = () => {
   };
   addCustomer(params).then((res: any) => {
     if (res.code === 200) {
+      //用户订阅消息模板消息
       wx.requestSubscribeMessage({
         tmplIds: ["ZZhiUAFnGXkIIIId6W9mBbf16DGC-OtX1sT_d5TWNUU"],
         success(response: any) {
+          if (
+            response["ZZhiUAFnGXkIIIId6W9mBbf16DGC-OtX1sT_d5TWNUU"] === "accept"
+          ) {
+            subscribeToMessage(openid).then((res: any) => {
+              if (res.code === 200) {
+                uni.showToast({ title: "订阅成功", icon: "success" });
+                uni.navigateBack();
+              } else {
+                uni.showToast({ title: "订阅失败", icon: "error" });
+                uni.navigateBack();
+              }
+            });
+          }
           // uni.showToast({ title: "订阅成功", icon: "success" });
-          subscribeToMessage(openid).then((res: any) => {
-            if (res.code === 200) {
-              uni.showToast({ title: "订阅成功", icon: "success" });
-              uni.navigateBack();
-            } else {
-              uni.showToast({ title: "订阅失败", icon: "error" });
-              uni.navigateBack();
-            }
-          });
         },
         fail(err) {
           uni.showToast({ title: "订阅失败", icon: "error" });