This commit is contained in:
zoujiandong
2025-06-17 17:58:29 +08:00
commit b496603f7c
129 changed files with 14644 additions and 0 deletions
+149
View File
@@ -0,0 +1,149 @@
// 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();
Page({
/**
* 页面的初始数据
*/
data: {
isLogin:false,
userInfo:{
hospitalName:'',
name:'',
photo:'',
passNum:'',
waitNum:'',
refuseNum:'',
},
waitSubmitNum:0,
img_host:app.hostConfig().imghost
},
goLogin:throttle(function(){
app.method.navigateTo({
url:'/case/pages/mobileLogin/mobileLogin'
})
}),
goAgree:throttle(function(){
app.method.navigateTo({
url: '/case/pages/agreement/agreement',
})
}),
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"
}
 wx.setStorageSync(token,'');
 wx.setStorageSync('draftTime','');
wx.reLaunch({
url:'/case/pages/mobileLogin/mobileLogin'
})
})
}),
handleGetInfo(){
let {userInfo}=this.data;
getInfo().then(res=>{
this.setData({
isLogin:true
});
for (const key in userInfo) {
this.setData({
['userInfo.'+key]:res[key]
})
}
}).catch(error=>{
if(error.code==30007){
this.setData({
isLogin:false
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.storeBindings = createStoreBindings(this, {
store,
fields: [,"active"],
actions: ["updateActive"],
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow(){
let caseDraft=wx.getStorageSync('caseDraft');
if(caseDraft){
this.setData({
waitSubmitNum:1
})
}else{
this.setData({
waitSubmitNum:0
})
}
this.handleGetInfo();
this.updateActive('center')
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
this.storeBindings.destroyStoreBindings();
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
// onShareAppMessage() {
// }
})
+7
View File
@@ -0,0 +1,7 @@
{
"usingComponents": {
"van-image": "@vant/weapp/image/index",
"van-icon": "@vant/weapp/icon/index"
},
"navigationStyle":"custom"
}
+58
View File
@@ -0,0 +1,58 @@
<!--pages/personCenter/personCenter.wxml-->
<view class="nav">
<view class="title">个人中心</view>
</view>
<view class="page">
<view class="headbox" wx:if="{{isLogin}}">
<van-image round class="headImg" width="240rpx" height="240rpx" src="{{userInfo.photo?userInfo.photo:img_host+'/default_avatar.png'}}"
/>
<view class="name">{{userInfo.name}}</view>
<view class="hospital">{{userInfo.hospitalName}}</view>
</view>
<view class="headbox" wx:else bind:tap="goLogin">
<van-image round class="headImg" width="240rpx" height="240rpx" src="{{img_host+'/default_avatar.png'}}"
/>
<view class="name">点击登录</view>
<view class="hospital">-</view>
</view>
<view class="databox">
<videw class="datacell">
<view class="num">{{isLogin?userInfo.passNum:'-'}}</view>
<view class="name">已通过</view>
</videw>
<videw class="datacell">
<view class="num">{{isLogin?userInfo.waitNum:'-'}}</view>
<view class="name">待审核</view>
</videw>
<videw class="datacell">
<view class="num {{isLogin?'active':'-'}}">{{isLogin?userInfo.refuseNum:'-'}}</view>
<view class="name">待修改</view>
</videw>
<videw class="datacell">
<view class="num {{isLogin?'active':'-'}}">{{isLogin?waitSubmitNum:'-'}}</view>
<view class="name">待提交</view>
</videw>
</view>
<view class="itembox">
<view class="cell" bind:tap="goAgree">
<view class="row">
<view class="left">
<image src="{{img_host+'/xiangmu.png'}}" mode="" class="item"/>
<view class="name">项目协议</view>
</view>
<van-icon name="arrow" color="#8c8c8c"/>
</view>
</view>
<view class="cell" bind:tap="goDescription">
<view class="row">
<view class="left">
<image src="{{img_host+'/caozuo.png'}}" mode="" class="item"/>
<view class="name">操作说明</view>
</view>
<van-icon name="arrow" color="#8c8c8c"/>
</view>
</view>
</view>
<view class="logout" wx:if="{{isLogin}}" bind:tap="handleLogout">退出登录</view>
</view>
+116
View File
@@ -0,0 +1,116 @@
/* pages/personCenter/personCenter.wxss */
page{
background-image: linear-gradient( #cdf0ff,#F7F9F9 30%);
}
.page{
margin-top: 180rpx;
}
.nav{
position: fixed;
top:0;
height:290rpx;
width:750rpx;
}
.nav .title{
font-size: 36rpx;
font-weight: 600;
color: #272B34;
margin: 106rpx 32rpx 0;
}
.headbox{
margin:0 32rpx 24rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.headbox .name{
margin-top: 15rpx;
font-size: 36rpx;
line-height: 54rpx;
font-weight: 550;
color: rgba(0,0,0,0.85);
}
.hospital{
line-height: 44rpx;
font-size: 28rpx;
font-weight: 400;
color: rgba(0,0,0,0.65);
}
.van-image--round{
box-shadow: 0 5rpx 10rpx 0 #ccc;
}
.databox{
padding:24rpx 0 ;
margin:0 32rpx;
display: flex;
background: #FFFFFF;
box-shadow: 0rpx 12rpx 28rpx 0rpx rgba(0,0,0,0.03);
border-radius: 16rpx;
justify-content: space-around;
}
.datacell{
display: flex;
flex-direction: column;
align-items: center;
}
.datacell .num{
font-size: 40rpx;
font-weight: bold;
color: #333333;
line-height: 48rpx;
}
.datacell .num.active{
color: #3881F7;
}
.datacell .name{
font-size: 28rpx;
font-weight: 400;
color: rgba(0,0,0,0.45);
line-height: 44rpx;
}
.itembox{
margin:24rpx 32rpx 0;
background: #FFFFFF;
box-shadow: 0rpx 12rpx 28rpx 0rpx rgba(0,0,0,0.03);
border-radius: 16rpx
}
.itembox .cell{
padding:0 24rpx;
}
.cell .row{
padding:32rpx 0;
border-bottom: 1rpx solid rgba(0,0,0,0.1);
align-items: center;
display: flex;
justify-content: space-between;
}
.cell:last-child .row{
border-bottom:none
}
.cell .left{
display: flex;
align-items: center;
}
.cell .item{
width:40rpx;
height:40rpx;
}
.itembox .left .name{
font-size: 32rpx;
margin-left: 12rpx;
font-weight: 400;
color: rgba(0,0,0,0.65);
}
.logout{
margin:32rpx 32rpx 0;
height: 88rpx;
font-size: 32rpx;
font-weight: 400;
color: #FF4D4F;
background: #FFFFFF;
border-radius: 8rpx;
align-items: center;
display: flex;
justify-content: center;
}