|
@@ -11,28 +11,31 @@ Vue.use(Vuex);
|
|
|
export default new Vuex.Store({
|
|
|
//所有的数据都放在state中
|
|
|
state: {
|
|
|
- msgCount:0,
|
|
|
- cartCount:0,
|
|
|
+ msgCount: 0,
|
|
|
+ cartCount: 0,
|
|
|
applyData: {}, //预约考试数据存放
|
|
|
- currentRouter:{},
|
|
|
+ currentRouter: {},
|
|
|
token: '',
|
|
|
user_account: '',
|
|
|
userInfo: null,
|
|
|
- examResult:{},
|
|
|
+ examResult: {},
|
|
|
header: {
|
|
|
serviceTel: {}
|
|
|
},//页头配置
|
|
|
footer: [],//页尾配置
|
|
|
links: null,//友情链接
|
|
|
- sysTime:0,
|
|
|
- businessItem:null,
|
|
|
- businessList:[],
|
|
|
+ sysTime: 0,
|
|
|
+ businessItem: null,
|
|
|
+ businessList: [],
|
|
|
+ isDesktop: !navigator.userAgent.match(
|
|
|
+ /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile)/i
|
|
|
+ )
|
|
|
},
|
|
|
|
|
|
getters: {
|
|
|
- businessList:state => state.businessList,
|
|
|
+ businessList: state => state.businessList,
|
|
|
businessItem: state => state.businessItem,
|
|
|
- sysTime: state => state.sysTime,
|
|
|
+ sysTime: state => state.sysTime,
|
|
|
userInfo: state => state.userInfo,
|
|
|
token: state => state.token,
|
|
|
header: state => state.header,
|
|
@@ -47,20 +50,20 @@ export default new Vuex.Store({
|
|
|
|
|
|
//操作数据,唯一的通道是mutations
|
|
|
mutations: {
|
|
|
- setBusinessList(state,list) {
|
|
|
+ setBusinessList(state, list) {
|
|
|
state.businessList = list
|
|
|
},
|
|
|
- setBusinessItem(state,item) {
|
|
|
+ setBusinessItem(state, item) {
|
|
|
console.log(item)
|
|
|
state.businessItem = item
|
|
|
},
|
|
|
- commonSystemTime(state,time) {
|
|
|
- state.sysTime = time;
|
|
|
- },
|
|
|
- setCurrentRouter(state,data) {
|
|
|
+ commonSystemTime(state, time) {
|
|
|
+ state.sysTime = time;
|
|
|
+ },
|
|
|
+ setCurrentRouter(state, data) {
|
|
|
state.currentRouter = data;
|
|
|
},
|
|
|
- setExamResult(state,data) {
|
|
|
+ setExamResult(state, data) {
|
|
|
state.examResult = data;
|
|
|
},
|
|
|
updateApplyData(state, data) {
|
|
@@ -93,7 +96,7 @@ export default new Vuex.Store({
|
|
|
|
|
|
getMsgCount(state) {
|
|
|
user.getappinformUserlist({
|
|
|
- systemStatusList:'1,2',
|
|
|
+ systemStatusList: '1,2',
|
|
|
receiptStatus: 0,
|
|
|
}).then(res => {
|
|
|
state.msgCount = res.total
|
|
@@ -104,36 +107,36 @@ export default new Vuex.Store({
|
|
|
//actions,可以来做异步操作,然后提交给mutations,而后再对state(数据)进行操作
|
|
|
actions: {
|
|
|
/**
|
|
|
- * 设置系统时间
|
|
|
- */
|
|
|
- setSystemTime({
|
|
|
- commit
|
|
|
- }) {
|
|
|
- return new Promise(resolve => {
|
|
|
- common.commonSystemTime().then(res => {
|
|
|
- if(res.code == 200) {
|
|
|
- commit('commonSystemTime', res.data)
|
|
|
- resolve()
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
+ * 设置系统时间
|
|
|
+ */
|
|
|
+ setSystemTime({
|
|
|
+ commit
|
|
|
+ }) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ common.commonSystemTime().then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ commit('commonSystemTime', res.data)
|
|
|
+ resolve()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
getbusinessList({
|
|
|
commit
|
|
|
}) {
|
|
|
return new Promise(resolve => {
|
|
|
- order.orderUserAllBusinessList().then( res => {
|
|
|
- if(res.code == 200) {
|
|
|
+ order.orderUserAllBusinessList().then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
commit('setBusinessList', res.rows)
|
|
|
- if(res.rows&&res.rows.length) {
|
|
|
- commit('setBusinessItem',res.rows[0])
|
|
|
+ if (res.rows && res.rows.length) {
|
|
|
+ commit('setBusinessItem', res.rows[0])
|
|
|
}
|
|
|
- resolve()
|
|
|
+ resolve()
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
/**
|
|
|
*
|
|
@@ -143,13 +146,13 @@ export default new Vuex.Store({
|
|
|
*/
|
|
|
getUserInfo(context) {
|
|
|
return new Promise(resolve => {
|
|
|
- login.getInfo({fromPlat: 2}).then(res => {
|
|
|
+ login.getInfo({ fromPlat: 2 }).then(res => {
|
|
|
context.commit('setUserInfo', res.data)
|
|
|
- if(!tools.getUuid()) {
|
|
|
+ if (!tools.getUuid()) {
|
|
|
tools.setUuid(new Date().valueOf() + "")
|
|
|
}
|
|
|
resolve()
|
|
|
- }).catch(err => {})
|
|
|
+ }).catch(err => { })
|
|
|
})
|
|
|
},
|
|
|
/**
|