zoukankan      html  css  js  c++  java
  • 2020-03-30

    庚子鼠年 己卯月 壬申日

    描述

    继续完善项目

    随笔

    强智登录模块

    1. 从cookie中获取,没有就不做操作,有就存入store
    2. 进入需要强智token的页面才去检测token,先简单检测(姓名,学号那些可以复用,没必要请求后台),然后获取数据的时候检测
    3. 如果不满足条件或者token过期,调用store中的异步方法updataQzInfo刷新数据
    4. 如果学号或者密码错误,则重定向到学号绑定页面

    相关代码

    mutations: {
        setQz (state, qz) {
          state.qz = qz
        }
      },
      actions: {
        // 通过cookie的数据 异步刷新用户的强智基本信息
        updataQzInfo (context) {
          // 通过保存的cook来给params赋值
          const params = {
            xh: this.state.qz.user.useraccount,
            pwd: this.state.qz.user.userpasswd,
            method: 'authUser'
          }
          qz.getQzInfo(params).then(res => {
            if (res.token === '-1') {
              console.log('密码错误或学号错误:' + res.token)
              // this.$router.push('/xhbind') 报错当前的url
              VueCookies.set('re_url', window.location.href)
              window.location.href = '/xhbind'
            } else {
              context.commit('setQz', res)
            }
          })
        }
      }
    
  • 相关阅读:
    Beans
    Redis记录-Redis命令
    Redis记录-Redis介绍
    RESTful记录-RESTful服务
    RESTful记录-RESTful内容
    RESTful记录-RESTful介绍
    HTTP记录-HTTP介绍
    Solr记录-solr检索和查询数据
    Solr记录-solr文档xml
    Solr记录-solr内核与索引
  • 原文地址:https://www.cnblogs.com/chang1024/p/12601887.html
Copyright © 2011-2022 走看看