自主项目,食堂系统,前端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.

129 lines
2.8 KiB

  1. <template>
  2. <view>
  3. <view class="lf-row-center lf-flex-column head" v-if="$isRight(canteen)">
  4. <image :src="canteen.avatar"></image>
  5. <view class="lf-m-t-20 lf-font-32 lf-font-bold lf-color-black">{{ canteen.name }}</view>
  6. <view class="lf-font-28 lf-color-555 lf-m-t-10">{{ canteen.user.canteen.remark }}</view>
  7. </view>
  8. <view class="list">
  9. <view class="lf-row-between list-item" hover-class="lf-opacity"
  10. v-for="(item, index) in block_list" :key="index"
  11. @click="$url(item.path)">
  12. <view class="lf-row-center">
  13. <image class="icon-img" :src="item.icon"></image>
  14. <text class="lf-text-vertical lf-m-l-20 lf-font-28 lf-color-black">{{ item.name }}</text>
  15. </view>
  16. <view>
  17. <u-icon name="arrow-right"></u-icon>
  18. </view>
  19. </view>
  20. </view>
  21. <view style="height: 170rpx;"></view>
  22. <view class="btn-bottom exit" v-if="$isRight(canteen)">
  23. <button class="lf-w-100" @click="loginOut">退出登录</button>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data(){
  30. return {
  31. canteen: {},
  32. block_list: []
  33. }
  34. },
  35. onLoad(){
  36. // todo 优化:显示订单角标
  37. this.getHomeData();
  38. },
  39. onReady(){
  40. // #ifndef MP
  41. var a = document.getElementsByClassName('uni-page-head-hd')[0];
  42. a.style.display = 'none';
  43. // #endif
  44. },
  45. methods: {
  46. getHomeData(){
  47. this.$http(this.API.API_CANTEEN_INDEX).then(res => {
  48. console.log("getHomeData", res);
  49. this.block_list = res.data.block;
  50. this.canteen = res.data.canteen;
  51. getApp().globalData.canteen_id = res.data.canteen.id;
  52. })
  53. },
  54. // 退出登录
  55. loginOut(){
  56. uni.showModal({
  57. title: '温馨提示',
  58. content: '确定退出登录吗?',
  59. confirmColor: '#11D189',
  60. success: result => {
  61. if(result.confirm){
  62. uni.removeStorageSync('canteen_token');
  63. this.$redirectToLogin('您已退出登录, 即将跳转...');
  64. }
  65. }
  66. })
  67. }
  68. }
  69. }
  70. </script>
  71. <style>
  72. page{
  73. background-color: #F6F6F6;
  74. }
  75. </style>
  76. <style lang="scss" scoped="scoped">
  77. .head{
  78. height: 374rpx;
  79. width: 750rpx;
  80. background-color: #FFFFFF;
  81. image{
  82. width: 200rpx;
  83. height: 200rpx;
  84. border: 2rpx solid #FFFFFF;
  85. border-radius: 50%;
  86. }
  87. }
  88. .list{
  89. margin-top: 20rpx;
  90. padding: 0 32rpx;
  91. background-color: #FFFFFF;
  92. width: 100%;
  93. height: auto;
  94. }
  95. .list-item{
  96. border-bottom: 1rpx solid #EEEEEE;
  97. height: 110rpx;
  98. box-sizing: border-box;
  99. position: relative;
  100. .icon-img{
  101. width: 50rpx;
  102. height: 50rpx;
  103. }
  104. .feedback-btn{
  105. position: absolute;
  106. width: 100%;
  107. height: 100%;
  108. z-index: 1;
  109. background: transparent;
  110. }
  111. &:last-child{
  112. border-bottom: none;
  113. }
  114. }
  115. .exit{
  116. padding: 0 32rpx;
  117. // bottom: 50rpx;
  118. padding-top: 10rpx;
  119. padding-bottom: 50rpx;
  120. box-sizing: border-box;
  121. background-color: #F6F6F6;
  122. button{
  123. background-color: #f0f0f0;
  124. color: #777777;
  125. }
  126. }
  127. </style>