1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
| // 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",
| method:"GET",
| data:{
| id:e.id
| },
| header:{'token':wx.getStorageSync('token')},
| success:(res)=>{
| console.log(res)
| this.setData({
| causeList:res.data.data
| })
| }
| })
| }
| })
|
|