index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="content-page-wrap flex-column">
  3. <top-main title="我的" back></top-main>
  4. <view class="middle-main">
  5. <image src="@/static/img/my-bg.svg" class="my-bg"></image>
  6. <view class="flex-column">
  7. <view class="vip-box" @click="goVip">
  8. <image src="@/static/img/vip-bg.svg"></image>
  9. <view class="flex vip-time">
  10. <view class="flex text">
  11. VIP剩余
  12. <h2>
  13. {{ 366 }}
  14. </h2>
  15. </view>
  16. <u-icon
  17. name="arrow-right"
  18. color="#FFD9AD"
  19. size="12"
  20. ></u-icon>
  21. </view>
  22. </view>
  23. <view class="inlet-box flex-column">
  24. <view class="flex">
  25. <view class="top-but" @click="goRecord">
  26. <view>钱包明细</view>
  27. <view class="icon flex-center"
  28. ><img src="@/static/img/icon-detail.svg"
  29. /></view>
  30. </view>
  31. <view class="top-but" style="margin-left: 32rpx">
  32. <view>NFT挖矿</view>
  33. <view class="icon flex-center"
  34. ><img src="@/static/img/icon-dig.svg"
  35. /></view>
  36. </view>
  37. </view>
  38. <view class="flex">
  39. <view class="bottom-left-but flex-left justify-around">
  40. <view>老K社区</view>
  41. <u-icon
  42. name="arrow-right"
  43. color="#000E08"
  44. size="18"
  45. bold
  46. ></u-icon>
  47. </view>
  48. <view
  49. class="bottom-right-but flex-left justify-around"
  50. style="margin-left: 26rpx"
  51. >
  52. <view>变更</view>
  53. <view class="icon flex-center"
  54. ><img src="@/static/img/icon-change.svg"
  55. /></view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="video-box">
  62. <view class="top-content flex justify-between">
  63. <h4>观看历史</h4>
  64. <view class="flex-left right-but" @click="goHistory">
  65. <text>更多</text>
  66. <u-icon
  67. name="arrow-right"
  68. color="#717171"
  69. size="14"
  70. bold
  71. ></u-icon>
  72. </view>
  73. </view>
  74. <view class="flex-left">
  75. <view
  76. class="card-row"
  77. v-for="(item, index) in historyData"
  78. :key="index"
  79. @click="goPlayVideo(item)"
  80. >
  81. <view class="card-img">
  82. <u-image
  83. :src="item.videoPoster"
  84. radius="8rpx"
  85. width="120rpx"
  86. height="180rpx"
  87. ></u-image>
  88. <text>{{ secondsToTime(item.duration) }}</text>
  89. </view>
  90. <view class="card-name">
  91. {{ item.videoName }}
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="video-box" style="margin-top: 40rpx">
  97. <view class="top-content flex justify-between">
  98. <h4>我的收藏</h4>
  99. <view class="flex-left right-but" @click="goCollect">
  100. <text>更多</text>
  101. <u-icon
  102. name="arrow-right"
  103. color="#717171"
  104. size="14"
  105. bold
  106. ></u-icon>
  107. </view>
  108. </view>
  109. <view class="flex-left">
  110. <view
  111. class="card-row"
  112. v-for="(item, index) in collectData"
  113. :key="index"
  114. @click="goPlayVideo(item)"
  115. >
  116. <view class="card-img">
  117. <u-image
  118. :src="item.videoPoster"
  119. radius="8rpx"
  120. width="120rpx"
  121. height="180rpx"
  122. ></u-image>
  123. <!-- <text>{{ item.playTime }}</text> -->
  124. </view>
  125. <view class="card-name">
  126. {{ item.videoName }}
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </template>
  133. <script>
  134. import $req from "@/service/serviceConfig";
  135. import topMain from "@/components/topMain";
  136. export default {
  137. components: {
  138. topMain,
  139. },
  140. data() {
  141. return {
  142. historyData: [],
  143. collectData: [],
  144. };
  145. },
  146. onShow() {
  147. let vm = this;
  148. vm.gteHistoryData();
  149. vm.gteCollectData();
  150. },
  151. methods: {
  152. // 播放视频
  153. goPlayVideo(row) {
  154. uni.navigateTo({
  155. url: `/pages/play/play?url=${row.url}`,
  156. });
  157. },
  158. // 前往历记录列表
  159. goHistory() {
  160. uni.navigateTo({
  161. url: `/pages/my/viewHistorys`,
  162. });
  163. },
  164. // 前往收藏列表
  165. goCollect() {
  166. uni.navigateTo({
  167. url: `/pages/my/myCollect`,
  168. });
  169. },
  170. // 获取历史数据
  171. gteHistoryData() {
  172. let vm = this;
  173. let query = {
  174. page: 1,
  175. size: 4,
  176. };
  177. uni.showLoading({
  178. title: "加载中",
  179. });
  180. $req.request({ alias: "view-records-page", query })
  181. .then((res) => {
  182. uni.hideLoading();
  183. if (res.code == 0) {
  184. vm.historyData = res.data.rows;
  185. }
  186. })
  187. .catch(() => {});
  188. },
  189. // 获取收藏数据
  190. gteCollectData() {
  191. let vm = this;
  192. let query = {
  193. page: 1,
  194. size: 4,
  195. };
  196. uni.showLoading({
  197. title: "加载中",
  198. });
  199. $req.request({ alias: "favorite-page", query })
  200. .then((res) => {
  201. uni.hideLoading();
  202. if (res.code == 0) {
  203. vm.collectData = res.data.rows;
  204. }
  205. })
  206. .catch(() => {});
  207. },
  208. goVip() {
  209. uni.navigateTo({
  210. url: "/pages/my/vip",
  211. });
  212. },
  213. goRecord() {
  214. uni.navigateTo({
  215. url: "/pages/my/record",
  216. });
  217. },
  218. // 秒转换为时分秒
  219. secondsToTime(seconds) {
  220. const hours = Math.floor(seconds / 3600)
  221. .toString()
  222. .padStart(2, "0");
  223. const minutes = Math.floor((seconds % 3600) / 60)
  224. .toString()
  225. .padStart(2, "0");
  226. const remainingSeconds = (seconds % 60).toString().padStart(2, "0");
  227. return hours + ":" + minutes + ":" + remainingSeconds;
  228. },
  229. },
  230. };
  231. </script>
  232. <style lang="less" scoped>
  233. .content-page-wrap {
  234. overflow-x: hidden;
  235. padding: 32rpx;
  236. .middle-main {
  237. padding: 28rpx 28rpx 42rpx 28rpx;
  238. .vip-box {
  239. position: relative;
  240. display: flex;
  241. align-items: center;
  242. height: 72rpx;
  243. margin-top: 46rpx;
  244. image {
  245. height: 100%;
  246. width: 100%;
  247. }
  248. .vip-time {
  249. position: absolute;
  250. top: 0;
  251. right: 0px;
  252. left: 50px;
  253. display: flex;
  254. justify-content: center;
  255. line-height: 80rpx;
  256. color: #e5a670;
  257. font-size: 26rpx;
  258. width: 100%;
  259. .text {
  260. margin-right: 80rpx;
  261. h2 {
  262. color: #ffd9ad;
  263. margin: 0 20rpx;
  264. }
  265. }
  266. }
  267. }
  268. .inlet-box {
  269. margin-top: 40rpx;
  270. color: #000;
  271. font-size: 28rpx;
  272. font-weight: bold;
  273. .top-but {
  274. flex: 1;
  275. height: 216rpx;
  276. background-color: #e4f2e9;
  277. border-radius: 30rpx;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-evenly;
  281. flex-direction: column;
  282. margin-bottom: 26rpx;
  283. .icon {
  284. width: 148rpx;
  285. height: 56rpx;
  286. background-color: #6ae199;
  287. border-radius: 62rpx;
  288. }
  289. }
  290. .bottom-left-but {
  291. flex: 1;
  292. height: 100rpx;
  293. background-color: #e4f2e9;
  294. border-radius: 30rpx;
  295. }
  296. .bottom-right-but {
  297. width: 214rpx;
  298. height: 100rpx;
  299. background-color: #e4f2e9;
  300. border-radius: 30rpx;
  301. .icon {
  302. width: 48rpx;
  303. height: 42rpx;
  304. background: #6ae199;
  305. border-radius: 62rpx;
  306. }
  307. }
  308. }
  309. }
  310. .my-bg {
  311. position: absolute;
  312. top: 140rpx;
  313. right: 0;
  314. width: 328rpx;
  315. height: 219.84rpx;
  316. }
  317. .video-box {
  318. width: 100%;
  319. // height: 344rpx;
  320. border-radius: 20rpx;
  321. border: 2rpx solid #e6aa76;
  322. padding: 48rpx 36rpx;
  323. .top-content {
  324. margin-bottom: 40rpx;
  325. .right-but {
  326. color: #717171;
  327. font-size: 24rpx;
  328. text {
  329. margin-right: 10rpx;
  330. }
  331. }
  332. }
  333. .card-row:first-child {
  334. margin-left: 0;
  335. }
  336. .card-row {
  337. width: 21.5%;
  338. margin-left: 32rpx;
  339. .card-img {
  340. position: relative;
  341. width: 100%;
  342. // height: 240rpx;
  343. text {
  344. font-size: 20rpx;
  345. color: #fff;
  346. position: absolute;
  347. right: 8rpx;
  348. bottom: 8rpx;
  349. }
  350. }
  351. .card-name {
  352. color: #000;
  353. font-size: 24rpx;
  354. margin-top: 24rpx;
  355. overflow: hidden;
  356. text-overflow: ellipsis;
  357. display: -webkit-box;
  358. -webkit-line-clamp: 1;
  359. -webkit-box-orient: vertical;
  360. }
  361. }
  362. }
  363. }
  364. </style>