💪 optimize: 优化代码

This commit is contained in:
wangsongsole 2024-01-08 18:06:53 +08:00
parent 6f9dacc848
commit bce181d2b3
1 changed files with 26 additions and 10 deletions

View File

@ -45,7 +45,11 @@
复制卡号
</p>
</template>
<p v-else class="generate">卡密正在生成中,请稍后刷新再查看</p>
<div v-else class="generate" style="display: flex;flex: 1;">
<p style="flex:1">{{cardData.status===3?'卡密兑换失败,请重新兑换':'卡密正在生成中,请稍后刷新再查看'}} </p>
<span @click="backHandler" style="color: #3558df;" v-if="cardData.status===3">重新兑换</span>
<span @click="getInfo" style="color: #3558df;" v-else>点击刷新</span>
</div>
</div>
<div class="item">
<p class="title">密码:</p>
@ -57,7 +61,11 @@
复制密码
</p>
</template>
<p v-else class="generate">卡密正在生成中,请稍后刷新再查看</p>
<div v-else class="generate" style="display: flex;flex: 1;">
<p style="flex:1">{{cardData.status===3?'卡密兑换失败,请重新兑换':'卡密正在生成中,请稍后刷新再查看'}} </p>
<span @click="backHandler" style="color: #3558df;" v-if="cardData.status===3">重新兑换</span>
<span @click="getInfo" style="color: #3558df;" v-else>点击刷新</span>
</div>
</div>
</template>
<template v-else>
@ -71,7 +79,11 @@
复制卡密
</p>
</template>
<p v-else class="generate">卡密正在生成中,请稍后刷新再查看</p>
<div v-else class="generate" style="display: flex;flex: 1;">
<p style="flex:1">{{cardData.status===3?'卡密兑换失败,请重新兑换':'卡密正在生成中,请稍后刷新再查看'}} </p>
<span @click="backHandler" style="color: #3558df;" v-if="cardData.status===3">重新兑换</span>
<span @click="getInfo" style="color: #3558df;" v-else>点击刷新</span>
</div>
</div>
</template>
</div>
@ -98,13 +110,7 @@
created () {
const orderNumber = localStorage.getItem('orderNumber');
/* 获取卡密详情 */
req.axiosGet(`/key/order/detail/${orderNumber}`).then(res => {
if (res.code == 200) {
this.cardData = res.data;
}
});
this.getInfo();
},
methods: {
@ -119,6 +125,16 @@
this.openDialog('复制成功');
},
getInfo () {
const orderNumber = localStorage.getItem('orderNumber');
/* 获取卡密详情 */
req.axiosGet(`/key/order/detail/${orderNumber}`).then(res => {
if (res.code == 200) {
this.cardData = res.data;
}
});
},
// 单条弹框
openDialog (tip) {