提交 3fc2ac98 作者: 毛细亚

更新缓存

上级 8aa3de7b
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9"/><title>company_app</title><script src="https://g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"></script><script defer="defer" src="static/js/chunk-vendors.fc0c503d.js"></script><script defer="defer" src="static/js/app.24843ee7.js"></script><link href="static/css/chunk-vendors.8e901099.css" rel="stylesheet"><link href="static/css/app.ea202361.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but company_app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9"/><title>company_app</title><script src="https://g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"></script><script defer="defer" src="static/js/chunk-vendors.b6398f5b.js"></script><script defer="defer" src="static/js/app.756234a1.js"></script><link href="static/css/chunk-vendors.8e901099.css" rel="stylesheet"><link href="static/css/app.b6496a0d.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but company_app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
......@@ -153,13 +153,6 @@ export default {
this.set_token(cookieToken)
console.log('从 Cookie 恢复 token:', cookieToken)
}
// 页面刷新时从 Cookie 恢复 accountSelect 到 store
const cookieAccountSelect = Cookies.get('accountSelect')
if (cookieAccountSelect && !this.$store.state.game.accountSelect) {
this.set_accountSelect(cookieAccountSelect)
console.log('从 Cookie 恢复 accountSelect:', cookieAccountSelect)
}
// 初始化时处理路径
const currentPath = this.$route.path
if (currentPath === '/' || currentPath === '' || currentPath === '/index.html') {
......
......@@ -5,12 +5,9 @@ import { zyouBindMember } from '@/api/works'
import Cookies from 'js-cookie'
// 从本地缓存获取accountSelect
const getAccountSelectFromCache = () => {
return Cookies.get('accountSelect') || ''
}
const state = {
accountSelect: getAccountSelectFromCache(), // 当前选中的用户的member_id,从缓存初始化
accountSelect: '', // 当前选中的用户的member_id,从缓存初始化
bindGameUserList: [], // 用户绑定的游戏角色
changeSelectWindow: false, // 切换客服窗口的时候 下发通知
gameUserInfo:{},
......@@ -22,12 +19,6 @@ const state = {
const mutations = {
set_accountSelect(state, data) {
state.accountSelect = data
// 同步到本地缓存
if (data) {
Cookies.set('accountSelect', data, { expires: 30 }) // 30天过期
} else {
Cookies.remove('accountSelect')
}
},
set_bindGameUserList(state, data) {
state.bindGameUserList = data
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论