|
|
|
@ -3,7 +3,7 @@ import {ref, reactive, onBeforeMount, onMounted, onUnmounted, watch, watchEffect |
|
|
|
|
import Sortable from "sortablejs"; |
|
|
|
|
import {useStore, mapState} from "vuex"; |
|
|
|
|
import JsonEditorVue from "json-editor-vue3"; |
|
|
|
|
import {ec_api_send_request, get_ec_api_request_url} from "@/apis/ec_api.js"; |
|
|
|
|
import {ec_api_send_request, get_ec_api_request_url, ec_api_get_suggest} from "@/apis/ec_api.js"; |
|
|
|
|
import {Refresh} from "@element-plus/icons-vue"; |
|
|
|
|
import "@/VueAceEditor/aceConfig" |
|
|
|
|
import {VAceEditor} from "vue3-ace-editor"; |
|
|
|
@ -216,6 +216,27 @@ function send_request() { |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function get_suggest() { |
|
|
|
|
const api_type = UserApiData.value.api[activeTab.value].type |
|
|
|
|
const api = UserApiData.value.api[activeTab.value].path |
|
|
|
|
await ec_api_get_suggest(api_type, api).then( |
|
|
|
|
(res) => { |
|
|
|
|
console.log('get_suggest', api, res) |
|
|
|
|
res.forEach((suggest) => { |
|
|
|
|
UserApiData.value.api[activeTab.value].params.forEach((param) => { |
|
|
|
|
if (param.param === suggest.param) { |
|
|
|
|
param['value'] = suggest['value'] |
|
|
|
|
param['default'] = suggest['value'] |
|
|
|
|
param['is_checked'] = suggest['is_checked'] |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
).catch((err) => { |
|
|
|
|
console.log(err) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 用于测试,可以添加到需要的方法中 |
|
|
|
|
function test() { |
|
|
|
|
console.log('store.state.ecApiModule.ec_api_data', store.state.ecApiModule.ec_api_data) |
|
|
|
@ -238,6 +259,7 @@ watch(() => store.state.ecApiModule.ec_api_data.api, (oldValue, newValue) => { |
|
|
|
|
// 监测activeTab, 如果切换标签页,则执行自动勾选的函数 |
|
|
|
|
watch(activeTab, () => { |
|
|
|
|
markIsChecked() |
|
|
|
|
get_suggest() |
|
|
|
|
handle_request_url() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|