2 Star 0 Fork 0

小企上云/新中德小程序

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 4.29 KB
一键复制 编辑 原始数据 按行查看 历史
Robin 提交于 2024-04-28 09:16 +08:00 . 样式调整
import UCML from './utils/UCML';
import wxDataHandle from './utils/wxDataHandle';
import EventHandle from './utils/EventHandle';
wx.App = {
//baseUrl: 'http://192.168.108.210:8112/',//'http://192.168.110.74:8090/',http://localhost:8090/
baseUrl: 'https://interface.itcanhelp.cn/',
//baseUrl: 'https://xzdwx.xzdsj.com/',
isUCMLCore: true
};
App({
onLaunch: function() {
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
this.globalData.Custom = capsule;
this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
} else {
this.globalData.CustomBar = e.statusBarHeight + 50;
}
}
})
// 展示本地存储能力q
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs);
var openid = wx.getStorageSync("openid");
if (openid) {
var params = {
openid: openid,
rtype: 1
};
wx.request({
url: wx.App.baseUrl + "OtherSource/WXSmallAppLogin.aspx",
method: 'POST',
data: params,
header: {
'content-type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
'UcmlType': 'json'
},
success: function(res) {
if (res.header.Token) {
wx.setStorageSync("ucmltoken", res.header.Token);
}
if (res.data.status == "1") {
wx.setStorageSync("sessionId", res.data.sessionId);
wx.setStorageSync("userName", res.data.userName);
wx.setStorageSync("employeeName", res.data.employeeName);
wx.setStorageSync("avatarUrl", res.data.avatarUrl);
var url = getCurrentPages().length ? 'BPO_WXSmallAppHome' : 'pages/WXSmallAppSys/BusinessUnit/BPO_WXSmallAppHome';
wx.reLaunch({
url: url
});
} else if (res.data.status == "2") {
var url = getCurrentPages().length ? 'BPO_WXSmallAppLogin' : 'pages/WXSmallAppSys/BusinessUnit/BPO_WXSmallAppLogin';
wx.reLaunch({
url: url
});
}else{
console.log(res.data.text);
}
}
});
} else {
wx.login({
success: function(res) {
var params = {
code: res.code,
rtype: 3
};
wx.request({
url: wx.App.baseUrl + "OtherSource/WXSmallAppLogin.aspx",
method: 'POST',
data: params,
header: {
'content-type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
'UcmlType': 'json'
},
success: function (res) {
if (res.header.Token) {
wx.setStorageSync("ucmltoken", res.header.Token);
}
if (res.data.status == "1") {
wx.setStorageSync("sessionId", res.data.sessionId);
wx.setStorageSync("userName", res.data.userName);
wx.setStorageSync("employeeName", res.data.employeeName);
wx.setStorageSync("avatarUrl", res.data.avatarUrl);
wx.setStorageSync("openid", res.data.openid);
wx.setStorageSync("unionid", res.data.unionid);
console.log(res.data.unionid);
var url = getCurrentPages().length ? 'BPO_WXSmallAppHome' : 'pages/WXSmallAppSys/BusinessUnit/BPO_WXSmallAppHome';
wx.reLaunch({
url: url
});
} else if (res.data.status == "2") {
wx.setStorageSync("openid", res.data.openid);
wx.setStorageSync("unionid", res.data.unionid);
console.log(res.data.unionid);
var url = getCurrentPages().length ? 'BPO_WXSmallAppLogin' : 'pages/WXSmallAppSys/BusinessUnit/BPO_WXSmallAppLogin';
wx.reLaunch({
url: url
});
} else {
console.log(res.data.text);
}
}
});
}
});
}
},
getSession: function() {
},
globalData: {
userInfo: null,
UCML: UCML,
wxUCMLSetting: wx.App,
wxDataEventBind: wxDataHandle,
EventHandler: EventHandle
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML/CSS
1
https://gitee.com/small-enterprise-cloud/xzd-apple.git
git@gitee.com:small-enterprise-cloud/xzd-apple.git
small-enterprise-cloud
xzd-apple
新中德小程序
master

搜索帮助

371d5123 14472233 46e8bd33 14472233