Browse Source

促销产品添加特征码

xiaohaizhao 1 year ago
parent
commit
c9b42c67de

+ 3 - 1
app.json

@@ -12,7 +12,9 @@
     "pages/address/update",
     "pages/index/userCenter/changePassword/index",
     "pages/bankAccount/index",
-    "pages/bankAccount/update"
+    "pages/bankAccount/update",
+    "pages/associatedPublicNumber/index",
+    "pages/associatedPublicNumber/webView"
   ],
   "subpackages": [
     {

+ 36 - 0
pages/associatedPublicNumber/index.js

@@ -0,0 +1,36 @@
+const _Http = getApp().globalData.http;
+
+Page({
+    data: {
+        text: "",
+        code: ""
+    },
+    onLoad(options) {
+        if (options.code == 0) {
+            this.setData({
+                text: "绑定出错 请稍后再试"
+            })
+        } else {
+            this.WechatServceBinding(options.code);
+        }
+    },
+    WechatServceBinding(wechat_code) {
+        _Http.basic({
+            "classname": "common.usercenter.usercenter",
+            "method": "WechatServceBinding",
+            "content": {
+                "accesstoken": wx.getStorageSync('userMsg').token,
+                "systemclient": "wservice",
+                wechat_code
+            }
+        }).then(res => {
+            console.log("绑定公众号", res)
+            this.setData({
+                code: res.msg == '成功' ? "" : wechat_code
+            })
+        })
+    },
+    onShow() {
+        this.data.code && this.WechatServceBinding(this.data.code);
+    }
+})

+ 4 - 0
pages/associatedPublicNumber/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "关联公众号"
+}

+ 16 - 0
pages/associatedPublicNumber/index.scss

@@ -0,0 +1,16 @@
+page {
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  background-color: #fff;
+  font-size: 36rpx;
+  font-weight: 700;
+  box-sizing: border-box;
+  padding: 0 50rpx;
+}
+
+image {
+  width: 500rpx;
+  height: 500rpx;
+}

+ 36 - 0
pages/associatedPublicNumber/index.wxml

@@ -0,0 +1,36 @@
+<view wx:if="{{text}}" style="margin-top: 400rpx;">
+	{{text}}
+</view>
+<block wx:else>
+	<image style="margin-top: 50rpx;" src="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306131686620036790B2108907.jpg" show-menu-by-longpress />
+	<block wx:if="{{code}}">
+		<view>
+			查询到还未关注公众号
+		</view>
+		<view style="margin-bottom: 30rpx;margin-top: 20rpx;">
+			请先关注公众号后进行绑定
+		</view>
+		<view>
+			请长按二维码识别图中公众号
+		</view>
+		<view style="margin-top: 20rpx;">
+			前去关注
+		</view>
+	</block>
+	<block wx:else>
+		<view>
+			已成功绑定消息通知
+		</view>
+		<view style="margin-bottom: 30rpx;margin-top: 20rpx;">
+			应用消息请关注公众号信息
+		</view>
+		<view>
+			可长按二维码识别图中公众号
+		</view>
+
+		<view style="margin-top: 20rpx;">
+			前去查看信息
+		</view>
+	</block>
+
+</block>

+ 8 - 0
pages/associatedPublicNumber/webView.js

@@ -0,0 +1,8 @@
+Page({
+  data: {
+
+  },
+  onLoad(options) {
+      
+  },
+})

+ 4 - 0
pages/associatedPublicNumber/webView.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "关联公众号"
+}

+ 1 - 0
pages/associatedPublicNumber/webView.scss

@@ -0,0 +1 @@
+/* pages/associatedPublicNumber/webView.wxss */

+ 1 - 0
pages/associatedPublicNumber/webView.wxml

@@ -0,0 +1 @@
+<web-view src="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbb36136a90907f54&redirect_uri=https://cucu.cnyunl.com:8079/getcode.html&response_type=code&scope=snsapi_base&state=#wechat_redirect" />

+ 7 - 1
pages/index/userCenter/index.js

@@ -56,7 +56,7 @@ Component({
 					getApp().globalData.SocketTask.close()
 					wx.showToast({
 						title: '退出成功',
-						mask:true
+						mask: true
 					});
 					let loginMsg = wx.getStorageSync("loginMsg");
 					wx.clearStorageSync();
@@ -138,5 +138,11 @@ Component({
 				}
 			})
 		},
+		/* 前去查询 */
+		bindingOfficialAccounts() {
+			wx.navigateTo({
+				url: '/pages/associatedPublicNumber/webView',
+			})
+		}
 	}
 })

+ 11 - 0
pages/index/userCenter/index.wxml

@@ -64,6 +64,17 @@
 				</view>
 			</view>
 		</navigator>
+		<navigator wx:if="{{userMsg.iswechatbinding}}" class="item" url="#" bindtap="bindingOfficialAccounts">
+			<view class="con">
+				<view class="label">
+					<text class="iconfont icon-a-wodebangdingweixin" style="color: var(--success);" />
+					消息通知设置
+				</view>
+				<view class="item-right">
+					<van-icon size='30rpx' name="arrow" />
+				</view>
+			</view>
+		</navigator>
 	</view>
 	<view style="width: 100vw;text-align: center;margin-top: 200rpx;">
 		<van-button custom-class='out-login' color="#CCC" bindtap="outLogin" plain>退出登录</van-button>