Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e12663052f | |||
| 842defea21 | |||
| d392ff98b7 |
+1
-1
@@ -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',
|
||||||
|
|||||||
@@ -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() || {};
|
||||||
|
|||||||
@@ -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 || '',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user