流程再次大调整

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

View File

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