lrf402788946 5 年之前
父節點
當前提交
b6b859b2ad

+ 1 - 0
.eslintignore

@@ -0,0 +1 @@
+node_modules/**

+ 9 - 7
src/components/list-components/list.vue

@@ -5,7 +5,7 @@
     </el-row>
     </el-row>
 
 
     <div class="infinite-list-layout">
     <div class="infinite-list-layout">
-      <nut-infiniteloading @loadmore="load" :is-show-mod="true" :has-more="hasMore" :is-loading="loading" :threshold="350">
+      <nut-infiniteloading @loadmore="load" :is-show-mod="true" :has-more="hasMore" :is-loading="iloading" :threshold="350">
         <slot name="list"></slot>
         <slot name="list"></slot>
       </nut-infiniteloading>
       </nut-infiniteloading>
     </div>
     </div>
@@ -13,17 +13,18 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
 export default {
 export default {
   name: 'list',
   name: 'list',
   props: {
   props: {
     hasMore: { type: Boolean, defalut: false },
     hasMore: { type: Boolean, defalut: false },
   },
   },
   components: {},
   components: {},
-  data: () => ({
-    loading: false,
-  }),
+  data: () => ({}),
   created() {},
   created() {},
-  computed: {},
+  computed: {
+    ...mapState(['iloading']),
+  },
   watch: {
   watch: {
     hasMore: {
     hasMore: {
       handler(val) {
       handler(val) {
@@ -36,10 +37,11 @@ export default {
     },
     },
   },
   },
   methods: {
   methods: {
+    ...mapMutations(['setLoading']),
     load() {
     load() {
-      this.loading = true;
+      this.setLoading();
       this.$emit('search', 'nextPage');
       this.$emit('search', 'nextPage');
-      this.loading = false;
+      // this.loading = false;
     },
     },
     word() {
     word() {
       let info = document.getElementsByClassName(`tips-txt`);
       let info = document.getElementsByClassName(`tips-txt`);

+ 4 - 1
src/pages/corp/store/index.js

@@ -11,7 +11,8 @@ import * as jobfair from '@/store/jobfair';
 import * as school from '@/store/schoolList';
 import * as school from '@/store/schoolList';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
 import * as corp from '@/store/corp';
 import * as corp from '@/store/corp';
-
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -28,4 +29,6 @@ export default new Vuex.Store({
     user: user,
     user: user,
     corp: corp,
     corp: corp,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 4 - 0
src/pages/jobfair/store/index.js

@@ -3,6 +3,8 @@ import Vuex from 'vuex';
 import * as jobfair from '@/store/jobfair';
 import * as jobfair from '@/store/jobfair';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
 import * as ticket from '@/store/ticket';
 import * as ticket from '@/store/ticket';
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -11,4 +13,6 @@ export default new Vuex.Store({
     user: user,
     user: user,
     ticket: ticket,
     ticket: ticket,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 4 - 0
src/pages/jobfairList/store/index.js

@@ -3,6 +3,8 @@ import Vuex from 'vuex';
 import * as jobfair from '@/store/jobfair';
 import * as jobfair from '@/store/jobfair';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
 
 
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -10,4 +12,6 @@ export default new Vuex.Store({
     jobfair: jobfair,
     jobfair: jobfair,
     user: user,
     user: user,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 4 - 1
src/pages/jobfairList/views/list.vue

@@ -61,7 +61,7 @@
 <script>
 <script>
 import listLayout from '@/layout/list-layout.vue';
 import listLayout from '@/layout/list-layout.vue';
 import nodata from '@/components/nodata.vue';
 import nodata from '@/components/nodata.vue';
-import { mapActions, mapState } from 'vuex';
+import { mapActions, mapState, mapMutations } from 'vuex';
 export default {
 export default {
   metaInfo() {
   metaInfo() {
     return {
     return {
@@ -93,6 +93,8 @@ export default {
     }),
     }),
   },
   },
   methods: {
   methods: {
+    ...mapMutations(['setLoading']),
+
     ...mapActions(['fairsOperation']),
     ...mapActions(['fairsOperation']),
     async search(type) {
     async search(type) {
       this.loading = true;
       this.loading = true;
@@ -114,6 +116,7 @@ export default {
         this.$set(this, `totalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `totalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `hasMore`, this.list.length < this.totalRow); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
         this.$set(this, `hasMore`, this.list.length < this.totalRow); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
       }
       }
+      this.setLoading(false);
       this.loading = false;
       this.loading = false;
     },
     },
     searchBar({ type, value }) {
     searchBar({ type, value }) {

+ 4 - 0
src/pages/jobinfo/store/index.js

@@ -4,6 +4,8 @@ import * as list from '@/store/jobinfo';
 import * as post from '@/store/jobs';
 import * as post from '@/store/jobs';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
 
 
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -12,4 +14,6 @@ export default new Vuex.Store({
     user: user,
     user: user,
     post: post,
     post: post,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 4 - 1
src/pages/jobinfoList/store/index.js

@@ -3,7 +3,8 @@ import Vuex from 'vuex';
 import * as jobinfo from '@/store/jobinfo';
 import * as jobinfo from '@/store/jobinfo';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
 import * as corp from '@/store/corp';
 import * as corp from '@/store/corp';
-
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -12,4 +13,6 @@ export default new Vuex.Store({
     user: user,
     user: user,
     corp: corp,
     corp: corp,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 3 - 1
src/pages/jobinfoList/views/list.vue

@@ -113,7 +113,7 @@
 import listLayout from '@/layout/list-layout.vue';
 import listLayout from '@/layout/list-layout.vue';
 import nodata from '@/components/nodata.vue';
 import nodata from '@/components/nodata.vue';
 import _ from 'lodash';
 import _ from 'lodash';
-import { mapActions, mapState } from 'vuex';
+import { mapActions, mapState, mapMutations } from 'vuex';
 export default {
 export default {
   metaInfo() {
   metaInfo() {
     return {
     return {
@@ -158,6 +158,7 @@ export default {
     }),
     }),
   },
   },
   methods: {
   methods: {
+    ...mapMutations(['setLoading']),
     ...mapActions(['jobinfoOperation', 'corpOperation']),
     ...mapActions(['jobinfoOperation', 'corpOperation']),
     //添加type形参
     //添加type形参
     async search(type) {
     async search(type) {
@@ -183,6 +184,7 @@ export default {
         this.$set(this, `totalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `totalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `hasMore`, this.list.length < this.totalRow); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
         this.$set(this, `hasMore`, this.list.length < this.totalRow); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
       }
       }
+      this.setLoading(false);
       this.loading = false;
       this.loading = false;
     },
     },
     searchBar({ type, value }) {
     searchBar({ type, value }) {

+ 4 - 0
src/pages/jobs/store/index.js

@@ -5,6 +5,8 @@ import * as user from '@/store/user';
 import * as resumes from '@/store/resumes';
 import * as resumes from '@/store/resumes';
 import * as letters from '@/store/letters';
 import * as letters from '@/store/letters';
 import * as corp from '@/store/corp';
 import * as corp from '@/store/corp';
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -15,4 +17,6 @@ export default new Vuex.Store({
     letters: letters,
     letters: letters,
     corp: corp,
     corp: corp,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 4 - 1
src/pages/jobsList/store/index.js

@@ -2,7 +2,8 @@ import Vue from 'vue';
 import Vuex from 'vuex';
 import Vuex from 'vuex';
 import * as jobs from '@/store/jobs';
 import * as jobs from '@/store/jobs';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
-
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -10,4 +11,6 @@ export default new Vuex.Store({
     jobs: jobs,
     jobs: jobs,
     user: user,
     user: user,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 2 - 0
src/pages/jobsList/views/list.vue

@@ -66,6 +66,7 @@ export default {
   },
   },
   computed: {},
   computed: {},
   methods: {
   methods: {
+    ...mapMutations(['setLoading']),
     ...mapActions(['postsOperation']),
     ...mapActions(['postsOperation']),
     async search({ type = this.active, currentPage } = {}) {
     async search({ type = this.active, currentPage } = {}) {
       let skip = 0;
       let skip = 0;
@@ -86,6 +87,7 @@ export default {
         this.$set(this, `${type}TotalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `${type}TotalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `${type}HasMore`, _.get(this, `${type}List`).length < result.total); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
         this.$set(this, `${type}HasMore`, _.get(this, `${type}List`).length < result.total); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
       }
       }
+      this.setLoading(false);
     },
     },
     searchBar({ type, value }) {
     searchBar({ type, value }) {
       //1)实时同步查询框中的内容至当前组件内
       //1)实时同步查询框中的内容至当前组件内

+ 4 - 1
src/pages/news/store/index.js

@@ -11,7 +11,8 @@ import * as jobfair from '@/store/jobfair';
 import * as school from '@/store/schoolList';
 import * as school from '@/store/schoolList';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
 import * as news from '@/store/news';
 import * as news from '@/store/news';
-
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -28,4 +29,6 @@ export default new Vuex.Store({
     user: user,
     user: user,
     news: news,
     news: news,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 5 - 0
src/pages/newsList/store/index.js

@@ -4,9 +4,14 @@ import * as site from '@/store/site';
 import * as modules from '@/store/module';
 import * as modules from '@/store/module';
 import * as column from '@/store/column';
 import * as column from '@/store/column';
 import * as news from '@/store/news';
 import * as news from '@/store/news';
+
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
+  state: { ...ustate },
+  mutations: { ...umutations },
   modules: {
   modules: {
     site: site,
     site: site,
     module: modules,
     module: modules,

+ 8 - 5
src/pages/newsList/views/list.vue

@@ -3,15 +3,16 @@
     <el-image style="width: 100%; height: 10rem" :src="url"></el-image>
     <el-image style="width: 100%; height: 10rem" :src="url"></el-image>
     <el-tabs v-model="activeName" style="padding:10px;" @tab-click="tabClick">
     <el-tabs v-model="activeName" style="padding:10px;" @tab-click="tabClick">
       <el-tab-pane v-for="(item, index) in list" :key="index" :name="`${index}`" :label="item.title">
       <el-tab-pane v-for="(item, index) in list" :key="index" :name="`${index}`" :label="item.title">
-        <item @search="toSearch" :list="item.children" :hasMore="item.hasMore" :index="item.index"></item>
+        <item @search="toSearch" :list="item.children" :hasMore="item.hasMore" :index="index"></item>
       </el-tab-pane>
       </el-tab-pane>
     </el-tabs>
     </el-tabs>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-import { mapActions } from 'vuex';
+import { mapActions, mapMutations } from 'vuex';
 import item from './item.vue';
 import item from './item.vue';
+import _ from 'lodash';
 export default {
 export default {
   metaInfo() {
   metaInfo() {
     return {
     return {
@@ -42,6 +43,7 @@ export default {
     },
     },
   },
   },
   methods: {
   methods: {
+    ...mapMutations(['setLoading']),
     ...mapActions(['siteOperation', 'columnOperation', 'newsOperation']),
     ...mapActions(['siteOperation', 'columnOperation', 'newsOperation']),
     async getSite() {
     async getSite() {
       let site = sessionStorage.getItem('site');
       let site = sessionStorage.getItem('site');
@@ -83,6 +85,7 @@ export default {
         this.$message.error(res.errmsg ? res.errmsg : 'error');
         this.$message.error(res.errmsg ? res.errmsg : 'error');
       }
       }
     },
     },
+    //查每个栏目下的信息
     async toSearch({ index, info }) {
     async toSearch({ index, info }) {
       let target = JSON.parse(JSON.stringify(this.list[index]));
       let target = JSON.parse(JSON.stringify(this.list[index]));
       if (target.hasMore === false) return;
       if (target.hasMore === false) return;
@@ -93,23 +96,23 @@ export default {
       } else {
       } else {
         target.page = 1;
         target.page = 1;
         target.skip = 0;
         target.skip = 0;
-        target.limit = this.$limit;
+        target.limit = this.$limit || 4;
       }
       }
       //数据处理
       //数据处理
       if (target.type === 'bugList' || target.type === 'column') {
       if (target.type === 'bugList' || target.type === 'column') {
         let res = await this.getNewsList(target, target.news_type, { skip: target.skip, limit: target.limit });
         let res = await this.getNewsList(target, target.news_type, { skip: target.skip, limit: target.limit });
         if (`${res.errcode}` === '0') {
         if (`${res.errcode}` === '0') {
-          target.children ? target.children.concat(res.data) : (target.children = res.data);
+          _.get(target, `children`) ? (target.children = [...target.children, ...res.data]) : (target.children = res.data);
           target.hasMore = target.children.length < res.total;
           target.hasMore = target.children.length < res.total;
         }
         }
         this.$set(this.list, index, target);
         this.$set(this.list, index, target);
       } else if (target.type === 'content') {
       } else if (target.type === 'content') {
         target.path = `news.html#/${target.content_id}`;
         target.path = `news.html#/${target.content_id}`;
       }
       }
+      this.setLoading(false);
     },
     },
     tabClick() {
     tabClick() {
       let target = this.list[this.activeName];
       let target = this.list[this.activeName];
-      console.log(target);
       if (target.type === 'url') {
       if (target.type === 'url') {
         window.location.href = target.url;
         window.location.href = target.url;
       } else if (target.type === 'content') {
       } else if (target.type === 'content') {

+ 4 - 1
src/pages/student/store/index.js

@@ -9,7 +9,8 @@ import * as letters from '@/store/letters';
 import * as jobs from '@/store/jobs';
 import * as jobs from '@/store/jobs';
 import * as corp from '@/store/corp';
 import * as corp from '@/store/corp';
 import * as dictionary from '@/store/dictionary';
 import * as dictionary from '@/store/dictionary';
-
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -24,4 +25,6 @@ export default new Vuex.Store({
     corp: corp,
     corp: corp,
     dictionary: dictionary,
     dictionary: dictionary,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 4 - 1
src/pages/talk/store/index.js

@@ -4,7 +4,8 @@ import * as talks from '@/store/talks';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
 import * as post from '@/store/jobs';
 import * as post from '@/store/jobs';
 import * as ticket from '@/store/ticket';
 import * as ticket from '@/store/ticket';
-
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -14,4 +15,6 @@ export default new Vuex.Store({
     post: post,
     post: post,
     user: user,
     user: user,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 4 - 1
src/pages/talkList/store/index.js

@@ -3,7 +3,8 @@ import Vuex from 'vuex';
 import * as talks from '@/store/talks';
 import * as talks from '@/store/talks';
 import * as user from '@/store/user';
 import * as user from '@/store/user';
 import * as corp from '@/store/corp';
 import * as corp from '@/store/corp';
-
+import * as ustate from '@/store/common/state';
+import * as umutations from '@/store/common/mutations';
 Vue.use(Vuex);
 Vue.use(Vuex);
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -12,4 +13,6 @@ export default new Vuex.Store({
     user: user,
     user: user,
     corp: corp,
     corp: corp,
   },
   },
+  state: { ...ustate },
+  mutations: { ...umutations },
 });
 });

+ 3 - 1
src/pages/talkList/views/list.vue

@@ -43,7 +43,7 @@
 
 
 <script>
 <script>
 import listLayout from '@/layout/list-layout.vue';
 import listLayout from '@/layout/list-layout.vue';
-import { mapActions, mapState } from 'vuex';
+import { mapActions, mapState, mapMutations } from 'vuex';
 import nodata from '@/components/nodata.vue';
 import nodata from '@/components/nodata.vue';
 import _ from 'lodash';
 import _ from 'lodash';
 export default {
 export default {
@@ -111,6 +111,7 @@ export default {
     }),
     }),
   },
   },
   methods: {
   methods: {
+    ...mapMutations(['setLoading']),
     ...mapActions(['talksOperation', 'corpOperation']),
     ...mapActions(['talksOperation', 'corpOperation']),
     async search(type) {
     async search(type) {
       this.loading = true;
       this.loading = true;
@@ -134,6 +135,7 @@ export default {
         this.$set(this, `totalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `totalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `hasMore`, this.list.length < this.totalRow); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
         this.$set(this, `hasMore`, this.list.length < this.totalRow); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
       }
       }
+      this.setLoading(false);
       this.loading = false;
       this.loading = false;
     },
     },
     searchBar({ type, value }) {
     searchBar({ type, value }) {

+ 5 - 0
src/store/common/mutations.js

@@ -0,0 +1,5 @@
+import _ from 'lodash';
+export const setLoading = (state, payload) => {
+  if (_.isBoolean(payload)) state.iloading = payload;
+  else state.iloading = !state.iloading;
+};

+ 1 - 0
src/store/common/state.js

@@ -0,0 +1 @@
+export const iloading = false;

+ 1 - 1
vue.config.js

@@ -45,7 +45,7 @@ module.exports = {
         target: 'http://smart.cc-lotus.info',
         target: 'http://smart.cc-lotus.info',
         ws: true,
         ws: true,
         onProxyReq(proxyReq, req, res) {
         onProxyReq(proxyReq, req, res) {
-          proxyReq.setHeader('x-tenant', '99991');
+          proxyReq.setHeader('x-tenant', 'master');
         },
         },
       },
       },
       '/wxtoken': {
       '/wxtoken': {