index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view class="page-container">
  3. <view class="status_bar" :style="{ height: statusBarHeight }"></view>
  4. <!-- 顶部标题栏 -->
  5. <view class="top-bar">
  6. <view class="top-left">
  7. <image class="avatar" src="/static/avatar.png" mode="aspectFill"></image>
  8. <text class="user-name">云联融智</text>
  9. </view>
  10. </view>
  11. <!-- 直播列表 -->
  12. <view class="live-list">
  13. <view class="live-row" v-for="(row, rowIndex) in liveData" :key="rowIndex">
  14. <view class="live-item" v-for="(item, index) in row" :key="index" @click="enterLive(item)">
  15. <view class="live-image-box">
  16. <image class="live-image" :src="item.image" mode="aspectFill"></image>
  17. <view class="live-tag">
  18. <image class="live-icon" src="/static/play.gif" mode="aspectFit"></image>
  19. <text class="live-text">直播中</text>
  20. </view>
  21. <view class="live-date">
  22. <text class="date-text">{{ item.date }}</text>
  23. </view>
  24. <view class="live-title">
  25. <text class="title-text">{{ item.title }}</text>
  26. </view>
  27. </view>
  28. <view class="live-info">
  29. <text class="live-room-name">{{ item.roomName }}</text>
  30. <view class="live-host">
  31. <image class="host-avatar" :src="item.hostAvatar" mode="aspectFill"></image>
  32. <text class="host-name">{{ item.hostName }}</text>
  33. <view class="live-viewers">
  34. <image class="viewer-icon" src="/static/watch_number.png" mode="aspectFit"></image>
  35. <text class="viewer-count">{{ item.viewers }}</text>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  49. liveData: [
  50. [
  51. {
  52. id: 1,
  53. image: "/static/famous_doctor_img.png",
  54. date: "08月19日",
  55. title: "向中国医生致敬",
  56. subtitle: "中国医师节",
  57. roomName: "光辉岁月直播间",
  58. hostAvatar: "/static/avatar.png",
  59. hostName: "月牙白很美",
  60. viewers: "14121"
  61. },
  62. {
  63. id: 2,
  64. image: "/static/famous_doctor_img.png",
  65. date: "08月19日",
  66. title: "向中国医生致敬",
  67. subtitle: "中国医师节",
  68. roomName: "光辉岁月直播间",
  69. hostAvatar: "/static/avatar.png",
  70. hostName: "月牙白很美",
  71. viewers: "14121"
  72. }
  73. ],
  74. [
  75. {
  76. id: 3,
  77. image: "/static/famous_doctor_img.png",
  78. date: "08月19日",
  79. title: "向中国医生致敬",
  80. subtitle: "中国医师节",
  81. roomName: "光辉岁月直播间",
  82. hostAvatar: "/static/avatar.png",
  83. hostName: "月牙白很美",
  84. viewers: "14121"
  85. },
  86. {
  87. id: 4,
  88. image: "/static/famous_doctor_img.png",
  89. date: "08月19日",
  90. title: "向中国医生致敬",
  91. subtitle: "中国医师节",
  92. roomName: "光辉岁月直播间",
  93. hostAvatar: "/static/avatar.png",
  94. hostName: "月牙白很美",
  95. viewers: "14121"
  96. }
  97. ]
  98. ]
  99. };
  100. },
  101. methods: {
  102. enterLive(item) {
  103. // 进入直播间
  104. uni.showToast({
  105. title: `进入${item.roomName}`,
  106. icon: 'none'
  107. });
  108. },
  109. navigateTo(url) {
  110. uni.switchTab({
  111. url: url
  112. });
  113. }
  114. }
  115. };
  116. </script>
  117. <style lang="scss" scoped>
  118. .page-container {
  119. width: 100%;
  120. min-height: 100vh;
  121. background-color: #f8f8f8;
  122. padding-bottom: 120upx; // 为底部导航栏留出空间
  123. .top-bar {
  124. display: flex;
  125. align-items: center;
  126. justify-content: space-between;
  127. padding: 16rpx 24upx;
  128. .top-left {
  129. display: flex;
  130. align-items: center;
  131. .avatar {
  132. width: 50upx;
  133. height: 50upx;
  134. border-radius: 50%;
  135. margin-right: 12upx;
  136. }
  137. .user-name {
  138. font-size: 28rpx;
  139. color: #626468;
  140. }
  141. }
  142. }
  143. .live-list {
  144. padding: 20upx;
  145. .live-row {
  146. display: flex;
  147. justify-content: space-between;
  148. margin-bottom: 20upx;
  149. .live-item {
  150. width: 48%;
  151. background-color: #ffffff;
  152. border-radius: 16upx;
  153. overflow: hidden;
  154. .live-image-box {
  155. position: relative;
  156. width: 100%;
  157. height: 400rpx;
  158. .live-image {
  159. width: 100%;
  160. height: 100%;
  161. }
  162. .live-tag {
  163. position: absolute;
  164. top: 15upx;
  165. left: 15upx;
  166. display: flex;
  167. align-items: center;
  168. background-color: rgba(255, 0, 0, 0.8);
  169. border-radius: 10upx;
  170. padding: 5upx 10upx;
  171. .live-icon {
  172. width: 20upx;
  173. height: 20upx;
  174. margin-right: 5upx;
  175. }
  176. .live-text {
  177. font-size: 20upx;
  178. font-family: PingFang SC;
  179. font-weight: 500;
  180. color: #ffffff;
  181. }
  182. }
  183. .live-date {
  184. position: absolute;
  185. bottom: 60upx;
  186. left: 0;
  187. right: 0;
  188. display: flex;
  189. align-items: center;
  190. justify-content: center;
  191. .date-text {
  192. font-size: 20upx;
  193. font-family: PingFang SC;
  194. font-weight: 500;
  195. color: #ffffff;
  196. text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
  197. }
  198. }
  199. .live-title {
  200. position: absolute;
  201. bottom: 30upx;
  202. left: 0;
  203. right: 0;
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. .title-text {
  208. font-size: 24upx;
  209. font-family: PingFang SC;
  210. font-weight: 500;
  211. color: #ffffff;
  212. text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
  213. }
  214. }
  215. }
  216. .live-info {
  217. padding: 20upx 20upx 28upx;
  218. .live-room-name {
  219. font-size: 28upx;
  220. font-family: PingFang SC;
  221. font-weight: 500;
  222. color: #333333;
  223. }
  224. .live-host {
  225. margin-top: 20upx;
  226. display: flex;
  227. align-items: center;
  228. .host-avatar {
  229. width: 32upx;
  230. height: 32upx;
  231. border-radius: 50%;
  232. margin-right: 10upx;
  233. }
  234. .host-name {
  235. font-size: 22rpx;
  236. color: #757575;
  237. color: #666666;
  238. flex: 1;
  239. }
  240. .live-viewers {
  241. display: flex;
  242. align-items: center;
  243. .viewer-icon {
  244. width: 32upx;
  245. height: 32upx;
  246. margin-right: 8upx;
  247. }
  248. .viewer-count {
  249. font-size: 22rpx;
  250. color: #999999;
  251. }
  252. }
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. </style>