guhongwei 3 år sedan
förälder
incheckning
02a44dec05
5 ändrade filer med 20 tillägg och 108 borttagningar
  1. 4 20
      src/App.vue
  2. 1 1
      src/plugins/axios.js
  3. 2 63
      src/store/index.js
  4. 10 24
      src/views/scientific/laboratory/index.vue
  5. 3 0
      vue.config.js

+ 4 - 20
src/App.vue

@@ -1,33 +1,17 @@
 <template>
   <div id="app">
-    <router-view v-if="finished" />
+    <router-view />
   </div>
 </template>
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions } = createNamespacedHelpers('login');
 export default {
   data() {
-    return {
-      finished: false,
-    };
-  },
-  async created() {
-    await this.toLogin();
-  },
-  methods: {
-    ...mapActions(['login']),
-    async toLogin() {
-      const obj = { username: 'wxyk', password: 'wxyk' };
-      const res = await this.login(obj);
-      if (res.code === 200) {
-        const token = res.token;
-        sessionStorage.setItem('token', token);
-        this.finished = true;
-      }
-    },
+    return {};
   },
+  async created() {},
+  methods: {},
 };
 </script>
 

+ 1 - 1
src/plugins/axios.js

@@ -16,4 +16,4 @@ const Plugin = {
   },
 };
 
-Vue.use(Plugin, { baseUrl: process.env.VUE_APP_BASE_API });
+Vue.use(Plugin, { baseUrl: '' });

+ 2 - 63
src/store/index.js

@@ -3,48 +3,7 @@ import Vuex from 'vuex';
 import * as ustate from '@common/src/store/user/state';
 import * as umutations from '@common/src/store/user/mutations';
 import test from '@common/src/store/test';
-import login from '@common/src/store/login';
-// 重点实验室
-import laboratory from '@common/src/store/laboratory';
-// 研究方向
-import direction from '@common/src/store/direction';
-// 重要成果
-import outcome from '@common/src/store/outcome';
-// 承担科研项目
-import task from '@common/src/store/task';
-// 博硕培养情况
-import doctor from '@common/src/store/doctor';
-// 职称晋升
-import title from '@common/src/store/title';
-// 人才称号
-import personnelname from '@common/src/store/personnelname';
-// 设备
-import equipment from '@common/src/store/equipment';
-// 社会服务活动
-import socialservices from '@common/src/store/socialservices';
-// 技术服务活动
-import technicalservice from '@common/src/store/technicalservice';
-// 科普活动
-import scienceactivities from '@common/src/store/scienceactivities';
-// 提交报告
-import report from '@common/src/store/report';
-// 主任及科研助理
-import assistant from '@common/src/store/assistant';
-// 学术委员会
-import committee from '@common/src/store/committee';
-// 平台活动时间段
-import times from '@common/src/store/times';
-// 其他成果
-import other from '@common/src/store/other';
-// 论文发表
-import paper from '@common/src/store/paper';
-// 获奖情况
-import patent from '@common/src/store/patent';
-// 制定标准明细
-import award from '@common/src/store/award';
-// 核心成员
-import personnel from '@common/src/store/personnel';
-
+import usual from '@common/src/store/usual';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -53,26 +12,6 @@ export default new Vuex.Store({
   actions: {},
   modules: {
     test,
-    login,
-    laboratory,
-    direction,
-    doctor,
-    title,
-    personnelname,
-    equipment,
-    socialservices,
-    technicalservice,
-    scienceactivities,
-    report,
-    assistant,
-    committee,
-    times,
-    outcome,
-    task,
-    other,
-    paper,
-    patent,
-    award,
-    personnel,
+    usual,
   },
 });

+ 10 - 24
src/views/scientific/laboratory/index.vue

@@ -12,7 +12,7 @@
 import list1 from '@/layout/scientific/laboratory/list-1.vue';
 import adminFrame from '@common/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions } = createNamespacedHelpers('laboratory');
+const { mapActions } = createNamespacedHelpers('usual');
 export default {
   name: 'index',
   props: {},
@@ -24,40 +24,26 @@ export default {
     return {
       list: [],
       total: 0,
-      limit: 4,
     };
   },
-  async created() {
-    await this.search();
+  created() {
+    console.log('in function:');
+    this.init();
   },
   methods: {
-    ...mapActions(['query']),
-    async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
-      if (searchName) info.name = searchName;
-      const res = await this.query({ skip, limit, ...info });
+    ...mapActions(['query', 'fetch']),
+    async init() {
+      const res = await this.query({ table: 'BasicInformation', skip: 0, limit: 10 });
       if (this.$checkRes(res)) {
-        this.$set(this, `list`, res.rows);
-        this.$set(this, `total`, res.total);
+        this.$set(this, 'list', res.data);
+        this.$set(this, 'total', res.total);
       }
     },
-    // 查看信息
-    async toView(data) {
-      this.$router.push({ path: '/scientific/laboratory/info', query: { id: data.id } });
-    },
-  },
-  computed: {
-    ...mapState(['user']),
   },
+
   metaInfo() {
     return { title: this.$route.meta.title };
   },
-  watch: {
-    test: {
-      deep: true,
-      immediate: true,
-      handler(val) {},
-    },
-  },
 };
 </script>
 

+ 3 - 0
vue.config.js

@@ -22,6 +22,9 @@ module.exports = {
       '/files': {
         target: 'http://broadcast.kqyjy.com',
       },
+      '/api/label': {
+        target: 'http://192.168.1.197:4200',
+      },
       [process.env.VUE_APP_BASE_API]: {
         target: 'http://192.168.1.197:8112',
         changeOrigin: true,