101 lines
1.9 KiB
Vue
101 lines
1.9 KiB
Vue
<template>
|
|
<view class="page">
|
|
<view class="info">
|
|
<u-cell :title="info.name">
|
|
<view slot="icon">
|
|
<u-avatar :src="info.avatar" />
|
|
</view>
|
|
</u-cell>
|
|
</view>
|
|
<view class="btns">
|
|
<u-empty v-if="list.length == 0" mode="list" text="请先在后台添加分类" />
|
|
<view class="btn" v-for="item in list" :key="item.id">
|
|
<u-button
|
|
:icon="item.image"
|
|
:text="item.name"
|
|
size="large"
|
|
@click="itemClick(item.id)"
|
|
/>
|
|
</view>
|
|
</view>
|
|
<view class="footer">
|
|
<u-button text="退出登录" type="error" @click="logout" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
info: {},
|
|
list: []
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.init()
|
|
},
|
|
methods: {
|
|
init() {
|
|
this.$ajax.get('/admin-api/category', {
|
|
params: {_action: 'getData'},
|
|
custom: { loading: true }
|
|
}).then(res => {
|
|
if (res.status == 0) {
|
|
this.list = res.data.items
|
|
}
|
|
})
|
|
this.$ajax.get('/admin-api/current-user').then(res => {
|
|
if (res.status == 0) {
|
|
this.info = res.data
|
|
}
|
|
})
|
|
},
|
|
itemClick(e) {
|
|
uni.setStorageSync('medical_record_treat_type_id', e)
|
|
uni.navigateTo({
|
|
url: '/pages/patient/index'
|
|
})
|
|
},
|
|
logout() {
|
|
uni.showModal({
|
|
title: '退出登录',
|
|
content: '是否确定?',
|
|
success: (e) => {
|
|
if (e.confirm) {
|
|
this.$ajax.get('/admin-api/logout').then(res => {
|
|
if (res.status == 0) {
|
|
uni.removeStorageSync('medical_record_auth_token')
|
|
uni.reLaunch({ url: '/pages/login/login' })
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
.page {
|
|
padding: 0 10px;
|
|
}
|
|
.info {
|
|
margin-top: 100rpx;
|
|
background: white;
|
|
}
|
|
.btns {
|
|
margin-top: 300rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
.btns .btn {
|
|
width: 100%;
|
|
margin-top: 20px;
|
|
}
|
|
.footer {
|
|
margin-top: 100rpx;
|
|
}
|
|
</style>
|