1234567891011121314151617181920212223 |
- import store from '@/store/index.js'
- import authorize from '@/common/config/authorize.js'
- import { userInfoLogin } from "@/api/use.js"
- // 根据微信的code获取用户登录状态:1已登录过 -1未登录过
- const wxLoginAuthorize = function(){
- authorize.getCode('weixin').then(wechatcode =>{
- userInfoLogin({code:wechatcode}).then(response =>{
- store.commit('updateStatus',response.data)
- store.commit('login',response.data);
- uni.setStorageSync('token',response.data.token)
- uni.removeStorageSync('sessionid')
- uni.setStorageSync('sessionid','JSESSIONID='+response.data.sessionId)
- }).catch(response =>{
- uni.removeStorageSync('sessionid')
- uni.setStorageSync('sessionid','JSESSIONID='+response.data)
- store.commit('logout',response.data)
- store.commit('updateStatus',response.data)
- })
- })
- }
- export default{
- wxLoginAuthorize
- }
|