zhaoxiaoqiang
2022-08-04 a5b43701b5b10db52ea0a78ffa24f474b1d70432
登录修改
1 files added
10 files modified
12432 ■■■■■ changed files
README.md 2 ●●● patch | view | raw | blame | history
package-lock.json 12321 ●●●●● patch | view | raw | blame | history
src/router/routes.js 20 ●●●● patch | view | raw | blame | history
src/store/index.js 18 ●●●●● patch | view | raw | blame | history
src/utils/wechat.js 4 ●●●● patch | view | raw | blame | history
src/views/bankCard/index.vue 6 ●●●● patch | view | raw | blame | history
src/views/homeIndex/home-index.vue 3 ●●●● patch | view | raw | blame | history
src/views/order/settlementEarly.vue 2 ●●● patch | view | raw | blame | history
src/views/personal/personal-center.vue 4 ●●●● patch | view | raw | blame | history
src/views/user/front-login.vue 18 ●●●● patch | view | raw | blame | history
src/views/user/login.vue 34 ●●●●● patch | view | raw | blame | history
README.md
@@ -1,4 +1,4 @@
## edu_ins_client
## axx_ins_client
教育分期平台用户端
package-lock.json
New file
Diff too large
src/router/routes.js
@@ -2,18 +2,18 @@
 * @Author: 小明丶
 * @Date: 2019-08-13 18:10:18
 * @LastEditors: zxq
 * @LastEditTime: 2022-08-02 17:27:11
 * @LastEditTime: 2022-08-04 10:47:20
 * @Description:
 */
export default [
    // {
    //     path:"/",
    //     name:'front-login',
    //     component:()=>import("@/views/user/front-login.vue"),
    //     meta:{
    //         isLogin:true
    //     }
    // },
    {
        path:"/",
        name:'front-login',
        component:()=>import("@/views/user/front-login.vue"),
        meta:{
            isLogin:true
        }
    },
    {
        path:"/login",
        name:'login',
@@ -36,7 +36,7 @@
    //     component:()=>import("@/views/user/agreement2.vue"),  
    // },
    {
        path:"/",
        path:"/home",
        name:'home',
        component:()=>import("@/views/home.vue"),
        children:[
src/store/index.js
@@ -1,8 +1,8 @@
/*
 * @Author: 小明丶
 * @Date: 2019-08-19 15:23:17
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-11-01 11:01:36
 * @LastEditors: zxq
 * @LastEditTime: 2022-08-04 10:46:21
 * @Description:
 */
import Vue from 'vue';
@@ -74,18 +74,16 @@
                openId:openId
            };
            //dispatch('getWechatUserInfo',{vm,openId,next})
            Vue.prototype.$api.login(passwordLogin).then(res => {
            Vue.prototype.$api.login(passwordLogin).then({body} => {
                // sessionStorage.jumpUrl = res.body.clientAccessDomain;
                let {
                    sessionId,
                    mblNo
                } = res.body;
                let {sessionId,mblNo} = body;
                let userInfo = {}
                userInfo.mblNo = res.body.account;//手机号修改成账号
                userInfo.hasBankCard = res.body.hasBankCard;//1标识有我的银行卡0未绑定银行卡
                userInfo.mblNo = body.account;//手机号修改成账号
                userInfo.hasBankCard =body.hasBankCard;//1标识有我的银行卡0未绑定银行卡
                commit(SET_SESSION_ID, sessionId);//存储sessionId用于判断是否登录
                localStorage.axx_ins_client_openId = body.openid;
                commit(SET_USER_INFO,userInfo)
                dispatch('setUserMenu',{ vm, next })
                dispatch('setUserMenu',{ vm, next });
                vm.$router.push('/home/index')//跳转到指定页面
            });
        },
src/utils/wechat.js
@@ -19,7 +19,7 @@
//         var url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`
        
//         // 判断用户是否已经授权
//         if(window.localStorage.edu_ins_client_openId == 'undefined' || !localStorage.edu_ins_client_openId){
//         if(window.localStorage.axx_ins_client_openId == 'undefined' || !localStorage.axx_ins_client_openId){
//             window.location.href = url
//             // 在回调页面去获取到授权返回的code,并且传递给后端
//         }
@@ -33,7 +33,7 @@
            // 拼接微信授权页面链接
            var url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${this.redirect_uri}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`
             // 判断用户是否已经授权
            if(window.localStorage.edu_ins_client_openId == 'undefined' || !localStorage.edu_ins_client_openId){
            if(window.localStorage.axx_ins_client_openId == 'undefined' || !localStorage.axx_ins_client_openId){
                window.location.href = url
                // 在回调页面去获取到授权返回的code,并且传递给后端
            }
src/views/bankCard/index.vue
@@ -1,10 +1,10 @@
<!--
 * @Author: your name
 * @Date: 2021-10-28 17:26:45
 * @LastEditTime: 2021-11-12 11:20:06
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-08-04 10:33:33
 * @LastEditors: zxq
 * @Description: In User Settings Edit
 * @FilePath: \edu_ins_client\src\views\bankCard\index.vue
 * @FilePath: \axx_ins_client\src\views\bankCard\index.vue
-->
<template>
  <div class="bankCard_page">
src/views/homeIndex/home-index.vue
@@ -2,7 +2,7 @@
 * @Author: 小明丶
 * @Date: 2020-05-20 20:29:47
 * @LastEditors: zxq
 * @LastEditTime: 2022-08-03 18:00:10
 * @LastEditTime: 2022-08-04 09:52:23
 * @Description:
-->
<template>
@@ -48,6 +48,7 @@
    };
  },
  created() {
    console.log(window)
    // this.getWXToken();
    // 判断微信接口是否支持
    wx.checkJsApi({
src/views/order/settlementEarly.vue
@@ -4,7 +4,7 @@
 * @LastEditors: zxq
 * @LastEditTime: 2022-06-16 10:06:39
 * @Description: Description
 * @FilePath: \edu_ins_client\src\views\order\settlementEarly.vue
 * @FilePath: \axx_ins_client\src\views\order\settlementEarly.vue
-->
<template>
  <div class="settlement_early">
src/views/personal/personal-center.vue
@@ -54,8 +54,8 @@
  computed:{
    ...mapState(['userinfo']),
    mation(){
      if(localStorage.edu_ins_client_userMation){
        return JSON.parse(localStorage.edu_ins_client_userMation)
      if(localStorage.axx_ins_client_userMation){
        return JSON.parse(localStorage.axx_ins_client_userMation)
      }
    }
  },
src/views/user/front-login.vue
@@ -2,7 +2,7 @@
 * @Author: 小明丶
 * @Date: 2020-06-04 09:55:50
 * @LastEditors: zxq
 * @LastEditTime: 2022-07-12 11:01:46
 * @LastEditTime: 2022-08-04 10:36:30
 * @Description:
-->
<template>
@@ -13,7 +13,7 @@
import Vue from "vue";
import { RadioGroup, Radio } from "vant";
import { Checkbox, CheckboxGroup } from "vant";
import { GoWeChat } from "../../utils/wechat";
// import { GoWeChat } from "../../utils/wechat";
Vue.use(Checkbox);
Vue.use(CheckboxGroup);
@@ -26,18 +26,18 @@
  },
  created() {
    var _this = this;
    // localStorage.edu_ins_client_openId = 'oJbj21YwUatdNaYf3iEPwwGtWuUg'
    // localStorage.edu_ins_client_userMation = '{"openid":"oGGPLs2yZ5tiBnB9iYcZrV60DoqM","nickname":"乌卡拉卡","sex":"1","province":"四川","city":"成都","country":"中国","headimgurl":"http://thirdwx.qlogo.cn/mmopen/vi_32/sYsBGsncFia9ql7K5stRibY61BSjDkPkNQFiasqdHiczTwbnX7JeZhcrp49RZD9icFTDLd2JqUjIrHHVw0f52kE4Uibw/132"}'
    // localStorage.axx_ins_client_openId = 'oJbj21YwUatdNaYf3iEPwwGtWuUg'
    // localStorage.axx_ins_client_userMation = '{"openid":"oGGPLs2yZ5tiBnB9iYcZrV60DoqM","nickname":"乌卡拉卡","sex":"1","province":"四川","city":"成都","country":"中国","headimgurl":"http://thirdwx.qlogo.cn/mmopen/vi_32/sYsBGsncFia9ql7K5stRibY61BSjDkPkNQFiasqdHiczTwbnX7JeZhcrp49RZD9icFTDLd2JqUjIrHHVw0f52kE4Uibw/132"}'
    // this.$router.push("/login");
    //本地是否存储有openId,有就调用openId登录
    if (localStorage.edu_ins_client_openId && localStorage.edu_ins_client_openId != undefined) {
    if (localStorage.axx_ins_client_openId && localStorage.axx_ins_client_openId != undefined) {
      //this.$router.push("/login");
      this.openIdLogin({
        this.openIdLogin({
          vm: _this,
          openId: localStorage.edu_ins_client_openId
          openId: localStorage.axx_ins_client_openId
        });
    } else {
      this.loginBut();
      this.$router.push("/login");
    }
  },
  methods: {
@@ -55,7 +55,7 @@
    //登录验证
    loginBut() {
        // 无openId跳转授权,有就执行openId登录
      //if (!localStorage.edu_ins_client_openId || localStorage.edu_ins_client_openId == undefined) {
      //if (!localStorage.axx_ins_client_openId || localStorage.axx_ins_client_openId == undefined) {
        let url = location.host
        //console.log(location.href)
        //console.log("准备跳转");   wx594ab33e0466eccf
src/views/user/login.vue
@@ -2,7 +2,7 @@
 * @Author: 小明丶
 * @Date: 2019-08-15 10:20:56
 * @LastEditors: zxq
 * @LastEditTime: 2022-06-16 11:34:10
 * @LastEditTime: 2022-08-04 10:42:08
 * @Description: 登录页面
 -->
<template>
@@ -108,30 +108,9 @@
    if(sessionStorage.verCode){
      this.verCode = sessionStorage.verCode
    }
    this.code = this.getUrlCode("code");
    console.log('this.code:',this.code)
    console.log('this.$route.query.whichPage:',this.$route.query.whichPage)
    if (this.code && !this.$route.query.whichPage) {
      this.$api.wechatUserInfo({ code: this.code}).then(res => {
          console.log('res.body.openid:',res.body.openid)
          localStorage.edu_ins_client_openId = res.body.openid;
          localStorage.edu_ins_client_userMation = JSON.stringify(res.body);
      });
    }
  },
  methods: {
    ...mapActions(["login", "getVercode", "openIdLogin"]),
    //截取code值
    getUrlCode(name) {
      return (
        decodeURIComponent(
          (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
            location.href
          ) || [, ""])[1].replace(/\+/g, "%20")
        ) || null
      );
    },
    ...mapActions(["login", "getVercode"]),
    //登录验证
    loginBut() {
      let v = this.$tool;
@@ -155,7 +134,7 @@
        vm: this,
        mblNo: this.mblNo,
        verCode: this.verCode,
        openId: localStorage.edu_ins_client_openId
        // openId: localStorage.axx_ins_client_openId
      });
    },
    sendCode() {
@@ -175,12 +154,6 @@
        sessionStorage.beforeDate = new Date().getTime()
        this.getSecond(60);
      })
      // this.$store.dispatch("getVercode", {
      //   vm: this,
      //   mblNo: this.mblNo,
      //   verCodeType: 1
      // });
    },
    //发送验证码计时函数
    getSecond(wait) {
@@ -229,7 +202,6 @@
  
  beforeRouteLeave (to, from, next) {
    // ...
    clearTimeout(this.timer)
    next()
  }