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 0000000..2ff2b00
Binary files /dev/null and b/images/upload.png differ
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}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/repair/repair.wxss b/pages/repair/repair.wxss
new file mode 100644
index 0000000..d8b27ce
--- /dev/null
+++ b/pages/repair/repair.wxss
@@ -0,0 +1,17 @@
+.user-container {
+ padding: 25rpx 10rpx;
+ background-color: #F0F0F0;
+ /*border: 1px solid black;*/
+}
+.form{
+ background-color: #fff;
+ margin: 10rpx 7rpx;
+}
+.repair_textarea{
+ width: 100%;
+ height: 150rpx;
+}
+.repair_image{
+ width: 150rpx;
+ height: 150rpx;
+}
\ No newline at end of file
diff --git a/pages/repairList/detail/detail.js b/pages/repairList/detail/detail.js
new file mode 100644
index 0000000..07f7cd7
--- /dev/null
+++ b/pages/repairList/detail/detail.js
@@ -0,0 +1,22 @@
+/** index.js **/
+const { appInfo, urlInfo } = require("../../../config/config.js");
+const util = require('../../../utils/util.js');
+//获取app实例
+const app = getApp();
+
+Page({
+ data: {
+ obj:{}
+ },
+ onLoad: function (e) {
+ let that = this
+ console.log(JSON.parse(e.item),99999)
+ this.setData({
+ obj: JSON.parse(e.item)
+ })
+ },
+
+ onShow: function () {
+ let that = this;
+ },
+})
\ No newline at end of file
diff --git a/pages/repairList/detail/detail.json b/pages/repairList/detail/detail.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/pages/repairList/detail/detail.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/pages/repairList/detail/detail.wxml b/pages/repairList/detail/detail.wxml
new file mode 100644
index 0000000..3c39cf1
--- /dev/null
+++ b/pages/repairList/detail/detail.wxml
@@ -0,0 +1,14 @@
+
+
+
+ 姓
+ 名: {{obj.repairName}}
+ 联系方式: {{obj.tel}}
+ 报修类型: {{obj.repairTypeName}}
+ 状
+ 态: {{obj.stateName}}
+
+ 预约时间: {{obj.appointmentTime}}
+
+
+
\ No newline at end of file
diff --git a/pages/repairList/detail/detail.wxss b/pages/repairList/detail/detail.wxss
new file mode 100644
index 0000000..a06b191
--- /dev/null
+++ b/pages/repairList/detail/detail.wxss
@@ -0,0 +1,31 @@
+.user-container {
+ padding: 25rpx 10rpx;
+ background-color: #F0F0F0;
+ /*border: 1px solid black;*/
+}
+
+.notice {
+ margin: 10rpx 7rpx;
+ padding: 25rpx;
+ background-color: #ffffff;
+ border-radius: 7rpx;
+ /* display: flex;
+ justify-content: space-between;
+ align-items: flex-end; */
+}
+.title {
+ border-bottom: 1rpx solid #dedede;
+ font-weight: 700;
+ font-size: 34rpx;
+ color: #5f5e5e;
+ display: flex;
+ justify-content: space-between;
+}
+.text{
+ padding: 8rpx 0;
+ font-size: 30rpx;
+}
+.button{
+ /* width: 160rpx; */
+ /* font-size: 30rpx; */
+}
\ No newline at end of file
diff --git a/pages/repairList/repairList.js b/pages/repairList/repairList.js
new file mode 100644
index 0000000..b567776
--- /dev/null
+++ b/pages/repairList/repairList.js
@@ -0,0 +1,81 @@
+/** index.js **/
+const {
+ appInfo,
+ urlInfo
+} = require("../../config/config.js");
+const util = require('../../utils/util.js');
+//获取app实例
+const app = getApp();
+
+Page({
+ data: {
+ tableData: [],
+ page: 1,
+ totalPage: 0,
+ loading: false
+ },
+ onLoad: function() {
+ this.getTable(1);
+ },
+
+ onShow: function() {
+ let that = this;
+ },
+ getTable: function(page, override) {
+ let that = this;
+ this.setData({
+ loading:true
+ })
+ return this.request({
+ "roomId": "752019100758260005",
+ "communityId": "7020181217000001",
+ "page": page,
+ "row": 10
+ }).then(res => {
+ that.setData({
+ tableData: override ? res.data.ownerRepairs : this.data.tableData.concat(res.data.ownerRepairs),
+ totalPage: res.data.records,
+ page:page,
+ loading:false
+ })
+ })
+ },
+
+ gotoDetail: function(e) {
+ wx.navigateTo({
+ url: "/pages/repairList/detail/detail?item=" + JSON.stringify(e.currentTarget.dataset.item)
+ })
+ },
+ onPullDownRefresh: function() {
+ // 上拉刷新
+ if (!this.data.loading) {
+ this.getTable(1, true).then(() => {
+ // 处理完成后,终止下拉刷新
+ wx.stopPullDownRefresh()
+ })
+ }
+ },
+ onReachBottom: function() {
+ // 下拉触底,先判断是否有请求正在进行中
+ // 以及检查当前请求页数是不是小于数据总页数,如符合条件,则发送请求
+ if (!this.data.loading && this.data.page < this.data.totalPage) {
+ this.getTable(this.data.page + 1)
+ }
+ },
+ //封装请求
+ request: function(data) {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: urlInfo.listOwnerRepairs,
+ header: util.getHeaders(),
+ method: "GET",
+ data: data,
+ success: function(res) {
+ if (res.statusCode == 200) {
+ resolve(res);
+ }
+ }
+ })
+ })
+ },
+})
\ No newline at end of file
diff --git a/pages/repairList/repairList.json b/pages/repairList/repairList.json
new file mode 100644
index 0000000..331ad4f
--- /dev/null
+++ b/pages/repairList/repairList.json
@@ -0,0 +1,3 @@
+{
+ "enablePullDownRefresh": true
+}
\ No newline at end of file
diff --git a/pages/repairList/repairList.wxml b/pages/repairList/repairList.wxml
new file mode 100644
index 0000000..c9da2cf
--- /dev/null
+++ b/pages/repairList/repairList.wxml
@@ -0,0 +1,19 @@
+
+
+
+ {{item.repairName}}
+ {{item.tel}}
+
+
+
+ 报修类型: {{item.repairTypeName}}
+ 状
+ 态: {{item.stateName}}
+ 预约时间: {{item.appointmentTime}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/repairList/repairList.wxss b/pages/repairList/repairList.wxss
new file mode 100644
index 0000000..50e17e6
--- /dev/null
+++ b/pages/repairList/repairList.wxss
@@ -0,0 +1,36 @@
+.user-container {
+ padding: 25rpx 10rpx;
+ background-color: #F0F0F0;
+ /*border: 1px solid black;*/
+}
+
+.notice {
+ margin: 10rpx 7rpx;
+ padding: 25rpx;
+ background-color: #ffffff;
+ border-radius: 7rpx;
+ /* display: flex;
+ justify-content: space-between;
+ align-items: flex-end; */
+}
+.title {
+ border-bottom: 1rpx solid #dedede;
+ font-weight: 700;
+ font-size: 34rpx;
+ color: #5f5e5e;
+ display: flex;
+ justify-content: space-between;
+}
+.text{
+ padding: 4rpx 0;
+ font-size: 30rpx;
+}
+.main{
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-end;
+}
+.button{
+ /* width: 160rpx; */
+ /* font-size: 30rpx; */
+}