|
@@ -1,19 +1,17 @@
|
|
|
const app = require('../../utils/util.js');
|
|
|
const tools = require('../../utils/tools.js');
|
|
|
+const request = require('../../utils/request.js');
|
|
|
Page({
|
|
|
data: {
|
|
|
// 轮播
|
|
|
backgrounds: [{
|
|
|
- "pic": "/images/banner1.png",
|
|
|
- // link:'../aboutme/index',
|
|
|
+ "pic": "/images/banner1.png"
|
|
|
},
|
|
|
{
|
|
|
- "pic": "/images/banner2.png",
|
|
|
- // link:'../aboutme/index',
|
|
|
+ "pic": "/images/banner2.png"
|
|
|
},
|
|
|
{
|
|
|
- "pic": "/images/banner3.png",
|
|
|
- // link:'../aboutme/index',
|
|
|
+ "pic": "/images/banner3.png"
|
|
|
},
|
|
|
],
|
|
|
indicatorDots: true,
|
|
@@ -29,7 +27,7 @@ Page({
|
|
|
url: '/pages/userBook/userBook',
|
|
|
})
|
|
|
},
|
|
|
- goXunfang() {
|
|
|
+ goChildren() {
|
|
|
if (!wx.getStorageSync('openId')) {
|
|
|
wx.login({
|
|
|
success: res => {
|
|
@@ -42,9 +40,8 @@ Page({
|
|
|
code: res.code
|
|
|
},
|
|
|
success: res => {
|
|
|
- console.log("用户的openid:" + res.data.data.openid);
|
|
|
wx.setStorageSync('openId', res.data.data.openid)
|
|
|
- this.isBInd(res.data.data.openid);
|
|
|
+ this.isBInd();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -52,213 +49,156 @@ Page({
|
|
|
} else {
|
|
|
this.isBInd();
|
|
|
}
|
|
|
- console.log(wx.getStorageSync('openId'))
|
|
|
},
|
|
|
- // 判断是否绑定
|
|
|
+ // 判断子女是否绑定老人
|
|
|
isBInd() {
|
|
|
let id = wx.getStorageSync('openId');
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wxinfo/visitIsExist',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- openId: id
|
|
|
- // appletId: id
|
|
|
- },
|
|
|
- success: res => {
|
|
|
- if (res.data.code == 1) {
|
|
|
- console.log("用户没绑定", res);
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/visitFind/visitFind',
|
|
|
- })
|
|
|
- } else if (res.data.code == 0) {
|
|
|
- console.log("用户已经绑定了", res);
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/bindOld/bindOld',
|
|
|
- })
|
|
|
- } else {
|
|
|
- wx.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: res.data.message,
|
|
|
- })
|
|
|
- }
|
|
|
+ request.request('/wxinfo/visitIsExist', {
|
|
|
+ openId: id
|
|
|
+ }, 'GET').then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.code == 1) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/visitFind/visitFind',
|
|
|
+ })
|
|
|
+ } else if (res.data.code == 0) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/bindOld/bindOld',
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: res.data.message,
|
|
|
+ })
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
goTongzhi() {
|
|
|
- wx.login({
|
|
|
- success: (res) => {
|
|
|
- if (res.code) {
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/getAppletOpenId',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- cid: 'applet',
|
|
|
- code: res.code
|
|
|
- },
|
|
|
- success: res => {
|
|
|
- // 获取到用户的 openid
|
|
|
- if (res.data.status == 200) {
|
|
|
- wx.setStorageSync('openId', res.data.data.openid)
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/applet/isExist',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- appletsId: wx.getStorageSync('openId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- console.log('app登录是否绑定的', res.data.code);
|
|
|
- if (res.data.code == 0) {
|
|
|
- if (res.data.data) {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/notice/notice',
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- wx.redirectTo({
|
|
|
- url: '/pages/login/login',
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log('获取用户登录态失败!' + res.errMsg);
|
|
|
+ tools.rzStatus().then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ if (res.data.data) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/notice/notice',
|
|
|
+ })
|
|
|
}
|
|
|
+ } else {
|
|
|
+ wx.clearStorageSync();
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: '当前您未登录,请登录',
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- // if (wx.getStorageSync('user') == '') {
|
|
|
- // wx.redirectTo({
|
|
|
- // url: '/pages/login/login',
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '/pages/notice/notice',
|
|
|
- // })
|
|
|
- // }
|
|
|
},
|
|
|
goPaiming() {
|
|
|
- wx.login({
|
|
|
- success: (res) => {
|
|
|
- if (res.code) {
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/getAppletOpenId',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- cid: 'applet',
|
|
|
- code: res.code
|
|
|
- },
|
|
|
- success: res => {
|
|
|
- // 获取到用户的 openid
|
|
|
- if (res.data.status == 200) {
|
|
|
- wx.setStorageSync('openId', res.data.data.openid)
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/applet/isExist',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- appletsId: wx.getStorageSync('openId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- console.log('app登录是否绑定的', res.data.code);
|
|
|
- if (res.data.code == 0) {
|
|
|
- if (res.data.data) {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/paiming/paiming',
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- wx.redirectTo({
|
|
|
- url: '/pages/login/login',
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ tools.rzStatus().then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ if (res.data.data) {
|
|
|
+ tools.finishInfo().then((res) => {
|
|
|
+ console.log(res.data.data.perfect, '我完善信息了吗 1代表完后 0代表未完成')
|
|
|
+ console.log(res.data.data.comparison, '我人脸识别过了吗 1代表完后 0代表未完成')
|
|
|
+ if (res.data.data.perfect == '0') {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/finishInfo/finishInfo',
|
|
|
+ })
|
|
|
+ return;
|
|
|
}
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log('获取用户登录态失败!' + res.errMsg);
|
|
|
+ if (res.data.data.perfect == '1' && res.data.data.comparison == '0') {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/faceRecognition/faceRecognition',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/paiming/paiming',
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
+ } else {
|
|
|
+ wx.clearStorageSync();
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: '当前您未登录,请登录',
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
goSaoMa() {
|
|
|
- wx.login({
|
|
|
- success: (res) => {
|
|
|
- if (res.code) {
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/getAppletOpenId',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- cid: 'applet',
|
|
|
- code: res.code
|
|
|
- },
|
|
|
- success: res => {
|
|
|
- // 获取到用户的 openid
|
|
|
- if (res.data.status == 200) {
|
|
|
- wx.setStorageSync('openId', res.data.data.openid)
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/applet/isExist',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- appletsId: wx.getStorageSync('openId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- console.log('app登录是否绑定的', res.data.code);
|
|
|
- if (res.data.code == 0) {
|
|
|
- if (res.data.data) {
|
|
|
- wx.scanCode({
|
|
|
- onlyFromCamera: true,
|
|
|
- success: (res) => {
|
|
|
- console.log(res, "扫码成功");
|
|
|
- let length = res.result.substring(res.result.lastIndexOf('/') + 1, res.result.length)
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/love/love?id=' + length,
|
|
|
- })
|
|
|
- },
|
|
|
- fail: (res) => {
|
|
|
- console.log(res, "扫码失败");
|
|
|
- wx.showToast({
|
|
|
- title: '扫码失败',
|
|
|
- icon: 'none',
|
|
|
- duration: 2000,
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- wx.redirectTo({
|
|
|
- url: '/pages/login/login',
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ tools.rzStatus().then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ if (res.data.data) {
|
|
|
+ tools.finishInfo().then((res) => {
|
|
|
+ console.log(res.data.data.perfect, '我完善信息了吗 1代表完后 0代表未完成')
|
|
|
+ console.log(res.data.data.comparison, '我人脸识别过了吗 1代表完后 0代表未完成')
|
|
|
+ if (res.data.data.perfect == '0') {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/finishInfo/finishInfo',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (res.data.data.perfect == '1' && res.data.data.comparison == '0') {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/faceRecognition/faceRecognition',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.scanCode({
|
|
|
+ onlyFromCamera: true,
|
|
|
+ success: (res) => {
|
|
|
+ let length = res.result.substring(res.result.lastIndexOf('/') + 1, res.result.length)
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/love/love?id=' + length,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ wx.showToast({
|
|
|
+ title: '扫码失败',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000,
|
|
|
})
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log('获取用户登录态失败!' + res.errMsg);
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
+ } else {
|
|
|
+ wx.clearStorageSync();
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: '当前您未登录,请登录',
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
depts() {
|
|
|
- console.log("1111111111111111111111111111");
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/applet/homeStatistics',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- appletsId: wx.getStorageSync('openId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- console.log("resrrrrrrrrrrrrrrrrrrrrrrr", res);
|
|
|
-
|
|
|
- if (res.data.code == 0) {
|
|
|
- this.setData({
|
|
|
- number: res.data.data
|
|
|
- })
|
|
|
- }
|
|
|
+ request.request('/applet/homeStatistics', {
|
|
|
+ appletsId: wx.getStorageSync('openId')
|
|
|
+ }, 'GET').then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.setData({
|
|
|
+ number: res.data.data
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -266,140 +206,53 @@ Page({
|
|
|
this.setData({
|
|
|
msgList: []
|
|
|
})
|
|
|
- wx.login({
|
|
|
- success: (res) => {
|
|
|
- if (res.code) {
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/getAppletOpenId',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- cid: 'applet',
|
|
|
- code: res.code
|
|
|
- },
|
|
|
- success: res => {
|
|
|
- // 获取到用户的 openid
|
|
|
- if (res.data.status == 200) {
|
|
|
- wx.setStorageSync('openId', res.data.data.openid)
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/applet/isExist',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- appletsId: wx.getStorageSync('openId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- console.log('app登录是否绑定的', res.data.code);
|
|
|
- if (res.data.code == 0) {
|
|
|
- if (res.data.data) {
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/appletNotice/listForAppletsFirst',
|
|
|
- method: "GET",
|
|
|
- header: {
|
|
|
- appletsId: wx.getStorageSync('openId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- if (res.data.data.length == 0) {
|
|
|
- this.data.msgList.push({
|
|
|
- title: '暂无通知'
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- msgList: this.data.msgList
|
|
|
- })
|
|
|
- } else {
|
|
|
- let result = res.data.data.title;
|
|
|
- this.data.msgList.push({
|
|
|
- title: result
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- msgList: this.data.msgList
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/welcomeMessage/list',
|
|
|
- method: "GET",
|
|
|
- success: (res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- if (res.data.data.length != 0) {
|
|
|
- let result = res.data.data[0].title
|
|
|
- this.data.msgList.push({
|
|
|
- title: result
|
|
|
- });
|
|
|
- this.data.msgList.push({
|
|
|
- title: result
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- msgList: this.data.msgList
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ tools.rzStatus().then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ if (res.data.data) {
|
|
|
+ request.request('/appletNotice/listForAppletsFirst', {
|
|
|
+ appletsId: wx.getStorageSync('openId')
|
|
|
+ }, 'GET').then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ if (res.data.data.length == 0) {
|
|
|
+ this.data.msgList.push({
|
|
|
+ title: '暂无通知'
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ msgList: this.data.msgList
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let result = res.data.data.title;
|
|
|
+ this.data.msgList.push({
|
|
|
+ title: result
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ msgList: this.data.msgList
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log('获取用户登录态失败!' + res.errMsg);
|
|
|
+ })
|
|
|
}
|
|
|
+ } else {
|
|
|
+ request.request('/welcomeMessage/list', {}, 'GET').then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ if (res.data.data.length != 0) {
|
|
|
+ let result = res.data.data[0].title
|
|
|
+ this.data.msgList.push({
|
|
|
+ title: result
|
|
|
+ });
|
|
|
+ this.data.msgList.push({
|
|
|
+ title: result
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ msgList: this.data.msgList
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- // if (wx.getStorageSync('user') == '') {
|
|
|
- // wx.request({
|
|
|
- // url: app.globalData.publicUrl + '/welcomeMessage/list',
|
|
|
- // method: "GET",
|
|
|
- // success: (res) => {
|
|
|
- // if (res.data.code == 0) {
|
|
|
- // if (res.data.data.length != 0) {
|
|
|
- // let result = res.data.data[0].title
|
|
|
- // this.data.msgList.push({
|
|
|
- // title: result
|
|
|
- // });
|
|
|
- // this.data.msgList.push({
|
|
|
- // title: result
|
|
|
- // });
|
|
|
- // this.setData({
|
|
|
- // msgList: this.data.msgList
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // wx.request({
|
|
|
- // url: app.globalData.publicUrl + '/appletNotice/listForAppletsFirst',
|
|
|
- // method: "GET",
|
|
|
- // header: {
|
|
|
- // appletsId: wx.getStorageSync('openId')
|
|
|
- // },
|
|
|
- // success: (res) => {
|
|
|
- // if (res.data.code == 0) {
|
|
|
- // if (res.data.data.length == 0) {
|
|
|
- // this.data.msgList.push({
|
|
|
- // title: '暂无通知'
|
|
|
- // });
|
|
|
- // this.setData({
|
|
|
- // msgList: this.data.msgList
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // let result = res.data.data.title;
|
|
|
- // this.data.msgList.push({
|
|
|
- // title: result
|
|
|
- // });
|
|
|
- // this.setData({
|
|
|
- // msgList: this.data.msgList
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
},
|
|
|
onShow() {
|
|
|
this.depts();
|