Skip to content

Commit

Permalink
fix(zoneMacro): 菜单显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Souma-Sumire committed Nov 2, 2024
1 parent 619edc1 commit 1ab6870
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/pages/zoneMacro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ const usedZoneInfo = [
...preSortZoneInfo.filter(v => v.contentType === undefined || !showContentTypes.includes(v.contentType)),
]
const websocketConnected = ref(false)
const useType = ref('ws' as 'ws' | 'act')
async function onLoad() {
if (window.location.href.indexOf('OVERLAY_WS') > 0) {
useType.value = 'ws'
let resolvePromise: (value: boolean | PromiseLike<boolean>) => void
const promise = new Promise<boolean>((resolve) => {
resolvePromise = resolve
Expand All @@ -69,7 +70,6 @@ async function onLoad() {
ElMessageBox.close()
res(true)
resolvePromise(true)
websocketConnected.value = true
})
}),
new Promise<boolean>((res) => {
Expand Down Expand Up @@ -99,12 +99,14 @@ async function onLoad() {
clearInterval(loop)
ElMessageBox.close()
resolvePromise(true)
websocketConnected.value = true
})
}, 1000)
}
return promise
}
else {
useType.value = 'act'
}
}
onMounted(() => {
Expand Down Expand Up @@ -287,6 +289,7 @@ onMounted(() => {
</el-button>
</el-row>
</div>
{{ useType }}
<div v-if="'Place' in macro">
<el-space v-show="macro.Editable">
<el-table :data="Object.entries(macro.Place)" border size="small">
Expand Down Expand Up @@ -416,8 +419,8 @@ onMounted(() => {
</el-card>
</el-space>
</el-main>
<div class="menu" :class="websocketConnected ? 'websocketConnected' : 'websocketDisconnected'">
<el-button v-if="!websocketConnected" size="small" @click="macroStore.toggleShow()">
<div class="menu" :class="useType">
<el-button v-if="useType === 'act'" size="small" @click="macroStore.toggleShow()">
隐藏页面
</el-button>
<el-button type="success" size="small" @click="macroStore.newOne('macro')">
Expand All @@ -440,10 +443,10 @@ onMounted(() => {
<el-button type="danger" size="small" @click="macroStore.resetAllData()">
恢复全部
</el-button>
<form v-if="!websocketConnected" bg-white style="font-size: 12px">
<form v-if="useType === 'act'" style="font-size: 12px;background-color: rgba(255, 255,255,0.5)">
<el-switch v-model="hideOnStartup" size="small" />默认最小化
</form>
<i v-if="!websocketConnected" class="vxe-icon-arrow-down">菜单</i>
<i v-if="useType === 'act'" class="vxe-icon-arrow-down">菜单</i>
</div>
</el-container>
</template>
Expand Down Expand Up @@ -511,7 +514,7 @@ body {
position: fixed;
top: 0;
right: 0;
&.websocketDisconnected{
&.act{
transform: translateY(calc(-100% + 1rem));
opacity: 0.5;
z-index: 100;
Expand Down

0 comments on commit 1ab6870

Please sign in to comment.