From 86dcc5518aa6c76d7cbb1b3c90598fde01a0017b Mon Sep 17 00:00:00 2001 From: shil Date: Wed, 25 Dec 2019 12:09:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B6=E5=BA=AD=E6=88=90=E5=91=98=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 1 + config/config.js | 4 +- pages/family/family.js | 145 +++++++++++++++++++++++++++++++++++++++ pages/family/family.json | 1 + pages/family/family.wxml | 99 ++++++++++++++++++++++++++ pages/family/family.wxss | 17 +++++ pages/index/index.js | 3 +- 7 files changed, 268 insertions(+), 2 deletions(-) create mode 100644 pages/family/family.js create mode 100644 pages/family/family.json create mode 100644 pages/family/family.wxml create mode 100644 pages/family/family.wxss diff --git a/app.json b/app.json index 6f1a83b..c389869 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,7 @@ { "pages": [ "pages/index/index", + "pages/family/family", "pages/circle/circle", "pages/location/location", "pages/books/books", diff --git a/config/config.js b/config/config.js index bc1c62a..5bb8652 100644 --- a/config/config.js +++ b/config/config.js @@ -24,7 +24,9 @@ const urlInfo = { //报修接口 saveOwnerRepair: baseUrl + 'appApi/ownerRepair.saveOwnerRepair', //查看报修 - listOwnerRepairs: baseUrl + 'appApi/ownerRepair.listOwnerRepairs' + listOwnerRepairs: baseUrl + 'appApi/ownerRepair.listOwnerRepairs', + //家庭成员 + saveOwner: baseUrl + 'appApi/owner.saveOwner', } diff --git a/pages/family/family.js b/pages/family/family.js new file mode 100644 index 0000000..686a480 --- /dev/null +++ b/pages/family/family.js @@ -0,0 +1,145 @@ +// pages/enterCommunity/enterCommunity.js +const { + appInfo, + urlInfo +} = require("../../config/config.js"); +const util = require('../../utils/util.js'); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + "sexArr":["男","女"], + "sex": "0", + "name": "", + "link": "", + "remark": "", + "ownerId": "", + "userId": "", + "ownerTypeCd": "1002", + "age": "", + "memberId": "" + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) {}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + + bindSexChange: function(e) { + this.setData({ + sex: e.detail.value + }) + }, + bindOwnerId: function(e) { + this.setData({ + ownerId: e.detail.value + }) + }, + bindName: function(e) { + this.setData({ + name: e.detail.value + }) + }, + bindAge: function(e) { + this.setData({ + age: e.detail.value + }) + }, + bindRemark: function(e) { + this.setData({ + remark: e.detail.value + }) + }, + submitRepair: function(e) { + let obj = { + "sex": this.data.sex, + "name": this.data.name, + "link": this.data.link, + "remark": this.data.remark, + "ownerId": this.data.ownerId, + "userId": this.data.userId, + "ownerTypeCd": this.data.ownerTypeCd, + "age": this.data.age, + "memberId": this.data.memberId + } + let msg = ""; + if (obj.ownerId == "") { + msg = "请填写业主"; + } else if (obj.name == "") { + msg = "请填写姓名"; + } else if (obj.sex == "") { + msg = "请填写性别"; + } else if (obj.age == "") { + msg = "请填写年龄"; + } + if (msg != "") { + wx.showToast({ + title: msg, + icon: 'none', + duration: 2000 + }) + } else { + console.log("提交数据", obj); + wx.request({ + url: urlInfo.saveOwner, // http://hc.demo.winqi.cn:8012/appApi/ownerRepair.saveOwnerRepair + header: util.getHeaders(), + method: "POST", + data: { + "sex": "1", + "name": "1", + "link": "1", + "remark": "1", + "ownerId": "1", + "userId": "1", + "ownerTypeCd": "1002", + "age": "11", + "memberId": "1" + }, + // data:obj, //动态数据 + success: function(res) { + console.log(res, 99999); + } + }); + } + + } +}) \ No newline at end of file diff --git a/pages/family/family.json b/pages/family/family.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/pages/family/family.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pages/family/family.wxml b/pages/family/family.wxml new file mode 100644 index 0000000..9a09579 --- /dev/null +++ b/pages/family/family.wxml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{sexArr[sex]}} + + + + + + + + + + + + + + + + + + + + + + + +