From e925fa7956f35508a091312f5d541bcf87fe15bd Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Tue, 25 Feb 2020 17:53:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- constant/UrlConstant.js | 8 +-- context/Java110Context.js | 20 ++++++- pages/addressList/addressList.vue | 92 ++++++++++++++++++++++++++----- pages/index/index.vue | 2 +- pages/login/login.vue | 2 +- 5 files changed, 102 insertions(+), 22 deletions(-) diff --git a/constant/UrlConstant.js b/constant/UrlConstant.js index 62b7c5f..25c2286 100644 --- a/constant/UrlConstant.js +++ b/constant/UrlConstant.js @@ -4,8 +4,8 @@ * add by wuxw 2019-12-28 */ // 服务器域名 -const baseUrl = 'https://app.demo.winqi.cn/'; -//const baseUrl = '/'; +//const baseUrl = 'https://app.demo.winqi.cn/'; +const baseUrl = '/'; const hcBaseUrl = 'https://hc.demo.winqi.cn'; // 登录接口 const loginUrl = baseUrl + 'app/loginProperty'; @@ -16,7 +16,7 @@ const listMyEnteredCommunitys = baseUrl + 'app/community.listMyEnteredCommunitys const listOwnerRepairs = baseUrl + 'app/ownerRepair.listOwnerRepairs'; //家庭成员 -const saveOwner = baseUrl + 'app/owner.saveOwner'; //家庭成员列表 +const queryStaffInfos = baseUrl + 'app/query.staff.infos'; //查询员工信息 const queryOwnerMembers = baseUrl + 'app/owner.queryOwnerMembers'; //投诉建议列表 @@ -65,7 +65,7 @@ module.exports = { GetNoticeListUrl: GetNoticeListUrl, listMyEnteredCommunitys: listMyEnteredCommunitys, listOwnerRepairs: listOwnerRepairs, - saveOwner: saveOwner, + queryStaffInfos: queryStaffInfos, appUserBindingOwner: appUserBindingOwner, queryAppUserBindingOwner: queryAppUserBindingOwner, queryOwnerMembers: queryOwnerMembers, diff --git a/context/Java110Context.js b/context/Java110Context.js index fb8479d..75f9869 100644 --- a/context/Java110Context.js +++ b/context/Java110Context.js @@ -62,7 +62,14 @@ const getCurrentLocation = function () { const getUserInfo = function () { let userInfo = uni.getStorageSync(constant.mapping.USER_INFO); + if(util.string.isNull(userInfo)){ + uni.redirectTo({ + url:"/pages/login/login" + }); + return; + } let _userInfo = JSON.parse(util.des.desDecrypt(userInfo)); + return _userInfo; }; /** @@ -139,11 +146,17 @@ const _loadArea = function (_level, _parentAreaCode, callBack = _areaList => {}) } }); }; +/** + * 获取当前小区 + */ +const getCurrentCommunity = function(){ + let currentCommunity = uni.getStorageSync(_that.java110Constant.mapping.CURRENT_COMMUNITY_INFO); + return getCurrentCommunity; +}; + /** * 获取当前小区信息 */ - - const getCommunity = function (callBack,reload) { let _communityInfo = uni.getStorageSync(constant.mapping.COMMUNITY_INFO); console.log('本地小区信息',_communityInfo); @@ -207,5 +220,6 @@ module.exports = { _loadArea: _loadArea, getCurrentLocation: getCurrentLocation, getCommunity: getCommunity, - request: request + request: request, + getCurrentCommunity:getCurrentCommunity }; \ No newline at end of file diff --git a/pages/addressList/addressList.vue b/pages/addressList/addressList.vue index db947bf..5ba88a9 100644 --- a/pages/addressList/addressList.vue +++ b/pages/addressList/addressList.vue @@ -3,17 +3,17 @@ - + - + - - + {{item.name}} @@ -21,11 +21,11 @@ {{item.name}}{{list[sub].name}} - 有{{sub+2}}个主子需要伺候 + {{item.orgName}}-{{item.tel}} - + @@ -40,19 +40,85 @@ export default { data() { return { - list: [] + list: [], + name:'' } }, onLoad() { - let list = [{}]; - for (let i = 0; i < 5; i++) { - list[i] = {}; - list[i].name = String.fromCharCode(65 + i); - } - this.list = list; + //let list = [{}]; + + // for (let i = 0; i < 5; i++) { + // list[i] = {}; + // list[i].name = String.fromCharCode(65 + i); + // } + //this.list = list; + this._loadStaffInfo(); + }, methods: { + _loadStaffInfo:function(){ + //获取商户ID + let _that =this; + let _userInfo = this.java110Context.getUserInfo(); + let storeId = _userInfo.storeId; + let _objData = { + page:1, + row:15, + storeId:storeId, + name:this.name + }; + this.java110Context.request({ + url: _that.java110Constant.url.queryStaffInfos, + header: _that.java110Context.getHeaders(), + method: "GET", + data: _objData, //动态数据 + success: function (res) { + console.log("请求返回信息:", res); + if (res.statusCode == 200) { + let _data = res.data; + _data.staffs.forEach(function(_ite){ + _ite.nameIndex = 'a'; + }); + _that.list = _data.staffs; + return; + } + wx.showToast({ + title: "服务器异常了", + icon: 'none', + duration: 2000 + }) + }, + fail: function (e) { + wx.showToast({ + title: "服务器异常了", + icon: 'none', + duration: 2000 + }) + } + }); + + }, + _callPhoto:function(_photo){ + uni.makePhoneCall({ + // 手机号 + phoneNumber: _photo, + + // 成功回调 + success: (res) => { + console.log('调用成功!') + }, + + // 失败回调 + fail: (res) => { + console.log('调用失败!') + } + + }); + }, + _searchStaff:function(){ + this._loadStaffInfo(); + } } } diff --git a/pages/index/index.vue b/pages/index/index.vue index 3844a0a..6ec8d3e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -115,7 +115,7 @@ let _that = this; //加载小区信息 this.java110Context.getCommunity(function(_communitys){ - let currentCommunity = uni.getStorageSync(_that.java110Constant.mapping.CURRENT_COMMUNITY_INFO); + let currentCommunity = _that.java110Context.getCurrentCommunity(_that.java110Constant.mapping.CURRENT_COMMUNITY_INFO); //随机放一个小区 let _tmpCommunityInfo = _communitys[0]; if(_that.java110Util.string.isNull(currentCommunity)){ diff --git a/pages/login/login.vue b/pages/login/login.vue index e8d7a75..fc41db4 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -46,7 +46,7 @@ }); this.logoUrl = this.java110Constant.url.baseUrl + 'logo.png'; - L + },