2024-09-19 12:57:55 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="p-2">
|
|
|
|
|
<u-navbar title="个人主页" back-icon-color="#232323" title-size="34" title-color="#232323"></u-navbar>
|
|
|
|
|
<view class="flex-col b-r-8 white p-row-32 m-b-2">
|
|
|
|
|
<view class="flex-row flex-jus-sp flex-ali-center p-col-32 bottom-border">
|
|
|
|
|
<d-text text="头像" color="#6C7380"></d-text>
|
|
|
|
|
<view class="flex-row flex-ali-center">
|
|
|
|
|
<u-image width="80rpx" height="80rpx" shape="circle" :src="doctorInfo.DoctorInfo.avatar"
|
|
|
|
|
@click="selectAct">
|
|
|
|
|
<u-loading slot="loading"></u-loading>
|
|
|
|
|
</u-image>
|
|
|
|
|
<view class="m-l-16" @click="selectAct">
|
|
|
|
|
<u-icon name="arrow-right" color="#A7ABB0" size="32"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="flex-row flex-jus-sp flex-ali-center p-col-32 bottom-border">
|
|
|
|
|
<d-text text="姓名" color="#6C7380"></d-text>
|
|
|
|
|
<d-text :text="doctorInfo.DoctorInfo.name" color="#31353D"></d-text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="flex-row flex-jus-sp flex-ali-center p-col-32 bottom-border">
|
|
|
|
|
<d-text text="性别" color="#6C7380"></d-text>
|
|
|
|
|
<d-text :text="doctorInfo.sex" color="#31353D"></d-text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="flex-row flex-jus-sp flex-ali-center p-col-32 bottom-border">
|
|
|
|
|
<d-text text="电话" color="#6C7380"></d-text>
|
|
|
|
|
<d-text :text="doctorInfo.DoctorInfo.mobile" color="#31353D"></d-text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="flex-row flex-jus-sp flex-ali-center p-col-32 bottom-border">
|
|
|
|
|
<d-text text="身份证" color="#6C7380"></d-text>
|
|
|
|
|
<d-text :text="doctorInfo.DoctorInfo.idcard" color="#31353D"></d-text>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- <view class="flex-row flex-jus-sp flex-ali-center p-col-32">
|
|
|
|
|
<d-text text="职称" color="#6C7380"></d-text>
|
|
|
|
|
<d-text :text="userInfo.title.name" color="#31353D"></d-text>
|
|
|
|
|
</view> -->
|
|
|
|
|
</view>
|
2025-02-13 10:31:01 +08:00
|
|
|
|
2024-09-19 12:57:55 +08:00
|
|
|
<view class="p-row-32 m-t-8" style="height: 100rpx;">
|
|
|
|
|
<u-button :throttle-time="0" shape="circle" :custom-style="{backgroundColor:'#6ACDBB',color:'#fff',heigth:'96rpx'}" @click="logout">
|
|
|
|
|
退出登录</u-button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
info,
|
|
|
|
|
logout,
|
|
|
|
|
toUpload,
|
|
|
|
|
} from '@/api/all.js'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
doctorInfo: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
// getAvatar() {
|
|
|
|
|
// let doctorInfo = uni.getStorageSync('doctorInfo')
|
|
|
|
|
// let url = require(`@/static/image/${doctorInfo.DoctorInfo.user.role%2==0?'nv':'nan'}.png`);
|
|
|
|
|
// // console.log(info, 'ddd')
|
|
|
|
|
// return doctorInfo.DoctorInfo['avatar'] ? doctorInfo.DoctorInfo['avatar'] : doctorInfo
|
|
|
|
|
// .DoctorInfo.user.role == 1 ? url : url
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getDoctor()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async getDoctor() {
|
|
|
|
|
let res = await info({
|
|
|
|
|
store_id: uni.getStorageSync('store_id') || '11001'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (res.errcode == 0) {
|
|
|
|
|
// console.log(res, 'wd');
|
|
|
|
|
this.doctorInfo = res.data;
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.$toast(res.msg);
|
|
|
|
|
this.loading = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
selectAct() {
|
|
|
|
|
uni.chooseImage({
|
|
|
|
|
count: 1, //默认9
|
|
|
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
|
|
sourceType: ['album', 'camera'],
|
|
|
|
|
success: (res) => {
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '请稍后...'
|
|
|
|
|
})
|
|
|
|
|
const tempFiles = res.tempFiles;
|
|
|
|
|
let resSize = tempFiles[0].size;
|
|
|
|
|
// 1M=1024KB=1048576B
|
|
|
|
|
console.log(resSize)
|
|
|
|
|
if (resSize > 1048576) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "上传图片大小不能超过1MB",
|
|
|
|
|
icon: 'error'
|
|
|
|
|
});
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
uni.uploadFile({
|
2025-02-13 10:31:01 +08:00
|
|
|
url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img',
|
2024-09-19 12:57:55 +08:00
|
|
|
filePath: res.tempFiles[0]['path'],
|
|
|
|
|
name: 'file',
|
|
|
|
|
header: {
|
|
|
|
|
authorization: `Bearer ${uni.getStorageSync('token')}`
|
|
|
|
|
},
|
|
|
|
|
formData: {
|
|
|
|
|
store_id: uni.getStorageSync('store_id') || '11001'
|
|
|
|
|
},
|
|
|
|
|
success: res => {
|
|
|
|
|
let req = this.$u.test.jsonString(res.data) ? JSON.parse(res
|
|
|
|
|
.data) : res.data
|
|
|
|
|
// console.log(req, 'req')
|
|
|
|
|
if (req.errcode == 0) {
|
|
|
|
|
toUpload({
|
|
|
|
|
store_id: uni.getStorageSync('store_id') ||
|
|
|
|
|
'11001',
|
|
|
|
|
avatar: req.data.url
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.getDoctor()
|
|
|
|
|
this.$toast('编辑成功');
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
} else {
|
|
|
|
|
this.$toast(res.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
logout() {
|
|
|
|
|
logout({store_id: uni.getStorageSync('store_id') || 11001,}).then((res) => {
|
|
|
|
|
if (res.errcode != -1) {
|
|
|
|
|
uni.clearStorage()
|
|
|
|
|
uni.clearStorageSync()
|
|
|
|
|
this.$go('/pages/login/index', 2)
|
|
|
|
|
} else {
|
|
|
|
|
this.$toast(res.msg);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// // 医生详情
|
|
|
|
|
// getInfo() {
|
|
|
|
|
// info({
|
|
|
|
|
// store_id: uni.getStorageSync('store_id') || '11001'
|
|
|
|
|
// }).then((res) => {
|
|
|
|
|
// // console.log(res.data, 'work-res');
|
|
|
|
|
// if (res.errcode == 0) {
|
|
|
|
|
// this.doctorInfo = res.data
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.getDoctor()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
page {
|
|
|
|
|
background-color: #F9FAFB;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<style scoped lang="scss">
|
2025-02-13 10:31:01 +08:00
|
|
|
</style>
|