Jelajahi Sumber

学生端微信绑定 微信解绑功能接口更新

dengshaobo 7 bulan lalu
induk
melakukan
bda288869c
4 mengubah file dengan 53 tambahan dan 5 penghapusan
  1. 21 1
      src/http/api/user.js
  2. 1 1
      src/views/login/login.vue
  3. 24 3
      src/views/userInfo/personInfo.vue
  4. 7 0
      vue.config.js

+ 21 - 1
src/http/api/user.js

@@ -33,9 +33,29 @@ const user = {
   //绑定手机号
   bindPhoneNumber(data)
   {
-    return post(base.prefix + '/api/v1/student_user/bind_phone', data)
+    return post(base.prefix + '/teachapi/v1/student_user/bind_phone', data)
   },
 
+  // 获取微信登录二维码
+  getWechatCode() {
+
+    if(base.VUE_APP_BASE){
+      return get(base.VUE_APP_BASE + '/api/v1/wechat/qrAuthorize')
+    }else{
+      return get('/teachingApi/v1/wechat/qrAuthorize')
+    }
+  },
+
+  // 个人中心-绑定微信
+  bindWechat (data) {
+    return get(base.prefix + '/api/v1/student_user/bind_wechat', data)
+  },
+  // 个人中心-解绑微信
+  unBindWechat (data) {
+    return get(base.prefix + '/api/v1/student_user/un_bind_wechat', data)
+  },
+
+
 }
 
 export default user

+ 1 - 1
src/views/login/login.vue

@@ -78,7 +78,7 @@ export default {
           console.log("打印用户信息",userInfo);
           this.$store.dispatch("user/CLEAR_LOCAL_STORAGE");//清空本地存储
           setToken(userInfo.tokenValue);
-          sessionStorage.setItem('schoolType', 2);//1:单校 2:联校//
+          sessionStorage.setItem('schoolType', 1);//1:单校 2:联校// 暂时写死单校
           this.$store.dispatch("user/SET_TOKEN", userInfo.tokenValue);
           this.$store.dispatch("user/SET_SCHOOL_LOGO",userInfo.schoolLogoUrl);//设置学校logo
           this.$store.dispatch("user/SET_SCHOOL_WEB_SITE_ID",userInfo.cloudMonitorSiteId || '');//设置学校网站id

+ 24 - 3
src/views/userInfo/personInfo.vue

@@ -77,8 +77,13 @@
       </el-dialog>
       <el-dialog title="绑定微信" center :visible.sync="showWeChartDialog" width="400px" @close="CloseWeChartDialog">
         <div class="dialog_center padding_20">
-          <div class="bingding_center wechar_qr" id="wechat-qr-container" v-loading="qrLoading"></div>
-          <p class="wechar_text"><img src="@/assets/login/login_wechat.webp" alt="" />微信扫描</p>
+          <div class="bingding_center wechar_qr" id="wechat-qr-container" style="width: 250px; height: 250px; transform: scale(0.8); transform-origin: 0 0;" v-loading="qrLoading"></div>
+          <div class="wechart_img">
+            <img src="@/assets/login/login_wechat.webp" alt="" />
+          </div>
+          <p class="wechar_text">
+            
+            微信扫描</p>
         </div>
       </el-dialog>
     </div>
@@ -198,7 +203,8 @@ export default {
       }
     },
     // 获取手机验证码
-    GetCode() {
+    GetCode() 
+    {
       if(!this.bindingPhoneData.phone) {
         this.$message.warning('请输入手机号码');
         return
@@ -315,5 +321,20 @@ export default {
 };
 </script>
 <style lang="scss" scoped>
+.wechart_img
+{
+  margin: auto;
+  text-align: center;
 
+  img
+  {
+    width: 32px;
+    height: 32px;
+  }
+  
+}
+.wechar_text
+{
+  text-align: center;
+}
 </style>

+ 7 - 0
vue.config.js

@@ -96,6 +96,13 @@ module.exports = {
           "^/api": "/",
         },
       },
+      "/teachingApi": {
+        target: "https://dev3.k12100.net/teaching/api/",
+        changeOrigin: true,
+        pathRewrite: {
+          "^/teachingApi": "/",
+        },
+      }
     },
   },
 };