| | |
| | | // index.ts |
| | | // 获取应用实例 |
| | | const groupPublicty = getApp() |
| | | |
| | | import Dialog from '@vant/weapp/dialog/dialog'; |
| | | Page({ |
| | | data: { |
| | | groId:'', |
| | | value:'', |
| | | show: false, |
| | | causeList:[], |
| | | isShow:false |
| | | }, |
| | | ondel(event) { |
| | | console.log(event); |
| | | |
| | | let that=this |
| | | const { position, instance } = event.detail; |
| | | switch (position) { |
| | | case 'left': |
| | | case 'cell': |
| | | instance.close(); |
| | | break; |
| | | case 'right': |
| | | Dialog.confirm({ |
| | | message: '确定删除吗?', |
| | | }).then(() => { |
| | | that.delCalist(event) |
| | | instance.close(); |
| | | }).catch(() => { |
| | | instance.close(); |
| | | }); |
| | | break; |
| | | } |
| | | }, |
| | | delCalist(e){ |
| | | wx.request( |
| | | { |
| | | url:groupPublicty.globalData.url+"/wx/announcement/delete?id="+e.target.dataset.id.id, |
| | | method:"DELETE", |
| | | // data:{ |
| | | // announcement:this.data.value, |
| | | // groupId:Number(this.data.groId) |
| | | |
| | | // }, |
| | | header:{'token':wx.getStorageSync('token')}, |
| | | success:(res)=>{ |
| | | console.log(res) |
| | | this.getList() |
| | | } |
| | | }) |
| | | }, |
| | | getUserInfo(event) { |
| | | console.log(event.detail); |
| | | wx.request( |
| | | { |
| | | url:groupPublicty.globalData.url+"/wx/announcement/add?announcement="+this.data.value+"&groupId="+this.data.groId, |
| | | method:"POST", |
| | | // data:{ |
| | | // announcement:this.data.value, |
| | | // groupId:Number(this.data.groId) |
| | | |
| | | // }, |
| | | header:{'token':wx.getStorageSync('token')}, |
| | | success:(res)=>{ |
| | | console.log(res) |
| | | this.setData({ |
| | | value:'' |
| | | }) |
| | | this.getList() |
| | | } |
| | | }) |
| | | }, |
| | | onChange(event) { |
| | | // event.detail 为当前输入的值 |
| | | console.log(event.detail); |
| | | this.setData({ |
| | | value:event.detail |
| | | }) |
| | | }, |
| | | onClose() { |
| | | this.setData({ show: false , |
| | | value:''}); |
| | | }, |
| | | addCause(){ |
| | | this.setData({ show: true }); |
| | | }, |
| | | getList(){ |
| | | wx.request( |
| | | { |
| | | url:groupPublicty.globalData.url+"/group/getAllNotice", |
| | | method:"GET", |
| | | data:{ |
| | | id:this.data.groId |
| | | }, |
| | | header:{'token':wx.getStorageSync('token')}, |
| | | success:(res)=>{ |
| | | console.log(res) |
| | | this.setData({ |
| | | causeList:res.data.data |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // 事件处理函数 |
| | | onLoad(e) { |
| | | console.log(e); |
| | | this.setData({ |
| | | groId:e.id |
| | | }) |
| | | wx.request( |
| | | { |
| | | url:groupPublicty.globalData.url+"/group/getAllNotice", |