Browse Source

完善绑定工号

seimin 3 years ago
parent
commit
61263eca06
3 changed files with 36 additions and 37 deletions
  1. 13 30
      pages/bindUser/bindUser.vue
  2. 20 6
      pages/homePage/homePage.vue
  3. 3 1
      pages/mypage/mypage.vue

+ 13 - 30
pages/bindUser/bindUser.vue

@@ -3,7 +3,7 @@
3 3
     <view class="scanFont">您的微信未绑定工号,请填写工号后进行使用</view>
4 4
     <view class="searchUser">
5 5
       <input class="searchUserIpt" v-model="account" type="text" placeholder="请输入工号" />
6
-      <button class="searchUserBtn" size="mini" @click="search(account)">检索</button>
6
+      <button class="searchUserBtn" @click="search(account)">检索</button>
7 7
     </view>
8 8
     <view class="accountName">
9 9
       检索到的用户:{{accountName}}
@@ -34,6 +34,7 @@
34 34
         models: {
35 35
           disjunctor: false,
36 36
         },
37
+        type: "", //登录来源类型
37 38
       }
38 39
     },
39 40
     methods: {
@@ -90,6 +91,7 @@
90 91
           account: this.bindAccount
91 92
         }).then((res) => {
92 93
           uni.hideLoading();
94
+          let _this = this;
93 95
           if (res.status == 200) {
94 96
             uni.showModal({
95 97
               title: '提示',
@@ -99,8 +101,13 @@
99 101
               confirmText: '进入系统',
100 102
               success: function(result) {
101 103
                 if (result.confirm) {
102
-                  console.log('用户点击确定');
103
-                  location.assign(location.origin + location.pathname);
104
+                  console.log('用户点击确定',_this.type);
105
+                  if (_this.type) {
106
+                    location.assign(location.origin + location.pathname + '#/pages/homePage/homePage?type=' +
107
+                      _this.type);
108
+                  } else {
109
+                    location.assign(location.origin + location.pathname + '#/pages/homePage/homePage');
110
+                  }
104 111
                 } else if (result.cancel) {
105 112
                   console.log('用户点击取消');
106 113
                 }
@@ -125,33 +132,8 @@
125 132
       },
126 133
     },
127 134
     onLoad(options) {
128
-      console.log(options, 'seimin')
129
-      this.options = options;
130
-      if (options.uniName == "replaceGo") { //替换
131
-        this.qrCode = options.qrCode
132
-        this.queryDept = {
133
-          dept: options.queryDept,
134
-          id: options.queryDeptId
135
-        };
136
-        this.msg = `此二维码绑定${options.targetDept}成功,${this.queryDept.dept}的二维码被清空`;
137
-        this.settings = [{
138
-          name: '替换',
139
-          uniName: 'replaceGo'
140
-        }, {
141
-          name: '保存',
142
-          uniName: 'replaceSave'
143
-        }];
144
-      } else if (options.uniName == "settingGo") { //设置
145
-        this.qrCode = options.qrCode;
146
-        this.msg = `将设置${options.targetDept}到此二维码上`;
147
-        this.settings = [{
148
-          name: '设置',
149
-          uniName: 'settingGo'
150
-        }, {
151
-          name: '保存',
152
-          uniName: 'settingSave'
153
-        }];
154
-      }
135
+      console.log(options, 'seimin');
136
+      this.type = options.type || "";
155 137
       // #ifdef APP-PLUS
156 138
       webHandle("no", "app");
157 139
       // #endif
@@ -204,6 +186,7 @@
204 186
       padding: 30rpx;
205 187
 
206 188
       .searchUserIpt {
189
+        padding: 24rpx;
207 190
         flex: 3;
208 191
         border: 1px solid #0003;
209 192
         margin-right: 30rpx;

+ 20 - 6
pages/homePage/homePage.vue

@@ -633,9 +633,15 @@
633 633
               });
634 634
             } else if (this.state == "555") {
635 635
               // 如果需要绑定账号 并且 没有微信号
636
-              uni.navigateTo({
637
-                url: "../bindUser/bindUser"
638
-              })
636
+              if(this.type){
637
+                uni.redirectTo({
638
+                  url: `../bindUser/bindUser?type=${this.type}`
639
+                })
640
+              }else{
641
+                uni.redirectTo({
642
+                  url: `../bindUser/bindUser`
643
+                })
644
+              }
639 645
             } else {
640 646
               console.log(this.url, "url");
641 647
               // https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww2506abad3086cfab&redirect_uri=http://weixintest2.ngser.dashitech.com/app&response_type=code&scope=snsapi_base&agentid=1000013&state=STATE&connect_redirect=1#wechat_redirect
@@ -673,10 +679,17 @@
673 679
                 }
674 680
               });
675 681
             } else if (this.state == "555") {
682
+              this.type = uni.getStorageSync("type"); //刷新页面后获取type
676 683
               // 如果需要绑定账号 并且 没有微信号
677
-              uni.navigateTo({
678
-                url: "../bindUser/bindUser"
679
-              })
684
+              if(this.type){
685
+                uni.redirectTo({
686
+                  url: `../bindUser/bindUser?type=${this.type}`
687
+                })
688
+              }else{
689
+                uni.redirectTo({
690
+                  url: `../bindUser/bindUser`
691
+                })
692
+              }
680 693
             } else {
681 694
               uni.showToast({
682 695
                 icon: "none",
@@ -834,6 +847,7 @@
834 847
       // #endif
835 848
     },
836 849
     onShow() {
850
+      console.log('onShow');
837 851
       // let flag = true;
838 852
       if (uni.getStorageSync("userData")) {
839 853
         this.online = uni.getStorageSync("userData").user.online;

+ 3 - 1
pages/mypage/mypage.vue

@@ -471,7 +471,9 @@
471 471
         });
472 472
       }
473 473
       //#endif
474
-      this.tab("day", "今日");
474
+      if (options.login != 1) {
475
+        this.tab("day", "今日");
476
+      }
475 477
 
476 478
       //图表
477 479
       this.cWidth = uni.upx2px(500);