b595f43dd19b22e54d8b880dfeb555cd.json 9.2 KB

1
  1. {"remainingRequest":"/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/systemNotice.vue?vue&type=script&lang=js&","dependencies":[{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/src/view/system-config/systemNotice.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\nimport axios from '@/libs/api.request'\nexport default {\n name: 'systemNotice',\n data () {\n return {\n btnLoading_pass: false,\n currentPage: 1,\n total: 0,\n showNoticeModal: false,\n eduModalTitle: 'addnew',\n // 查询条件\n pagenum: 10,\n // 新增数据对象\n addData: {\n title: '',\n content: '',\n province: '',\n city: '',\n district: ''\n },\n editPid: '',\n editCid: '',\n editDid: '',\n provinceList: [], // 省列表\n cityList: [], // 市列表\n districtList: [], // 区列表\n publishType: '1', // 发布对象\n addRule: {\n title: [{\n required: true,\n message: '请先填写公告标题',\n trigger: 'blur'\n }],\n content: [{\n required: true,\n message: '请先填写公告内容',\n trigger: 'blur'\n }],\n province: [{\n validator: (rule, value, callback) => {\n if (this.publishType == 1) {\n callback()\n } else {\n if (!value) {\n return callback(new Error('请选择省'))\n } else {\n callback()\n }\n }\n },\n trigger: 'blur'\n }],\n city: [{\n validator: (rule, value, callback) => {\n if (this.publishType == 1) {\n callback()\n } else {\n if (!value) {\n return callback(new Error('请选择市'))\n } else {\n callback()\n }\n }\n },\n trigger: 'blur'\n }],\n district: [{\n validator: (rule, value, callback) => {\n if (this.publishType == 1) {\n callback()\n } else {\n if (!value) {\n return callback(new Error('请选择市'))\n } else {\n callback()\n }\n }\n },\n trigger: 'blur'\n }]\n },\n columns: [\n {\n title: ' 排序',\n key: 'id'\n },\n {\n title: '标题',\n key: 'title'\n },\n {\n title: '更改时间',\n key: 'updated_at'\n },\n {\n title: '创建时间',\n key: 'created_at'\n },\n {\n title: '操作',\n key: 'action',\n align: 'center',\n render: (h, params) => {\n return h('div', [\n h('Button', {\n props: {\n size: 'small',\n type: 'primary'\n },\n style: {\n marginTop: '5px',\n marginBottom: '5px'\n },\n on: {\n click: () => {\n this.eduModalTitle = 'check'\n this.showNoticeModal = true\n // this.addData = params.row\n this.addData.title = params.row.title\n this.addData.content = params.row.content\n this.addData.province = params.row.province // 这里的赋值不会触发 省select的on-change,具体原因不只\n this.getCity() // 不对city 和 district,因为会查出相对应的 select的on-change,采用手动调用 getCity()的方式\n if (params.row.province) {\n this.editPid = params.row.province,\n this.editCid = params.row.city,\n this.editDid = params.row.district,\n // this.getProvince('check')\n this.publishType = '2'\n } else {\n this.publishType = '1'\n }\n }\n }\n }, '查看')\n ])\n }\n }\n ],\n tableData: []\n }\n },\n created () {\n this.getList()\n this.getProvince()\n },\n methods: {\n // 分页\n levelchangepage (res) {\n this.currentPage = res\n this.getList()\n },\n // 打开新增广告弹窗\n openNoticeModal () {\n this.eduModalTitle = 'addnew',\n this.publishType = '1',\n this.addData.title = ''\n this.addData.content = ''\n this.showNoticeModal = true\n },\n // 获取列表信息\n getList () {\n axios\n .request({\n method: 'POST',\n url: '/admins/system/notice',\n data: {\n page: this.currentPage\n }\n })\n .then(res => {\n if (res.data.code === 'success') {\n this.tableData = res.data.data.data\n this.total = res.data.data.total\n } else {\n this.$Message.error(res.data.message, 'middle')\n }\n })\n },\n // 新增促销活动\n saveAdd (name) {\n this.$refs[name].validate((valid) => {\n if (valid) {\n var that = this\n that.btnLoading_pass = true\n var addData = {\n title: this.addData.title,\n content: this.addData.content\n }\n if (this.publishType == 2) {\n addData['province'] = this.addData.province\n addData['city'] = this.addData.city\n addData['district'] = this.addData.district\n }\n axios.request({\n url: '/admins/system/notice/edit',\n data: addData,\n method: 'POST'\n }).then(res => {\n if (res.data.code === 'success') {\n that.showNoticeModal = false\n that.getList()\n }\n that.$Message.info(res.data.message)\n that.btnLoading_pass = false\n })\n } else {\n // this.$Message.error('Fail!');\n }\n })\n },\n getProvince () {\n \taxios.request({\n \t\tmethod: 'GET',\n \t\turl: '/admins/area/0'\n \t}).then((res) => {\n \t\tif (res.data.code === 'success') {\n \t\t\tthis.addData.province === '' && (this.addData.province = res.data.data.list[0].id)\n \t\t\tthis.provinceList = res.data.data.list\n this.getCity()\n \t\t} else {\n \t\t\tthis.$vux.toast.text(res.data.message, 'middle')\n \t\t}\n \t})\n },\n getCity () {\n \tvar id = this.addData.province\n this.editCid && (id = this.editCid)\n \taxios.request({\n \t\tmethod: 'GET',\n \t\turl: '/admins/area/' + id\n \t}).then((res) => {\n \t\tif (res.data.code === 'success') {\n \t\t\tthis.cityList = res.data.data.list\n \t\t\tif (this.editCid) {\n \t\t\t\tthis.addData.city = this.editCid\n \t\t\t\tthis.editCid = '' // 第一次赋值之后置空\n \t\t\t} else {\n \t\t\t\tthis.addData.city = res.data.data.list[0].id\n \t\t\t}\n this.getDistrict()\n \t\t} else {\n \t\t\tthis.$vux.toast.text(res.data.message, 'middle')\n \t\t}\n \t})\n },\n getDistrict () {\n var id = this.addData.province\n this.editDid && (id = this.editDid)\n console.log('getDistrict', this.addData.city)\n \taxios.request({\n \t\tmethod: 'GET',\n \t\turl: '/admins/area/' + this.addData.city\n \t}).then((res) => {\n \t\tif (res.data.code === 'success') {\n \t\t\tthis.districtList = res.data.data.list\n \t\t\tif (this.editDid) {\n \t\t\t\tthis.addData.district = this.editDid\n \t\t\t\tthis.editDid = '' // 第一次赋值之后置空\n \t\t\t} else {\n \t\t\t\tthis.addData.district = res.data.data.list[0].id\n \t\t\t}\n \t\t} else {\n \t\t\tthis.$vux.toast.text(res.data.message, 'middle')\n \t\t}\n \t})\n }\n }\n}\n",null]}