| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727 |
- <template>
- <view class="container">
- <view class="user-section">
- <!-- <view class="bg"></view> -->
- <view class="user-info-box flex_item" @click="ToMycode">
- <view class="portrait" v-if="userInfo.type != 2 && userInfo.type">
- <image :src="userInfo.avatar"></image>
- </view>
- <view class="portrait" v-if="!userInfo.type">
- <image src="../../static/error/missing-face.png"></image>
- </view>
- <view class="portrait" v-if="userInfo.type == 2">
- <image :src="userInfo.ext_info.photo"></image>
- </view>
- <view class="info">
- <view class="name-box flex_item">
- <view class="name clamp">
- {{ (userInfo.ext_info ? (userInfo.ext_info.name ? userInfo.ext_info.name : false) : false) || '游客' }}
- </view>
- <view class="name-text" v-if="userInfo.type == 1">用户</view>
- <view class="name-text" v-if="userInfo.type == 2">医生</view>
- <view class="name-text" v-if="userInfo.type == 3">机构</view>
- </view>
- <view class="name-box flex_item" v-if="userInfo.type">
- <view class="name-text left" v-if="userInfo.type != 1 && userInfo.ext_info.status == 0">审核中
- </view>
- <view class="name-text left" v-if="userInfo.type != 1 && userInfo.ext_info.status == 2">审核不通过
- </view>
- </view>
- <view v-if="userInfo.type == 2">所在医院:{{ userInfo.ext_info.hospital_name }}</view>
- </view>
- <!-- <view class="icon flex">
- <view class="my" @click.stop="navTo('/pages/user/msg')"><image src="/static/img/img012.png"></image></view>
- </view> -->
- </view>
- <!-- <view class="myinfo flex" v-if="userInfo.type == 1" @click="navTo('/pages/userinfo/patient')">我的资料</view> -->
- <image class="arc" src="/static/img/arc.png"></image>
- </view>
- <view class="cover-container">
- <view class="info-box" v-if="userInfo.type != 2"
- @click="navTo('/pages/shareQrCode/index?spread=' + userInfo.uid)">
- <view class="info">
- <image src="/static/img/img032.png" mode="aspectFit"></image>
- </view>
- <view class="text">二维码分享</view>
- </view>
- <view class="info-box" v-if="userInfo.type == 2"
- @click="navTo('/pages/shareQrCode/card?spread=' + userInfo.uid)">
- <view class="info">
- <image src="/static/img/img032.png" mode="aspectFit"></image>
- </view>
- <view class="text">二维码分享</view>
- </view>
- <view class="item-box">
- <view class="flex item-list" @click="navTo('/pages/wallet/commission')">
- <view class="flex_item list-icon">
- <view class="icon">
- <image src="/static/img/img033.png"></image>
- </view>
- <view class="text">我的余额</view>
- </view>
- <view class="icon"><text class="iconfont iconenter"></text></view>
- </view>
- <view class="fen"></view>
- <view class="flex item-list" @click="navTo('/pages/order/myorder')">
- <view class="flex_item list-icon">
- <view class="icon">
- <image src="/static/img/img034.png"></image>
- </view>
- <view class="text">我的订单</view>
- </view>
- <view class="icon"><text class="iconfont iconenter"></text></view>
- </view>
- <view class="fen"></view>
- <view class="flex item-list" @click="navTo('/pages/recommend/index')">
- <view class="flex_item list-icon">
- <view class="icon">
- <image src="/static/img/img036.png"></image>
- </view>
- <view class="text">我的推荐</view>
- </view>
- <view class="icon"><text class="iconfont iconenter"></text></view>
- </view>
- <view class="fen"></view>
- <view class="flex item-list" v-if="userInfo.type == 1" @click="navTo('/pages/userinfo/patient')">
- <view class="flex_item list-icon">
- <view class="icon">
- <image src="/static/img/img035.png"></image>
- </view>
- <view class="text">我的资料</view>
- </view>
- <view class="icon"><text class="iconfont iconenter"></text></view>
- </view>
- <view class="flex item-list" v-if="userInfo.type == 2" @click="navTo('/pages/userinfo/doctor')">
- <view class="flex_item list-icon">
- <view class="icon">
- <image src="/static/img/img035.png"></image>
- </view>
- <view class="text">我的资料</view>
- </view>
- <view class="icon"><text class="iconfont iconenter"></text></view>
- </view>
- <view class="flex item-list" v-if="userInfo.type == 3" @click="navTo('/pages/userinfo/mechanism')">
- <view class="flex_item list-icon">
- <view class="icon">
- <image src="/static/img/img035.png"></image>
- </view>
- <view class="text">我的资料</view>
- </view>
- <view class="icon"><text class="iconfont iconenter"></text></view>
- </view>
- </view>
- </view>
- <!-- 问诊评论 -->
- <view class="item-box bottom" v-if="userInfo.type == 2">
- <view class="icon-box flex_item">
- <view class="left-icon"></view>
- <view class="flex left-box">
- <view class="left-tit">问诊评论</view>
- <view class="more" @click="navTo('/pages/user/reply?id=' + userInfo.uid)">
- 查看更多
- <text class="iconfont iconenter"></text>
- </view>
- </view>
- </view>
- <view class="left-txt" v-if="list == ''">暂无数据</view>
- <view class="ask-list flex_item" v-if="list != ''" v-for="(ls, index) in list" :key="index">
- <image :src="ls.avatar || '/static/error/missing-face.png'" class="ask-img"></image>
- <text class="ask-txt ellipsis">{{ ls.comment }}</text>
- </view>
- </view>
- <view class="list-cell" v-if="userInfo.type" @click="toLogout"><text class="cell-tit">退出登录</text></view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import uniList from '@/components/uni-list/uni-list.vue';
- import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
- import {
- getUserInfo
- } from '@/api/login.js';
- import {
- allComment
- } from '@/api/doctor.js';
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- import {
- logout
- } from '@/api/set.js';
- let startY = 0,
- moveY = 0,
- pageAtTop = true;
- export default {
- components: {
- uniList,
- uniListItem
- },
- data() {
- return {
- list: ''
- };
- },
- onShow() {
- // 判断是否已经登录
- console.log(this.hasLogin, 'user');
- this.loadBaseData();
- // if (this.hasLogin) {
- // } else {
- // this.userInfo = {
- // ext_info: {
- // status: ''
- // }
- // };
- // }
- },
- watch: {},
- computed: {
- ...mapState(['hasLogin', 'userInfo'])
- },
- methods: {
- ...mapMutations(['setUserInfo', 'setOrderInfo', 'logout']),
- //退出登录
- toLogout() {
- uni.showModal({
- content: '确定要退出登录么',
- success: e => {
- if (e.confirm) {
- this.logout();
- }
- }
- });
- },
- // 加载初始数据
- loadBaseData() {
- let obj = this;
- getUserInfo({})
- .then(({
- data
- }) => {
- obj.setUserInfo(data);
- // obj.userInfo = data;
- console.log(obj.userInfo);
- // let arr = data.map(e => {
- // e.createtime = getTime(e.createtime);
- // return e;
- // });
- this.getDoctor();
- if (data.ext_info.status == 2) {
- uni.showModal({
- title: '提示',
- content: '您的审核未通过: \n ' + data.ext_info.reason + ' \n 是否重新提交审核!',
- success: function(res) {
- if (res.confirm) {
- console.log('用户点击确定');
- if (data.type == 2) {
- uni.navigateTo({
- url: '/pages/public/DocRegister'
- });
- }
- if (data.type == 3) {
- uni.navigateTo({
- url: '/pages/public/MecRegister'
- });
- }
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }
- // 1是病人 2是医生 3是机构
- if (obj.userInfo.type == 2) {
- uni.setTabBarItem({
- index: 0,
- text: '首页',
- iconPath: 'static/tabBar/tab-home.png',
- selectedIconPath: 'static/tabBar/tab-home-current.png'
- });
- uni.setTabBarItem({
- index: 1,
- text: '我的病人',
- iconPath: 'static/tabBar/tab-cate.png',
- selectedIconPath: 'static/tabBar/tab-cate-current.png',
- visible: true
- });
- uni.setTabBarItem({
- index: 2,
- text: '科普学习',
- iconPath: 'static/tabBar/tab-study.png',
- selectedIconPath: 'static/tabBar/tab-study-current.png',
- visible: false
- });
- uni.setTabBarItem({
- index: 3,
- text: '接单',
- iconPath: 'static/tabBar/jd.png',
- selectedIconPath: 'static/tabBar/jd-act.png',
- pagePath: '/pages/dd/dd',
- visible:true
- })
- uni.setTabBarItem({
- index: 4,
- text: '我的',
- iconPath: 'static/tabBar/tab-my.png',
- selectedIconPath: 'static/tabBar/tab-my-current.png'
- });
- }
- if (obj.userInfo.type == 1) {
- uni.setTabBarItem({
- index: 0,
- text: '首页',
- iconPath: 'static/tabBar/tab-home.png',
- selectedIconPath: 'static/tabBar/tab-home-current.png'
- });
- uni.setTabBarItem({
- index: 1,
- text: '咨询记录',
- iconPath: 'static/tabBar/tab-cate.png',
- selectedIconPath: 'static/tabBar/tab-cate-current.png',
- visible: true
- });
- uni.setTabBarItem({
- index: 2,
- text: '科普学习',
- iconPath: 'static/tabBar/tab-study.png',
- selectedIconPath: 'static/tabBar/tab-study-current.png',
- visible: false
- });
- uni.setTabBarItem({
- index: 3,
- text: '接单',
- iconPath: 'static/tabBar/jd.png',
- selectedIconPath: 'static/tabBar/jd-act.png',
- visible: false
- })
- uni.setTabBarItem({
- index: 4,
- text: '我的',
- iconPath: 'static/tabBar/tab-my.png',
- selectedIconPath: 'static/tabBar/tab-my-current.png'
- });
- }
- if (obj.userInfo.type == 3) {
- uni.setTabBarItem({
- index: 0,
- text: '首页',
- iconPath: 'static/tabBar/tab-home.png',
- selectedIconPath: 'static/tabBar/tab-home-current.png'
- });
- uni.setTabBarItem({
- index: 1,
- text: '咨询记录',
- iconPath: 'static/tabBar/tab-cate.png',
- selectedIconPath: 'static/tabBar/tab-cate-current.png'
- });
- uni.setTabBarItem({
- index: 2,
- text: '科普学习',
- iconPath: 'static/tabBar/tab-study.png',
- selectedIconPath: 'static/tabBar/tab-study-current.png',
- visible: false
- });
- uni.setTabBarItem({
- index: 3,
- text: '发布订单',
- iconPath: 'static/tabBar/jd.png',
- selectedIconPath: 'static/tabBar/jd-act.png',
- pagePath: '/pages/dd/dd',
- visible: true
- })
- uni.setTabBarItem({
- index: 4,
- text: '我的',
- iconPath: 'static/tabBar/tab-my.png',
- selectedIconPath: 'static/tabBar/tab-my-current.png'
- });
- }
- if (obj.userInfo.type == 2 && obj.userInfo.ext_info.price == '0.00') {
- uni.showModal({
- title: '提示',
- content: '您的用户信息尚未完善,是否前去完善?',
- success: function(res) {
- if (res.confirm) {
- console.log('用户点击确定');
- uni.navigateTo({
- url: '/pages/userinfo/doctor'
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }
- })
- .catch(e => {
- if (e.message == '请登录') {
- uni.showModal({
- title: '提示',
- content: '您未登录,是否登录?',
- success: function(res) {
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/public/wxLogin'
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- } else {
- console.log(e.message);
- }
- });
- },
- //获取医生详情
- getDoctor() {
- let obj = this;
- console.log(obj.userInfo, 55);
- allComment({
- uid: obj.userInfo.uid,
- limit: 5,
- page: 1
- })
- .then(({
- data
- }) => {
- obj.list = data;
- })
- .catch(e => {
- console.log(e.message);
- });
- },
- ToMycode() {
- if (this.userInfo.type == 1) {
- uni.navigateTo({
- url: '/pages/userinfo/patient'
- });
- }
- if (this.userInfo.type == 2) {
- uni.navigateTo({
- url: '/pages/userinfo/doctor'
- });
- }
- if (this.userInfo.type == 3) {
- uni.navigateTo({
- url: '/pages/userinfo/mechanism'
- });
- }
- },
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- if (!this.hasLogin) {
- // 保存地址
- saveUrl();
- uni.showModal({
- title: '提示',
- content: '您未登录,是否马上登录?',
- success: res => {
- if (res.confirm) {
- interceptor();
- }
- }
- });
- // 登录拦截
- } else {
- uni.navigateTo({
- url
- });
- }
- }
- }
- };
- </script>
- <style lang="scss">
- .list-cell {
- margin-top: 60rpx;
- .cell-tit {
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- width: 560rpx;
- height: 80rpx;
- color: #fff;
- background: $base-color;
- border-radius: 40rpx;
- font-size: $font-base + 2rpx;
- margin: 0 auto;
- }
- }
- page {
- height: 100%;
- // padding-bottom: 188rpx;
- }
- %flex-center {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- %section {
- display: flex;
- justify-content: space-around;
- align-content: center;
- background: #fff;
- border-radius: 10rpx;
- }
- .container {
- background-color: $page-color-base;
- height: 1650rpx;
- // padding-bottom: 188rpx;
- }
- .user-section {
- // height: 500rpx;
- padding: 60rpx 30rpx 0;
- padding-bottom: 90rpx;
- position: relative;
- background: linear-gradient(52deg, #7e99fe, #978ffa);
- .arc {
- position: absolute;
- left: 0;
- bottom: 0;
- // margin-top: -34rpx;
- width: 100%;
- height: 36rpx;
- }
- // .bg {
- // position: absolute;
- // left: 0;
- // top: 0;
- // width: 100%;
- // height: 100%;
- // background: linear-gradient(52deg, rgba(126, 153, 254, 1), rgba(151, 143, 250, 1));
- // }
- }
- .user-info-box {
- font-size: 32rpx;
- color: #ffffff;
- height: 200rpx;
- // display: flex;
- // align-items: center;
- // justify-content: space-between;
- // position: relative;
- z-index: 3;
- .portrait {
- width: 135rpx;
- height: 135rpx;
- image {
- width: 100%;
- height: 100%;
- border-radius: 100%;
- }
- }
- .info {
- padding: 0rpx 25rpx;
- width: 75%;
- .name-box {
- width: 100%;
- padding-bottom: 15rpx;
- .name {
- font-size: 32rpx;
- max-width: 60%;
- }
- .name-text {
- margin-left: 25rpx;
- font-size: 22rpx !important;
- border: 2rpx solid #ffffff;
- padding: 2rpx 25rpx;
- border-radius: 25rpx;
- }
- .left {
- margin-left: 0 !important;
- }
- }
- }
- .icon {
- image {
- width: 48rpx;
- height: 49rpx;
- }
- }
- }
- .myinfo {
- z-index: 999;
- position: absolute;
- right: 0;
- top: 25%;
- background-color: #ffffff;
- color: #6786fb;
- font-size: 24rpx;
- padding: 14rpx 29rpx;
- border-top-left-radius: 50rpx;
- border-bottom-left-radius: 50rpx;
- }
- .cover-container {
- // background: $page-color-base;
- margin-top: -100rpx;
- position: relative;
- // background: #f5f5f5;
- padding-bottom: 20rpx;
- .info-box {
- // position: absolute;
- // top: -80rpx;
- z-index: 999;
- margin: 0 auto;
- // margin-top: -80rpx;
- width: 91%;
- color: #697079;
- left: 35rpx;
- border-radius: 25rpx;
- background-color: #ffffff;
- text-align: center;
- font-size: 24rpx;
- padding: 25rpx 0rpx;
- .info {
- width: 100%;
- height: 100rpx;
- text-align: center;
- image {
- width: 100rpx;
- height: 100%;
- }
- }
- .text {
- padding-top: 15rpx;
- }
- }
- }
- .bottom {
- padding-bottom: 100rpx !important;
- }
- .item-box {
- width: 100%;
- background-color: #ffffff;
- // position: relative;
- // top: 150rpx;
- padding: 15rpx 25rpx;
- padding-bottom: 0;
- margin-top: 30rpx;
- .item-list {
- width: 100%;
- padding: 10rpx 0rpx;
- .list-icon {
- image {
- width: 77rpx;
- height: 77rpx;
- margin-right: 35rpx;
- }
- .text {
- color: #323232;
- font-size: 28rpx;
- font-weight: bold;
- }
- }
- }
- .fen {
- width: 100%;
- height: 2rpx;
- background-color: #ececec;
- margin: 10rpx 0rpx;
- }
- }
- .icon-box {
- margin-bottom: 32rpx;
- }
- .left-icon {
- width: 12rpx;
- height: 42rpx;
- background: $base-color;
- border-radius: 6rpx;
- }
- .left-box {
- width: 100%;
- }
- .left-tit {
- font-size: 30rpx;
- font-weight: bold;
- color: rgba(51, 51, 51, 1);
- line-height: 42rpx;
- margin-left: 14rpx;
- }
- .more {
- font-size: 24rpx;
- color: #666666;
- }
- .left-txt {
- font-size: 28rpx;
- font-weight: 500;
- color: rgba(102, 102, 102, 1);
- line-height: 52rpx;
- }
- .ask-list {
- margin-bottom: 25rpx;
- .ask-img {
- width: 92rpx;
- height: 92rpx;
- border-radius: 50%;
- }
- .ask-txt {
- font-size: 28rpx;
- font-weight: 500;
- width: 80%;
- padding-left: 15rpx;
- color: rgba(102, 102, 102, 1);
- line-height: 48rpx;
- }
- }
- /*公用边框样式*/
- %icon {
- margin-right: 10rpx;
- display: inline-block;
- padding: 2rpx 10rpx;
- border: 1rpx solid $color-yellow;
- color: $color-yellow;
- line-height: 1;
- font-size: $font-base;
- border-radius: 10rpx;
- }
- </style>
|