xuqiang 4 лет назад
Родитель
Сommit
13c692887e
7 измененных файлов с 118 добавлено и 99 удалено
  1. 3 3
      package-lock.json
  2. 1 1
      package.json
  3. 9 1
      project.private.config.json
  4. 32 33
      src/App.vue
  5. 1 2
      src/main.js
  6. 13 0
      src/pages/Home.vue
  7. 59 59
      src/store/vuex.js

+ 3 - 3
package-lock.json

@@ -5212,9 +5212,9 @@
       }
     },
     "es-abstract": {
-      "version": "1.18.4",
-      "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.4.tgz",
-      "integrity": "sha512-xjDAPJRxKc1uoTkdW8MEk7Fq/2bzz3YoCADYniDV7+KITCUdu9c90fj1aKI7nEZFZxRrHlDo3wtma/C6QkhlXQ==",
+      "version": "1.18.5",
+      "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.5.tgz",
+      "integrity": "sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA==",
       "dev": true,
       "requires": {
         "call-bind": "^1.0.2",

+ 1 - 1
package.json

@@ -41,7 +41,7 @@
     "@vant/weapp": "^1.7.2",
     "axios": "^0.21.1",
     "babel-loader": "^8.2.2",
-    "dayjs": "^1.10.4",
+    "dayjs": "^1.10.6",
     "megalo": "latest",
     "octoparse": "^0.4.2",
     "qs": "^6.10.1",

+ 9 - 1
project.private.config.json

@@ -11,7 +11,15 @@
       "list": []
     },
     "miniprogram": {
-      "list": []
+      "list": [
+         {
+          "id": -1,
+          "name": "首页",
+          "pathName": "/pages/Home",
+          "query": "",
+          "scene": null
+        }
+      ]
     }
   }
 }

+ 32 - 33
src/App.vue

@@ -1,39 +1,38 @@
 <script>
 export default {
   onLaunch(options) {
-    wx.login({
-      success: res => {
-        console.log(res);
-        this.$http
-          .post("/auth/maLogin", { code: res.code })
-          .then(res => {
-            this.$http.setToken(res.token);
-            this.$store.commit("setSessionKey", res.sessionKey);
-            this.$store
-              .dispatch("getUserInfo")
-              .then(() => {
-                this.globalData.initialize = true;
-                console.log(this.globalData);
-                if (this.globalData.initializeCallback) {
-                  this.globalData.initializeCallback();
-                }
-              })
-              .catch(() => {
-                this.globalData.initialize = true;
-              });
-          })
-          .catch(e => {
-            console.log(e);
-          });
-      }
-    });
-    wx.getSystemInfo({
-      success: res => {
-        console.log(res);
-        this.$store.commit("setSystemInfo", res);
-      }
-    });
-
+    // wx.login({
+    //   success: res => {
+    //     console.log(res);
+    //     this.$http
+    //       .post("/auth/maLogin", { code: res.code })
+    //       .then(res => {
+    //         this.$http.setToken(res.token);
+    //         this.$store.commit("setSessionKey", res.sessionKey);
+    //         this.$store
+    //           .dispatch("getUserInfo")
+    //           .then(() => {
+    //             this.globalData.initialize = true;
+    //             console.log(this.globalData);
+    //             if (this.globalData.initializeCallback) {
+    //               this.globalData.initializeCallback();
+    //             }
+    //           })
+    //           .catch(() => {
+    //             this.globalData.initialize = true;
+    //           });
+    //       })
+    //       .catch(e => {
+    //         console.log(e);
+    //       });
+    //   }
+    // });
+    // wx.getSystemInfo({
+    //   success: res => {
+    //     console.log(res);
+    //     this.$store.commit("setSystemInfo", res);
+    //   }
+    // });
     // Do something initial when launch.
   },
   onShow(options) {

+ 1 - 2
src/main.js

@@ -26,7 +26,7 @@ app.$mount();
 export default {
   config: {
     // pages 的首个页面会被编译成首页
-    pages: ["pages/hello", "pages/my/my", "pages/vuex/vuex"],
+    pages: ["pages/hello", "pages/my/my", "pages/vuex/vuex", "pages/Home"],
     tabBar: {
       color: "#333",
       selectedColor: "#007d37",
@@ -54,7 +54,6 @@ export default {
     window: {
       backgroundTextStyle: "light",
       navigationBarBackgroundColor: "#fff",
-      navigationBarTitleText: "megalo project",
       navigationBarTextStyle: "black"
     }
   }

+ 13 - 0
src/pages/Home.vue

@@ -0,0 +1,13 @@
+<config>
+{
+    "navigationBarTitleText": "常见问题",
+    "backgroundColor":"#F5F7FA"
+}
+</config>
+<template>
+  <div>111</div>
+</template>
+<script>
+export default {};
+</script>
+<style lang="less"></style>

+ 59 - 59
src/store/vuex.js

@@ -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]);
+//           }
+//         });
+//     }
+//   }
+// });