后台开发文档
This commit is contained in:
parent
be75d352b2
commit
806a45ccf7
|
@ -34,6 +34,7 @@
|
|||
"lodash": "^4.17.19",
|
||||
"monaco-editor": "^0.20.0",
|
||||
"monaco-editor-webpack-plugin": "^1.9.0",
|
||||
"pinyin-pro": "^3.11.0",
|
||||
"qs": "^6.9.4",
|
||||
"quill": "^1.3.7",
|
||||
"sass": "^1.51.0",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<!--
|
||||
* @Author: hisense.wuhongjian
|
||||
* @Date: 2022-04-11 10:11:40
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-07-21 15:03:51
|
||||
* @LastEditors: hisense.wuhongjian
|
||||
* @LastEditTime: 2022-07-26 20:23:13
|
||||
* @Description: 告诉大家这是什么
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
|
@ -27,7 +27,8 @@
|
|||
'isTab': true, // 是否通过tab展示内容?
|
||||
'iframeURL': '' // 是否通过iframe嵌套展示内容? (以http[s]://开头, 自动匹配)
|
||||
};
|
||||
window.SITE_CONFIG['frontUrl'] = 'http://15.2.21.243:9796/#/vueTemplateDemo';
|
||||
window.SITE_CONFIG['frontUrl'] = 'http://localhost:8080/#/vueTemplateDemo';
|
||||
// window.SITE_CONFIG['frontUrl'] = 'http://15.2.21.243:9796/#/vueTemplateDemo';
|
||||
// window.SITE_CONFIG['frontUrl'] = 'http://124.222.94.39:9796/#/vueTemplateDemo';
|
||||
// window.SITE_CONFIG['frontUrl'] = 'http://15.72.183.90:7008/#/vueTemplateDemo';
|
||||
// window.SITE_CONFIG['frontUrl'] = 'http://10.134.135.9:9797/#/vueTemplateDemo';
|
||||
|
@ -45,7 +46,7 @@
|
|||
// window.SITE_CONFIG['apiURL'] = 'http://124.222.94.39:8888/renren-admin';
|
||||
// window.SITE_CONFIG['apiURL'] = 'http://10.16.5.35:8888/renren-admin';
|
||||
window.SITE_CONFIG['apiURL'] = 'http://15.2.21.236:8888/renren-admin';
|
||||
window.SITE_CONFIG['previewUrl'] = 'http://15.2.21.236:9796/';
|
||||
window.SITE_CONFIG['previewUrl'] = 'http://localhost:8080/';
|
||||
// window.SITE_CONFIG['apiURL'] = 'http://15.2.23.141:8000/renren-admin';
|
||||
// WebSocket地址
|
||||
window.SITE_CONFIG['socketURL'] ='ws://localhost:8080/renren-admin/websocket';
|
||||
|
|
|
@ -241,6 +241,7 @@ import mixinViewModule from '@/mixins/view-module'
|
|||
import AddOrUpdate from './bsabilityai-add-or-update'
|
||||
import dictionaries from '@/utils/dictionaries'
|
||||
import qs from 'qs'
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
import RelateApplication from './bsabilityai-relate-application.vue'
|
||||
import putOnTheShelf from '@/views/modules/putOnTheShelf'
|
||||
export default {
|
||||
|
@ -292,7 +293,10 @@ export default {
|
|||
responseData: {},
|
||||
linkType: ''
|
||||
},
|
||||
typeInput: '组件服务'
|
||||
typeInput: '组件服务',
|
||||
uuidOne: '',
|
||||
uuidTwo: '',
|
||||
uuidSnum: ''
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
|
@ -384,11 +388,89 @@ export default {
|
|||
// })
|
||||
// this.disabled = true
|
||||
},
|
||||
// 创建uuid
|
||||
uuid (len, radix) {
|
||||
var chars =
|
||||
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
var uuid = []
|
||||
var 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)
|
||||
},
|
||||
showDocument (val) {
|
||||
window.open(
|
||||
window.SITE_CONFIG.frontUrl + '?id=' + val.id + '&&type=' + val.type,
|
||||
'_blank'
|
||||
)
|
||||
// 第一步:创建文档
|
||||
// 不存在文档时创建空文档
|
||||
this.uuidSplice()
|
||||
const uuidParam = val.infoList.filter((item) => {
|
||||
if (item.attrType === '技术文档') {
|
||||
return item
|
||||
}
|
||||
})
|
||||
if (uuidParam.length > 0) {
|
||||
this.uuidSnum = uuidParam[0].attrValue.split('/')[1].split('.')[0]
|
||||
} else {
|
||||
const type = pinyin(val.type, {
|
||||
pattern: 'initial'
|
||||
}).replace(/\s*/g, '')
|
||||
const obj = {
|
||||
attrType: '技术文档',
|
||||
attrValue: type + '/' + this.uuidSnum + '.md',
|
||||
delFlag: 0
|
||||
}
|
||||
val.infoList.push(obj)
|
||||
}
|
||||
|
||||
// 存在时加入文档
|
||||
this.$http
|
||||
.put('/resource/update', val)
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.$message({
|
||||
message: this.$t('prompt.success'),
|
||||
type: 'success',
|
||||
duration: 500,
|
||||
onClose: () => {
|
||||
// 打开这个空的开发文档
|
||||
window.open(
|
||||
window.SITE_CONFIG.frontUrl + '?id=' + this.uuidSnum + '&&type=' + val.type,
|
||||
'_blank'
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
// 第二部,update列数据,成功后打开文档编辑
|
||||
},
|
||||
getDataList2 (names) {
|
||||
if (names != null) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: hisense.wuhongjian
|
||||
* @Date: 2022-04-19 17:18:48
|
||||
* @LastEditors: hisense.wuhongjian
|
||||
* @LastEditTime: 2022-07-18 16:40:21
|
||||
* @LastEditTime: 2022-07-27 10:34:02
|
||||
* @Description: markdown编辑器
|
||||
-->
|
||||
<template>
|
||||
|
@ -44,10 +44,27 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
console.log('2222', this.route.currentRoute.query)
|
||||
// const keyId = this.route.currentRoute.value.query.id
|
||||
// this.uuidSplice()
|
||||
// 两种获取数据的形式: 1.父组件传递过来 2. 路由传递过来
|
||||
console.log('111111111', this.newDateForm)
|
||||
this.getDevelopmentFile()
|
||||
},
|
||||
computed: {
|
||||
newDateForm() {
|
||||
if (this.dataFrom && this.dataFrom.type) {
|
||||
return this.dataFrom
|
||||
} else {
|
||||
return {
|
||||
id: this.route.currentRoute.query.id,
|
||||
type: this.route.currentRoute.query.type,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 创建uuid
|
||||
uuid(len, radix) {
|
||||
var chars =
|
||||
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
|
@ -86,6 +103,7 @@
|
|||
this.uuidSnum = this.uuidSnum.replace(/\s+/g, '')
|
||||
console.log('this.uuidOne', this.uuidSnum)
|
||||
},
|
||||
// 保存文档
|
||||
async saveText(file) {
|
||||
// console.log('保存成功', e)
|
||||
// const jsonStr = JSON.stringify(e)
|
||||
|
@ -97,7 +115,7 @@
|
|||
}
|
||||
let myfile = new File([blob], this.uuidSnum + '.md')
|
||||
var formData = new FormData()
|
||||
const type = pinyin(this.dataFrom.type, {
|
||||
const type = pinyin(this.newDateForm.type, {
|
||||
pattern: 'initial',
|
||||
}).replace(/\s*/g, '')
|
||||
formData.append('fileName', this.uuidSnum + '.md')
|
||||
|
@ -120,19 +138,24 @@
|
|||
message.error('保存失败')
|
||||
}
|
||||
},
|
||||
// 初始化文档
|
||||
async getDevelopmentFile() {
|
||||
debugger
|
||||
const uuidParam = this.dataFrom.infoList.filter((item) => {
|
||||
if (item.attrType === '技术文档') {
|
||||
return item
|
||||
}
|
||||
})
|
||||
let uuid = ''
|
||||
if (uuidParam[0].attrValue) {
|
||||
uuid = uuidParam[0].attrValue.split('/')[1].split('.')[0]
|
||||
if (this.newDateForm.id) {
|
||||
uuid = this.newDateForm.id
|
||||
} else {
|
||||
const uuidParam = this.newDateForm.infoList.filter((item) => {
|
||||
if (item.attrType === '技术文档') {
|
||||
return item
|
||||
}
|
||||
})
|
||||
if (uuidParam[0].attrValue) {
|
||||
uuid = uuidParam[0].attrValue.split('/')[1].split('.')[0]
|
||||
}
|
||||
}
|
||||
this.uuidSnum = uuid
|
||||
const type = pinyin(this.dataFrom.type, {
|
||||
const type = pinyin(this.newDateForm.type, {
|
||||
pattern: 'initial',
|
||||
}).replace(/\s*/g, '')
|
||||
console.log(type)
|
||||
|
@ -142,12 +165,6 @@
|
|||
}
|
||||
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