| 1 |
- {"remainingRequest":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/thread-loader/dist/cjs.js!/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/babel-loader/lib/index.js!/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/cache-loader/dist/cjs.js??ref--0-0!/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/vue-loader/lib/index.js??vue-loader-options!/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/src/view/system-config/bannerManage.vue?vue&type=script&lang=js&","dependencies":[{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/src/view/system-config/bannerManage.vue","mtime":1618306924000},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/cache-loader/dist/cjs.js","mtime":1665684022107},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/thread-loader/dist/cjs.js","mtime":1665684003955},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/babel-loader/lib/index.js","mtime":1665684010704},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/cache-loader/dist/cjs.js","mtime":1665684022107},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/vue-loader/lib/index.js","mtime":1665684006084}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport axios from '@/libs/api.request';\nexport default {\n name: 'banner',\n\n data() {\n return {\n addBanner: false,\n editBanner: false,\n formAdd: {\n title: '',\n sort: '',\n img: ''\n },\n formEdit: {\n title: '',\n sort: '',\n img: ''\n },\n bannerUrl: this.$config.baseUrl.pro,\n columns: [{\n title: '排序',\n key: 'sort',\n width: 150\n }, {\n title: '图片',\n key: 'img',\n align: 'center',\n render: (h, params) => {\n return h('div', {\n style: {\n \"width\": '80px',\n \"height\": '80px',\n padding: '5px'\n }\n }, [h('img', {\n attrs: {\n src: this.bannerUrl + params.row.img\n },\n style: {\n \"max-width\": '100%',\n \"max-height\": '100%'\n }\n })]);\n }\n }, {\n title: '标题',\n key: 'title'\n }, {\n title: '操作',\n minWidth: 200,\n key: 'action',\n align: 'center',\n render: (h, params) => {\n let btnArr = [];\n btnArr.push(h('Button', {\n props: {\n size: 'small',\n type: 'primary'\n },\n style: {\n marginTop: '5px',\n marginBottom: '5px',\n marginRight: '5px'\n },\n on: {\n click: () => {\n let _this = this;\n\n _this.editBanner = true;\n _this.formEdit.id = params.row.id;\n _this.formEdit.title = params.row.title;\n _this.formEdit.img = params.row.img;\n _this.formEdit.sort = params.row.sort;\n }\n },\n directives: [{\n name: 'opcode',\n value: 'admins/system/slider/update'\n }]\n }, '编辑'));\n btnArr.push(h('Button', {\n props: {\n size: 'small',\n type: 'error'\n },\n style: {\n marginTop: '5px',\n marginBottom: '5px',\n marginRight: '5px'\n },\n on: {\n click: () => {\n let _this = this;\n\n this.$Modal.confirm({\n title: '确定删除该条数据吗?',\n content: '',\n loading: true,\n onOk: () => {\n _this.delBanner(params.row.id);\n }\n });\n }\n },\n directives: [{\n name: 'opcode',\n value: 'admins/system/slider/del'\n }]\n }, '删除'));\n return h('div', btnArr);\n }\n }],\n tableData: []\n };\n },\n\n created() {\n this.getBanner();\n },\n\n methods: {\n addBtn() {\n if (this.tableData.length >= 5) {\n this.$Message.warning('最多只能添加5个轮播图');\n return;\n }\n\n this.addBanner = true;\n },\n\n cancel() {\n this.formAdd.title = '';\n this.formAdd.sort = '';\n this.formAdd.img = '';\n this.formAdd.url = '';\n this.$refs.imgupload.fileList = [];\n },\n\n uploadBannerSuccess(res, file) {\n if (res.code == 'success') {\n this.$set(this.formAdd, 'img', res.data.url);\n this.$refs.imgupload.fileList = [];\n } else {\n this.$Message.error(res.message);\n }\n },\n\n uploadBannerSuccessEdit(res, file) {\n if (res.code == 'success') {\n this.$set(this.formEdit, 'img', res.data.url);\n this.$refs.imguploadEdit.fileList = [];\n } else {\n this.$Message.error(res.message);\n }\n },\n\n handleImgBefore(res) {\n this.$refs.imgupload.fileList = [];\n },\n\n handleImgBeforeEdit(res) {\n this.$refs.imguploadEdit.fileList = [];\n },\n\n saveBanner() {\n let _this = this;\n\n if (!_this.formAdd.sort) {\n _this.$Message.error('请输入排序!');\n\n return;\n }\n\n if (!_this.formAdd.img) {\n _this.$Message.error('请上传图片!');\n\n return;\n }\n\n axios.request({\n url: '/admins/system/slider/add',\n data: _this.formAdd,\n method: 'POST'\n }).then(res => {\n if (res.data.code === 'success') {\n _this.addBanner = false;\n\n _this.$Modal.remove();\n\n _this.$Message.success(res.data.message, 'middle');\n\n _this.getBanner();\n\n _this.cancel();\n } else {\n _this.$Message.error(res.data.message);\n }\n });\n },\n\n saveBannerEdit() {\n let _this = this;\n\n if (!_this.formEdit.sort) {\n _this.$Message.error('请输入排序!');\n\n return;\n }\n\n if (!_this.formEdit.img) {\n _this.$Message.error('请上传图片!');\n\n return;\n }\n\n axios.request({\n url: '/admins/system/slider/update',\n data: _this.formEdit,\n method: 'POST'\n }).then(res => {\n if (res.data.code === 'success') {\n _this.editBanner = false;\n\n _this.$Modal.remove();\n\n _this.$Message.success(res.data.message, 'middle');\n\n _this.getBanner();\n\n _this.formEdit.title = '';\n _this.formEdit.sort = '';\n _this.formEdit.img = '';\n _this.formEdit.url = '';\n _this.$refs.imguploadEdit.fileList = [];\n } else {\n _this.$Message.error(res.data.message);\n }\n });\n },\n\n getBanner() {\n let _this = this;\n\n axios.request({\n url: 'admins/system/slider/index',\n method: 'POST'\n }).then(res => {\n if (res.data.code === 'success') {\n _this.tableData = res.data.data;\n } else {\n _this.$Message.error(res.data.message);\n }\n });\n },\n\n delBanner(id) {\n let _this = this;\n\n axios.request({\n url: '/admins/system/slider/del',\n data: {\n id: id\n },\n method: 'POST'\n }).then(res => {\n if (res.data.code === 'success') {\n _this.$Modal.remove();\n\n _this.$Message.success(res.data.message, 'middle');\n\n _this.getBanner();\n } else {\n _this.$Message.error(res.data.message);\n }\n });\n }\n\n }\n};",null]}
|