1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/.cache/vue-loader/59ea507243d20c097166991afd7...

1 line
12 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{"remainingRequest":"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//\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 () {\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",{"version":3,"sources":["news-add-or-update.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"news-add-or-update.vue","sourceRoot":"src/views/modules/sys","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"]}]}