我的任务跳转

master
Tuisku 3 years ago
parent 4f4d9d5113
commit 5bd3a35176

@ -21,7 +21,7 @@
<view class="{{showOrHide?'shadow':''}}" bind:tap="closeMask" /> <view class="{{showOrHide?'shadow':''}}" bind:tap="closeMask" />
<!-- 任务展示 --> <!-- 任务展示 -->
<view class="quest"> <view class="quest">
<view class="quest_crad" wx:for="{{questes}}" wx:key="index" data-url="/pages/quest/subpage/detail/detail" data-quest="{{item}}" bindtap="to"> <view class="quest_crad" wx:for="{{questes}}" wx:key="index" data-url="/pages/quest/subpage/detail/detail" data-quest="{{item.id}}" bindtap="to">
<view class="card_top"> <view class="card_top">
<view class="card_time">{{item.start}}-{{item.end}}</view> <view class="card_time">{{item.start}}-{{item.end}}</view>
<view class="card_status" style="color:{{item.status === 2 ? '#999999' : item.status === 0 ? '#999999' : item.isReceived === 0 ? '#FF8B3C' : '#006BFF'}};">{{item.status === 2 ? '已完成' : item.status === 0 ? '未开始' : item.isReceived === 0 ? '待领取' : '进行中'}}</view> <view class="card_status" style="color:{{item.status === 2 ? '#999999' : item.status === 0 ? '#999999' : item.isReceived === 0 ? '#FF8B3C' : '#006BFF'}};">{{item.status === 2 ? '已完成' : item.status === 0 ? '未开始' : item.isReceived === 0 ? '待领取' : '进行中'}}</view>

@ -115,7 +115,6 @@ Page({
}) })
this.userlogin() this.userlogin()
} else { } else {
} }
}) })
} }
@ -172,15 +171,19 @@ Page({
key: 'token', key: 'token',
data: res.data.token data: res.data.token
}) })
wx.qy.login({ if (this.data.userInfo.departmentName===''||this.data.userInfo.departmentName===null) {
success: function (res) { this.fresh()
http("/qywx/userDepartmentRefresh", "post", { } else {
code: res.code wx.qy.login({
}).then(res => { success: function (res) {
console.log(res) http("/qywx/userDepartmentRefresh", "post", {
}) code: res.code
} }).then(res => {
}) console.log(res)
})
}
})
}
} }
}) })
} }

@ -11,9 +11,9 @@
<!-- <button bindtap="getUserProfile" open-type="getUserInfo">注册</button> --> <!-- <button bindtap="getUserProfile" open-type="getUserInfo">注册</button> -->
<view class="user_name"> <view class="user_name">
<view class="user_name2">{{user_name}} <view class="user_name2">{{user_name}}
<button class="fresh" bindtap="fresh">点击刷新组织架构</button> <!-- <button class="fresh" bindtap="fresh">点击刷新组织架构</button> -->
</view> </view>
<view class="user_tip">{{userInfo.departmentName}}-{{userInfo.userid}}</view> <view class="user_tip" bindtap="fresh">{{userInfo.departmentName}}-{{userInfo.userid}}</view>
</view> </view>
</view> </view>
<view class="balance" data-url="/pages/user/subpage/integral/integral" bindtap="to"> <view class="balance" data-url="/pages/user/subpage/integral/integral" bindtap="to">

@ -19,11 +19,11 @@ const time = se => {
return '' return ''
} }
var minutes = parseInt(se / (1000 * 60)); var minutes = parseInt(se / (1000 * 60));
if (minutes < 10){ if (minutes < 10) {
minutes = '0' + minutes minutes = '0' + minutes
} }
var seconds = parseInt((se % (1000 * 60)) / 1000); var seconds = parseInt((se % (1000 * 60)) / 1000);
if (seconds < 10){ if (seconds < 10) {
seconds = '0' + seconds seconds = '0' + seconds
} }
// console.log(minutes + " 分钟 " + seconds + " 秒 ") // console.log(minutes + " 分钟 " + seconds + " 秒 ")
@ -60,6 +60,97 @@ const http = (url, method, data, isLoading = true) => {
resolve(res.data); resolve(res.data);
} else if (10008 === res.data.code && res.data.msg === "未注册!") { } else if (10008 === res.data.code && res.data.msg === "未注册!") {
resolve(res.data) 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 { } else {
wx.showToast({ wx.showToast({
title: res.data.msg, title: res.data.msg,

Loading…
Cancel
Save