流程再次大调整

This commit is contained in:
aixianling
2023-01-03 16:20:23 +08:00
parent 55c71a3058
commit 04664e58b3
2 changed files with 15 additions and 22 deletions

View File

@@ -17,7 +17,7 @@
<u-parse :html="detail.ending"/>
</AiGroup>
<u-gap height="160"/>
<weixin-login :autoShow="!user.token" content="投票需要您授权您的微信信息" @login="getList"/>
<weixin-login :autoShow="!user.token||wxLogin" content="投票需要您授权您的微信信息" @login="getList"/>
</section>
</template>
@@ -32,7 +32,8 @@ export default {
data() {
return {
detail: {},
list: []
list: [],
wxLogin: false
}
},
computed: {
@@ -59,7 +60,8 @@ export default {
})
},
handleDetail(id) {
uni.navigateTo({url: './voteDetail?id=' + id})
if (!this.user.token) this.wxLogin = true
else uni.navigateTo({url: './voteDetail?id=' + id})
}
},
onShow() {

View File

@@ -10,27 +10,22 @@
<div class="text circle mar-l16" :class="{disabled:canotVote}" @click="handleVote">投票</div>
</div>
</AiBottomBtn>
<weixin-login :autoShow="showWxLogin" @login="handleVote"/>
</section>
</template>
<script>
import {mapState} from "vuex"
import WeixinLogin from "./weixinLogin";
export default {
name: "voteDetail",
components: {WeixinLogin},
appName: "投票详情",
computed: {
...mapState(['user']),
wxCode: v => v.$route.query.code,
canotVote: v => !!v.user.token && v.detail.isVote == '0'
},
data() {
return {
detail: {},
showWxLogin: false
}
},
methods: {
@@ -44,20 +39,16 @@ export default {
})
},
handleVote() {
if (!this.user.token) {//未登录,获取openId和token
this.showWxLogin = true
} else {//已登录,直接投票
if (!this.canotVote) {
const {id} = this.$route.query
this.$http.post("/app/appvideovoteinfo/voteByVideoId", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
this.$u.toast("投票成功!")
this.getDetail()
} else if (res?.msg) this.$u.toast(res.msg)
})
}
if (!this.canotVote) {
const {id} = this.$route.query
this.$http.post("/app/appvideovoteinfo/voteByVideoId", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
this.$u.toast("投票成功!")
this.getDetail()
}
}).catch(err => this.$u.toast(err || "投票失败!"))
}
},
},