diff --git a/src/apis/ec_api.js b/src/apis/ec_api.js index 8717824..7bbbbae 100644 --- a/src/apis/ec_api.js +++ b/src/apis/ec_api.js @@ -100,6 +100,17 @@ export const ec_api_get_suggest = (api_type, api) => { }) } +export const ec_api_get_suggest_timestamp = (api_type, api) => { + return request({ + url: 'ec/get_suggest_params_timestamp', + method: 'get', + params: { + member_type: api_type, + api: api + } + }) +} + export const ec_api_set_user_data = (req_data) => { return request({ url: 'ec/set_user_data', diff --git a/src/components/ec_api/SeatStatus.vue b/src/components/ec_api/SeatStatus.vue new file mode 100644 index 0000000..53d3c61 --- /dev/null +++ b/src/components/ec_api/SeatStatus.vue @@ -0,0 +1,234 @@ + + + + + 选择座位: + + 清除选择 + + + + + + + + + + {{ seat['label'] }} + {{ seat['name'] }} + + + + + + + + + + diff --git a/src/components/ec_api/TabArea.vue b/src/components/ec_api/TabArea.vue index 2781a0d..452c36d 100644 --- a/src/components/ec_api/TabArea.vue +++ b/src/components/ec_api/TabArea.vue @@ -3,12 +3,18 @@ import {ref, reactive, onBeforeMount, onMounted, onUnmounted, watch, computed} f 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, ec_api_get_suggest} from "@/apis/ec_api.js"; +import { + ec_api_send_request, + get_ec_api_request_url, + ec_api_get_suggest, + ec_api_get_suggest_timestamp +} from "@/apis/ec_api.js"; import {Eleme, Refresh} from "@element-plus/icons-vue"; import "@/VueAceEditor/aceConfig" import {VAceEditor} from "vue3-ace-editor"; import {ElMessage} from "element-plus"; import MovieShow from "@/components/ec_api/MovieShow.vue"; +import SeatStatus from "@/components/ec_api/SeatStatus.vue"; // 注册store @@ -89,6 +95,7 @@ function initApiData() { 'sig': '', 'format': 'json', 'reload': true, + 'timestamp': 0, 'params': store.state.ecApiModule.ec_api_data.api_params[item.id] } } @@ -264,6 +271,22 @@ async function get_suggest() { } } +async function get_timestamp() { + const api_type = UserApiData.value.api[activeTab.value].type + const api = UserApiData.value.api[activeTab.value].path + await ec_api_get_suggest_timestamp(api_type, api).then( + res => { + console.log('get_timestamp', res['timestamp']) + if (res['timestamp'] > UserApiData.value.api[activeTab.value].timestamp) { + UserApiData.value.api[activeTab.value].reload = true + UserApiData.value.api[activeTab.value].timestamp = res['timestamp'] + } + } + ).catch((err) => { + console.log(err) + }) +} + // 用于测试,可以添加到需要的方法中 function test() { console.log('store.state.ecApiModule.ec_api_data', store.state.ecApiModule.ec_api_data) @@ -271,6 +294,7 @@ function test() { // console.log('activeTab.value', activeTab.value) } +// 计算属性用来处理场次接口获取的数据,并同步给对应的选择模块 const showList = computed(() => { const api = UserApiData.value.api[activeTab.value] if (api.path === 'cinema/plays') { @@ -292,6 +316,30 @@ const showList = computed(() => { return [] }) +// 计算属性用来处理座位接口获取的数据,并同步给对应的选择模块 +const seatList = computed(() => { + const api = UserApiData.value.api[activeTab.value] + if (api.path === 'play/seat-status') { + if (api.format === 'json') { + if (api.response === '{"root": "root"}') { + return [] + } else { + console.log("api.handled['res']['data']", api.handled['res']['data']) + return api.handled['res']['data'] + } + } + if (api.format === 'xml' || api.format === 'html') { + if (api.response === '') { + return [] + } else { + console.log("api.handled['res']['data']", api.handled['res']['data']) + return api.handled['res']['data'] + } + } + } + return [] +}) + // 监测ec_select_api的变化 生成新的本地数据,如果当前选中的标签被取消勾选,则选择剩下标签的第一个 watch(() => store.state.ecApiModule.ec_api_data.api, (oldValue, newValue) => { console.log('watch store.state.ecApiModule.ec_api_data.api') @@ -308,6 +356,7 @@ watch(() => store.state.ecApiModule.ec_api_data.api, (oldValue, newValue) => { // 监测activeTab, 如果切换标签页,则执行自动勾选的函数 watch(activeTab, () => { markIsChecked() + get_timestamp() get_suggest() handle_request_url() }) @@ -316,6 +365,7 @@ watch(activeTab, () => { watch(UserApiData.value, () => { console.log('watch UserApiData', UserApiData.value) console.log('store.state.ecApiModule.ec_api_data', store.state.ecApiModule.ec_api_data) + get_suggest() handle_request_url() }, {deep: true, flush: "post"}) @@ -375,6 +425,7 @@ const ace_options = { :key="api['id']" :label="api['description']" :name="api['id']" + :disabled="req_loading" > +