diff --git a/src/assets/image/jiace.png b/src/assets/image/jiace.png new file mode 100644 index 0000000..d9db807 Binary files /dev/null and b/src/assets/image/jiace.png differ diff --git a/src/assets/image/login-bg.jpg b/src/assets/image/login-bg.jpg deleted file mode 100644 index b80c6bc..0000000 Binary files a/src/assets/image/login-bg.jpg and /dev/null differ diff --git a/src/main.js b/src/main.js index 7c5d08b..313cd44 100644 --- a/src/main.js +++ b/src/main.js @@ -1,56 +1,66 @@ -import Vue from 'vue' +import Vue from 'vue'; -import Cookies from 'js-cookie' +import Cookies from 'js-cookie'; -import 'normalize.css/normalize.css' // a modern alternative to CSS resets +import 'normalize.css/normalize.css'; // a modern alternative to CSS resets -import Element from 'element-ui' -import './assets/styles/element-variables.scss' +import Element from 'element-ui'; +import './assets/styles/element-variables.scss'; -import '@/assets/styles/index.scss' // global css -import '@/assets/styles/ruoyi.scss' // ruoyi css -import App from './App' -import store from './store' -import router from './router' -import permission from './directive/permission' +import '@/assets/styles/index.scss'; // global css +import '@/assets/styles/ruoyi.scss'; // ruoyi css +import App from './App'; +import store from './store'; +import router from './router'; +import permission from './directive/permission'; -import './assets/icons' // icon -import './permission' // permission control -import { getDicts } from "@/api/system/dict/data"; -import { getConfigKey } from "@/api/system/config"; -import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi"; -import Pagination from "@/components/Pagination"; +import './assets/icons'; // icon +import './permission'; // permission control +import { getDicts } from '@/api/system/dict/data'; +import { getConfigKey } from '@/api/system/config'; +import { + parseTime, + resetForm, + addDateRange, + selectDictLabel, + selectDictLabels, + download, + handleTree +} from '@/utils/ruoyi'; +import { formatRichText } from '@/utils/editor'; +import Pagination from '@/components/Pagination'; //自定义表格工具扩展 -import RightToolbar from "@/components/RightToolbar" +import RightToolbar from '@/components/RightToolbar'; // 全局方法挂载 -Vue.prototype.getDicts = getDicts -Vue.prototype.getConfigKey = getConfigKey -Vue.prototype.parseTime = parseTime -Vue.prototype.resetForm = resetForm -Vue.prototype.addDateRange = addDateRange -Vue.prototype.selectDictLabel = selectDictLabel -Vue.prototype.selectDictLabels = selectDictLabels -Vue.prototype.download = download -Vue.prototype.handleTree = handleTree +Vue.prototype.getDicts = getDicts; +Vue.prototype.getConfigKey = getConfigKey; +Vue.prototype.parseTime = parseTime; +Vue.prototype.resetForm = resetForm; +Vue.prototype.addDateRange = addDateRange; +Vue.prototype.selectDictLabel = selectDictLabel; +Vue.prototype.selectDictLabels = selectDictLabels; +Vue.prototype.download = download; +Vue.prototype.handleTree = handleTree; +Vue.prototype.formatRichText = formatRichText; -Vue.prototype.msgSuccess = function (msg) { - this.$message({ showClose: true, message: msg, type: "success" }); -} +Vue.prototype.msgSuccess = function(msg) { + this.$message({ showClose: true, message: msg, type: 'success' }); +}; -Vue.prototype.msgError = function (msg) { - this.$message({ showClose: true, message: msg, type: "error" }); -} +Vue.prototype.msgError = function(msg) { + this.$message({ showClose: true, message: msg, type: 'error' }); +}; -Vue.prototype.msgInfo = function (msg) { +Vue.prototype.msgInfo = function(msg) { this.$message.info(msg); -} +}; // 全局组件挂载 -Vue.component('Pagination', Pagination) -Vue.component('RightToolbar', RightToolbar) +Vue.component('Pagination', Pagination); +Vue.component('RightToolbar', RightToolbar); -Vue.use(permission) +Vue.use(permission); /** * If you don't want to use mock-server @@ -63,13 +73,13 @@ Vue.use(permission) Vue.use(Element, { size: Cookies.get('size') || 'medium' // set element-ui default size -}) +}); -Vue.config.productionTip = false +Vue.config.productionTip = false; new Vue({ el: '#app', router, store, render: h => h(App) -}) +}); diff --git a/src/utils/editor.js b/src/utils/editor.js new file mode 100644 index 0000000..fc03154 --- /dev/null +++ b/src/utils/editor.js @@ -0,0 +1,51 @@ +export function formatRichText(url) { + let src = document.querySelectorAll('#text .ql-editor img'); + console.log(src); + for (let i = 0; i < src.length; i++) { + const string = src[i].getAttribute('src'); + src[i].setAttribute('src', url + string); + } + let src2 = document.querySelectorAll('#text .ql-editor a'); + for (let i = 0; i < src2.length; i++) { + const string = src2[i].getAttribute('href'); + src2[i].setAttribute('href', url + string); + } + // console.log(document.querySelectorAll('#text .ql-editor a')); + // var imgReg = /|\/>)/gi; + // var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i; + // var arr = html.match(imgReg); + // // console.log(arr); + // for (let i = 0; i < arr.length; i++) { + // let src = arr[i].match(srcReg); + // //获取图片地址 + // console.log(html); + // console.log(src[1]); + // if (src[1]) { + // var newContent = html.replace( + // /\|\/>)/gi; +// var hrefReg = /href=[\'\"]?([^\'\"]*)[\'\"]?/i; +// var arr2 = html.match(aReg); +// for (let i = 0; i < arr2.length; i++) { +// let src = arr2[i].match(hrefReg); +// //获取图片地址 +// if (src[1]) { +// var newContent = html.replace(/\ @@ -158,7 +156,7 @@ $loginForm: 383px; // align-items: center; height: 100%; min-height: $loginHeight; - // background-image: url('../assets/image/login-bg.jpg'); + background-image: url('../assets/image/jiace.png'); background-size: cover; position: relative; } @@ -262,4 +260,4 @@ $loginForm: 383px; .el-input__prefix { color: #209cff; } - \ No newline at end of file + diff --git a/src/views/policy/library/add.vue b/src/views/policy/library/add.vue index 3a49672..e7b7b98 100644 --- a/src/views/policy/library/add.vue +++ b/src/views/policy/library/add.vue @@ -47,7 +47,9 @@ - +
+ +
{ + this.formatRichText(this.ruleForm.downloadUrl); + }); + } + }, + deep: true + }, created() { let { id } = this.$route.query; if (id) { diff --git a/src/views/technology/achievement/add.vue b/src/views/technology/achievement/add.vue index ac0109f..baca286 100644 --- a/src/views/technology/achievement/add.vue +++ b/src/views/technology/achievement/add.vue @@ -12,8 +12,9 @@ - - + + + @@ -70,12 +71,21 @@ export default { MultiUpload }, data() { + // var valiIcon = (rule, value, callback) => { + // // 图片验证 + // if (!this.selectProductPics[0]) { + // callback(new Error('请上传成果图片')); + // } else { + // callback(); + // } + // }; return { aaa: '', bbb: '', editPage: false, ruleForm: { title: '', + pic: '', level: '', attribute: '', source: '', @@ -123,9 +133,55 @@ export default { source: [{ required: true, message: '请填写', trigger: 'blur' }], source2: [{ required: true, message: '请填写', trigger: 'blur' }], text: [{ required: true, message: '请填写内容', trigger: 'blur' }] + // pic: [{ required: true, validator: valiIcon }] } }; }, + computed: { + //商品的主图和画册图片 + selectProductPics: { + get: function() { + let pics = []; + if ( + this.ruleForm.pic === undefined || + this.ruleForm.pic == null || + this.ruleForm.pic === '' + ) { + return pics; + } + pics.push(this.value.pic); + // if ( + // this.value.albumPics === undefined || + // this.value.albumPics == null || + // this.value.albumPics === '' + // ) { + // return pics; + // } + // let albumPics = this.value.albumPics.split(','); + // for (let i = 0; i < albumPics.length; i++) { + // pics.push(albumPics[i]); + // } + // return pics; + }, + set: function(newValue) { + if (newValue == null || newValue.length === 0) { + this.ruleForm.pic = null; + // this.value.albumPics = null; + } else { + this.value.pic = newValue[0]; + // this.value.albumPics = ''; + // if (newValue.length > 1) { + // for (let i = 1; i < newValue.length; i++) { + // this.value.albumPics += newValue[i]; + // if (i !== newValue.length - 1) { + // this.value.albumPics += ','; + // } + // } + // } + } + } + } + }, methods: { submitForm(formName) { this.$refs[formName].validate(valid => {