This commit is contained in:
aixianling
2023-01-03 17:13:48 +08:00
parent 04664e58b3
commit 2c4e83a19b
2 changed files with 11 additions and 8 deletions

View File

@@ -17,13 +17,13 @@
<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||wxLogin" content="投票需要您授权您的微信信息" @login="getList"/> <weixin-login :autoShow="!user.token" :visible.sync="wxLogin" content="投票需要您授权您的微信信息" @login="getList"/>
</section> </section>
</template> </template>
<script> <script>
import {mapState} from "vuex" import {mapState} from "vuex"
import WeixinLogin from "./weixinLogin"; import WeixinLogin from "./component/weixinLogin";
export default { export default {
name: "AppVote", name: "AppVote",
@@ -33,7 +33,7 @@ export default {
return { return {
detail: {}, detail: {},
list: [], list: [],
wxLogin: false wxLogin: 0
} }
}, },
computed: { computed: {
@@ -60,7 +60,7 @@ export default {
}) })
}, },
handleDetail(id) { handleDetail(id) {
if (!this.user.token) this.wxLogin = true if (!this.user.token) this.wxLogin++
else uni.navigateTo({url: './voteDetail?id=' + id}) else uni.navigateTo({url: './voteDetail?id=' + id})
} }
}, },

View File

@@ -12,7 +12,8 @@ export default {
name: "weixinLogin", name: "weixinLogin",
props: { props: {
content: {default: "是否要进行微信授权?"}, content: {default: "是否要进行微信授权?"},
autoShow: Boolean autoShow: Boolean,
visible: {default: ""}
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
@@ -20,8 +21,7 @@ export default {
}, },
data() { data() {
return { return {
show: false, show: false
appid: ""
} }
}, },
methods: { methods: {
@@ -50,7 +50,7 @@ export default {
} }
}), 500) }), 500)
}) })
} },
}, },
watch: { watch: {
autoShow: { autoShow: {
@@ -58,6 +58,9 @@ export default {
handler(v) { handler(v) {
this.wxCode ? this.autoLogin() : this.show = !!v this.wxCode ? this.autoLogin() : this.show = !!v
} }
},
visible(v) {
this.show = !!v
} }
} }
} }