Browse Source

format issues

Michael Wang 7 years ago
parent
commit
525a92b102
4 changed files with 22 additions and 21 deletions
  1. 5 8
      .eslintrc.js
  2. 8 1
      README.md
  3. 4 1
      http-test/online-exam.http
  4. 5 11
      src/router.js

+ 5 - 8
.eslintrc.js

@@ -3,15 +3,12 @@ module.exports = {
   env: {
     node: true
   },
-  'extends': [
-    'plugin:vue/essential',
-    '@vue/prettier'
-  ],
+  extends: ["plugin:vue/essential", "@vue/prettier"],
   rules: {
-    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
-    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
+    "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
+    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
   },
   parserOptions: {
-    parser: 'babel-eslint'
+    parser: "babel-eslint"
   }
-}
+};

+ 8 - 1
README.md

@@ -83,7 +83,14 @@ vue-cli
 5.  界面展示程序状态,即出错信息
 
 如果用户需要 vuex action 的结果,可以在 vuex action 里面返回 promise,不建议在 component 处理状态。
- 应该尽可能通过 store 的状态更新使得界面更新。
+应该尽可能通过 store 的状态更新使得界面更新。
+
+## 状态处理
+
+无需共享状态的组件可以直接在组件的生命周期中发请求获取数据。一般是纯显示的组件比较多。
+
+共享状态的通过 vuex 来处理。
+TODO: module state
 
 ### 参考资料
 

+ 4 - 1
http-test/online-exam.http

@@ -26,7 +26,10 @@ GET https://ecs-dev.qmth.com.cn:8878/api/online_exam_course/currentTime
 token: {{token}}
 key: {{key}}
 
+###
+GET https://ecs-dev.qmth.com.cn:8878/api/ecs_core/org/logo?domain=ecs-dev.qmth.com.cn
 
 
-
+###
+GET https://ecs-dev.qmth.com.cn:8878/api/ecs_core/org/getRootOrgByCode?code=ecs-dev.qmth.com.cn
 

+ 5 - 11
src/router.js

@@ -10,7 +10,8 @@ import Login from "./features/login/Login.vue";
 Vue.use(Router);
 let router = new Router({
   mode: "history",
-  routes: [{
+  routes: [
+    {
       path: "/",
       name: "home",
       component: Home
@@ -30,11 +31,6 @@ let router = new Router({
       name: "OnlineExamHome",
       component: OnlineExamHome
     },
-    {
-      path: "/online-exam",
-      name: "OnlineExamHome",
-      component: OnlineExamHome
-    },
     {
       path: "*",
       component: NotFoundComponent
@@ -43,18 +39,16 @@ let router = new Router({
 });
 
 router.beforeEach((to, from, next) => {
-  debugger
+  debugger;
   if (to.path === "/login") {
     next();
   } else {
     if (!window.localStorage.getItem("token")) {
-      next({
-        path: "/login"
-      })
+      next({ path: "/login" });
     } else {
       next();
     }
   }
 });
 
-export default router;
+export default router;