forked from zhurui/management
1 line
17 KiB
JSON
1 line
17 KiB
JSON
{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\sys\\news-add-or-update.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\sys\\news-add-or-update.vue","mtime":1614735254000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"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//\nimport Cookies from 'js-cookie';\nimport debounce from 'lodash/debounce';\nimport 'quill/dist/quill.snow.css';\nimport Quill from 'quill';\nexport default {\n data: function data() {\n return {\n visible: false,\n quillEditor: null,\n quillEditorToolbarOptions: [['bold', 'italic', 'underline', 'strike'], ['blockquote', 'code-block', 'image'], [{\n 'header': 1\n }, {\n 'header': 2\n }], [{\n 'list': 'ordered'\n }, {\n 'list': 'bullet'\n }], [{\n 'script': 'sub'\n }, {\n 'script': 'super'\n }], [{\n 'indent': '-1'\n }, {\n 'indent': '+1'\n }], [{\n 'direction': 'rtl'\n }], [{\n 'size': ['small', false, 'large', 'huge']\n }], [{\n 'header': [1, 2, 3, 4, 5, 6, false]\n }], [{\n 'color': []\n }, {\n 'background': []\n }], [{\n 'font': []\n }], [{\n 'align': []\n }], ['clean']],\n uploadUrl: '',\n dataForm: {\n id: '',\n title: '',\n content: '',\n pubDate: ''\n }\n };\n },\n computed: {\n dataRule: function dataRule() {\n var _this = this;\n\n var validateContent = function validateContent(rule, value, callback) {\n if (_this.quillEditor.getLength() <= 1) {\n return callback(new Error(_this.$t('validate.required')));\n }\n\n callback();\n };\n\n return {\n title: [{\n required: true,\n message: this.$t('validate.required'),\n trigger: 'blur'\n }],\n content: [{\n required: true,\n message: this.$t('validate.required'),\n trigger: 'blur'\n }, {\n validator: validateContent,\n trigger: 'blur'\n }],\n pubDate: [{\n required: true,\n message: this.$t('validate.required'),\n trigger: 'blur'\n }]\n };\n }\n },\n methods: {\n init: function init() {\n var _this2 = this;\n\n this.visible = true;\n this.$nextTick(function () {\n if (_this2.quillEditor) {\n _this2.quillEditor.deleteText(0, _this2.quillEditor.getLength());\n } else {\n _this2.quillEditorHandle();\n }\n\n _this2.$refs['dataForm'].resetFields();\n\n if (_this2.dataForm.id) {\n _this2.getInfo();\n }\n });\n },\n // 富文本编辑器\n quillEditorHandle: function quillEditorHandle() {\n var _this3 = this;\n\n this.quillEditor = new Quill('#J_quillEditor', {\n modules: {\n toolbar: this.quillEditorToolbarOptions\n },\n theme: 'snow'\n }); // 自定义上传图片功能 (使用element upload组件)\n\n this.uploadUrl = \"\".concat(window.SITE_CONFIG['apiURL'], \"/sys/oss/upload?access_token=\").concat(Cookies.get('access_token'));\n this.quillEditor.getModule('toolbar').addHandler('image', function () {\n _this3.$refs.uploadBtn.$el.click();\n }); // 监听内容变化,动态赋值\n\n this.quillEditor.on('text-change', function () {\n _this3.dataForm.content = _this3.quillEditor.root.innerHTML;\n });\n },\n // 上传图片之前\n uploadBeforeUploadHandle: function uploadBeforeUploadHandle(file) {\n if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {\n this.$message.error('只支持jpg、png、gif格式的图片!');\n return false;\n }\n },\n // 上传图片成功\n uploadSuccessHandle: function uploadSuccessHandle(res, file, fileList) {\n if (res.code !== 0) {\n return this.$message.error(res.msg);\n }\n\n this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.src);\n },\n // 获取信息\n getInfo: function getInfo() {\n var _this4 = this;\n\n this.$http.get(\"/sys/news/\".concat(this.dataForm.id)).then(function (_ref) {\n var res = _ref.data;\n\n if (res.code !== 0) {\n return _this4.$message.error(res.msg);\n }\n\n _this4.dataForm = res.data;\n _this4.quillEditor.root.innerHTML = _this4.dataForm.content;\n }).catch(function () {});\n },\n // 表单提交\n dataFormSubmitHandle: debounce(function () {\n var _this5 = this;\n\n this.$refs['dataForm'].validate(function (valid) {\n if (!valid) {\n return false;\n }\n\n _this5.$http[!_this5.dataForm.id ? 'post' : 'put']('/sys/news', _this5.dataForm, {\n headers: {\n 'content-type': 'application/x-www-form-urlencoded'\n }\n }).then(function (_ref2) {\n var res = _ref2.data;\n\n if (res.code !== 0) {\n return _this5.$message.error(res.msg);\n }\n\n _this5.$message({\n message: _this5.$t('prompt.success'),\n type: 'success',\n duration: 500,\n onClose: function onClose() {\n _this5.visible = false;\n\n _this5.$emit('refreshDataList');\n }\n });\n }).catch(function () {});\n });\n }, 1000, {\n 'leading': true,\n 'trailing': false\n })\n }\n};",{"version":3,"sources":["news-add-or-update.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,OAAA,OAAA,MAAA,WAAA;AACA,OAAA,QAAA,MAAA,iBAAA;AACA,OAAA,2BAAA;AACA,OAAA,KAAA,MAAA,OAAA;AACA,eAAA;AACA,EAAA,IADA,kBACA;AACA,WAAA;AACA,MAAA,OAAA,EAAA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A,MAAA,CAAA,OAAA,GAAA,KAAA;;AACA,cAAA,MAAA,CAAA,KAAA,CAAA,iBAAA;AACA;AAPA,WAAA;AASA,SAjBA,EAiBA,KAjBA,CAiBA,YAAA,CAAA,CAjBA;AAkBA,OAtBA;AAuBA,KAxBA,EAwBA,IAxBA,EAwBA;AAAA,iBAAA,IAAA;AAAA,kBAAA;AAAA,KAxBA;AA1DA;AAnDA,CAAA","sourcesContent":["<template>\n <el-dialog :visible.sync=\"visible\" :title=\"!dataForm.id ? $t('add') : $t('update')\" :close-on-click-modal=\"false\" :close-on-press-escape=\"false\">\n <el-form :model=\"dataForm\" :rules=\"dataRule\" ref=\"dataForm\" @keyup.enter.native=\"dataFormSubmitHandle()\" label-width=\"120px\">\n <el-form-item prop=\"title\" :label=\"$t('news.title')\">\n <el-input v-model=\"dataForm.title\" :placeholder=\"$t('news.title')\"></el-input>\n </el-form-item>\n <el-form-item prop=\"content\" :label=\"$t('news.content')\">\n <!-- 富文本编辑器, 容器 -->\n <div id=\"J_quillEditor\"></div>\n <!-- 自定义上传图片功能 (使用element upload组件) -->\n <el-upload\n :action=\"uploadUrl\"\n :show-file-list=\"false\"\n :before-upload=\"uploadBeforeUploadHandle\"\n :on-success=\"uploadSuccessHandle\"\n style=\"display: none;\">\n <el-button ref=\"uploadBtn\" type=\"primary\" size=\"small\">{{ $t('upload.button') }}</el-button>\n </el-upload>\n </el-form-item>\n <el-form-item prop=\"pubDate\" :label=\"$t('news.pubDate')\">\n <el-date-picker v-model=\"dataForm.pubDate\" type=\"datetime\" value-format=\"yyyy-MM-dd HH:mm:ss\" :placeholder=\"$t('news.pubDate')\"></el-date-picker>\n </el-form-item>\n </el-form>\n <template slot=\"footer\">\n <el-button @click=\"visible = false\">{{ $t('cancel') }}</el-button>\n <el-button type=\"primary\" @click=\"dataFormSubmitHandle()\">{{ $t('confirm') }}</el-button>\n </template>\n </el-dialog>\n</template>\n\n<script>\nimport Cookies from 'js-cookie'\nimport debounce from 'lodash/debounce'\nimport 'quill/dist/quill.snow.css'\nimport Quill from 'quill'\nexport default {\n data () {\n return {\n visible: false,\n quillEditor: null,\n quillEditorToolbarOptions: [\n ['bold', 'italic', 'underline', 'strike'],\n ['blockquote', 'code-block', 'image'],\n [{ 'header': 1 }, { 'header': 2 }],\n [{ 'list': 'ordered' }, { 'list': 'bullet' }],\n [{ 'script': 'sub' }, { 'script': 'super' }],\n [{ 'indent': '-1' }, { 'indent': '+1' }],\n [{ 'direction': 'rtl' }],\n [{ 'size': ['small', false, 'large', 'huge'] }],\n [{ 'header': [1, 2, 3, 4, 5, 6, false] }],\n [{ 'color': [] }, { 'background': [] }],\n [{ 'font': [] }],\n [{ 'align': [] }],\n ['clean']\n ],\n uploadUrl: '',\n dataForm: {\n id: '',\n title: '',\n content: '',\n pubDate: ''\n }\n }\n },\n computed: {\n dataRule () {\n var validateContent = (rule, value, callback) => {\n if (this.quillEditor.getLength() <= 1) {\n return callback(new Error(this.$t('validate.required')))\n }\n callback()\n }\n return {\n title: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ],\n content: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' },\n { validator: validateContent, trigger: 'blur' }\n ],\n pubDate: [\n { required: true, message: this.$t('validate.required'), trigger: 'blur' }\n ]\n }\n }\n },\n methods: {\n init () {\n this.visible = true\n this.$nextTick(() => {\n if (this.quillEditor) {\n this.quillEditor.deleteText(0, this.quillEditor.getLength())\n } else {\n this.quillEditorHandle()\n }\n this.$refs['dataForm'].resetFields()\n if (this.dataForm.id) {\n this.getInfo()\n }\n })\n },\n // 富文本编辑器\n quillEditorHandle () {\n this.quillEditor = new Quill('#J_quillEditor', {\n modules: {\n toolbar: this.quillEditorToolbarOptions\n },\n theme: 'snow'\n })\n // 自定义上传图片功能 (使用element upload组件)\n this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/sys/oss/upload?access_token=${Cookies.get('access_token')}`\n this.quillEditor.getModule('toolbar').addHandler('image', () => {\n this.$refs.uploadBtn.$el.click()\n })\n // 监听内容变化,动态赋值\n this.quillEditor.on('text-change', () => {\n this.dataForm.content = this.quillEditor.root.innerHTML\n })\n },\n // 上传图片之前\n uploadBeforeUploadHandle (file) {\n if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {\n this.$message.error('只支持jpg、png、gif格式的图片!')\n return false\n }\n },\n // 上传图片成功\n uploadSuccessHandle (res, file, fileList) {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.src)\n },\n // 获取信息\n getInfo () {\n this.$http.get(`/sys/news/${this.dataForm.id}`).then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.dataForm = res.data\n this.quillEditor.root.innerHTML = this.dataForm.content\n }).catch(() => {})\n },\n // 表单提交\n dataFormSubmitHandle: debounce(function () {\n this.$refs['dataForm'].validate((valid) => {\n if (!valid) {\n return false\n }\n this.$http[!this.dataForm.id ? 'post' : 'put'](\n '/sys/news',\n this.dataForm,\n { headers: { 'content-type': 'application/x-www-form-urlencoded' } }\n ).then(({ data: res }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.$message({\n message: this.$t('prompt.success'),\n type: 'success',\n duration: 500,\n onClose: () => {\n this.visible = false\n this.$emit('refreshDataList')\n }\n })\n }).catch(() => {})\n })\n }, 1000, { 'leading': true, 'trailing': false })\n }\n}\n</script>\n"],"sourceRoot":"src/views/modules/sys"}]} |