guhongwei 4 yıl önce
işleme
29ebf0da3e
53 değiştirilmiş dosya ile 2230 ekleme ve 0 silme
  1. 2 0
      .env
  2. 33 0
      .eslintrc.js
  3. 22 0
      .gitignore
  4. 0 0
      .prettierrc
  5. 5 0
      README.md
  6. 3 0
      babel.config.js
  7. 64 0
      package.json
  8. BIN
      public/favicon.ico
  9. 42 0
      public/index.html
  10. 28 0
      src/App.vue
  11. 28 0
      src/assets/css/color-dark.css
  12. 4 0
      src/assets/css/icon.css
  13. 177 0
      src/assets/css/main.css
  14. 29 0
      src/assets/css/theme-green/color-green.css
  15. BIN
      src/assets/css/theme-green/fonts/element-icons.ttf
  16. BIN
      src/assets/css/theme-green/fonts/element-icons.woff
  17. 1 0
      src/assets/css/theme-green/index.css
  18. BIN
      src/assets/img/img.jpg
  19. BIN
      src/assets/img/login-bg.jpg
  20. BIN
      src/assets/logo.png
  21. 179 0
      src/components/common/Header.vue
  22. 66 0
      src/components/common/Home.vue
  23. 140 0
      src/components/common/Sidebar.vue
  24. 181 0
      src/components/common/Tags.vue
  25. 33 0
      src/components/common/breadcrumb.vue
  26. 6 0
      src/components/common/bus.js
  27. 79 0
      src/components/common/directives.js
  28. 30 0
      src/components/common/i18n.js
  29. 64 0
      src/main.js
  30. 19 0
      src/plugins/axios.js
  31. 39 0
      src/plugins/check-res.js
  32. 5 0
      src/plugins/element.js
  33. 6 0
      src/plugins/filters.js
  34. 27 0
      src/plugins/loading.js
  35. 4 0
      src/plugins/meta.js
  36. 33 0
      src/plugins/methods.js
  37. 21 0
      src/plugins/setting.js
  38. 65 0
      src/plugins/stomp.js
  39. 25 0
      src/plugins/var.js
  40. 41 0
      src/router/index.js
  41. 56 0
      src/store/adminLogin.js
  42. 17 0
      src/store/index.js
  43. 33 0
      src/store/user/mutations.js
  44. 2 0
      src/store/user/state.js
  45. 117 0
      src/util/axios-wrapper.js
  46. 10 0
      src/util/filters.js
  47. 50 0
      src/util/methods-util.js
  48. 69 0
      src/util/user-util.js
  49. 55 0
      src/views/404.vue
  50. 212 0
      src/views/Login.vue
  51. 32 0
      src/views/homeIndex.vue
  52. 38 0
      src/views/question/index.vue
  53. 38 0
      vue.config.js

+ 2 - 0
.env

@@ -0,0 +1,2 @@
+VUE_APP_AXIOS_BASE_URL = ''
+VUE_APP_ROUTER="/liveQuest"

+ 33 - 0
.eslintrc.js

@@ -0,0 +1,33 @@
+// https://eslint.org/docs/user-guide/configuring
+
+module.exports = {
+  root: true,
+  env: {
+    node: true,
+  },
+  extends: ['plugin:vue/essential', '@vue/prettier'],
+  plugins: ['vue'],
+  rules: {
+    'max-len': [
+      'warn',
+      {
+        code: 250,
+      },
+    ],
+    'no-unused-vars': 'off',
+    'no-console': 'off',
+    'prettier/prettier': [
+      'warn',
+      {
+        singleQuote: true,
+        trailingComma: 'es5',
+        bracketSpacing: true,
+        jsxBracketSameLine: true,
+        printWidth: 160,
+      },
+    ],
+  },
+  parserOptions: {
+    parser: 'babel-eslint',
+  },
+};

+ 22 - 0
.gitignore

@@ -0,0 +1,22 @@
+.DS_Store
+node_modules
+package-lock.json
+/dist
+example.html
+# local env files
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw*

+ 0 - 0
.prettierrc


+ 5 - 0
README.md

@@ -0,0 +1,5 @@
+## 项目操作
+### 下载依赖包 npm i &&  npm install
+### 运行项目 npm run serve
+### 打包项目 npm run build
+

+ 3 - 0
babel.config.js

@@ -0,0 +1,3 @@
+module.exports = {
+  presets: ['@vue/cli-plugin-babel/preset'],
+};

+ 64 - 0
package.json

@@ -0,0 +1,64 @@
+{
+  "name": "website-cms",
+  "version": "0.1.0",
+  "private": true,
+  "scripts": {
+    "serve": "vue-cli-service serve",
+    "build": "vue-cli-service build",
+    "lint": "vue-cli-service lint"
+  },
+  "dependencies": {
+    "axios": "^0.20.0",
+    "babel-polyfill": "^6.26.0",
+    "core-js": "^3.6.5",
+    "element-ui": "^2.13.2",
+    "html2canvas": "^1.0.0-rc.7",
+    "jsonwebtoken": "^8.5.1",
+    "jspdf": "^2.3.1",
+    "lodash": "^4.17.20",
+    "naf-core": "^0.1.2",
+    "qrcode": "^1.4.4",
+    "vue": "^2.6.11",
+    "vue-i18n": "^8.21.0",
+    "vue-meta": "^2.4.0",
+    "vue-router": "^3.2.0",
+    "vuex": "^3.4.0",
+    "wangeditor": "^3.1.1"
+  },
+  "devDependencies": {
+    "@vue/cli-plugin-babel": "~4.5.0",
+    "@vue/cli-plugin-eslint": "~4.5.0",
+    "@vue/cli-plugin-router": "~4.5.0",
+    "@vue/cli-plugin-vuex": "~4.5.0",
+    "@vue/cli-service": "~4.5.0",
+    "@vue/eslint-config-prettier": "^6.0.0",
+    "babel-eslint": "^10.1.0",
+    "eslint": "^6.7.2",
+    "eslint-plugin-prettier": "^3.1.3",
+    "eslint-plugin-vue": "^6.2.2",
+    "less": "^3.0.4",
+    "less-loader": "^5.0.0",
+    "prettier": "^1.19.1",
+    "vue-template-compiler": "^2.6.11"
+  },
+  "eslintConfig": {
+    "root": true,
+    "env": {
+      "node": true
+    },
+    "extends": [
+      "plugin:vue/essential",
+      "eslint:recommended",
+      "@vue/prettier"
+    ],
+    "parserOptions": {
+      "parser": "babel-eslint"
+    },
+    "rules": {}
+  },
+  "browserslist": [
+    "> 1%",
+    "last 2 versions",
+    "not dead"
+  ]
+}

BIN
public/favicon.ico


+ 42 - 0
public/index.html

@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width,initial-scale=1.0">
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+    <title><%= htmlWebpackPlugin.options.title %></title>
+    <style>
+      /*修改滚动条样式*/
+      div::-webkit-scrollbar {
+        width: 5px;
+        height: 10px;
+      }
+    
+      div::-webkit-scrollbar-track {
+        background: rgb(239, 239, 239);
+        border-radius: 2px;
+      }
+    
+      div::-webkit-scrollbar-thumb {
+        background: #bfbfbf;
+        border-radius: 10px;
+      }
+    
+      div::-webkit-scrollbar-thumb:hover {
+        background: #333;
+      }
+    
+      div::-webkit-scrollbar-corner {
+        background: #179a16;
+      }
+    </style>
+  </head>
+  <body>
+    <noscript>
+      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
+    </noscript>
+    <div id="app"></div>
+    <!-- built files will be auto injected -->
+  </body>
+</html>

+ 28 - 0
src/App.vue

@@ -0,0 +1,28 @@
+<template>
+  <div id="App">
+    <router-view></router-view>
+  </div>
+</template>
+
+<script>
+export default {
+  metaInfo: { title: 'App' },
+  name: 'App',
+  props: {},
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {},
+};
+</script>
+
+<style>
+@import './assets/css/main.css';
+/*深色主题*/
+@import './assets/css/color-dark.css';
+/* 浅绿色主题*/
+/* @import './assets/css/theme-green/color-green.css'; */
+</style>

+ 28 - 0
src/assets/css/color-dark.css

@@ -0,0 +1,28 @@
+.header{
+    background-color: #242f42;
+}
+.login-wrap{
+    background: #324157;
+}
+.plugins-tips{
+    background: #eef1f6;
+}
+.plugins-tips a{
+    color: #20a0ff;
+}
+.el-upload--text em {
+    color: #20a0ff;
+}
+.pure-button{
+    background: #20a0ff;
+}
+.tags-li.active {
+    border: 1px solid #409EFF;
+    background-color: #409EFF;
+}
+.message-title{
+    color: #20a0ff;
+}
+.collapse-btn:hover{
+    background: rgb(40,52,70);
+}

+ 4 - 0
src/assets/css/icon.css

@@ -0,0 +1,4 @@
+
+    [class*=" el-icon-lx"], [class^=el-icon-lx] {
+        font-family: lx-iconfont!important;
+    }

+ 177 - 0
src/assets/css/main.css

@@ -0,0 +1,177 @@
+* {
+    margin: 0;
+    padding: 0;
+}
+
+html,
+body,
+#app,
+.wrapper {
+    width: 100%;
+    height: 100%;
+    overflow: hidden;
+}
+
+body {
+    font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif;
+}
+
+a {
+    text-decoration: none
+}
+
+
+.content-box {
+    position: absolute;
+    left: 200px;
+    right: 0;
+    top: 60px;
+    bottom: 0;
+    padding-bottom: 30px;
+    -webkit-transition: left .3s ease-in-out;
+    transition: left .3s ease-in-out;
+    background: #f0f0f0;
+}
+
+.content {
+    width: auto;
+    height: 100%;
+    padding: 10px;
+    overflow-y: scroll;
+    box-sizing: border-box;
+}
+
+.content-collapse {
+    left: 65px;
+}
+
+.container {
+    padding: 30px;
+    background: #fff;
+    border: 1px solid #ddd;
+    border-radius: 5px;
+}
+
+.crumbs {
+    margin: 10px 0;
+}
+
+.el-table th {
+    background-color: #f5f7fa !important;
+}
+
+.pagination {
+    margin: 20px 0;
+    text-align: right;
+}
+
+.plugins-tips {
+    padding: 20px 10px;
+    margin-bottom: 20px;
+}
+
+.el-button+.el-tooltip {
+    margin-left: 10px;
+}
+
+.el-table tr:hover {
+    background: #f6faff;
+}
+
+.mgb20 {
+    margin-bottom: 20px;
+}
+
+.move-enter-active,
+.move-leave-active {
+    transition: opacity .5s;
+}
+
+.move-enter,
+.move-leave {
+    opacity: 0;
+}
+
+/*BaseForm*/
+
+.form-box {
+    width: 600px;
+}
+
+.form-box .line {
+    text-align: center;
+}
+
+.el-time-panel__content::after,
+.el-time-panel__content::before {
+    margin-top: -7px;
+}
+
+.el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default) {
+    padding-bottom: 0;
+}
+
+/*Upload*/
+
+.pure-button {
+    width: 150px;
+    height: 40px;
+    line-height: 40px;
+    text-align: center;
+    color: #fff;
+    border-radius: 3px;
+}
+
+.g-core-image-corp-container .info-aside {
+    height: 45px;
+}
+
+.el-upload--text {
+    background-color: #fff;
+    border: 1px dashed #d9d9d9;
+    border-radius: 6px;
+    box-sizing: border-box;
+    width: 360px;
+    height: 180px;
+    text-align: center;
+    cursor: pointer;
+    position: relative;
+    overflow: hidden;
+}
+
+.el-upload--text .el-icon-upload {
+    font-size: 67px;
+    color: #97a8be;
+    margin: 40px 0 16px;
+    line-height: 50px;
+}
+
+.el-upload--text {
+    color: #97a8be;
+    font-size: 14px;
+    text-align: center;
+}
+
+.el-upload--text em {
+    font-style: normal;
+}
+
+/*VueEditor*/
+
+.ql-container {
+    min-height: 400px;
+}
+
+.ql-snow .ql-tooltip {
+    transform: translateX(117.5px) translateY(10px) !important;
+}
+
+.editor-btn {
+    margin-top: 20px;
+}
+
+/*markdown*/
+
+.v-note-wrapper .v-note-panel {
+    min-height: 500px;
+}

+ 29 - 0
src/assets/css/theme-green/color-green.css

@@ -0,0 +1,29 @@
+.header{
+    background-color: #07c4a8;
+}
+.login-wrap{
+    background: rgba(56, 157, 170, 0.82);;
+}
+.plugins-tips{
+    background: #f2f2f2;
+}
+.plugins-tips a{
+    color: #00d1b2;
+}
+.el-upload--text em {
+    color: #00d1b2;
+}
+.pure-button{
+    background: #00d1b2;
+}
+.pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus, .pagination > .active > span, .pagination > .active > span:hover, .pagination > .active > span:focus {
+    background-color: #00d1b2 !important;
+    border-color: #00d1b2 !important;
+}
+.tags-li.active {
+    border: 1px solid #00d1b2;
+    background-color: #00d1b2;
+}
+.collapse-btn:hover{
+    background: #00d1b2;
+}

BIN
src/assets/css/theme-green/fonts/element-icons.ttf


BIN
src/assets/css/theme-green/fonts/element-icons.woff


Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 0
src/assets/css/theme-green/index.css


BIN
src/assets/img/img.jpg


BIN
src/assets/img/login-bg.jpg


BIN
src/assets/logo.png


+ 179 - 0
src/components/common/Header.vue

@@ -0,0 +1,179 @@
+<template>
+  <div class="header">
+    <!-- 折叠按钮 -->
+    <div class="collapse-btn" @click="collapseChage">
+      <i v-if="!collapse" class="el-icon-s-fold"></i>
+      <i v-else class="el-icon-s-unfold"></i>
+    </div>
+    <div class="logo">成果评价系统-管理中心</div>
+    <div class="header-right">
+      <div class="header-user-con">
+        <!-- 全屏显示 -->
+        <div class="btn-fullscreen" @click="handleFullScreen">
+          <el-tooltip effect="dark" :content="fullscreen ? `取消全屏` : `全屏`" placement="bottom">
+            <i class="el-icon-rank"></i>
+          </el-tooltip>
+        </div>
+        <!-- 用户头像 -->
+        <div class="user-avator">
+          <img src="../../assets/img/img.jpg" />
+        </div>
+        <!-- 用户名下拉菜单 -->
+        <el-dropdown class="user-name" trigger="hover">
+          <span class="el-dropdown-link">
+            {{ user.name || '游客' }}
+          </span>
+        </el-dropdown>
+        <div class="btn">
+          <button @click="loginout"><i class="el-icon-switch-button"></i></button>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+import bus from '../common/bus';
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  data() {
+    return {
+      collapse: false,
+      fullscreen: false,
+    };
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  methods: {
+    // 用户名下拉菜单选择事件
+    loginout() {
+      localStorage.removeItem('token');
+      this.$router.push('/login');
+    },
+    // 侧边栏折叠
+    collapseChage() {
+      this.collapse = !this.collapse;
+      bus.$emit('collapse', this.collapse);
+    },
+    // 全屏事件
+    handleFullScreen() {
+      let element = document.documentElement;
+      if (this.fullscreen) {
+        if (document.exitFullscreen) {
+          document.exitFullscreen();
+        } else if (document.webkitCancelFullScreen) {
+          document.webkitCancelFullScreen();
+        } else if (document.mozCancelFullScreen) {
+          document.mozCancelFullScreen();
+        } else if (document.msExitFullscreen) {
+          document.msExitFullscreen();
+        }
+      } else {
+        if (element.requestFullscreen) {
+          element.requestFullscreen();
+        } else if (element.webkitRequestFullScreen) {
+          element.webkitRequestFullScreen();
+        } else if (element.mozRequestFullScreen) {
+          element.mozRequestFullScreen();
+        } else if (element.msRequestFullscreen) {
+          // IE11
+          element.msRequestFullscreen();
+        }
+      }
+      this.fullscreen = !this.fullscreen;
+    },
+  },
+  mounted() {
+    if (document.body.clientWidth < 1500) {
+      this.collapseChage();
+    }
+  },
+};
+</script>
+<style scoped>
+.header {
+  position: relative;
+  box-sizing: border-box;
+  width: 100%;
+  height: 60px;
+  font-size: 22px;
+  color: #fff;
+}
+.collapse-btn {
+  float: left;
+  padding: 0 21px;
+  cursor: pointer;
+  line-height: 60px;
+}
+.header .logo {
+  float: left;
+  width: 25%;
+  line-height: 60px;
+}
+.header-right {
+  float: right;
+  padding-right: 50px;
+}
+.header-user-con {
+  display: flex;
+  height: 60px;
+  align-items: center;
+}
+.btn-fullscreen {
+  transform: rotate(45deg);
+  margin-right: 5px;
+  font-size: 24px;
+}
+.btn-bell,
+.btn-fullscreen {
+  position: relative;
+  width: 30px;
+  height: 30px;
+  text-align: center;
+  border-radius: 15px;
+  cursor: pointer;
+}
+.btn-bell-badge {
+  position: absolute;
+  right: 0;
+  top: -2px;
+  width: 8px;
+  height: 8px;
+  border-radius: 4px;
+  background: #f56c6c;
+  color: #fff;
+}
+.btn-bell .el-icon-bell {
+  color: #fff;
+}
+.user-name {
+  margin-left: 10px;
+}
+.user-avator {
+  margin-left: 20px;
+}
+.user-avator img {
+  display: block;
+  width: 40px;
+  height: 40px;
+  border-radius: 50%;
+}
+.el-dropdown-link {
+  color: #fff;
+  cursor: pointer;
+}
+.el-dropdown-menu__item {
+  text-align: center;
+}
+.btn {
+  margin: 0 0 0 10px;
+}
+.btn button:hover {
+  cursor: pointer;
+  background-color: #409eff;
+  color: #fff;
+}
+.btn button i {
+  font-size: 25px;
+}
+</style>

+ 66 - 0
src/components/common/Home.vue

@@ -0,0 +1,66 @@
+<template>
+  <el-container>
+    <el-header style="padding:0;">
+      <v-head></v-head>
+    </el-header>
+    <el-container>
+      <el-aside width="200px">
+        <v-sidebar></v-sidebar>
+      </el-aside>
+      <el-main>
+        <div class="content-box" :class="{ 'content-collapse': collapse }">
+          <v-tags></v-tags>
+          <div class="content">
+            <transition name="move" mode="out-in">
+              <el-row>
+                <el-col :span="24" class="main">
+                  <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
+                  <el-col :span="24" class="container">
+                    <router-view></router-view>
+                  </el-col>
+                </el-col>
+              </el-row>
+            </transition>
+            <el-backtop target=".content"></el-backtop>
+          </div>
+        </div>
+      </el-main>
+    </el-container>
+  </el-container>
+</template>
+
+<script>
+import breadcrumb from '@c/common/breadcrumb.vue';
+import vHead from './Header.vue';
+import vSidebar from './Sidebar.vue';
+import vTags from './Tags.vue';
+import bus from './bus';
+export default {
+  data() {
+    return {
+      tagsList: [],
+      collapse: false,
+    };
+  },
+  components: {
+    vHead,
+    vSidebar,
+    vTags,
+    breadcrumb,
+  },
+  created() {
+    bus.$on('collapse-content', msg => {
+      this.collapse = msg;
+    });
+
+    // 只有在标签页列表里的页面才使用keep-alive,即关闭标签之后就不保存到内存中了。
+    bus.$on('tags', msg => {
+      let arr = [];
+      for (let i = 0, len = msg.length; i < len; i++) {
+        msg[i].name && arr.push(msg[i].name);
+      }
+      this.tagsList = arr;
+    });
+  },
+};
+</script>

+ 140 - 0
src/components/common/Sidebar.vue

@@ -0,0 +1,140 @@
+<template>
+  <div class="sidebar">
+    <el-menu
+      class="sidebar-el-menu"
+      :default-active="onRoutes"
+      :collapse="collapse"
+      background-color="#324157"
+      text-color="#bfcbd9"
+      active-text-color="#20a0ff"
+      unique-opened
+      router
+    >
+      <template v-for="item in items">
+        <template v-if="item.subs">
+          <el-submenu class="second" :index="item.index" :key="item.index">
+            <template slot="title">
+              <i :class="item.icon"></i>
+              <span slot="title">
+                <span>{{ item.title }}</span>
+              </span>
+            </template>
+            <template v-for="subItem in item.subs">
+              <el-submenu v-if="subItem.subs" :index="subItem.index" :key="subItem.index">
+                <template slot="title">{{ subItem.title }}</template>
+                <el-menu-item v-for="(threeItem, i) in subItem.subs" :key="i" :index="threeItem.index">{{ threeItem.title }}</el-menu-item>
+              </el-submenu>
+              <el-menu-item v-else :index="subItem.index" :key="subItem.index">{{ subItem.title }}</el-menu-item>
+            </template>
+          </el-submenu>
+        </template>
+        <template v-else>
+          <el-menu-item class="first" :index="item.index" :key="item.index">
+            <i :class="item.icon"></i>
+            <span slot="title">
+              <span>{{ item.title }}</span>
+            </span>
+          </el-menu-item>
+        </template>
+      </template>
+    </el-menu>
+  </div>
+</template>
+
+<script>
+import _ from 'lodash';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: menu } = createNamespacedHelpers('menu');
+import bus from '../common/bus';
+export default {
+  data() {
+    return {
+      collapse: false,
+      items: [
+        {
+          icon: 'el-icon-s-home',
+          index: 'homeIndex',
+          title: '系统首页',
+        },
+      ],
+      num: {},
+    };
+  },
+  computed: {
+    ...mapState(['user']),
+    onRoutes() {
+      return this.$route.path;
+    },
+  },
+  created() {
+    // 通过 Event Bus 进行组件间通信,来折叠侧边栏
+    bus.$on('collapse', msg => {
+      this.collapse = msg;
+      bus.$emit('collapse-content', msg);
+    });
+  },
+  methods: {
+    ...menu(['query']),
+    // 分配用户彩带权限
+    async getMenu() {
+      let user = this.user;
+      let list = _.cloneDeep(this.items);
+      let data = [
+        {
+          icon: 'el-icon-s-home',
+          index: '/question',
+          title: '问卷管理',
+        },
+      ];
+      list.push(...data);
+      this.$set(this, `items`, _.uniqBy(list, 'index'));
+    },
+    // 查询成果数
+    async searchNum() {
+      let role = this.user.role;
+      if (role == undefined) {
+        let res = await this.queryNum(this.user.id);
+        if (this.$checkRes(res)) {
+          this.$set(this, `num`, res.data);
+        }
+      }
+    },
+  },
+  watch: {
+    user: {
+      deep: true,
+      immediate: true,
+      handler(val) {
+        this.getMenu();
+      },
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.sidebar {
+  display: block;
+  position: absolute;
+  left: 0;
+  top: 60px;
+  bottom: 0;
+  overflow-y: scroll;
+}
+.sidebar::-webkit-scrollbar {
+  width: 0;
+}
+.sidebar-el-menu:not(.el-menu--collapse) {
+  width: 200px;
+}
+.sidebar > ul {
+  height: 100%;
+}
+.num {
+  font-size: 16px;
+  padding: 0 10px;
+  span {
+    padding: 0 5px;
+  }
+}
+</style>

+ 181 - 0
src/components/common/Tags.vue

@@ -0,0 +1,181 @@
+<template>
+  <div class="tags" v-if="showTags">
+    <ul>
+      <li class="tags-li" v-for="(item, index) in tagsList" :class="{ active: isActive(item.path) }" :key="index">
+        <router-link :to="item.path" class="tags-li-title">
+          {{ item.title }}
+        </router-link>
+        <span class="tags-li-icon" @click="closeTags(index)"><i class="el-icon-close"></i></span>
+      </li>
+    </ul>
+    <div class="tags-close-box">
+      <el-dropdown @command="handleTags">
+        <el-button size="mini" type="primary"> 标签选项<i class="el-icon-arrow-down el-icon--right"></i> </el-button>
+        <el-dropdown-menu size="small" slot="dropdown">
+          <el-dropdown-item command="other">关闭其他</el-dropdown-item>
+          <el-dropdown-item command="all">关闭所有</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+    </div>
+  </div>
+</template>
+
+<script>
+import bus from './bus';
+export default {
+  data() {
+    return {
+      tagsList: [],
+    };
+  },
+  methods: {
+    isActive(path) {
+      return path === this.$route.fullPath;
+    },
+    // 关闭单个标签
+    closeTags(index) {
+      const delItem = this.tagsList.splice(index, 1)[0];
+      const item = this.tagsList[index] ? this.tagsList[index] : this.tagsList[index - 1];
+      if (item) {
+        delItem.path === this.$route.fullPath && this.$router.push(item.path);
+      } else {
+        this.$router.push('/');
+      }
+    },
+    // 关闭全部标签
+    closeAll() {
+      this.tagsList = [];
+      this.$router.push('/');
+    },
+    // 关闭其他标签
+    closeOther() {
+      const curItem = this.tagsList.filter(item => {
+        return item.path === this.$route.fullPath;
+      });
+      this.tagsList = curItem;
+    },
+    // 设置标签
+    setTags(route) {
+      const isExist = this.tagsList.some(item => {
+        return item.path === route.fullPath;
+      });
+      if (!isExist) {
+        if (this.tagsList.length >= 8) {
+          this.tagsList.shift();
+        }
+        this.tagsList.push({
+          title: route.meta.title,
+          path: route.fullPath,
+          name: route.matched[1].components.default.name,
+        });
+      }
+      bus.$emit('tags', this.tagsList);
+    },
+    handleTags(command) {
+      command === 'other' ? this.closeOther() : this.closeAll();
+    },
+  },
+  computed: {
+    showTags() {
+      return this.tagsList.length > 0;
+    },
+  },
+  watch: {
+    $route(newValue, oldValue) {
+      this.setTags(newValue);
+    },
+  },
+  created() {
+    this.setTags(this.$route);
+    // 监听关闭当前页面的标签页
+    bus.$on('close_current_tags', () => {
+      for (let i = 0, len = this.tagsList.length; i < len; i++) {
+        const item = this.tagsList[i];
+        if (item.path === this.$route.fullPath) {
+          if (i < len - 1) {
+            this.$router.push(this.tagsList[i + 1].path);
+          } else if (i > 0) {
+            this.$router.push(this.tagsList[i - 1].path);
+          } else {
+            this.$router.push('/');
+          }
+          this.tagsList.splice(i, 1);
+          break;
+        }
+      }
+    });
+  },
+};
+</script>
+
+<style>
+.tags {
+  position: relative;
+  height: 30px;
+  overflow: hidden;
+  background: #fff;
+  padding-right: 120px;
+  box-shadow: 0 5px 10px #ddd;
+}
+
+.tags ul {
+  box-sizing: border-box;
+  width: 100%;
+  height: 100%;
+}
+
+.tags-li {
+  float: left;
+  margin: 3px 5px 2px 3px;
+  border-radius: 3px;
+  font-size: 12px;
+  overflow: hidden;
+  cursor: pointer;
+  height: 23px;
+  line-height: 23px;
+  border: 1px solid #e9eaec;
+  background: #fff;
+  padding: 0 5px 0 12px;
+  vertical-align: middle;
+  color: #666;
+  -webkit-transition: all 0.3s ease-in;
+  -moz-transition: all 0.3s ease-in;
+  transition: all 0.3s ease-in;
+}
+
+.tags-li:not(.active):hover {
+  background: #f8f8f8;
+}
+
+.tags-li.active {
+  color: #fff;
+}
+
+.tags-li-title {
+  float: left;
+  max-width: 80px;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+  margin-right: 5px;
+  color: #666;
+}
+
+.tags-li.active .tags-li-title {
+  color: #fff;
+}
+
+.tags-close-box {
+  position: absolute;
+  right: 0;
+  top: 0;
+  box-sizing: border-box;
+  padding-top: 1px;
+  text-align: center;
+  width: 110px;
+  height: 30px;
+  background: #fff;
+  box-shadow: -3px 0 15px 3px rgba(0, 0, 0, 0.1);
+  z-index: 10;
+}
+</style>

+ 33 - 0
src/components/common/breadcrumb.vue

@@ -0,0 +1,33 @@
+<template>
+  <div id="breadcrumb">
+    <el-row>
+      <el-col :span="24" class="crumbs">
+        <el-breadcrumb separator="/">
+          <el-breadcrumb-item> <i class="el-icon-s-grid"></i> {{ breadcrumbTitle }} </el-breadcrumb-item>
+        </el-breadcrumb>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  metaInfo: {},
+  name: 'breadcrumb',
+  props: {
+    breadcrumbTitle: { type: String },
+  },
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 6 - 0
src/components/common/bus.js

@@ -0,0 +1,6 @@
+import Vue from 'vue';
+
+// 使用 Event Bus
+const bus = new Vue();
+
+export default bus;

+ 79 - 0
src/components/common/directives.js

@@ -0,0 +1,79 @@
+import Vue from 'vue';
+
+// v-dialogDrag: 弹窗拖拽属性
+Vue.directive('dialogDrag', {
+  bind(el, binding, vnode, oldVnode) {
+    const dialogHeaderEl = el.querySelector('.el-dialog__header');
+    const dragDom = el.querySelector('.el-dialog');
+
+    dialogHeaderEl.style.cssText += ';cursor:move;';
+    dragDom.style.cssText += ';top:0px;';
+
+    // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
+    const sty = (() => {
+      if (window.document.currentStyle) {
+        return (dom, attr) => dom.currentStyle[attr];
+      } else {
+        return (dom, attr) => getComputedStyle(dom, false)[attr];
+      }
+    })();
+
+    dialogHeaderEl.onmousedown = e => {
+      // 鼠标按下,计算当前元素距离可视区的距离
+      const disX = e.clientX - dialogHeaderEl.offsetLeft;
+      const disY = e.clientY - dialogHeaderEl.offsetTop;
+
+      const screenWidth = document.body.clientWidth; // body当前宽度
+      const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取)
+
+      const dragDomWidth = dragDom.offsetWidth; // 对话框宽度
+      const dragDomheight = dragDom.offsetHeight; // 对话框高度
+
+      const minDragDomLeft = dragDom.offsetLeft;
+      const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth;
+
+      const minDragDomTop = dragDom.offsetTop;
+      const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight;
+
+      // 获取到的值带px 正则匹配替换
+      let styL = sty(dragDom, 'left');
+      let styT = sty(dragDom, 'top');
+
+      // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
+      if (styL.includes('%')) {
+        styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100);
+        styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100);
+      } else {
+        styL = +styL.replace(/\px/g, '');
+        styT = +styT.replace(/\px/g, '');
+      }
+
+      document.onmousemove = function(e) {
+        // 通过事件委托,计算移动的距离
+        let left = e.clientX - disX;
+        let top = e.clientY - disY;
+
+        // 边界处理
+        if (-left > minDragDomLeft) {
+          left = -minDragDomLeft;
+        } else if (left > maxDragDomLeft) {
+          left = maxDragDomLeft;
+        }
+
+        if (-top > minDragDomTop) {
+          top = -minDragDomTop;
+        } else if (top > maxDragDomTop) {
+          top = maxDragDomTop;
+        }
+
+        // 移动当前元素
+        dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
+      };
+
+      document.onmouseup = function(e) {
+        document.onmousemove = null;
+        document.onmouseup = null;
+      };
+    };
+  },
+});

+ 30 - 0
src/components/common/i18n.js

@@ -0,0 +1,30 @@
+export const messages = {
+  zh: {
+    i18n: {
+      breadcrumb: '国际化产品',
+      tips: '通过切换语言按钮,来改变当前内容的语言。',
+      btn: '切换英文',
+      title1: '常用用法',
+      p1: '要是你把你的秘密告诉了风,那就别怪风把它带给树。',
+      p2: '没有什么比信念更能支撑我们度过艰难的时光了。',
+      p3: '只要能把自己的事做好,并让自己快乐,你就领先于大多数人了。',
+      title2: '组件插值',
+      info: 'Element组件需要国际化,请参考 {action}。',
+      value: '文档',
+    },
+  },
+  en: {
+    i18n: {
+      breadcrumb: 'International Products',
+      tips: 'Click on the button to change the current language. ',
+      btn: 'Switch Chinese',
+      title1: 'Common usage',
+      p1: 'If you reveal your secrets to the wind you should not blame the wind for  revealing them to the trees.',
+      p2: 'Nothing can help us endure dark times better than our faith. ',
+      p3: "If you can do what you do best and be happy, you're further along in life  than most people.",
+      title2: 'Component interpolation',
+      info: 'The default language of Element is Chinese. If you wish to use another language, please refer to the {action}.',
+      value: 'documentation',
+    },
+  },
+};

+ 64 - 0
src/main.js

@@ -0,0 +1,64 @@
+import Vue from 'vue';
+import App from './App.vue';
+import router from './router';
+import store from './store';
+import ElementUI from 'element-ui';
+import VueI18n from 'vue-i18n';
+import '@/plugins/axios';
+import '@/plugins/check-res';
+import '@/plugins/meta';
+import '@/plugins/filters';
+import '@/plugins/loading';
+import '@/plugins/var';
+import '@/plugins/methods';
+import '@/plugins/setting';
+import { messages } from './components/common/i18n';
+import 'element-ui/lib/theme-chalk/index.css'; // 默认主题
+// import './assets/css/theme-green/index.css'; // 浅绿色主题
+import './assets/css/icon.css';
+import './components/common/directives';
+import 'babel-polyfill';
+const jwt = require('jsonwebtoken');
+Vue.config.productionTip = false;
+Vue.use(VueI18n);
+Vue.use(ElementUI, {
+  size: 'small',
+});
+const i18n = new VueI18n({
+  locale: 'zh',
+  messages,
+});
+
+//使用钩子函数对路由进行权限跳转
+router.beforeEach((to, from, next) => {
+  document.title = `${to.meta.title} `;
+  let token = to.query.token;
+  if (token) {
+    let user = jwt.decode(token);
+    localStorage.setItem('token', token);
+    store.commit('setUser', user, { root: true });
+    next();
+  } else {
+    let token = localStorage.getItem('token');
+    if (to.path == '/homeIndex') {
+      if (!token) {
+        next('/login');
+      } else {
+        let user = jwt.decode(token);
+        store.commit('setUser', user, { root: true });
+        next();
+      }
+    } else {
+      let user = jwt.decode(token);
+      store.commit('setUser', user, { root: true });
+      next();
+    }
+  }
+});
+
+new Vue({
+  router,
+  store,
+  i18n,
+  render: h => h(App),
+}).$mount('#app');

+ 19 - 0
src/plugins/axios.js

@@ -0,0 +1,19 @@
+import Vue from 'vue';
+import AxiosWrapper from '@/util/axios-wrapper';
+
+const Plugin = {
+  install(vue, options) {
+    // 3. 注入组件
+    vue.mixin({
+      created() {
+        if (this.$store && !this.$store.$axios) {
+          this.$store.$axios = this.$axios;
+        }
+      },
+    });
+    // 4. 添加实例方法
+    vue.prototype.$axios = new AxiosWrapper(options);
+  },
+};
+
+Vue.use(Plugin, { baseUrl: process.env.VUE_APP_AXIOS_BASE_URL });

+ 39 - 0
src/plugins/check-res.js

@@ -0,0 +1,39 @@
+/* eslint-disable no-underscore-dangle */
+/* eslint-disable no-param-reassign */
+/* eslint-disable no-unused-vars */
+/* eslint-disable no-shadow */
+import Vue from 'vue';
+import _ from 'lodash';
+import { Message } from 'element-ui';
+
+const vm = new Vue({});
+const Plugin = {
+  install(Vue, options) {
+    // 4. 添加实例方法
+    Vue.prototype.$checkRes = (res, okText, errText) => {
+      let _okText = okText;
+      let _errText = errText;
+      if (!_.isFunction(okText) && _.isObject(okText) && okText != null) {
+        ({ okText: _okText, errText: _errText } = okText);
+      }
+      const { errcode = 0, errmsg } = res || {};
+      if (errcode === 0) {
+        if (_.isFunction(_okText)) {
+          return _okText();
+        }
+        if (_okText) {
+          Message.success(_okText);
+        }
+        return true;
+      }
+      if (_.isFunction(_errText)) {
+        return _errText();
+      }
+      // Message.error(_errText || errmsg);
+      Message({ message: _errText || errmsg, duration: 2000 });
+      return false;
+    };
+  },
+};
+
+Vue.use(Plugin);

+ 5 - 0
src/plugins/element.js

@@ -0,0 +1,5 @@
+import Vue from 'vue';
+import Element from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+
+Vue.use(Element);

+ 6 - 0
src/plugins/filters.js

@@ -0,0 +1,6 @@
+import Vue from 'vue';
+import filters from '@/util/filters';
+
+for (const method in filters) {
+  Vue.filter(method, filters[method]);
+}

+ 27 - 0
src/plugins/loading.js

@@ -0,0 +1,27 @@
+/* eslint-disable no-console */
+/* eslint-disable no-param-reassign */
+
+import Vue from 'vue';
+
+const Plugin = {
+  // eslint-disable-next-line no-unused-vars
+  install(vue, options) {
+    // 3. 注入组件
+    vue.mixin({
+      created() {
+        // eslint-disable-next-line no-underscore-dangle
+        const isRoot = this.constructor === Vue;
+        // console.log(`rootId:${rootVue_uid}; thisId:${this._uid}`);
+        // if (rootVue_uid !== 3) {
+        //   console.log(this);
+        // }
+        if (isRoot) {
+          const el = document.getElementById('loading');
+          if (el) el.style.display = 'none';
+        }
+      },
+    });
+  },
+};
+
+Vue.use(Plugin, { baseUrl: process.env.VUE_APP_AXIOS_BASE_URL });

+ 4 - 0
src/plugins/meta.js

@@ -0,0 +1,4 @@
+import Vue from 'vue';
+import Meta from 'vue-meta';
+
+Vue.use(Meta);

+ 33 - 0
src/plugins/methods.js

@@ -0,0 +1,33 @@
+import Vue from 'vue';
+import _ from 'lodash';
+const Plugin = {
+  install(Vue, options) {
+    // 3. 注入组件
+    Vue.mixin({
+      created() {
+        if (this.$store && !this.$store.$toUndefined) {
+          this.$store.$toUndefined = this.$toUndefined;
+        }
+      },
+    });
+    // 4. 添加实例方法
+    Vue.prototype.$toUndefined = object => {
+      let keys = Object.keys(object);
+      keys.map(item => {
+        object[item] = object[item] === '' ? (object[item] = undefined) : object[item];
+      });
+      return object;
+    };
+    Vue.prototype.$turnTo = item => {
+      if (item.info_type == 1) {
+        window.open(item.url);
+      } else {
+        let router = window.vm.$router;
+        let route = window.vm.$route.path;
+        router.push({ path: `/info/detail?id=${item.id}` });
+      }
+    };
+  },
+};
+
+Vue.use(Plugin);

+ 21 - 0
src/plugins/setting.js

@@ -0,0 +1,21 @@
+import Vue from 'vue';
+
+Vue.config.weixin = {
+  // baseUrl: process.env.BASE_URL + 'weixin',
+  // baseUrl: 'http://jh.tgoodsoft.net',
+  baseUrl: `http://${location.host}`,
+};
+
+Vue.config.stomp = {
+  // brokerURL: 'ws://http://free.liaoningdoupo.com/ws',
+  brokerURL: '/ws', // ws://${location.host}/ws
+  connectHeaders: {
+    host: 'visit',
+    login: 'visit', //visit
+    passcode: 'visit', //visit123
+  },
+  // debug: true,
+  reconnectDelay: 5000,
+  heartbeatIncoming: 4000,
+  heartbeatOutgoing: 4000,
+};

+ 65 - 0
src/plugins/stomp.js

@@ -0,0 +1,65 @@
+/**
+ * 基于WebStomp的消息处理插件
+ */
+
+import Vue from 'vue';
+import _ from 'lodash';
+import assert from 'assert';
+import { Client } from '@stomp/stompjs/esm5/client';
+
+const Plugin = {
+  install(Vue, options) {
+    assert(_.isObject(options));
+    if (options.debug && !_.isFunction(options.debug)) {
+      options.debug = str => {
+        console.log(str);
+      };
+    }
+    assert(_.isString(options.brokerURL));
+    if (!options.brokerURL.startsWith('ws://')) {
+      options.brokerURL = `ws://${location.host}${options.brokerURL}`;
+    }
+
+    // 3. 注入组件
+    Vue.mixin({
+      beforeDestroy: function() {
+        if (this.$stompClient) {
+          this.$stompClient.deactivate();
+          delete this.$stompClient;
+        }
+      },
+    });
+
+    // 4. 添加实例方法
+    Vue.prototype.$stomp = function(subscribes = {}) {
+      // connect to mq
+      const client = new Client(options);
+      client.onConnect = frame => {
+        // Do something, all subscribes must be done is this callback
+        // This is needed because this will be executed after a (re)connect
+        console.log('[stomp] connected');
+        Object.keys(subscribes)
+          .filter(p => _.isFunction(subscribes[p]))
+          .forEach(key => {
+            client.subscribe(key, subscribes[key]);
+          });
+      };
+
+      client.onStompError = frame => {
+        // Will be invoked in case of error encountered at Broker
+        // Bad login/passcode typically will cause an error
+        // Complaint brokers will set `message` header with a brief message. Body may contain details.
+        // Compliant brokers will terminate the connection after any error
+        console.log('Broker reported error: ' + frame.headers['message']);
+        console.log('Additional details: ' + frame.body);
+      };
+
+      client.activate();
+
+      this.$stompClient = client;
+    };
+  },
+};
+export default () => {
+  Vue.use(Plugin, Vue.config.stomp);
+};

+ 25 - 0
src/plugins/var.js

@@ -0,0 +1,25 @@
+import Vue from 'vue';
+import _ from 'lodash';
+
+const getSiteId = () => {
+  let host = `${window.location.hostname}`; //`999991.smart.jilinjobswx.cn ${window.location.hostname}`
+  let schId;
+  host = host.replace('http://', '');
+  let arr = host.split('.');
+  if (arr.length > 0) {
+    schId = arr[0];
+    if (schId === 'smart') schId = 'master';
+    else `${schId}`.includes('localhost') || `${schId}`.includes('127.0.0.1') ? (schId = '99991') : '';
+    sessionStorage.setItem('schId', `${schId}`.includes('localhost') || `${schId}`.includes('127.0.0.1') ? '99991' : schId);
+  }
+  return schId;
+};
+const Plugin = {
+  install(vue, options) {
+    // 4. 添加实例方法
+    vue.prototype.$limit = 10;
+    vue.prototype.$site = getSiteId();
+  },
+};
+
+Vue.use(Plugin);

+ 41 - 0
src/router/index.js

@@ -0,0 +1,41 @@
+import Vue from 'vue';
+import Router from 'vue-router';
+
+Vue.use(Router);
+export default new Router({
+  mode: 'history',
+  base: process.env.NODE_ENV === 'development' ? '' : 'liveAchieve',
+  routes: [
+    {
+      path: '/',
+      redirect: '/homeIndex',
+    },
+    {
+      path: '/',
+      component: () => import('../components/common/Home.vue'),
+      meta: { title: '自述文件1' },
+      children: [
+        {
+          path: '/homeIndex',
+          component: () => import('../views/homeIndex.vue'),
+          meta: { title: '系统首页' },
+        },
+        // 问卷管理
+        {
+          path: '/question',
+          component: () => import('../views/question/index.vue'),
+          meta: { title: '问卷管理' },
+        },
+      ],
+    },
+    {
+      path: '/login',
+      component: () => import('../views/Login.vue'),
+      meta: { title: '登录' },
+    },
+    {
+      path: '*',
+      redirect: '/404',
+    },
+  ],
+});

+ 56 - 0
src/store/adminLogin.js

@@ -0,0 +1,56 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+const jwt = require('jsonwebtoken');
+Vue.use(Vuex);
+const api = {
+  adminLoginInfo: `/api/live/v0/users/admin`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.adminLoginInfo}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.adminLoginInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.adminLoginInfo}/${payload}`);
+    return res;
+  },
+  async login({ commit }, { user }) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}/login`, user);
+    if (res.errcode === 0) {
+      localStorage.setItem('token', res.data);
+      user = jwt.decode(res.data);
+      commit('setUser', user, { root: true });
+    }
+    return res;
+  },
+  async updatePwd({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}/password/${id}`, data);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 17 - 0
src/store/index.js

@@ -0,0 +1,17 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import * as ustate from './user/state';
+import * as umutations from './user/mutations';
+// 管理员
+import adminLogin from './adminLogin';
+
+Vue.use(Vuex);
+
+export default new Vuex.Store({
+  state: { ...ustate },
+  mutations: { ...umutations },
+  actions: {},
+  modules: {
+    adminLogin,
+  },
+});

+ 33 - 0
src/store/user/mutations.js

@@ -0,0 +1,33 @@
+export const setUser = (state, payload) => {
+  state.user = payload;
+  // let res = true;
+  // //登陆时
+  // if (payload) {
+  //   state.token = payload;
+  // } else {
+  //   //已经登陆,切换路由时取出客户信息放在总store中
+  //   let token = localStorage.getItem('token');
+  //   if (token && token !== 'guest') {
+  //     state.user = jwt.decode(token);
+  //   } else if (token && token == 'guest') {
+  //     let user = localStorage.getItem('user');
+  //     state.user = JSON.parse(user);
+  //   } else {
+  //     let timestamp = new Date().getTime();
+  //     let user = {
+  //       // id: `guest${timestamp}`,
+  //       name: `游客${timestamp}`,
+  //     };
+  //     state.user = user;
+  //     localStorage.setItem('token', 'guest');
+  //     localStorage.setItem('user', JSON.stringify(user));
+  //     console.warn('游客身份');
+  //   }
+  // }
+  // return res;
+};
+
+export const deleteUser = (state, payload) => {
+  state.user = {};
+  localStorage.removeItem('token');
+};

+ 2 - 0
src/store/user/state.js

@@ -0,0 +1,2 @@
+export const user = {};
+export const menuList = [];

+ 117 - 0
src/util/axios-wrapper.js

@@ -0,0 +1,117 @@
+/* eslint-disable no-console */
+/* eslint-disable no-param-reassign */
+
+import _ from 'lodash';
+import Axios from 'axios';
+import { Util, Error } from 'naf-core';
+// import { Indicator } from 'mint-ui';
+import util from './user-util';
+
+const { trimData, isNullOrUndefined } = Util;
+const { ErrorCode } = Error;
+
+let currentRequests = 0;
+
+export default class AxiosWrapper {
+  constructor({ baseUrl = '', unwrap = true } = {}) {
+    this.baseUrl = baseUrl;
+    this.unwrap = unwrap;
+  }
+
+  // 替换uri中的参数变量
+  static merge(uri, query = {}) {
+    if (!uri.includes(':')) {
+      return uri;
+    }
+    const keys = [];
+    const regexp = /\/:([a-z0-9_]+)/gi;
+    let res;
+    // eslint-disable-next-line no-cond-assign
+    while ((res = regexp.exec(uri)) != null) {
+      keys.push(res[1]);
+    }
+    keys.forEach(key => {
+      if (!isNullOrUndefined(query[key])) {
+        uri = uri.replace(`:${key}`, query[key]);
+      }
+    });
+    return uri;
+  }
+
+  $get(uri, query, options) {
+    return this.$request(uri, null, query, options);
+  }
+
+  $post(uri, data = {}, query, options) {
+    return this.$request(uri, data, query, options);
+  }
+  $delete(uri, data = {}, router, query, options = {}) {
+    options = { ...options, method: 'delete' };
+    return this.$request(uri, data, query, options, router);
+  }
+  async $request(uri, data, query, options) {
+    // TODO: 合并query和options
+    if (_.isObject(query) && _.isObject(options)) {
+      options = { ...options, params: query, method: 'get' };
+    } else if (_.isObject(query) && !query.params) {
+      options = { params: query };
+    } else if (_.isObject(query) && query.params) {
+      options = query;
+    }
+    if (!options) options = {};
+    if (options.params) options.params = trimData(options.params);
+    const url = AxiosWrapper.merge(uri, options.params);
+    currentRequests += 1;
+    // Indicator.open({
+    //   spinnerType: 'fading-circle',
+    // });
+
+    try {
+      const axios = Axios.create({
+        baseURL: this.baseUrl,
+      });
+      axios.defaults.headers.common.Authorization = util.token;
+      let res = await axios.request({
+        method: isNullOrUndefined(data) ? 'get' : 'post',
+        url,
+        data,
+        responseType: 'json',
+        ...options,
+      });
+      res = res.data;
+      const { errcode, errmsg, details } = res;
+      if (errcode) {
+        console.warn(`[${uri}] fail: ${errcode}-${errmsg} ${details}`);
+        return res;
+      }
+      // unwrap data
+      if (this.unwrap) {
+        res = _.omit(res, ['errmsg', 'details']);
+        const keys = Object.keys(res);
+        if (keys.length === 1 && keys.includes('data')) {
+          res = res.data;
+        }
+      }
+      return res;
+    } catch (err) {
+      let errmsg = '接口请求失败,请稍后重试';
+      if (err.response) {
+        const { status } = err.response;
+        if (status === 401) errmsg = '用户认证失败,请重新登录';
+        if (status === 403) errmsg = '当前用户不允许执行该操作';
+      }
+      console.error(
+        `[AxiosWrapper] 接口请求失败: ${err.config && err.config.url} - 
+        ${err.message}`
+      );
+      return { errcode: ErrorCode.SERVICE_FAULT, errmsg, details: err.message };
+    } finally {
+      /* eslint-disable */
+      currentRequests -= 1;
+      if (currentRequests <= 0) {
+        currentRequests = 0;
+        // Indicator.close();
+      }
+    }
+  }
+}

+ 10 - 0
src/util/filters.js

@@ -0,0 +1,10 @@
+import _ from 'lodash';
+
+const filters = {
+  getName(object) {
+    const { data, searchItem } = object;
+    return _.get(data, searchItem) === undefined ? '' : _.get(data, searchItem);
+  },
+};
+
+export default filters;

+ 50 - 0
src/util/methods-util.js

@@ -0,0 +1,50 @@
+import { Util } from 'naf-core';
+
+const { isNullOrUndefined } = Util;
+
+export default {
+  //判断信息是否过期
+  isDateOff(dataDate) {
+    const now = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
+    dataDate = new Date(dataDate);
+    return now.getTime() <= dataDate.getTime();
+  },
+  //判断企业是否可以执行此动作/显示
+  checkCorp(data) {
+    const { role, unit, selfUnit, status, displayType, userid } = data;
+    if (!isNullOrUndefined(selfUnit) && !isNullOrUndefined(status)) {
+      return role === 'corp' && selfUnit === unit && status === '0';
+    } else if (!isNullOrUndefined(displayType)) {
+      if (role === 'corp') {
+        return role === displayType;
+      } else {
+        return role === displayType && !isNullOrUndefined(userid);
+      }
+    }
+  },
+  //获取url的参数params
+  getParams() {
+    let str = location.href;
+    let num = str.indexOf('?');
+    const param = {};
+    str = str.substr(num + 1);
+    let num2 = str.indexOf('#');
+    let str2 = '';
+    if (num2 > 0) {
+      str2 = str.substr(0, num2);
+    } else {
+      num2 = str.indexOf('/');
+      str2 = str.substr(0, num2);
+    }
+    const arr = str2.split('&');
+    for (let i = 0; i < arr.length; i++) {
+      num = arr[i].indexOf('=');
+      if (num > 0) {
+        const name = arr[i].substring(0, num);
+        const value = arr[i].substr(num + 1);
+        param[name] = decodeURI(value);
+      }
+    }
+    return param;
+  },
+};

+ 69 - 0
src/util/user-util.js

@@ -0,0 +1,69 @@
+/* eslint-disable no-console */
+export default {
+  get user() {
+    const val = sessionStorage.getItem('user');
+    try {
+      if (val) return JSON.parse(val);
+    } catch (err) {
+      console.error(err);
+    }
+    return null;
+  },
+  set user(userinfo) {
+    sessionStorage.setItem('user', JSON.stringify(userinfo));
+  },
+  get token() {
+    return sessionStorage.getItem('token');
+  },
+  set token(token) {
+    sessionStorage.setItem('token', token);
+  },
+  get openid() {
+    return sessionStorage.getItem('openid');
+  },
+  set openid(openid) {
+    sessionStorage.setItem('openid', openid);
+  },
+  get isGuest() {
+    return !this.user || this.user.role === 'guest';
+  },
+  save({ userinfo, token }) {
+    sessionStorage.setItem('user', JSON.stringify(userinfo));
+    sessionStorage.setItem('token', token);
+  },
+
+  get corpInfo() {
+    const val = sessionStorage.getItem('corpInfo');
+    if (val) return JSON.parse(val);
+    return null;
+  },
+  set corpInfo(corpInfo) {
+    sessionStorage.setItem('corpInfo', JSON.stringify(corpInfo));
+  },
+  saveCorpInfo(corpInfo) {
+    sessionStorage.setItem('corpInfo', JSON.stringify(corpInfo));
+  },
+
+  get unit() {
+    const val = sessionStorage.getItem('unit');
+    if (val) return JSON.parse(val);
+    return null;
+  },
+  set unit(unitList) {
+    sessionStorage.setItem('unit', JSON.stringify(unitList));
+  },
+  saveUnit(unitList) {
+    sessionStorage.setItem('unit', JSON.stringify(unitList));
+  },
+  get userInfo() {
+    const val = sessionStorage.getItem('userInfo');
+    if (val) return JSON.parse(val);
+    return null;
+  },
+  set userInfo(userInfo) {
+    sessionStorage.setItem('userInfo', JSON.stringify(userInfo));
+  },
+  saveUserInfo(userInfo) {
+    sessionStorage.setItem('userInfo', JSON.stringify(userInfo));
+  },
+};

+ 55 - 0
src/views/404.vue

@@ -0,0 +1,55 @@
+<template>
+  <div class="error-page">
+    <div class="error-code">4<span>0</span>4</div>
+    <div class="error-desc">啊哦~ 你所访问的页面不存在</div>
+    <div class="error-handle">
+      <router-link to="/">
+        <el-button type="primary" size="large">返回首页</el-button>
+      </router-link>
+      <el-button class="error-btn" type="primary" size="large" @click="goBack">返回上一页</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  methods: {
+    goBack() {
+      this.$router.go(-1);
+    },
+  },
+};
+</script>
+
+<style scoped>
+.error-page {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+  width: 100%;
+  height: 100%;
+  background: #f3f3f3;
+  box-sizing: border-box;
+}
+.error-code {
+  line-height: 1;
+  font-size: 250px;
+  font-weight: bolder;
+  color: #2d8cf0;
+}
+.error-code span {
+  color: #00a854;
+}
+.error-desc {
+  font-size: 30px;
+  color: #777;
+}
+.error-handle {
+  margin-top: 30px;
+  padding-bottom: 200px;
+}
+.error-btn {
+  margin-left: 100px;
+}
+</style>

+ 212 - 0
src/views/Login.vue

@@ -0,0 +1,212 @@
+<template>
+  <div id="Login">
+    <el-row>
+      <el-col :span="24" class="main" :style="{ height: clientHeight + 'px' }">
+        <div class="w_1200">
+          <el-row :gutter="20">
+            <el-col :span="10" :offset="6" class="info">
+              <el-col :span="24" class="text">
+                成果评价系统
+              </el-col>
+              <el-col :span="24" class="tabs">
+                <el-tabs v-model="active" type="card">
+                  <el-tab-pane label="个人用户" name="first">
+                    <el-col :span="24" class="two">
+                      <el-form :model="webForm" :rules="rules" ref="webForm" label-width="100px">
+                        <el-form-item label="账号" prop="phone">
+                          <el-input v-model="webForm.phone" placeholder="请输入账号"></el-input>
+                        </el-form-item>
+                        <el-form-item label="密码" prop="password">
+                          <el-input v-model="webForm.password" placeholder="请输入密码" show-password></el-input>
+                        </el-form-item>
+                        <el-col :span="24" class="btn">
+                          <el-button type="primary" @click="webLogin('webForm')">确认登录</el-button>
+                        </el-col>
+                      </el-form>
+                    </el-col>
+                  </el-tab-pane>
+                  <el-tab-pane label="管理用户" name="second">
+                    <el-col :span="24" class="two">
+                      <el-form :model="form" :rules="rules" ref="form" label-width="100px">
+                        <el-form-item label="手机号" prop="code_phone">
+                          <el-input v-model="form.code_phone" placeholder="请输入手机号"></el-input>
+                        </el-form-item>
+                        <el-form-item label="密码" prop="passwd">
+                          <el-input v-model="form.passwd" placeholder="请输入密码" show-password></el-input>
+                        </el-form-item>
+                        <el-col :span="24" class="btn">
+                          <el-button type="primary" @click="adminLogin('form')">确认登录</el-button>
+                        </el-col>
+                      </el-form>
+                    </el-col>
+                  </el-tab-pane>
+                  <el-tab-pane label="专家用户" name="third">
+                    <el-col :span="24" class="two">
+                      <el-form :model="expert" ref="expert" label-width="100px">
+                        <el-form-item label="手机号" prop="phone">
+                          <el-input v-model="expert.phone" placeholder="请输入手机号"></el-input>
+                        </el-form-item>
+                        <el-form-item label="密码" prop="passwd">
+                          <el-input v-model="expert.password" placeholder="请输入密码" show-password></el-input>
+                        </el-form-item>
+                        <el-col :span="24" class="btn">
+                          <el-button type="primary" @click="toExpertLogin('form')">确认登录</el-button>
+                        </el-col>
+                      </el-form>
+                    </el-col>
+                  </el-tab-pane>
+                </el-tabs>
+              </el-col>
+            </el-col>
+          </el-row>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
+const { mapActions: personal } = createNamespacedHelpers('personal');
+const { mapActions: organization } = createNamespacedHelpers('organization');
+const { mapActions: achieveExpert } = createNamespacedHelpers('achieveExpert');
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'Login',
+  props: {},
+  components: {},
+  data: function() {
+    return {
+      // 页面高度
+      clientHeight: '',
+      active: 'first',
+      // 个人登录
+      webForm: {},
+      // 管理登录
+      form: {},
+      rules: {
+        code_phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
+        passwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
+        phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
+        password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
+        type: [{ required: true, message: '请选择用户类别', trigger: 'change' }],
+      },
+      // 专家登陆
+      expert: {},
+    };
+  },
+  created() {},
+  methods: {
+    ...personal(['perLogin']),
+    ...organization(['orgLogin']),
+    ...adminLogin(['login']),
+    ...achieveExpert({ expertLogin: 'login' }),
+    // 个人登录
+    webLogin(formName) {
+      this.$refs[formName].validate(async valid => {
+        if (valid) {
+          let data = this.webForm;
+          data.type = '4';
+          if (data.type == '4') {
+            let res = await this.perLogin({ user: data });
+            if (this.$checkRes(res)) {
+              this.$message.success('登录成功');
+              this.$router.push('/homeIndex');
+            }
+          } else if (data.type == '5') {
+            data.institution_code = data.phone;
+            let res = await this.orgLogin({ user: data });
+            if (this.$checkRes(res)) {
+              this.$message.success('登录成功');
+              this.$router.push('/homeIndex');
+            }
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 管理登录
+    adminLogin(formName) {
+      this.$refs[formName].validate(async valid => {
+        if (valid) {
+          let res = await this.login({ user: this.form });
+          if (this.$checkRes(res)) {
+            this.$message.success('登录成功');
+            this.$router.push('/homeIndex');
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 专家登陆
+    async toExpertLogin() {
+      let dup = _.cloneDeep(this.expert);
+      const res = await this.expertLogin(dup);
+      if (this.$checkRes(res)) {
+        this.$message.success('登录成功');
+        this.$router.push('/homeIndex');
+      }
+    },
+  },
+  mounted() {
+    let clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
+    this.$set(this, `clientHeight`, clientHeight);
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped>
+.w_1200 {
+  width: 1200px;
+  margin: 0 auto;
+}
+.main {
+  background-image: url(../assets/img/login-bg.jpg);
+  background-repeat: no-repeat;
+  background-size: 100% 100%;
+  overflow: auto;
+  .info {
+    height: 430px;
+    box-shadow: 0 0 5px #ccc;
+    position: relative;
+    top: 150px;
+    background-color: #ffffff9f;
+    border-radius: 10px;
+    .text {
+      text-align: center;
+      font-size: 20px;
+      padding: 20px 0;
+      font-weight: bold;
+      border-bottom: 1px solid #000;
+      margin: 0 0 15px 0;
+    }
+    .tabs {
+      padding: 0 !important;
+      /deep/.el-tabs__item {
+        width: 162px;
+        text-align: center;
+        font-size: 18px;
+        font-weight: bold;
+      }
+      .btn {
+        text-align: center;
+      }
+      .two {
+        padding: 30px 0px !important;
+      }
+    }
+  }
+}
+</style>

+ 32 - 0
src/views/homeIndex.vue

@@ -0,0 +1,32 @@
+<template>
+  <div id="homeIndex">
+    <el-row>
+      <el-col :span="24">
+        <p>homeIndex</p>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'homeIndex',
+  props: {},
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped></style>

+ 38 - 0
src/views/question/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main">
+        test
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 38 - 0
vue.config.js

@@ -0,0 +1,38 @@
+const path = require('path');
+const common = path.resolve(__dirname, '../common');
+module.exports = {
+  publicPath: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROUTER,
+  // 打包文件
+  outputDir: 'liveQuest',
+  configureWebpack: config => {
+    Object.assign(config, {
+      // 开发生产共同配置
+      resolve: {
+        alias: {
+          '@': path.resolve(__dirname, './src'),
+          '@c': path.resolve(__dirname, './src/components'),
+          '@a': path.resolve(__dirname, './src/assets'),
+          '@common': common,
+        },
+      },
+    });
+  },
+  devServer: {
+    port: '8001',
+    //api地址前缀
+    proxy: {
+      '/files': {
+        target: 'http://broadcast.waityou24.cn',
+      },
+      '/api': {
+        target: 'http://broadcast.waityou24.cn',
+        changeOrigin: true,
+        ws: false,
+      },
+      '/ws': {
+        target: 'http://broadcast.waityou24.cn',
+        ws: false,
+      },
+    },
+  },
+};