You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
3.0 KiB
156 lines
3.0 KiB
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
list:[],
|
|
_openid:"",
|
|
itemid:"",
|
|
title:"",
|
|
// 底部弹出
|
|
click: false,
|
|
option: false,
|
|
},
|
|
|
|
search(e){
|
|
this.setData({
|
|
title:e.detail.value
|
|
}
|
|
)
|
|
this.getnotes()
|
|
},
|
|
getnotes(){
|
|
wx.cloud.callFunction({
|
|
name:"getNotes",
|
|
data:{
|
|
title:this.data.title
|
|
}
|
|
}).then(res=>{
|
|
this.setData({
|
|
list:res.result.data
|
|
})
|
|
}).catch(res=>{
|
|
console.log("调用getNotes失败",res);
|
|
})
|
|
},
|
|
shanchuFs(e){
|
|
this.setData({
|
|
itemid:e.currentTarget.dataset.itemid
|
|
})
|
|
wx.cloud.database().collection('note').doc(this.data.itemid).remove().then(res=>{
|
|
}).catch(res=>{
|
|
console.log("删除失败",res)
|
|
})
|
|
wx.cloud.database().collection('Collection').where({noteid:this.data.itemid}).remove().then(res=>{
|
|
}).catch(res=>{
|
|
console.log("删除失败",res)
|
|
})
|
|
this.getnotes()
|
|
},
|
|
note: function (e) {
|
|
if (e.currentTarget.dataset.type == 1) {
|
|
wx.navigateTo({
|
|
url: '../xiugaibiji/xiugaibiji?id=' + e.currentTarget.dataset.id
|
|
})
|
|
} else {
|
|
wx.navigateTo({
|
|
url: '../xiugaibiji/xiugaibiji?id=' + e.currentTarget.dataset.id
|
|
})
|
|
}
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad() {
|
|
wx.cloud.callFunction({
|
|
name:"getopid",
|
|
success: res=>{
|
|
this.setData({
|
|
_openid:res.result.openid
|
|
})
|
|
this.getnotes()
|
|
|
|
},
|
|
fail(res){
|
|
console.log("getopid获取失败",res);
|
|
}
|
|
})
|
|
},
|
|
onToggle() {
|
|
this.setData({
|
|
value: "",
|
|
isSearch:false,
|
|
title:""
|
|
})
|
|
this.getnotes()
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this.getnotes()
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
|
|
// 底部弹窗
|
|
clickPup: function() {
|
|
let _that = this;
|
|
if (!_that.data.click)
|
|
{
|
|
_that.setData({ click: true, })
|
|
}
|
|
if (_that.data.option) { _that.setData({ option: false, }) // 关闭显示弹窗动画的内容,不设置的话会出现:点击任何地方都会出现弹窗,就不是指定位置点击出现弹窗了
|
|
setTimeout(() => {
|
|
_that.setData({ click: false, }) }, 500) }
|
|
else { _that.setData({ option: true }) } },
|
|
|
|
|
|
|
|
})
|
|
|
|
|