guhongwei 4 years ago
parent
commit
23a5a3dc4e
13 changed files with 11980 additions and 233 deletions
  1. 4 1
      .env
  2. 11921 0
      package-lock.json
  3. 2 0
      package.json
  4. 8 6
      src/main.js
  5. 5 2
      src/plugins/check-res.js
  6. 0 33
      src/plugins/methods.js
  7. 5 5
      src/plugins/setting.js
  8. 5 0
      src/plugins/vant.js
  9. 0 25
      src/plugins/var.js
  10. 8 25
      src/util/axios-wrapper.js
  11. 0 30
      src/util/menus.js
  12. 0 96
      src/util/qrcode.vue
  13. 22 10
      vue.config.js

+ 4 - 1
.env

@@ -1,2 +1,5 @@
 VUE_APP_AXIOS_BASE_URL = ''
-VUE_APP_ROUTER="/www"
+VUE_APP_ROOT_URL=/admin/
+VUE_APP_MODULE='student'
+VUE_APP_USER_TYPE = '4'
+VUE_APP_LIMIT = 10

File diff suppressed because it is too large
+ 11921 - 0
package-lock.json


+ 2 - 0
package.json

@@ -8,10 +8,12 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
+    "@stomp/stompjs": "^5.4.4",
     "axios": "^0.19.2",
     "core-js": "^3.6.4",
     "element-ui": "^2.13.2",
     "loadsh": "0.0.4",
+    "moment": "^2.26.0",
     "naf-core": "^0.1.2",
     "vant": "^2.8.3",
     "vue": "^2.6.11",

+ 8 - 6
src/main.js

@@ -2,21 +2,23 @@ import Vue from 'vue';
 import App from './App.vue';
 import router from './router';
 import store from './store';
-import '@/plugins/element.js';
+import '@/plugins/element';
+import '@/plugins/vant';
 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 InitStomp from '@/plugins/stomp';
+import moment from 'moment';
+moment.lang('zh-cn');
+Vue.prototype.$moment = moment;
+Vue.config.productionTip = false;
 
 new Vue({
   router,
   store,
   render: h => h(App),
 }).$mount('#app');
-window.vm = new Vue({
-  router,
-});
+InitStomp();

+ 5 - 2
src/plugins/check-res.js

@@ -5,6 +5,7 @@
 import Vue from 'vue';
 import _ from 'lodash';
 import { Message } from 'element-ui';
+import { Notify } from 'vant';
 
 const vm = new Vue({});
 const Plugin = {
@@ -22,14 +23,16 @@ const Plugin = {
           return _okText();
         }
         if (_okText) {
-          Message.success(_okText);
+          // Message.success(_okText);
+          Notify({ type: 'success', message: _okText });
         }
         return true;
       }
       if (_.isFunction(_errText)) {
         return _errText();
       }
-      Message.error(_errText || errmsg);
+      // Message.error(_errText || errmsg);
+      Notify({ type: 'danger', message: _okText });
       // Message({ message: _errText || errmsg, duration: 60000 });
       return false;
     };

+ 0 - 33
src/plugins/methods.js

@@ -1,33 +0,0 @@
-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);

+ 5 - 5
src/plugins/setting.js

@@ -1,17 +1,17 @@
 import Vue from 'vue';
-
 Vue.config.weixin = {
   // baseUrl: process.env.BASE_URL + 'weixin',
-  baseUrl: `http://${location.host}/weixin`,
+  baseUrl: 'http://free.liaoningdoupo.com',
+  target: process.env.NODE_ENV === 'development' ? 'http://10.16.10.7:8001' : 'http://free.liaoningdoupo.com/student',
 };
 
 Vue.config.stomp = {
   // brokerURL: 'ws://192.168.1.190:15674/ws',
   brokerURL: '/ws', // ws://${location.host}/ws
   connectHeaders: {
-    host: 'smart',
-    login: 'web',
-    passcode: 'web123',
+    host: 'train',
+    login: 'visit',
+    passcode: 'visit',
   },
   // debug: true,
   reconnectDelay: 5000,

+ 5 - 0
src/plugins/vant.js

@@ -0,0 +1,5 @@
+import Vue from 'vue';
+import Vant from 'vant';
+import 'vant/lib/index.css';
+
+Vue.use(Vant);

+ 0 - 25
src/plugins/var.js

@@ -1,25 +0,0 @@
-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);

+ 8 - 25
src/util/axios-wrapper.js

@@ -37,30 +37,19 @@ export default class AxiosWrapper {
     });
     return uri;
   }
-  //替换路由方法
-  static routerChange(uri, router = {}) {
-    let keys = Object.keys(router);
-    keys.forEach(key => {
-      uri = _.replace(uri, `{${key}}`, router[key]);
-    });
-    return uri;
-  }
 
-  $get(uri, router, query, options) {
-    return this.$request(uri, null, query, options, router);
+  $get(uri, query, options) {
+    return this.$request(uri, null, query, options);
   }
 
-  $post(uri, data = {}, router, query, options) {
-    return this.$request(uri, data, query, options, router);
+  $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, router) {
-    // TODO: 合并query和options
+  async $request(uri, data, query, options) {
     if (_.isObject(query) && _.isObject(options)) {
       options = { ...options, params: query, method: 'get' };
     } else if (_.isObject(query) && !query.params) {
@@ -70,11 +59,7 @@ export default class AxiosWrapper {
     }
     if (!options) options = {};
     if (options.params) options.params = trimData(options.params);
-    let url = AxiosWrapper.merge(uri, options.params);
-    //处理url部分需要替换参数的情况
-    if (_.isObject(router)) {
-      url = AxiosWrapper.routerChange(url, router);
-    }
+    const url = AxiosWrapper.merge(uri, options.params);
     currentRequests += 1;
     // Indicator.open({
     //   spinnerType: 'fading-circle',
@@ -84,9 +69,7 @@ export default class AxiosWrapper {
       const axios = Axios.create({
         baseURL: this.baseUrl,
       });
-      if (sessionStorage.getItem('token')) {
-        axios.defaults.headers.common.Authorization = util.token;
-      }
+      axios.defaults.headers.common.Authorization = util.token;
       let res = await axios.request({
         method: isNullOrUndefined(data) ? 'get' : 'post',
         url,
@@ -122,7 +105,7 @@ export default class AxiosWrapper {
       );
       return { errcode: ErrorCode.SERVICE_FAULT, errmsg, details: err.message };
     } finally {
-      /* eslint-disable */
+    /* eslint-disable */
       currentRequests -= 1;
       if (currentRequests <= 0) {
         currentRequests = 0;

+ 0 - 30
src/util/menus.js

@@ -1,30 +0,0 @@
-export const coreMenu = [
-  {
-    path: '/talk/list/in',
-    name: '校内宣讲会',
-  },
-  {
-    path: '/talk/list/out',
-    name: '校外宣讲会',
-  },
-  {
-    path: '/jobfair/list/in',
-    name: '校内招聘会',
-  },
-  {
-    path: '/jobfair/list/out',
-    name: '校外招聘会',
-  },
-  {
-    path: '/jobinfo/list',
-    name: '在线招聘',
-  },
-  {
-    path: '/jobs/list/official',
-    name: '正式岗位',
-  },
-  {
-    path: '/jobs/list/internship',
-    name: '实习岗位',
-  },
-];

+ 0 - 96
src/util/qrcode.vue

@@ -1,96 +0,0 @@
-<template>
-  <div id="qrcodes" style="width:100%;">
-    <mt-header title="二维码">
-      <mt-button class="bgnone" slot="left" @click="$router.go(-1)">返回</mt-button>
-    </mt-header>
-    <span v-if="user.role === 'user'">
-      <li class="txtQr" style="padding-top:7vh;">学生姓名:{{ userInfo.xm || '' }}</li>
-      <li class="txtQr">门票类型:{{ ticketType }}</li>
-    </span>
-    <div id="qrcode" style="display:flex;justify-content:center;align-items:center;" :style="newHeight" ref="qrcode">
-      <canvas id="canvas" style="display:-webkit-inline-box;width: 4rem !important;height:4rem !important;margin-top: 200px;"></canvas>
-    </div>
-  </div>
-</template>
-
-<script>
-import { mapActions, mapState, mapMutations } from 'vuex';
-import QRCode from 'qrcode';
-export default {
-  name: 'qrcodes',
-  data() {
-    return {
-      id: this.$route.query.id || '',
-      ticketType: this.$route.query.type && this.$route.query.type === '0' ? '普通票' : '受限票' || '',
-      popupVisible: false,
-    };
-  },
-  computed: {
-    ...mapState({
-      user: state => state.publics.user,
-      userInfo: state => state.self.userInfo,
-    }),
-    newHeight: {
-      get() {
-        let height;
-        if (this.user.role === 'user') {
-          height = window.screen.availHeight * 0.3 + 'px';
-        } else {
-          height = window.screen.availHeight * 0.6 + 'px';
-        }
-        let style = { height: height };
-        return style;
-      },
-    },
-  },
-  created() {
-    this.$nextTick(() => {
-      this.initQrcode();
-    });
-  },
-  methods: {
-    async initQrcode() {
-      if (!this.booForQrcode) {
-        await QRCode.toCanvas(document.getElementById('canvas'), this.id, {
-          width: 300,
-          margin: 0,
-          color: { dark: this.$route.query.type === '0' ? '#00ff14' : '#FF9900' },
-        });
-      }
-    },
-  },
-};
-</script>
-
-<style lang="less" scoped>
-.txtQr {
-  font-size: 14px;
-  text-align: center;
-  min-height: 30px;
-  margin-bottom: 1px;
-  white-space: nowrap;
-  overflow: hidden;
-  text-overflow: ellipsis;
-}
-.mint-header {
-  -webkit-box-align: center;
-  -ms-flex-align: center;
-  align-items: center;
-  background-color: #26a2ff;
-  -webkit-box-sizing: border-box;
-  box-sizing: border-box;
-  color: #fff;
-  display: -webkit-box;
-  display: -ms-flexbox;
-  display: flex;
-  height: 50px;
-  line-height: 50px;
-  color: #fff;
-  font-size: 16px;
-  background: #2577e3;
-  padding: 0;
-  position: relative;
-  text-align: center;
-  white-space: nowrap;
-}
-</style>

+ 22 - 10
vue.config.js

@@ -1,7 +1,9 @@
 const path = require('path');
-const publics = path.resolve(__dirname, '../web-common');
+const question = path.resolve(__dirname, '../question-examine');
+const frame = path.resolve(__dirname, '../frame');
 module.exports = {
-  publicPath: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROUTER,
+  publicPath: process.env.NODE_ENV === 'development' ? '/' : '/student',
+  outputDir: 'student',
   configureWebpack: config => {
     Object.assign(config, {
       // 开发生产共同配置
@@ -10,7 +12,8 @@ module.exports = {
           '@': path.resolve(__dirname, './src'),
           '@c': path.resolve(__dirname, './src/components'),
           '@a': path.resolve(__dirname, './src/assets'),
-          '@publics': publics,
+          '@question': question,
+          '@frame': frame,
         },
       },
     });
@@ -19,15 +22,24 @@ module.exports = {
     port: '8001',
     //api地址前缀
     proxy: {
-      '/api': {
+      '/files': {
         target: 'http://smart.cc-lotus.info',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/ws': {
+        target: 'http://free.liaoningdoupo.com',
+        ws: true,
+      },
+      '/weixin': {
+        target: 'http://smart.cc-lotus.info',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api': {
+        target: 'http://free.liaoningdoupo.com',
+        changeOrigin: true,
         ws: true,
-        onProxyReq(proxyReq, req, res) {
-          proxyReq.setHeader('x-tenant', '99991');
-        },
-        '/files': {
-          target: 'http://free.liaoningdoupo.com',
-        },
       },
     },
   },