From e4e2740c0b1ac9083bf1aee088b4ee838c61c9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E4=BA=9A=E7=94=B7?= Date: Sat, 9 Oct 2021 18:06:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E8=AF=A6=E6=83=85=EF=BC=8C?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AF=A6=E6=83=85=EF=BC=8C=E6=88=91=E7=9A=84?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/popup/popup.js | 59 +++++++++ components/popup/popup.json | 4 + components/popup/popup.wxml | 10 ++ components/popup/popup.wxss | 60 +++++++++ ...ngDetail.wxss => meetingDetailSigned.wxss} | 0 pages/project/project.js | 116 +++++++++++------- pages/project/project.json | 4 +- pages/project/project.wxml | 3 +- 8 files changed, 207 insertions(+), 49 deletions(-) create mode 100644 components/popup/popup.js create mode 100644 components/popup/popup.json create mode 100644 components/popup/popup.wxml create mode 100644 components/popup/popup.wxss rename pages/meetingDetail/{meetingDetail.wxss => meetingDetailSigned.wxss} (100%) diff --git a/components/popup/popup.js b/components/popup/popup.js new file mode 100644 index 0000000..35595ed --- /dev/null +++ b/components/popup/popup.js @@ -0,0 +1,59 @@ +// components/popup/popup.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + // 是否弹出显示 + visible: { + type: Boolean, + value: false + }, + //点击外部的遮罩层是否允许关闭 + outClickCanClose: { + type: Boolean, + value: false + }, + // 组件循环需要渲染的数据内容, 接受label和value的形式 + data: { + type: Array, + value: [ + { + label: '是', + value: 1 + },{ + label: '否', + value: 0 + } + ] + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + closePopup() { + this.triggerEvent("close", { + visible: this.data.visible + }) + }, + outClick(){ + if (this.data.outClickCanClose){ + this.triggerEvent("close", { + visible: this.data.visible + }) + } + }, + ok(e){ + this.triggerEvent("ok", e.target.dataset.value) + } + } +}) diff --git a/components/popup/popup.json b/components/popup/popup.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/popup/popup.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/popup/popup.wxml b/components/popup/popup.wxml new file mode 100644 index 0000000..d5032d5 --- /dev/null +++ b/components/popup/popup.wxml @@ -0,0 +1,10 @@ + + + + + + {{item.label}} + + + + \ No newline at end of file diff --git a/components/popup/popup.wxss b/components/popup/popup.wxss new file mode 100644 index 0000000..02994c9 --- /dev/null +++ b/components/popup/popup.wxss @@ -0,0 +1,60 @@ +/* components/popup/popup.wxss */ +.i-modal-mask { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.7); + z-index: 1000; + transition: all 0.2s ease-in-out; + opacity: 0; + visibility: hidden; + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.i-modal-mask-show { + opacity: 1; + visibility: visible; +} +.centerView { + width: 85%; + background-color: #fff; + border-radius: 10rpx; + display: flex; + flex-direction: column; + align-items: center; + padding: 0 15px; + max-height: 50%; + overflow-y: auto; +} +.centerView::-webkit-scrollbar{ + width: 0; +} + + +.contentText { + width: 100%; + color: #333; + font-size: 14px; + word-break: break-all; +} +.item{ + width: 100%; + text-align: center; + line-height: 40px; + border-bottom: 0.5px solid #f5f5f5; +} +.item text{ + display: block; + width: 100%; +} +.item:last-child{ + border: 0; +} + diff --git a/pages/meetingDetail/meetingDetail.wxss b/pages/meetingDetail/meetingDetailSigned.wxss similarity index 100% rename from pages/meetingDetail/meetingDetail.wxss rename to pages/meetingDetail/meetingDetailSigned.wxss diff --git a/pages/project/project.js b/pages/project/project.js index 9f5249b..8eba712 100644 --- a/pages/project/project.js +++ b/pages/project/project.js @@ -5,10 +5,12 @@ Page({ * 页面的初始数据 */ data: { + visible: false, + index: 0, searchParams: { pageNo: 1, pageSize: 10, - needInvoice: 0, // 是否需要发票 0 1 + needInvoice: 0, // 是否需要发票 0 4 pack: 0, // 是否打包 0 1 year: '', // 运行年份 }, @@ -28,19 +30,75 @@ Page({ active: false, tabIndex: 3 } + ], + data: [ + { + label: '需要', + value: 4 + },{ + label: '不需要', + value: 0 + } ] }, + // 搜索筛选 + changeTab(e){ + this.data.index = e.currentTarget.dataset.index + if(this.data.index === 0){ + this.setData({ + data: [ + { + label: '需要', + value: 4 + },{ + label: '不需要', + value: 0 + } + ] + }) + }else if(this.data.index === 1){ + this.setData({ + data: [ + { + label: '是', + value: 1 + },{ + label: '否', + value: 0 + } + ] + }) + } + this.setData({ + visible: true + }) + }, + // 关闭弹出层 + close() { + this.setData({ + visible: false + }) + }, + ok(e){ + if(this.data.index === 0){ + this.setData({ + 'searchParams.needInvoice': e.detail + }) + }else if(this.data.index === 1){ + this.setData({ + 'searchParams.pack': e.detail + }) + } + // this.loadData() + console.log(this.data.searchParams) + }, // 项目详情 projectDetail(){ wx.navigateTo({ url: '../projectDetail/projectDetail', }) }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - console.log(this.data.searchParams) + loadData(){ UserApi.projectList(this.data.searchParams).then(res=>{ console.log(res) @@ -52,53 +110,17 @@ Page({ }) }) }, - /** - * 生命周期函数--监听页面初次渲染完成 + * 生命周期函数--监听页面加载 */ - onReady: function () { - + onLoad: function (options) { + // this.loadData() }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + this.data.pageNo++ + // this.loadData() }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } }) \ No newline at end of file diff --git a/pages/project/project.json b/pages/project/project.json index 0e892df..bac8bb4 100644 --- a/pages/project/project.json +++ b/pages/project/project.json @@ -1,4 +1,6 @@ { "navigationBarTitleText": "项目", - "usingComponents": {} + "usingComponents": { + "popup": "../../components/popup/popup" + } } \ No newline at end of file diff --git a/pages/project/project.wxml b/pages/project/project.wxml index 60b671d..3560161 100644 --- a/pages/project/project.wxml +++ b/pages/project/project.wxml @@ -1,6 +1,6 @@ - + {{select.select}} @@ -20,3 +20,4 @@ +