后台开发文档

This commit is contained in:
wuhongjian 2022-07-27 10:54:34 +08:00
parent be75d352b2
commit 806a45ccf7
4 changed files with 126 additions and 25 deletions

View File

@ -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",

View File

@ -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';

View File

@ -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) {

View File

@ -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)
},
},