diff --git a/api/index.js b/api/index.js
index ec65915..246ee23 100644
--- a/api/index.js
+++ b/api/index.js
@@ -2,13 +2,12 @@
import BASE_URL from './base.js';
import useNetWork from '@/common/useNetWork.js';
-const UPDATE_IMG = BASE_URL + '/user/updateUserImg';
+const GET_USER_INFO = BASE_URL + '/user/userLogin';
-export function updateImg(fileId, uid) {
+export function getUserInfo(phone) {
useNetWork();
const params = {
- fileId: fileId,
- uid: uid,
+ phoneCode: phone,
};
- return fetch.post(UPDATE_IMG, params).then(res => res);
+ return fetch.post(GET_USER_INFO, params).then(res => res);
}
\ No newline at end of file
diff --git a/api/index.js b/api/index.js
index ec65915..246ee23 100644
--- a/api/index.js
+++ b/api/index.js
@@ -2,13 +2,12 @@
import BASE_URL from './base.js';
import useNetWork from '@/common/useNetWork.js';
-const UPDATE_IMG = BASE_URL + '/user/updateUserImg';
+const GET_USER_INFO = BASE_URL + '/user/userLogin';
-export function updateImg(fileId, uid) {
+export function getUserInfo(phone) {
useNetWork();
const params = {
- fileId: fileId,
- uid: uid,
+ phoneCode: phone,
};
- return fetch.post(UPDATE_IMG, params).then(res => res);
+ return fetch.post(GET_USER_INFO, params).then(res => res);
}
\ No newline at end of file
diff --git a/common/fetch.js b/common/fetch.js
index ff5a1ed..1efb372 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -24,12 +24,20 @@
if (data.data.code === 200) {
resolve(data.data.data);
} else if (data.data.code === 2401) {
- //登陆过期
+ uni.showToast({
+ title: `登录过期,正在重新登录`,
+ icon: "none",
+ duration: 2000,
+ });
getLogin();
- } else {
+ resolve(data.data.message);
+ } else if (data.data.code === 500 && data.data.message === '您的账号未注册,请先注册' ||
+ data.data.code === 2402) {
+ resolve('用户未注册');
+ } else {
uni.showToast({
title: "系统异常,请稍后再试!",
- title: `${data.data.message}`,
+ // title: `${data.data.message}`,
icon: "none",
duration: 2000,
});
diff --git a/api/index.js b/api/index.js
index ec65915..246ee23 100644
--- a/api/index.js
+++ b/api/index.js
@@ -2,13 +2,12 @@
import BASE_URL from './base.js';
import useNetWork from '@/common/useNetWork.js';
-const UPDATE_IMG = BASE_URL + '/user/updateUserImg';
+const GET_USER_INFO = BASE_URL + '/user/userLogin';
-export function updateImg(fileId, uid) {
+export function getUserInfo(phone) {
useNetWork();
const params = {
- fileId: fileId,
- uid: uid,
+ phoneCode: phone,
};
- return fetch.post(UPDATE_IMG, params).then(res => res);
+ return fetch.post(GET_USER_INFO, params).then(res => res);
}
\ No newline at end of file
diff --git a/common/fetch.js b/common/fetch.js
index ff5a1ed..1efb372 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -24,12 +24,20 @@
if (data.data.code === 200) {
resolve(data.data.data);
} else if (data.data.code === 2401) {
- //登陆过期
+ uni.showToast({
+ title: `登录过期,正在重新登录`,
+ icon: "none",
+ duration: 2000,
+ });
getLogin();
- } else {
+ resolve(data.data.message);
+ } else if (data.data.code === 500 && data.data.message === '您的账号未注册,请先注册' ||
+ data.data.code === 2402) {
+ resolve('用户未注册');
+ } else {
uni.showToast({
title: "系统异常,请稍后再试!",
- title: `${data.data.message}`,
+ // title: `${data.data.message}`,
icon: "none",
duration: 2000,
});
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 4c359eb..c2e5e0a 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -15,6 +15,7 @@
import { mapMutations } from 'vuex';
import TabBar from '@/components/tabBar/tabBar.vue';
import { getLogin } from '@/utils/auth.js';
+ import { getUserInfo } from '@/api/index.js';
export default {
components: {
TabBar,
@@ -31,7 +32,8 @@
id: 'check',
name: '物联设备状态查看'
},
- ]
+ ],
+ phone: '',
}
},
onLoad() {
@@ -49,12 +51,22 @@
},
methods: {
// ...mapMutations(['setNavRect'])
- handleClick(id) {
- if(id=="submit"){
- wx.navigateTo({
- url: `/pages/information/information?id=${id}`,
-
+ async handleClick(id) {
+ //如果this.phone为空,先弹出获取手机号,得到手机号之后验证此人是都注册过
+
+ let phone = '18342910967'; //先将手机号写死
+ const res = await getUserInfo(phone);
+ if(res === '用户未注册') {
+ wx.reLaunch({
+ url: '/pages/register/register'
});
+ } else {
+ if(id=="submit"){
+ wx.navigateTo({
+ url: `/pages/information/information?id=${id}`,
+
+ });
+ }
}
}
}
diff --git a/api/index.js b/api/index.js
index ec65915..246ee23 100644
--- a/api/index.js
+++ b/api/index.js
@@ -2,13 +2,12 @@
import BASE_URL from './base.js';
import useNetWork from '@/common/useNetWork.js';
-const UPDATE_IMG = BASE_URL + '/user/updateUserImg';
+const GET_USER_INFO = BASE_URL + '/user/userLogin';
-export function updateImg(fileId, uid) {
+export function getUserInfo(phone) {
useNetWork();
const params = {
- fileId: fileId,
- uid: uid,
+ phoneCode: phone,
};
- return fetch.post(UPDATE_IMG, params).then(res => res);
+ return fetch.post(GET_USER_INFO, params).then(res => res);
}
\ No newline at end of file
diff --git a/common/fetch.js b/common/fetch.js
index ff5a1ed..1efb372 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -24,12 +24,20 @@
if (data.data.code === 200) {
resolve(data.data.data);
} else if (data.data.code === 2401) {
- //登陆过期
+ uni.showToast({
+ title: `登录过期,正在重新登录`,
+ icon: "none",
+ duration: 2000,
+ });
getLogin();
- } else {
+ resolve(data.data.message);
+ } else if (data.data.code === 500 && data.data.message === '您的账号未注册,请先注册' ||
+ data.data.code === 2402) {
+ resolve('用户未注册');
+ } else {
uni.showToast({
title: "系统异常,请稍后再试!",
- title: `${data.data.message}`,
+ // title: `${data.data.message}`,
icon: "none",
duration: 2000,
});
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 4c359eb..c2e5e0a 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -15,6 +15,7 @@
import { mapMutations } from 'vuex';
import TabBar from '@/components/tabBar/tabBar.vue';
import { getLogin } from '@/utils/auth.js';
+ import { getUserInfo } from '@/api/index.js';
export default {
components: {
TabBar,
@@ -31,7 +32,8 @@
id: 'check',
name: '物联设备状态查看'
},
- ]
+ ],
+ phone: '',
}
},
onLoad() {
@@ -49,12 +51,22 @@
},
methods: {
// ...mapMutations(['setNavRect'])
- handleClick(id) {
- if(id=="submit"){
- wx.navigateTo({
- url: `/pages/information/information?id=${id}`,
-
+ async handleClick(id) {
+ //如果this.phone为空,先弹出获取手机号,得到手机号之后验证此人是都注册过
+
+ let phone = '18342910967'; //先将手机号写死
+ const res = await getUserInfo(phone);
+ if(res === '用户未注册') {
+ wx.reLaunch({
+ url: '/pages/register/register'
});
+ } else {
+ if(id=="submit"){
+ wx.navigateTo({
+ url: `/pages/information/information?id=${id}`,
+
+ });
+ }
}
}
}
diff --git a/pages/register/register.vue b/pages/register/register.vue
index 2210d61..35f0c52 100644
--- a/pages/register/register.vue
+++ b/pages/register/register.vue
@@ -49,7 +49,7 @@
labelWidth="80"
class="form-item"
>
-
{{ form.phone || "获取手机号" }}
-
+ -->
+
diff --git a/api/index.js b/api/index.js
index ec65915..246ee23 100644
--- a/api/index.js
+++ b/api/index.js
@@ -2,13 +2,12 @@
import BASE_URL from './base.js';
import useNetWork from '@/common/useNetWork.js';
-const UPDATE_IMG = BASE_URL + '/user/updateUserImg';
+const GET_USER_INFO = BASE_URL + '/user/userLogin';
-export function updateImg(fileId, uid) {
+export function getUserInfo(phone) {
useNetWork();
const params = {
- fileId: fileId,
- uid: uid,
+ phoneCode: phone,
};
- return fetch.post(UPDATE_IMG, params).then(res => res);
+ return fetch.post(GET_USER_INFO, params).then(res => res);
}
\ No newline at end of file
diff --git a/common/fetch.js b/common/fetch.js
index ff5a1ed..1efb372 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -24,12 +24,20 @@
if (data.data.code === 200) {
resolve(data.data.data);
} else if (data.data.code === 2401) {
- //登陆过期
+ uni.showToast({
+ title: `登录过期,正在重新登录`,
+ icon: "none",
+ duration: 2000,
+ });
getLogin();
- } else {
+ resolve(data.data.message);
+ } else if (data.data.code === 500 && data.data.message === '您的账号未注册,请先注册' ||
+ data.data.code === 2402) {
+ resolve('用户未注册');
+ } else {
uni.showToast({
title: "系统异常,请稍后再试!",
- title: `${data.data.message}`,
+ // title: `${data.data.message}`,
icon: "none",
duration: 2000,
});
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 4c359eb..c2e5e0a 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -15,6 +15,7 @@
import { mapMutations } from 'vuex';
import TabBar from '@/components/tabBar/tabBar.vue';
import { getLogin } from '@/utils/auth.js';
+ import { getUserInfo } from '@/api/index.js';
export default {
components: {
TabBar,
@@ -31,7 +32,8 @@
id: 'check',
name: '物联设备状态查看'
},
- ]
+ ],
+ phone: '',
}
},
onLoad() {
@@ -49,12 +51,22 @@
},
methods: {
// ...mapMutations(['setNavRect'])
- handleClick(id) {
- if(id=="submit"){
- wx.navigateTo({
- url: `/pages/information/information?id=${id}`,
-
+ async handleClick(id) {
+ //如果this.phone为空,先弹出获取手机号,得到手机号之后验证此人是都注册过
+
+ let phone = '18342910967'; //先将手机号写死
+ const res = await getUserInfo(phone);
+ if(res === '用户未注册') {
+ wx.reLaunch({
+ url: '/pages/register/register'
});
+ } else {
+ if(id=="submit"){
+ wx.navigateTo({
+ url: `/pages/information/information?id=${id}`,
+
+ });
+ }
}
}
}
diff --git a/pages/register/register.vue b/pages/register/register.vue
index 2210d61..35f0c52 100644
--- a/pages/register/register.vue
+++ b/pages/register/register.vue
@@ -49,7 +49,7 @@
labelWidth="80"
class="form-item"
>
-
{{ form.phone || "获取手机号" }}
-
+ -->
+
diff --git a/utils/auth.js b/utils/auth.js
index 455a130..baeb1ff 100644
--- a/utils/auth.js
+++ b/utils/auth.js
@@ -20,6 +20,11 @@
console.log('登录参数', data, uni.getStorageSync('sessionId'))
login(data.code).then(res => {
uni.setStorageSync('sessionId', res);
+ uni.showToast({
+ title: `登录成功`,
+ icon: "none",
+ duration: 2000,
+ });
resolve('登录成功');
});
},