asd123a20 3 years ago
parent
commit
461bfc0b96

+ 17 - 27
src/components/foot/index.vue

@@ -6,23 +6,23 @@
         <div class="infobox">
           <div class="info">
             <div class="title">主办单位:</div>
-            <div class="text">{{ datas && datas.company }}</div>
+            <div class="text">{{ configurationdata && configurationdata.company }}</div>
           </div>
           <div class="info">
             <div class="title">单位电话:</div>
-            <div class="text">{{ datas && datas.phone }}</div>
+            <div class="text">{{ configurationdata && configurationdata.phone }}</div>
           </div>
           <div class="info">
             <div class="title">单位地址:</div>
-            <div class="text">{{ datas && datas.address }}</div>
+            <div class="text">{{ configurationdata && configurationdata.address }}</div>
           </div>
           <div class="info">
             <div class="title">单位邮编:</div>
-            <div class="text">{{ datas && datas.postcode }}</div>
+            <div class="text">{{ configurationdata && configurationdata.postcode }}</div>
           </div>
           <div class="info">
             <div class="title">备案号:</div>
-            <div class="text">{{ datas && datas.record }}</div>
+            <div class="text">{{ configurationdata && configurationdata.record }}</div>
           </div>
         </div>
         <img src="../../assets/foot/sy.png" alt="事业单位" class="sydw">
@@ -33,34 +33,24 @@
 
 <script>
 import links from './links.vue'
+import { createNamespacedHelpers } from 'vuex'
+const { mapActions: configmapActions, mapState: configmapState } = createNamespacedHelpers('webconfig')
 export default {
   components: {
     links
   },
   data () {
-    return {
-      datas: {
-        // 名称
-        name: '吉林省社会科学院、吉林省社会科学界联合会 © 2021',
-        // 描述
-        describe: '',
-        // 单位
-        company: '吉林省社会科学院、吉林省社会科学界联合会 © 2021',
-        // 电话
-        phone: '0431-84637225(编辑室) 0431-81294835(编务室) ',
-        // 地址
-        address: '吉林省长春市自由大路5399号',
-        // 邮箱
-        mail: 'jjzh1985@vip.163.com',
-        // 邮编
-        postcode: '130033',
-        // 备案号
-        record: '吉ICP备 15003060号-1'
-      }
-    }
+    return {}
+  },
+  methods: {
+    ...configmapActions(['configurationquery'])
   },
-  methods: {},
-  mounted () {}
+  mounted () {
+    this.configurationquery()
+  },
+  computed: {
+    ...configmapState(['configurationdata'])
+  }
 }
 </script>
 

+ 8 - 3
src/components/heads/index.vue

@@ -7,7 +7,7 @@
                 <input placeholder="搜索" class="input1" type="text">
                 <button class="btn1">搜索</button>
             </div> -->
-            <h3 class="el-icon-phone"> 0431-84637225</h3>
+            <h3 class="el-icon-phone"> {{ configurationdata && configurationdata.phone }}</h3>
         </div>
     </div>
     <menus class="menu"></menus>
@@ -16,6 +16,8 @@
 
 <script>
 import menus from './menus.vue'
+import { createNamespacedHelpers } from 'vuex'
+const { mapState: configmapState } = createNamespacedHelpers('webconfig')
 export default {
   components: {
     menus
@@ -24,7 +26,10 @@ export default {
     return {}
   },
   methods: {},
-  mounted () {}
+  mounted () {},
+  computed: {
+    ...configmapState(['configurationdata'])
+  }
 }
 </script>
 
@@ -64,7 +69,7 @@ export default {
                 }
             }
             h3 {
-                margin-left: 40%;
+                // margin-left: 10%;
             }
         }
     }

+ 1 - 1
src/components/heads/menus.vue

@@ -47,7 +47,7 @@ export default {
       // eslint-disable-next-line eqeqeq
       if (e.type == '2') {
         const routeData = this.$router.resolve({
-          path: `/www/page/${e.code}`
+          path: `/www/page/${e.pages}`
         })
         window.open(routeData.href)
       }

+ 1 - 1
src/components/sidebar/index.vue

@@ -5,7 +5,7 @@
       <cover class="cover"></cover>
       <p>经济纵横 2021第1期  总第190期</p>
       <p>出版时间:2021年01月01日</p>
-      <el-button class="btn" size="mini">查看详细内容</el-button>
+      <!-- <el-button class="btn" size="mini">查看详细内容</el-button> -->
     </div>
     <buttons class="btns"></buttons>
   </div>

+ 0 - 20
src/store/column.js

@@ -1,20 +0,0 @@
-import axios from 'axios'
-const api = {
-  query: '/api/column/menuquery'
-}
-const state = {
-  items: []
-}
-const mutations = {
-  column (state, payload) {
-    state.items = payload
-  }
-}
-const actions = {
-  async getcolumn ({ commit }, payload) {
-    const res = await axios.get(api.query, { params: { code: payload.code } })
-    if (res.data.errcode === 0) commit('column', res.data.data)
-    return res
-  }
-}
-export default { state, mutations, actions, namespaced: true }

+ 1 - 1
src/store/content.js

@@ -19,7 +19,7 @@ const mutations = {
 }
 const actions = {
   async getcontent ({ commit }, { code, skip, limit } = {}) {
-    const res = await axios.get(api.query, { params: { columns: code, skip, limit } })
+    const res = await axios.get(api.query, { params: { code, skip, limit } })
     if (res.data.errcode === 0) commit('content', res.data)
     return res
   },

+ 3 - 3
src/store/index.js

@@ -1,11 +1,11 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
 import menu from './menu'
-import column from './column'
 import content from './content'
 import page from './page'
 import banner from './banner'
 import links from './links'
+import webconfig from './webconfig'
 Vue.use(Vuex)
 
 export default new Vuex.Store({
@@ -17,10 +17,10 @@ export default new Vuex.Store({
   },
   modules: {
     menu,
-    column,
     content,
     page,
     banner,
-    links
+    links,
+    webconfig
   }
 })

+ 14 - 4
src/store/page.js

@@ -1,20 +1,30 @@
 import axios from 'axios'
 const api = {
-  query: '/api/page/details'
+  query: '/api/page/details',
+  pagequery: '/api/page/query'
 }
 const state = {
-  pageitem: {}
+  pageitem: {},
+  pageList: null
 }
 const mutations = {
   details (state, payload) {
-    state.pageitem = payload[0]
+    state.pageitem = payload
+  },
+  page (state, payload) {
+    state.pageList = payload.data
   }
 }
 const actions = {
   async getdetails ({ commit }, payload) {
-    const res = await axios.get(api.query, { params: { code: payload.code } })
+    const res = await axios.get(`${api.query}/${payload.code}`)
     if (res.data.errcode === 0) commit('details', res.data.data)
     return res
+  },
+  async pagequery ({ commit }) {
+    const res = await axios.get(api.pagequery)
+    if (res.errcode === 0) commit('page', res)
+    return res
   }
 }
 export default { state, mutations, actions, namespaced: true }

+ 33 - 0
src/store/webconfig.js

@@ -0,0 +1,33 @@
+import axios from 'axios'
+const api = {
+  configurationquery: '/api/configuration/query',
+  configurationcreate: '/api/configuration/create',
+  configurationupdate: '/api/configuration/update'
+}
+
+// initial state
+const state = () => ({
+  configurationdata: {}
+})
+
+// actions
+const actions = {
+  async configurationquery ({ commit }, { filter, paging } = {}) {
+    const res = await axios.get(api.configurationquery)
+    if (res.data.errcode === 0) commit('configurationquery', res.data)
+    return res
+  }
+}
+
+// mutations
+const mutations = {
+  configurationquery (state, payload) {
+    state.configurationdata = payload.data
+  }
+}
+export default {
+  namespaced: true,
+  state,
+  actions,
+  mutations
+}

File diff suppressed because it is too large
+ 35 - 22
src/views/Home.vue


+ 2 - 2
src/views/details.vue

@@ -6,8 +6,8 @@
       <div class="box">
         <titles :type="'正文'" :title="item" :en="en"></titles>
         <div class="html">
-          <h2>{{ contentitem.title }}</h2>
-          <p class="date">发表时间: {{ contentitem.date }} / 访问量: {{ contentitem.hits || 0 }}</p>
+          <h2>{{ contentitem && contentitem.title }}</h2>
+          <p class="date">发表时间: {{ contentitem && contentitem.date }}  访问量: {{ contentitem && contentitem.hits || 0 }}</p>
           <div class="content" v-html="contentitem.content"></div>
           <a v-if="contentitem && contentitem.annexname" :href="contentitem.annex" target="_blank">附件: {{ contentitem.annexname }}</a>
         </div>

+ 11 - 17
src/views/list.vue

@@ -35,7 +35,6 @@ import moment from 'moment'
 import breadcrumb from '../components/breadcrumb.vue'
 import { createNamespacedHelpers } from 'vuex'
 const { mapState, mapActions } = createNamespacedHelpers('menu')
-const { mapState: columnmapState, mapActions: columnmapActions } = createNamespacedHelpers('column')
 const { mapState: contentnmapState, mapActions: contentmapActions } = createNamespacedHelpers('content')
 export default {
   props: {
@@ -56,11 +55,10 @@ export default {
   },
   methods: {
     ...mapActions(['getmenu']),
-    ...columnmapActions(['getcolumn']),
     ...contentmapActions(['getcontent']),
     // 分页
     async currentChange (e) {
-      await this.getcontent({ code: this.columnitems[0].code, skip: e - 1, limit: this.pageSize })
+      await this.getcontent({ code: this.id, skip: e - 1, limit: this.pageSize })
       this.contentlist = [...this.contentitems]
       this.total = this.contenttotal
     },
@@ -73,20 +71,17 @@ export default {
       window.open(routeData.href)
     },
     async filteritem () {
-      const items = this.items.filter(p => p.code === this.id)[0]
-      this.item = items.name || ''
-      this.en = items.en || ''
-      const res = await this.getcolumn(items)
-      if (res.data.errcode === 0) {
-        if (this.columnitems.length > 0) {
-          await this.getcontent({ code: this.columnitems[0].code, skip: 0, limit: this.pageSize })
-          this.contentlist = [...this.contentitems]
-          this.total = this.contenttotal
-        } else {
-          this.contentlist = []
-          this.total = 0
-        }
+      let items = {}
+      if (this.id !== '-1') {
+        items = this.items.filter(p => p.code === this.id)[0]
       }
+      // eslint-disable-next-line eqeqeq
+      this.item = items.name
+      // eslint-disable-next-line eqeqeq
+      this.en = items.en
+      await this.getcontent({ code: this.id, skip: 0, limit: this.pageSize })
+      this.contentlist = [...this.contentitems]
+      this.total = this.contenttotal
     }
   },
   async mounted () {
@@ -95,7 +90,6 @@ export default {
   },
   computed: {
     ...mapState(['items']),
-    ...columnmapState({ columnitems: 'items' }),
     ...contentnmapState({ contentitems: 'items', contenttotal: 'total' })
   },
   watch: {

+ 2 - 3
src/views/page.vue

@@ -48,7 +48,8 @@ export default {
     async filteritem () {
       let items = {}
       if (this.code !== '-1') {
-        items = this.items.filter(p => p.code === this.id)[0]
+        console.log(this.items)
+        items = this.items.filter(p => p.code === this.code)[0]
       }
       // eslint-disable-next-line eqeqeq
       this.item = this.code == '-1' ? '轮播图' : items.name
@@ -62,11 +63,9 @@ export default {
     if (res.data.errcode === 0) this.filteritem()
     // eslint-disable-next-line eqeqeq
     if (this.code == '-1') {
-      console.log(111)
       await this.bannergetdetails({ id: this.id })
       this.pagedetails = this.banneritem
     } else {
-      console.log(222)
       await this.getdetails({ code: this.id })
       this.pagedetails = this.pageitem
     }