1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- // app.js
- App({
- onLaunch() {
- // 版本更新
- const updateManager = wx.getUpdateManager()
-
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- if (res.hasUpdate) {
- //准备更新
- updateManager.onUpdateReady(function () {
- wx.showModal({
- title: '业务交流通更新啦~',
- content: '新版本已经准备好,请重启应用',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- }
- })
- })
-
- //更新失败
- updateManager.onUpdateFailed(function () {
- wx.showModal({
- title: '出错啦',
- content: '更新失败,请检查您的网络状况',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- }
- })
- })
- }
- })
-
-
-
- // 登录
- wx.login({
- success: (res) => {
- if (res.code) {
- //获取openid
- wx.request({
- url: this.mangerUrl + '/service/weixin/getWxOpenId',
- data: {
- appNum: 12,
- js_code: res.code
- },
- success: (result) => {
- if (!!result.data && result.data.openid) {
- console.log(result, 'result');
- // this.globalData.openid = result.data.openid;
- this.globalData.appid = result.data.appid;
- // this.globalData.sessionKey = result.data.sessionKey;
- }
- }
- })
- } else {
- wx.showToast({
- title: '获取登录信息失败',
- icon: 'none',
- duration: 2000
- })
- }
- }
- })
- },
- globalData: {
- userInfo: null,
- openid: "oBkT7vu1Q8l-xsbux_i1FNmRWuJ4",
- appid: "",
- sessionKey: "",
- suiteCode: "",
- customerId: "666967",
- },
- // 跳转登录页
- goLogin(e) {
- wx.navigateTo({
- url: "/pages/login/login"
- })
- },
- // mangerUrl: 'http://test2.hhrchina.com',
- mangerUrl: "http://192.168.18.156",
- // mangerUrl: "https://www.hhrchina.com",
- // mangerUrlPath: "https://www.hhrchina.com",
- })
|