Przeglądaj źródła

跳转授权完成

谢杰标 3 lat temu
rodzic
commit
f22d789ce9

+ 1 - 1
common/tool.js

@@ -5,7 +5,7 @@ export default {
   isGoLogin(isBack = true) {
     if (!uni.getStorageSync("user_account")) {
       uni.navigateTo({
-        url: "/pages/login/login?isBack=" + isBack,
+        url: "/pages/login/login?isBack=" + 1,
       });
       return true;
     } else {

+ 3 - 3
pages/actdetail/index.vue

@@ -98,15 +98,15 @@ export default {
     },
     getLinkCode() {
       let { distributionId } = this.detailInfo;
-      getLinkCode({ distributionId }).then((res) => {
+      getLinkCode({ distributionId }).then(({ linkCode, shareCode }) => {
         uni.navigateTo({
           url:
             "/pages/bill/index?distributionId=" +
             distributionId +
             "&linkCode=" +
-            res +
+            linkCode +
             "&shareCode=" +
-            this.$store.state.userInfo.shareCode,
+            shareCode,
         });
       });
     },

+ 3 - 3
pages/actlist/index.vue

@@ -59,15 +59,15 @@ export default {
       };
     },
     makePoster(distributionId) {
-      getLinkCode({ distributionId }).then((res) => {
+      getLinkCode({ distributionId }).then(({ linkCode, shareCode }) => {
         uni.navigateTo({
           url:
             "/pages/bill/index?distributionId=" +
             distributionId +
             "&linkCode=" +
-            res +
+            linkCode +
             "&shareCode=" +
-            this.$store.state.userInfo.shareCode,
+            shareCode,
         });
       });
     },

+ 1 - 0
pages/bill/index.vue

@@ -56,6 +56,7 @@ export default {
     this.options = options;
     this.getSharePoster();
     this.share();
+    uni.setStorageSync("BillHerf", window.location.href);
   },
   components: {
     tkiQrcode,

+ 19 - 7
pages/cashout/index.vue

@@ -73,14 +73,20 @@ export default {
     return {
       show: false,
       money: 0,
+      options: {},
     };
   },
   onShow() {
+    location.search.includes("code") && this.OfficialLogin();
+  },
+  onLoad(options) {
     if (this.$method.isGoLogin()) {
       return;
     }
-    !this.userInfo && this.$store.dispatch("getUserInfo");
-    location.search.includes("code") && this.OfficialLogin();
+    this.options = options;
+    if (options.isAuth) {
+      this.checkBindGzh();
+    }
   },
   methods: {
     changeMoney(val) {
@@ -97,10 +103,16 @@ export default {
       this.show = false;
     },
     open() {
-      checkBindGzh().then((res) => {
+      this.checkBindGzh().then((res) => {
+        this.show = true;
+        this.money = this.userInfo.cash;
+      });
+    },
+    // 获取授权
+    checkBindGzh() {
+      return checkBindGzh().then((res) => {
         if (res || process.env.NODE_ENV == "development") {
-          this.show = true;
-          this.money = this.userInfo.cash;
+          return Promise.resolve();
         } else {
           this.authorize();
         }
@@ -139,11 +151,11 @@ export default {
         this.$u.toast("请输入提现金额");
         return;
       }
-      
+
       withdrawal({ cash: this.money }).then((res) => {
         this.show = false;
         this.$u.toast("提现成功");
-        this.$store.dispatch("getUserInfo")
+        this.$store.dispatch("getUserInfo");
       });
     },
   },

+ 0 - 1
pages/index/index.vue

@@ -46,7 +46,6 @@
       <view class="login_text">欢迎来到业务员平台</view>
       <view class="login_text">您还没有登录哦~</view>
       <u-button
-        :disabled="isUse"
         class="c_btn loginBtn"
         text="立即登录/注册"
         @click="jumpLogin"

+ 18 - 9
pages/login/login.vue

@@ -173,13 +173,11 @@ export default {
       current: 0,
       codeTips: "",
       isUse: false,
-      isBack: false,
+      options: {},
     };
   },
-  onLoad(option) {
-    if (option.isBack) {
-      this.isBack = option.isBack;
-    }
+  onLoad(options) {
+    this.options = options;
   },
   onShow() {},
   onReady() {
@@ -189,7 +187,7 @@ export default {
   methods: {
     toRegister() {
       uni.navigateTo({
-        url: "/pages/login/register",
+        url: "/pages/login/register?backBill=" + (this.options.backBill || ""),
       });
     },
     handelLogin() {
@@ -258,11 +256,22 @@ export default {
     loginCallback(data) {
       this.$store.commit("LOGIN_CB", data);
       this.$store.dispatch("getUserInfo").then((res) => {
-        setTimeout(() => {
-          uni.navigateTo({
+        if (this.options.backBill) {
+          let href = uni.getStorageSync("BillHerf");
+          if (href) {
+            window.location.href = href;
+          } else {
+            uni.reLaunch({
+              url: "/pages/index/index",
+            });
+          }
+        } else if (this.options.isBack) {
+          // 返回上一页
+        } else {
+          uni.reLaunch({
             url: "/pages/index/index",
           });
-        }, 600);
+        }
       });
     },
   },

+ 19 - 6
pages/login/register.vue

@@ -134,7 +134,7 @@ export default {
         ],
       },
       isUse: false,
-      isBack: false,
+      options: {},
     };
   },
   mounted() {},
@@ -158,9 +158,22 @@ export default {
                   }).then((data) => {
                     this.$store.commit("LOGIN_CB", data);
                     this.$store.dispatch("getUserInfo").then((res) => {
-                      uni.navigateTo({
-                        url: "/pages/index/index",
-                      });
+                      if (this.options.backBill) {
+                        let href = uni.getStorageSync("BillHerf");
+                        if (href) {
+                          window.location.href = href;
+                        } else {
+                          uni.reLaunch({
+                            url: "/pages/index/index",
+                          });
+                        }
+                      } else if (this.options.isBack) {
+                        // 返回上一页
+                      } else {
+                        uni.reLaunch({
+                          url: "/pages/index/index",
+                        });
+                      }
                     });
                   });
                 },
@@ -200,11 +213,11 @@ export default {
       }
     },
   },
-  onLoad(option) {
+  onLoad(options) {
     this.$nextTick(() => {
       this.$refs.uForm.setRules(this.rules);
     });
-    this.isBack = option.isBack;
+    this.options = options;
   },
 };
 </script>

+ 1 - 6
pages/profile/index.vue

@@ -28,7 +28,7 @@
       <u-form-item label="手机号码">
         <u-input
           disabled
-          v-model="userInfo.telphone"
+          v-model="userInfo.phonenumber"
           border="bottom"
           type="number"
           maxlength="11"
@@ -52,11 +52,6 @@ export default {
       fileList: [],
     };
   },
-  async onShow() {
-    if (this.$method.isLogin()) {
-      !this.userInfo && (await this.$store.dispatch("getUserInfo"));
-    }
-  },
   methods: {
     toProfile() {
       uploadFile().then((avatar) => {

+ 2 - 2
pages/vcard/index.vue

@@ -56,12 +56,12 @@ export default {
     },
     toLogin() {
       uni.navigateTo({
-        url: "/pages/login/login",
+        url: "/pages/login/login?backBill=1",
       });
     },
     toRegister() {
       uni.navigateTo({
-        url: "/pages/login/register",
+        url: "/pages/login/register?backBill=1",
       });
     },
   },

+ 2 - 1
utils/commission.js

@@ -1,8 +1,9 @@
 import { myRequest } from "./request.js";
 //登录短信
-export function getCashList() {
+export function getCashList(data) {
   return myRequest({
     url: "/distribution/cash/log/fromOrderCashList",
     method: "get",
+    data
   });
 }

+ 0 - 188
utils/login.js

@@ -80,191 +80,3 @@ export function aliyunpolicy(data) {
     // noToken: true
   });
 }
-// export default {
-//   //我的列表数据
-//   getinfoAttached(data) {
-//     return myRequest({
-//       url: "/app/user/infoAttached",
-//       method: "get",
-//       data: data,
-//     });
-//   },
-//   //登录
-//   login(data) {
-//     return myRequest({
-//       url: "/login",
-//       // url: '/testLogin',
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   //登录用户信息
-//   getInfo(data) {
-//     return myRequest({
-//       url: "/app/user/getInfo",
-//       method: "get",
-//       data: data,
-//     });
-//   },
-//   /**
-//    * @param {Object} data
-//    * 微信登录
-//    */
-//   wxLogin(data) {
-//     return myRequest({
-//       url: "/app/common/bindLogin",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-
-//   //刷新令牌
-//   refreshToken(data) {
-//     return myRequest({
-//       url: "/refreshToken/" + data,
-//       method: "get",
-//       noToken: true,
-//     });
-//   },
-//   //查询等级列表
-//   gradelist(data) {
-//     return myRequest({
-//       url: "/grade/list",
-//       method: "get",
-//       data: data,
-//     });
-//   },
-//   refreshUserInfo() {
-//     this.getInfo().then((resdata) => {
-//       if (resdata.data.code == 200) {
-//         store.commit("updateUserInfo", { userInfo: resdata.data.data });
-//       }
-//     });
-//   },
-//   //注册短信
-//   registerSms(data) {
-//     return myRequest({
-//       url: "/app/common/sms/register",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   //获取重新绑定手机短信
-//   bindNewSms(data) {
-//     return myRequest({
-//       url: "/app/common/sms/bindNew",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-
-//   //重新绑定手机
-//   bindNewTel(data) {
-//     return myRequest({
-//       url: "/app/user/bindNewTel",
-//       method: "post",
-//       data: data,
-//     });
-//   },
-
-//   //注册用户
-//   registerUser(data) {
-//     return myRequest({
-//       url: "/app/common/register_small",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   //登录短信
-//   loginSms(data) {
-//     return myRequest({
-//       url: "/app/common/sms/login",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   //忘记短信
-//   forgetSms(data) {
-//     return myRequest({
-//       url: "/app/common/sms/forget",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   //忘记用户
-//   forgetUser(data) {
-//     return myRequest({
-//       url: "/app/common/register_forget",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   //短信登录用户
-//   smsLogin(data) {
-//     return myRequest({
-//       url: "/app/common/sms_login",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   //账号登录用户
-//   accountLogin(data) {
-//     return myRequest({
-//       url: "/app/common/account_login",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   skipLogin(data) {
-//     return myRequest({
-//       url: "/app/common/telphone_login",
-//       method: "post",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   //绑定身份证号信息
-//   bindId(data) {
-//     return myRequest({
-//       url: "/app/user/bind_idcard",
-//       method: "post",
-//       data: data,
-//     });
-//   },
-//   // 小程序校验PC登录二维码
-//   scanLoginCheck(data) {
-//     return myRequest({
-//       url: "/scan_login_check",
-//       method: "post",
-//       data: data,
-//     });
-//   },
-//   // 小程序已扫码
-//   scanhasCode(data) {
-//     return myRequest({
-//       url: "/scan_code",
-//       method: "get",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-//   // 移动端配置参数
-//   mobileConfig(data) {
-//     return myRequest({
-//       url: "/app/common/base/home/list",
-//       method: "get",
-//       data: data,
-//       noToken: true,
-//     });
-//   },
-// };

+ 1 - 1
utils/upload.js

@@ -2,7 +2,7 @@ import { myRequest } from "./request.js";
 //上传图片
 export function aliyunpolicy(data) {
   return myRequest({
-    url: "/aliyun/oss/seller_policy",
+    url: "/aliyun/oss/policy",
     method: "get",
     data: data,
     // noToken: true

+ 0 - 19
utils/user.js

@@ -25,25 +25,6 @@ export function checkBindGzh(data) {
   });
 }
 
-// 获取appid
-export function getWxConfig(data) {
-  return myRequest({
-    url: "/app/common/wx/config",
-    method: "get",
-    data: data,
-    noToken: true,
-  });
-}
-
-//绑定公众号
-export function OfficialLogin(data) {
-  return myRequest({
-    url: "/distribution/seller/gzh_bind",
-    method: "post",
-    data: data,
-  });
-}
-
 // 提现
 export function withdrawal(data) {
   return myRequest({