🎨 钱包账号调整为手动激活

This commit is contained in:
ronger 2022-11-01 22:48:32 +08:00
parent 2efafd12c0
commit aaad5ab50b
3 changed files with 28 additions and 9 deletions

View File

@ -90,7 +90,8 @@
</el-link> </el-link>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item command="user">个人中心</el-dropdown-item> <el-dropdown-item command="user">个人中心</el-dropdown-item>
<el-dropdown-item command="answer">每日一题</el-dropdown-item> <el-dropdown-item command="answer" v-if="$auth.user.bankAccount">每日一题</el-dropdown-item>
<el-dropdown-item command="answer" v-else :disabled="true">每日一题<small>(开通钱包账号激活)</small></el-dropdown-item>
<el-dropdown-item command="drafts" divided>我的草稿</el-dropdown-item> <el-dropdown-item command="drafts" divided>我的草稿</el-dropdown-item>
<el-dropdown-item command="wallet">我的钱包</el-dropdown-item> <el-dropdown-item command="wallet">我的钱包</el-dropdown-item>
<el-dropdown-item command="user-info" divided>设置</el-dropdown-item> <el-dropdown-item command="user-info" divided>设置</el-dropdown-item>

View File

@ -95,7 +95,7 @@
{{ article.articleThumbsUpCount }} {{ article.articleThumbsUpCount }}
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip class="item" effect="dark" content="赞赏" placement="top-start"> <el-tooltip v-if="article.canSponsor" class="item" effect="dark" content="赞赏" placement="top-start" :disabled="!$auth.user.bankAccount">
<el-button v-if="user.idUser === article.articleAuthorId" type="text" <el-button v-if="user.idUser === article.articleAuthorId" type="text"
style="font-size: 1.2rem;"> style="font-size: 1.2rem;">
<svg width="24" height="24"> <svg width="24" height="24">

View File

@ -8,15 +8,21 @@
<span style="font-size: 24px;"> 账号:</span> <span style="color: red;">{{ bankAccount.bankAccount }}</span> <span style="font-size: 24px;"> 账号:</span> <span style="color: red;">{{ bankAccount.bankAccount }}</span>
</el-col> </el-col>
<el-col class="bank-account-item"> <el-col class="bank-account-item">
<span style="font-size: 24px;"> 余额:</span> <span style="color: red;">{{ bankAccount.accountBalance }}</span> <span <span style="font-size: 24px;"> 余额:</span> <span style="color: red;">{{ bankAccount.accountBalance }}</span>
<span
style="font-size: 24px;">巴旦木</span> style="font-size: 24px;">巴旦木</span>
</el-col> </el-col>
<el-col> <el-col>
<records :records="records" :bankAccount="bankAccount.bankAccount" @currentChange="handleCurrentChange" @searchTransactionRecord="searchTransactionRecord"></records> <records :records="records" :bankAccount="bankAccount.bankAccount" @currentChange="handleCurrentChange"
@searchTransactionRecord="searchTransactionRecord"></records>
</el-col> </el-col>
</el-col> </el-col>
<el-col v-else style="text-align: center;margin-top: 10vh;"> <el-col v-else style="text-align: center;margin-top: 10vh;">
<el-button type="primary">开通钱包账号</el-button> <p style="font-size: 24px;line-height: 48px;">
<code>钱包</code> 是社区非常重要的组成部分<br/>
开通钱包账号后可激活 <code>每日一题</code> , <code>赞赏</code> 等功能
</p>
<el-button type="primary" @click="createBankAccount">现在开通</el-button>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
@ -28,7 +34,8 @@ import Records from "../components/common/bank/account/records";
export default { export default {
name: "wallet", name: "wallet",
components: {Records}, components: {Records},
fetch({store, error}) { fetch() {
let {store, error} = this.$nuxt.context
return Promise.all([ return Promise.all([
store store
.dispatch('wallet/fetchDetail') .dispatch('wallet/fetchDetail')
@ -45,8 +52,7 @@ export default {
}) })
}, },
data() { data() {
return { return {}
}
}, },
methods: { methods: {
handleCurrentChange(search) { handleCurrentChange(search) {
@ -67,6 +73,14 @@ export default {
startDate: startDate, startDate: startDate,
endDate: endDate endDate: endDate
}) })
},
createBankAccount() {
let _ts = this
_ts.$axios.$post('/api/wallet/create').then(function (res) {
if (res) {
_ts.$fetch()
}
})
} }
}, },
mounted() { mounted() {
@ -80,4 +94,8 @@ export default {
font-size: 32px; font-size: 32px;
padding-left: 15vw; padding-left: 15vw;
} }
code {
color: red;
font-weight: bold;
}
</style> </style>