合并版本

This commit is contained in:
wuhongjian 2022-07-12 17:43:06 +08:00
commit 0814ccea07
9 changed files with 841 additions and 548 deletions

View File

@ -231,3 +231,11 @@ export function queryResourceRelByKeyId(params) {
params,
})
}
//
export function filesUpload(data) {
return request({
url: window.SITE_CONFIG.apiURL + '/upload',
method: 'post',
data,
})
}

View File

@ -192,6 +192,7 @@
],
},
])
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -315,6 +316,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
if (obj.attrType == '技术文档' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -322,6 +326,13 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '技术文档') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {

View File

@ -99,6 +99,7 @@
import mybus from '@/myplugins/mybus'
const showView = ref('基本信息')
const router = useRouter()
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -285,7 +286,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
console.log(obj, dataFrom.value.infoList)
if (obj.attrType == '技术文档' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -293,6 +296,14 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '技术文档') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {
fileList.value = obj

View File

@ -173,6 +173,7 @@
],
},
])
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -297,6 +298,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
if (obj.attrType == '使用手册' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -304,6 +308,13 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '使用手册') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {

View File

@ -173,6 +173,7 @@
],
},
])
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -297,6 +298,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
if (obj.attrType == '技术文档' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -304,6 +308,13 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '技术文档') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {

View File

@ -0,0 +1,69 @@
<!--
* @Author: hisense.wuhongjian
* @Date: 2022-04-19 17:18:48
* @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-05-06 19:11:32
* @Description: markdown编辑器
-->
<template>
<editor
v-model="text"
:iconfontJs="iconfontJs"
pageFullScreen
@save="saveText"
></editor>
</template>
<script setup>
import { defineComponent, ref, defineProps } from 'vue'
import { message } from 'ant-design-vue'
import Editor from 'md-editor-v3'
import { pinyin } from 'pinyin-pro'
// import FileSaver from 'file-saver'
import 'md-editor-v3/lib/style.css'
import * as fontJs from '/public/static/js/font.js'
import { filesUpload } from '@/api/personalCenter'
import mybus from '@/myplugins/mybus'
let text = ref('')
let iconfontJs = fontJs
const props = defineProps({
data: { type: Array, default: null },
})
function saveText(file) {
const blob = new Blob([file], {
type: 'md',
})
let myfile = new File([blob], '技术文档.md')
var formData = new FormData()
const type = pinyin('技术文档', {
pattern: 'initial',
}).replace(/\s*/g, '')
formData.append('fileName', '技术文档' + '.md')
formData.append('type', type)
formData.append('file', myfile) // 'file' HTTP Post, file File
// formData.append('name', this.route.currentRoute.query.id + '.md')
// FileSaver.saveAs(blob, '.md')
filesUpload(formData).then((resData) => {
const res = resData.data.data
text.value = res
mybus.emit('showTextFunctionEmit', false)
let infoList = ref({
attrType: '技术文档',
attrValue: res,
delFlag: 0,
})
mybus.emit('chageDataFrom', infoList.value)
console.log('res', res)
if (res.data.code === 0) {
message.success('保存成功')
} else {
message.error('保存失败')
}
})
}
</script>
<style scoped>
.md-fullscreen {
z-index: 10;
}
</style>

View File

@ -121,6 +121,7 @@
],
},
])
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -245,6 +246,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
if (obj.attrType == '技术文档' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -252,6 +256,13 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '技术文档') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {

File diff suppressed because it is too large Load Diff

View File

@ -138,6 +138,7 @@
let obj = props.dataList.infoList.filter(
(item) => item.attrType === '技术文档'
)[0]
debugger
console.log('dataFrom.value.link', obj.attrValue)
window.open(
window.SITE_CONFIG.previewUrl +
@ -149,6 +150,7 @@
let obj = props.dataList.infoList.filter(
(item) => item.attrType === '使用手册'
)[0]
debugger
console.log('dataFrom.value.link', obj.attrValue)
window.open(
window.SITE_CONFIG.previewUrl +