|
@@ -611,10 +611,53 @@ export default {
|
|
|
}, 0);
|
|
|
}, 0);
|
|
|
},
|
|
|
+ setOpenId(openid) {
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ functionName: API_CONFIG.ajax_UpdateOpenId.functionName, // 调用存储过程的名称
|
|
|
+ uid: this.userid,
|
|
|
+ openid: openid,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.$ajax
|
|
|
+ .post(API_CONFIG.baseUrl, params)
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success("绑定成功");
|
|
|
+ this.wechatDialogVisible = false;
|
|
|
+ this.getData();
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("绑定失败请重新扫码");
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
Ochange() {
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ let _this = this;
|
|
|
+ window.addEventListener("message", function (e) {
|
|
|
+ // 监听 message 事件
|
|
|
+ console.log(e);
|
|
|
+ if (e.data && e.data.method == "getOpenId") {
|
|
|
+ console.log(e);
|
|
|
+ console.log(e.data.code);
|
|
|
+ console.log(_this.loginType);
|
|
|
+
|
|
|
+ if (e.data.code == 200) {
|
|
|
+ _this.setOpenId(e.data.data.openid);
|
|
|
+ } else {
|
|
|
+ _this.$message.error("扫码登录失败请重新扫码");
|
|
|
+ _this.wechatDialogVisible = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.wechatDialogVisible = true;
|
|
|
+ _this.wechatLogin();
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|