guhongwei 4 年之前
父節點
當前提交
132434f980
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      src/views/bind/bind.vue

+ 11 - 1
src/views/bind/bind.vue

@@ -44,11 +44,21 @@ export default {
   methods: {
     ...mapActions(['login', 'bind']),
     async onSubmit(form) {
+      // form.openid = this.openid;
       form.openid = this.openid;
       let res = await this.bind(form);
-      if (this.$checkRes(res, `绑定成功`)) {
+      if (res.errcode === 0) {
+        this.$notify({
+          message: '绑定成功',
+          type: 'success',
+        });
         sessionStorage.setItem('user', JSON.stringify(res.data));
         window.history.replaceState({}, '首页', `${Vue.config.weixin.baseUrl}/api/train/auth?redirect_uri=${Vue.config.weixin.target}/login&type=0`);
+      } else {
+        this.$notify({
+          message: '绑定失败',
+          type: 'error',
+        });
       }
     },
   },