|
@@ -1,5 +1,8 @@
|
|
|
// pages/detail/index.js
|
|
|
const app = getApp();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -45,9 +48,13 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
getAcDetail(actid){
|
|
|
- app.globalData.api.activity_id({
|
|
|
- actid
|
|
|
- }).then(res => {
|
|
|
+ /**
|
|
|
+ * 8月2号改动:
|
|
|
+ * 由于 api.js 中 Get 请求是字符串拼接参数
|
|
|
+ * 原:app.globalData.api.activity_id({ actid })
|
|
|
+ * actid 被toString成 字符 [object *****] 了。故请求报错
|
|
|
+ */
|
|
|
+ app.globalData.api.activity_id(actid).then(res => {
|
|
|
let v = res.data;
|
|
|
v.shareMember = 0;
|
|
|
if (v.images) {
|
|
@@ -55,21 +62,42 @@ Page({
|
|
|
return v != '';
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
if (v.members) {
|
|
|
- v.membersList = v.members.split(';').filter(v => {
|
|
|
- return v != '';
|
|
|
- })
|
|
|
- if (v.membersList.indexOf(app.globalData.userInfo.phone || '0') > -1) {
|
|
|
- v.shareMember = 1;
|
|
|
+ /**
|
|
|
+ * 8月2日改动:
|
|
|
+ * @object v.members 在 list_public 请求中是 手机号字符串的拼接形式
|
|
|
+ * @object v.members 在 此接口中是用户对象
|
|
|
+ * 原:v.membersList = v.members.split(';').filter(v => v != '')
|
|
|
+ *
|
|
|
+ * @function setShareMember: 由于网络请求的不确定性可能会造成 userInfo
|
|
|
+ * 暂时性为 null 导致 v.membersList indexOf 报错 在获取到 userInfo 比对
|
|
|
+ * 完成后才可保存
|
|
|
+ */
|
|
|
+ v.membersList = [] // string[]
|
|
|
+ v.members.forEach(item => v.membersList.push(item.phone))
|
|
|
+ const _this = this
|
|
|
+ setShareMember()
|
|
|
+ function setShareMember() {
|
|
|
+ setTimeout(user => {
|
|
|
+ if (!user) return setShareMember()
|
|
|
+ console.log(user.phone)
|
|
|
+ if (v.membersList.indexOf(user.phone || '0') > -1) v.shareMember = 1
|
|
|
+ setThem.call(_this)
|
|
|
+ }, 50, app.globalData.userInfo)
|
|
|
}
|
|
|
}
|
|
|
- this.setData({
|
|
|
- currentActivity:v,
|
|
|
- markers: [{
|
|
|
- latitude: v.latitude || 0,
|
|
|
- longitude: v.longitude || 0
|
|
|
- }]
|
|
|
- })
|
|
|
+
|
|
|
+ function setThem() {
|
|
|
+ this.setData({
|
|
|
+ currentActivity:v,
|
|
|
+ markers: [{
|
|
|
+ latitude: v.latitude || 0,
|
|
|
+ longitude: v.longitude || 0
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
async getPhoneNumber(e) {
|