From 2f812e33de0e2507ab87b0b458faad788c52b7a4 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 17 七月 2025 09:26:43 +0800
Subject: [PATCH] 前端
---
small-program/App.vue | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/small-program/App.vue b/small-program/App.vue
index a981323..22c1eea 100644
--- a/small-program/App.vue
+++ b/small-program/App.vue
@@ -1,7 +1,27 @@
<script>
+ import { mapState } from 'vuex'
export default {
+ computed: {
+ ...mapState(['userInfo','openid'])
+ },
onLaunch: function() {
- console.log('App Launch')
+ var that = this;
+ console.log(this.userInfo)
+ if (!this.userInfo || JSON.stringify(this.userInfo) == '{}') {
+ uni.login({
+ provider: 'weixin',
+ success: async function (loginRes) {
+ let { code } = loginRes;
+ let res = await that.$u.api.wxLogin({ code })
+ if (res.code === 200) {
+ that.$store.commit('setToken', res.data.token)
+ that.$store.commit('setOpenid', res.data.openid)
+ that.$store.commit('setUserInfo', res.data.member)
+ that.$isResolve()
+ }
+ }
+ });
+ }
},
onShow: function() {
console.log('App Show')
@@ -13,6 +33,5 @@
</script>
<style lang="scss">
- /* 娉ㄦ剰瑕佸啓鍦ㄧ涓�琛岋紝鍚屾椂缁檚tyle鏍囩鍔犲叆lang="scss"灞炴�� */
- @import "uview-ui/index.scss";
+ @import "uview-ui/index.scss";
</style>
\ No newline at end of file
--
Gitblit v1.9.3