index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. this.getMenu();
  110. })
  111. },
  112. getMenu() {
  113. this.$api.getMenu().then(res => {
  114. this.roleMenu.map((item2,index1) => {
  115. res.data.map((item1,index) => {
  116. if(parseInt(item1.id) == parseInt(item2)){
  117. this.menuList.push(item1)
  118. }
  119. })
  120. this.$forceUpdate()
  121. })
  122. })
  123. },
  124. getNewsList() {
  125. this.$api.getNewestList({
  126. limit: 4
  127. }).then(resp => {
  128. this.newsList = resp.data;
  129. })
  130. },
  131. navTo(path) {
  132. this.$common.to(path)
  133. }
  134. }
  135. }
  136. </script>
  137. <style scoped lang="scss">
  138. .wrap {
  139. // padding: 10rpx;
  140. }
  141. .menu-box {
  142. height: 300rpx;
  143. display: flex;
  144. flex-wrap: wrap;
  145. gap: 20rpx 40rpx;
  146. .menu-item {
  147. width: 128rpx;
  148. height: 128rpx;
  149. position: relative;
  150. text-align: center;
  151. .menu-img {
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. image {
  156. height: 64rpx;
  157. width: 64rpx;
  158. }
  159. }
  160. .menu-text {
  161. font-size: 16rpx;
  162. }
  163. }
  164. }
  165. .box {
  166. padding: 20rpx 40rpx;
  167. width: 90%;
  168. // margin: auto;
  169. margin-top: 10rpx;
  170. background: #fff;
  171. border-radius: 30rpx;
  172. }
  173. .msg-box {
  174. height: 600rpx;
  175. margin-top: 10rpx;
  176. .title {
  177. font-size: 30rpx;
  178. line-height: 60rpx;
  179. display: flex;
  180. width: 30%;
  181. border-bottom: 1px solid #e2e2e2;
  182. }
  183. }
  184. .news-box {
  185. margin-top: 20rpx;
  186. display: flex;
  187. height: 140rpx;
  188. widows: 100vw;
  189. padding-bottom: 20rpx;
  190. border-bottom: 1px solid #e2e2e2;
  191. .news-img image {
  192. width: 140rpx;
  193. height: 100%;
  194. }
  195. .news-item {
  196. width: 100vw;
  197. word-break: break-all;
  198. .new-title {
  199. font-size: 28rpx;
  200. padding: 10rpx 20rpx;
  201. }
  202. .news-notice {
  203. display: flex;
  204. font-size: 28rpx;
  205. color: #9e9b9b;
  206. padding: 20rpx 20rpx 0 20rpx;
  207. }
  208. }
  209. }
  210. </style>