Files
xk-doctor-wx/subPackages/sub_my/my_setAct.vue
李琦 31551437c2 1. 更新切换账号逻辑
2. 诊所管理员功能上线
2026-05-30 16:36:33 +08:00

151 lines
4.4 KiB
Vue

<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>
<view class="p-row-32 m-t-8 white b-r-8">
<account-switch-entry />
</view>
<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'
import AccountSwitchEntry from '@/components/account-switch/account-switch-entry.vue'
import { chooseAvatarImage } from '@/common/js/select-avatar-image.js';
export default {
components: { AccountSwitchEntry },
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() {
chooseAvatarImage({
formData: {
store_id: uni.getStorageSync('store_id') || '11001',
},
onSuccess: (res) => {
const req = this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data;
if (req.errcode == 0) {
toUpload({
store_id: uni.getStorageSync('store_id') || '11001',
avatar: req.data.url,
}).then(() => {
this.getDoctor();
this.$toast('编辑成功');
});
} 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">
</style>