diff --git a/app.json b/app.json index 6159760..8958dc7 100644 --- a/app.json +++ b/app.json @@ -1,5 +1,6 @@ { "pages": [ + "pages/login/index", "pages/home/index", "pages/billList/index", "pages/rechargeRecord/index", @@ -8,7 +9,6 @@ "pages/invoiceDetailContent/index", "pages/invoicing/index", "pages/member/index", - "pages/login/index", "pages/handleLogin/index", "pages/my/index", "pages/waitApprove/index", diff --git a/childPackage/pages/electricQuery/index.json b/childPackage/pages/electricQuery/index.json index a5ba7a6..3972a94 100644 --- a/childPackage/pages/electricQuery/index.json +++ b/childPackage/pages/electricQuery/index.json @@ -10,6 +10,7 @@ "empty": "/components/empty/index", "timePicker": "/components/timePicker/index", "accountingCard": "./components/accountingCard/index", + "pagination": "/components/pagination/index", "echarts": "/childPackage/components/echarts/ec-canvas" }, "navigationStyle": "custom" diff --git a/childPackage/pages/electricQuery/index.wxml b/childPackage/pages/electricQuery/index.wxml index 837a1a7..34cc5fa 100644 --- a/childPackage/pages/electricQuery/index.wxml +++ b/childPackage/pages/electricQuery/index.wxml @@ -79,7 +79,14 @@ - + +
+ + + diff --git a/components/pagination/index.js b/components/pagination/index.js new file mode 100644 index 0000000..540e3a3 --- /dev/null +++ b/components/pagination/index.js @@ -0,0 +1,143 @@ +Component({ + /** + * 组件的属性列表 + */ + properties: { + currentIndex: { //当前页码 + type: Number, + value: 1 + }, + totalPage: { + type: Number + } + }, + + /** + * 组件的初始数据 + */ + data: { + index: 1, + total: 10, + pageMask: false, + prevBtnDis: true, + nextBtnDis: false + }, + + /** + * 组件的方法列表 + */ + lifetimes: { + // 在组件实例进入页面节点树时执行 + attached: function () { + this.setData({ + index: this.properties.currentIndex, + total: this.properties.totalPage + }) + } + + }, + methods: { + + // 设置异步请求之后的页面、总记录数 + setPage(index, total){ + this.setData({ + index, + total + }) + }, + + //每次改变页码就调用该函数 + triggerParent: function () { + + // 通知父组件当前加载的页数 + + // 自定义组件向父组件传值 + const option = { + currentIndex: this.data.index + }; + + // pagingChange 自定义名称事件,父组件中使用 + this.triggerEvent('pagingChange', option) + + }, + //开启页码弹窗 + showPagePopUp: function () { + this.setData({ + pageMask: true + }) + }, + //关闭页码弹窗 + hidePagePopUp: function () { + this.setData({ + pageMask: false + }) + }, + //更改页码点击事件 + onChangePage: function (e) { + //console.log("更改页码事件:",e); + this.setData({ + pageMask: false, + index: e.currentTarget.dataset.index //点击的页数 + }) + + // 先判断当前页数,是否需要更新disabled的状态 + this.updateBtnDis(); + + this.triggerParent(); + + }, + //上一页点击事件 + prevPage: function () { + if(this.data.index <= 1) return; + let num = this.data.index - 1; + this.setData({ + index: num + }) + this.triggerParent(); + // 更新按钮状态 + this.updateBtnDis(); + }, + //下一页点击事件 + nextPage: function () { + if(this.data.index >= this.data.total) return; + let num = this.data.index + 1; + this.setData({ + index: num + }) + + this.triggerParent(); + + // 更新按钮状态 + this.updateBtnDis(); + }, + + //判断按钮是否为disabled + updateBtnDis: function () { + + let index = this.data.index; + let total = this.data.total; + + if(index == total && index == 1){ // 都为起始页和总页数都为1 + this.setData({ + nextBtnDis: true, + prevBtnDis: true + }) + }else if (index == total) { // 最后一页 + this.setData({ + nextBtnDis: true + }) + } else if (index == 1){ // 第一页 + this.setData({ + prevBtnDis: true + }) + }else{ + this.setData({ + prevBtnDis: false + }) + this.setData({ + nextBtnDis: false + }) + } + } + } +}) \ No newline at end of file diff --git a/components/pagination/index.json b/components/pagination/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/pagination/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/pagination/index.wxml b/components/pagination/index.wxml new file mode 100644 index 0000000..4d599db --- /dev/null +++ b/components/pagination/index.wxml @@ -0,0 +1,16 @@ + + + + 上一页 + {{index}}/{{total}} + 下一页 + + + diff --git a/components/pagination/index.wxss b/components/pagination/index.wxss new file mode 100644 index 0000000..2ea11a7 --- /dev/null +++ b/components/pagination/index.wxss @@ -0,0 +1,83 @@ +/* components/pagination/index.wxss */ +view,text,image{ + padding: 0; + margin: 0; + box-sizing: border-box; +} +.page-control{ + width: 100%; +} +.page-control .page-control-btns{ + width: 100%; + padding: 20rpx 0; + display: flex; + align-items: center; + justify-content: space-around; +} +.page-control .page-control-btns .page-number{ + width: 20%; + text-align: center; + color: #333; +} +.page-control .page-control-btns .page-number:active{ + background-color: #ddd; +} +.page-control .page-control-btns .page-btn{ + width: 30%; + padding: 15rpx 20rpx; + font-size: 30rpx; + background-color: #0099CC; + color: #fff; + border-radius: 10rpx; + text-align: center; +} +.page-control .page-control-btns .page-btn:active{ + opacity: .5; +} +.page-control .page-control-btns .btn-disabled{ + background-color: #ddd; + color: #999; +} +.page-container{ + position: fixed; + top: 0rpx; + left: 0rpx; + width: 100%; + height: 100%; + z-index: 999; +} +.page-mask{ + width: 100%; + height: 100%; + position: absolute; + left: 0; + top: 0; + background-color: rgba(0,0,0,0.5); +} +.page-popup{ + width: 100%; + height: 100%; + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; +} +.page-popup-box{ + width: 60%; + margin: 0 auto; + background-color: #fff; + height: 60%; + border-radius: 10rpx; + z-index: 9999; + overflow: auto; +} +.page-line{ + width: 100%; + height: 80rpx; + line-height: 80rpx; + padding: 0rpx 20rpx; + border-bottom: 1rpx solid #e2e2e2; +} +.page-line:active{ + background-color: #ddd; +} diff --git a/components/select/index.wxss b/components/select/index.wxss index 1c6032b..e6024d2 100644 --- a/components/select/index.wxss +++ b/components/select/index.wxss @@ -4,8 +4,6 @@ } .options { - - background-color: #fff; padding: 20rpx; margin-left: 32rpx; @@ -15,7 +13,8 @@ border-radius: 5rpx; box-sizing: border-box; width: calc(100% - 64rpx); - max-height: 50vh; + max-height: 40vh; + overflow: auto; } .option { diff --git a/pages/handleLogin/index.js b/pages/handleLogin/index.js index b601765..a39081c 100644 --- a/pages/handleLogin/index.js +++ b/pages/handleLogin/index.js @@ -23,6 +23,7 @@ Page({ */ onLoad(options) { const { canBack } = options + console.log('cnaback', canBack) if (canBack === 'false') { this.setData({ canBack: false }) } diff --git a/pages/handleLogin/index.wxml b/pages/handleLogin/index.wxml index f71a851..67a3e47 100644 --- a/pages/handleLogin/index.wxml +++ b/pages/handleLogin/index.wxml @@ -5,13 +5,10 @@ - 您可以联系贵司在系统中预留的手机号联系人 + 点击下方扫一扫,扫描管理员二维码直接绑定。 - 登录本系统-我的-二维码 - - - 使用微信扫一扫,直接绑定 + 说明:系统预留手机号联系人为本系统管理员,其它人员可通过扫描管理员二维码进行绑定。 去扫码 diff --git a/pages/home/index.js b/pages/home/index.js index 87002ab..2f41b43 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -276,9 +276,11 @@ Page({ } if (!data?.length) { alertInfo("尚无信息") - wx.redirectTo({ - url: '/pages/handleLogin/index?back=false', - }) + setTimeout(() => { + wx.redirectTo({ + url: '/pages/handleLogin/index?back=false', + }) + }, 500) return; } const [firstPark = {}] = data; @@ -336,6 +338,7 @@ Page({ alertInfo(message) return; } + const that = this; wx.requestPayment({ timeStamp: data?.time, nonceStr: data?.nonceStr, diff --git a/pages/login/index.js b/pages/login/index.js index 12d3700..8498bcd 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -69,7 +69,7 @@ Page({ this.noPermission() return; } - alertSuccess("登录成功") + alertSuccess("注册成功") const { token, ...user } = data wx.setStorageSync('user', user) wx.setStorageSync('token', data?.token) diff --git a/pages/member/components/memberManage/index.js b/pages/member/components/memberManage/index.js index 7db56f0..f612f9a 100644 --- a/pages/member/components/memberManage/index.js +++ b/pages/member/components/memberManage/index.js @@ -43,9 +43,10 @@ Component({ }) }, async setAdmin(e) { - const { user, tenement } = e.currentTarget.dataset; + const { user } = e.currentTarget.dataset; + const tenement = wx.getStorageSync('tenement'); await wxModal({ content: `你的管理员身份将转交给${user.name}` }) - const { code, message } = await approveUser({ userId: user.id, type: 2, tenement }) + const { code, message } = await approveUser({ userId: user.id, type: 2, tenement: tenement?.id }) if (code !== OK) { alertInfo(message) return; @@ -57,9 +58,10 @@ Component({ alertSuccess("转交成功") }, async remove(e) { - const { user, tenement } = e.currentTarget.dataset; + const { user } = e.currentTarget.dataset; + const tenement = wx.getStorageSync('tenement'); await wxModal({ content: `将移除${user.name}?` }) - const { code, message } = await removeUser(user.id, tenement) + const { code, message } = await removeUser(user.id, tenement?.id) if (code !== OK) { alertInfo(message) return; diff --git a/pages/questions/index.wxml b/pages/questions/index.wxml index c3bca1b..366b8bd 100644 --- a/pages/questions/index.wxml +++ b/pages/questions/index.wxml @@ -2,7 +2,7 @@ - + {{index + 1}}、 {{ item.name }} {{ item.content }} diff --git a/pages/questions/index.wxss b/pages/questions/index.wxss index a2307cf..d14fb8f 100644 --- a/pages/questions/index.wxss +++ b/pages/questions/index.wxss @@ -3,7 +3,6 @@ flex: 1; padding: 16rpx 24rpx 20rpx; box-sizing: border-box; - display: flex; } .question { diff --git a/service/park.js b/service/park.js index 55c475e..a21b36e 100644 --- a/service/park.js +++ b/service/park.js @@ -4,4 +4,9 @@ const { GET, POST, PUT, DELETE } = apis // 获取园区列表 export const getParkList = async function({ keyword }) { return await GET(`/wx/getParkList?keyword=${keyword}`); +} + +// 获取未登录的园区列表 +export const getLoginParkList = async function({ keyword }) { + return await GET(`/wx/getLoginParkList?keyword=${keyword}`); } \ No newline at end of file diff --git a/utils/index.js b/utils/index.js index 5d594a0..2aee9bb 100644 --- a/utils/index.js +++ b/utils/index.js @@ -55,7 +55,7 @@ export function getConfigByEnv() { break; // 正式版 case 'release': - api = "https://zgd.hbhcbn.com/api" + api = "https://zgd.hbhcbn.com/api3" break; } return { api, }