diff --git a/cloudfunctions/setMyWatch/index.js b/cloudfunctions/setMyWatch/index.js
index 8fd8be330bca347aca190d312bb5e1fa6b0764ed..cafed583e2b02d89474606ea88fae2ee0cc23e7b 100644
--- a/cloudfunctions/setMyWatch/index.js
+++ b/cloudfunctions/setMyWatch/index.js
@@ -9,23 +9,24 @@ const db = cloud.database()
exports.main = async(event, context) => {
const wxContext = cloud.getWXContext();
-
+ let { type } = event
try {
let result = await db.collection("myWatch").where({
openid: wxContext.OPENID
}).get();
if (result.data && result.data.length > 0) {
- let { watch, _id } = result.data[0];
- let hasWatch = watch.find(val => val == event.id);
+ let data = result.data[0];
+ let _id = data._id
+ let hasWatch = data[type].find(val => val == event.id);
if (hasWatch) { //原本已经这个项目的ID
return {
isChange: false
}
} else {
- watch.push(event.id);
+ data[type].push(event.id);
return await db.collection('myWatch').doc(_id).update({
data: {
- watch
+ [type]:data[type]
}
})
}
@@ -33,7 +34,8 @@ exports.main = async(event, context) => {
return await db.collection('myWatch').add({
data: {
openid: wxContext.OPENID,
- watch: [event.id]
+ watch:type=='watch'?[event.id]:[],
+ benefit:type=='benefit'?[event.id]:[]
}
})
}
diff --git a/miniprogram/pages/baby/detail.js b/miniprogram/pages/baby/detail.js
index ed43a33793a117ff7a210041859244c5ed65faf1..910d553f37c0af2eff283079cdc7fe5623ae2637 100644
--- a/miniprogram/pages/baby/detail.js
+++ b/miniprogram/pages/baby/detail.js
@@ -56,7 +56,8 @@ Page({
wx.cloud.callFunction({
name: 'setMyWatch',
data: {
- id: this.data.id
+ id: this.data.id,
+ type:'watch'
},
complete: function(data){
if(data.result.isChange!==false){
diff --git a/miniprogram/pages/baby/detail.json b/miniprogram/pages/baby/detail.json
index 1a817a907f865a41e32b139007413540e11f5382..cc4eecf3474cf0baa6dd5dddbaeea6fe8e416866 100644
--- a/miniprogram/pages/baby/detail.json
+++ b/miniprogram/pages/baby/detail.json
@@ -4,6 +4,6 @@
"navigationBarTitleText": "宝贝回家",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "dark",
- "enablePullDownRefresh": true,
+ "enablePullDownRefresh": false,
"usingComponents": {}
}
\ No newline at end of file
diff --git a/miniprogram/pages/baby/detail.wxml b/miniprogram/pages/baby/detail.wxml
index dc13d1465edade0b509d2f03e5e06109077ab070..1c387f48303433ae5c92d72905e99cb78028fdb8 100644
--- a/miniprogram/pages/baby/detail.wxml
+++ b/miniprogram/pages/baby/detail.wxml
@@ -9,7 +9,7 @@
性别:{{babyInfo.sex}}
生日:{{babyInfo.birthday}}
-
+
失踪信息
失踪地点:{{babyInfo.missing.region}}{{babyInfo.missing.city}}{{babyInfo.missing.address}}
失踪时间:{{babyInfo.missing.time}}
diff --git a/miniprogram/pages/baby/index.json b/miniprogram/pages/baby/index.json
index 1a817a907f865a41e32b139007413540e11f5382..cc4eecf3474cf0baa6dd5dddbaeea6fe8e416866 100644
--- a/miniprogram/pages/baby/index.json
+++ b/miniprogram/pages/baby/index.json
@@ -4,6 +4,6 @@
"navigationBarTitleText": "宝贝回家",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "dark",
- "enablePullDownRefresh": true,
+ "enablePullDownRefresh": false,
"usingComponents": {}
}
\ No newline at end of file
diff --git a/miniprogram/pages/baby/index.wxss b/miniprogram/pages/baby/index.wxss
index 59e281fa94683b1f85b64908141da824a9fc8629..07224128d7ea19a6bb0e9f586df751ef11d810e6 100644
--- a/miniprogram/pages/baby/index.wxss
+++ b/miniprogram/pages/baby/index.wxss
@@ -27,3 +27,8 @@
.bot_info{
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
+
+.baby_place{
+ max-height: 32rpx;
+ overflow: hidden;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/benefit/detail.js b/miniprogram/pages/benefit/detail.js
index 5b88b482615fde576c6230828883973ceac0bf37..d848a9e91dd419473ab46becf95fc955a7ba02b5 100644
--- a/miniprogram/pages/benefit/detail.js
+++ b/miniprogram/pages/benefit/detail.js
@@ -33,11 +33,12 @@ Page({
name: 'getMyWatch',
// 传给云函数的参数
data: {
+ type:'benefit'
},
// 成功回调
complete: function(data){
let res = data.result;
- let myWatch = res.data[0]&&res.data[0].watch || []
+ let myWatch = res.data[0]&&res.data[0].benefit || []
let isFocused;
if([].indexOf.call(myWatch,options.id)!==-1){
isFocused = 1
@@ -56,7 +57,8 @@ Page({
wx.cloud.callFunction({
name: 'setMyWatch',
data: {
- id: this.data.id
+ id: this.data.id,
+ type:'benefit'
},
complete: function(data){
if(data.result.isChange!==false){
diff --git a/miniprogram/pages/benefit/detail.json b/miniprogram/pages/benefit/detail.json
index 71c89a4c64ebd15854d0a088268f5bffdb398e88..82744df8d3280f22c1771be9dd2b9dfffff87547 100644
--- a/miniprogram/pages/benefit/detail.json
+++ b/miniprogram/pages/benefit/detail.json
@@ -4,6 +4,6 @@
"navigationBarTitleText": "公益援助",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "dark",
- "enablePullDownRefresh": true,
+ "enablePullDownRefresh": false,
"usingComponents": {}
}
\ No newline at end of file
diff --git a/miniprogram/pages/benefit/index.json b/miniprogram/pages/benefit/index.json
index 71c89a4c64ebd15854d0a088268f5bffdb398e88..82744df8d3280f22c1771be9dd2b9dfffff87547 100644
--- a/miniprogram/pages/benefit/index.json
+++ b/miniprogram/pages/benefit/index.json
@@ -4,6 +4,6 @@
"navigationBarTitleText": "公益援助",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "dark",
- "enablePullDownRefresh": true,
+ "enablePullDownRefresh": false,
"usingComponents": {}
}
\ No newline at end of file
diff --git a/miniprogram/pages/find/detail.js b/miniprogram/pages/find/detail.js
index f33bcaf3dc61e21889bae1abc87c2447b2439eb6..8a340959d24d20ca470fcedf28c15f5f0f82c670 100644
--- a/miniprogram/pages/find/detail.js
+++ b/miniprogram/pages/find/detail.js
@@ -1,18 +1,78 @@
-// miniprogram/pages/find/detail.js
+// miniprogram/pages/home/detail.js
Page({
/**
* 页面的初始数据
*/
data: {
-
+ id:'',
+ isFocused:false,
+ babyInfo:{}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
+ this.setData({
+ id: options.id
+ })
+ var that = this;
+ const db = wx.cloud.database()
+ db.collection('findPersonList').where({
+ _id: options.id
+ }).get({
+ success: function (res) {
+ that.setData({ babyInfo: res.data&&res.data[0]||{} })
+ }
+ })
+
+
+ wx.cloud.callFunction({
+ // 需调用的云函数名
+ name: 'getMyWatch',
+ // 传给云函数的参数
+ data: {
+ },
+ // 成功回调
+ complete: function(data){
+ let res = data.result;
+ let myWatch = res.data[0]&&res.data[0].watch || []
+ let isFocused;
+ if([].indexOf.call(myWatch,options.id)!==-1){
+ isFocused = 1
+ }else{
+ isFocused = 0
+ }
+ that.setData({
+ isFocused:isFocused
+ })
+ }
+ })
+ },
+ handleTap:function(){
+ var that = this;
+ wx.cloud.callFunction({
+ name: 'setMyWatch',
+ data: {
+ id: this.data.id,
+ type:'watch'
+ },
+ complete: function(data){
+ if(data.result.isChange!==false){
+ wx.showToast({
+ title: '关注成功',
+ icon: 'success',
+ duration: 2000
+ })
+
+ that.setData({
+ isFocused:1
+ })
+ }
+ }
+ })
},
/**
diff --git a/miniprogram/pages/find/detail.json b/miniprogram/pages/find/detail.json
index 1f80f630c441ca92aa99fbd6ac8877680d1c3066..3842abadc0257e9fae1e978c05a2826935f686a2 100644
--- a/miniprogram/pages/find/detail.json
+++ b/miniprogram/pages/find/detail.json
@@ -4,6 +4,6 @@
"navigationBarTitleText": "寻亲寻人",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "dark",
- "enablePullDownRefresh": true,
+ "enablePullDownRefresh": false,
"usingComponents": {}
}
\ No newline at end of file
diff --git a/miniprogram/pages/find/detail.wxml b/miniprogram/pages/find/detail.wxml
index 5d9def4ca6ce6cba162c1922153c42782f531dd8..6c48b46908b7b5b6b58e0136b5462b77ea5bb77a 100644
--- a/miniprogram/pages/find/detail.wxml
+++ b/miniprogram/pages/find/detail.wxml
@@ -1,4 +1,4 @@
-
+
@@ -15,6 +15,9 @@
失踪时间:{{babyInfo.missing.time}}
失踪时身高:{{babyInfo.height}}
失踪时特征:{{babyInfo.description}}
+ 其他:{{babyInfo.other}}
+ 关注
+ 已关注
diff --git a/miniprogram/pages/find/detail.wxss b/miniprogram/pages/find/detail.wxss
index 60013347571cc308f14bacc1ce4ac830a81e8a73..3479e54054b131367f4fe87ac099299de9e9be25 100644
--- a/miniprogram/pages/find/detail.wxss
+++ b/miniprogram/pages/find/detail.wxss
@@ -1 +1,47 @@
-/* miniprogram/pages/find/detail.wxss */
\ No newline at end of file
+/* miniprogram/pages/find/detail.wxss */
+/* miniprogram/pages/home/detail.wxss */
+
+.top{
+ width:100%;
+ height: 600rpx;
+}
+
+.baby_img{
+ width: 100%;
+ height: 600rpx;
+}
+
+
+.info_cell{
+ font-size: 36rpx;
+ background-color:#fff;
+ padding: 10rpx 30rpx;
+ border-top: 1px solid #e6e6e6;
+ line-height:64rpx;
+}
+
+.baby_name{
+ font-weight: bold;
+ font-size: 48rpx;
+ margin: 30rpx;
+}
+
+.title{
+ margin:0 30rpx;
+ line-height:64rpx;
+}
+
+.watch_btn{
+ position: fixed;
+ right:0;
+ top: 800rpx;
+ width:160rpx;
+ height: 80rpx;
+ line-height: 80rpx;
+ text-align: center;
+ background-color:red;
+ color: white;
+ z-index: 111;
+ border-top-left-radius: 50rpx;
+ border-bottom-left-radius: 50rpx;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/find/index.js b/miniprogram/pages/find/index.js
index cc0c8affa73c84299e8922a236df01a87dc4c2ec..3968664ebcc60d10ae1f8f815367ace624cbc844 100644
--- a/miniprogram/pages/find/index.js
+++ b/miniprogram/pages/find/index.js
@@ -5,7 +5,7 @@ Page({
* 页面的初始数据
*/
data: {
- babyList: []
+ findPersonList: []
},
/**
@@ -15,9 +15,9 @@ Page({
var that = this;
const db = wx.cloud.database()
- db.collection('babyList').get({
+ db.collection('findPersonList').get({
success: function (res) {
- that.setData({ babyList: res.data })
+ that.setData({ findPersonList: res.data })
}
})
},
diff --git a/miniprogram/pages/find/index.json b/miniprogram/pages/find/index.json
index 1f80f630c441ca92aa99fbd6ac8877680d1c3066..3842abadc0257e9fae1e978c05a2826935f686a2 100644
--- a/miniprogram/pages/find/index.json
+++ b/miniprogram/pages/find/index.json
@@ -4,6 +4,6 @@
"navigationBarTitleText": "寻亲寻人",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "dark",
- "enablePullDownRefresh": true,
+ "enablePullDownRefresh": false,
"usingComponents": {}
}
\ No newline at end of file
diff --git a/miniprogram/pages/find/index.wxml b/miniprogram/pages/find/index.wxml
index d1655bc0b165653dd10b896e4b56d5fa62656838..d240ea88a2bd3fa3b537da4344abb549d843147a 100644
--- a/miniprogram/pages/find/index.wxml
+++ b/miniprogram/pages/find/index.wxml
@@ -1,9 +1,9 @@
-
+
-
+
diff --git a/miniprogram/pages/find/index.wxss b/miniprogram/pages/find/index.wxss
index 2124fcd1cb99b9a05b9a1eef3bb6ad39a4201655..31c64351b254fded4418bf1e613011ad5362db59 100644
--- a/miniprogram/pages/find/index.wxss
+++ b/miniprogram/pages/find/index.wxss
@@ -29,3 +29,8 @@
.bot_info{
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
+
+.baby_place{
+ max-height: 32rpx;
+ overflow: hidden;
+}
\ No newline at end of file