Browse Source

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/admin into dev

许成详 6 years ago
parent
commit
f6599695a2

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

63
           <span>图片:</span>
63
           <span>图片:</span>
64
           <div class="flex-item">
64
           <div class="flex-item">
65
             <el-upload
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>
66
+              :action="$api.file.image.url"
67
+              :limit='limit'
68
+              list-type="picture-card"
69
+              :file-list='imgsArr'
70
+              :on-success="handlePictureCardPreview"
71
+              :on-remove="handleRemove"
72
+              :on-exceed="exceed">
73
+              <i class="el-icon-plus"></i>
72
             </el-upload>
74
             </el-upload>
75
+            <el-dialog :visible.sync="dialogVisible">
76
+              <img width="100%" :src="imgs" alt="">
77
+            </el-dialog>
73
           </div>
78
           </div>
74
         </li>
79
         </li>
75
         <!-- <li class="flex-h">
80
         <!-- <li class="flex-h">
113
         Title: '',
118
         Title: '',
114
         OrgId: '',
119
         OrgId: '',
115
         CaseId: ''
120
         CaseId: ''
116
-      }
121
+      },
122
+      dialogVisible: false,
123
+      imgs: '',
124
+      imgsArr: [],
125
+      limit: 1
117
     }
126
     }
118
   },
127
   },
119
   components: {},
128
   components: {},
137
     submit () {
146
     submit () {
138
       this.postData.OrgId = this.OrgId
147
       this.postData.OrgId = this.OrgId
139
       this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
148
       this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
149
+      this.postData.ImageUrl = ''
150
+      for (let i = 0; i < this.imgsArr.length; i++) {
151
+        this.postData.ImageUrl += this.imgsArr[i].response.result.url + ','
152
+      }
153
+      if (this.postData.ImageUrl) {
154
+        this.postData.ImageUrl = this.postData.ImageUrl.substr(0, this.postData.ImageUrl.length - 1)
155
+      }
140
       this.$ajax(this.$api.cms.addImage.url, {
156
       this.$ajax(this.$api.cms.addImage.url, {
141
         method: this.$api.cms.addImage.method,
157
         method: this.$api.cms.addImage.method,
142
         data: this.postData
158
         data: this.postData
156
     cancel () {
172
     cancel () {
157
       this.$router.go(-1)
173
       this.$router.go(-1)
158
     },
174
     },
159
-    handleAvatarSuccess (res, file) {
160
-      this.postData.ImageUrl = res.result.url
175
+    handlePictureCardPreview (res, file, fileList) {
176
+      this.imgs = res.result.url
177
+      this.dialogVisible = true
178
+      this.imgsArr = fileList
179
+    },
180
+    handleRemove (file, fileList) {
181
+      this.imgsArr = fileList
182
+    },
183
+    exceed () {
184
+      this.$message({
185
+        message: '超过可传的图片上限',
186
+        type: 'info',
187
+        duration: 1000
188
+      })
161
     }
189
     }
162
   }
190
   }
163
 }
191
 }

+ 49
- 11
src/pages/system/cmsManager/bannerManager/edit.vue View File

63
           <span>图片:</span>
63
           <span>图片:</span>
64
           <div class="flex-item">
64
           <div class="flex-item">
65
             <el-upload
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>
66
+              :action="$api.file.image.url"
67
+              :limit='limit'
68
+              list-type="picture-card"
69
+              :file-list='imgsArr'
70
+              :on-success="handlePictureCardPreview"
71
+              :on-remove="handleRemove"
72
+              :on-exceed="exceed">
73
+              <i class="el-icon-plus"></i>
72
             </el-upload>
74
             </el-upload>
75
+            <el-dialog :visible.sync="dialogVisible">
76
+              <img width="100%" :src="imgs" alt="">
77
+            </el-dialog>
73
           </div>
78
           </div>
74
         </li>
79
         </li>
75
         <!-- <li class="flex-h">
80
         <!-- <li class="flex-h">
113
         Title: '',
118
         Title: '',
114
         OrgId: '',
119
         OrgId: '',
115
         CaseId: ''
120
         CaseId: ''
116
-      }
121
+      },
122
+      dialogVisible: false,
123
+      imgs: '',
124
+      imgsArr: [],
125
+      limit: 1
117
     }
126
     }
118
   },
127
   },
119
   components: {},
128
   components: {},
134
       this.postData.OrgId = this.OrgId
143
       this.postData.OrgId = this.OrgId
135
       this.postData.CaseId = this.CaseId
144
       this.postData.CaseId = this.CaseId
136
       this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
145
       this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
137
-      console.log(this.postData)
146
+      this.postData.ImageUrl = ''
147
+      for (let i = 0; i < this.imgsArr.length; i++) {
148
+        this.postData.ImageUrl += this.imgsArr[i].response.result.url + ','
149
+      }
150
+      if (this.postData.ImageUrl) {
151
+        this.postData.ImageUrl = this.postData.ImageUrl.substr(0, this.postData.ImageUrl.length - 1)
152
+      }
138
       this.$ajax(this.$api.cms.editImage.url, {
153
       this.$ajax(this.$api.cms.editImage.url, {
139
         method: this.$api.cms.editImage.method,
154
         method: this.$api.cms.editImage.method,
140
         data: this.postData,
155
         data: this.postData,
157
     cancel () {
172
     cancel () {
158
       this.$router.go(-1)
173
       this.$router.go(-1)
159
     },
174
     },
160
-    handleAvatarSuccess (res, file) {
161
-      this.postData.ImageUrl = res.result.url
162
-    },
163
     getDetail () {
175
     getDetail () {
164
       this.$ajax(this.$api.cms.imageDetail.url, {
176
       this.$ajax(this.$api.cms.imageDetail.url, {
165
         method: this.$api.cms.imageDetail.method,
177
         method: this.$api.cms.imageDetail.method,
170
         console.log(res)
182
         console.log(res)
171
         res.Status = res.Status + ''
183
         res.Status = res.Status + ''
172
         res.ForwardType === 'url' ? res.ForwardType = '1' : res.ForwardType = '0'
184
         res.ForwardType === 'url' ? res.ForwardType = '1' : res.ForwardType = '0'
185
+        let imgsArr = []
186
+        let item = {
187
+          url: res.ImageUrl,
188
+          response: {
189
+            result: {
190
+              url: res.ImageUrl
191
+            }
192
+          }
193
+        }
194
+        imgsArr.push(item)
195
+        this.imgsArr = imgsArr
173
         this.postData = res
196
         this.postData = res
174
       }).catch(msg => {
197
       }).catch(msg => {
175
 
198
 
176
       })
199
       })
200
+    },
201
+    handlePictureCardPreview (res, file, fileList) {
202
+      this.imgs = res.result.url
203
+      this.dialogVisible = true
204
+      this.imgsArr = fileList
205
+    },
206
+    handleRemove (file, fileList) {
207
+      this.imgsArr = fileList
208
+    },
209
+    exceed () {
210
+      this.$message({
211
+        message: '超过可传的图片上限',
212
+        type: 'info',
213
+        duration: 1000
214
+      })
177
     }
215
     }
178
   }
216
   }
179
 }
217
 }

+ 1
- 0
src/pages/system/cmsManager/bannerManager/index.vue View File

116
       this.$router.push({ name: 'addBanner' })
116
       this.$router.push({ name: 'addBanner' })
117
     },
117
     },
118
     getList () {
118
     getList () {
119
+      this.tableData = []
119
       this.$ajax(this.$api.cms.imageList.url, {
120
       this.$ajax(this.$api.cms.imageList.url, {
120
         method: this.$api.cms.imageList.method,
121
         method: this.$api.cms.imageList.method,
121
         queryData: {
122
         queryData: {

+ 1
- 1
src/pages/system/cmsManager/indexMsg/edit.vue View File

106
         data: this.postData
106
         data: this.postData
107
       }).then(res => {
107
       }).then(res => {
108
         this.$message({
108
         this.$message({
109
-          message: '添加成功',
109
+          message: '编辑成功',
110
           type: 'success',
110
           type: 'success',
111
           duration: 1000
111
           duration: 1000
112
         })
112
         })

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

104
       })
104
       })
105
     },
105
     },
106
     searchList (key) { // 搜索列表
106
     searchList (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
-      })
107
+      this.tableSearch.key = key
108
+      this.getList()
121
     },
109
     },
122
     addIndexMsg () {
110
     addIndexMsg () {
123
       this.$router.push({ name: 'addIndexMsg' })
111
       this.$router.push({ name: 'addIndexMsg' })
124
     },
112
     },
125
     getList () {
113
     getList () {
114
+      this.tableData = []
126
       this.$ajax(this.$api.cms.info.url, {
115
       this.$ajax(this.$api.cms.info.url, {
127
         method: this.$api.cms.info.method,
116
         method: this.$api.cms.info.method,
128
         queryData: {
117
         queryData: {
129
           page: this.postData.currentPage,
118
           page: this.postData.currentPage,
130
-          pagesize: this.postData.pageSize
119
+          pagesize: this.postData.pageSize,
120
+          title: this.tableSearch.key
131
         }
121
         }
132
       }).then(res => {
122
       }).then(res => {
133
         this.tableData = res.list
123
         this.tableData = res.list

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

48
               :action="$api.file.image.url"
48
               :action="$api.file.image.url"
49
               list-type="picture-card"
49
               list-type="picture-card"
50
               :on-success="handlePictureCardPreview"
50
               :on-success="handlePictureCardPreview"
51
+              :file-list='imgsArr'
51
               :on-remove="handleRemove">
52
               :on-remove="handleRemove">
52
               <i class="el-icon-plus"></i>
53
               <i class="el-icon-plus"></i>
53
             </el-upload>
54
             </el-upload>
62
             <el-upload
63
             <el-upload
63
               :action='$api.file.image.url'
64
               :action='$api.file.image.url'
64
               list-type="picture-card"
65
               list-type="picture-card"
66
+              :file-list='detailimgsArr'
65
               :on-success="handlePictureCardPreviewDetail"
67
               :on-success="handlePictureCardPreviewDetail"
66
               :on-remove="handleRemoveDetail">
68
               :on-remove="handleRemoveDetail">
67
               <i class="el-icon-plus"></i>
69
               <i class="el-icon-plus"></i>
89
           <span>是否前台展示:</span>
91
           <span>是否前台展示:</span>
90
           <div class="flex-item">
92
           <div class="flex-item">
91
             <div style="width:50%" class="radio">
93
             <div style="width:50%" class="radio">
92
-              <el-radio v-model="postData.IsAllCourse" label='1' >是</el-radio>
93
-              <el-radio v-model="postData.IsAllCourse" label='0' >否</el-radio>
94
+              <el-radio v-model="postData.Status" label='1' >是</el-radio>
95
+              <el-radio v-model="postData.Status" label='0' >否</el-radio>
94
             </div>
96
             </div>
95
           </div>
97
           </div>
96
         </li>
98
         </li>
114
         Name: '',
116
         Name: '',
115
         Title: '',
117
         Title: '',
116
         DetailContent: '',
118
         DetailContent: '',
117
-        IsAllCourse: '1',
119
+        Status: '1',
118
         imgs: '',
120
         imgs: '',
119
         detailimgs: '',
121
         detailimgs: '',
120
         courseids: ''
122
         courseids: ''
139
     ...mapActions(['updateSystemInfo']),
141
     ...mapActions(['updateSystemInfo']),
140
     submit () {
142
     submit () {
141
       this.postData.OrgId = this.OrgId
143
       this.postData.OrgId = this.OrgId
144
+      this.postData.imgs = ''
145
+      this.postData.detailimgs = ''
142
       for (let i = 0; i < this.imgsArr.length; i++) {
146
       for (let i = 0; i < this.imgsArr.length; i++) {
143
         this.postData.imgs += this.imgsArr[i].response.result.url + ','
147
         this.postData.imgs += this.imgsArr[i].response.result.url + ','
144
       }
148
       }
166
     cancel () {
170
     cancel () {
167
       this.$router.go(-1)
171
       this.$router.go(-1)
168
     },
172
     },
169
-    handlePictureCardPreview (res, file) {
173
+    handlePictureCardPreview (res, file, fileList) {
170
       this.imgs = res.result.url
174
       this.imgs = res.result.url
171
       this.dialogVisible = true
175
       this.dialogVisible = true
172
-      this.imgsArr.push(file)
176
+      this.imgsArr = fileList
173
     },
177
     },
174
-    handleRemove (file) {
175
-      for (let i = 0; i < this.imgsArr.length; i++) {
176
-        if (this.imgsArr[i].uid === file.uid) {
177
-          this.imgsArr.splice(i, 1)
178
-        }
179
-      }
178
+    handleRemove (file, fileList) {
179
+      this.imgsArr = fileList
180
     },
180
     },
181
-    handlePictureCardPreviewDetail (res, file) {
181
+    handlePictureCardPreviewDetail (res, file, fileList) {
182
       this.detailimgs = res.result.url
182
       this.detailimgs = res.result.url
183
       this.dialogVisibleDetail = true
183
       this.dialogVisibleDetail = true
184
-      this.detailimgsArr.push(file)
184
+      this.detailimgsArr = fileList
185
     },
185
     },
186
-    handleRemoveDetail (file) {
187
-      for (let i = 0; i < this.detailimgsArr.length; i++) {
188
-        if (this.detailimgsArr[i].uid === file.uid) {
189
-          this.detailimgsArr.splice(i, 1)
190
-        }
191
-      }
186
+    handleRemoveDetail (file, fileList) {
187
+      this.detailimgsArr = fileList
192
     }
188
     }
193
   },
189
   },
194
   created () {
190
   created () {

+ 57
- 25
src/pages/system/cmsManager/majorProjects/edit.vue View File

47
             <el-upload
47
             <el-upload
48
               :action="$api.file.image.url"
48
               :action="$api.file.image.url"
49
               list-type="picture-card"
49
               list-type="picture-card"
50
+              :file-list='imgsArr'
50
               :on-success="handlePictureCardPreview"
51
               :on-success="handlePictureCardPreview"
51
               :on-remove="handleRemove">
52
               :on-remove="handleRemove">
52
               <i class="el-icon-plus"></i>
53
               <i class="el-icon-plus"></i>
62
             <el-upload
63
             <el-upload
63
               :action='$api.file.image.url'
64
               :action='$api.file.image.url'
64
               list-type="picture-card"
65
               list-type="picture-card"
66
+              :file-list='detailimgsArr'
65
               :on-success="handlePictureCardPreviewDetail"
67
               :on-success="handlePictureCardPreviewDetail"
66
               :on-remove="handleRemoveDetail">
68
               :on-remove="handleRemoveDetail">
67
               <i class="el-icon-plus"></i>
69
               <i class="el-icon-plus"></i>
89
           <span>是否前台展示:</span>
91
           <span>是否前台展示:</span>
90
           <div class="flex-item">
92
           <div class="flex-item">
91
             <div style="width:50%" class="radio">
93
             <div style="width:50%" class="radio">
92
-              <el-radio v-model="postData.IsAllCourse" label='1' >是</el-radio>
93
-              <el-radio v-model="postData.IsAllCourse" label='0' >否</el-radio>
94
+              <el-radio v-model="postData.Status" label='1' >是</el-radio>
95
+              <el-radio v-model="postData.Status" label='0' >否</el-radio>
94
             </div>
96
             </div>
95
           </div>
97
           </div>
96
         </li>
98
         </li>
114
         Name: '',
116
         Name: '',
115
         Title: '',
117
         Title: '',
116
         DetailContent: '',
118
         DetailContent: '',
117
-        IsAllCourse: '1',
119
+        Status: '1',
118
         imgs: '',
120
         imgs: '',
119
         detailimgs: '',
121
         detailimgs: '',
120
         courseids: ''
122
         courseids: ''
138
   methods: {
140
   methods: {
139
     submit () {
141
     submit () {
140
       this.postData.OrgId = this.OrgId
142
       this.postData.OrgId = this.OrgId
143
+      this.postData.imgs = ''
144
+      this.postData.detailimgs = ''
141
       for (let i = 0; i < this.imgsArr.length; i++) {
145
       for (let i = 0; i < this.imgsArr.length; i++) {
142
         this.postData.imgs += this.imgsArr[i].response.result.url + ','
146
         this.postData.imgs += this.imgsArr[i].response.result.url + ','
143
       }
147
       }
144
-      this.postData.imgs = this.postData.imgs.substr(0, this.postData.imgs.length - 1)
148
+      if (this.postData.imgs) {
149
+        this.postData.imgs = this.postData.imgs.substr(0, this.postData.imgs.length - 1)
150
+      }
145
       for (let i = 0; i < this.detailimgsArr.length; i++) {
151
       for (let i = 0; i < this.detailimgsArr.length; i++) {
146
         this.postData.detailimgs += this.detailimgsArr[i].response.result.url + ','
152
         this.postData.detailimgs += this.detailimgsArr[i].response.result.url + ','
147
       }
153
       }
148
-      this.postData.detailimgs = this.postData.detailimgs.substr(0, this.postData.detailimgs.length - 1)
149
-      this.$ajax(this.$api.cms.addCase.url, {
150
-        method: this.$api.cms.addCase.method,
154
+      if (this.postData.detailimgs) {
155
+        this.postData.detailimgs = this.postData.detailimgs.substr(0, this.postData.detailimgs.length - 1)
156
+      }
157
+      console.log(this.postData)
158
+      this.$ajax(this.$api.cms.editCase.url, {
159
+        method: this.$api.cms.editCase.method,
160
+        urlData: {
161
+          id: this.$route.query.id
162
+        },
151
         data: this.postData
163
         data: this.postData
152
       }).then(res => {
164
       }).then(res => {
153
         this.$message({
165
         this.$message({
154
-          message: '添加成功',
166
+          message: '编辑成功',
155
           type: 'success',
167
           type: 'success',
156
           duration: 1000
168
           duration: 1000
157
         })
169
         })
165
     cancel () {
177
     cancel () {
166
       this.$router.go(-1)
178
       this.$router.go(-1)
167
     },
179
     },
168
-    handlePictureCardPreview (res, file) {
180
+    handlePictureCardPreview (res, file, fileList) {
169
       this.imgs = res.result.url
181
       this.imgs = res.result.url
170
       this.dialogVisible = true
182
       this.dialogVisible = true
171
-      this.imgsArr.push(file)
183
+      this.imgsArr = fileList
184
+      console.log(this.imgsArr)
172
     },
185
     },
173
-    handleRemove (file) {
174
-      for (let i = 0; i < this.imgsArr.length; i++) {
175
-        if (this.imgsArr[i].uid === file.uid) {
176
-          this.imgsArr.splice(i, 1)
177
-        }
178
-      }
186
+    handleRemove (file, fileList) {
187
+      this.imgsArr = fileList
179
     },
188
     },
180
-    handlePictureCardPreviewDetail (res, file) {
189
+    handlePictureCardPreviewDetail (res, file, fileList) {
181
       this.detailimgs = res.result.url
190
       this.detailimgs = res.result.url
182
       this.dialogVisibleDetail = true
191
       this.dialogVisibleDetail = true
183
-      this.detailimgsArr.push(file)
192
+      this.detailimgsArr = fileList
184
     },
193
     },
185
-    handleRemoveDetail (file) {
186
-      for (let i = 0; i < this.detailimgsArr.length; i++) {
187
-        if (this.detailimgsArr[i].uid === file.uid) {
188
-          this.detailimgsArr.splice(i, 1)
189
-        }
190
-      }
194
+    handleRemoveDetail (file, fileList) {
195
+      this.detailimgsArr = fileList
191
     },
196
     },
192
     getDetail () {
197
     getDetail () {
193
       this.$ajax(this.$api.cms.caseDetail.url, {
198
       this.$ajax(this.$api.cms.caseDetail.url, {
197
         }
202
         }
198
       }).then(res => {
203
       }).then(res => {
199
         console.log(res)
204
         console.log(res)
200
-        res.IsAllCourse += ''
205
+        res.Status += ''
206
+        let imgsArr = []
207
+        let detailimgsArr = []
208
+        for (let i = 0; i < res.CmsCaseImgs.length; i++) {
209
+          if (res.CmsCaseImgs[i].ImageType === 'cover') {
210
+            let item = {
211
+              url: res.CmsCaseImgs[i].CaseImageUrl,
212
+              response: {
213
+                result: {
214
+                  url: res.CmsCaseImgs[i].CaseImageUrl
215
+                }
216
+              }
217
+            }
218
+            imgsArr.push(item)
219
+          } else if (res.CmsCaseImgs[i].ImageType === 'detail') {
220
+            let item = {
221
+              url: res.CmsCaseImgs[i].CaseImageUrl,
222
+              response: {
223
+                result: {
224
+                  url: res.CmsCaseImgs[i].CaseImageUrl
225
+                }
226
+              }
227
+            }
228
+            detailimgsArr.push(item)
229
+          }
230
+        }
231
+        this.imgsArr = imgsArr
232
+        this.detailimgsArr = detailimgsArr
201
         this.postData = res
233
         this.postData = res
202
       }).catch(msg => {
234
       }).catch(msg => {
203
 
235
 

+ 34
- 18
src/pages/system/cmsManager/majorProjects/index.vue View File

45
         </el-table-column>
45
         </el-table-column>
46
         <el-table-column label="操作" width="450">
46
         <el-table-column label="操作" width="450">
47
           <template slot-scope="scope">
47
           <template slot-scope="scope">
48
-            <el-button v-if="!scope.row.isShow"
48
+            <el-button
49
               size="mini"
49
               size="mini"
50
               type="primary"
50
               type="primary"
51
-              @click="showItem(scope.$index, scope.row)">前台展示</el-button>
52
-            <el-button v-if="scope.row.isShow"
53
-              size="mini"
54
-              type="danger"
55
-              @click="cancelShowItem(scope.$index, scope.row)">取消前台展示</el-button>
51
+              @click="showItem(scope.$index, scope.row)"><span v-if="scope.row.Status === 1">取消前台展示</span><span v-if="scope.row.Status === 0">前台展示</span></el-button>
56
             <el-button
52
             <el-button
57
               size="mini"
53
               size="mini"
58
               type="warning"
54
               type="warning"
59
               @click="editItem(scope.$index, scope.row)">编辑</el-button>
55
               @click="editItem(scope.$index, scope.row)">编辑</el-button>
60
-            <el-button
56
+            <!-- <el-button
61
               size="mini"
57
               size="mini"
62
-              @click="copyItemUrl(scope.$index, scope.row)">复制专题链接</el-button>
58
+              @click="copyItemUrl(scope.$index, scope.row)">复制专题链接</el-button> -->
63
             <el-button
59
             <el-button
64
               size="mini"
60
               size="mini"
65
               type="danger"
61
               type="danger"
121
       this.getList()
117
       this.getList()
122
     },
118
     },
123
     showItem (index, row) { // 前台显示
119
     showItem (index, row) { // 前台显示
124
-      console.log(index, row)
125
-    },
126
-    cancelShowItem (index, row) { // 取消前台显示
127
-      console.log(index, row)
120
+      this.editIsAllCourse(row)
128
     },
121
     },
129
     editItem (index, row) { // 编辑
122
     editItem (index, row) { // 编辑
130
       console.log(index, row)
123
       console.log(index, row)
131
       this.$router.push({ name: 'editIndexCase', query: { id: row.CmsCaseId } })
124
       this.$router.push({ name: 'editIndexCase', query: { id: row.CmsCaseId } })
132
     },
125
     },
133
-    copyItemUrl (index, row) { // 复制专题链接
134
-      console.log(index, row)
135
-    },
126
+    // copyItemUrl (index, row) { // 复制专题链接
127
+    //   console.log(index, row)
128
+    //   window.clipboardData.setData('Text', row.Title)
129
+    // },
136
     deleteItem (index, row) { // 删除
130
     deleteItem (index, row) { // 删除
137
       console.log(index, row)
131
       console.log(index, row)
138
       this.$confirm('确认删除此项目专题?', '提示', {
132
       this.$confirm('确认删除此项目专题?', '提示', {
149
       })
143
       })
150
     },
144
     },
151
     searchList (key) { // 搜索列表
145
     searchList (key) { // 搜索列表
152
-      console.log(key)
146
+      this.tableSearch.key = key
147
+      this.getList()
153
     },
148
     },
154
     addMajorProjects () {
149
     addMajorProjects () {
155
       this.$router.push({ name: 'addIndexCase' })
150
       this.$router.push({ name: 'addIndexCase' })
156
     },
151
     },
157
     getList () {
152
     getList () {
153
+      this.tableData = []
158
       this.$ajax(this.$api.cms.case.url, {
154
       this.$ajax(this.$api.cms.case.url, {
159
         method: this.$api.cms.case.method,
155
         method: this.$api.cms.case.method,
160
         queryData: {
156
         queryData: {
161
           page: this.postData.currentPage,
157
           page: this.postData.currentPage,
162
           pagesize: this.postData.pageSize,
158
           pagesize: this.postData.pageSize,
163
-          caseid: this.tableSearch.caseId
159
+          caseid: this.tableSearch.caseId,
160
+          name: this.tableSearch.key
164
         }
161
         }
165
       }).then(res => {
162
       }).then(res => {
166
         for (let i = 0; i < res.list.length; i++) {
163
         for (let i = 0; i < res.list.length; i++) {
188
       }).catch(msg => {
185
       }).catch(msg => {
189
 
186
 
190
       })
187
       })
191
-    }
188
+    },
189
+    editIsAllCourse (data) {
190
+      console.log(data)
191
+      let api = data.Status === 1 ? this.$api.cms.caseHide : this.$api.cms.caseShow
192
+      this.$ajax(api.url, {
193
+        method: api.method,
194
+        urlData: {
195
+          id: data.CmsCaseId
196
+        }
197
+      }).then(res => {
198
+        this.$message({
199
+          message: '编辑成功',
200
+          type: 'success',
201
+          duration: 1000
202
+        })
203
+        this.getList()
204
+      }).catch(msg => {
205
+
206
+      })
207
+    },
192
   }
208
   }
193
 }
209
 }
194
 </script>
210
 </script>

+ 51
- 14
src/pages/system/cmsManager/newsManager/add.vue View File

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.LocationId" placeholder="请选择">
39
+              <el-select v-model="postData.LocationIds" multiple placeholder="请选择">
40
                 <el-option
40
                 <el-option
41
                   v-for="item in positionList"
41
                   v-for="item in positionList"
42
                   :key="item.LocationId"
42
                   :key="item.LocationId"
63
           <span>图片:</span>
63
           <span>图片:</span>
64
           <div class="flex-item">
64
           <div class="flex-item">
65
             <el-upload
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>
66
+              :action="$api.file.image.url"
67
+              :limit='limit'
68
+              list-type="picture-card"
69
+              :file-list='imgsArr'
70
+              :on-success="handlePictureCardPreview"
71
+              :on-remove="handleRemove"
72
+              :on-exceed="exceed">
73
+              <i class="el-icon-plus"></i>
72
             </el-upload>
74
             </el-upload>
75
+            <el-dialog :visible.sync="dialogVisible">
76
+              <img width="100%" :src="imgs" alt="">
77
+            </el-dialog>
73
           </div>
78
           </div>
74
         </li>
79
         </li>
75
         <li style="text-align:center">
80
         <li style="text-align:center">
82
 </template>
87
 </template>
83
 
88
 
84
 <script>
89
 <script>
85
-import { mapState } from 'vuex'
90
+import { mapState, mapActions, createNamespacedHelpers } from 'vuex'
91
+const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
86
 export default {
92
 export default {
87
   name: '',
93
   name: '',
88
   data () {
94
   data () {
92
         ForwardUrl: '',
98
         ForwardUrl: '',
93
         ForwardResourceId: '',
99
         ForwardResourceId: '',
94
         Status: '1',
100
         Status: '1',
95
-        LocationIds: '1',
101
+        LocationIds: [],
96
         ImageUrl: '',
102
         ImageUrl: '',
97
         Title: '',
103
         Title: '',
98
         OrgId: '',
104
         OrgId: '',
99
         CaseId: ''
105
         CaseId: ''
100
-      }
106
+      },
107
+      dialogVisible: false,
108
+      imgs: '',
109
+      imgsArr: [],
110
+      limit: 1
101
     }
111
     }
102
   },
112
   },
103
   components: {},
113
   components: {},
114
+  created () {
115
+    this.updateSystemInfo().then(() => {
116
+      this.postData.OrgId = this.OrgId
117
+      this.postData.CaseId = this.CaseId
118
+    })
119
+  },
104
   computed: {
120
   computed: {
105
     ...mapState({
121
     ...mapState({
106
       positionList: x => x.cms.location,
122
       positionList: x => x.cms.location,
107
       OrgId: x => x.app.user.OrgId,
123
       OrgId: x => x.app.user.OrgId,
124
+      CaseId: x => x.app.cases.default,
108
     })
125
     })
109
   },
126
   },
110
   methods: {
127
   methods: {
128
+    ...mapActions(['updateSystemInfo']),
129
+    ...mapCmsActions(['updateLocationInfo']),
111
     submit () {
130
     submit () {
112
       console.log(this.postData)
131
       console.log(this.postData)
113
-      this.postData.OrgId = this.OrgId
114
       this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
132
       this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
133
+      this.postData.locationids = this.postData.LocationIds.join(',')
134
+      this.postData.ImageUrl = ''
135
+      for (let i = 0; i < this.imgsArr.length; i++) {
136
+        this.postData.ImageUrl += this.imgsArr[i].response.result.url + ','
137
+      }
138
+      if (this.postData.ImageUrl) {
139
+        this.postData.ImageUrl = this.postData.ImageUrl.substr(0, this.postData.ImageUrl.length - 1)
140
+      }
115
       this.$ajax(this.$api.cms.addNews.url, {
141
       this.$ajax(this.$api.cms.addNews.url, {
116
         method: this.$api.cms.addNews.method,
142
         method: this.$api.cms.addNews.method,
117
         data: this.postData
143
         data: this.postData
131
     cancel () {
157
     cancel () {
132
       this.$router.go(-1)
158
       this.$router.go(-1)
133
     },
159
     },
134
-    handleAvatarSuccess (res, file) {
135
-      console.log(res)
136
-      this.postData.ImageUrl = res.result.url
160
+    handlePictureCardPreview (res, file, fileList) {
161
+      this.imgs = res.result.url
162
+      this.dialogVisible = true
163
+      this.imgsArr = fileList
164
+    },
165
+    handleRemove (file, fileList) {
166
+      this.imgsArr = fileList
167
+    },
168
+    exceed () {
169
+      this.$message({
170
+        message: '超过可传的图片上限',
171
+        type: 'info',
172
+        duration: 1000
173
+      })
137
     }
174
     }
138
   }
175
   }
139
 }
176
 }

+ 124
- 47
src/pages/system/cmsManager/newsManager/edit.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.LocationIds" multiple 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
+              :action="$api.file.image.url"
67
+              :limit='limit'
68
+              list-type="picture-card"
69
+              :file-list='imgsArr'
70
+              :on-success="handlePictureCardPreview"
71
+              :on-remove="handleRemove"
72
+              :on-exceed="exceed">
73
+              <i class="el-icon-plus"></i>
74
+            </el-upload>
75
+            <el-dialog :visible.sync="dialogVisible">
76
+              <img width="100%" :src="imgs" alt="">
77
+            </el-dialog>
81
           </div>
78
           </div>
82
         </li>
79
         </li>
83
         <li style="text-align:center">
80
         <li style="text-align:center">
90
 </template>
87
 </template>
91
 
88
 
92
 <script>
89
 <script>
90
+import { mapState, createNamespacedHelpers } from 'vuex'
91
+const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
93
 export default {
92
 export default {
94
   name: '',
93
   name: '',
95
   data () {
94
   data () {
96
     return {
95
     return {
97
       postData: {
96
       postData: {
98
-        jumpType: '0',
99
-        link: '',
100
-        release: '0',
101
-        position: '',
102
-        index: '0'
97
+        ForwardType: '1',
98
+        ForwardUrl: '',
99
+        ForwardResourceId: '',
100
+        Status: '1',
101
+        LocationIds: [],
102
+        ImageUrl: '',
103
+        Title: '',
104
+        OrgId: '',
105
+        CaseId: ''
103
       },
106
       },
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
-      }],
107
+      dialogVisible: false,
108
+      imgs: '',
109
+      imgsArr: [],
110
+      limit: 1
117
     }
111
     }
118
   },
112
   },
119
   components: {},
113
   components: {},
114
+  created () {
115
+    this.updateLocationInfo().then(() => {
116
+      this.getDetail()
117
+    })
118
+  },
119
+  computed: {
120
+    ...mapState({
121
+      positionList: x => x.cms.location
122
+    })
123
+  },
120
   methods: {
124
   methods: {
125
+    ...mapCmsActions(['updateLocationInfo']),
121
     submit () {
126
     submit () {
122
       console.log(this.postData)
127
       console.log(this.postData)
128
+      this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'
129
+      this.postData.locationids = this.postData.LocationIds.join(',')
130
+      this.postData.ImageUrl = ''
131
+      for (let i = 0; i < this.imgsArr.length; i++) {
132
+        this.postData.ImageUrl += this.imgsArr[i].response.result.url + ','
133
+      }
134
+      if (this.postData.ImageUrl) {
135
+        this.postData.ImageUrl = this.postData.ImageUrl.substr(0, this.postData.ImageUrl.length - 1)
136
+      }
137
+      this.$ajax(this.$api.cms.editNews.url, {
138
+        method: this.$api.cms.editNews.method,
139
+        urlData: {
140
+          id: this.$route.query.id
141
+        },
142
+        data: this.postData
143
+      }).then(res => {
144
+        this.$message({
145
+          message: '编辑成功',
146
+          type: 'success',
147
+          duration: 1000
148
+        })
149
+        setTimeout(() => {
150
+          this.$router.push({ name: 'newsManager' })
151
+        }, 1000)
152
+      }).catch(msg => {
153
+
154
+      })
123
     },
155
     },
124
     cancel () {
156
     cancel () {
125
       this.$router.go(-1)
157
       this.$router.go(-1)
158
+    },
159
+    handlePictureCardPreview (res, file, fileList) {
160
+      this.imgs = res.result.url
161
+      this.dialogVisible = true
162
+      this.imgsArr = fileList
163
+    },
164
+    handleRemove (file, fileList) {
165
+      this.imgsArr = fileList
166
+    },
167
+    exceed () {
168
+      this.$message({
169
+        message: '超过可传的图片上限',
170
+        type: 'info',
171
+        duration: 1000
172
+      })
173
+    },
174
+    getDetail () {
175
+      this.$ajax(this.$api.cms.newsDetail.url, {
176
+        method: this.$api.cms.newsDetail.method,
177
+        urlData: {
178
+          id: this.$route.query.id
179
+        }
180
+      }).then(res => {
181
+        res.ForwardType === 'url' ? res.ForwardType = '1' : res.ForwardType = '0'
182
+        res.Status += ''
183
+        res.LocationIds = res.NewsLocations.reduce((previousValue, currentValue, index, array) => {
184
+          console.log(previousValue)
185
+          previousValue.push(currentValue.LocationId)
186
+          return previousValue
187
+        }, [])
188
+        console.log(res.LocationIds)
189
+        let imgsArr = []
190
+        let item = {
191
+          url: res.ImageUrl,
192
+          response: {
193
+            result: {
194
+              url: res.ImageUrl
195
+            }
196
+          }
197
+        }
198
+        imgsArr.push(item)
199
+        this.imgsArr = imgsArr
200
+        this.postData = res
201
+      }).catch(msg => {
202
+
203
+      })
126
     }
204
     }
127
-  },
128
-  mounted () { }
205
+  }
129
 }
206
 }
130
 </script>
207
 </script>
131
 
208
 

+ 26
- 19
src/pages/system/cmsManager/newsManager/index.vue View File

41
           label="标题">
41
           label="标题">
42
         </el-table-column>
42
         </el-table-column>
43
         <el-table-column
43
         <el-table-column
44
-          prop="LocationShow"
44
+          prop="LocationNames"
45
           label="位置">
45
           label="位置">
46
         </el-table-column>
46
         </el-table-column>
47
         <el-table-column
47
         <el-table-column
65
     <el-pagination
65
     <el-pagination
66
       @current-change="handleCurrentChange"
66
       @current-change="handleCurrentChange"
67
       :current-page.sync="postData.currentPage"
67
       :current-page.sync="postData.currentPage"
68
-      :page-size="10"
68
+      :page-size="postData.pageSize"
69
       layout="prev, pager, next, jumper"
69
       layout="prev, pager, next, jumper"
70
-      :total="100">
70
+      :total="postData.total">
71
     </el-pagination>
71
     </el-pagination>
72
   </div>
72
   </div>
73
 </template>
73
 </template>
112
     },
112
     },
113
     handleEdit (index, row) { // 编辑
113
     handleEdit (index, row) { // 编辑
114
       console.log(index, row)
114
       console.log(index, row)
115
-      this.$router.push({ name: 'editNews' })
115
+      this.$router.push({ name: 'editNews', query: { id: row.NewsId } })
116
     },
116
     },
117
     handleDelete (index, row) { // 删除
117
     handleDelete (index, row) { // 删除
118
       console.log(index, row)
118
       console.log(index, row)
121
         cancelButtonText: '取消',
121
         cancelButtonText: '取消',
122
         type: 'warning'
122
         type: 'warning'
123
       }).then(() => {
123
       }).then(() => {
124
-        this.$message({
125
-          type: 'success',
126
-          message: '删除成功!'
127
-        })
124
+        this.deleteNews(row.NewsId)
128
       }).catch(() => {
125
       }).catch(() => {
129
         this.$message({
126
         this.$message({
130
           type: 'info',
127
           type: 'info',
133
       })
130
       })
134
     },
131
     },
135
     searchList (key) { // 搜索列表
132
     searchList (key) { // 搜索列表
136
-      console.log(key)
133
+      this.tableSearch.key = key
134
+      this.getList()
137
     },
135
     },
138
     addNews () {
136
     addNews () {
139
       this.$router.push({ name: 'addNews' })
137
       this.$router.push({ name: 'addNews' })
140
     },
138
     },
141
     getList () {
139
     getList () {
140
+      this.tableData = []
142
       this.$ajax(this.$api.cms.news.url, {
141
       this.$ajax(this.$api.cms.news.url, {
143
         method: this.$api.cms.news.method,
142
         method: this.$api.cms.news.method,
144
         queryData: {
143
         queryData: {
145
           page: this.postData.currentPage,
144
           page: this.postData.currentPage,
146
           pagesize: this.postData.pageSize,
145
           pagesize: this.postData.pageSize,
147
-          locationid: this.tableSearch.LocationId
146
+          locationid: this.tableSearch.LocationId,
147
+          title: this.tableSearch.key
148
         }
148
         }
149
       }).then(res => {
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++) {
150
         for (let i = 0; i < res.list.length; i++) {
154
           res.list[i].Status === 1 ? res.list[i].StatusShow = '是' : res.list[i].StatusShow = '否'
151
           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
         }
152
         }
161
-        console.log(res.list)
162
         this.tableData = res.list
153
         this.tableData = res.list
163
         this.postData.total = res.pagenum
154
         this.postData.total = res.pagenum
164
         this.postData.currentPage = res.page
155
         this.postData.currentPage = res.page
165
       }).catch(msg => {
156
       }).catch(msg => {
166
 
157
 
158
+      })
159
+    },
160
+    deleteNews (id) {
161
+      this.$ajax(this.$api.cms.deleteNews.url, {
162
+        method: this.$api.cms.deleteNews.method,
163
+        urlData: {
164
+          id: id
165
+        }
166
+      }).then(res => {
167
+        this.$message({
168
+          type: 'success',
169
+          message: '删除成功!'
170
+        })
171
+        this.getList()
172
+      }).catch(msg => {
173
+
167
       })
174
       })
168
     }
175
     }
169
   }
176
   }

+ 13
- 5
src/util/api.js View File

280
       method: 'delete',
280
       method: 'delete',
281
       url: `${baseUrl}${common}/cms/info/:id`
281
       url: `${baseUrl}${common}/cms/info/:id`
282
     },
282
     },
283
-    news: { // 咨列表
283
+    news: { // 咨列表
284
       method: 'get',
284
       method: 'get',
285
       url: `${baseUrl}${common}/cms/news`
285
       url: `${baseUrl}${common}/cms/news`
286
     },
286
     },
287
-    newsDetail: { // 咨详情
287
+    newsDetail: { // 咨详情
288
       method: 'get',
288
       method: 'get',
289
       url: `${baseUrl}${common}/cms/news/:id`
289
       url: `${baseUrl}${common}/cms/news/:id`
290
     },
290
     },
291
-    addNews: { // 新增咨
291
+    addNews: { // 新增咨
292
       method: 'post',
292
       method: 'post',
293
       url: `${baseUrl}${common}/cms/news`
293
       url: `${baseUrl}${common}/cms/news`
294
     },
294
     },
295
-    editNews: { // 编辑咨
295
+    editNews: { // 编辑咨
296
       method: 'put',
296
       method: 'put',
297
       url: `${baseUrl}${common}/cms/news/:id`
297
       url: `${baseUrl}${common}/cms/news/:id`
298
     },
298
     },
299
-    deleteNews: { // 删除咨
299
+    deleteNews: { // 删除咨
300
       method: 'delete',
300
       method: 'delete',
301
       url: `${baseUrl}${common}/cms/news/:id`
301
       url: `${baseUrl}${common}/cms/news/:id`
302
+    },
303
+    caseShow: { // 前台展示
304
+      method: 'put',
305
+      url: `${baseUrl}${common}/cms/caseshow/:id`
306
+    },
307
+    caseHide: { // 取消前台展示
308
+      method: 'put',
309
+      url: `${baseUrl}${common}/cms/casehide/:id`
302
     }
310
     }
303
   },
311
   },
304
   file: {
312
   file: {