|
@ -713,7 +713,25 @@ import * as YinhangApi from '@/api/shop/yinhang' |
|
|
import * as InfoApi from '@/api/shop/info' |
|
|
import * as InfoApi from '@/api/shop/info' |
|
|
import * as Api from '@/api/page' |
|
|
import * as Api from '@/api/page' |
|
|
import store from '@/store' |
|
|
import store from '@/store' |
|
|
|
|
|
|
|
|
|
|
|
import storage from '@/utils/storage' |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
ACCESS_TOKEN, |
|
|
|
|
|
USER_ID |
|
|
|
|
|
} from '@/store/mutation-types' |
|
|
|
|
|
const loginSuccess = (commit, { |
|
|
|
|
|
token, |
|
|
|
|
|
userId |
|
|
|
|
|
}) => { |
|
|
|
|
|
// 过期时间30天 |
|
|
|
|
|
const expiryTime = 30 * 86400 |
|
|
|
|
|
// 保存tokne和userId到缓存 |
|
|
|
|
|
storage.set(USER_ID, userId, expiryTime) |
|
|
|
|
|
storage.set(ACCESS_TOKEN, token, expiryTime) |
|
|
|
|
|
// 记录到store全局变量 |
|
|
|
|
|
commit('SET_TOKEN', token) |
|
|
|
|
|
commit('SET_USER_ID', userId) |
|
|
|
|
|
} |
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
@ -798,8 +816,10 @@ export default { |
|
|
var systemInfo = graceJS.system(); |
|
|
var systemInfo = graceJS.system(); |
|
|
this.contentHeight = systemInfo.windowHeight * 0.65; |
|
|
this.contentHeight = systemInfo.windowHeight * 0.65; |
|
|
}, |
|
|
}, |
|
|
async onLoad() { |
|
|
|
|
|
await this.getUserInfo() |
|
|
|
|
|
|
|
|
async onLoad(options) { |
|
|
|
|
|
if (options.token) { |
|
|
|
|
|
await this.getUserInfo(options.id, options.token) |
|
|
|
|
|
} |
|
|
this.getDetail() |
|
|
this.getDetail() |
|
|
|
|
|
|
|
|
this.getCategory() |
|
|
this.getCategory() |
|
@ -813,6 +833,7 @@ export default { |
|
|
store.dispatch('Login', { |
|
|
store.dispatch('Login', { |
|
|
mobile: result.data.mobile |
|
|
mobile: result.data.mobile |
|
|
}) |
|
|
}) |
|
|
|
|
|
loginSuccess(token, id) |
|
|
resolve() |
|
|
resolve() |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|