http请求修改
This commit is contained in:
@@ -12,10 +12,6 @@ const http = (method, url, data, header= headerDefault) => {
|
||||
let Authorization = wx.getStorageSync(TokenKey) ? wx.getStorageSync(TokenKey) : '';
|
||||
header[TokenKey] = Authorization == '' ? '' : Authorization
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
wx.request({
|
||||
method: method,
|
||||
url: baseUrl + url,
|
||||
@@ -24,34 +20,14 @@ const http = (method, url, data, header= headerDefault) => {
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
if (res.statusCode === 200) {
|
||||
// 接口请求错误的时候提示
|
||||
if((res.data.code !== 200 && res.data.code !== 0) && (res.data.message)) {
|
||||
wx.showToast({
|
||||
title: res.data.message,
|
||||
icon: "none",
|
||||
duration: 800,
|
||||
mask: true
|
||||
});
|
||||
}
|
||||
// 200: 服务端业务处理正常结束
|
||||
resolve(res.data)
|
||||
} else {
|
||||
reject(res.data);
|
||||
wx.hideLoading();
|
||||
// wx.showToast({
|
||||
// title: "登录失效,请重新登录",
|
||||
// icon: "none",
|
||||
// duration: 1500,
|
||||
// mask: true
|
||||
// });
|
||||
// wx.navigateTo({
|
||||
// url: '/pages/login/login',
|
||||
// })
|
||||
console.error("登录失效3");
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
console.error(err);
|
||||
reject(err);
|
||||
wx.hideLoading();
|
||||
},
|
||||
|
||||
@@ -11,6 +11,10 @@ Page({
|
||||
},
|
||||
|
||||
loadData(){
|
||||
wx.showToast({
|
||||
title: '加载中...',
|
||||
icon: 'loading'
|
||||
})
|
||||
let params = {
|
||||
pageNo: this.data.pageNo,
|
||||
pageSize: this.data.pageSize
|
||||
@@ -23,6 +27,12 @@ Page({
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'fail',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
},
|
||||
// 分标委详情页
|
||||
|
||||
@@ -27,24 +27,40 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
wx.showToast({
|
||||
title: '加载中...',
|
||||
icon: 'loading'
|
||||
})
|
||||
this.data.id = options.id
|
||||
MeetingApi.meetingList({caseCommitteeId: this.data.id}).then(res=>{
|
||||
if(res.success){
|
||||
if(res.result.records && res.result.records.length >= 1){
|
||||
if(res.result.records && res.result.records.length <= 2){
|
||||
this.setData({
|
||||
meetingList: res.result.records
|
||||
})
|
||||
}else if(res.result.records && res.result.records.length >= 2){
|
||||
}else if(res.result.records && res.result.records.length > 2){
|
||||
this.setData({
|
||||
meetingList: res.result.records.slice(1)
|
||||
meetingList: res.result.records.slice(0,2)
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'fail',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
UserApi.committeeDetail({id: this.data.id}).then(res=>{
|
||||
this.setData({
|
||||
form: res.result
|
||||
})
|
||||
}).catch(err => {
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'fail',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@ Page({
|
||||
}
|
||||
},
|
||||
loadData(){
|
||||
wx.showToast({
|
||||
title: '加载中...',
|
||||
icon: 'loading'
|
||||
})
|
||||
UserApi.messageList(this.data.searchParams).then(res=>{
|
||||
if(res.success){
|
||||
// 搜索时,把原数据清空,重新筛选
|
||||
@@ -56,6 +60,12 @@ Page({
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'fail',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
},
|
||||
// 点击首页的五个选项跳转页面
|
||||
|
||||
@@ -101,6 +101,10 @@ Page({
|
||||
},
|
||||
// 获取会议列表数据
|
||||
queryMeetingList(){
|
||||
wx.showToast({
|
||||
title: '加载中...',
|
||||
icon: 'loading'
|
||||
})
|
||||
MeetingApi.meetingList(this.data.searchParams).then(res => {
|
||||
if(res.success){
|
||||
// 搜索时,把原数据清空,重新筛选
|
||||
|
||||
+27
-34
@@ -1,8 +1,6 @@
|
||||
// pages/mine/mine.js
|
||||
import UserApi from '../../assets/js/http/userApi'
|
||||
import {
|
||||
isLogin
|
||||
} from '../../assets/js/common'
|
||||
import {isLogin} from '../../assets/js/common'
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -34,7 +32,6 @@ Page({
|
||||
unBind() {
|
||||
isLogin(() => {
|
||||
wx.showModal({
|
||||
cancelColor: '取消',
|
||||
content: '确定解绑并退出登录?',
|
||||
confirmColor: '#069F99',
|
||||
success(res) {
|
||||
@@ -59,38 +56,34 @@ Page({
|
||||
},
|
||||
// 扫码签到
|
||||
scanCode() {
|
||||
// isLogin(() => {
|
||||
// wx.scanCode({
|
||||
// onlyFromCamera: false,
|
||||
// scanType: [],
|
||||
// success: (result) => {
|
||||
// console.log(result)
|
||||
// },
|
||||
// fail: (res) => {
|
||||
// console.log(result)
|
||||
// },
|
||||
// complete: (res) => {
|
||||
// console.log(result)
|
||||
// },
|
||||
// })
|
||||
// 成功扫码的回调 1448213074467938306,1448107789464113154
|
||||
UserApi.scanCode({
|
||||
meetingId: '1448213074467938306'
|
||||
}).then(res => {
|
||||
if (res.success) {
|
||||
let result = JSON.stringify(res.result)
|
||||
wx.navigateTo({
|
||||
url: `../scanSign/scanSign?signed=1&meeting=${result}`,
|
||||
})
|
||||
} else {
|
||||
let result = JSON.stringify(res.result)
|
||||
// 未查到报名信息
|
||||
wx.navigateTo({
|
||||
url: `../scanSign/scanSign?signed=0&meeting=${result}`,
|
||||
isLogin(() => {
|
||||
wx.scanCode({
|
||||
onlyFromCamera: false,
|
||||
scanType: [],
|
||||
success: (result) => {
|
||||
console.log(result)
|
||||
let meetingId = result.result // 会议Id
|
||||
// 成功扫码的回调
|
||||
UserApi.scanCode({
|
||||
meetingId
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.success) {
|
||||
let result = JSON.stringify(res.result)
|
||||
wx.navigateTo({ // 已报名
|
||||
url: `../scanSign/scanSign?signed=1&meeting=${result}`,
|
||||
})
|
||||
} else {
|
||||
// let result = JSON.stringify(res.result)
|
||||
// 未查到报名信息
|
||||
wx.navigateTo({ // 未报名
|
||||
url: `../scanSign/scanSign?signed=0&meeting=${1}`,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
// })
|
||||
})
|
||||
},
|
||||
// 我的资料
|
||||
mineData() {
|
||||
@@ -98,7 +91,7 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: '../mineData/mineData',
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
// 我的合同
|
||||
mineContract() {
|
||||
|
||||
@@ -60,6 +60,10 @@ Page({
|
||||
})
|
||||
},
|
||||
loadData(){
|
||||
wx.showToast({
|
||||
title: '加载中...',
|
||||
icon: 'loading'
|
||||
})
|
||||
if(this.data.type == 'project'){
|
||||
UserApi.projectList(this.data.searchParams).then(res=>{
|
||||
if(res.success){
|
||||
@@ -78,7 +82,7 @@ Page({
|
||||
}).catch(err=>{
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'fail',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
|
||||
@@ -37,16 +37,22 @@ Page({
|
||||
MeetingApi.meetingList({workingGroupProjectId: this.data.id}).then(res=>{
|
||||
console.log(res)
|
||||
if(res.success){
|
||||
if(res.result.records && res.result.records.length >= 1){
|
||||
if(res.result.records && res.result.records.length <= 2){
|
||||
this.setData({
|
||||
meetingList: res.result.records
|
||||
})
|
||||
}else if(res.result.records && res.result.records.length >= 2){
|
||||
}else if(res.result.records && res.result.records.length > 2){
|
||||
this.setData({
|
||||
meetingList: res.result.records.slice(1)
|
||||
meetingList: res.result.records.slice(0,2)
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'fail',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}
|
||||
UserApi.projectDetail({id: this.data.id}).then(res=>{
|
||||
@@ -67,6 +73,12 @@ Page({
|
||||
})
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'fail',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import UserApi from '../../assets/js/http/userApi'
|
||||
import { baseUrl, URL_CONFIG } from '../../assets/js/http/api'
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -6,9 +7,9 @@ Page({
|
||||
*/
|
||||
data: {
|
||||
form: {},
|
||||
isSigned: 1, // 默认未报名
|
||||
isSigned: 1, // 是否报名
|
||||
fileId: '', // 图片id
|
||||
src: 'null' // 签名之后,保存签名的图片地址
|
||||
src: null // 签名之后,保存签名的图片地址
|
||||
},
|
||||
// 去签到页
|
||||
scanSign(){
|
||||
@@ -45,6 +46,12 @@ Page({
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'fail',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
},
|
||||
// 去报名
|
||||
@@ -57,9 +64,16 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
console.log(options)
|
||||
let meeting = JSON.parse(options.meeting)
|
||||
let src
|
||||
if(meeting.checkFile){ // 签到名回显
|
||||
src = baseUrl + URL_CONFIG + 'sys/common/download/' + meeting.checkFile
|
||||
}else{
|
||||
src = ''
|
||||
}
|
||||
this.setData({
|
||||
isSigned: options.signed,
|
||||
src
|
||||
})
|
||||
let form = JSON.parse(options.meeting)
|
||||
this.setData({
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
<text>{{form.startTime}}</text>
|
||||
</view>
|
||||
<!-- 已报名信息显示的内容start -->
|
||||
<view wx:if="{{isSigned}}">
|
||||
<view wx:if="{{isSigned == '1'}}">
|
||||
<text>参会单位</text>
|
||||
<text>{{form.companyName}}</text>
|
||||
</view>
|
||||
<view wx:if="{{isSigned}}">
|
||||
<view wx:if="{{isSigned == '1'}}">
|
||||
<text>参会人</text>
|
||||
<text>{{form.companyContactName}}</text>
|
||||
</view>
|
||||
<view wx:if="{{isSigned}}">
|
||||
<view wx:if="{{isSigned == '1'}}">
|
||||
<text>是否签到</text>
|
||||
<text>{{form.checkIn ? '是' : '否'}}</text>
|
||||
</view>
|
||||
@@ -38,17 +38,17 @@
|
||||
<view class="imageBox" wx:if="{{src}}">
|
||||
<image src="{{src}}" ></image>
|
||||
</view>
|
||||
<view class="scanSign" wx:if="{{isSigned && !form.checkIn}}">
|
||||
<view class="scanSign" wx:if="{{isSigned == '1' && !form.checkIn}}">
|
||||
<text bindtap="sureSign">签到</text>
|
||||
</view>
|
||||
<!-- 已报名信息显示的内容end -->
|
||||
|
||||
<!-- 未报名显示的内容start -->
|
||||
|
||||
<view class="warning-text" wx:if="{{!isSigned}}">
|
||||
<view class="warning-text" wx:if="{{isSigned == '0'}}">
|
||||
<image src="../../assets/images/warning.png"></image>
|
||||
<text>很抱歉,未查询到您的报名信息</text>
|
||||
</view>
|
||||
<view class="scanSign" wx:if="{{!isSigned}}">
|
||||
<view class="scanSign" wx:if="{{isSigned == '0'}}">
|
||||
<text bindtap="goSignUp">去报名</text>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user