...
|
...
|
@@ -5,11 +5,13 @@ Page({ |
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
current: 0,
|
|
|
current: -1,
|
|
|
currentIndex: true,
|
|
|
tabcurrent: 3,
|
|
|
portal_post: [], //全部文章
|
|
|
portal_two: [], //全部分类
|
|
|
maskstate: false,
|
|
|
currentSort: 0,
|
|
|
sort: [{
|
|
|
id: 0,
|
|
|
name: '默认排序'
|
...
|
...
|
@@ -18,6 +20,74 @@ Page({ |
|
|
name: '热度排序'
|
|
|
}]
|
|
|
},
|
|
|
|
|
|
|
|
|
//全部tab
|
|
|
wishAllInfo(e) {
|
|
|
this.setData({
|
|
|
currentIndex: true,
|
|
|
current: -1
|
|
|
})
|
|
|
this.wishIndex()
|
|
|
},
|
|
|
|
|
|
//心愿首页接口调取
|
|
|
wishIndex() {
|
|
|
let url = '/home/wish/index'
|
|
|
let params = {}
|
|
|
let header = {
|
|
|
"XX-Token": wx.getStorageSync('token')
|
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log(res)
|
|
|
const list = res.portal_post.map((item, index) => {
|
|
|
return {
|
|
|
...item,
|
|
|
showlabel_box: false,
|
|
|
more: JSON.parse(item.more)
|
|
|
}
|
|
|
});
|
|
|
this.setData({
|
|
|
portal_post: list,
|
|
|
portal_two: res.portal_two,
|
|
|
})
|
|
|
// console.log(this.data.portal_post)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//导航点击
|
|
|
chargeTab(e) {
|
|
|
var ids = wx.setStorageSync('id',e.currentTarget.dataset.id)
|
|
|
var id=wx.getStorageSync('id')
|
|
|
var index = e.currentTarget.dataset.index;
|
|
|
this.setData({
|
|
|
currentIndex: false
|
|
|
});
|
|
|
this.setData({
|
|
|
current: index
|
|
|
});
|
|
|
if (!this.data.currentIndex) {
|
|
|
this.classifyInfo(id)
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//获取分类信息
|
|
|
classifyInfo(id) {
|
|
|
let url = '/home/wish/posts'
|
|
|
let params = {
|
|
|
id
|
|
|
}
|
|
|
let header = {
|
|
|
"XX-Token": wx.getStorageSync('token')
|
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
this.setData({
|
|
|
portal_post: res
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
//点击蒙层关闭
|
|
|
closeMask() {
|
|
|
let that = this;
|
...
|
...
|
@@ -26,6 +96,7 @@ Page({ |
|
|
is_showSort: false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//开启或关闭排序列表
|
|
|
setdown() {
|
|
|
let that = this;
|
...
|
...
|
@@ -35,15 +106,25 @@ Page({ |
|
|
showrent_mask: false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//(热度排序)
|
|
|
chooseSort(e) {
|
|
|
const current = e.currentTarget.dataset.index;
|
|
|
const index = e.currentTarget.dataset.index;
|
|
|
this.setData({
|
|
|
currentSort: current,
|
|
|
currentSort: index,
|
|
|
is_showSort: false,
|
|
|
// down: !this.data.down,
|
|
|
});
|
|
|
this.wishIndex()
|
|
|
var current = this.data.current
|
|
|
var currentIndex = this.data.currentIndex
|
|
|
var id = wx.getStorageSync('id')
|
|
|
console.log(id)
|
|
|
if (currentIndex) {
|
|
|
this.wishIndex()
|
|
|
} else {
|
|
|
this.classifyInfo(id)
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
//进入搜索
|
...
|
...
|
@@ -69,6 +150,7 @@ Page({ |
|
|
|
|
|
//个人信息弹框
|
|
|
showModal(e) {
|
|
|
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var portal_post = this.data.portal_post
|
|
|
portal_post[index].maskstate = !portal_post[index].maskstate
|
...
|
...
|
@@ -76,6 +158,7 @@ Page({ |
|
|
portal_post: portal_post
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//复制微信号
|
|
|
clickCopy(e) {
|
|
|
var wxn = e.currentTarget.dataset.wxn
|
...
|
...
|
@@ -86,12 +169,14 @@ Page({ |
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//进入主页
|
|
|
enterHomePage() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/my/myindex/myindex'
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//举报
|
|
|
report(e) {
|
|
|
var to_user_id = e.currentTarget.dataset.to_user_id
|
...
|
...
|
@@ -111,28 +196,7 @@ Page({ |
|
|
});
|
|
|
})
|
|
|
},
|
|
|
//心愿首页接口调取
|
|
|
wishIndex() {
|
|
|
let url = '/home/wish/index'
|
|
|
let params = {}
|
|
|
let header = {
|
|
|
"XX-Token": wx.getStorageSync('token')
|
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log(res)
|
|
|
const list = res.portal_post.map((item, index) => {
|
|
|
return { ...item,
|
|
|
showlabel_box: false,
|
|
|
more: JSON.parse(item.more)
|
|
|
}
|
|
|
});
|
|
|
this.setData({
|
|
|
portal_post: list,
|
|
|
portal_two: res.portal_two,
|
|
|
})
|
|
|
console.log(this.data.portal_post)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//收藏,取消收藏
|
|
|
collectInfo(e) {
|
|
|
var id = e.currentTarget.dataset.id
|
...
|
...
|
@@ -175,8 +239,8 @@ Page({ |
|
|
this.wishIndex()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
//评论
|
|
|
review(e) {
|
|
|
var post_id = e.currentTarget.dataset.id
|
...
|
...
|
@@ -205,42 +269,6 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
|
|
|
//弹窗
|
|
|
show() {
|
|
|
this.setData({
|
|
|
showlabel_box: true
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//导航点击
|
|
|
chargeTab(e) {
|
|
|
var id = e.currentTarget.dataset.id
|
|
|
var index = e.currentTarget.dataset.index;
|
|
|
var current = this.data.current;
|
|
|
if (current == index) {
|
|
|
return false
|
|
|
} else {
|
|
|
this.setData({
|
|
|
current: index
|
|
|
})
|
|
|
}
|
|
|
this.classifyInfo(id)
|
|
|
},
|
|
|
|
|
|
//获取分类信息
|
|
|
classifyInfo(id) {
|
|
|
let url = '/home/wish/posts'
|
|
|
let params = {
|
|
|
id
|
|
|
}
|
|
|
let header = {
|
|
|
"XX-Token": wx.getStorageSync('token')
|
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log(res)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//底部服务导航
|
|
|
service(e) {
|
|
|
console.log(e)
|
...
|
...
|
@@ -258,7 +286,6 @@ Page({ |
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
//底部咨询导航点击事件
|
|
|
consult(e) {
|
|
|
var tindex = e.currentTarget.dataset.tindex
|
...
|
...
|
@@ -293,23 +320,29 @@ Page({ |
|
|
|
|
|
//发布服务跳转
|
|
|
releaseService() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/service/release/release',
|
|
|
})
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/service/release/release',
|
|
|
})
|
|
|
},
|
|
|
//发布资讯跳转
|
|
|
releaseMessage() {
|
|
|
wx.showToast({title:'该功能正在开发中',icon: 'none'})
|
|
|
// wx.navigateTo({
|
|
|
// url: '/pages/service/release/release',
|
|
|
// })
|
|
|
wx.showToast({
|
|
|
title: '该功能正在开发中',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
// wx.navigateTo({
|
|
|
// url: '/pages/service/release/release',
|
|
|
// })
|
|
|
},
|
|
|
//发布心愿跳转
|
|
|
releaseWish() {
|
|
|
wx.showToast({title:'该功能正在开发中',icon: 'none'})
|
|
|
// wx.navigateTo({
|
|
|
// url: '/pages/wish/release/release',
|
|
|
// })
|
|
|
wx.showToast({
|
|
|
title: '该功能正在开发中',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
// wx.navigateTo({
|
|
|
// url: '/pages/wish/release/release',
|
|
|
// })
|
|
|
},
|
|
|
|
|
|
//底部导航心愿点击事件
|
...
|
...
|
|