yuantianjiao 6 년 전
부모
커밋
e6b8f03601

+ 2
- 0
src/main.js 파일 보기

@@ -10,6 +10,7 @@ import './style/main.css'
10 10
 import router from './router'
11 11
 import Ajax from './util/ajax'
12 12
 import api from './util/api'
13
+import toolClass from './util/util'
13 14
 import store from './store'
14 15
 import Vuex from 'vuex'
15 16
 import md5 from 'js-md5'
@@ -31,6 +32,7 @@ Vue.prototype.$api = api
31 32
 Vue.prototype.$ajax = Ajax
32 33
 Vue.prototype.md5 = md5
33 34
 Vue.prototype.Base64 = Base64
35
+Vue.prototype.toolClass = toolClass
34 36
 /* eslint-disable no-new */
35 37
 new Vue({
36 38
   el: '#app',

+ 9
- 6
src/pages/system/cmsManager/bannerManager/add.vue 파일 보기

@@ -72,7 +72,7 @@
72 72
             </el-upload>
73 73
           </div>
74 74
         </li>
75
-        <li class="flex-h">
75
+        <!-- <li class="flex-h">
76 76
           <span>对应案场:</span>
77 77
           <div class="flex-item">
78 78
             <div style="width:50%">
@@ -86,7 +86,7 @@
86 86
               </el-select>
87 87
             </div>
88 88
           </div>
89
-        </li>
89
+        </li> -->
90 90
         <li style="text-align:center">
91 91
           <el-button type="primary" size="mini" @click="submit">保存</el-button>
92 92
           <el-button type="danger" size="mini" @click="cancel">取消</el-button>
@@ -97,7 +97,7 @@
97 97
 </template>
98 98
 
99 99
 <script>
100
-import { mapState, createNamespacedHelpers } from 'vuex'
100
+import { mapState, createNamespacedHelpers, mapActions } from 'vuex'
101 101
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
102 102
 export default {
103 103
   name: '',
@@ -108,7 +108,7 @@ export default {
108 108
         ForwardUrl: '',
109 109
         ForwardResourceId: '',
110 110
         Status: '1',
111
-        LocationId: '',
111
+        LocationId: '1',
112 112
         ImageUrl: '',
113 113
         Title: '',
114 114
         OrgId: '',
@@ -119,7 +119,9 @@ export default {
119 119
   components: {},
120 120
   created () {
121 121
     this.updateLocationInfo()
122
-    this.postData.CaseId = this.defaultCaseId
122
+    this.updateSystemInfo().then(() => {
123
+      this.postData.CaseId = this.defaultCaseId
124
+    })
123 125
   },
124 126
   computed: {
125 127
     ...mapState({
@@ -131,9 +133,10 @@ export default {
131 133
   },
132 134
   methods: {
133 135
     ...mapCmsActions(['updateLocationInfo']),
136
+    ...mapActions(['updateSystemInfo']),
134 137
     submit () {
135 138
       this.postData.OrgId = this.OrgId
136
-      console.log(this.postData)
139
+      this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
137 140
       this.$ajax(this.$api.cms.addImage.url, {
138 141
         method: this.$api.cms.addImage.method,
139 142
         data: this.postData

+ 4
- 2
src/pages/system/cmsManager/bannerManager/edit.vue 파일 보기

@@ -72,7 +72,7 @@
72 72
             </el-upload>
73 73
           </div>
74 74
         </li>
75
-        <li class="flex-h">
75
+        <!-- <li class="flex-h">
76 76
           <span>对应案场:</span>
77 77
           <div class="flex-item">
78 78
             <div style="width:50%">
@@ -86,7 +86,7 @@
86 86
               </el-select>
87 87
             </div>
88 88
           </div>
89
-        </li>
89
+        </li> -->
90 90
         <li style="text-align:center">
91 91
           <el-button type="primary" size="mini" @click="submit">保存</el-button>
92 92
           <el-button type="danger" size="mini" @click="cancel">取消</el-button>
@@ -133,6 +133,7 @@ export default {
133 133
     submit () {
134 134
       this.postData.OrgId = this.OrgId
135 135
       this.postData.CaseId = this.CaseId
136
+      this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
136 137
       console.log(this.postData)
137 138
       this.$ajax(this.$api.cms.editImage.url, {
138 139
         method: this.$api.cms.editImage.method,
@@ -168,6 +169,7 @@ export default {
168 169
       }).then(res => {
169 170
         console.log(res)
170 171
         res.Status = res.Status + ''
172
+        res.ForwardType === 'url' ? res.ForwardType = '1' : res.ForwardType = '0'
171 173
         this.postData = res
172 174
       }).catch(msg => {
173 175
 

+ 5
- 2
src/pages/system/cmsManager/bannerManager/index.vue 파일 보기

@@ -57,7 +57,7 @@
57 57
 
58 58
 <script>
59 59
 import tableSearch from '@/components/tableSearch/index'
60
-import { mapState, createNamespacedHelpers } from 'vuex'
60
+import { mapState, createNamespacedHelpers, mapActions } from 'vuex'
61 61
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
62 62
 export default {
63 63
   name: '',
@@ -80,11 +80,14 @@ export default {
80 80
     tableSearch,
81 81
   },
82 82
   created () {
83
+    this.updateSystemInfo().then(() => {
84
+      this.getList()
85
+    })
83 86
     this.updateLocationInfo()
84
-    this.getList()
85 87
   },
86 88
   methods: {
87 89
     ...mapCmsActions(['updateLocationInfo']),
90
+    ...mapActions(['updateSystemInfo']),
88 91
     handleCurrentChange (val) {
89 92
       this.postData.currentPage = val
90 93
       this.getList()

+ 6
- 4
src/pages/system/cmsManager/indexMsg/add.vue 파일 보기

@@ -66,7 +66,7 @@
66 66
 </template>
67 67
 
68 68
 <script>
69
-import { mapState, createNamespacedHelpers } from 'vuex'
69
+import { mapState, createNamespacedHelpers, mapActions } from 'vuex'
70 70
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
71 71
 export default {
72 72
   name: '',
@@ -84,7 +84,9 @@ export default {
84 84
   components: {},
85 85
   created () {
86 86
     this.updateLocationInfo()
87
-    this.postData.CaseId = this.defaultCaseId
87
+    this.updateSystemInfo().then(() => {
88
+      this.postData.CaseId = this.defaultCaseId
89
+    })
88 90
   },
89 91
   computed: {
90 92
     ...mapState({
@@ -96,6 +98,7 @@ export default {
96 98
   },
97 99
   methods: {
98 100
     ...mapCmsActions(['updateLocationInfo']),
101
+    ...mapActions(['updateSystemInfo']),
99 102
     submit () {
100 103
       console.log(this.postData)
101 104
       this.postData.OrgId = this.OrgId
@@ -118,8 +121,7 @@ export default {
118 121
     cancel () {
119 122
       this.$router.go(-1)
120 123
     }
121
-  },
122
-  mounted () { }
124
+  }
123 125
 }
124 126
 </script>
125 127
 

+ 15
- 2
src/pages/system/cmsManager/indexMsg/index.vue 파일 보기

@@ -5,7 +5,7 @@
5 5
         <div class="flex-item flex-h">
6 6
           <el-button size="mini" type="success" @click='addIndexMsg'>新增消息</el-button>
7 7
         </div>
8
-        <tableSearch @exportSearchKey="searchList"></tableSearch>
8
+        <tableSearch value="请输入标题" @exportSearchKey="searchList"></tableSearch>
9 9
       </div>
10 10
       <div class="moreFilter"></div>
11 11
     </div>
@@ -104,7 +104,20 @@ export default {
104 104
       })
105 105
     },
106 106
     searchList (key) { // 搜索列表
107
-      console.log(key)
107
+      this.$ajax(this.$api.cms.info.url, {
108
+        method: this.$api.cms.info.method,
109
+        queryData: {
110
+          page: this.postData.currentPage,
111
+          pagesize: 100,
112
+          title: key
113
+        }
114
+      }).then(res => {
115
+        this.tableData = res.list
116
+        this.postData.total = res.pagenum
117
+        this.postData.currentPage = res.page
118
+      }).catch(msg => {
119
+
120
+      })
108 121
     },
109 122
     addIndexMsg () {
110 123
       this.$router.push({ name: 'addIndexMsg' })

+ 5
- 5
src/pages/system/cmsManager/majorProjects/add.vue 파일 보기

@@ -104,7 +104,7 @@
104 104
 </template>
105 105
 
106 106
 <script>
107
-import { mapState } from 'vuex'
107
+import { mapState, mapActions } from 'vuex'
108 108
 export default {
109 109
   name: '',
110 110
   data () {
@@ -136,6 +136,7 @@ export default {
136 136
     })
137 137
   },
138 138
   methods: {
139
+    ...mapActions(['updateSystemInfo']),
139 140
     submit () {
140 141
       this.postData.OrgId = this.OrgId
141 142
       for (let i = 0; i < this.imgsArr.length; i++) {
@@ -188,13 +189,12 @@ export default {
188 189
           this.detailimgsArr.splice(i, 1)
189 190
         }
190 191
       }
191
-    },
192
-    spli (arr) {
193
-      console.log(arr)
194 192
     }
195 193
   },
196 194
   created () {
197
-    this.postData.CaseId = this.defaultCaseId
195
+    this.updateSystemInfo().then(() => {
196
+      this.postData.CaseId = this.defaultCaseId
197
+    })
198 198
   }
199 199
 }
200 200
 </script>

+ 16
- 3
src/pages/system/cmsManager/majorProjects/edit.vue 파일 보기

@@ -189,11 +189,24 @@ export default {
189 189
         }
190 190
       }
191 191
     },
192
-    spli (arr) {
193
-      console.log(arr)
192
+    getDetail () {
193
+      this.$ajax(this.$api.cms.caseDetail.url, {
194
+        method: this.$api.cms.caseDetail.method,
195
+        urlData: {
196
+          id: this.$route.query.id
197
+        }
198
+      }).then(res => {
199
+        console.log(res)
200
+        res.IsAllCourse += ''
201
+        this.postData = res
202
+      }).catch(msg => {
203
+
204
+      })
194 205
     }
195 206
   },
196
-  mounted () { }
207
+  created () {
208
+    this.getDetail()
209
+  }
197 210
 }
198 211
 </script>
199 212
 

+ 37
- 39
src/pages/system/cmsManager/majorProjects/index.vue 파일 보기

@@ -28,19 +28,19 @@
28 28
         stripe
29 29
         style="width: 100%">
30 30
         <el-table-column
31
-          prop="name"
31
+          prop="Name"
32 32
           label="名称">
33 33
         </el-table-column>
34 34
         <el-table-column
35
-          prop="title"
35
+          prop="Title"
36 36
           label="标题">
37 37
         </el-table-column>
38 38
         <el-table-column
39
-          prop="caseName"
39
+          prop="CaseName"
40 40
           label="对应案场">
41 41
         </el-table-column>
42 42
         <el-table-column
43
-          prop="creatTime"
43
+          prop="CreateDate"
44 44
           label="创建时间">
45 45
         </el-table-column>
46 46
         <el-table-column label="操作" width="450">
@@ -80,7 +80,7 @@
80 80
 
81 81
 <script>
82 82
 import tableSearch from '@/components/tableSearch/index'
83
-import { mapState } from 'vuex'
83
+import { mapState, mapActions } from 'vuex'
84 84
 
85 85
 export default {
86 86
   name: '',
@@ -95,31 +95,7 @@ export default {
95 95
         key: '', // 搜索关键字
96 96
         caseId: '', // 案场id
97 97
       },
98
-      tableData: [{
99
-        name: 'xxx',
100
-        title: 'xxx',
101
-        caseName: 'xxx',
102
-        creatTime: 'xxx',
103
-        isShow: false
104
-      }, {
105
-        name: 'xxx',
106
-        title: 'xxx',
107
-        caseName: 'xxx',
108
-        creatTime: 'xxx',
109
-        isShow: false
110
-      }, {
111
-        name: 'xxx',
112
-        title: 'xxx',
113
-        caseName: 'xxx',
114
-        creatTime: 'xxx',
115
-        isShow: false
116
-      }, {
117
-        name: 'xxx',
118
-        title: 'xxx',
119
-        caseName: 'xxx',
120
-        creatTime: 'xxx',
121
-        isShow: false
122
-      }]
98
+      tableData: []
123 99
     }
124 100
   },
125 101
   computed: {
@@ -133,10 +109,13 @@ export default {
133 109
     tableSearch,
134 110
   },
135 111
   created () {
136
-    this.getList()
137
-    this.tableSearch.caseId = this.defaultCaseId
112
+    this.updateSystemInfo().then(() => {
113
+      this.tableSearch.caseId = this.defaultCaseId
114
+      this.getList()
115
+    })
138 116
   },
139 117
   methods: {
118
+    ...mapActions(['updateSystemInfo']),
140 119
     handleCurrentChange (val) {
141 120
       this.postData.currentPage = val - 1
142 121
       this.getList()
@@ -149,7 +128,7 @@ export default {
149 128
     },
150 129
     editItem (index, row) { // 编辑
151 130
       console.log(index, row)
152
-      this.$router.push({ name: 'editIndexCase', query: { id: row.id } })
131
+      this.$router.push({ name: 'editIndexCase', query: { id: row.CmsCaseId } })
153 132
     },
154 133
     copyItemUrl (index, row) { // 复制专题链接
155 134
       console.log(index, row)
@@ -161,10 +140,7 @@ export default {
161 140
         cancelButtonText: '取消',
162 141
         type: 'warning'
163 142
       }).then(() => {
164
-        this.$message({
165
-          type: 'success',
166
-          message: '删除成功!'
167
-        })
143
+        this.deleteInfo(row.CmsCaseId)
168 144
       }).catch(() => {
169 145
         this.$message({
170 146
           type: 'info',
@@ -183,10 +159,32 @@ export default {
183 159
         method: this.$api.cms.case.method,
184 160
         queryData: {
185 161
           page: this.postData.currentPage,
186
-          pagesize: this.postData.pageSize
162
+          pagesize: this.postData.pageSize,
163
+          caseid: this.tableSearch.caseId
187 164
         }
188 165
       }).then(res => {
189
-        console.log(res)
166
+        for (let i = 0; i < res.list.length; i++) {
167
+          res.list[i].CreateDate = this.toolClass.dateFormat(res.list[i].CreateDate)
168
+        }
169
+        this.tableData = res.list
170
+        this.postData.total = res.pagenum
171
+        this.postData.currentPage = res.page
172
+      }).catch(msg => {
173
+
174
+      })
175
+    },
176
+    deleteInfo (id) {
177
+      this.$ajax(this.$api.cms.deleteCase.url, {
178
+        method: this.$api.cms.deleteCase.method,
179
+        urlData: {
180
+          id: id
181
+        }
182
+      }).then(res => {
183
+        this.$message({
184
+          type: 'success',
185
+          message: '删除成功!'
186
+        })
187
+        this.getList()
190 188
       }).catch(msg => {
191 189
 
192 190
       })

+ 58
- 48
src/pages/system/cmsManager/newsManager/add.vue 파일 보기

@@ -6,8 +6,8 @@
6 6
           <span>跳转类型:</span>
7 7
           <div class="flex-item">
8 8
             <div style="width:50%" class="radio">
9
-                <el-radio v-model="postData.jumpType" label='0' >连接</el-radio>
10
-                <el-radio v-model="postData.jumpType" label='1' >课程</el-radio>
9
+                <el-radio v-model="postData.ForwardType" label='1' >连接</el-radio>
10
+                <el-radio v-model="postData.ForwardType" label='0' >课程</el-radio>
11 11
             </div>
12 12
           </div>
13 13
         </li>
@@ -17,7 +17,7 @@
17 17
             <div style="width:50%">
18 18
               <el-input
19 19
                 placeholder="请输入连接"
20
-                v-model="postData.link"
20
+                v-model="postData.ForwardUrl"
21 21
                 clearable>
22 22
               </el-input>
23 23
             </div>
@@ -27,8 +27,8 @@
27 27
           <span>是否发布:</span>
28 28
           <div class="flex-item">
29 29
             <div style="width:50%" class="radio">
30
-              <el-radio v-model="postData.release" label='0' >是</el-radio>
31
-                <el-radio v-model="postData.release" label='1' >否</el-radio>
30
+              <el-radio v-model="postData.Status" label='1' >是</el-radio>
31
+                <el-radio v-model="postData.Status" label='0' >否</el-radio>
32 32
             </div>
33 33
           </div>
34 34
         </li>
@@ -36,33 +36,24 @@
36 36
           <span>图片位置:</span>
37 37
           <div class="flex-item">
38 38
             <div style="width:50%">
39
-              <el-select v-model="postData.position" placeholder="请选择">
39
+              <el-select v-model="postData.LocationId" placeholder="请选择">
40 40
                 <el-option
41 41
                   v-for="item in positionList"
42
-                  :key="item.value"
43
-                  :label="item.label"
44
-                  :value="item.value">
42
+                  :key="item.LocationId"
43
+                  :label="item.LocationName"
44
+                  :value="item.LocationId">
45 45
                 </el-option>
46 46
               </el-select>
47 47
             </div>
48 48
           </div>
49 49
         </li>
50
-        <li class="flex-h">
51
-          <span>是否推荐到首页:</span>
52
-          <div class="flex-item">
53
-            <div style="width:50%" class="radio">
54
-              <el-radio v-model="postData.index" label='0' >是</el-radio>
55
-                <el-radio v-model="postData.index" label='1' >否</el-radio>
56
-            </div>
57
-          </div>
58
-        </li>
59 50
         <li class="flex-h">
60 51
           <span>标题:</span>
61 52
           <div class="flex-item">
62 53
             <div style="width:50%">
63 54
               <el-input
64
-                placeholder="请输入真实姓名"
65
-                v-model="postData.realName"
55
+                placeholder="请输入标题"
56
+                v-model="postData.Title"
66 57
                 clearable>
67 58
               </el-input>
68 59
             </div>
@@ -71,13 +62,14 @@
71 62
         <li class="flex-h">
72 63
           <span>图片:</span>
73 64
           <div class="flex-item">
74
-            <div>
75
-              <a class="formImg">
76
-                <img src="" class="centerLabel contain" alt="">
77
-                <i class="iconfont icon-quxiao"></i>
78
-              </a>
79
-              <el-button type="success" size="mini">上传图片</el-button>
80
-            </div>
65
+            <el-upload
66
+              class="avatar-uploader"
67
+              :action='$api.file.image.url'
68
+              :show-file-list="false"
69
+              :on-success="handleAvatarSuccess">
70
+              <img v-if="postData.ImageUrl" :src="postData.ImageUrl" class="avatar">
71
+              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
72
+            </el-upload>
81 73
           </div>
82 74
         </li>
83 75
         <li style="text-align:center">
@@ -90,42 +82,60 @@
90 82
 </template>
91 83
 
92 84
 <script>
85
+import { mapState } from 'vuex'
93 86
 export default {
94 87
   name: '',
95 88
   data () {
96 89
     return {
97 90
       postData: {
98
-        jumpType: '0',
99
-        link: '',
100
-        release: '0',
101
-        position: '',
102
-        index: '0'
103
-      },
104
-      positionList: [{
105
-        value: '0',
106
-        label: '首页'
107
-      }, {
108
-        value: '1',
109
-        label: '精选'
110
-      }, {
111
-        value: '2',
112
-        label: '社交'
113
-      }, {
114
-        value: '3',
115
-        label: '健身'
116
-      }],
91
+        ForwardType: '1',
92
+        ForwardUrl: '',
93
+        ForwardResourceId: '',
94
+        Status: '1',
95
+        LocationIds: '1',
96
+        ImageUrl: '',
97
+        Title: '',
98
+        OrgId: '',
99
+        CaseId: ''
100
+      }
117 101
     }
118 102
   },
119 103
   components: {},
104
+  computed: {
105
+    ...mapState({
106
+      positionList: x => x.cms.location,
107
+      OrgId: x => x.app.user.OrgId,
108
+    })
109
+  },
120 110
   methods: {
121 111
     submit () {
122 112
       console.log(this.postData)
113
+      this.postData.OrgId = this.OrgId
114
+      this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
115
+      this.$ajax(this.$api.cms.addNews.url, {
116
+        method: this.$api.cms.addNews.method,
117
+        data: this.postData
118
+      }).then(res => {
119
+        this.$message({
120
+          message: '添加成功',
121
+          type: 'success',
122
+          duration: 1000
123
+        })
124
+        setTimeout(() => {
125
+          this.$router.push({ name: 'newsManager' })
126
+        }, 1000)
127
+      }).catch(msg => {
128
+
129
+      })
123 130
     },
124 131
     cancel () {
125 132
       this.$router.go(-1)
133
+    },
134
+    handleAvatarSuccess (res, file) {
135
+      console.log(res)
136
+      this.postData.ImageUrl = res.result.url
126 137
     }
127
-  },
128
-  mounted () { }
138
+  }
129 139
 }
130 140
 </script>
131 141
 

+ 67
- 45
src/pages/system/cmsManager/newsManager/index.vue 파일 보기

@@ -5,6 +5,19 @@
5 5
         <div class="flex-item flex-h">
6 6
           <el-button size="mini" type="success" @click='addNews'>新增资讯</el-button>
7 7
         </div>
8
+        <ul>
9
+          <li>
10
+            <span>选择位置:</span>
11
+            <el-select v-model="tableSearch.LocationId" placeholder="请选择">
12
+              <el-option
13
+                v-for="item in positionList"
14
+                :key="item.LocationId"
15
+                :label="item.LocationName"
16
+                :value="item.LocationId">
17
+              </el-option>
18
+            </el-select>
19
+          </li>
20
+        </ul>
8 21
         <tableSearch @exportSearchKey="searchList"></tableSearch>
9 22
       </div>
10 23
       <div class="moreFilter"></div>
@@ -17,23 +30,24 @@
17 30
         <el-table-column
18 31
           prop="img"
19 32
           label="图片">
33
+          <template slot-scope="scope">
34
+            <a class="tableImg">
35
+              <img :src="scope.row.ImageUrl" class="centerLabel contain" alt="">
36
+            </a>
37
+          </template>
20 38
         </el-table-column>
21 39
         <el-table-column
22
-          prop="title"
40
+          prop="Title"
23 41
           label="标题">
24 42
         </el-table-column>
25 43
         <el-table-column
26
-          prop="position"
44
+          prop="LocationShow"
27 45
           label="位置">
28 46
         </el-table-column>
29 47
         <el-table-column
30
-          prop="isShow"
48
+          prop="StatusShow"
31 49
           label="是否发布">
32 50
         </el-table-column>
33
-        <el-table-column
34
-          prop="toIndex"
35
-          label="推荐至首页">
36
-        </el-table-column>
37 51
         <el-table-column label="操作">
38 52
           <template slot-scope="scope">
39 53
             <el-button
@@ -49,9 +63,8 @@
49 63
       </el-table>
50 64
     </div>
51 65
     <el-pagination
52
-      @size-change="handleSizeChange"
53 66
       @current-change="handleCurrentChange"
54
-      :current-page.sync="currentPage"
67
+      :current-page.sync="postData.currentPage"
55 68
       :page-size="10"
56 69
       layout="prev, pager, next, jumper"
57 70
       :total="100">
@@ -61,58 +74,39 @@
61 74
 
62 75
 <script>
63 76
 import tableSearch from '@/components/tableSearch/index'
64
-import { createNamespacedHelpers } from 'vuex'
65
-
66
-const { mapState: mapCaseState } = createNamespacedHelpers('case')
67
-
77
+import { mapState, createNamespacedHelpers } from 'vuex'
78
+const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
68 79
 export default {
69 80
   name: '',
70 81
   data () {
71 82
     return {
72
-      currentPage: 0, // 当前页码
83
+      postData: {
84
+        currentPage: 1, // 当前页码
85
+        pageSize: 10,
86
+        total: 0,
87
+      },
73 88
       tableSearch: { // 表格搜索条件
74 89
         key: '', // 搜索关键字
75
-        caseId: '', // 案场id
90
+        LocationId: '1',
76 91
       },
77
-      tableData: [{
78
-        img: 'xxx',
79
-        title: 'xxx',
80
-        position: 'xxx',
81
-        isShow: 'xxx',
82
-        toIndex: 'xxx'
83
-      }, {
84
-        img: 'xxx',
85
-        title: 'xxx',
86
-        position: 'xxx',
87
-        isShow: 'xxx',
88
-        toIndex: 'xxx'
89
-      }, {
90
-        img: 'xxx',
91
-        title: 'xxx',
92
-        position: 'xxx',
93
-        isShow: 'xxx',
94
-        toIndex: 'xxx'
95
-      }, {
96
-        img: 'xxx',
97
-        title: 'xxx',
98
-        position: 'xxx',
99
-        isShow: 'xxx',
100
-        toIndex: 'xxx'
101
-      }]
92
+      tableData: []
102 93
     }
103 94
   },
104 95
   computed: {
105
-    ...mapCaseState({
106
-      caseList: x => x.caseList,
96
+    ...mapState({
97
+      positionList: x => x.cms.location,
107 98
     })
108 99
   },
109 100
   components: {
110 101
     tableSearch,
111 102
   },
103
+  created () {
104
+    this.updateLocationInfo().then(() => {
105
+      this.getList()
106
+    })
107
+  },
112 108
   methods: {
113
-    handleSizeChange (val) {
114
-      console.log(`每页 ${val} 条`)
115
-    },
109
+    ...mapCmsActions(['updateLocationInfo']),
116 110
     handleCurrentChange (val) {
117 111
       console.log(`当前页: ${val}`)
118 112
     },
@@ -143,6 +137,34 @@ export default {
143 137
     },
144 138
     addNews () {
145 139
       this.$router.push({ name: 'addNews' })
140
+    },
141
+    getList () {
142
+      this.$ajax(this.$api.cms.news.url, {
143
+        method: this.$api.cms.news.method,
144
+        queryData: {
145
+          page: this.postData.currentPage,
146
+          pagesize: this.postData.pageSize,
147
+          locationid: this.tableSearch.LocationId
148
+        }
149
+      }).then(res => {
150
+        let that = this
151
+        console.log(that.positionList)
152
+        console.log(res.list)
153
+        for (let i = 0; i < res.list.length; i++) {
154
+          res.list[i].Status === 1 ? res.list[i].StatusShow = '是' : res.list[i].StatusShow = '否'
155
+          for (let j = 0; j < that.positionList.length; i++) {
156
+            if (res.list[i].LocationIds === that.positionList[j].LocationId) {
157
+              res.list[i].LocationShow = that.positionList[j].LocationName
158
+            }
159
+          }
160
+        }
161
+        console.log(res.list)
162
+        this.tableData = res.list
163
+        this.postData.total = res.pagenum
164
+        this.postData.currentPage = res.page
165
+      }).catch(msg => {
166
+
167
+      })
146 168
     }
147 169
   }
148 170
 }

+ 6
- 4
src/store/cms/index.js 파일 보기

@@ -11,12 +11,14 @@ export default {
11 11
   },
12 12
   actions: {
13 13
     updateLocationInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
14
-      this.$ajax(this.$api.cms.location.url, {
15
-        method: this.$api.cms.location.method
16
-      })
17
-        .then(res => {
14
+      return new Promise((resolve) => {
15
+        this.$ajax(this.$api.cms.location.url, {
16
+          method: this.$api.cms.location.method
17
+        }).then(res => {
18 18
           context.commit('init', res)
19
+          resolve()
19 20
         })
21
+      })
20 22
     }
21 23
   }
22 24
 }

+ 21
- 1
src/util/api.js 파일 보기

@@ -151,9 +151,29 @@ const $api = {
151 151
       method: 'put',
152 152
       url: `${baseUrl}/common/cms/info/:id`
153 153
     },
154
-    deleteInfo: { // 编辑首页消息
154
+    deleteInfo: { // 删除首页消息
155 155
       method: 'delete',
156 156
       url: `${baseUrl}/common/cms/info/:id`
157
+    },
158
+    news: { // 咨询列表
159
+      method: 'get',
160
+      url: `${baseUrl}/common/cms/news`
161
+    },
162
+    newsDetail: { // 咨询详情
163
+      method: 'get',
164
+      url: `${baseUrl}/common/cms/news/:id`
165
+    },
166
+    addNews: { // 新增咨询
167
+      method: 'post',
168
+      url: `${baseUrl}/common/cms/news`
169
+    },
170
+    editNews: { // 编辑咨询
171
+      method: 'put',
172
+      url: `${baseUrl}/common/cms/news/:id`
173
+    },
174
+    deleteNews: { // 删除咨询
175
+      method: 'delete',
176
+      url: `${baseUrl}/common/cms/news/:id`
157 177
     }
158 178
   },
159 179
   file: {

+ 25
- 0
src/util/util.js 파일 보기

@@ -0,0 +1,25 @@
1
+const toolClass = {
2
+  dateFormat: (timestamp) => {
3
+    let date = new Date(timestamp)
4
+    let y = date.getFullYear()
5
+    let m = date.getMonth() + 1
6
+    let d = date.getDate()
7
+    let h = date.getHours()
8
+    let min = date.getMinutes()
9
+    if (m < 10) {
10
+      m = '0' + m
11
+    }
12
+    if (d < 10) {
13
+      d = '0' + d
14
+    }
15
+    if (h < 10) {
16
+      h = '0' + h
17
+    }
18
+    if (min < 10) {
19
+      min = '0' + min
20
+    }
21
+    return y + '-' + m + '-' + d + ' ' + h + ':' + min
22
+  }
23
+}
24
+
25
+export default toolClass