From 72dbfec77a747b9a08bc71b630464d4383877082 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期一, 25 八月 2025 01:15:02 +0800 Subject: [PATCH] 按钮判断 --- src/views/bookStore/detail.vue | 39 +++++++++++++++++++++++++-------------- 1 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/views/bookStore/detail.vue b/src/views/bookStore/detail.vue index d2b4537..aed3219 100644 --- a/src/views/bookStore/detail.vue +++ b/src/views/bookStore/detail.vue @@ -168,11 +168,29 @@ <el-button v-if="currentRoute == 'teachingServices'" plain @click="addPaperBook" >绾歌川鏍蜂功</el-button > - <el-button plain @click="applyTextBook" v-if="!bookInfo.alreadyBuy" + <el-button + size="large" + type="primary" + @click="useCode" + v-if="!bookInfo.alreadyBuy && currentBook?.state !== 'Normal'" + >浣跨敤璐功鐮�</el-button + > + <el-button + style="background-color: #144941; color: #fff" + @click="applyTextBook" + size="large" + type="primary" + v-if="!bookInfo.alreadyBuy && currentBook?.state !== 'Normal'" >鐢宠璇曠敤</el-button > - <el-button plain @click="useCode" v-if="!bookInfo.alreadyBuy">浣跨敤璐功鐮�</el-button> - <el-button plain @click="read" v-if="bookInfo.alreadyBuy">寮�濮嬮槄璇�</el-button> + + <el-button + plain + size="large" + @click="read" + v-if="bookInfo.alreadyBuy || currentBook?.state == 'Normal'" + >寮�濮嬮槄璇�</el-button + > </div> </div> </div> @@ -317,6 +335,7 @@ let editableTabsValue = ref('1') let activateCode = ref('') let resourceHave = ref(true) +let currentBook = ref(null) let loading = ref(false) let buyBookCodeDialog = ref(false) var chartDom = null @@ -354,6 +373,7 @@ digitalTextId.value = route.query.bookId getBookDetail(digitalTextId.value) getRecommendBookList() + getTextBookList() }) watchEffect(() => { @@ -380,14 +400,7 @@ item.content = JSON.parse(item.content)[0] item.productId = item.content.id } - const currentBook = res.datas.find((item) => item.productId == digitalTextId.value) - if (currentBook) { - return currentBook - } else { - return null - } - } else { - return null + currentBook.value = res.datas.find((item) => item.productId == digitalTextId.value) } } @@ -498,9 +511,7 @@ //鐢宠璇曠敤 const applyTextBook = async () => { - console.log(userStore.userInfo, 'userInfo') - const isApply = await getTextBookList() - if (isApply?.state == 'WaitAudit') { + if (currentBook.value?.state == 'WaitAudit') { ElMessageBox.confirm('鎮ㄥ凡鐢宠璇曠敤璇ヤ功锛屾槸鍚﹀墠寰�鏌ョ湅', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', -- Gitblit v1.9.1