管理端增加小程序跳转配置
Showing
4 changed files
with
261 additions
and
139 deletions
... | @@ -325,7 +325,8 @@ | ... | @@ -325,7 +325,8 @@ |
325 | "version": "1.0.0", | 325 | "version": "1.0.0", |
326 | "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz", | 326 | "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz", |
327 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", | 327 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", |
328 | "dev": true | 328 | "dev": true, |
329 | "optional": true | ||
329 | }, | 330 | }, |
330 | "assign-symbols": { | 331 | "assign-symbols": { |
331 | "version": "1.0.0", | 332 | "version": "1.0.0", |
... | @@ -1972,6 +1973,7 @@ | ... | @@ -1972,6 +1973,7 @@ |
1972 | "resolved": "http://registry.npm.taobao.org/combined-stream/download/combined-stream-1.0.7.tgz", | 1973 | "resolved": "http://registry.npm.taobao.org/combined-stream/download/combined-stream-1.0.7.tgz", |
1973 | "integrity": "sha1-LR0kMXr7ir6V1tLAsHtXgTU52Cg=", | 1974 | "integrity": "sha1-LR0kMXr7ir6V1tLAsHtXgTU52Cg=", |
1974 | "dev": true, | 1975 | "dev": true, |
1976 | "optional": true, | ||
1975 | "requires": { | 1977 | "requires": { |
1976 | "delayed-stream": "~1.0.0" | 1978 | "delayed-stream": "~1.0.0" |
1977 | } | 1979 | } |
... | @@ -2763,7 +2765,8 @@ | ... | @@ -2763,7 +2765,8 @@ |
2763 | "version": "1.0.0", | 2765 | "version": "1.0.0", |
2764 | "resolved": "http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz", | 2766 | "resolved": "http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz", |
2765 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", | 2767 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", |
2766 | "dev": true | 2768 | "dev": true, |
2769 | "optional": true | ||
2767 | }, | 2770 | }, |
2768 | "depd": { | 2771 | "depd": { |
2769 | "version": "1.1.2", | 2772 | "version": "1.1.2", |
... | @@ -3531,7 +3534,8 @@ | ... | @@ -3531,7 +3534,8 @@ |
3531 | "version": "1.3.0", | 3534 | "version": "1.3.0", |
3532 | "resolved": "http://registry.npm.taobao.org/extsprintf/download/extsprintf-1.3.0.tgz", | 3535 | "resolved": "http://registry.npm.taobao.org/extsprintf/download/extsprintf-1.3.0.tgz", |
3533 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", | 3536 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", |
3534 | "dev": true | 3537 | "dev": true, |
3538 | "optional": true | ||
3535 | }, | 3539 | }, |
3536 | "fast-deep-equal": { | 3540 | "fast-deep-equal": { |
3537 | "version": "1.1.0", | 3541 | "version": "1.1.0", |
... | @@ -3870,7 +3874,8 @@ | ... | @@ -3870,7 +3874,8 @@ |
3870 | "ansi-regex": { | 3874 | "ansi-regex": { |
3871 | "version": "2.1.1", | 3875 | "version": "2.1.1", |
3872 | "bundled": true, | 3876 | "bundled": true, |
3873 | "dev": true | 3877 | "dev": true, |
3878 | "optional": true | ||
3874 | }, | 3879 | }, |
3875 | "aproba": { | 3880 | "aproba": { |
3876 | "version": "1.2.0", | 3881 | "version": "1.2.0", |
... | @@ -3891,12 +3896,14 @@ | ... | @@ -3891,12 +3896,14 @@ |
3891 | "balanced-match": { | 3896 | "balanced-match": { |
3892 | "version": "1.0.0", | 3897 | "version": "1.0.0", |
3893 | "bundled": true, | 3898 | "bundled": true, |
3894 | "dev": true | 3899 | "dev": true, |
3900 | "optional": true | ||
3895 | }, | 3901 | }, |
3896 | "brace-expansion": { | 3902 | "brace-expansion": { |
3897 | "version": "1.1.11", | 3903 | "version": "1.1.11", |
3898 | "bundled": true, | 3904 | "bundled": true, |
3899 | "dev": true, | 3905 | "dev": true, |
3906 | "optional": true, | ||
3900 | "requires": { | 3907 | "requires": { |
3901 | "balanced-match": "^1.0.0", | 3908 | "balanced-match": "^1.0.0", |
3902 | "concat-map": "0.0.1" | 3909 | "concat-map": "0.0.1" |
... | @@ -3911,17 +3918,20 @@ | ... | @@ -3911,17 +3918,20 @@ |
3911 | "code-point-at": { | 3918 | "code-point-at": { |
3912 | "version": "1.1.0", | 3919 | "version": "1.1.0", |
3913 | "bundled": true, | 3920 | "bundled": true, |
3914 | "dev": true | 3921 | "dev": true, |
3922 | "optional": true | ||
3915 | }, | 3923 | }, |
3916 | "concat-map": { | 3924 | "concat-map": { |
3917 | "version": "0.0.1", | 3925 | "version": "0.0.1", |
3918 | "bundled": true, | 3926 | "bundled": true, |
3919 | "dev": true | 3927 | "dev": true, |
3928 | "optional": true | ||
3920 | }, | 3929 | }, |
3921 | "console-control-strings": { | 3930 | "console-control-strings": { |
3922 | "version": "1.1.0", | 3931 | "version": "1.1.0", |
3923 | "bundled": true, | 3932 | "bundled": true, |
3924 | "dev": true | 3933 | "dev": true, |
3934 | "optional": true | ||
3925 | }, | 3935 | }, |
3926 | "core-util-is": { | 3936 | "core-util-is": { |
3927 | "version": "1.0.2", | 3937 | "version": "1.0.2", |
... | @@ -4038,7 +4048,8 @@ | ... | @@ -4038,7 +4048,8 @@ |
4038 | "inherits": { | 4048 | "inherits": { |
4039 | "version": "2.0.3", | 4049 | "version": "2.0.3", |
4040 | "bundled": true, | 4050 | "bundled": true, |
4041 | "dev": true | 4051 | "dev": true, |
4052 | "optional": true | ||
4042 | }, | 4053 | }, |
4043 | "ini": { | 4054 | "ini": { |
4044 | "version": "1.3.5", | 4055 | "version": "1.3.5", |
... | @@ -4050,6 +4061,7 @@ | ... | @@ -4050,6 +4061,7 @@ |
4050 | "version": "1.0.0", | 4061 | "version": "1.0.0", |
4051 | "bundled": true, | 4062 | "bundled": true, |
4052 | "dev": true, | 4063 | "dev": true, |
4064 | "optional": true, | ||
4053 | "requires": { | 4065 | "requires": { |
4054 | "number-is-nan": "^1.0.0" | 4066 | "number-is-nan": "^1.0.0" |
4055 | } | 4067 | } |
... | @@ -4064,6 +4076,7 @@ | ... | @@ -4064,6 +4076,7 @@ |
4064 | "version": "3.0.4", | 4076 | "version": "3.0.4", |
4065 | "bundled": true, | 4077 | "bundled": true, |
4066 | "dev": true, | 4078 | "dev": true, |
4079 | "optional": true, | ||
4067 | "requires": { | 4080 | "requires": { |
4068 | "brace-expansion": "^1.1.7" | 4081 | "brace-expansion": "^1.1.7" |
4069 | } | 4082 | } |
... | @@ -4071,12 +4084,14 @@ | ... | @@ -4071,12 +4084,14 @@ |
4071 | "minimist": { | 4084 | "minimist": { |
4072 | "version": "0.0.8", | 4085 | "version": "0.0.8", |
4073 | "bundled": true, | 4086 | "bundled": true, |
4074 | "dev": true | 4087 | "dev": true, |
4088 | "optional": true | ||
4075 | }, | 4089 | }, |
4076 | "minipass": { | 4090 | "minipass": { |
4077 | "version": "2.2.4", | 4091 | "version": "2.2.4", |
4078 | "bundled": true, | 4092 | "bundled": true, |
4079 | "dev": true, | 4093 | "dev": true, |
4094 | "optional": true, | ||
4080 | "requires": { | 4095 | "requires": { |
4081 | "safe-buffer": "^5.1.1", | 4096 | "safe-buffer": "^5.1.1", |
4082 | "yallist": "^3.0.0" | 4097 | "yallist": "^3.0.0" |
... | @@ -4095,6 +4110,7 @@ | ... | @@ -4095,6 +4110,7 @@ |
4095 | "version": "0.5.1", | 4110 | "version": "0.5.1", |
4096 | "bundled": true, | 4111 | "bundled": true, |
4097 | "dev": true, | 4112 | "dev": true, |
4113 | "optional": true, | ||
4098 | "requires": { | 4114 | "requires": { |
4099 | "minimist": "0.0.8" | 4115 | "minimist": "0.0.8" |
4100 | } | 4116 | } |
... | @@ -4175,7 +4191,8 @@ | ... | @@ -4175,7 +4191,8 @@ |
4175 | "number-is-nan": { | 4191 | "number-is-nan": { |
4176 | "version": "1.0.1", | 4192 | "version": "1.0.1", |
4177 | "bundled": true, | 4193 | "bundled": true, |
4178 | "dev": true | 4194 | "dev": true, |
4195 | "optional": true | ||
4179 | }, | 4196 | }, |
4180 | "object-assign": { | 4197 | "object-assign": { |
4181 | "version": "4.1.1", | 4198 | "version": "4.1.1", |
... | @@ -4187,6 +4204,7 @@ | ... | @@ -4187,6 +4204,7 @@ |
4187 | "version": "1.4.0", | 4204 | "version": "1.4.0", |
4188 | "bundled": true, | 4205 | "bundled": true, |
4189 | "dev": true, | 4206 | "dev": true, |
4207 | "optional": true, | ||
4190 | "requires": { | 4208 | "requires": { |
4191 | "wrappy": "1" | 4209 | "wrappy": "1" |
4192 | } | 4210 | } |
... | @@ -4272,7 +4290,8 @@ | ... | @@ -4272,7 +4290,8 @@ |
4272 | "safe-buffer": { | 4290 | "safe-buffer": { |
4273 | "version": "5.1.1", | 4291 | "version": "5.1.1", |
4274 | "bundled": true, | 4292 | "bundled": true, |
4275 | "dev": true | 4293 | "dev": true, |
4294 | "optional": true | ||
4276 | }, | 4295 | }, |
4277 | "safer-buffer": { | 4296 | "safer-buffer": { |
4278 | "version": "2.1.2", | 4297 | "version": "2.1.2", |
... | @@ -4308,6 +4327,7 @@ | ... | @@ -4308,6 +4327,7 @@ |
4308 | "version": "1.0.2", | 4327 | "version": "1.0.2", |
4309 | "bundled": true, | 4328 | "bundled": true, |
4310 | "dev": true, | 4329 | "dev": true, |
4330 | "optional": true, | ||
4311 | "requires": { | 4331 | "requires": { |
4312 | "code-point-at": "^1.0.0", | 4332 | "code-point-at": "^1.0.0", |
4313 | "is-fullwidth-code-point": "^1.0.0", | 4333 | "is-fullwidth-code-point": "^1.0.0", |
... | @@ -4327,6 +4347,7 @@ | ... | @@ -4327,6 +4347,7 @@ |
4327 | "version": "3.0.1", | 4347 | "version": "3.0.1", |
4328 | "bundled": true, | 4348 | "bundled": true, |
4329 | "dev": true, | 4349 | "dev": true, |
4350 | "optional": true, | ||
4330 | "requires": { | 4351 | "requires": { |
4331 | "ansi-regex": "^2.0.0" | 4352 | "ansi-regex": "^2.0.0" |
4332 | } | 4353 | } |
... | @@ -4370,12 +4391,14 @@ | ... | @@ -4370,12 +4391,14 @@ |
4370 | "wrappy": { | 4391 | "wrappy": { |
4371 | "version": "1.0.2", | 4392 | "version": "1.0.2", |
4372 | "bundled": true, | 4393 | "bundled": true, |
4373 | "dev": true | 4394 | "dev": true, |
4395 | "optional": true | ||
4374 | }, | 4396 | }, |
4375 | "yallist": { | 4397 | "yallist": { |
4376 | "version": "3.0.2", | 4398 | "version": "3.0.2", |
4377 | "bundled": true, | 4399 | "bundled": true, |
4378 | "dev": true | 4400 | "dev": true, |
4401 | "optional": true | ||
4379 | } | 4402 | } |
4380 | } | 4403 | } |
4381 | }, | 4404 | }, |
... | @@ -5589,7 +5612,8 @@ | ... | @@ -5589,7 +5612,8 @@ |
5589 | "version": "0.1.1", | 5612 | "version": "0.1.1", |
5590 | "resolved": "http://registry.npm.taobao.org/jsbn/download/jsbn-0.1.1.tgz", | 5613 | "resolved": "http://registry.npm.taobao.org/jsbn/download/jsbn-0.1.1.tgz", |
5591 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", | 5614 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", |
5592 | "dev": true | 5615 | "dev": true, |
5616 | "optional": true | ||
5593 | }, | 5617 | }, |
5594 | "jsesc": { | 5618 | "jsesc": { |
5595 | "version": "1.3.0", | 5619 | "version": "1.3.0", |
... | @@ -10765,7 +10789,8 @@ | ... | @@ -10765,7 +10789,8 @@ |
10765 | "version": "0.14.5", | 10789 | "version": "0.14.5", |
10766 | "resolved": "http://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz", | 10790 | "resolved": "http://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz", |
10767 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", | 10791 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", |
10768 | "dev": true | 10792 | "dev": true, |
10793 | "optional": true | ||
10769 | }, | 10794 | }, |
10770 | "type-check": { | 10795 | "type-check": { |
10771 | "version": "0.3.2", | 10796 | "version": "0.3.2", | ... | ... |
... | @@ -189,3 +189,38 @@ export const dashboardExport = params => { | ... | @@ -189,3 +189,38 @@ export const dashboardExport = params => { |
189 | console.log("url:", url); | 189 | console.log("url:", url); |
190 | window.open(url) | 190 | window.open(url) |
191 | }; | 191 | }; |
192 | |||
193 | |||
194 | export const request = { | ||
195 | post(url, data) { | ||
196 | return axios.post(`${base}${url}`, data); | ||
197 | }, | ||
198 | get(url, data) { | ||
199 | return axios.get(`${base}${url}`, { params: data }); | ||
200 | }, | ||
201 | form(url, params) { | ||
202 | let formData = new FormData(); //使用formData对象 | ||
203 | for (let key in params) { | ||
204 | formData.append(key, params[key]); | ||
205 | } | ||
206 | let requestUrl = url.indexOf("://") >= 0 ? `${url}` : `${base}${url}`; | ||
207 | return axios.post(requestUrl, formData, formDataHeaders) | ||
208 | }, | ||
209 | build(url, params) { | ||
210 | let fullUrl = `${base}${url}`; | ||
211 | let split = ""; | ||
212 | for (let key in params) { | ||
213 | if (split) { | ||
214 | split = "&"; | ||
215 | } else { | ||
216 | split = "?" | ||
217 | } | ||
218 | fullUrl += split + key + "=" + params[key]; | ||
219 | } | ||
220 | return fullUrl; | ||
221 | }, | ||
222 | requestDomain() { | ||
223 | return `${base}` | ||
224 | } | ||
225 | /*test*/ | ||
226 | }; | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -27,6 +27,9 @@ | ... | @@ -27,6 +27,9 @@ |
27 | style="width: 100%;" | 27 | style="width: 100%;" |
28 | > | 28 | > |
29 | <el-table-column prop="title" label="标题"></el-table-column> | 29 | <el-table-column prop="title" label="标题"></el-table-column> |
30 | <el-table-column label="所属分类"> | ||
31 | <template slot-scope="scope">{{formatClassify(scope.row)}}</template> | ||
32 | </el-table-column> | ||
30 | <!-- <el-table-column prop="thumb" label="封面"></el-table-column> --> | 33 | <!-- <el-table-column prop="thumb" label="封面"></el-table-column> --> |
31 | <el-table-column label="封面图"> | 34 | <el-table-column label="封面图"> |
32 | <template slot-scope="scope"> | 35 | <template slot-scope="scope"> |
... | @@ -161,6 +164,7 @@ export default { | ... | @@ -161,6 +164,7 @@ export default { |
161 | classifyDialogList: [], | 164 | classifyDialogList: [], |
162 | tagList: [] | 165 | tagList: [] |
163 | }, | 166 | }, |
167 | classifyMap: {}, | ||
164 | listLoading: false, | 168 | listLoading: false, |
165 | editLoading: false, | 169 | editLoading: false, |
166 | editFormVisible: false, | 170 | editFormVisible: false, |
... | @@ -294,6 +298,9 @@ export default { | ... | @@ -294,6 +298,9 @@ export default { |
294 | this.$set(this.totalData, 'classifyDialogList', content) | 298 | this.$set(this.totalData, 'classifyDialogList', content) |
295 | //深复制 | 299 | //深复制 |
296 | let content2 = Object.assign([], content) | 300 | let content2 = Object.assign([], content) |
301 | content2.forEach(element => { | ||
302 | this.classifyMap[element.classify] = element.name; | ||
303 | }); | ||
297 | content2.unshift({ | 304 | content2.unshift({ |
298 | classify: '', | 305 | classify: '', |
299 | dispayType: '', | 306 | dispayType: '', |
... | @@ -330,6 +337,9 @@ export default { | ... | @@ -330,6 +337,9 @@ export default { |
330 | this.reqTagList() | 337 | this.reqTagList() |
331 | console.log('editForm:', this.editForm) | 338 | console.log('editForm:', this.editForm) |
332 | }, | 339 | }, |
340 | formatClassify(data) { | ||
341 | return this.classifyMap[data.classify]; | ||
342 | }, | ||
333 | deleteHandler(index, row) { | 343 | deleteHandler(index, row) { |
334 | let data = { | 344 | let data = { |
335 | articleCode: row.articleCode | 345 | articleCode: row.articleCode | ... | ... |
... | @@ -5,11 +5,7 @@ | ... | @@ -5,11 +5,7 @@ |
5 | <el-form> | 5 | <el-form> |
6 | <el-form-item> | 6 | <el-form-item> |
7 | <div class="tool-wrap fl"> | 7 | <div class="tool-wrap fl"> |
8 | <el-select | 8 | <el-select v-model="curClassify" placeholder="请选择" @change="HandleSelectChange"> |
9 | v-model="curClassify" | ||
10 | placeholder="请选择" | ||
11 | @change="HandleSelectChange" | ||
12 | > | ||
13 | <el-option | 9 | <el-option |
14 | v-for="(item,index) in totalData.classifyList" | 10 | v-for="(item,index) in totalData.classifyList" |
15 | :key="index" | 11 | :key="index" |
... | @@ -32,39 +28,39 @@ | ... | @@ -32,39 +28,39 @@ |
32 | > | 28 | > |
33 | <el-table-column label="缩略图"> | 29 | <el-table-column label="缩略图"> |
34 | <template slot-scope="scope"> | 30 | <template slot-scope="scope"> |
35 | <img class="poster" :src="scope.row.bannerPic" alt> | 31 | <img class="poster" :src="scope.row.bannerPic" alt /> |
32 | </template> | ||
33 | </el-table-column> | ||
34 | <el-table-column label="所属分类"> | ||
35 | <template slot-scope="scope">{{formatClassify(scope.row)}}</template> | ||
36 | </el-table-column> | ||
37 | <el-table-column label="跳转方式"> | ||
38 | <template slot-scope="scope">{{formatJumpType(scope.row)}}</template> | ||
39 | </el-table-column> | ||
40 | |||
41 | <el-table-column label="跳转路径" min-width="200px"> | ||
42 | <template slot-scope="scope"> | ||
43 | <div v-if="scope.row.linkType == 'minipro'">{{scope.row.miniproAppId}}</div> | ||
44 | <div>{{scope.row.link}}</div> | ||
36 | </template> | 45 | </template> |
37 | </el-table-column> | 46 | </el-table-column> |
38 | <el-table-column prop="link" label="跳转链接"></el-table-column> | ||
39 | 47 | ||
40 | <el-table-column label="操作" :width="curClassify ? 300 : 150"> | 48 | <el-table-column label="操作" :width="curClassify ? 300 : 150"> |
41 | <template slot-scope="scope"> | 49 | <template slot-scope="scope"> |
42 | <el-button | 50 | <el-button v-if="curClassify" size="small" @click="upHandler(scope.$index, scope.row)">上移</el-button> |
43 | v-if="curClassify" | ||
44 | size="small" | ||
45 | @click="upHandler(scope.$index, scope.row)" | ||
46 | >上移</el-button> | ||
47 | <el-button | 51 | <el-button |
48 | v-if="curClassify" | 52 | v-if="curClassify" |
49 | size="small" | 53 | size="small" |
50 | @click="downHandler(scope.$index, scope.row)" | 54 | @click="downHandler(scope.$index, scope.row)" |
51 | >下移</el-button> | 55 | >下移</el-button> |
52 | <el-button size="small" @click="modifyHandler(scope.$index, scope.row)">修改</el-button> | 56 | <el-button size="small" @click="modifyHandler(scope.$index, scope.row)">修改</el-button> |
53 | <el-button | 57 | <el-button size="small" type="danger" @click="deleteHandler(scope.$index, scope.row)">删除</el-button> |
54 | size="small" | ||
55 | type="danger" | ||
56 | @click="deleteHandler(scope.$index, scope.row)" | ||
57 | >删除</el-button> | ||
58 | </template> | 58 | </template> |
59 | </el-table-column> | 59 | </el-table-column> |
60 | </el-table> | 60 | </el-table> |
61 | 61 | ||
62 | <!--编辑界面--> | 62 | <!--编辑界面--> |
63 | <el-dialog | 63 | <el-dialog :title="dialogTitle" :visible.sync="editFormVisible" :close-on-click-modal="false"> |
64 | :title="dialogTitle" | ||
65 | :visible.sync="editFormVisible" | ||
66 | :close-on-click-modal="false" | ||
67 | > | ||
68 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | 64 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> |
69 | <el-form-item label="分类" prop="classify"> | 65 | <el-form-item label="分类" prop="classify"> |
70 | <el-select | 66 | <el-select |
... | @@ -86,12 +82,27 @@ | ... | @@ -86,12 +82,27 @@ |
86 | v-show="editForm.bannerPic" | 82 | v-show="editForm.bannerPic" |
87 | :src="editForm.bannerPic" | 83 | :src="editForm.bannerPic" |
88 | alt | 84 | alt |
89 | > | 85 | /> |
90 | <upload-item pid="p1" v-on:upload-success="onUploadSuccess"></upload-item> | 86 | <upload-item pid="p1" v-on:upload-success="onUploadSuccess"></upload-item> |
91 | <!-- <el-input v-model="editForm.pic"></el-input> --> | 87 | <!-- <el-input v-model="editForm.pic"></el-input> --> |
92 | </el-form-item> | 88 | </el-form-item> |
93 | 89 | ||
94 | <el-form-item label="跳转链接" prop="link"> | 90 | <el-form-item label="跳转类型" prop="linkType"> |
91 | <el-select v-model="editForm.linkType" placeholder="请选择"> | ||
92 | <el-option | ||
93 | v-for="(item,index) in jumpTypeList" | ||
94 | :key="index" | ||
95 | :label="item.label" | ||
96 | :value="item.value" | ||
97 | ></el-option> | ||
98 | </el-select> | ||
99 | </el-form-item> | ||
100 | |||
101 | <el-form-item label="小程序ID" prop="miniproAppId" v-if="editForm.linkType == 'minipro'"> | ||
102 | <el-input v-model="editForm.miniproAppId"></el-input> | ||
103 | </el-form-item> | ||
104 | |||
105 | <el-form-item label="跳转链接" prop="link" v-if="editForm.linkType != 'none'"> | ||
95 | <el-input v-model="editForm.link"></el-input> | 106 | <el-input v-model="editForm.link"></el-input> |
96 | </el-form-item> | 107 | </el-form-item> |
97 | </el-form> | 108 | </el-form> |
... | @@ -121,14 +132,15 @@ import { | ... | @@ -121,14 +132,15 @@ import { |
121 | getBannerList, | 132 | getBannerList, |
122 | saveBanner, | 133 | saveBanner, |
123 | deleteBanner, | 134 | deleteBanner, |
124 | changeBanner | 135 | changeBanner, |
125 | } from '../../api/api.js' | 136 | request |
126 | import UploadItem from '../../components/UploadItem' | 137 | } from "../../api/api.js"; |
138 | import UploadItem from "../../components/UploadItem"; | ||
127 | 139 | ||
128 | export default { | 140 | export default { |
129 | data() { | 141 | data() { |
130 | return { | 142 | return { |
131 | key: 'value', | 143 | key: "value", |
132 | page: 1, | 144 | page: 1, |
133 | pageSize: 10, | 145 | pageSize: 10, |
134 | total: 0, | 146 | total: 0, |
... | @@ -137,50 +149,74 @@ export default { | ... | @@ -137,50 +149,74 @@ export default { |
137 | classifyList: [], | 149 | classifyList: [], |
138 | classifyDialogList: [] | 150 | classifyDialogList: [] |
139 | }, | 151 | }, |
152 | classifyMap: {}, | ||
153 | jumpType: {}, | ||
154 | jumpTypeList: [ | ||
155 | { | ||
156 | label: "无跳转", | ||
157 | value: "none" | ||
158 | }, | ||
159 | { | ||
160 | label: "网页", | ||
161 | value: "web" | ||
162 | }, | ||
163 | { | ||
164 | label: "小程序", | ||
165 | value: "minipro" | ||
166 | } | ||
167 | ], | ||
140 | listLoading: false, | 168 | listLoading: false, |
141 | editLoading: false, | 169 | editLoading: false, |
142 | editFormVisible: false, | 170 | editFormVisible: false, |
143 | dialogTitle: '编辑', | 171 | dialogTitle: "编辑", |
144 | //编辑界面数据 | 172 | //编辑界面数据 |
145 | editForm: { | 173 | editForm: { |
146 | bannerPic: '', | 174 | bannerCode: "", |
147 | link: '', | 175 | bannerPic: "", |
148 | classify: '' | 176 | link: "", |
177 | classify: "", | ||
178 | linkType: "", | ||
179 | miniproAppId: "" | ||
149 | }, | 180 | }, |
150 | editFormRules: { | 181 | editFormRules: { |
151 | bannerPic: [ | 182 | bannerPic: [ |
152 | { | 183 | { |
153 | required: true, | 184 | required: true, |
154 | message: '请输入头图地址', | 185 | message: "请输入头图地址", |
155 | trigger: 'blur' | 186 | trigger: "blur" |
156 | } | 187 | } |
157 | ], | 188 | ], |
158 | link: [ | 189 | link: [ |
159 | { | 190 | { |
160 | required: true, | 191 | required: true, |
161 | message: '请输入跳转链接', | 192 | message: "请输入跳转链接", |
162 | trigger: 'blur' | 193 | trigger: "blur" |
163 | } | 194 | } |
164 | ], | 195 | ], |
165 | classify: [ | 196 | miniproAppId: [ |
166 | { required: true, message: '请选择分类', trigger: 'blur' } | 197 | { |
167 | ] | 198 | required: true, |
168 | }, | 199 | message: "请输入小程序ID", |
169 | curClassify: '' | 200 | trigger: "blur" |
170 | } | 201 | } |
202 | ], | ||
203 | classify: [{ required: true, message: "请选择分类", trigger: "blur" }] | ||
204 | }, | ||
205 | curClassify: "" | ||
206 | }; | ||
171 | }, | 207 | }, |
172 | computed: { | 208 | computed: { |
173 | pageNum() { | 209 | pageNum() { |
174 | return Math.ceil(this.total / this.pageSize) | 210 | return Math.ceil(this.total / this.pageSize); |
175 | } | 211 | } |
176 | }, | 212 | }, |
177 | methods: { | 213 | methods: { |
178 | name() {}, | 214 | name() {}, |
179 | onUploadSuccess(evtAny) { | 215 | onUploadSuccess(evtAny) { |
180 | let { pid, url } = evtAny | 216 | let { pid, url } = evtAny; |
181 | if (pid == 'p1') { | 217 | if (pid == "p1") { |
182 | this.$set(this.editForm, 'bannerPic', url) | 218 | this.$set(this.editForm, "bannerPic", url); |
183 | } else if (pid == 'v1') { | 219 | } else if (pid == "v1") { |
184 | // this.$set(this.editForm, 'vedioUrl', url) | 220 | // this.$set(this.editForm, 'vedioUrl', url) |
185 | } | 221 | } |
186 | }, | 222 | }, |
... | @@ -190,155 +226,172 @@ export default { | ... | @@ -190,155 +226,172 @@ export default { |
190 | page: this.page, | 226 | page: this.page, |
191 | size: this.pageSize, | 227 | size: this.pageSize, |
192 | classify: this.curClassify | 228 | classify: this.curClassify |
193 | } | 229 | }; |
194 | getBannerList(data).then(result => { | 230 | getBannerList(data).then(result => { |
195 | let { content, code } = result | 231 | let { content, code } = result; |
196 | let { list, total } = content | 232 | let { list, total } = content; |
197 | this.total = total | 233 | this.total = total; |
198 | this.$set(this.totalData, 'dataList', list) | 234 | this.$set(this.totalData, "dataList", list); |
199 | console.log('this.totalData:', this.totalData.dataList) | 235 | console.log("this.totalData:", this.totalData.dataList); |
200 | }) | 236 | }); |
201 | }, | 237 | }, |
202 | reqGetClassifyList() { | 238 | reqGetClassifyList() { |
203 | let data = {} | 239 | let data = {}; |
204 | getClassifyList(data) | 240 | getClassifyList(data) |
205 | .then(result => { | 241 | .then(result => { |
206 | let { content, code } = result | 242 | let { content, code } = result; |
207 | this.$set(this.totalData, 'classifyDialogList', content) | 243 | this.$set(this.totalData, "classifyDialogList", content); |
208 | //深复制 | 244 | //深复制 |
209 | let content2 = Object.assign([], content) | 245 | let content2 = Object.assign([], content); |
246 | content2.forEach(element => { | ||
247 | this.classifyMap[element.classify] = element.name; | ||
248 | }); | ||
210 | content2.unshift({ | 249 | content2.unshift({ |
211 | classify: '', | 250 | classify: "", |
212 | dispayType: '', | 251 | dispayType: "", |
213 | name: '全部' | 252 | name: "全部" |
214 | }) | 253 | }); |
215 | this.$set(this.totalData, 'classifyList', content2) | 254 | this.$set(this.totalData, "classifyList", content2); |
216 | this.reqQuery() | 255 | this.reqQuery(); |
217 | }) | 256 | }) |
218 | .catch(err => {}) | 257 | .catch(err => {}); |
219 | }, | 258 | }, |
220 | upHandler(index, row) { | 259 | upHandler(index, row) { |
221 | let lastItem = this.totalData.dataList[index - 1] | 260 | let lastItem = this.totalData.dataList[index - 1]; |
222 | let curItem = this.totalData.dataList[index] | 261 | let curItem = this.totalData.dataList[index]; |
223 | this.changeDataHandler(lastItem, curItem) | 262 | this.changeDataHandler(lastItem, curItem); |
224 | }, | 263 | }, |
225 | downHandler(index, row) { | 264 | downHandler(index, row) { |
226 | let lastItem = this.totalData.dataList[index + 1] | 265 | let lastItem = this.totalData.dataList[index + 1]; |
227 | let curItem = this.totalData.dataList[index] | 266 | let curItem = this.totalData.dataList[index]; |
228 | this.changeDataHandler(lastItem, curItem) | 267 | this.changeDataHandler(lastItem, curItem); |
229 | }, | 268 | }, |
230 | changeDataHandler(lastItem, curItem) { | 269 | changeDataHandler(lastItem, curItem) { |
231 | console.log('lastItem:', lastItem) | 270 | console.log("lastItem:", lastItem); |
232 | console.log('curItem:', curItem) | 271 | console.log("curItem:", curItem); |
233 | if (lastItem && curItem) { | 272 | if (lastItem && curItem) { |
234 | let data = { | 273 | let data = { |
235 | lbc: lastItem.bannerCode, | 274 | lbc: lastItem.bannerCode, |
236 | rbc: curItem.bannerCode | 275 | rbc: curItem.bannerCode |
237 | } | 276 | }; |
238 | changeBanner(data) | 277 | changeBanner(data) |
239 | .then(result => { | 278 | .then(result => { |
240 | this.$notify({ | 279 | this.$notify({ |
241 | title: '成功', | 280 | title: "成功", |
242 | message: '操作成功', | 281 | message: "操作成功", |
243 | type: 'success' | 282 | type: "success" |
244 | }) | 283 | }); |
245 | this.reqQuery() | 284 | this.reqQuery(); |
246 | }) | 285 | }) |
247 | .catch(err => {}) | 286 | .catch(err => {}); |
248 | } | 287 | } |
249 | }, | 288 | }, |
250 | 289 | ||
251 | // 修改 显示修改对话框 | 290 | // 修改 显示修改对话框 |
252 | modifyHandler(index, row) { | 291 | modifyHandler(index, row) { |
253 | this.dialogTitle = '修改' | 292 | this.dialogTitle = "修改"; |
254 | this.editFormVisible = true | 293 | this.editFormVisible = true; |
255 | try { | 294 | try { |
256 | this.$refs['editForm'].resetFields() | 295 | this.$refs["editForm"].resetFields(); |
257 | } catch (error) {} | 296 | } catch (error) {} |
258 | this.editForm = Object.assign({}, row) | 297 | this.editForm = Object.assign({}, row); |
259 | }, | 298 | }, |
260 | deleteHandler(index, row) { | 299 | deleteHandler(index, row) { |
261 | let data = { | 300 | let data = { |
262 | bannerCode: row.bannerCode | 301 | bannerCode: row.bannerCode |
263 | } | 302 | }; |
264 | console.log('deleteHandler data:', data) | 303 | console.log("deleteHandler data:", data); |
265 | this.$confirm('确认删除吗?', '提示', {}).then(() => { | 304 | this.$confirm("确认删除吗?", "提示", {}).then(() => { |
266 | deleteBanner(data) | 305 | deleteBanner(data) |
267 | .then(result => { | 306 | .then(result => { |
268 | let { code, content } = result | 307 | let { code, content } = result; |
269 | if (code == 200) { | 308 | if (code == 200) { |
270 | this.$notify({ | 309 | this.$notify({ |
271 | title: '成功', | 310 | title: "成功", |
272 | message: '删除成功', | 311 | message: "删除成功", |
273 | type: 'success' | 312 | type: "success" |
274 | }) | 313 | }); |
275 | } else { | 314 | } else { |
276 | } | 315 | } |
277 | this.editFormVisible = false | 316 | this.editFormVisible = false; |
278 | this.reqQuery() | 317 | this.reqQuery(); |
279 | }) | ||
280 | .catch(err => {}) | ||
281 | }) | 318 | }) |
319 | .catch(err => {}); | ||
320 | }); | ||
282 | }, | 321 | }, |
283 | // 新增 | 322 | // 新增 |
284 | handleAdd() { | 323 | handleAdd() { |
285 | this.editForm = { | 324 | this.editForm = { |
286 | bannerCode: '', | 325 | bannerCode: "", |
287 | bannerPic: '', | 326 | bannerPic: "", |
288 | link: '', | 327 | link: "", |
289 | linkType: '', | 328 | linkType: "web", |
290 | classify: '' | 329 | classify: "", |
291 | } | 330 | miniproAppId : "" |
331 | }; | ||
292 | try { | 332 | try { |
293 | this.$refs['editForm'].resetFields() | 333 | this.$refs["editForm"].resetFields(); |
294 | } catch (error) {} | 334 | } catch (error) {} |
295 | this.editFormVisible = true | 335 | this.editFormVisible = true; |
296 | this.dialogTitle = '新增' | 336 | this.dialogTitle = "新增"; |
297 | }, | 337 | }, |
298 | // 提交 新增/修改 | 338 | // 提交 新增/修改 |
299 | editSubmit() { | 339 | editSubmit() { |
300 | let data = this.editForm | 340 | let data = this.editForm; |
301 | this.$refs.editForm.validate(valid => { | 341 | this.$refs.editForm.validate(valid => { |
302 | if (valid) { | 342 | if (valid) { |
303 | this.editLoading = true | 343 | this.editLoading = true; |
304 | saveBanner(data) | 344 | saveBanner(data) |
305 | .then(result => { | 345 | .then(result => { |
306 | let { code, content } = result | 346 | let { code, content } = result; |
307 | if (code == 200) { | 347 | if (code == 200) { |
308 | this.$notify({ | 348 | this.$notify({ |
309 | title: '成功', | 349 | title: "成功", |
310 | message: '提交成功', | 350 | message: "提交成功", |
311 | type: 'success' | 351 | type: "success" |
312 | }) | 352 | }); |
313 | } else { | 353 | } else { |
314 | } | 354 | } |
315 | this.editLoading = false | 355 | this.editLoading = false; |
316 | this.editFormVisible = false | 356 | this.editFormVisible = false; |
317 | this.reqQuery() | 357 | this.reqQuery(); |
318 | }) | 358 | }) |
319 | .catch(err => {}) | 359 | .catch(err => {}); |
320 | } | 360 | } |
321 | }) | 361 | }); |
322 | }, | 362 | }, |
323 | // 点击页数 | 363 | // 点击页数 |
324 | handleCurrentChange(val) { | 364 | handleCurrentChange(val) { |
325 | this.page = val | 365 | this.page = val; |
326 | this.reqQuery() | 366 | this.reqQuery(); |
327 | }, | 367 | }, |
328 | HandleSelectChange() { | 368 | HandleSelectChange() { |
329 | this.reqQuery() | 369 | this.reqQuery(); |
330 | }, | 370 | }, |
331 | // 编辑时选择分类 | 371 | // 编辑时选择分类 |
332 | HandleSelectDialogChange() {} | 372 | HandleSelectDialogChange() {}, |
373 | formatClassify(data) { | ||
374 | return this.classifyMap[data.classify]; | ||
375 | }, | ||
376 | formatJumpType(data) { | ||
377 | let type = this.jumpType[data.linkType]; | ||
378 | if (!type) { | ||
379 | type = this.jumpType["web"]; | ||
380 | } | ||
381 | return type; | ||
382 | } | ||
333 | }, | 383 | }, |
334 | 384 | ||
335 | created() { | 385 | created() { |
336 | this.reqGetClassifyList() | 386 | this.jumpTypeList.forEach(element => { |
387 | this.jumpType[element.value] = element.label; | ||
388 | }); | ||
389 | this.reqGetClassifyList(); | ||
337 | }, | 390 | }, |
338 | components: { | 391 | components: { |
339 | UploadItem | 392 | UploadItem |
340 | } | 393 | } |
341 | } | 394 | }; |
342 | </script> | 395 | </script> |
343 | 396 | ||
344 | <style lang="less" scoped> | 397 | <style lang="less" scoped> |
... | @@ -363,5 +416,4 @@ export default { | ... | @@ -363,5 +416,4 @@ export default { |
363 | display: flex; | 416 | display: flex; |
364 | justify-content: flex-end; | 417 | justify-content: flex-end; |
365 | } | 418 | } |
366 | |||
367 | </style> | 419 | </style> | ... | ... |
-
Please register or sign in to post a comment