yuantianjiao 6 years ago
parent
commit
e6b8f03601

+ 2
- 0
src/main.js View File

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

+ 9
- 6
src/pages/system/cmsManager/bannerManager/add.vue View File

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

+ 4
- 2
src/pages/system/cmsManager/bannerManager/edit.vue View File

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

+ 5
- 2
src/pages/system/cmsManager/bannerManager/index.vue View File

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

+ 6
- 4
src/pages/system/cmsManager/indexMsg/add.vue View File

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

+ 15
- 2
src/pages/system/cmsManager/indexMsg/index.vue View File

5
         <div class="flex-item flex-h">
5
         <div class="flex-item flex-h">
6
           <el-button size="mini" type="success" @click='addIndexMsg'>新增消息</el-button>
6
           <el-button size="mini" type="success" @click='addIndexMsg'>新增消息</el-button>
7
         </div>
7
         </div>
8
-        <tableSearch @exportSearchKey="searchList"></tableSearch>
8
+        <tableSearch value="请输入标题" @exportSearchKey="searchList"></tableSearch>
9
       </div>
9
       </div>
10
       <div class="moreFilter"></div>
10
       <div class="moreFilter"></div>
11
     </div>
11
     </div>
104
       })
104
       })
105
     },
105
     },
106
     searchList (key) { // 搜索列表
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
     addIndexMsg () {
122
     addIndexMsg () {
110
       this.$router.push({ name: 'addIndexMsg' })
123
       this.$router.push({ name: 'addIndexMsg' })

+ 5
- 5
src/pages/system/cmsManager/majorProjects/add.vue View File

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

+ 16
- 3
src/pages/system/cmsManager/majorProjects/edit.vue View File

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
 </script>
211
 </script>
199
 
212
 

+ 37
- 39
src/pages/system/cmsManager/majorProjects/index.vue View File

28
         stripe
28
         stripe
29
         style="width: 100%">
29
         style="width: 100%">
30
         <el-table-column
30
         <el-table-column
31
-          prop="name"
31
+          prop="Name"
32
           label="名称">
32
           label="名称">
33
         </el-table-column>
33
         </el-table-column>
34
         <el-table-column
34
         <el-table-column
35
-          prop="title"
35
+          prop="Title"
36
           label="标题">
36
           label="标题">
37
         </el-table-column>
37
         </el-table-column>
38
         <el-table-column
38
         <el-table-column
39
-          prop="caseName"
39
+          prop="CaseName"
40
           label="对应案场">
40
           label="对应案场">
41
         </el-table-column>
41
         </el-table-column>
42
         <el-table-column
42
         <el-table-column
43
-          prop="creatTime"
43
+          prop="CreateDate"
44
           label="创建时间">
44
           label="创建时间">
45
         </el-table-column>
45
         </el-table-column>
46
         <el-table-column label="操作" width="450">
46
         <el-table-column label="操作" width="450">
80
 
80
 
81
 <script>
81
 <script>
82
 import tableSearch from '@/components/tableSearch/index'
82
 import tableSearch from '@/components/tableSearch/index'
83
-import { mapState } from 'vuex'
83
+import { mapState, mapActions } from 'vuex'
84
 
84
 
85
 export default {
85
 export default {
86
   name: '',
86
   name: '',
95
         key: '', // 搜索关键字
95
         key: '', // 搜索关键字
96
         caseId: '', // 案场id
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
   computed: {
101
   computed: {
133
     tableSearch,
109
     tableSearch,
134
   },
110
   },
135
   created () {
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
   methods: {
117
   methods: {
118
+    ...mapActions(['updateSystemInfo']),
140
     handleCurrentChange (val) {
119
     handleCurrentChange (val) {
141
       this.postData.currentPage = val - 1
120
       this.postData.currentPage = val - 1
142
       this.getList()
121
       this.getList()
149
     },
128
     },
150
     editItem (index, row) { // 编辑
129
     editItem (index, row) { // 编辑
151
       console.log(index, row)
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
     copyItemUrl (index, row) { // 复制专题链接
133
     copyItemUrl (index, row) { // 复制专题链接
155
       console.log(index, row)
134
       console.log(index, row)
161
         cancelButtonText: '取消',
140
         cancelButtonText: '取消',
162
         type: 'warning'
141
         type: 'warning'
163
       }).then(() => {
142
       }).then(() => {
164
-        this.$message({
165
-          type: 'success',
166
-          message: '删除成功!'
167
-        })
143
+        this.deleteInfo(row.CmsCaseId)
168
       }).catch(() => {
144
       }).catch(() => {
169
         this.$message({
145
         this.$message({
170
           type: 'info',
146
           type: 'info',
183
         method: this.$api.cms.case.method,
159
         method: this.$api.cms.case.method,
184
         queryData: {
160
         queryData: {
185
           page: this.postData.currentPage,
161
           page: this.postData.currentPage,
186
-          pagesize: this.postData.pageSize
162
+          pagesize: this.postData.pageSize,
163
+          caseid: this.tableSearch.caseId
187
         }
164
         }
188
       }).then(res => {
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
       }).catch(msg => {
188
       }).catch(msg => {
191
 
189
 
192
       })
190
       })

+ 58
- 48
src/pages/system/cmsManager/newsManager/add.vue View File

6
           <span>跳转类型:</span>
6
           <span>跳转类型:</span>
7
           <div class="flex-item">
7
           <div class="flex-item">
8
             <div style="width:50%" class="radio">
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
             </div>
11
             </div>
12
           </div>
12
           </div>
13
         </li>
13
         </li>
17
             <div style="width:50%">
17
             <div style="width:50%">
18
               <el-input
18
               <el-input
19
                 placeholder="请输入连接"
19
                 placeholder="请输入连接"
20
-                v-model="postData.link"
20
+                v-model="postData.ForwardUrl"
21
                 clearable>
21
                 clearable>
22
               </el-input>
22
               </el-input>
23
             </div>
23
             </div>
27
           <span>是否发布:</span>
27
           <span>是否发布:</span>
28
           <div class="flex-item">
28
           <div class="flex-item">
29
             <div style="width:50%" class="radio">
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
             </div>
32
             </div>
33
           </div>
33
           </div>
34
         </li>
34
         </li>
36
           <span>图片位置:</span>
36
           <span>图片位置:</span>
37
           <div class="flex-item">
37
           <div class="flex-item">
38
             <div style="width:50%">
38
             <div style="width:50%">
39
-              <el-select v-model="postData.position" placeholder="请选择">
39
+              <el-select v-model="postData.LocationId" placeholder="请选择">
40
                 <el-option
40
                 <el-option
41
                   v-for="item in positionList"
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
                 </el-option>
45
                 </el-option>
46
               </el-select>
46
               </el-select>
47
             </div>
47
             </div>
48
           </div>
48
           </div>
49
         </li>
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
         <li class="flex-h">
50
         <li class="flex-h">
60
           <span>标题:</span>
51
           <span>标题:</span>
61
           <div class="flex-item">
52
           <div class="flex-item">
62
             <div style="width:50%">
53
             <div style="width:50%">
63
               <el-input
54
               <el-input
64
-                placeholder="请输入真实姓名"
65
-                v-model="postData.realName"
55
+                placeholder="请输入标题"
56
+                v-model="postData.Title"
66
                 clearable>
57
                 clearable>
67
               </el-input>
58
               </el-input>
68
             </div>
59
             </div>
71
         <li class="flex-h">
62
         <li class="flex-h">
72
           <span>图片:</span>
63
           <span>图片:</span>
73
           <div class="flex-item">
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
           </div>
73
           </div>
82
         </li>
74
         </li>
83
         <li style="text-align:center">
75
         <li style="text-align:center">
90
 </template>
82
 </template>
91
 
83
 
92
 <script>
84
 <script>
85
+import { mapState } from 'vuex'
93
 export default {
86
 export default {
94
   name: '',
87
   name: '',
95
   data () {
88
   data () {
96
     return {
89
     return {
97
       postData: {
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
   components: {},
103
   components: {},
104
+  computed: {
105
+    ...mapState({
106
+      positionList: x => x.cms.location,
107
+      OrgId: x => x.app.user.OrgId,
108
+    })
109
+  },
120
   methods: {
110
   methods: {
121
     submit () {
111
     submit () {
122
       console.log(this.postData)
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
     cancel () {
131
     cancel () {
125
       this.$router.go(-1)
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
 </script>
140
 </script>
131
 
141
 

+ 67
- 45
src/pages/system/cmsManager/newsManager/index.vue View File

5
         <div class="flex-item flex-h">
5
         <div class="flex-item flex-h">
6
           <el-button size="mini" type="success" @click='addNews'>新增资讯</el-button>
6
           <el-button size="mini" type="success" @click='addNews'>新增资讯</el-button>
7
         </div>
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
         <tableSearch @exportSearchKey="searchList"></tableSearch>
21
         <tableSearch @exportSearchKey="searchList"></tableSearch>
9
       </div>
22
       </div>
10
       <div class="moreFilter"></div>
23
       <div class="moreFilter"></div>
17
         <el-table-column
30
         <el-table-column
18
           prop="img"
31
           prop="img"
19
           label="图片">
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
         </el-table-column>
38
         </el-table-column>
21
         <el-table-column
39
         <el-table-column
22
-          prop="title"
40
+          prop="Title"
23
           label="标题">
41
           label="标题">
24
         </el-table-column>
42
         </el-table-column>
25
         <el-table-column
43
         <el-table-column
26
-          prop="position"
44
+          prop="LocationShow"
27
           label="位置">
45
           label="位置">
28
         </el-table-column>
46
         </el-table-column>
29
         <el-table-column
47
         <el-table-column
30
-          prop="isShow"
48
+          prop="StatusShow"
31
           label="是否发布">
49
           label="是否发布">
32
         </el-table-column>
50
         </el-table-column>
33
-        <el-table-column
34
-          prop="toIndex"
35
-          label="推荐至首页">
36
-        </el-table-column>
37
         <el-table-column label="操作">
51
         <el-table-column label="操作">
38
           <template slot-scope="scope">
52
           <template slot-scope="scope">
39
             <el-button
53
             <el-button
49
       </el-table>
63
       </el-table>
50
     </div>
64
     </div>
51
     <el-pagination
65
     <el-pagination
52
-      @size-change="handleSizeChange"
53
       @current-change="handleCurrentChange"
66
       @current-change="handleCurrentChange"
54
-      :current-page.sync="currentPage"
67
+      :current-page.sync="postData.currentPage"
55
       :page-size="10"
68
       :page-size="10"
56
       layout="prev, pager, next, jumper"
69
       layout="prev, pager, next, jumper"
57
       :total="100">
70
       :total="100">
61
 
74
 
62
 <script>
75
 <script>
63
 import tableSearch from '@/components/tableSearch/index'
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
 export default {
79
 export default {
69
   name: '',
80
   name: '',
70
   data () {
81
   data () {
71
     return {
82
     return {
72
-      currentPage: 0, // 当前页码
83
+      postData: {
84
+        currentPage: 1, // 当前页码
85
+        pageSize: 10,
86
+        total: 0,
87
+      },
73
       tableSearch: { // 表格搜索条件
88
       tableSearch: { // 表格搜索条件
74
         key: '', // 搜索关键字
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
   computed: {
95
   computed: {
105
-    ...mapCaseState({
106
-      caseList: x => x.caseList,
96
+    ...mapState({
97
+      positionList: x => x.cms.location,
107
     })
98
     })
108
   },
99
   },
109
   components: {
100
   components: {
110
     tableSearch,
101
     tableSearch,
111
   },
102
   },
103
+  created () {
104
+    this.updateLocationInfo().then(() => {
105
+      this.getList()
106
+    })
107
+  },
112
   methods: {
108
   methods: {
113
-    handleSizeChange (val) {
114
-      console.log(`每页 ${val} 条`)
115
-    },
109
+    ...mapCmsActions(['updateLocationInfo']),
116
     handleCurrentChange (val) {
110
     handleCurrentChange (val) {
117
       console.log(`当前页: ${val}`)
111
       console.log(`当前页: ${val}`)
118
     },
112
     },
143
     },
137
     },
144
     addNews () {
138
     addNews () {
145
       this.$router.push({ name: 'addNews' })
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 View File

11
   },
11
   },
12
   actions: {
12
   actions: {
13
     updateLocationInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
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
           context.commit('init', res)
18
           context.commit('init', res)
19
+          resolve()
19
         })
20
         })
21
+      })
20
     }
22
     }
21
   }
23
   }
22
 }
24
 }

+ 21
- 1
src/util/api.js View File

151
       method: 'put',
151
       method: 'put',
152
       url: `${baseUrl}/common/cms/info/:id`
152
       url: `${baseUrl}/common/cms/info/:id`
153
     },
153
     },
154
-    deleteInfo: { // 编辑首页消息
154
+    deleteInfo: { // 删除首页消息
155
       method: 'delete',
155
       method: 'delete',
156
       url: `${baseUrl}/common/cms/info/:id`
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
   file: {
179
   file: {

+ 25
- 0
src/util/util.js View File

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