7.14 提交
This commit is contained in:
@@ -1,80 +1,158 @@
|
||||
// pages/personCenter/personCenter.js
|
||||
import {getInfo,logout} from "../../api/api"
|
||||
import {throttle} from "../../utils/util"
|
||||
import {createStoreBindings} from "mobx-miniprogram-bindings"
|
||||
import {store} from '../../store/store.js'
|
||||
const app=getApp();
|
||||
import {
|
||||
getInfo,
|
||||
logout,
|
||||
applyActivity,
|
||||
limitCount,
|
||||
getActivityStatus
|
||||
} from "../../api/api"
|
||||
import {
|
||||
throttle
|
||||
} from "../../utils/util"
|
||||
import {
|
||||
createStoreBindings
|
||||
} from "mobx-miniprogram-bindings"
|
||||
import {
|
||||
store
|
||||
} from '../../store/store.js'
|
||||
const app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
isLogin:false,
|
||||
userInfo:{
|
||||
hospitalName:'',
|
||||
name:'',
|
||||
photo:'',
|
||||
passNum:'',
|
||||
waitNum:'',
|
||||
refuseNum:'',
|
||||
|
||||
isLogin: false,
|
||||
showApply: false,
|
||||
showCancle: true,
|
||||
userInfo: {
|
||||
hospitalName: '',
|
||||
name: '',
|
||||
photo: '',
|
||||
passNum: '',
|
||||
waitNum: '',
|
||||
refuseNum: '',
|
||||
|
||||
},
|
||||
waitSubmitNum:0,
|
||||
img_host:app.hostConfig().imghost
|
||||
waitSubmitNum: 0,
|
||||
img_host: app.hostConfig().imghost
|
||||
},
|
||||
goLogin:throttle(function(){
|
||||
onCancelApply() {
|
||||
this.setData({
|
||||
showApply: false
|
||||
})
|
||||
},
|
||||
onConfirmApply: throttle(function () {
|
||||
this.setData({
|
||||
showApply: false
|
||||
})
|
||||
this.handleApply();
|
||||
}),
|
||||
goApply() {
|
||||
getActivityStatus().then(result=>{
|
||||
if(result){
|
||||
if(result.status==1){
|
||||
wx.showToast({
|
||||
title:'恭喜您,您的病例交流活动申请已通过审核',
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
}else if(result.status==2){
|
||||
wx.showToast({
|
||||
title:'您的病例交流活动申请正在审核中',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
}else{
|
||||
this.getLimit();
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
getLimit(){
|
||||
limitCount({
|
||||
type:3
|
||||
}).then(result => {
|
||||
console.log(result);
|
||||
if (result < 2) {
|
||||
wx.showToast({
|
||||
title: '病例审核通过2份及以上可申请病例交流活动',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
showApply:true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
handleApply() {
|
||||
applyActivity().then(res => {
|
||||
// wx.showToast({
|
||||
// title: '申请成功',
|
||||
// icon: 'none'
|
||||
// })
|
||||
})
|
||||
},
|
||||
goLogin: throttle(function () {
|
||||
app.method.navigateTo({
|
||||
url:'/case/pages/mobileLogin/mobileLogin'
|
||||
})
|
||||
}),
|
||||
goAgree:throttle(function(){
|
||||
url: '/case/pages/mobileLogin/mobileLogin'
|
||||
})
|
||||
}),
|
||||
goAgree: throttle(function () {
|
||||
app.method.navigateTo({
|
||||
url: '/case/pages/agreement/agreement',
|
||||
})
|
||||
}),
|
||||
goBind:throttle(function(){
|
||||
})
|
||||
}),
|
||||
goBind: throttle(function () {
|
||||
app.method.navigateTo({
|
||||
url: '/case/pages/bankCard/bankCard',
|
||||
})
|
||||
}),
|
||||
goDescription:throttle(function(){
|
||||
})
|
||||
}),
|
||||
goDescription: throttle(function () {
|
||||
app.method.navigateTo({
|
||||
url: '/case/pages/agreement/agreement?type=description',
|
||||
})
|
||||
}),
|
||||
handleLogout:throttle(function(){
|
||||
logout().then(res=>{
|
||||
// wx.clearStorageSync()
|
||||
const { envVersion } = wx.getAccountInfoSync().miniProgram;
|
||||
let token=''
|
||||
if(envVersion=="develop" || envVersion=="trial"){
|
||||
token="DEV_CASE_TOKEN"
|
||||
}else{
|
||||
token="PROD_CASE_TOKEN"
|
||||
})
|
||||
}),
|
||||
handleLogout: throttle(function () {
|
||||
logout().then(res => {
|
||||
// wx.clearStorageSync()
|
||||
const {
|
||||
envVersion
|
||||
} = wx.getAccountInfoSync().miniProgram;
|
||||
let token = ''
|
||||
if (envVersion == "develop" || envVersion == "trial") {
|
||||
token = "DEV_CASE_TOKEN"
|
||||
} else {
|
||||
token = "PROD_CASE_TOKEN"
|
||||
}
|
||||
wx.setStorageSync(token,'');
|
||||
wx.setStorageSync('draftTime','');
|
||||
wx.setStorageSync(token, '');
|
||||
wx.setStorageSync('draftTime', '');
|
||||
wx.reLaunch({
|
||||
url:'/case/pages/mobileLogin/mobileLogin'
|
||||
url: '/case/pages/mobileLogin/mobileLogin'
|
||||
})
|
||||
})
|
||||
}),
|
||||
handleGetInfo(){
|
||||
let {userInfo}=this.data;
|
||||
getInfo().then(res=>{
|
||||
}),
|
||||
handleGetInfo() {
|
||||
let {
|
||||
userInfo
|
||||
} = this.data;
|
||||
getInfo().then(res => {
|
||||
this.setData({
|
||||
isLogin:true
|
||||
isLogin: true
|
||||
});
|
||||
for (const key in userInfo) {
|
||||
this.setData({
|
||||
['userInfo.'+key]:res[key]
|
||||
})
|
||||
}
|
||||
}).catch(error=>{
|
||||
if(error.code==30007){
|
||||
this.setData({
|
||||
isLogin:false
|
||||
['userInfo.' + key]: res[key]
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (error.code == 30007) {
|
||||
this.setData({
|
||||
isLogin: false
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -83,13 +161,13 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
this.storeBindings = createStoreBindings(this, {
|
||||
store,
|
||||
fields: [,"active"],
|
||||
actions: ["updateActive"],
|
||||
});
|
||||
|
||||
|
||||
this.storeBindings = createStoreBindings(this, {
|
||||
store,
|
||||
fields: [, "active"],
|
||||
actions: ["updateActive"],
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -102,20 +180,20 @@ Page({
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow(){
|
||||
let caseDraft=wx.getStorageSync('caseDraft');
|
||||
if(caseDraft){
|
||||
this.setData({
|
||||
waitSubmitNum:1
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
waitSubmitNum:0
|
||||
})
|
||||
}
|
||||
this.handleGetInfo();
|
||||
this.updateActive('center')
|
||||
},
|
||||
onShow() {
|
||||
let caseDraft = wx.getStorageSync('caseDraft');
|
||||
if (caseDraft) {
|
||||
this.setData({
|
||||
waitSubmitNum: 1
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
waitSubmitNum: 0
|
||||
})
|
||||
}
|
||||
this.handleGetInfo();
|
||||
this.updateActive('center')
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"dialog":"../../components/dialog/dialog",
|
||||
"van-icon": "@vant/weapp/icon/index"
|
||||
},
|
||||
"navigationStyle":"custom"
|
||||
|
||||
@@ -39,20 +39,20 @@
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
<image src="../../static/info.png" mode="" class="item"/>
|
||||
<view class="name">绑定信息</view>
|
||||
<view class="name">个人认证</view>
|
||||
</view>
|
||||
<van-icon name="arrow" color="#8c8c8c"/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="cell" bind:tap="goAgree">
|
||||
<view class="cell" bind:tap="goApply">
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
<image src="{{img_host+'/xiangmu.png'}}" mode="" class="item"/>
|
||||
<view class="name">项目协议</view>
|
||||
<view class="name">千帆杯病例交流活动申请</view>
|
||||
</view>
|
||||
<van-icon name="arrow" color="#8c8c8c"/>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="cell" bind:tap="goDescription">
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
@@ -64,4 +64,5 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="logout" wx:if="{{isLogin}}" bind:tap="handleLogout">退出登录</view>
|
||||
</view>
|
||||
</view>
|
||||
<dialog showDialog="{{showApply}}" bind:confirm="onConfirmApply" cancelText="否" bind:cancel="onCancelApply" confirmText="是" message="您是否需要申请千帆杯病例交流活动"></dialog>
|
||||
Reference in New Issue
Block a user