Commit 8e335201 by liangjianmin

Add home page layout and styles with user info display and exit functionality

parent 1760090c
.home-index {
min-height: 100vh;
padding-bottom: 158rpx;
background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
.head {
padding: 24rpx 28rpx;
min-height: 140rpx;
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
border-radius: 0 0 24rpx 24rpx;
box-shadow: 0 6rpx 20rpx rgba(37, 99, 235, 0.3);
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: -40%;
right: -15%;
width: 250rpx;
height: 250rpx;
background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
pointer-events: none;
}
.info-bar {
position: relative;
z-index: 1;
.icon-juxing {
font-size: 90rpx;
color: #ffffff;
margin-right: 16rpx;
}
.t1 {
font-size: 32rpx;
color: #ffffff;
font-weight: 600;
letter-spacing: 0.5rpx;
}
.t2 {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.9);
margin-top: 6rpx;
}
}
.setting {
position: relative;
z-index: 1;
padding: 14rpx 18rpx;
background: rgba(255, 255, 255, 0.2);
border-radius: 20rpx;
transition: all 0.2s ease;
cursor: pointer;
&:active {
background: rgba(255, 255, 255, 0.35);
transform: scale(0.96);
}
.iconfont {
font-size: 26rpx;
color: #ffffff;
}
.tt {
font-size: 24rpx;
color: #ffffff;
margin-left: 6rpx;
font-weight: 500;
}
}
}
.fast-entry {
position: relative;
background: #ffffff;
padding-top: 24rpx;
&::after {
position: absolute;
bottom: 0px;
left: 0;
right: 0;
width: 100%;
height: 1px;
background-color: #ffffff;
content: '';
}
.tit {
font-size: 24rpx;
color: #1e2021;
font-weight: bold;
margin-bottom: 36rpx;
padding-left: 24rpx;
}
.bar {
flex-wrap: wrap;
.box {
position: relative;
flex: 1;
height: 177rpx;
border-right: 1px solid #e6edf0;
border-bottom: 1px solid #e6edf0;
&:nth-of-type(3n) {
border-right: 1px solid transparent;
}
.num {
position: absolute;
right: 32rpx;
top: 5rpx;
width: 42rpx;
height: 32rpx;
background: #bb3434;
border-radius: 16rpx;
font-size: 20rpx;
color: #ffffff;
}
.iconfont {
font-size: 64rpx;
color: #197adb;
}
.text {
margin-top: 8rpx;
font-size: 22rpx;
color: #404547;
}
}
}
}
}
\ No newline at end of file
<template> <template>
<view class="home-index"> <view class="home-index">
<!-- 实际内容 -->
<view class="head" v-if="!loading && info.user_info">
<view class=" row bothSide verCenter">
<view class="info-bar row verCenter">
<text class="iconfont icon-juxing"></text>
<view class="column">
<text class="t1">{{ info.user_info.name }}</text>
<text class="t2">{{ info.user_info.email }}</text>
</view>
</view>
<view class="setting row verCenter" @click="exit()">
<text class="iconfont icon-a-juxing13"></text>
<text class="tt">设置</text>
</view>
</view>
</view>
</view> </view>
</template> </template>
<script> <script>
import { API } from '@/util/api.js';
export default { export default {
data() { data() {
return {}; return {
info: {},
loading: true
};
},
onShow() {
this.getData();
},
methods: {
/**
* 获取数据
*/
getData() {
this.request(API.getStatisticsInfo, 'POST', {}, false).then(res => {
if (res.code === 0) {
this.info = res.data;
uni.setStorageSync('email', res.data.user_info.email);
uni.setStorageSync('user_name', res.data.user_info.name);
}
this.loading = false;
});
},
/**
* 退出系统
*/
exit() {
uni.showModal({
title: '提示',
content: '确定要退出系统吗?',
showCancel: true,
success: res => {
if (res.confirm) {
// 批量清理用户相关存储
['oa_skey', 'oa_user_id', 'email', 'user_name'].map(key => uni.removeStorageSync(key));
uni.redirectTo({
url: '/pages/mine/login'
});
} else if (res.cancel) {
// 用户点击取消操作
console.log('用户点击取消');
}
}
});
}
} }
}; };
</script> </script>
......
...@@ -93,11 +93,7 @@ ...@@ -93,11 +93,7 @@
uni.setStorageSync('oa_skey', res.data.skey); uni.setStorageSync('oa_skey', res.data.skey);
uni.setStorageSync('oa_user_id', res.data.userId); uni.setStorageSync('oa_user_id', res.data.userId);
// 仅 App 端触发震动反馈,告知用户登录成功
// #ifdef APP-PLUS
uni.vibrateShort();
// #endif
uni.redirectTo({ uni.redirectTo({
url: '/pages/home/index' url: '/pages/home/index'
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment