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"/>
</AiGroup>
<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>
</template>
<script>
import {mapState} from "vuex"
import WeixinLogin from "./weixinLogin";
import WeixinLogin from "./component/weixinLogin";
export default {
name: "AppVote",
@@ -33,7 +33,7 @@ export default {
return {
detail: {},
list: [],
wxLogin: false
wxLogin: 0
}
},
computed: {
@@ -60,7 +60,7 @@ export default {
})
},
handleDetail(id) {
if (!this.user.token) this.wxLogin = true
if (!this.user.token) this.wxLogin++
else uni.navigateTo({url: './voteDetail?id=' + id})
}
},

View File

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