技术文档
This commit is contained in:
parent
169d66e608
commit
deb886a254
|
@ -232,7 +232,7 @@ export default {
|
|||
startDate: '',
|
||||
endDate: '',
|
||||
operation: '',
|
||||
operationType: 'all'
|
||||
operationType: ''
|
||||
}
|
||||
this.value1 = '' // 格式化日期
|
||||
this.operationType = '' // 操作类型转化
|
||||
|
|
|
@ -162,6 +162,13 @@
|
|||
@click="showTextFunction()"
|
||||
>
|
||||
编辑富文本
|
||||
<div
|
||||
v-show="showText"
|
||||
class="fuwenbenbianjiqi"
|
||||
style="position: absolute; z-index: 10000"
|
||||
>
|
||||
<VueTemplateDemo :dataFrom="props.dataFrom"></VueTemplateDemo>
|
||||
</div>
|
||||
</div>
|
||||
<upload
|
||||
v-else-if="item.type == 'video'"
|
||||
|
@ -240,13 +247,6 @@
|
|||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div
|
||||
v-show="showText"
|
||||
class="fuwenbenbianjiqi"
|
||||
style="width: 100px; height: 100px; z-index: 10000"
|
||||
>
|
||||
<VueTemplateDemo></VueTemplateDemo>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
|
@ -260,7 +260,7 @@
|
|||
queryResourceRelByKeyId,
|
||||
filesUpload,
|
||||
} from '@/api/personalCenter'
|
||||
import VueTemplateDemo from '@/views/capacityOnTheShelf/FilesUpload.vue'
|
||||
import VueTemplateDemo from '@/views/personalCenter/VueTemplateDemo.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
const router = useRouter()
|
||||
const abilityToType = router.currentRoute.value.query.abilityToType
|
||||
|
@ -417,6 +417,7 @@
|
|||
}
|
||||
mybus.on('showTextFunctionEmit', (show) => {
|
||||
console.log('ssdcsd')
|
||||
debugger
|
||||
showText.value = show
|
||||
})
|
||||
mybus.off('func')
|
||||
|
|
|
@ -187,11 +187,7 @@
|
|||
)[0]
|
||||
// console.log('dataFrom.value.link', obj.attrValue)
|
||||
if (obj) {
|
||||
window.open(
|
||||
window.SITE_CONFIG.previewUrl +
|
||||
'hisense_office/onlinePreview?url=' +
|
||||
btoa(encodeURI(obj.attrValue))
|
||||
)
|
||||
window.open(window.SITE_CONFIG.frontUrl + obj.attrValue)
|
||||
} else {
|
||||
message.config({
|
||||
top: '100px', // 距离顶部的位置
|
||||
|
|
|
@ -207,11 +207,7 @@
|
|||
(item) => item.attrType === '技术文档'
|
||||
)[0]
|
||||
if (obj) {
|
||||
window.open(
|
||||
window.SITE_CONFIG.previewUrl +
|
||||
'hisense_office/onlinePreview?url=' +
|
||||
btoa(encodeURI(obj.attrValue))
|
||||
)
|
||||
window.open(window.SITE_CONFIG.frontUrl + obj.attrValue)
|
||||
} else {
|
||||
message.config({
|
||||
top: '100px', // 距离顶部的位置
|
||||
|
|
|
@ -138,10 +138,9 @@
|
|||
let obj = props.dataList.infoList.filter(
|
||||
(item) => item.attrType === '技术文档'
|
||||
)[0]
|
||||
debugger
|
||||
console.log('dataFrom.value.link', obj.attrValue)
|
||||
window.open(
|
||||
window.SITE_CONFIG.previewUrl +
|
||||
window.SITE_CONFIG.frontUrl +
|
||||
'hisense_office/onlinePreview?url=' +
|
||||
btoa(encodeURI(obj.attrValue))
|
||||
)
|
||||
|
@ -150,7 +149,6 @@
|
|||
let obj = props.dataList.infoList.filter(
|
||||
(item) => item.attrType === '使用手册'
|
||||
)[0]
|
||||
debugger
|
||||
console.log('dataFrom.value.link', obj.attrValue)
|
||||
window.open(
|
||||
window.SITE_CONFIG.previewUrl +
|
||||
|
|
|
@ -215,11 +215,7 @@
|
|||
(item) => item.attrType === '技术文档'
|
||||
)[0]
|
||||
if (obj) {
|
||||
window.open(
|
||||
window.SITE_CONFIG.previewUrl +
|
||||
'hisense_office/onlinePreview?url=' +
|
||||
btoa(encodeURI(obj.attrValue))
|
||||
)
|
||||
window.open(window.SITE_CONFIG.frontUrl + obj.attrValue)
|
||||
} else {
|
||||
message.config({
|
||||
top: '100px', // 距离顶部的位置
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
<script>
|
||||
import { defineComponent } from 'vue'
|
||||
import mybus from '@/myplugins/mybus'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getDevelopmentFile, updateDevelopmentFile } from '@/api/file'
|
||||
|
@ -27,34 +28,88 @@
|
|||
export default defineComponent({
|
||||
name: 'VueTemplateDemo',
|
||||
components: { Editor },
|
||||
props: {
|
||||
dataFrom: {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
text: '',
|
||||
route: useRouter(),
|
||||
iconfontJs: fontJs,
|
||||
uuidOne: '',
|
||||
uuidTwo: '',
|
||||
uuidSnum: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.uuidSplice()
|
||||
this.getDevelopmentFile()
|
||||
},
|
||||
methods: {
|
||||
uuid(len, radix) {
|
||||
var chars =
|
||||
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
var uuid = [],
|
||||
i
|
||||
radix = radix || chars.length
|
||||
|
||||
if (len) {
|
||||
// Compact form
|
||||
for (i = 0; i < len; i++) uuid[i] = chars[0 | (Math.random() * radix)]
|
||||
} else {
|
||||
// rfc4122, version 4 form
|
||||
var r
|
||||
|
||||
// rfc4122 requires these characters
|
||||
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
|
||||
uuid[14] = '4'
|
||||
|
||||
// Fill in random data. At i==19 set the high bits of clock sequence as
|
||||
// per rfc4122, sec. 4.1.5
|
||||
for (i = 0; i < 36; i++) {
|
||||
if (!uuid[i]) {
|
||||
r = 0 | (Math.random() * 16)
|
||||
uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return uuid.join('')
|
||||
},
|
||||
|
||||
uuidSplice() {
|
||||
this.uuidOne = this.uuid(13, 16)
|
||||
this.uuidTwo = this.uuid(13, 16)
|
||||
this.uuidSnum = this.uuidOne + this.uuidTwo
|
||||
this.uuidSnum = this.uuidSnum.replace(/\s+/g, '')
|
||||
console.log('this.uuidOne', this.uuidSnum)
|
||||
},
|
||||
async saveText(file) {
|
||||
// console.log('保存成功', e)
|
||||
// const jsonStr = JSON.stringify(e)
|
||||
const blob = new Blob([file], {
|
||||
type: 'md',
|
||||
})
|
||||
let myfile = new File([blob], this.route.currentRoute.query.id + '.md')
|
||||
let myfile = new File([blob], this.uuidSnum + '.md')
|
||||
var formData = new FormData()
|
||||
const type = pinyin(this.route.currentRoute.query.type, {
|
||||
const type = pinyin(this.dataFrom.type, {
|
||||
pattern: 'initial',
|
||||
}).replace(/\s*/g, '')
|
||||
formData.append('fileName', this.route.currentRoute.query.id + '.md')
|
||||
formData.append('fileName', this.uuidSnum + '.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')
|
||||
const res = await updateDevelopmentFile(formData)
|
||||
let infoList = {
|
||||
attrType: '技术文档',
|
||||
attrValue: res.data.data,
|
||||
delFlag: 0,
|
||||
}
|
||||
mybus.emit('chageDataFrom', infoList)
|
||||
mybus.emit('showTextFunctionEmit', false)
|
||||
console.log('res', res)
|
||||
if (res.data.code === 0) {
|
||||
message.success('保存成功')
|
||||
|
@ -63,20 +118,22 @@
|
|||
}
|
||||
},
|
||||
async getDevelopmentFile() {
|
||||
console.log(
|
||||
this.route.currentRoute.query.id,
|
||||
this.route.currentRoute.query.type
|
||||
)
|
||||
const type = pinyin(this.route.currentRoute.query.type, {
|
||||
const type = pinyin(this.dataFrom.type, {
|
||||
pattern: 'initial',
|
||||
}).replace(/\s*/g, '')
|
||||
console.log(type)
|
||||
const param = {
|
||||
type: type,
|
||||
resourceId: this.route.currentRoute.query.id,
|
||||
resourceId: this.uuidSnum,
|
||||
}
|
||||
const res = await getDevelopmentFile(param)
|
||||
this.text = res.data
|
||||
let infoList = {
|
||||
attrType: '技术文档',
|
||||
attrValue: this.text.data,
|
||||
delFlag: 0,
|
||||
}
|
||||
mybus.emit('chageDataFrom', infoList)
|
||||
console.log('res', res)
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue