123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <template>
- <view class="container">
- <view class="top">
- <image class="avatar"mode="aspectFill" :src="src"></image>
- <text v-if="role && role !== 'guest'" class="name">{{ userInfo.name}}</text>
- <button v-else type="default" :plain="true" style="border: none;" class="login" @click="register">注册</button>
- </view>
- <view class="main" v-if="role && role !== 'guest'">
- <uni-card>
- <uni-list :border="false">
- <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[0]" title="个人资料" link clickable @click="onClick(0)"></uni-list-item>
- </uni-list>
- </uni-card>
- <uni-card>
- <uni-list :border="false">
- <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[1]" title="家人代领" link clickable @click="onClick(1)"></uni-list-item>
- </uni-list>
- </uni-card>
- <uni-card>
- <uni-list :border="false">
- <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[2]" title="问卷调查" link clickable @click="onClick(2)"></uni-list-item>
- </uni-list>
- </uni-card>
- <uni-card>
- <uni-list :border="false">
- <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[3]" title="我的积分" link clickable @click="onClick(3)"></uni-list-item>
- </uni-list>
- </uni-card>
- <uni-card>
- <uni-list :border="false">
- <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[4]" title="意见反馈" link clickable @click="onClick(4)"></uni-list-item>
- </uni-list>
- </uni-card>
- <!-- <uni-card class="logoutBox">
- <uni-list :border="false">
- <uni-list-item size="mini" class="logout" title="退出登录" clickable @click="onClick(4)"></uni-list-item>
- </uni-list>
- </uni-card> -->
- </view>
- </view>
- </template>
- <script>
- import requestLogin from '../../api/login.js';
- export default {
- data() {
- return {
- extraIconList: [
- {
- color: '#ff8319',
- size: '22',
- type: 'person'
- },
- {
- color: '#ebc200',
- size: '22',
- type: 'home'
- },
- {
- color: '#429ff6',
- size: '22',
- type: 'mail-open-filled'
- },
- {
- color: '#4cd964',
- size: '22',
- type: 'star-filled'
- },
- {
- color: '#e70000',
- size: '22',
- type: 'email-filled'
- }
- ],
- src: 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/6acec660-4f31-11eb-a16f-5b3e54966275.jpg',
- userInfo: {},
- role: ''
- }
- },
- onShow() {
- this.userInfo = uni.getStorageSync('userinfo');
- this.role = uni.getStorageSync('role');
- },
- mounted() {},
- methods: {
- register() {
- uni.navigateTo({
- url: '/pages/user/index'
- })
- },
- onClick(e) {
- console.log(e);
- if (e == 0) {
- uni.navigateTo({
- url: '/pages/user/index'
- })
- return;
- }
- if (e == 1) {
- this.illness();
- return;
- }
- // if (e == 4) {
- // this.logOut();
- // return;
- // }
- uni.showToast({
- title: '敬请期待',
- icon: 'error',
- duration: 2000,
- });
- },
- illness() {
- uni.navigateTo({
- url: '/pages/illness/index'
- })
- },
- logOut() {
- uni.clearStorage();
- uni.redirectTo({
- url: '/pages/index/index'
- })
- }
- }
- }
- </script>
- <style>
- .container {
- width: 100%;
- }
- .top {
- height: 25vh;
- background-color: #fd6b18;
- padding-top: 10px;
- position: relative;
- z-index: 1;
- }
- .avatar {
- width: 70px;
- height: 70px;
- border-radius: 50%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .name {
- color: #fff;
- width: 100%;
- text-align: center;
- display: block;
- margin: 10px 0;
- }
- .login {
- margin: 10px auto;
- color: #fff !important;
- padding: 0;
- line-height: 1em;
- }
- .main {
- width: 90%;
- display: block;
- margin: 0 auto;
- margin-top: -40px;
- position: relative;
- z-index: 2;
- }
- .logoutBox {
- display: block;
- margin-top: 50px;
- }
- .logout .uni-list-item__content-title {
- text-align: center;
- }
- </style>
|