diff --git a/pages/user/subpage/quest/quest.wxml b/pages/user/subpage/quest/quest.wxml
index 87347f1..9272e11 100644
--- a/pages/user/subpage/quest/quest.wxml
+++ b/pages/user/subpage/quest/quest.wxml
@@ -21,7 +21,7 @@
-
+
{{item.start}}-{{item.end}}
{{item.status === 2 ? '已完成' : item.status === 0 ? '未开始' : item.isReceived === 0 ? '待领取' : '进行中'}}
diff --git a/pages/user/user.js b/pages/user/user.js
index 8ea3744..9e6f5ef 100644
--- a/pages/user/user.js
+++ b/pages/user/user.js
@@ -115,7 +115,6 @@ Page({
})
this.userlogin()
} else {
-
}
})
}
@@ -172,15 +171,19 @@ Page({
key: 'token',
data: res.data.token
})
- wx.qy.login({
- success: function (res) {
- http("/qywx/userDepartmentRefresh", "post", {
- code: res.code
- }).then(res => {
- console.log(res)
- })
- }
- })
+ if (this.data.userInfo.departmentName===''||this.data.userInfo.departmentName===null) {
+ this.fresh()
+ } else {
+ wx.qy.login({
+ success: function (res) {
+ http("/qywx/userDepartmentRefresh", "post", {
+ code: res.code
+ }).then(res => {
+ console.log(res)
+ })
+ }
+ })
+ }
}
})
}
diff --git a/pages/user/user.wxml b/pages/user/user.wxml
index 6a98fca..ec12964 100644
--- a/pages/user/user.wxml
+++ b/pages/user/user.wxml
@@ -11,9 +11,9 @@
{{user_name}}
-
+
- {{userInfo.departmentName}}-{{userInfo.userid}}
+ {{userInfo.departmentName}}-{{userInfo.userid}}
diff --git a/utils/util.js b/utils/util.js
index 8ec91a9..41c8922 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -19,11 +19,11 @@ const time = se => {
return ''
}
var minutes = parseInt(se / (1000 * 60));
- if (minutes < 10){
+ if (minutes < 10) {
minutes = '0' + minutes
}
var seconds = parseInt((se % (1000 * 60)) / 1000);
- if (seconds < 10){
+ if (seconds < 10) {
seconds = '0' + seconds
}
// console.log(minutes + " 分钟 " + seconds + " 秒 ")
@@ -60,6 +60,97 @@ const http = (url, method, data, isLoading = true) => {
resolve(res.data);
} else if (10008 === res.data.code && res.data.msg === "未注册!") {
resolve(res.data)
+ } else if (10010 === res.data.code) {
+ wx.login({
+ success: res => {
+ http("/user/login", "post", {
+ code: res.code
+ }).then(res => {
+ if (res.msg === "未注册!") {
+ wx.getSystemInfo({
+ success(res) {
+ if (res.environment) {
+ // 企业微信环境
+ this.getUserProfile()
+ } else {
+ // 微信·环境
+ wx.showToast({
+ title: '初次打开请在企业微信中',
+ icon: 'none',
+ duration: 3000
+ })
+ }
+ }
+ })
+ } else {
+ getApp().globalData.token = res.data.token
+ wx.setStorage({
+ key: 'user',
+ data: res.data.user
+ })
+ wx.setStorage({
+ key: 'token',
+ data: res.data.token
+ })
+ if (res.data.user.departmentName === '' || res.data.user.departmentName === null) {
+ wx.getSystemInfo({
+ success(res) {
+ if (res.environment) {
+ // 企业微信环境
+ wx.qy.login({
+ success: function (res) {
+ http("/qywx/userDepartmentRefresh", "post", {
+ code: res.code
+ }).then(res => {
+ console.log(res)
+ if (res.success) {
+ wx.showToast({
+ title: '刷新成功',
+ icon: 'none',
+ duration: 3000
+ })
+ this.userlogin()
+ } else {}
+ })
+ }
+ })
+ } else {
+ // 微信·环境
+ wx.showToast({
+ title: '请在企业微信中打开\r\n以获取企业架构',
+ icon: 'none',
+ duration: 3000
+ })
+ }
+ }
+ })
+ } else {
+ wx.getSystemInfo({
+ success(res) {
+ if (res.environment) {
+ // 企业微信环境
+ wx.qy.login({
+ success: function (res) {
+ http("/qywx/userDepartmentRefresh", "post", {
+ code: res.code
+ }).then(res => {
+ console.log(res)
+ })
+ }
+ })
+ } else {
+ // 微信·环境
+ }
+ }
+ })
+ }
+ }
+ http(url, method, data, isLoading = true).then(res => {
+ console.log(res)
+ })
+ })
+ }
+ })
} else {
wx.showToast({
title: res.data.msg,