自主项目,食堂系统,前端uniapp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

128 lines
2.8 KiB

<template>
<view>
<view class="lf-row-center lf-flex-column head" v-if="$isRight(canteen)">
<image :src="canteen.avatar"></image>
<view class="lf-m-t-20 lf-font-32 lf-font-bold lf-color-black">{{ canteen.name }}</view>
<view class="lf-font-28 lf-color-555 lf-m-t-10">{{ canteen.user.canteen.remark }}</view>
</view>
<view class="list">
<view class="lf-row-between list-item" hover-class="lf-opacity"
v-for="(item, index) in block_list" :key="index"
@click="$url(item.path)">
<view class="lf-row-center">
<image class="icon-img" :src="item.icon"></image>
<text class="lf-text-vertical lf-m-l-20 lf-font-28 lf-color-black">{{ item.name }}</text>
</view>
<view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
<view style="height: 170rpx;"></view>
<view class="btn-bottom exit" v-if="$isRight(canteen)">
<button class="lf-w-100" @click="loginOut">退出登录</button>
</view>
</view>
</template>
<script>
export default {
data(){
return {
canteen: {},
block_list: []
}
},
onLoad(){
this.getHomeData();
},
onReady(){
// #ifndef MP
var a = document.getElementsByClassName('uni-page-head-hd')[0];
a.style.display = 'none';
// #endif
},
methods: {
getHomeData(){
this.$http(this.API.API_CANTEEN_INDEX).then(res => {
console.log("getHomeData", res);
this.block_list = res.data.block;
this.canteen = res.data.canteen;
getApp().globalData.canteen_id = res.data.canteen.id;
})
},
// 退出登录
loginOut(){
uni.showModal({
title: '温馨提示',
content: '确定退出登录吗?',
confirmColor: '#11D189',
success: result => {
if(result.confirm){
uni.removeStorageSync('canteen_token');
this.$redirectToLogin('您已退出登录, 即将跳转...');
}
}
})
}
}
}
</script>
<style>
page{
background-color: #F6F6F6;
}
</style>
<style lang="scss" scoped="scoped">
.head{
height: 374rpx;
width: 750rpx;
background-color: #FFFFFF;
image{
width: 200rpx;
height: 200rpx;
border: 2rpx solid #FFFFFF;
border-radius: 50%;
}
}
.list{
margin-top: 20rpx;
padding: 0 32rpx;
background-color: #FFFFFF;
width: 100%;
height: auto;
}
.list-item{
border-bottom: 1rpx solid #EEEEEE;
height: 110rpx;
box-sizing: border-box;
position: relative;
.icon-img{
width: 50rpx;
height: 50rpx;
}
.feedback-btn{
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
background: transparent;
}
&:last-child{
border-bottom: none;
}
}
.exit{
padding: 0 32rpx;
// bottom: 50rpx;
padding-top: 10rpx;
padding-bottom: 50rpx;
box-sizing: border-box;
background-color: #F6F6F6;
button{
background-color: #f0f0f0;
color: #777777;
}
}
</style>