index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <view>
  3. <!-- 状态栏高度 -->
  4. <view :style="{ height: `${statusBarHeight}px` }"></view>
  5. <!-- 导航栏 -->
  6. <view :style="{ height: `${navigationBarHeight}px`,lineHeight: `${navigationBarHeight}px`}" class="order-nav">
  7. 北京大学校园送
  8. </view>
  9. <view style="background-color: #FF6702;height: 60rpx;"></view>
  10. <view class="card">
  11. <view class="card-left">
  12. <img class="avatar" src="/static/img/ic-buy.png" alt="用户头像">
  13. <view class="username">老番茄333 <image src="/static/img/ic-code.png" class="code"></image>
  14. </view>
  15. <view class="phone-info">
  16. <text>绑定手机号:185-7033-6037</text>
  17. <image src="/static/img/ic-copy.png">
  18. </image>
  19. </view>
  20. </view>
  21. <view class="card-right">
  22. <view class="card-content">
  23. <view class="content-item">
  24. <img class="content-icon" src="/static/img/ic-tickets.png" alt="我的票劵">
  25. <view class="content-text1">我的票劵</view>
  26. </view>
  27. <view class="content-item">
  28. <img class="content-icon" src="/static/img/ic-order.png" alt="我的订单">
  29. <view class="content-text2">我的订单</view>
  30. </view>
  31. <view class="content-item">
  32. <img class="content-icon" src="/static/img/ic-gold.png" alt="我的金币">
  33. <view class="content-text3">我的金币</view>
  34. </view>
  35. </view>
  36. <view class="profile-link">
  37. <text>个人中心</text>
  38. <img src="/static/img/ic-right.png" />
  39. </view>
  40. </view>
  41. </view>
  42. <view class="item-settled">
  43. <image src="/static/img/ic-settled-left.png" style="width: 350rpx;height: 116rpx;"></image>
  44. <image src="/static/img/ic-bg-line.png" style="width: 4rpx;height: 154rpx;margin: 0 20rpx;"></image>
  45. <image src="/static/img/ic-settled-right.png" style="width: 350rpx;height: 116rpx;"></image>
  46. </view>
  47. <view class="item-features">
  48. <view class="item-features-title">我的功能</view>
  49. <div class="grid-container">
  50. <!-- 示例:12 个格子(3行x4列) -->
  51. <div class="grid-item" v-for="item in featuresList" :key="item.id">
  52. <img class="grid-img" :src="item.icon">
  53. <div class="grid-text">{{item.text}}</div>
  54. </div>
  55. </div>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  61. let app = getApp();
  62. export default {
  63. data() {
  64. return {
  65. statusBarHeight: app.globalData.statusBarHeight,
  66. navigationBarHeight: 0,
  67. featuresList: [{
  68. id: 1,
  69. icon: '/static/img/ic-express.png',
  70. text: '我的快递'
  71. },
  72. {
  73. id: 2,
  74. icon: '/static/img/ic-address.png',
  75. text: '通用地址'
  76. },
  77. {
  78. id: 3,
  79. icon: '/static/img/ic-comments.png',
  80. text: '我的评论'
  81. },
  82. {
  83. id: 4,
  84. icon: '/static/img/ic-collection.png',
  85. text: '我的收藏'
  86. },
  87. {
  88. id: 5,
  89. icon: '/static/img/ic-buy.png',
  90. text: '我的团购'
  91. },
  92. {
  93. id: 6,
  94. icon: '/static/img/ic-vouchers.png',
  95. text: '我的卡券'
  96. },
  97. {
  98. id: 7,
  99. icon: '/static/img/ic-distribution.png',
  100. text: '我的分销'
  101. },
  102. {
  103. id: 8,
  104. icon: '/static/img/ic-friend.png',
  105. text: '邀请好友'
  106. },
  107. {
  108. id: 9,
  109. icon: '/static/img/ic-feedback.png',
  110. text: '帮助反馈'
  111. },
  112. {
  113. id: 10,
  114. icon: '/static/img/ic-security-settings.png',
  115. text: '安全设置'
  116. }
  117. ],
  118. }
  119. },
  120. onLoad(options) {
  121. let that = this;
  122. //首页数据加载
  123. // this.getIndexConfig();
  124. // #ifdef MP-WEIXIN
  125. // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
  126. const custom = wx.getMenuButtonBoundingClientRect()
  127. // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  128. this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
  129. // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
  130. // #endif
  131. },
  132. methods: {},
  133. }
  134. </script>
  135. <style scoped>
  136. .order-nav {
  137. font-weight: 500;
  138. font-size: 35rpx;
  139. color: #FFFFFF;
  140. background-color: #FF6702;
  141. text-align: center;
  142. }
  143. .item-settled {
  144. background: linear-gradient(135deg, #FED0A7 0%, #FFF3E2 52%, #FAEDD3 100%);
  145. border-radius: 8rpx;
  146. padding: 20rpx;
  147. box-shadow: 0 0 0 2rpx rgba(255, 220, 135, 1);
  148. position: relative;
  149. top: -90rpx;
  150. margin: 0 20rpx;
  151. display: flex;
  152. align-items: center;
  153. }
  154. .item-settled::after {
  155. content: "";
  156. position: absolute;
  157. top: -2rpx;
  158. left: -2rpx;
  159. right: -2rpx;
  160. bottom: -2rpx;
  161. background: linear-gradient(200deg, rgba(255, 220, 135, 1), rgba(255, 172, 33, 1), rgba(255, 201, 24, 1));
  162. border-radius: 10rpx;
  163. z-index: -1;
  164. pointer-events: none;
  165. }
  166. .card {
  167. position: relative;
  168. display: flex;
  169. /* 启用flex布局 */
  170. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  171. padding: 40rpx 30rpx 120rpx 30rpx;
  172. box-sizing: border-box;
  173. background: linear-gradient(225deg, #ECF3FE 0%, #FEFEFE 100%);
  174. border-radius: 23rpx;
  175. top: -20rpx;
  176. }
  177. .card-left {
  178. position: relative;
  179. }
  180. .card-right {
  181. flex: 1;
  182. }
  183. .avatar {
  184. position: absolute;
  185. top: -80rpx;
  186. left: 0;
  187. width: 131rpx;
  188. height: 131rpx;
  189. background-color: #D8D8D8;
  190. border: 4rpx solid #FFFFFF;
  191. border-radius: 50%;
  192. object-fit: cover;
  193. }
  194. .username {
  195. margin-top: 70rpx;
  196. color: #141414;
  197. font-size: 35rpx;
  198. font-weight: bold;
  199. }
  200. .code {
  201. width: 31rpx;
  202. height: 31rpx;
  203. margin-left: 20rpx;
  204. }
  205. .card-content {
  206. display: flex;
  207. justify-content: space-between;
  208. }
  209. .content-item {
  210. display: flex;
  211. flex-direction: column;
  212. align-items: center;
  213. width: 33%;
  214. }
  215. .content-icon {
  216. width: 70rpx;
  217. height: 70rpx;
  218. margin-bottom: 15rpx;
  219. }
  220. .content-text1 {
  221. font-size: 23rpx;
  222. background: linear-gradient(90deg, #FFB908 0%, #DC7A11 100%);
  223. -webkit-background-clip: text;
  224. background-clip: text;
  225. color: transparent;
  226. }
  227. .content-text2 {
  228. font-size: 23rpx;
  229. background: linear-gradient(90deg, #93B0FF 0%, #1B4EFF 100%);
  230. -webkit-background-clip: text;
  231. background-clip: text;
  232. color: transparent;
  233. }
  234. .content-text3 {
  235. font-size: 23rpx;
  236. background: linear-gradient(90deg, #F4D600 0%, #FF9100 100%);
  237. -webkit-background-clip: text;
  238. background-clip: text;
  239. color: transparent;
  240. }
  241. .phone-info {
  242. font-size: 21rpx;
  243. padding-top: 10rpx;
  244. }
  245. .phone-info text {
  246. margin-right: 14rpx;
  247. }
  248. .phone-info image {
  249. width: 27rpx;
  250. height: 27rpx;
  251. vertical-align: middle;
  252. }
  253. .profile-link {
  254. margin-top: 20rpx;
  255. font-size: 23rpx;
  256. font-weight: 600;
  257. line-height: 21rpx;
  258. text-align: right;
  259. }
  260. .profile-link img {
  261. width: 24rpx;
  262. height: 24rpx;
  263. vertical-align: middle;
  264. margin-left: 12rpx;
  265. }
  266. .grid-container {
  267. display: flex;
  268. flex-wrap: wrap;
  269. gap: 0;
  270. /* 改用 margin 控制间距 */
  271. padding: 20rpx;
  272. /* 父容器内边距 */
  273. box-sizing: border-box;
  274. /* 包含 padding 在宽度内 */
  275. }
  276. .grid-item {
  277. width: 25%;
  278. /* 直接 25% 无需 calc */
  279. display: flex;
  280. flex-direction: column;
  281. align-items: center;
  282. margin-bottom: 30rpx;
  283. /* 行间距 */
  284. padding: 0 10rpx;
  285. /* 左右间隙(替代 gap) */
  286. box-sizing: border-box;
  287. /* 关键 */
  288. }
  289. .grid-img {
  290. width: 58rpx;
  291. height: 58rpx;
  292. margin-bottom: 8rpx;
  293. }
  294. .grid-text {
  295. font-size: 24rpx;
  296. color: #333;
  297. }
  298. .item-features {
  299. background: #FFFFFF;
  300. border-radius: 23rpx;
  301. margin: -60rpx 20rpx 20rpx 20rpx;
  302. }
  303. .item-features-title {
  304. padding: 20rpx;
  305. font-weight: 600;
  306. font-size: 27rpx;
  307. color: #2E261E;
  308. line-height: 38rpx;
  309. }
  310. </style>