|
@@ -1,21 +1,56 @@
|
|
|
// app.js
|
|
|
const utils = require('/utils/util.js')
|
|
|
-// const baseIp= "http://127.0.0.1:9747"
|
|
|
-// const baseIp= "http://61.177.40.178:8000/zhsw"
|
|
|
-// const baseIp = "http://192.168.0.215:9000/zhsw"
|
|
|
-const baseIp = "https://www.izilaishui.com:9000/zhsw"
|
|
|
// 图片预览地址
|
|
|
-
|
|
|
+const ipConfig = {
|
|
|
+ develop: "http://127.0.0.1:", //开发地址
|
|
|
+ trial: "http://61.177.40.178:", // 体验地址
|
|
|
+ release: "https://www.izilaishui.com:", //上线地址
|
|
|
+}
|
|
|
+const hostConfig = {
|
|
|
+ develop: "9747", //开发地址
|
|
|
+ trial: "8000/zhsw", // 体验地址
|
|
|
+ release: "9000/zhsw", //上线地址
|
|
|
+}
|
|
|
App({
|
|
|
onLaunch(options) {
|
|
|
+ debugger;
|
|
|
+ const ACCOUNT_INFO = wx.getAccountInfoSync();
|
|
|
+ const ENV_VERSION = ACCOUNT_INFO.miniProgram.envVersion;
|
|
|
+ const baseIp = ipConfig[ENV_VERSION || develop];
|
|
|
+ const host = hostConfig[ENV_VERSION || develop];
|
|
|
const logs = wx.getStorageSync('logs') || []
|
|
|
+ this.globalData.interfaceUrls = {
|
|
|
+ loginUrl: baseIp + host + '/wechat/login', // 登录+获取绑定列表
|
|
|
+ accountBind: baseIp + host + '/wechat/account/bind', // 账号绑定
|
|
|
+ homePageInfo: baseIp + host + '/wechat/account/info/', // 首页获取用水量等信息
|
|
|
+ billList: baseIp + host + '/wechat/bill/list', // 首页获取用水量等信息
|
|
|
+ accountList: baseIp + host + '/wechat/account/list', // 首页获取用水量等信息
|
|
|
+ accountUnbind: baseIp + host + '/wechat/account/unbind', // 户号解绑方法
|
|
|
+ setDefaultAccount: baseIp + host + '/wechat/account/setDefaultAccount', // 设置默认户号
|
|
|
+ repairRegistration: baseIp + host + '/wechat/registration/repair',//报修登记
|
|
|
+ feedback: baseIp + host + '/wechat/registration/feedback',//投诉建议
|
|
|
+ mineRepair: baseIp + host + '/wechat/mine/repair',//报修登记
|
|
|
+ mineFeedback: baseIp + host + '/wechat/mine/feedback',//投诉建议
|
|
|
+ paymentList: baseIp + host + '/wechat/payment/record',//缴费记录信息
|
|
|
+ pendingBill: baseIp + host + '/wechat/bill/pending/',//代缴费用
|
|
|
+ prepayOrder: baseIp + host + '/wechat/payment/prepayOrder/',//获取缴费的订单信息
|
|
|
+ createPaymentRecord: baseIp + host + '/wechat/payment/record/create',//获取缴费的订单信息
|
|
|
+ updateRadstateStatus: baseIp + host + '/wechat/account/readStatus',//修改已读状态
|
|
|
+ updateRadstateStatusAll: baseIp + host + '/wechat/account/readStatusAll',//全部消息已读
|
|
|
+ waterList: baseIp + host + '/water/list',//从主库获取全部水站信息
|
|
|
+ getHuMing: baseIp + host + '/wechat/account/getHuMing'//根据户号、水站获取户名
|
|
|
+ }
|
|
|
+ // 微信静态文件预览方式 使用二开服务的使用次方法
|
|
|
+ this.globalData.weChatImgPreviewUrl = baseIp + "8020/wechat/";
|
|
|
+ // 平台
|
|
|
+ this.globalData.imgPreviewUrl = baseIp + "9000/common/sys/sysfile/preview/";
|
|
|
logs.unshift(Date.now())
|
|
|
wx.setStorageSync('logs', logs)
|
|
|
// 登录
|
|
|
wx.login({
|
|
|
success: res => {
|
|
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|
|
- if(res.code){
|
|
|
+ if (res.code) {
|
|
|
const _this = this
|
|
|
// 登录
|
|
|
wx.showLoading({
|
|
@@ -31,11 +66,11 @@ App({
|
|
|
},
|
|
|
success(res) {
|
|
|
wx.hideLoading()
|
|
|
- if (!res.data.code || res.data.code!= "200") {
|
|
|
+ if (!res.data.code || res.data.code != "200") {
|
|
|
utils.simleInfoWithBack('登录失败,请稍后再试')
|
|
|
return
|
|
|
}
|
|
|
- _this.globalData.launchPara=options.query.deskey;
|
|
|
+ _this.globalData.launchPara = options.query.deskey;
|
|
|
const resData = res.data.data
|
|
|
if (resData) {
|
|
|
_this.globalData.userWxInfo = {
|
|
@@ -45,27 +80,27 @@ App({
|
|
|
// 当前用户所关联的户号信息
|
|
|
bindAccountInfo: resData.swUserManagementVos,
|
|
|
// 当前用户所对应的水务公司
|
|
|
- currentDsKey:""
|
|
|
+ currentDsKey: ""
|
|
|
}
|
|
|
- if(resData.swUserManagementVos.length!=0){
|
|
|
- _this.globalData.currentAccountInfo=(resData.swUserManagementVos||[])[0];
|
|
|
- _this.globalData.userWxInfo.currentDsKey=(resData.swUserManagementVos||[])[0].dsKey;
|
|
|
+ if (resData.swUserManagementVos.length != 0) {
|
|
|
+ _this.globalData.currentAccountInfo = (resData.swUserManagementVos || [])[0];
|
|
|
+ _this.globalData.userWxInfo.currentDsKey = (resData.swUserManagementVos || [])[0].dsKey;
|
|
|
};
|
|
|
- // _this.globalData.waterCompanys=resData.waterCompany;
|
|
|
+ // _this.baseIp.waterCompanys=resData.waterCompany;
|
|
|
if (resData.swUserManagementVos.length == 0) {
|
|
|
- _this.globalData.refresh=0;
|
|
|
+ _this.globalData.refresh = 0;
|
|
|
wx.navigateTo({
|
|
|
- url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
})
|
|
|
} else {
|
|
|
- _this.globalData.refresh=1;
|
|
|
+ _this.globalData.refresh = 1;
|
|
|
wx.switchTab({
|
|
|
url: '/pages/homepage/homepage',
|
|
|
- success:function () {
|
|
|
+ success: function () {
|
|
|
var page = getCurrentPages().pop();
|
|
|
if (page == undefined || page == null) return;
|
|
|
- page.onLoad(); //重新刷新页面
|
|
|
- }
|
|
|
+ page.onLoad(); //重新刷新页面
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
} else {
|
|
@@ -77,15 +112,15 @@ App({
|
|
|
utils.simleInfo('登录失败,请稍后再试')
|
|
|
}
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
utils.simleInfo('登录失败,请稍后再试')
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
globalData: {
|
|
|
- nickName:"",
|
|
|
- avatarUrl:"",
|
|
|
+ nickName: "",
|
|
|
+ avatarUrl: "",
|
|
|
// 当前用户信息
|
|
|
userWxInfo: {},
|
|
|
// 系统中存在的水务公司
|
|
@@ -93,41 +128,17 @@ App({
|
|
|
// 小程序启动时带的参数
|
|
|
launchPara: null,
|
|
|
// 当前用户所选择的账户信息
|
|
|
- currentAccountInfo:null,
|
|
|
+ currentAccountInfo: null,
|
|
|
// 是否刷新主页数据
|
|
|
- refresh:0,
|
|
|
+ refresh: 0,
|
|
|
+ baseIp: "",
|
|
|
// 系统接口地址
|
|
|
interfaceUrls: {
|
|
|
- loginUrl: baseIp+ '/wechat/login', // 登录+获取绑定列表
|
|
|
- accountBind: baseIp+ '/wechat/account/bind', // 账号绑定
|
|
|
- homePageInfo: baseIp+ '/wechat/account/info/', // 首页获取用水量等信息
|
|
|
- billList: baseIp+ '/wechat/bill/list', // 首页获取用水量等信息
|
|
|
- accountList: baseIp+ '/wechat/account/list', // 首页获取用水量等信息
|
|
|
- accountUnbind: baseIp+ '/wechat/account/unbind', // 户号解绑方法
|
|
|
- setDefaultAccount: baseIp+ '/wechat/account/setDefaultAccount', // 设置默认户号
|
|
|
- repairRegistration: baseIp+ '/wechat/registration/repair',//报修登记
|
|
|
- feedback: baseIp+ '/wechat/registration/feedback',//投诉建议
|
|
|
- mineRepair: baseIp+ '/wechat/mine/repair',//报修登记
|
|
|
- mineFeedback: baseIp+ '/wechat/mine/feedback',//投诉建议
|
|
|
- paymentList: baseIp+ '/wechat/payment/record',//缴费记录信息
|
|
|
- pendingBill: baseIp+ '/wechat/bill/pending/',//代缴费用
|
|
|
- prepayOrder:baseIp+ '/wechat/payment/prepayOrder/',//获取缴费的订单信息
|
|
|
- createPaymentRecord:baseIp+ '/wechat/payment/record/create',//获取缴费的订单信息
|
|
|
- updateRadstateStatus: baseIp+ '/wechat/account/readStatus',//修改已读状态
|
|
|
- updateRadstateStatusAll: baseIp+ '/wechat/account/readStatusAll',//全部消息已读
|
|
|
- waterList: baseIp+ '/water/list',//从主库获取全部水站信息
|
|
|
- getHuMing: baseIp+ '/wechat/account/getHuMing'//根据户号、水站获取户名
|
|
|
},
|
|
|
// 微信静态文件预览方式 使用二开服务的使用次方法
|
|
|
- // weChatImgPreviewUrl: "http://192.168.0.215:8020/wechat/",
|
|
|
- // weChatImgPreviewUrl: "http://61.177.40.178:8020/wechat/",
|
|
|
- weChatImgPreviewUrl: "https://www.izilaishui.com:8020/wechat/",
|
|
|
-
|
|
|
+ weChatImgPreviewUrl: "",
|
|
|
// 平台
|
|
|
- // imgPreviewUrl:"http://192.168.0.215:9000/common/sys/sysfile/preview/",
|
|
|
- // imgPreviewUrl:"http://61.177.40.178:9000/common/sys/sysfile/preview/",
|
|
|
- imgPreviewUrl:"https://www.izilaishui.com:9000/common/sys/sysfile/preview/",
|
|
|
-
|
|
|
+ imgPreviewUrl: "",
|
|
|
// 统一管理图片路径
|
|
|
images: {
|
|
|
logo: '/static_file/logo.png',
|
|
@@ -141,10 +152,10 @@ App({
|
|
|
tzd: '/static_file/tzd.png',
|
|
|
phone: '/static_file/phone.png',
|
|
|
yl: '/static_file/yl.png',
|
|
|
- jcsfcjtzd:'/static_file/jcsfcjtzd.jpg'
|
|
|
+ jcsfcjtzd: '/static_file/jcsfcjtzd.jpg'
|
|
|
}
|
|
|
},
|
|
|
// 用户通知公告
|
|
|
- notices:[]
|
|
|
+ notices: []
|
|
|
}
|
|
|
})
|