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
| // components/popup/index.js
| const app = getApp()
| Component({
| /**
| * 组件的属性列表
| */
| properties: {
|
| },
| ready() {
| var that = this;
| // 动态获取屏幕高度
| wx.getSystemInfo({
| success: (result) => {
| that.setData({
| height: result.windowHeight
| });
| },
| })
| },
| properties: {
| visible: {
| type: Boolean
| },
| },
| /**
| * 组件的初始数据
| */
| data: {
| inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding: 0 0 0 16rpx;',
| visible: false, //打开弹窗的对应下标
| height: '', //屏幕高度
| inputvalue: '',
| joinGroup: '',
| noTip: false,
| },
|
| /**
| * 组件的方法列表
| */
| methods: {
| //关闭弹窗
| closePopup() {
| this.setData({
| visible: false,
| inputvalue: '',
| })
| },
|
| // 输入框改变
| inputChange(e) {
| this.setData({
| inputvalue: e.detail.value
| })
| },
| // 单选框改变
| onChangeRadio(e) {
| console.log(e)
| this.setData({
| joinGroup: e.currentTarget.dataset.value
| })
| },
| // 确定
| confirmSuggest() {
| if (this.data.joinGroup) {
| if (this.data.joinGroup == 1) {
| if (!this.data.inputvalue.length) {
| wx.showToast({
| icon: "error",
| title: '请填写联系方式',
| })
| } else {
| // this.joinClass()
| var myEventDetail = {
| value: this.data.inputvalue
| } // detail对象,提供给事件监听函数
| var myEventOption = {
| bubbles: true,
| composed: true
| } // 触发事件的选项
| this.triggerEvent('joinClass', myEventDetail, myEventOption)
| }
| } else {
| this.closePopup()
| }
| } else {
| wx.showToast({
| icon: 'error',
| title: '请选择后确认',
| })
| }
| },
|
| }
| })
|
|