From 024627801fcec0f0924ef2a949b05cc00096e85b Mon Sep 17 00:00:00 2001 From: RogerWork Date: Mon, 26 Aug 2024 20:19:22 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91=EF=BC=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=B3=E5=88=A4=E6=96=AD=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E8=BF=87=E6=9C=9F=202.=20=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=BA=A7=E4=BD=8D=E5=9B=BE=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/ec_api.js | 11 ++ src/components/ec_api/SeatStatus.vue | 234 +++++++++++++++++++++++++++ src/components/ec_api/TabArea.vue | 54 ++++++- 3 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 src/components/ec_api/SeatStatus.vue 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 @@ + + + + + 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" > +