service.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="container">
  3. <view class="head">
  4. <u-navbar :is-fixed="false" :border-bottom="false" :is-back="true" back-icon-name="arrow-leftward"
  5. back-icon-color="#fff" back-icon-size="35" :background="{ background: 'linear-gradient(90deg, #69b0ff, #5f88ff)' }" title="服务"
  6. title-color="#fff"></u-navbar>
  7. <view class="head-bg"></view>
  8. <!-- 我的订阅 start -->
  9. <view class="card sub">
  10. <view class="title">我的订阅</view>
  11. <view class="list">
  12. <u-grid :col="4" :border="false">
  13. <u-grid-item bg-color="transparent" v-for="(item, index) in subscribeList" :key="index">
  14. <navigator url="" hover-class="none" class="nav-item">
  15. <image :src="item.img" mode="widthFix" class="nav-item-img"></image>
  16. <view class="nav-item-name">{{ item.name }}</view>
  17. </navigator>
  18. </u-grid-item>
  19. </u-grid>
  20. </view>
  21. </view>
  22. <!-- 我的订阅 end -->
  23. <!-- 服务列表 start -->
  24. <view class="card wrap" v-for="(item, index) in serviceList" :key="index">
  25. <view class="title">{{item.name}}</view>
  26. <view class="list">
  27. <u-grid :col="4" :border="false">
  28. <u-grid-item bg-color="transparent" v-for="(_item, _index) in item.list" :key="_index">
  29. <navigator url="" hover-class="none" class="nav-item">
  30. <image :src="_item.img" mode="widthFix" class="nav-item-img"></image>
  31. <view class="nav-item-name">{{ _item.name }}</view>
  32. </navigator>
  33. </u-grid-item>
  34. </u-grid>
  35. </view>
  36. </view>
  37. <!-- 服务列表 end -->
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. fakeSubscribeList,
  44. fakeServiceList,
  45. } from "@/api/mock/service.js";
  46. export default {
  47. data() {
  48. return {
  49. // 我的订阅
  50. subscribeList: [],
  51. // 服务列表
  52. serviceList: [],
  53. };
  54. },
  55. onLoad() {
  56. // 后续将改为与后端联动
  57. // 加载我的订阅数据
  58. fakeSubscribeList().then(data => {
  59. this.subscribeList = data;
  60. })
  61. // 加载服务集合数据
  62. fakeServiceList().then(data => {
  63. this.serviceList = data;
  64. })
  65. }
  66. };
  67. </script>
  68. <style lang="scss">
  69. .container {
  70. background-color: #f7f7f7;
  71. min-height: 100vh;
  72. overflow: hidden;
  73. }
  74. .head {
  75. position: relative;
  76. top: 0;
  77. left: 0;
  78. z-index: 1;
  79. }
  80. .head-bg {
  81. position: absolute;
  82. left: 0px;
  83. top: 0px;
  84. z-index: -1;
  85. width: 750rpx;
  86. height: 270rpx;
  87. background: linear-gradient(90deg, #69b0ff, #5f88ff);
  88. }
  89. .card {
  90. margin: 30rpx;
  91. background: #ffffff;
  92. border-radius: 20rpx;
  93. margin-top: 36rpx;
  94. }
  95. .sub {
  96. .title {
  97. padding-top: 36rpx;
  98. display: flex;
  99. justify-content: center;
  100. align-items: center;
  101. font-size: 30rpx;
  102. font-family: Source Han Sans CN;
  103. font-weight: 500;
  104. color: #000000;
  105. &::before {
  106. content: '';
  107. display: block;
  108. width: 135rpx;
  109. height: 1rpx;
  110. background: #e4e7ed;
  111. margin: 0 17rpx;
  112. }
  113. &::after {
  114. content: '';
  115. display: block;
  116. width: 135rpx;
  117. height: 1rpx;
  118. background: #e4e7ed;
  119. margin: 0 17rpx;
  120. }
  121. }
  122. }
  123. .list {
  124. display: flex;
  125. flex-wrap: wrap;
  126. padding: 0 0 30rpx;
  127. .nav-item {
  128. width: 100%;
  129. display: flex;
  130. flex-direction: column;
  131. justify-content: space-between;
  132. align-items: center;
  133. font-size: 30rpx;
  134. font-family: Source Han Sans CN;
  135. font-weight: 400;
  136. color: #131313;
  137. line-height: 48rpx;
  138. opacity: 0.77;
  139. &-img {
  140. width: 54rpx;
  141. height: 54rpx;
  142. margin-bottom: 30rpx;
  143. }
  144. &-name {
  145. font-size: 26rpx;
  146. font-family: PingFang SC;
  147. font-weight: 400;
  148. color: #585b61;
  149. }
  150. }
  151. }
  152. .wrap {
  153. .title {
  154. padding: 36rpx 16rpx;
  155. display: flex;
  156. align-items: center;
  157. font-size: 32rpx;
  158. font-family: Source Han Sans CN;
  159. font-weight: 500;
  160. color: #000000;
  161. &::before {
  162. content: "";
  163. display: block;
  164. width: 5rpx;
  165. height: 36rpx;
  166. margin-right: 10rpx;
  167. background: #3ac4d1;
  168. }
  169. }
  170. }
  171. </style>