|
|
@@ -1,60 +1,60 @@
|
|
|
-import Vuex from "vuex";
|
|
|
-import http from "../plugins/http";
|
|
|
-export default new Vuex.Store({
|
|
|
- state: {
|
|
|
- sessionKey: "",
|
|
|
- safeArea: {
|
|
|
- top: 0,
|
|
|
- botton: 0
|
|
|
- },
|
|
|
- systemInfo: {
|
|
|
- statusBarHeight: 44
|
|
|
- },
|
|
|
- userInfo: null,
|
|
|
- userStoreInfo: null
|
|
|
- },
|
|
|
- mutations: {
|
|
|
- setUserInfo(state, userInfo) {
|
|
|
- state.userInfo = userInfo;
|
|
|
- },
|
|
|
- setSessionKey(state, sessionKey) {
|
|
|
- state.sessionKey = sessionKey;
|
|
|
- },
|
|
|
- setSystemInfo(state, systemInfo) {
|
|
|
- state.systemInfo = systemInfo;
|
|
|
- },
|
|
|
- setUserStoreInfo(state, userStoreInfo) {
|
|
|
- state.userStoreInfo = userStoreInfo;
|
|
|
- }
|
|
|
- },
|
|
|
- actions: {
|
|
|
- getUserInfo(context) {
|
|
|
- return http.http.get("/user/my").then(res => {
|
|
|
- if (res.sex || res.nickname.indexOf("用户") === -1) {
|
|
|
- context.commit("setUserInfo", res);
|
|
|
- } else {
|
|
|
- context.commit("setUserInfo", null);
|
|
|
- }
|
|
|
+// import Vuex from "vuex";
|
|
|
+// import http from "../plugins/http";
|
|
|
+// export default new Vuex.Store({
|
|
|
+// state: {
|
|
|
+// sessionKey: "",
|
|
|
+// safeArea: {
|
|
|
+// top: 0,
|
|
|
+// botton: 0
|
|
|
+// },
|
|
|
+// systemInfo: {
|
|
|
+// statusBarHeight: 44
|
|
|
+// },
|
|
|
+// userInfo: null,
|
|
|
+// userStoreInfo: null
|
|
|
+// },
|
|
|
+// mutations: {
|
|
|
+// setUserInfo(state, userInfo) {
|
|
|
+// state.userInfo = userInfo;
|
|
|
+// },
|
|
|
+// setSessionKey(state, sessionKey) {
|
|
|
+// state.sessionKey = sessionKey;
|
|
|
+// },
|
|
|
+// setSystemInfo(state, systemInfo) {
|
|
|
+// state.systemInfo = systemInfo;
|
|
|
+// },
|
|
|
+// setUserStoreInfo(state, userStoreInfo) {
|
|
|
+// state.userStoreInfo = userStoreInfo;
|
|
|
+// }
|
|
|
+// },
|
|
|
+// actions: {
|
|
|
+// getUserInfo(context) {
|
|
|
+// return http.http.get("/user/my").then(res => {
|
|
|
+// if (res.sex || res.nickname.indexOf("用户") === -1) {
|
|
|
+// context.commit("setUserInfo", res);
|
|
|
+// } else {
|
|
|
+// context.commit("setUserInfo", null);
|
|
|
+// }
|
|
|
|
|
|
- return Promise.resolve(res);
|
|
|
- });
|
|
|
- },
|
|
|
- getUserStore(context) {
|
|
|
- return http.http
|
|
|
- .postJson("/store/all", {
|
|
|
- query: {
|
|
|
- userId: context.state.userInfo.id
|
|
|
- }
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- if (res.empty) {
|
|
|
- context.commit("setUserStoreInfo", null);
|
|
|
- return Promise.reject();
|
|
|
- } else {
|
|
|
- context.commit("setUserStoreInfo", res.content[0]);
|
|
|
- return Promise.resolve(res.content[0]);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-});
|
|
|
+// return Promise.resolve(res);
|
|
|
+// });
|
|
|
+// },
|
|
|
+// getUserStore(context) {
|
|
|
+// return http.http
|
|
|
+// .postJson("/store/all", {
|
|
|
+// query: {
|
|
|
+// userId: context.state.userInfo.id
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .then(res => {
|
|
|
+// if (res.empty) {
|
|
|
+// context.commit("setUserStoreInfo", null);
|
|
|
+// return Promise.reject();
|
|
|
+// } else {
|
|
|
+// context.commit("setUserStoreInfo", res.content[0]);
|
|
|
+// return Promise.resolve(res.content[0]);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|