112 lines
2.1 KiB
JavaScript
112 lines
2.1 KiB
JavaScript
import {
|
|
code,
|
|
dologin,
|
|
sendSms,
|
|
register,
|
|
getBindUserDeviceId,
|
|
getDayInfo,
|
|
getDeviceListDays,
|
|
getVersion,
|
|
getIndexData,
|
|
forgotPassword,
|
|
getUserInfo,
|
|
checkLoginCode,
|
|
getLoginCode
|
|
} from '@/common/api.js';
|
|
|
|
let state = {
|
|
userInfo: {},
|
|
apiToken: '',
|
|
serverTime:0,
|
|
activeDevice: ''
|
|
},
|
|
getters = {
|
|
getUserInfo(state){
|
|
return state.userInfo
|
|
},
|
|
getApiToken(state){
|
|
return state.apiToken
|
|
},
|
|
getServerTime(state){
|
|
return state.serverTime
|
|
},
|
|
getActiceDevice(state){
|
|
return state.activeDevice
|
|
}
|
|
},
|
|
mutations = {
|
|
setUserInfo(state,data) {
|
|
state.userInfo = data
|
|
},
|
|
setApiToken(state,data){
|
|
state.apiToken = data
|
|
},
|
|
logOut(state,data) {
|
|
state.apiToken = ''
|
|
},
|
|
setActiceDevice(state,data) {
|
|
state.activeDevice = data
|
|
}
|
|
},
|
|
actions = {
|
|
async code({commit}, data) {
|
|
const res = await code(data)
|
|
return res
|
|
},
|
|
async dologin({commit}, data) {
|
|
const res = await dologin(data)
|
|
return res
|
|
},
|
|
async sendSms({commit}, data) {
|
|
const res = await sendSms(data)
|
|
return res
|
|
},
|
|
async register({commit}, data) {
|
|
const res = await register(data)
|
|
return res
|
|
},
|
|
async getBindUserDeviceId({commit}, data) {
|
|
const res = await getBindUserDeviceId(data)
|
|
return res
|
|
},
|
|
async getDayInfo({commit}, data) {
|
|
const res = await getDayInfo(data)
|
|
return res
|
|
},
|
|
async getDeviceListDays({commit}, data) {
|
|
const res = await getDeviceListDays(data)
|
|
return res
|
|
},
|
|
async getVersion({commit}, data) {
|
|
const res = await getVersion(data)
|
|
return res
|
|
},
|
|
async getIndexData({commit}, data) {
|
|
const res = await getIndexData(data)
|
|
return res
|
|
},
|
|
async forgotPassword({commit}, data) {
|
|
const res = await forgotPassword(data)
|
|
return res
|
|
},
|
|
async getUserInfo({commit}, data) {
|
|
const res = await getUserInfo(data)
|
|
return res
|
|
},
|
|
async getLoginCode({commit}, data) {
|
|
const res = await getLoginCode(data)
|
|
return res
|
|
},
|
|
async checkLoginCode({commit}, data,config) {
|
|
const res = await checkLoginCode(data,config)
|
|
return res
|
|
},
|
|
}
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
getters,
|
|
mutations,
|
|
actions
|
|
}
|