diff --git a/app.js b/app.js index d24175a..00ed519 100644 --- a/app.js +++ b/app.js @@ -7,6 +7,10 @@ App({ }, mplogin: function () { var that = this; + wx.showLoading({ + title: '账号自动登录中...', + icon:'none' + }) wx.login({ success: res => { // 发送 res.code 到后台换取 openId, sessionKey, unionId @@ -37,12 +41,12 @@ App({ // that.callback() //执行定义的回调函数 // } /**** KEY PART START ****/ - var pages = getCurrentPages() // get all current pages - var currentPage = pages[pages.length - 1] // Get current loading page - if (currentPage.callback){ - currentPage.callback(); // Callback - that.oncallback = false; // Callback called - } + // var pages = getCurrentPages() // get all current pages + // var currentPage = pages[pages.length - 1] // Get current loading page + // if (currentPage.callback){ + // currentPage.callback(); // Callback + // that.oncallback = false; // Callback called + // } /**** KEY PART END ****/ @@ -59,8 +63,17 @@ App({ that.globalData.userInfo.isaqy = 1 } } - }); + }); + wx.hideLoading() + wx.reLaunch({ + url: '/pages/main/main', + }) } else { + wx.showToast({ + title: '未绑定账号,请手动登录', + icon:'none' + }) + wx.hideLoading() that.globalData.userInfo.mpopenid = res.data.mpopenid wx.reLaunch({ url: '/pages/bind/binduser?mpopenid=' + res.data.mpopenid, diff --git a/app.json b/app.json index 6f72462..a474985 100644 --- a/app.json +++ b/app.json @@ -1,5 +1,6 @@ { "pages": [ + "pages/bind/binduser", "pages/main/main", "pages/index/index", "pages/logs/logs", @@ -14,7 +15,6 @@ "pages/todo/todo", "pages/trouble/troubletodo", "pages/trouble/accesstrouble", - "pages/bind/binduser", "pages/observe/addobserve", "pages/observe/observe", "pages/observe/observedetail", @@ -88,7 +88,10 @@ "pages/dickey/treeselect", "pages/troublefollow/index", "pages/troublefollow/handle", - "pages/troublefollow/detail" + "pages/troublefollow/detail", + "pages/offence/index", + "pages/offence/add", + "pages/offence/detail" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/area/tree.js b/pages/area/tree.js index 446b3d1..d861318 100644 --- a/pages/area/tree.js +++ b/pages/area/tree.js @@ -11,6 +11,8 @@ Page({ yhqy__name:e.detail.name, missqy:e.detail.id, missqy__name:e.detail.name, + offenceqy:e.detail.id, + offenceqy__name:e.detail.name, zyqy__name:e.detail.name, zyqy:e.detail.id, jyqy:e.detail.id, diff --git a/pages/bind/binduser.js b/pages/bind/binduser.js index 245c0dc..94dd2a6 100644 --- a/pages/bind/binduser.js +++ b/pages/bind/binduser.js @@ -42,9 +42,9 @@ Page({ openid:null } //重置globaldata和session getApp().mplogin() - wx.switchTab({ - url: '/pages/main/main', - }) + // wx.switchTab({ + // url: '/pages/main/main', + // }) }else{ wx.showModal({ content: '账户或密码不正确!', diff --git a/pages/images/offence.svg b/pages/images/offence.svg new file mode 100644 index 0000000..8763e7c --- /dev/null +++ b/pages/images/offence.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pages/main/main.js b/pages/main/main.js index 2c0fe20..521683f 100644 --- a/pages/main/main.js +++ b/pages/main/main.js @@ -95,13 +95,13 @@ Page({ */ onShow: function () { var that = this - - if ((getApp().globalData.sessionId != null) && (getApp().globalData.sessionId.indexOf('sessionid') != -1)) { - that.getNew() - } - else { - getApp().mplogin() - } + that.getNew() + // if ((getApp().globalData.sessionId != null) && (getApp().globalData.sessionId.indexOf('sessionid') != -1)) { + // that.getNew() + // } + // else { + // getApp().mplogin() + // } if (getApp().globalData.userInfo.companyid == 2681) { this.setData({ isGjjt: true, diff --git a/pages/main/main.wxml b/pages/main/main.wxml index 8389cae..7ac0eb8 100644 --- a/pages/main/main.wxml +++ b/pages/main/main.wxml @@ -37,6 +37,13 @@ {{yhgznum}} + + + 违章举报 + + + + 行为观察 @@ -52,12 +59,18 @@ {{jytodonum}} 合理化建议 - - - 作业许可 - {{zytodonum}} + + + + + 公告 - + + + 通知 + {{noread}} + + 风险任务 {{tasknum}} @@ -68,8 +81,12 @@ - + + + 作业许可 + {{zytodonum}} + 设备巡检 @@ -88,7 +105,6 @@ --> - @@ -108,19 +124,14 @@ 线下培训 {{dqdnum}} - - - 公告 - - - - 通知 - {{noread}} - 模拟练习 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/offence/index.wxss b/pages/offence/index.wxss new file mode 100644 index 0000000..81770db --- /dev/null +++ b/pages/offence/index.wxss @@ -0,0 +1,15 @@ +/* pages/offence/index.wxss */ +.weui-btn{ + width:auto; + margin: 5px; +} +.container { + background-color: #fff; + color: #939393; +} +.head{ + color:#fff; + background-color: cornflowerblue; + text-align: center; +} + \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index b1da53b..eb36082 100644 --- a/utils/request.js +++ b/utils/request.js @@ -10,25 +10,34 @@ function request(url, method, data) { 'Cookie': getApp().globalData.sessionId, }, success: (res => { - if (res.data.code == 1) { - resolve(res.data); - }else if(res.data.code == -1){ - getApp().onLaunch() - wx.switchTab({ - url: '/pages/main/main', - }) - } - else { - var msg = '' - if(res.data){ - msg = res.data - } + if(res.statusCode >= 500){ wx.showToast({ - title: msg, - icon: 'none', - duration: 1000 + title: '服务器错误', + icon: 'none' }) - } + }else{ + resolve(res.data); + } + + // if (res.data.code == 1) { + // resolve(res.data); + // }else if(res.data.code == -1){ + // getApp().onLaunch() + // wx.switchTab({ + // url: '/pages/main/main', + // }) + // } + // else { + // var msg = '' + // if(res.data){ + // msg = res.data + // } + // wx.showToast({ + // title: msg, + // icon: 'none', + // duration: 1000 + // }) + // } }), fail: (res => {