技术文档

This commit is contained in:
851673013@qq.com 2022-07-14 14:55:49 +08:00
parent 169d66e608
commit deb886a254
7 changed files with 80 additions and 36 deletions

View File

@ -232,7 +232,7 @@ export default {
startDate: '', startDate: '',
endDate: '', endDate: '',
operation: '', operation: '',
operationType: 'all' operationType: ''
} }
this.value1 = '' // this.value1 = '' //
this.operationType = '' // this.operationType = '' //

View File

@ -162,6 +162,13 @@
@click="showTextFunction()" @click="showTextFunction()"
> >
编辑富文本 编辑富文本
<div
v-show="showText"
class="fuwenbenbianjiqi"
style="position: absolute; z-index: 10000"
>
<VueTemplateDemo :dataFrom="props.dataFrom"></VueTemplateDemo>
</div>
</div> </div>
<upload <upload
v-else-if="item.type == 'video'" v-else-if="item.type == 'video'"
@ -240,13 +247,6 @@
</div> </div>
</template> </template>
</div> </div>
<div
v-show="showText"
class="fuwenbenbianjiqi"
style="width: 100px; height: 100px; z-index: 10000"
>
<VueTemplateDemo></VueTemplateDemo>
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
@ -260,7 +260,7 @@
queryResourceRelByKeyId, queryResourceRelByKeyId,
filesUpload, filesUpload,
} from '@/api/personalCenter' } from '@/api/personalCenter'
import VueTemplateDemo from '@/views/capacityOnTheShelf/FilesUpload.vue' import VueTemplateDemo from '@/views/personalCenter/VueTemplateDemo.vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const router = useRouter() const router = useRouter()
const abilityToType = router.currentRoute.value.query.abilityToType const abilityToType = router.currentRoute.value.query.abilityToType
@ -417,6 +417,7 @@
} }
mybus.on('showTextFunctionEmit', (show) => { mybus.on('showTextFunctionEmit', (show) => {
console.log('ssdcsd') console.log('ssdcsd')
debugger
showText.value = show showText.value = show
}) })
mybus.off('func') mybus.off('func')

View File

@ -187,11 +187,7 @@
)[0] )[0]
// console.log('dataFrom.value.link', obj.attrValue) // console.log('dataFrom.value.link', obj.attrValue)
if (obj) { if (obj) {
window.open( window.open(window.SITE_CONFIG.frontUrl + obj.attrValue)
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(obj.attrValue))
)
} else { } else {
message.config({ message.config({
top: '100px', // top: '100px', //

View File

@ -207,11 +207,7 @@
(item) => item.attrType === '技术文档' (item) => item.attrType === '技术文档'
)[0] )[0]
if (obj) { if (obj) {
window.open( window.open(window.SITE_CONFIG.frontUrl + obj.attrValue)
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(obj.attrValue))
)
} else { } else {
message.config({ message.config({
top: '100px', // top: '100px', //

View File

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

View File

@ -215,11 +215,7 @@
(item) => item.attrType === '技术文档' (item) => item.attrType === '技术文档'
)[0] )[0]
if (obj) { if (obj) {
window.open( window.open(window.SITE_CONFIG.frontUrl + obj.attrValue)
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(obj.attrValue))
)
} else { } else {
message.config({ message.config({
top: '100px', // top: '100px', //

View File

@ -16,6 +16,7 @@
<script> <script>
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import mybus from '@/myplugins/mybus'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { getDevelopmentFile, updateDevelopmentFile } from '@/api/file' import { getDevelopmentFile, updateDevelopmentFile } from '@/api/file'
@ -27,34 +28,88 @@
export default defineComponent({ export default defineComponent({
name: 'VueTemplateDemo', name: 'VueTemplateDemo',
components: { Editor }, components: { Editor },
props: {
dataFrom: {
type: Object,
},
},
data() { data() {
return { return {
text: '', text: '',
route: useRouter(), route: useRouter(),
iconfontJs: fontJs, iconfontJs: fontJs,
uuidOne: '',
uuidTwo: '',
uuidSnum: '',
} }
}, },
created() { created() {
this.uuidSplice()
this.getDevelopmentFile() this.getDevelopmentFile()
}, },
methods: { 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) { async saveText(file) {
// console.log('', e) // console.log('', e)
// const jsonStr = JSON.stringify(e) // const jsonStr = JSON.stringify(e)
const blob = new Blob([file], { const blob = new Blob([file], {
type: 'md', 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() var formData = new FormData()
const type = pinyin(this.route.currentRoute.query.type, { const type = pinyin(this.dataFrom.type, {
pattern: 'initial', pattern: 'initial',
}).replace(/\s*/g, '') }).replace(/\s*/g, '')
formData.append('fileName', this.route.currentRoute.query.id + '.md') formData.append('fileName', this.uuidSnum + '.md')
formData.append('type', type) formData.append('type', type)
formData.append('file', myfile) // 'file' HTTP Post, file File formData.append('file', myfile) // 'file' HTTP Post, file File
// formData.append('name', this.route.currentRoute.query.id + '.md') // formData.append('name', this.route.currentRoute.query.id + '.md')
// FileSaver.saveAs(blob, '.md') // FileSaver.saveAs(blob, '.md')
const res = await updateDevelopmentFile(formData) 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) console.log('res', res)
if (res.data.code === 0) { if (res.data.code === 0) {
message.success('保存成功') message.success('保存成功')
@ -63,20 +118,22 @@
} }
}, },
async getDevelopmentFile() { async getDevelopmentFile() {
console.log( const type = pinyin(this.dataFrom.type, {
this.route.currentRoute.query.id,
this.route.currentRoute.query.type
)
const type = pinyin(this.route.currentRoute.query.type, {
pattern: 'initial', pattern: 'initial',
}).replace(/\s*/g, '') }).replace(/\s*/g, '')
console.log(type) console.log(type)
const param = { const param = {
type: type, type: type,
resourceId: this.route.currentRoute.query.id, resourceId: this.uuidSnum,
} }
const res = await getDevelopmentFile(param) const res = await getDevelopmentFile(param)
this.text = res.data this.text = res.data
let infoList = {
attrType: '技术文档',
attrValue: this.text.data,
delFlag: 0,
}
mybus.emit('chageDataFrom', infoList)
console.log('res', res) console.log('res', res)
}, },
}, },