From a5fd9683f1451a3b102e2b6d4bce42441d3ba40e Mon Sep 17 00:00:00 2001 From: shil Date: Wed, 18 Dec 2019 10:02:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E4=BF=AE=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 9 +- config/config.js | 7 +- images/upload.png | Bin 0 -> 1918 bytes pages/index/index.js | 61 ++++---- pages/repair/repair.js | 216 ++++++++++++++++++++++++++++ pages/repair/repair.json | 3 + pages/repair/repair.wxml | 118 +++++++++++++++ pages/repair/repair.wxss | 17 +++ pages/repairList/detail/detail.js | 22 +++ pages/repairList/detail/detail.json | 1 + pages/repairList/detail/detail.wxml | 14 ++ pages/repairList/detail/detail.wxss | 31 ++++ pages/repairList/repairList.js | 81 +++++++++++ pages/repairList/repairList.json | 3 + pages/repairList/repairList.wxml | 19 +++ pages/repairList/repairList.wxss | 36 +++++ 16 files changed, 602 insertions(+), 36 deletions(-) create mode 100644 images/upload.png create mode 100644 pages/repair/repair.js create mode 100644 pages/repair/repair.json create mode 100644 pages/repair/repair.wxml create mode 100644 pages/repair/repair.wxss create mode 100644 pages/repairList/detail/detail.js create mode 100644 pages/repairList/detail/detail.json create mode 100644 pages/repairList/detail/detail.wxml create mode 100644 pages/repairList/detail/detail.wxss create mode 100644 pages/repairList/repairList.js create mode 100644 pages/repairList/repairList.json create mode 100644 pages/repairList/repairList.wxml create mode 100644 pages/repairList/repairList.wxss diff --git a/app.json b/app.json index 1a20f02..6f1a83b 100644 --- a/app.json +++ b/app.json @@ -9,9 +9,11 @@ "pages/myBooks/myBooks", "pages/detail/detail", "pages/comment/comment", - "pages/notice/index", - "pages/notice/detail/detail" + "pages/notice/detail/detail", + "pages/repairList/repairList", + "pages/repair/repair", + "pages/repairList/detail/detail" ], "window": { "navigationBarTextStyle": "white", @@ -49,9 +51,8 @@ }, "permission": { "scope.userLocation": { - "desc": "你的位置信息将用于小程序位置接口的效果展示" + "desc": "你的位置信息将用于小程序位置接口的效果展示" } }, "sitemapLocation": "sitemap.json" - } \ No newline at end of file diff --git a/config/config.js b/config/config.js index 89da05f..bc1c62a 100644 --- a/config/config.js +++ b/config/config.js @@ -20,8 +20,11 @@ const appInfo = { const urlInfo = { areaUrl: baseUrl +"appApi/area.listAreas", - GetNoticeListUrl: baseUrl + 'appApi/api.queryNotices' - + GetNoticeListUrl: baseUrl + 'appApi/api.queryNotices', + //报修接口 + saveOwnerRepair: baseUrl + 'appApi/ownerRepair.saveOwnerRepair', + //查看报修 + listOwnerRepairs: baseUrl + 'appApi/ownerRepair.listOwnerRepairs' } diff --git a/images/upload.png b/images/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..2ff2b00f380272830777534221d8260ba7e24b5f GIT binary patch literal 1918 zcmV-^2Z8vBP))FhxO&pYsS0dRQyee^|_qPP@T0i4odT>k)`K&fBQ7d^n}s^>I0WR{=U4)m*Q zQQ{+fH1h~x3fKkCHiDr?HGDEjPYl43@gY?7)tQdVRQLj-okVI2V}*a3G;QbAeSoF# z78EyG9N^1{Y@+PmVKK)s>+S*E_{dTwr+y54q#FZ6*iPB|g6&-00l0DhGNzmm#o4w8 zG|&Hj0`Cf&Iqd^1Ro?>gIEu4u4y29u9s=*Ry7v)uuen11yGX z5FRvDpaq|Zss1y#edQq&-sS=NwYx!m%0zM2JVf0o>$T}Y(5zNC}^#D9pEEN5(RGK02BVisVjI*gKvZc$y)J8~YQ?i0GX z3Sw4TU1x{N^PK07}d?C2e4RO0Wyfl`Jmnee5~hh zAalev5_sR~KEU-4pGAM)=YV*f?ftq1oG`s&3l;C1y7`lL;OEER%1O~?6!9wWNxF#> z>VFR$wX_`eQhjF+oGoWGkcYV@U*YOlN?_+O3HCN>W2ZaXSgTbxmG=Z3n0kL;me;gzw@E+{liL zUhI^wJwQLa4OrjF#OUk7eU!aVwDc^6KSc3Kqxlv#I|$Ba35NEz%eOEN8Xd z-*07gJizsjET?}e_1#Fb&c|5puH+Vp68Q`tcq7h{cv1A7iQ-KJDH)>T{&v3A@c{jB z_sks6MA`%%>W@TkSjpI6d>2f9-4LF^RDBwTBbK3 zi^y@_&FIkIW~Flgzqs$s92xjGuq2CbO3h*VWRM+he9lk*@~fAFJfLrsz(L6v6*t~A zt6y^f{V?9{+m*mVH{=!6^arS{dP>)*Nnfm9hsd2qJzJRx|6_W|X|tc%4FJ0`(?5bE z7n@kfYzfK_<9Ta5f3Jw4<|U>ogzt7 z=r0L8opaFX@@|+oh3Uz7JhrYU3A}UW1N<+r)KbQ0iI$w3da|6gm{PbNMZ6GV>pDo_ z)lXhDc3`|yf10g~2+yG8XAn&xa{LoeBqt*rAaL6cJigoFxHzimiQrh>N-YDq*4j8; zGk$@oXUxWH%Le zZ3lpNAv7b>6M?&} z8Q{&z;ZQ9;*SEY=qgZ==u>g$ZU5vR;Hv^1+>c%X-9sR`sP?(_Xt(+Z3^K@c(->EnQ zMh{`9>ej^oP|4L)+o=6@T9Erv0niQZU4RQNhO|GK(5+S8 zS@69GPzX8v{D-*bn(0>k(fMplDZC7&egG1m|Fe7b8bDzeWv}hRL}!38vXO_+WV(MF zqOP<`uy+6+LD)>$+uCWo$pFr}6l+%?>PFz=PR5yD?*)MMlUZ_W(jCKe0B5NTS3N|o zomo~gxdiq*0`L5`@O|TZH}P?j2}JE-iXU-X;jd}l{A>VcGsJ(|QU3=K^`4n;q<8v% zFYRj+H9@)Xt+qkM>Lx_=HopXgQio7HiS+%2qtSTQ(-C?A)4Wx$)7TuK<{O&>%mHc= z(3IyLm;=-#pefHgFbAkfKvSM~U=C1|fTld}Kuv)E2kcH3ZzL(ZhyVZp07*qoM6N<$ Eg577NLI3~& literal 0 HcmV?d00001 diff --git a/pages/index/index.js b/pages/index/index.js index 63fbb82..2679f0c 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,25 +1,25 @@ // pages/index/index.js -const {appInfo} = require("../../config/config.js") +const { + appInfo +} = require("../../config/config.js") Page({ /** * 页面的初始数据 */ data: { - ad:[ - { - imageUrl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573966727205&di=66965e182c0d2efd0818a7d9b8c2629a&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fcf482ffb4f3fc6d941664e1cba8ca3ca6e9c0a9443f84-AsGU9b_fw658", - url:"http://www.homecommunity.cn/" + ad: [{ + imageUrl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573966727205&di=66965e182c0d2efd0818a7d9b8c2629a&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fcf482ffb4f3fc6d941664e1cba8ca3ca6e9c0a9443f84-AsGU9b_fw658", + url: "http://www.homecommunity.cn/" }, { imageUrl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573966727205&di=66965e182c0d2efd0818a7d9b8c2629a&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fcf482ffb4f3fc6d941664e1cba8ca3ca6e9c0a9443f84-AsGU9b_fw658", url: "http://www.homecommunity.cn/" } ], - notices:[ - { - name:"今日8:00-00:00 停电,请各位知晓", - src:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573966727205&di=66965e182c0d2efd0818a7d9b8c2629a&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fcf482ffb4f3fc6d941664e1cba8ca3ca6e9c0a9443f84-AsGU9b_fw658", + notices: [{ + name: "今日8:00-00:00 停电,请各位知晓", + src: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573966727205&di=66965e182c0d2efd0818a7d9b8c2629a&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fcf482ffb4f3fc6d941664e1cba8ca3ca6e9c0a9443f84-AsGU9b_fw658", }, { name: "今日8:00-00:00 停电,请各位知晓,测试测试测测人吃吃吃吃吃吃吃吃吃吃吃吃吃吃", @@ -45,7 +45,8 @@ Page({ src: "/images/4.png" }, { name: "报修", - src: "/images/5.png" + src: "/images/5.png", + href: "/pages/repair/repair" }, { name: "房屋出租", src: "/images/6.png" @@ -54,7 +55,7 @@ Page({ src: "/images/7.png", href: "/pages/notice/index" }] - + }, selected: 0, mask1Hidden: true, @@ -66,10 +67,10 @@ Page({ selectedNumb: 0, sortSelected: "综合排序" }, - finish: function () { + finish: function() { var that = this; }, - sortSelected: function (e) { + sortSelected: function(e) { var that = this; // wx.request({ // url: "https://www.easy-mock.com/mock/596257bc9adc231f357c4664/restaurant/overAll", @@ -82,19 +83,19 @@ Page({ // } // }); }, - onGotUserInfo: function (e) { + onGotUserInfo: function(e) { console.log(e.detail.errMsg) console.log(e.detail.userInfo) console.log(e.detail.rawData) }, - clearSelectedNumb: function () { + clearSelectedNumb: function() { this.setData({ characteristicSelected: [false], discountSelected: null, selectedNumb: 0 }) }, - characteristicSelected: function (e) { + characteristicSelected: function(e) { var info = this.data.characteristicSelected; info[e.currentTarget.dataset.index] = !info[e.currentTarget.dataset.index]; this.setData({ @@ -103,7 +104,7 @@ Page({ }) console.log(e.currentTarget.dataset.index); }, - discountSelected: function (e) { + discountSelected: function(e) { if (this.data.discountSelected != e.currentTarget.dataset.index) { this.setData({ discountSelected: e.currentTarget.dataset.index, @@ -116,27 +117,27 @@ Page({ }) } }, - onTapTag: function (e) { + onTapTag: function(e) { this.setData({ selected: e.currentTarget.dataset.index }); }, - mask1Cancel: function () { + mask1Cancel: function() { this.setData({ mask1Hidden: true }) }, - mask2Cancel: function () { + mask2Cancel: function() { this.setData({ mask2Hidden: true }) }, - onOverallTag: function () { + onOverallTag: function() { this.setData({ mask1Hidden: false }) }, - onFilter: function () { + onFilter: function() { this.setData({ mask2Hidden: false }) @@ -144,21 +145,21 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad: function (options) { + onLoad: function(options) { console.log(appInfo); }, /** * 生命周期函数--监听页面初次渲染完成 */ - onReady: function () { + onReady: function() { }, /** * 生命周期函数--监听页面显示 */ - onShow: function () { + onShow: function() { var that = this; // wx.request({ // url: "https://www.easy-mock.com/mock/596257bc9adc231f357c4664/restaurant/info", @@ -179,35 +180,35 @@ Page({ /** * 生命周期函数--监听页面隐藏 */ - onHide: function () { + onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ - onUnload: function () { + onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ - onPullDownRefresh: function () { + onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ - onReachBottom: function () { + onReachBottom: function() { }, /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function() { } }) \ No newline at end of file diff --git a/pages/repair/repair.js b/pages/repair/repair.js new file mode 100644 index 0000000..fc087ec --- /dev/null +++ b/pages/repair/repair.js @@ -0,0 +1,216 @@ +// pages/enterCommunity/enterCommunity.js +const { + appInfo, + urlInfo +} = require("../../config/config.js"); +const util = require('../../utils/util.js'); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + typeArr: [{ + label: "卧室报修", + value: 10001 + }, { + label: "管道报修", + value: 10002 + }, { + label: "客厅报修", + value: 10003 + }], + repairType: 10001, + repairTypeIndex:0, + repairName: "", + tel: "", + communityId:"", + roomId: "", + appointmentTime: "", + context: "", + date: "", + time: "", + photos: [], + imgUrl: [] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) {}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + bindDateChange: function(e) { + this.setData({ + date: e.detail.value + }) + }, + bindTimeChange: function(e) { + this.setData({ + time: e.detail.value + }) + }, + bindTypeChange: function(e) { + let value = e.detail.value; + this.setData({ + repairType: this.data.typeArr[value].value, + repairTypeIndex: value + }) + }, + bindRepairName: function(e) { + this.setData({ + repairName: e.detail.value + }) + }, + bindTel: function(e) { + this.setData({ + tel: e.detail.value + }) + }, + bindCommunity: function (e) { + this.setData({ + communityId: e.detail.value + }) + }, + bindRoom: function(e) { + this.setData({ + roomId: e.detail.value + }) + }, + bindContent: function(e) { + console.log(e, 9999999); + this.setData({ + context: e.detail.value + }) + }, + submitRepair: function(e) { + let obj = { + appointmentTime: this.data.date + " " + this.data.time + ":00", + repairType: this.data.repairType, + repairName: this.data.repairName, + tel: this.data.tel, + communityId: this.data.communityId, + roomId: this.data.roomId, + context: this.data.context, + photos: [this.data.photos[1]] + } + let msg = ""; + if (obj.repairName == "") { + msg = "请填写报修人"; + } else if (obj.tel == "") { + msg = "请填写联系方式"; + } else if (obj.communityId == ""){ + msg = "请填写小区信息"; + } else if (obj.roomId == "") { + msg = "请填写房屋信息"; + } else if (this.data.date == "") { + msg = "请填写预约日期"; + } else if (this.data.time == "") { + msg = "请填写预约时间"; + } else if (obj.content == "") { + msg = "请填写报修内容"; + } else if (this.data.photos == "") { + msg = "请上传图片"; + } + if (msg != "") { + wx.showToast({ + title: msg, + icon: 'none', + duration: 2000 + }) + } else { + console.log("提交数据", obj); + wx.request({ + url: urlInfo.saveOwnerRepair, // http://hc.demo.winqi.cn:8012/appApi/ownerRepair.saveOwnerRepair + header: util.getHeaders(), + method: "POST", + data: { + "repairType": "10001", + "roomId": "752019100758260005", + "communityId": "7020181217000001", + "repairName": "吴学文", + "tel": "17797173942", + "context": "服务太差", + "appointmentTime": "2019-12-14 18:30:30", + "photos": ['base64....'] + }, + // data:obj, //动态数据 + success: function(res) { + console.log(res, 99999); + } + }); + } + + }, + uploadImg: function() { + let that = this; + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success(res) { + // tempFilePath可以作为img标签的src属性显示图片 + const tempFilePaths = res.tempFilePaths + console.log(res.tempFilePaths); + const photos = []; + for (var x = 0; x < res.tempFilePaths.length; x++) { + wx.getFileSystemManager().readFile({ + filePath: res.tempFilePaths[x], //选择图片返回的相对路径 + encoding: "base64", //这个是很重要的 + success: res => { //成功的回调 + //返回base64格式 + console.log('data:image/png;base64,' + res.data) + photos[x] = res.data; + } + }) + } + that.setData({ + photos: photos, + imgUrl: tempFilePaths + }) + + } + }) + } +}) \ No newline at end of file diff --git a/pages/repair/repair.json b/pages/repair/repair.json new file mode 100644 index 0000000..4fb451b --- /dev/null +++ b/pages/repair/repair.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "报修" +} \ No newline at end of file diff --git a/pages/repair/repair.wxml b/pages/repair/repair.wxml new file mode 100644 index 0000000..c9d830f --- /dev/null +++ b/pages/repair/repair.wxml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + {{typeArr[repairTypeIndex].label}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{date}} + + + + + + + + + + + + {{time}} + + + + + + + + + + +