12345678910111213141516171819202122232425262728 |
- // 获取登录token
- export function againToken($u, openid,userId) {
- $u.api.reLogin({wechatOpenid: openid}).then((userData) => {
- if(userData && userData.code ===200) {
- if(userData.data && userData.data.accessToken){
- $u.vuex('vuex_user_info', userData.data);
- } else {
- // 清空用户数据缓存
- $u.vuex('vuex_user_info', {});
- $u.vuex('vuex_member_info', {});
- }
- $u.api.memberInfo({id:userId}).then(({code, data, msg}) => {
- if(code ===200) {
- $u.vuex('vuex_member_info', data)
- if(window && window.location){
- window.location.reload(false);
- }else{
- $u.route('/pages/index/index',{type:'reLaunch'});
- }
- }
- })
- } else {
- // 清空用户数据缓存
- $u.vuex('vuex_user_info', {});
- $u.vuex('vuex_member_info', {});
- }
- })
- }
|