lixin-web
Version:
vue and bootstrap
67 lines (60 loc) • 1.56 kB
JavaScript
import {ajax} from '../../js/util/axios'
const state = {
GA:false,
GACfg:{},
// hasPayPw,hasProPw value '' not false
// webapp/component/admin/user-center/PayPw.vue:89
securityStatus:{
isBindSecurity:'',
isBindWithdrawPassword:''
},
registLinkList:[]
}
const getters = {
GA: state => state.GA,
GACfg: state => state.GACfg,
securityStatus: state => state.securityStatus,
hasPayName: state => state.securityStatus.isBindWithdrawName,
hasPayPw: state => state.securityStatus.isBindWithdrawPassword,
hasProPw: state => state.securityStatus.isBindSecurity,
registLinkList: state => state.registLinkList,
}
const actions = {
getGACfg({state,commit},callback = () => {}){
if(!state.GA) return
if(typeof state.GACfg.accountId === 'number'){
callback(state.GACfg)
}else{
ajax('account/prepare-update-google-auth',data => {
commit('setGACfg',data)
callback(data)
})
}
},
checkSecurity({state,commit},callback = () => {}){
ajax('account/get-bind-status',data => {
commit('setSecurity',data)
callback(data)
})
}
}
const mutations = {
setGA (state,result) {
state.GA = result
},
setGACfg(state,cfg){
state.GACfg = {...state.GACfg,...cfg}
},
setSecurity(state,result){
state.securityStatus = {...state.securityStatus,...result}
},
setRegistLink(state,list){
state.registLinkList = list
}
}
export default {
state,
getters,
actions,
mutations
}