动态获取接口请求方式

This commit is contained in:
a0049873 2022-06-15 17:13:19 +08:00
parent 99cdec5f8e
commit 7fc167b7df
1 changed files with 25 additions and 87 deletions

View File

@ -18,9 +18,7 @@
<a-radio-group <a-radio-group
v-else-if="item.type == 'radio'" v-else-if="item.type == 'radio'"
v-model:value="item.note1" v-model:value="item.note1"
:options=" :options="item.options"
item.name === '接口请求方式' ? plainOptions2 : plainOptions3
"
/> />
<a-textarea <a-textarea
v-else-if="item.type == 'textArea'" v-else-if="item.type == 'textArea'"
@ -48,86 +46,6 @@
tip="支持文件类型大小不超过100M" tip="支持文件类型大小不超过100M"
></upload> ></upload>
</div> </div>
<!-- <div class="form">
<span>接口请求方式</span>
<a-radio-group
v-model:value="data.interfaceRequestMode"
:options="plainOptions2"
/>
</div>
<div class="form">
<span>是否支持试用</span>
<a-radio-group
v-model:value="data.supportTrial"
:options="plainOptions3"
/>
</div>
<div class="form">
<span>试用地址</span>
<a-input
v-model:value="data.trialAddress"
placeholder="请输入试用地址"
/>
</div>
<div class="form">
<span>试用描述</span>
<a-textarea
v-model:value="data.trialDescription"
:showCount="true"
:maxlength="200"
placeholder="请输入试用描述"
/>
</div> -->
<!-- <div class="form">
<span>技术文档</span>
<a-upload
v-model:file-list="fileList"
:action="`${baseURL}/upload`"
list-type="picture"
class="upload-list-inline"
:before-upload="beforeUpload"
>
<a-button>
<upload-outlined></upload-outlined>
上传文档
</a-button>
<span
style="
display: inline-block;
margin-left: 10px;
color: #999999;
font-size: 14px;
"
>
支持MP3 类型文件大小不超过100M
</span>
</a-upload>
</div>
<div class="form">
<span>试用效果图</span>
<a-upload
v-model:file-list="fileList2"
:action="`${baseURL}/upload`"
list-type="picture"
class="upload-list-inline"
:before-upload="beforeUpload"
>
<a-button>
<upload-outlined></upload-outlined>
图片上传
</a-button>
<span
style="
display: inline-block;
margin-left: 10px;
color: #999999;
font-size: 14px;
"
>
支持MP3 类型文件大小不超过100M
</span>
</a-upload>
</div> -->
</div> </div>
</template> </template>
<template v-else-if="title.name == '计费标准信息'"> <template v-else-if="title.name == '计费标准信息'">
@ -248,6 +166,7 @@
import mybus from '@/myplugins/mybus' import mybus from '@/myplugins/mybus'
import upload from '@/views/components/upload' import upload from '@/views/components/upload'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { getCategoryTreePage } from '@/api/personalCenter'
// import { baseURL } from '@/config' // import { baseURL } from '@/config'
const props = defineProps({ const props = defineProps({
refData: { type: Object, default: null }, refData: { type: Object, default: null },
@ -256,11 +175,32 @@
imgList: { type: Array, default: null }, imgList: { type: Array, default: null },
}) })
const data = ref({ const data = ref({
list: props.refData.children.filter((item) => item.name === '使用方式')[0] list: [],
.children,
freightBasis: [], freightBasis: [],
commonProblem: [], commonProblem: [],
}) })
let arr = props.refData.children.filter((item) => item.name !== '常见问题')
data.value.list = []
arr.forEach((val) => {
val.children.forEach((item) => {
if (item.isLinkToDic === 'true' && item.linkValue) {
getCategoryTreePage({
page: 1,
limit: 20,
dictTypeId: item.linkValue,
deFlage: 0,
}).then((res) => {
// console.log(res.data.data)
if (item.type === 'radio') {
item.options = res.data.data.list.map((radio) => radio.dictLabel)
}
data.value.list.push(item)
})
} else {
data.value.list.push(item)
}
})
})
if (props.dataFrom) { if (props.dataFrom) {
console.log(props.dataFrom, data.value.list) console.log(props.dataFrom, data.value.list)
props.dataFrom.infoList.forEach((item) => { props.dataFrom.infoList.forEach((item) => {
@ -277,8 +217,6 @@
const question = ref('') const question = ref('')
const answer = ref('') const answer = ref('')
const plainOptions = ['一次性买断', '按调用次数', '按并发路数', '按年计费'] const plainOptions = ['一次性买断', '按调用次数', '按并发路数', '按年计费']
const plainOptions2 = ['GET', 'POST']
const plainOptions3 = ['是', '否']
const limitNumber = (value) => { const limitNumber = (value) => {
if (typeof value === 'string') { if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0 return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0