123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <template>
- <view class="page">
- <view class="header">
- <view class="user">
- <image class="avatar" :src="headLogo || '../../static/head.png'" />
- <text> {{displayName}} </text>
- </view>
- </view>
- <view class="menu">
- <view class="item" @click="handleMenuClick">
- <img src="/static/appstore-add.png"></img>
- <view>编辑中心</view>
- </view>
- <view class="item" @click="dialogToggle('success')">
- <img src="/static/poweroff.png"></img>
- <view>退出登录</view>
- </view>
- <uni-popup ref="alertDialog" type="dialog">
- <uni-popup-dialog :type="msgType" cancelText="否" confirmText="是" title="提示" content="是否退出登录"
- @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
- </uni-popup>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- headLogo: '',
- nameList: ''
- }
- },
- created() {
- // this.wechatId = uni.getStorageSync('wechatId');
- this.headLogo = uni.getStorageSync('headLogo');
- // this.nameList = uni.getStorageSync('nameList');
- this.getData()
- },
- computed: {
- displayName: function() {
- if (this.nameList) {
- return this.nameList;
- } else {
- return '编号00001';
- }
- }
- },
- onLoad() {
- },
- methods: {
- onPullDownRefresh() {
- this.getData();
- setTimeout(function() {
- uni.stopPullDownRefresh(); //停止下拉刷新动画
- }, 1000);
- },
- getData() {
- this.$http('homePage.information', {}, '加载中').then((res) => {
- this.nameList = res.data.userName;
- })
- },
- //退出登录
- dialogToggle(type) {
- this.msgType = type
- this.$refs.alertDialog.open()
- },
- dialogConfirm() {
- uni.removeStorageSync('token'); // 清除缓存中的 token
- uni.removeStorageSync('headLogo');
- uni.removeStorageSync('wechatId');
- uni.removeStorageSync('nameList');
- uni.reLaunch({
- url: '/pages/login/index',
- success: () => {
- setTimeout(() => {
- this.$refs.alertDialog.open();
- }, 1000);
- }
- });
- },
- dialogClose() {
- console.log('点击关闭')
- },
- handleMenuClick() {
- uni.navigateTo({
- url: '/pages/home/home'
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .page {
- background: #f5f5f5;
- min-height: 100vh;
- .header {
- background: #90ffe4;
- height: 300rpx;
- .user {
- display: flex;
- flex-direction: column;
- align-items: center;
- image {
- width: 150rpx;
- height: 150rpx;
- border-radius: 50%;
- margin: 10rpx;
- background: #ccc;
- }
- text {
- color: #000;
- font-size: 25rpx;
- margin-top: 15rpx;
- }
- }
- }
- .menu {
- background: #fff;
- .item {
- border-bottom: 1px solid #f0f0f0;
- display: flex;
- height: 80rpx;
- align-items: center;
- padding: 0 20rpx;
- box-sizing: border-box;
- width: 750rpx;
- &:active {
- background: #f0f0f0;
- }
- image {
- height: 40rpx;
- width: 40rpx;
- }
- view {
- font-size: 14px;
- color: #444;
- padding-left: 10rpx;
- box-sizing: border-box;
- width: calc(100% - 70rpx);
- }
- .arrow {
- width: 30rpx;
- height: 36rpx;
- }
- }
- }
- }
- </style>
|