Compare commits

...

3 Commits

Author SHA1 Message Date
kk e12663052f 查询用户信息接口增加open_id参数
Uni-app H5 Deploy (Prod + Staging) / deploy (release) Successful in 47s
2026-07-11 20:21:58 +08:00
kk 842defea21 注册成功后保存用户id与手机号
Uni-app H5 Deploy (Prod + Staging) / deploy (release) Successful in 44s
2026-07-11 18:30:16 +08:00
kk d392ff98b7 apiBaseUrl改成https
Uni-app H5 Deploy (Prod + Staging) / deploy (release) Successful in 41s
2026-07-11 18:22:44 +08:00
3 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
*/ */
const prod = { const prod = {
// 业务 API 地址(vms-api // 业务 API 地址(vms-api
apiBaseUrl: 'http://101.200.86.98:4000', apiBaseUrl: 'https://vmsapi.arklinksmart.cn',
// 网关地址(vms-gateway)— 用户授权、短信等接口走网关 // 网关地址(vms-gateway)— 用户授权、短信等接口走网关
apiGatewayUrl: 'https://gateway.arklinksmart.cn', apiGatewayUrl: 'https://gateway.arklinksmart.cn',
+2 -1
View File
@@ -415,7 +415,8 @@ export default {
// 检查用户信息,若缓存中没有则调接口获取 // 检查用户信息,若缓存中没有则调接口获取
if (!this.userId) { if (!this.userId) {
try { try {
const infoRes = await gatewayGet('/api/v1/user/info', {}); const openId = uni.getStorageSync('openid') || '';
const infoRes = await gatewayGet('/api/v1/user/info', { open_id: openId });
const infoData = (infoRes.data || {}).data || {}; const infoData = (infoRes.data || {}).data || {};
if (infoData.user_id) { if (infoData.user_id) {
const existing = getCachedUserInfo() || {}; const existing = getCachedUserInfo() || {};
+6 -3
View File
@@ -183,15 +183,18 @@ export default {
}); });
const ret = res.data || {}; const ret = res.data || {};
console.log('[register] 注册响应:', JSON.stringify(ret, null, 2));
if (ret.code === 0 && ret.data) { if (ret.code === 0 && ret.data) {
// 保存 token // 保存 token
uni.setStorageSync('token', ret.data.token); uni.setStorageSync('token', ret.data.token);
// 存储 user_info至少有 user_id 就能开门 // 存储 user_info接口返回 user_info.user_id 和 phone
const existing = uni.getStorageSync('user_info') || {}; const existing = uni.getStorageSync('user_info') || {};
const apiUserInfo = ret.data.user_info || {};
const userInfo = { const userInfo = {
user_id: ret.data.user_id || existing.user_id || '', user_id: apiUserInfo.user_id || existing.user_id || '',
phone: this.phone || existing.phone || '', phone: apiUserInfo.phone || this.phone || existing.phone || '',
nickname: existing.nickname || '', nickname: existing.nickname || '',
avatar: existing.avatar || '', avatar: existing.avatar || '',
}; };