From 7b09a9950f13521190a4aef9bbc2a6163445566c Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期二, 03 三月 2026 18:01:03 +0800
Subject: [PATCH] 小程序 接口开发
---
mini-program/components/login/login.vue | 36 +++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/mini-program/components/login/login.vue b/mini-program/components/login/login.vue
index 56ebcb3..8363ae2 100644
--- a/mini-program/components/login/login.vue
+++ b/mini-program/components/login/login.vue
@@ -47,21 +47,31 @@
this.show = false
},
getphonenumber(e) {
+ var that = this;
if (e.detail.errMsg === 'getPhoneNumber:ok') {
- this.$u.api.wxPhone({
- code: e.detail.code,
- shopId:this.recshopid,
- recId:this.recuserid,
- openid: this.openid
- }).then(res => {
- if (res.code === 200) {
- this.$store.commit('setUserInfo', res.data.member)
- this.$store.commit('setToken', res.data.token)
- this.$store.commit('setRecShopId','')
- this.$store.commit('setRecUserId','')
- this.close()
+ uni.login({
+ provider: 'weixin',
+ success: async function (loginRes) {
+ let { code } = loginRes;
+ let res = await that.$u.api.wxLogin({ code })
+ if (res.code === 200) {
+ that.$u.api.wxPhone({
+ code: e.detail.code,
+ shopId:that.recshopid,
+ recId:that.recuserid,
+ openid: res.data.openid
+ }).then(res => {
+ if (res.code === 200) {
+ that.$store.commit('setUserInfo', res.data.member)
+ that.$store.commit('setToken', res.data.token)
+ that.$store.commit('setRecShopId','')
+ that.$store.commit('setRecUserId','')
+ that.close()
+ }
+ })
+ }
}
- })
+ });
}
}
}
--
Gitblit v1.9.3