index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view>
  3. <view class="wrap">
  4. <u-swiper height="200" :list="bannerList" keyName="image" img-mode="scaleToFill" :effect3d="true"></u-swiper>
  5. </view>
  6. <view class="box menu-box">
  7. <view class="menu-item" v-for="(item, index) in menuList" key="index" @click="navTo(item.path)">
  8. <view class="menu-img">
  9. <!-- <image src="../../static/icon/user.png"></image> -->
  10. <u-icon :name="item.icon" color="#2979ff" size="50"></u-icon>
  11. </view>
  12. <view class="menu-text">{{item.menuName}}</view>
  13. </view>
  14. <!-- <view class="menu-item">
  15. <view class="menu-img">
  16. <image src="../../static/icon/user.png"></image>
  17. </view>
  18. <view class="menu-text">购买确认确</view>
  19. </view>
  20. <view class="menu-item">
  21. <view class="menu-img">
  22. <image src="../../static/icon/user.png"></image>
  23. </view>
  24. <view class="menu-text">购买确认确</view>
  25. </view>
  26. <view class="menu-item">
  27. <view class="menu-img">
  28. <image src="../../static/icon/user.png"></image>
  29. </view>
  30. <view class="menu-text">购买确认确</view>
  31. </view>
  32. <view class="menu-item">
  33. <view class="menu-img">
  34. <image src="../../static/icon/user.png"></image>
  35. </view>
  36. <view class="menu-text">购买确认确</view>
  37. </view>
  38. <view class="menu-item">
  39. <view class="menu-img">
  40. <image src="../../static/icon/user.png"></image>
  41. </view>
  42. <view class="menu-text">购买确认确</view>
  43. </view>
  44. <view class="menu-item">
  45. <view class="menu-img">
  46. <image src="../../static/icon/user.png"></image>
  47. </view>
  48. <view class="menu-text">购买确认确</view>
  49. </view>
  50. <view class="menu-item">
  51. <view class="menu-img">
  52. <image src="../../static/icon/user.png"></image>
  53. </view>
  54. <view class="menu-text">购买确认确</view>
  55. </view> -->
  56. </view>
  57. <view class="box msg-box">
  58. <view class="title">
  59. <u-icon name="calendar" color="#ff0000" size="28"></u-icon>
  60. <text>最新资讯</text>
  61. </view>
  62. <view class="news-box" v-for="(item,index) in newsList" :key="index">
  63. <view class="news-img">
  64. <image src="https://www.leezon.net/uploads/news/20200314160130384800.jpg"></image>
  65. </view>
  66. <view class="news-item">
  67. <view class="new-title">{{item.title}}</view>
  68. <view class="news-notice">
  69. <view style="flex: 1;display: flex;"><u-icon name="eye-fill"></u-icon>12</view>
  70. <view style="flex: 3;text-align: right;">2023-12-34 22:00:00</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. data() {
  80. return {
  81. bannerList: [],
  82. newsList: [],
  83. roleMenu: [],
  84. menuList: [],
  85. }
  86. },
  87. onLoad() {
  88. this.getBannerList();
  89. this.getNewsList();
  90. this.getRoleMenu();
  91. this.getMenu();
  92. },
  93. methods: {
  94. getBannerList() {
  95. this.$api.getBannerList().then(resp => {
  96. this.bannerList = resp.data;
  97. })
  98. },
  99. getRoleMenu() {
  100. let menu = uni.getStorageSync("menu")
  101. this.$api.getRoleMenu().then(res => {
  102. res.data.map((item1,index) => {
  103. menu.map((item2,index1) => {
  104. if(item1.appRoleId == item2){
  105. this.roleMenu.push(item1.appMenuId)
  106. }
  107. })
  108. })
  109. })
  110. },
  111. getMenu() {
  112. this.$api.getMenu().then(res => {
  113. this.roleMenu.map((item2,index1) => {
  114. res.data.map((item1,index) => {
  115. if(parseInt(item1.id) == parseInt(item2)){
  116. this.menuList.push(item1)
  117. }
  118. })
  119. })
  120. })
  121. },
  122. getNewsList() {
  123. this.$api.getNewestList({
  124. limit: 4
  125. }).then(resp => {
  126. this.newsList = resp.data;
  127. })
  128. },
  129. navTo(path) {
  130. this.$common.to(path)
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. .wrap {
  137. // padding: 10rpx;
  138. }
  139. .menu-box {
  140. height: 300rpx;
  141. display: flex;
  142. flex-wrap: wrap;
  143. gap: 20rpx 40rpx;
  144. .menu-item {
  145. width: 128rpx;
  146. height: 128rpx;
  147. position: relative;
  148. text-align: center;
  149. .menu-img {
  150. display: flex;
  151. align-items: center;
  152. justify-content: center;
  153. image {
  154. height: 64rpx;
  155. width: 64rpx;
  156. }
  157. }
  158. .menu-text {
  159. font-size: 16rpx;
  160. }
  161. }
  162. }
  163. .box {
  164. padding: 20rpx 40rpx;
  165. width: 90%;
  166. // margin: auto;
  167. margin-top: 10rpx;
  168. background: #fff;
  169. border-radius: 30rpx;
  170. }
  171. .msg-box {
  172. height: 600rpx;
  173. margin-top: 10rpx;
  174. .title {
  175. font-size: 30rpx;
  176. line-height: 60rpx;
  177. display: flex;
  178. width: 30%;
  179. border-bottom: 1px solid #e2e2e2;
  180. }
  181. }
  182. .news-box {
  183. margin-top: 20rpx;
  184. display: flex;
  185. height: 140rpx;
  186. widows: 100vw;
  187. padding-bottom: 20rpx;
  188. border-bottom: 1px solid #e2e2e2;
  189. .news-img image {
  190. width: 140rpx;
  191. height: 100%;
  192. }
  193. .news-item {
  194. width: 100vw;
  195. word-break: break-all;
  196. .new-title {
  197. font-size: 28rpx;
  198. padding: 10rpx 20rpx;
  199. }
  200. .news-notice {
  201. display: flex;
  202. font-size: 28rpx;
  203. color: #9e9b9b;
  204. padding: 20rpx 20rpx 0 20rpx;
  205. }
  206. }
  207. }
  208. </style>