瀏覽代碼

修改登录

448368749@qq.com 4 年之前
父節點
當前提交
95266ec134
共有 5 個文件被更改,包括 18 次插入145 次删除
  1. 2 2
      src/manifest.json
  2. 8 9
      src/pages/index/index.vue
  3. 1 0
      src/pages/index/setting/setting.vue
  4. 4 131
      src/pages/public/login.vue
  5. 3 3
      src/store/index.js

+ 2 - 2
src/manifest.json

@@ -1,8 +1,8 @@
 {
-    "name" : "Rageframe商城",
+    "name" : "休度游商家管理系统",
     "appid" : "__UNI__B6E0DB1",
     // 自行更换uniapp appid 可登录查看uniapp提供的用户统计 https://tongji.dcloud.net.cn/
-    "description" : "Rageframe商城",
+    "description" : "休度游商家管理系统",
     "versionName" : "1.0.0",
     "versionCode" : "100",
     "transformPx" : false,

+ 8 - 9
src/pages/index/index.vue

@@ -357,20 +357,12 @@ export default {
   // 页面生命周期 监听页面加载
   onLoad() {
     _self = this;
-    console.log(this.userInfo)
     this.cWidth = uni.upx2px(690); // upx2px 转换为px
     this.cHeight = uni.upx2px(300);
     this.bWidth = uni.upx2px(690);
     this.bHeight = uni.upx2px(300);
 
     this.getShopList();
-    this.getExponentData();
-    this.getPendingData();
-    this.shopSellTrend();
-    this.shopSellMoneyTrend();
-    this.futureDayData();
-    this.shopSellData();
-
     this.loading = false;
 
     
@@ -445,6 +437,13 @@ export default {
         if (res.data && res.code === 200) {
           let newarr = [{ name: '全部', id: 0 }];
           this.shopArray = newarr.concat(res.data);
+          this.getExponentData();
+          this.getPendingData();
+          this.shopSellTrend();
+          this.shopSellMoneyTrend();
+          this.futureDayData();
+          this.shopSellData();
+
         }
       });
     },
@@ -491,7 +490,7 @@ export default {
       if (yesnum === 0) {
         itemEle.percent = 100;
       } else {
-        itemEle.percent = (todaynum - yesnum) / yesnum;
+        itemEle.percent = ((todaynum - yesnum) / yesnum).toFixed(2);
       }
 
       if (yesnum === todaynum) {

+ 1 - 0
src/pages/index/setting/setting.vue

@@ -56,6 +56,7 @@ export default {
 				console.log('退出登陆');
 				console.log(res);
 				this.$mHelper.toast('退出成功')
+				uni.removeStorageSync('user')
 				setTimeout(() => {
 					this.$mRouter.reLaunch({route: '/pages/public/login'})
 				}, 1000);

+ 4 - 131
src/pages/public/login.vue

@@ -88,108 +88,10 @@ export default {
     }
   },
   // 页面生命周期 监听页面加载是否加载完成
-  onLoad() {
-    const time = moment().valueOf() / 1000 - uni.getStorageSync('loginSmsCodeTime');   // 从本地缓存中异步获取指定 key 对应的内容。
-    if (time < 60) {
-      this.codeSeconds = this.$mConstDataConfig.sendCodeTime - parseInt(time, 10);
-      this.handleSmsCodeTime(this.codeSeconds);
-    } else {
-      this.codeSeconds = this.$mConstDataConfig.sendCodeTime;
-      this.smsCodeBtnDisabled = false;
-      uni.removeStorageSync('loginSmsCodeTime');
-    }
-    this.loginParams.mobile = uni.getStorageSync('loginMobile') || '';
-    this.loginParams.password = uni.getStorageSync('loginPassword') || '';
-    this.userInfo = uni.getStorageSync('wechatUserInfo');
-
+  onLoad() {   
     this.getCaptchaImage();
-    //  this.changeLogin(); 
   },
-  methods: { 
-    //获取用户信息
-  changeLogin(){
-    let that = this  
-	// 授权
-	// 获取用户详细信息, 可以获取到说明已经授权过, 直接拿到用户信息
-      uni.getUserInfo({
-        provider: 'weixin',
-        //授权成功的回调
-        success(res) {          
-          uni.showToast({
-              title:'授权成功',
-            icon:'none'
-          })
-          // that.wechatuserinfo = res.userInfo    
-          console.log(res)
-          uni.setStorageSync('wechatUserInfo',res.userInfo )     
-        },
-        //第一次进入小程序
-        fail() {
-          uni.showToast({
-            title: '请点击授权进行登录',
-            icon: 'none'
-          });
-        }
-      });
-    },
-  
-    loginTest(mobile, password) {
-      this.loginParams.mobile = mobile;
-      this.loginParams.password = password;
-    },
-
-    // 发送验证码并进入倒计时
-    async getSmsCode() {
-      this.reqBody['mobile'] = this.loginParams['mobile'];
-      let checkSendCode = this.$mGraceChecker.check(
-        this.reqBody,
-        this.$mFormRule.sendCodeRule
-      );
-      if (!checkSendCode) {
-        this.$mHelper.toast(this.$mGraceChecker.error);
-        return;
-      }
-      await this.$http
-        .post(smsCode, {
-          mobile: this.loginParams.mobile,
-          usage: 'login',
-        })
-        .then((r) => {
-          if (r.data) {
-            this.$mHelper.toast(`验证码发送成功, 验证码是${r.data}`);
-          } else {
-            this.$mHelper.toast('验证码已发送.');
-          }
-          this.smsCodeBtnDisabled = true;
-          uni.setStorageSync('loginSmsCodeTime', moment().valueOf() / 1000);
-          this.handleSmsCodeTime(59);
-        });
-    },
-
-    handleSmsCodeTime(time) {
-      let timer = setInterval(() => {
-        if (time === 0) {
-          clearInterval(timer);
-          this.smsCodeBtnDisabled = false;
-        } else {
-          this.codeSeconds = time;
-          this.smsCodeBtnDisabled = true;
-          time--;
-        }
-      }, 1000);
-    },
-    // 失去焦点的手机号
-    blurMobileChange(e) {
-      this.mobile = e.detail.value;
-    },
-    // 切换登录方式
-    showLoginBySmsCode() {
-      this.loginByPass = !this.loginByPass;
-    },
-    // // 返回上一页
-    // navBack() {
-    //   this.$mRouter.back();
-    // },
+  methods: {  
     // 统一跳转路由
     navTo() {
       this.$mRouter.redirectTo({ route: '/pages/public/resetpassword' });
@@ -225,19 +127,7 @@ export default {
       if (!cheRes) {
         this.$mHelper.toast(this.$mGraceChecker.error);
         return;
-      }
-      /*  #ifdef  APP-PLUS  */
-      this.reqBody.group = 'tinyShopApp';
-      /*  #endif  */
-      /*  #ifdef H5  */
-      this.reqBody.group = 'tinyShopH5';
-      /*  #endif  */
-      /*  #ifdef  MP-WEIXIN  */
-      this.reqBody.group = 'tinyShopWechatMq';
-      /*  #endif  */
-      /*  #ifdef  MP-QQ  */
-      this.reqBody.group = 'tinyShopQqMq';
-      /*  #endif  */
+      }    
       this.handleLogin(this.loginParams, loginApi);
     },
     // 登录
@@ -247,25 +137,8 @@ export default {
         .post(loginApi, params)
         .then((r) => {
           this.$mHelper.toast('恭喜您,登录成功!');
-          this.$mStore.commit('login', r.data);
-          const backToPage = uni.getStorageSync('backToPage');
-          if (backToPage) {
-            if (
-              backToPage.indexOf('/pages/user/user') !== -1 ||
-              backToPage.indexOf('/pages/cart/cart') !== -1 ||
-              backToPage.indexOf('/pages/index/index') !== -1 ||
-              backToPage.indexOf('/pages/notify/notify') !== -1 ||
-              backToPage.indexOf('/pages/category/category') !== -1
-            ) {
-              this.$mRouter.reLaunch(JSON.parse(backToPage));
-            } else {
-              this.$mRouter.redirectTo(JSON.parse(backToPage));
-            }
-            uni.removeStorageSync('backToPage');
-            uni.removeStorageSync('wechatUserInfo');
-          } else {            
+          this.$mStore.commit('login', r.data);            
             this.$mRouter.reLaunch({ route: '/pages/index/index' });
-          }
         })
         .catch(() => {
           this.btnLoading = false;

+ 3 - 3
src/store/index.js

@@ -43,9 +43,9 @@ const store = new Vuex.Store({
 			state.userInfo = provider.member;
 			state.user = provider;
             uni.setStorageSync('user', provider);
-			uni.setStorageSync('accessToken', provider.access_token);
-			uni.setStorageSync('refreshToken', provider.refresh_token);
-			uni.setStorageSync('userInfo', provider.member);
+			// uni.setStorageSync('accessToken', provider.access_token);
+			// uni.setStorageSync('refreshToken', provider.refresh_token);
+			// uni.setStorageSync('userInfo', provider.member);
         },
         logout(state) {
             state.accessToken = '';