fix 插入图片

This commit is contained in:
赵霄
2023-09-17 18:46:49 +08:00
parent 18bea574ca
commit 50e199c43c
5 changed files with 558 additions and 566 deletions
+2 -2
View File
@@ -13,14 +13,14 @@
<% if (process.env.NODE_ENV === 'development' ) { %> <% if (process.env.NODE_ENV === 'development' ) { %>
<script> <script>
window._CONFIG = { window._CONFIG = {
'interfaceUrl': 'http://10.10.10.46:4202', 'interfaceUrl': 'http://139.9.235.66:8184',
}; };
</script> </script>
<% } %> <% } %>
<% if (process.env.NODE_ENV === 'production' ) { %> <% if (process.env.NODE_ENV === 'production' ) { %>
<script> <script>
window._CONFIG = { window._CONFIG = {
'interfaceUrl': 'https://srms.foton.com.cn', 'interfaceUrl': 'http://laws-sinotruk-server-kmc2c.yf-grp:8080',
}; };
</script> </script>
<% } %> <% } %>
+3 -3
View File
@@ -3,12 +3,12 @@
* @author: chenxiaoxi * @author: chenxiaoxi
* @date: 2021-08-18 17:47:46 * @date: 2021-08-18 17:47:46
*/ */
const interfaceUrl = window._CONFIG.interfaceUrl + '/api/' //本地 const interfaceUrl = window._CONFIG.interfaceUrl + '/laws-sinotruk/' //本地
// const interfaceUrl = 'https://srms.foton.com.cn/api/' //线上 // const interfaceUrl = 'https://srms.foton.com.cn/api/' //线上
const uploadFilePath = 'api/att/attFile/uploadNew' const uploadFilePath = '/laws-sinotruk/onlyoffice/upload'
const staticFilePath = window._CONFIG.interfaceUrl + '/api/att/attFile/downloadFileForSarNew' //本地 const staticFilePath = window._CONFIG.interfaceUrl + '/laws-sinotruk/onlyoffice/downLoadFile' //本地
// const staticFilePath = 'https://srms.foton.com.cn/api/att/attFile/downloadFile' //线上 // const staticFilePath = 'https://srms.foton.com.cn/api/att/attFile/downloadFile' //线上
module.exports = { module.exports = {
interfaceUrl, interfaceUrl,
+128 -127
View File
@@ -18,12 +18,12 @@
v-bind="formItemLayout" v-bind="formItemLayout"
@submit="handleSubmit" @submit="handleSubmit"
> >
<!-- <a-form-item label="标题">--> <!-- <a-form-item label="标题">-->
<!-- <a-input--> <!-- <a-input-->
<!-- v-model="form.title"--> <!-- v-model="form.title"-->
<!-- placeholder="请输入标题"--> <!-- placeholder="请输入标题"-->
<!-- />--> <!-- />-->
<!-- </a-form-item>--> <!-- </a-form-item>-->
<a-form-item label="图片"> <a-form-item label="图片">
<a-upload <a-upload
ref="upload" ref="upload"
@@ -31,7 +31,7 @@
list-type="picture-card" list-type="picture-card"
class="avatar-uploader" class="avatar-uploader"
:show-upload-list="false" :show-upload-list="false"
action="api/att/attFile/upload" action="/laws-sinotruk/onlyoffice/upload"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:customRequest="uploadFile" :customRequest="uploadFile"
@change="handleChange" @change="handleChange"
@@ -47,9 +47,9 @@
}, },
]" ]"
> >
<img ref="myImg" v-if="imageUrl" :src="imageUrl" style="width: 300px; height: 300px;"/> <img ref="myImg" v-if="imageUrl" :src="imageUrl" style="width: 300px; height: 300px;" />
<div v-else> <div v-else>
<a-icon :type="loading ? 'loading' : 'plus'"/> <a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text"> <div class="ant-upload-text">
Upload Upload
</div> </div>
@@ -57,7 +57,7 @@
</a-upload> </a-upload>
</a-form-item> </a-form-item>
<a-form-item label="图片大小"> <a-form-item label="图片大小">
<a-radio-group :options="plainOptions" v-model="form.size"/> <a-radio-group :options="plainOptions" v-model="form.size" />
</a-form-item> </a-form-item>
</a-form-model> </a-form-model>
</a-modal> </a-modal>
@@ -65,24 +65,24 @@
</template> </template>
<script> <script>
import _axios from '@/plugins/axios2' import _axios from '@/plugins/axios2'
import pxConversionMm from '../common/unitConversion' import pxConversionMm from '../common/unitConversion'
function getBase64(img, callback) { function getBase64 (img, callback) {
console.log(img); console.log(img)
const reader = new FileReader(); const reader = new FileReader()
reader.addEventListener('load', () => callback(reader.result)); reader.addEventListener('load', () => callback(reader.result))
reader.readAsDataURL(img); reader.readAsDataURL(img)
} }
const plainOptions = ['原图', '小', '中', '大']; const plainOptions = ['原图', '小', '中', '大']
export default { export default {
data() { data () {
return { return {
visible: false, visible: false,
formItemLayout: { formItemLayout: {
labelCol: {span: 6}, labelCol: { span: 6 },
wrapperCol: {span: 14}, wrapperCol: { span: 14 }
}, },
loading: false, loading: false,
imageUrl: '', imageUrl: '',
@@ -122,7 +122,7 @@
} }
}, },
methods: { methods: {
handleClick() { handleClick () {
// console.log(window.Asc.plugin.info) // console.log(window.Asc.plugin.info)
window.Asc.scope.guid = window.Asc.plugin.info.guid window.Asc.scope.guid = window.Asc.plugin.info.guid
this.ctx.callCommand(() => { this.ctx.callCommand(() => {
@@ -173,7 +173,7 @@
// contentWindow.postMessage({ m: 'Wx Success' }, '*') // contentWindow.postMessage({ m: 'Wx Success' }, '*')
}, false) }, false)
}, },
handleCaptionClick() { handleCaptionClick () {
// console.log(window.Asc.plugin.info) // console.log(window.Asc.plugin.info)
window.Asc.scope.guid = window.Asc.plugin.info.guid window.Asc.scope.guid = window.Asc.plugin.info.guid
this.ctx.callCommand(() => { this.ctx.callCommand(() => {
@@ -217,7 +217,7 @@
// contentWindow.postMessage({ m: 'Wx Success' }, '*') // contentWindow.postMessage({ m: 'Wx Success' }, '*')
}, false) }, false)
}, },
handleCaptionClick2() { handleCaptionClick2 () {
// _api.init(oWordControl); // _api.init(oWordControl);
// this.ctx.callCommand(function () { // this.ctx.callCommand(function () {
// try { // try {
@@ -259,10 +259,10 @@
}, false) }, false)
}, },
openImageDialog() { openImageDialog () {
this.visible = true this.visible = true
}, },
openImageNoteFou() { openImageNoteFou () {
this.ctx.callCommand(() => { this.ctx.callCommand(() => {
try { try {
const oDocument = Api.GetDocument() const oDocument = Api.GetDocument()
@@ -281,36 +281,36 @@
if (currentNumbering) { if (currentNumbering) {
oNumLvl = currentNumbering.GetNumbering().GetLevel(0) oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
} else { } else {
let oNumbering = oDocument.CreateNumbering("numbered"); let oNumbering = oDocument.CreateNumbering('numbered')
oNumLvl = oNumbering.GetLevel(0); oNumLvl = oNumbering.GetLevel(0)
} }
const sFormatString = "%1"; const sFormatString = '%1'
oNumLvl.SetCustomType("lowerLetter", sFormatString, "left"); oNumLvl.SetCustomType('lowerLetter', sFormatString, 'left')
oNumLvl.SetSuff("space"); oNumLvl.SetSuff('space')
const textPr = oNumLvl.GetTextPr() const textPr = oNumLvl.GetTextPr()
textPr.SetFontSize(18); textPr.SetFontSize(18)
textPr.SetFontFamily('黑体') textPr.SetFontFamily('黑体')
textPr.SetSmallCaps(true); textPr.SetSmallCaps(true)
textPr.SetVertAlign("superscript"); textPr.SetVertAlign('superscript')
const paraPr = oNumLvl.GetParaPr() const paraPr = oNumLvl.GetParaPr()
paraPr.SetSpacingBefore(0); paraPr.SetSpacingBefore(0)
paraPr.SetJc("left"); paraPr.SetJc('left')
paraPr.SetIndFirstLine(-150); paraPr.SetIndFirstLine(-150)
const oParagraph1 = Api.CreateParagraph() const oParagraph1 = Api.CreateParagraph()
oParagraph1.SetIndLeft(574); oParagraph1.SetIndLeft(574)
oParagraph1.SetNumbering(oNumLvl) oParagraph1.SetNumbering(oNumLvl)
oParagraph1.SetSpacingAfter(32) oParagraph1.SetSpacingAfter(32)
oParagraph1.SetFontSize(18) oParagraph1.SetFontSize(18)
oDocument.InsertContent([oParagraph1]) oDocument.InsertContent([oParagraph1])
let GetNext = oParagraph1.GetNext() let GetNext = oParagraph1.GetNext()
GetNext.Delete() GetNext.Delete()
oParagraph.Delete(); oParagraph.Delete()
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
}, false) }, false)
}, },
openImageName(){ openImageName () {
Asc.scope.numData = this.numData Asc.scope.numData = this.numData
this.ctx.callCommand(() => { this.ctx.callCommand(() => {
try { try {
@@ -324,12 +324,12 @@
let SpacingBefore let SpacingBefore
for (let i = num - 1; i >= 0; i--) { for (let i = num - 1; i >= 0; i--) {
const element = oDocument.GetElement(i) const element = oDocument.GetElement(i)
if ("table" === element.GetClassType()) { if ('table' === element.GetClassType()) {
if (element.GetTableDescription() == 'appendix') { if (element.GetTableDescription() == 'appendix') {
table = element table = element
break break
} }
} else if ("paragraph" === element.GetClassType()) { } else if ('paragraph' === element.GetClassType()) {
const getNumbering = element.GetNumbering() const getNumbering = element.GetNumbering()
const text = element.GetSpacingAfter() const text = element.GetSpacingAfter()
if (getNumbering !== null) { if (getNumbering !== null) {
@@ -341,21 +341,21 @@
} }
} }
const allElement = oDocument.GetElementsCount() const allElement = oDocument.GetElementsCount()
if (table){ if (table) {
let number = table.GetCell(0, 0).GetContent().GetElement(1); let number = table.GetCell(0, 0).GetContent().GetElement(1)
SpacingBefore = number.GetSpacingBefore(); SpacingBefore = number.GetSpacingBefore()
} }
if (SpacingBefore){ if (SpacingBefore) {
if (currentNumbering){ if (currentNumbering) {
oNumLvl = currentNumbering.GetNumbering().GetLevel(0) oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
}else{ } else {
for (let i = num + 1; i < allElement; i++) { for (let i = num + 1; i < allElement; i++) {
const element = oDocument.GetElement(i) const element = oDocument.GetElement(i)
if ("table" === element.GetClassType()) { if ('table' === element.GetClassType()) {
if (element.GetTableDescription() == 'appendix') { if (element.GetTableDescription() == 'appendix') {
break break
} }
} else if ("paragraph" === element.GetClassType()) { } else if ('paragraph' === element.GetClassType()) {
const getNumbering = element.GetNumbering() const getNumbering = element.GetNumbering()
const text = element.GetSpacingAfter() const text = element.GetSpacingAfter()
if (getNumbering !== null) { if (getNumbering !== null) {
@@ -366,26 +366,26 @@
} }
} }
} }
if (currentNumbering){ if (currentNumbering) {
oNumLvl = currentNumbering.GetNumbering().GetLevel(0) oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
}else{ } else {
let oNumbering = oDocument.CreateNumbering("numbered"); let oNumbering = oDocument.CreateNumbering('numbered')
oNumLvl = oNumbering.GetLevel(0); oNumLvl = oNumbering.GetLevel(0)
const sFormatString = "图"+Asc.scope.numData[SpacingBefore]+".%1"; const sFormatString = '图' + Asc.scope.numData[SpacingBefore] + '.%1'
oNumLvl.SetCustomType("decimal", sFormatString, "center"); oNumLvl.SetCustomType('decimal', sFormatString, 'center')
} }
} }
}else{ } else {
if (currentNumbering){ if (currentNumbering) {
oNumLvl = currentNumbering.GetNumbering().GetLevel(0) oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
}else{ } else {
for (let i = num + 1; i < allElement; i++) { for (let i = num + 1; i < allElement; i++) {
const element = oDocument.GetElement(i) const element = oDocument.GetElement(i)
if ("table" === element.GetClassType()) { if ('table' === element.GetClassType()) {
if (element.GetTableDescription() == 'appendix') { if (element.GetTableDescription() == 'appendix') {
break break
} }
} else if ("paragraph" === element.GetClassType()) { } else if ('paragraph' === element.GetClassType()) {
const getNumbering = element.GetNumbering() const getNumbering = element.GetNumbering()
const text = element.GetSpacingAfter() const text = element.GetSpacingAfter()
if (getNumbering !== null) { if (getNumbering !== null) {
@@ -396,30 +396,30 @@
} }
} }
} }
if (currentNumbering){ if (currentNumbering) {
oNumLvl = currentNumbering.GetNumbering().GetLevel(0) oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
}else{ } else {
let oNumbering = oDocument.CreateNumbering("numbered"); let oNumbering = oDocument.CreateNumbering('numbered')
oNumLvl = oNumbering.GetLevel(0); oNumLvl = oNumbering.GetLevel(0)
const sFormatString = "图 %1"; const sFormatString = '图 %1'
oNumLvl.SetCustomType("decimal", sFormatString, "center"); oNumLvl.SetCustomType('decimal', sFormatString, 'center')
} }
} }
} }
const oNewDocumentStyle = oDocument.GetStyle("List Paragraph"); const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
const oTextPr3 = oNewDocumentStyle.GetTextPr(); const oTextPr3 = oNewDocumentStyle.GetTextPr()
oTextPr3.SetFontFamily("黑体"); oTextPr3.SetFontFamily('黑体')
const textPr = oNumLvl.GetTextPr(); const textPr = oNumLvl.GetTextPr()
textPr.SetFontFamily("黑体"); textPr.SetFontFamily('黑体')
textPr.SetFontSize(21) textPr.SetFontSize(21)
// const CNParagraph = Api.CreateParagraph(); // const CNParagraph = Api.CreateParagraph();
oParagraph.SetJc("center"); oParagraph.SetJc('center')
// oParagraph.AddText("图片"); // oParagraph.AddText("图片");
oParagraph.SetFontSize(21); oParagraph.SetFontSize(21)
oParagraph.SetStyle(oNewDocumentStyle); oParagraph.SetStyle(oNewDocumentStyle)
oParagraph.SetFontFamily("黑体"); oParagraph.SetFontFamily('黑体')
oParagraph.SetSpacingAfter(34,false) oParagraph.SetSpacingAfter(34, false)
oParagraph.SetNumbering(oNumLvl); oParagraph.SetNumbering(oNumLvl)
oDocument.InsertContent([oParagraph]) oDocument.InsertContent([oParagraph])
let GetNext = oParagraph.GetNext() let GetNext = oParagraph.GetNext()
GetNext.Delete() GetNext.Delete()
@@ -429,7 +429,8 @@
} }
}, false) }, false)
}, },
handleOk() { handleOk () {
console.log('图片上传和了')
this.visible = false this.visible = false
window.Asc.scope.imageUrl = this.imageUrl window.Asc.scope.imageUrl = this.imageUrl
window.Asc.scope.title = this.form.title window.Asc.scope.title = this.form.title
@@ -442,7 +443,7 @@
} }
this.ctx.callCommand(() => { this.ctx.callCommand(() => {
try { try {
const oDocument = Api.GetDocument(); const oDocument = Api.GetDocument()
const imgOParagraph = Api.CreateParagraph() const imgOParagraph = Api.CreateParagraph()
let imgSize = { let imgSize = {
width: 0, width: 0,
@@ -466,8 +467,8 @@
imgSize.height = 89.3 imgSize.height = 89.3
break break
} }
const oDrawing = Api.CreateImage(Asc.scope.imageUrl, imgSize.width * 36000, imgSize.height * 36000); const oDrawing = Api.CreateImage(Asc.scope.imageUrl, imgSize.width * 36000, imgSize.height * 36000)
imgOParagraph.AddDrawing(oDrawing); imgOParagraph.AddDrawing(oDrawing)
// const allElement = oDocument.GetElementsCount() // const allElement = oDocument.GetElementsCount()
// let numbering = null // let numbering = null
// let currentNumbering = null // let currentNumbering = null
@@ -507,11 +508,11 @@
// imgText.SetJc("center"); // imgText.SetJc("center");
// imgText.SetSpacingBefore(10) // imgText.SetSpacingBefore(10)
// imgText.SetSmallCaps(true); // imgText.SetSmallCaps(true);
imgOParagraph.SetJc("center"); imgOParagraph.SetJc('center')
imgOParagraph.SetSmallCaps(true); imgOParagraph.SetSmallCaps(true)
const breakLine = Api.CreateParagraph() const breakLine = Api.CreateParagraph()
breakLine.SetJc('left') breakLine.SetJc('left')
oDocument.InsertContent([imgOParagraph]); oDocument.InsertContent([imgOParagraph])
// oDocument.InsertContent([imgText]); // oDocument.InsertContent([imgText]);
// 创建表格 包裹文字和列项 // 创建表格 包裹文字和列项
@@ -527,37 +528,37 @@
}, },
handleChange(info) { handleChange (info) {
if (info.file.status === 'uploading') { if (info.file.status === 'uploading') {
this.loading = true; this.loading = true
return; return
} }
if (info.file.status === 'done') { if (info.file.status === 'done') {
// Get this url from response in real world. // Get this url from response in real world.
getBase64(info.file.originFileObj, imageUrl => { getBase64(info.file.originFileObj, imageUrl => {
console.log(imageUrl); console.log(imageUrl)
this.imageUrl = imageUrl; this.imageUrl = imageUrl
this.loading = false; this.loading = false
}); })
} }
}, },
beforeUpload(file) { beforeUpload (file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
if (!isJpgOrPng) { if (!isJpgOrPng) {
this.$message.error('You can only upload JPG file!'); this.$message.error('You can only upload JPG file!')
} }
const isLt2M = file.size / 1024 / 1024 < 2; const isLt2M = file.size / 1024 / 1024 < 2
if (!isLt2M) { if (!isLt2M) {
this.$message.error('Image must smaller than 2MB!'); this.$message.error('Image must smaller than 2MB!')
} }
return isJpgOrPng && isLt2M; return isJpgOrPng && isLt2M
}, },
uploadFile(fileObj) { uploadFile (fileObj) {
let {file} = fileObj let { file } = fileObj
const _data = new FormData() const _data = new FormData()
var renameReportFile = new File([file], '新名称.jpg', {type: file.type}); var renameReportFile = new File([file], '新名称.jpg', { type: file.type })
_data.append('file', renameReportFile) _data.append('file', renameReportFile)
_axios({ _axios({
url: this.uploadFilePath, url: this.uploadFilePath,
@@ -565,10 +566,10 @@
data: _data data: _data
}).then(res => { }).then(res => {
this.loading = false this.loading = false
console.log(res); console.log(res)
this.imageUrl = this.staticFilePath + '?fileId=' + res.data.id this.imageUrl = this.staticFilePath + '?path=' + res.result.url
const img = new Image() const img = new Image()
img.src = this.staticFilePath + '?fileId=' + res.data.id img.src = this.staticFilePath + '?path=' + res.result.url
if (img.complete) { if (img.complete) {
this.imgOrigin = { this.imgOrigin = {
width: img.width, width: img.width,
@@ -576,12 +577,12 @@
} }
} else { } else {
img.onload = () => { img.onload = () => {
console.log(12); console.log(12)
this.imgOrigin = { this.imgOrigin = {
width: img.width, width: img.width,
height: img.height height: img.height
} }
console.log(this.imgOrigin); console.log(this.imgOrigin)
} }
} }
}).catch(e => { }).catch(e => {
@@ -589,25 +590,25 @@
}) })
}, },
handleSubmit() { handleSubmit () {
this.visible = false this.visible = false
}, },
handleTest() { handleTest () {
this.ctx.callCommand(() => { this.ctx.callCommand(() => {
try { try {
window.imgNumOParagraph = window.imgNumOParagraph || null window.imgNumOParagraph = window.imgNumOParagraph || null
var oNumbering, oNumLvl var oNumbering, oNumLvl
oDocument = Api.GetDocument(); oDocument = Api.GetDocument()
// 未创建图片列项 // 未创建图片列项
if (window.imgNumOParagraph) { if (window.imgNumOParagraph) {
oNumbering = window.imgNumOParagraph oNumbering = window.imgNumOParagraph
} else { } else {
// 图片 // 图片
oNumbering = oDocument.CreateNumbering("numbered"); oNumbering = oDocument.CreateNumbering('numbered')
window.imgNumOParagraph = oNumbering window.imgNumOParagraph = oNumbering
} }
oNumLvl = oNumbering.GetLevel(oNumbering.GetLevel(0).GetLevelIndex()); oNumLvl = oNumbering.GetLevel(oNumbering.GetLevel(0).GetLevelIndex())
// console.log('this', this) // console.log('this', this)
var num = oNumLvl.GetNumbering() var num = oNumLvl.GetNumbering()
// console.log(oDocument.GetNumbering()) // console.log(oDocument.GetNumbering())
@@ -616,36 +617,36 @@
oNumLvl.SetRestart(false) oNumLvl.SetRestart(false)
// title = '图' + oNumLvl.GetNumbering() // title = '图' + oNumLvl.GetNumbering()
// oNumLvl.SetCustomType('lowerRoman', oNumLvl.GetNumbering(), 'left') // oNumLvl.SetCustomType('lowerRoman', oNumLvl.GetNumbering(), 'left')
oParagraph = Api.CreateParagraph(); oParagraph = Api.CreateParagraph()
oParagraph.SetNumbering(oNumLvl); oParagraph.SetNumbering(oNumLvl)
oParagraph.AddText("测试段落"); oParagraph.AddText('测试段落')
oParagraph.SetContextualSpacing(true); oParagraph.SetContextualSpacing(true)
oDocument.Push(oParagraph); oDocument.Push(oParagraph)
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
}) })
}, }
}, },
computed: {}, computed: {},
mounted() { mounted () {
}
} }
}
</script> </script>
<style> <style>
.avatar-uploader > .ant-upload { .avatar-uploader > .ant-upload {
width: 128px; width: 128px;
height: 128px; height: 128px;
} }
.ant-upload-select-picture-card i { .ant-upload-select-picture-card i {
font-size: 32px; font-size: 32px;
color: #999; color: #999;
} }
.ant-upload-select-picture-card .ant-upload-text { .ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px; margin-top: 8px;
color: #666; color: #666;
} }
</style> </style>
+1 -3
View File
@@ -8,7 +8,7 @@ import axios from 'axios'
const config = { const config = {
// baseURL: '/' // baseURL: '/'
baseURL: window._CONFIG.interfaceUrl,//本地 baseURL: window._CONFIG.interfaceUrl//本地
// baseURL: 'https://srms.foton.com.cn',//线上 // baseURL: 'https://srms.foton.com.cn',//线上
// timeout: 60 * 1000, // Timeout // timeout: 60 * 1000, // Timeout
// withCredentials: true, // Check cross-site Access-Control // withCredentials: true, // Check cross-site Access-Control
@@ -23,7 +23,6 @@ _axios.interceptors.request.use(
(error) => (error) =>
// Do something with request error // Do something with request error
Promise.reject(error) Promise.reject(error)
) )
// Add a response interceptor // Add a response interceptor
@@ -34,7 +33,6 @@ _axios.interceptors.response.use(
(error) => (error) =>
// Do something with response error // Do something with response error
Promise.reject(error) Promise.reject(error)
) )
export default _axios export default _axios
+7 -14
View File
@@ -7,8 +7,9 @@ const pageMethod = require('./utils/getPages.js')
const pages = pageMethod.pages() const pages = pageMethod.pages()
const configs = pageMethod.configs() const configs = pageMethod.configs()
// const { interfaceUrl } = require('./src/config') // const { interfaceUrl } = require('./src/config')
function resolve(dir) { function resolve (dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
@@ -40,22 +41,14 @@ module.exports = {
port: 8081, port: 8081,
headers: { 'Access-Control-Allow-Origin': '*' }, headers: { 'Access-Control-Allow-Origin': '*' },
proxy: { proxy: {
'/api': { '/laws-sinotruk': {
target: 'localhost:8080/', target: 'http://139.9.235.66:8184',
ws: false,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/api': '' // '/laws-sinotruk': '' // 默认所有请求都加了jero-boot前缀,需要去掉
}
} }
},
// '/api': {
// // target: 'https://qcwss.cloud.tencent.com/domain/ajax',
// target: interfaceUrl,
// ws: true,
// changeOrigin: true,
// pathRewrite: {
// '^/api': '', // rewrite path
// },
// }
} }
} }
} }