mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-24 05:46:04 +08:00
业主绑定功能基本开发完成
This commit is contained in:
parent
cc1c523740
commit
620a569477
@ -10,6 +10,9 @@ class MappingConstant{
|
||||
static TOKEN = "token"; // token 标识
|
||||
static USER_INFO = "userInfo"; // 用户信息
|
||||
static AREA_INFO = "areaInfo"; // 地区信息
|
||||
static CURRENT_COMMUNITY_INFO = "currentCommunityInfo"; // 小区信息
|
||||
static OWNER_INFO = "ownerInfo"; // 当前业主信息
|
||||
static CURRENT_COMMUNITY_INFO = "currentCommunityInfo"; //业主当前小区信息
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -21,8 +21,12 @@ const baseUrl = 'https://app.demo.winqi.cn/';
|
||||
//家庭成员
|
||||
const saveOwner=baseUrl + 'app/owner.saveOwner';
|
||||
|
||||
//绑定业主
|
||||
const appUserBindingOwner = baseUrl + 'app/owner.appUserBindingOwner';
|
||||
|
||||
//查询绑定业主
|
||||
const queryAppUserBindingOwner = baseUrl + 'app/owner.listAppUserBindingOwners';
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
@ -33,5 +37,6 @@ module.exports = {
|
||||
saveOwnerRepair: saveOwnerRepair,
|
||||
listOwnerRepairs: listOwnerRepairs,
|
||||
saveOwner: saveOwner,
|
||||
appUserBindingOwner: appUserBindingOwner
|
||||
appUserBindingOwner: appUserBindingOwner,
|
||||
queryAppUserBindingOwner: queryAppUserBindingOwner
|
||||
};
|
||||
@ -115,6 +115,56 @@ const _loadArea = function (_level, _parentAreaCode, callBack = (_areaList)=>{})
|
||||
})
|
||||
}
|
||||
|
||||
const getOwner = function(callBack = (_ownerInfo)=>{}){
|
||||
// 从硬盘中获取 业主信息
|
||||
let _ownerInfo = wx.getStorageSync(constant.mapping.OWNER_INFO);
|
||||
if (_ownerInfo){
|
||||
callBack(_ownerInfo);
|
||||
}else{
|
||||
wx.request({
|
||||
url: constant.url.queryAppUserBindingOwner,
|
||||
header: getHeaders(),
|
||||
data: {
|
||||
|
||||
},
|
||||
success: function (res) {
|
||||
console.log('login success');
|
||||
let data = res.data;
|
||||
console.log(res);
|
||||
if(res.statusCode == 200){
|
||||
_ownerInfo = data.auditAppUserBindingOwners[0];
|
||||
if (_ownerInfo.state == '12000'){
|
||||
wx.setStorageSync(constant.mapping.OWNER_INFO, _ownerInfo);
|
||||
let _currentCommunityInfo = {
|
||||
communityId: _ownerInfo.communityId,
|
||||
communityName: _ownerInfo.communityName
|
||||
}
|
||||
wx.setStorageSync(constant.mapping.CURRENT_COMMUNITY_INFO, _currentCommunityInfo);
|
||||
}
|
||||
callBack(data.auditAppUserBindingOwners[0]);
|
||||
}
|
||||
},
|
||||
|
||||
fail: function (error) {
|
||||
// 调用服务端登录接口失败
|
||||
wx.showToast({
|
||||
title: '调用接口失败',
|
||||
});
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前小区信息
|
||||
*/
|
||||
const getCurrentCommunity = function(){
|
||||
let communityInfo = wx.getStorageSync(constant.mapping.CURRENT_COMMUNITY_INFO);
|
||||
return communityInfo;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
constant: constant,
|
||||
util: util,
|
||||
@ -124,5 +174,7 @@ module.exports = {
|
||||
getUserInfo: getUserInfo,
|
||||
getLoginFlag: getLoginFlag,
|
||||
_loadArea: _loadArea,
|
||||
getCurrentLocation: getCurrentLocation
|
||||
getCurrentLocation: getCurrentLocation,
|
||||
getOwner: getOwner,
|
||||
getCurrentCommunity: getCurrentCommunity
|
||||
};
|
||||
@ -7,13 +7,16 @@ const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
userInfo: {}, // 用户信息
|
||||
ownerFlag: false // 是否有业主信息 标记 如果有为 true 没有为false
|
||||
},
|
||||
onLoad: function() {
|
||||
let _that = this;
|
||||
factory.login.checkLoginStatus(function(){
|
||||
_that.setData({
|
||||
userInfo: context.getUserInfo()
|
||||
});
|
||||
});
|
||||
//查询用户信息
|
||||
_that.loadOwenrInfo();
|
||||
});
|
||||
},
|
||||
|
||||
@ -27,5 +30,25 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: '../bindOwner/bindOwner',
|
||||
})
|
||||
},
|
||||
viewOwner: function () {
|
||||
wx.navigateTo({
|
||||
url: '../viewBindOwner/viewBindOwner',
|
||||
})
|
||||
},
|
||||
loadOwenrInfo:function(){
|
||||
let _that = this;
|
||||
context.getOwner(function(_ownerInfo){
|
||||
console.log(_ownerInfo);
|
||||
if (_ownerInfo){
|
||||
_that.setData({
|
||||
ownerFlag:true
|
||||
})
|
||||
}else{
|
||||
_that.setData({
|
||||
ownerFlag: false
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
<view class="tab-container bg-white">
|
||||
|
||||
<view class="tab-item border-bottom" hover-class="tab-item-hover" catchtap="bindingOwner">
|
||||
<view wx:if="{{ownerFlag== false}}" class="tab-item border-bottom" hover-class="tab-item-hover" catchtap="bindingOwner">
|
||||
<view>
|
||||
<text class="iconfont iconaccount icon"></text>
|
||||
<text class="tab-text">绑定业主</text>
|
||||
@ -33,6 +33,14 @@
|
||||
<view class="tab-arrow"></view>
|
||||
</view>
|
||||
|
||||
<view wx:else class="tab-item border-bottom" hover-class="tab-item-hover" catchtap="viewOwner">
|
||||
<view>
|
||||
<text class="iconfont iconaccount icon"></text>
|
||||
<text class="tab-text">业主信息</text>
|
||||
</view>
|
||||
<view class="tab-arrow"></view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="tab-item" hover-class="tab-item-hover" catchtap="goMyBooks">
|
||||
<view>
|
||||
<image src="../../images/bought.png" mode="aspectFit" class="tab-icon"></image>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// pages/viewBindOwner/viewBindOwner.js
|
||||
const context = require("../../context/Java110Context.js");
|
||||
Page({
|
||||
|
||||
/**
|
||||
@ -34,17 +35,8 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
areaName: '西宁市城东区',
|
||||
communityId:'7020181217000001',
|
||||
communityName: '格兰小镇',
|
||||
appUserName: '吴学文',
|
||||
appUserId: '772019092507000013',
|
||||
idCard: '632126199109162011',
|
||||
link: '17797173942',
|
||||
active: 1
|
||||
});
|
||||
|
||||
|
||||
this.loadOwnerInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -94,5 +86,27 @@ Page({
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载业主信息
|
||||
*/
|
||||
loadOwnerInfo:function(){
|
||||
let _that = this;
|
||||
context.getOwner(function(_ownerInfo){
|
||||
if(_ownerInfo){
|
||||
let _active = _ownerInfo.state == '10000'?1:2
|
||||
_that.setData({
|
||||
areaName: '西宁市城东区',
|
||||
communityId: _ownerInfo.communityId,
|
||||
communityName: _ownerInfo.communityName,
|
||||
appUserName: _ownerInfo.appUserName,
|
||||
appUserId: _ownerInfo.appUserId,
|
||||
idCard: _ownerInfo.idCard,
|
||||
link: _ownerInfo.link,
|
||||
active: _active
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
@ -35,12 +35,27 @@ const formatNumber = n => {
|
||||
|
||||
const getDateYYYYMMDDHHMISS = function () {
|
||||
let date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
const hour = date.getHours();
|
||||
const minute = date.getMinutes();
|
||||
const second = date.getSeconds();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
let hour = date.getHours();
|
||||
let minute = date.getMinutes();
|
||||
let second = date.getSeconds();
|
||||
if (month < 10) {
|
||||
month = '0' + month;
|
||||
}
|
||||
if (day < 10) {
|
||||
day = '0' + day;
|
||||
}
|
||||
if (hour < 10){
|
||||
hour = '0'+hour;
|
||||
}
|
||||
if (minute < 10){
|
||||
minute = '0' + minute;
|
||||
}
|
||||
if (second < 10) {
|
||||
second = '0' + second;
|
||||
}
|
||||
return year + "" + month + "" + day + "" + hour + "" + minute + "" + second;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user