snow 1 jaar geleden
bovenliggende
commit
b79aeeff52
4 gewijzigde bestanden met toevoegingen van 19 en 24 verwijderingen
  1. 0 0
      dist/app.js
  2. 1 1
      dist/runtime.js
  3. 3 23
      src/components/binding/index.vue
  4. 15 0
      src/pages/wechat.vue

File diff suppressed because it is too large
+ 0 - 0
dist/app.js


+ 1 - 1
dist/runtime.js

@@ -113,7 +113,7 @@
 /******/
 /******/ 	var hotApplyOnUpdate = true;
 /******/ 	// eslint-disable-next-line no-unused-vars
-/******/ 	var hotCurrentHash = "dd2b5b612359221f7fc5";
+/******/ 	var hotCurrentHash = "29e80528b033ee90b665";
 /******/ 	var hotRequestTimeout = 10000;
 /******/ 	var hotCurrentModuleData = {};
 /******/ 	var hotCurrentChildModule;

+ 3 - 23
src/components/binding/index.vue

@@ -1,19 +1,18 @@
 <template>
   <div class="binding-container">
-    <div v-if="isMobile">
+    <div>
       <el-alert title="您的微信号未绑定过系统,请先绑定一个账号" :closable="false" type="warning" center show-icon />
       <el-form label-width="80px" size="mini" style="margin-top:10px" ref="formRef" :model="formData" :rules="rules">
         <el-form-item label="账号:" prop="username">
           <el-input v-model="formData.username" placeholder="账号" />
         </el-form-item>
 
-
         <el-form-item label="密码:" prop="password">
           <el-input type="password" v-model="formData.password" placeholder="密码" />
         </el-form-item>
 
         <el-form-item style="display: flex;justify-content: flex-end;">
-          <wx-open-subscribe :template="'2W6QA6ke0W9h17KbP__0fvijmoWAlCShaphBu6C3C4Q,05NTNhwfrx4iMwMQwMZD9cORVaJ8E4BEs0S8K988O54'" id="subscribe-btn" @success="handleSuccess" @error="handleError">
+          <wx-open-subscribe :template="template" id="subscribe-btn" @success="handleSuccess" @error="handleError">
             <script type="text/wxtag-template">
               <style>
               .sub-btn{
@@ -32,8 +31,6 @@
         </el-form-item>
       </el-form>
     </div>
-
-    <el-alert v-else title="请使用手机端绑定账号" :closable="false" type="error" center show-icon />
   </div>
 </template>
 
@@ -94,9 +91,6 @@ export default {
     }
   },
   created() {
-    if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) {
-      this.isMobile = true
-    }
     document.title = "绑定采销账号"
   },
   beforeDestory() {
@@ -112,23 +106,9 @@ export default {
       this.submit();
       // this.$message.warning("订阅失败,请重试!")
     },
-    handleLastValue(value) {
-      this.formData.lastCode = value.replace(/[^\d]/g, '');
-      let { lastCode = "", phone } = this.formData
-      let phoneLastCode = []
-      for (let i = 0; i < 4; i++) { phoneLastCode[i] = lastCode[i] || "*" }
-      const phonePreCode = phone.slice(0, 7)
-      console.log(phonePreCode)
-      this.formData.phone = phonePreCode + phoneLastCode.join("");
-    },
     handleChange(value) {
       const item = this.accounts.find(({ value: oV }) => oV === value)
-
-      this.formData = {
-        id: item.value,
-        phone: item.mobile,
-        lastCode: ""
-      }
+      this.formData = { id: item.value, phone: item.mobile, lastCode: ""  }
     },
     async submit() {
       try {

+ 15 - 0
src/pages/wechat.vue

@@ -90,7 +90,22 @@ export default {
       const { wxinfo, isLogin, userinfo } = (result.data || {})
       this.isBound = Number(isLogin) === 1;
       this.openid = wxinfo.openid;
+      const isMobile = /Mobi|Android|iPhone/i.test(navigator.userAgent);
+
+      //未绑定且非移动端-直接跳转至登录页
+      if(!this.isBound && !isMobile){
+        this.$alert('请使用手机版微信绑定账号', '正在跳转至登录页...', {
+          type:'warning',
+          callback: () => {
+            const back = getParameterByName("back")
+            window.location.href = back + "/?from=authorization"
+          }
+        });
+        return
+      }
+
       if (!this.isBound) return;
+
       this.jumpToSystem(userinfo.token)
     },
     jumpToSystem(token = "") {

Some files were not shown because too many files changed in this diff