series.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {extend name="public/base"/}
  2. {block name="css"}
  3. <style>
  4. .series-title {font-size: 16px;}
  5. .series-time {font-size: 12px;color: #999;}
  6. .lw-list article{border-radius: 5px;width:100%;height:110px;display:flex;align-items:center;background:white;padding:5px 10px;}
  7. .lw-list article .s-left {height:90px;display:flex;flex-direction:column;width: 100%;margin-left:auto;}
  8. .lw-list article .s-left.image {width: calc(100% - 120px);}
  9. .lw-list article .s-left .s-title{font-size: 16px;text-overflow: ellipsis;display: -webkit-box;overflow: hidden;-webkit-box-orient: vertical;-webkit-line-clamp: 3;text-align:left;color:#323233;}
  10. .lw-list article .s-left .s-time{font-size: 12px;color:#999;margin-top:auto;text-align:right;}
  11. .lw-list article .s-left .s-color3{color:var(--blue);}
  12. .lw-list article .s-left .s-color2{color:var(--red);}
  13. .lw-list article .s-right {width:110px;}
  14. </style>
  15. {/block}
  16. {block name="body"}
  17. <van-nav-bar
  18. class="nav-theme"
  19. :fixed="true"
  20. :placeholder="true"
  21. left-text="返回"
  22. left-arrow
  23. @click-left="onBack"
  24. >
  25. <template #title>
  26. <span class="text-white">{$series.title}</span>
  27. </template>
  28. </van-nav-bar>
  29. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  30. <van-list
  31. v-model:loading="loading"
  32. :finished="finished"
  33. finished-text="没有更多了"
  34. @load="onList"
  35. >
  36. <div class="lw-list">
  37. <article v-for="video in list" @click="toVideo(video.id)">
  38. <section class="s-right">
  39. <van-image
  40. width="110"
  41. height="85"
  42. fit="cover"
  43. :src="video.main_image"
  44. ></van-image>
  45. </section>
  46. <section class="s-left image">
  47. <div class="s-title">{{video.title}}</div>
  48. <div class="s-time" :class="'s-color'+video.watch_status">{{video.watch_text}}</div>
  49. </section>
  50. </article>
  51. </div>
  52. </van-list>
  53. </van-pull-refresh>
  54. {/block}
  55. {block name="script"}
  56. <script>
  57. function v_setup() {
  58. let base = {};
  59. base.activeNames = Vue.ref([]);
  60. //列表
  61. base.page = Vue.ref(1);
  62. base.loading = Vue.ref(false);
  63. base.finished = Vue.ref(false);
  64. base.refreshing = Vue.ref(false);
  65. base.list = Vue.reactive([]);
  66. base.onList = () => {
  67. let param = {};
  68. param.page = base.page.value;
  69. base.page.value++;
  70. postJson("soldier/listSeries?id={$id}", param).then( ({data}) => {
  71. base.loading.value = false;
  72. if (base.refreshing.value) base.refreshing.value = false;
  73. if (data.length === 0) {
  74. base.finished.value = true;
  75. } else {
  76. base.list.push(...data);
  77. }
  78. });
  79. };
  80. base.onRefresh = () => {
  81. base.list = Vue.reactive([]);
  82. base.page.value = 1;
  83. base.loading.value = true;
  84. base.finished.value = false;
  85. base.onList();
  86. };
  87. base.toVideo = (id) => {
  88. location.href = "{:url('soldier/video')}?id=" + id;
  89. };
  90. base.onBack = () => {
  91. location.href = "{:url('soldier/index')}";
  92. };
  93. return base;
  94. }
  95. </script>
  96. {/block}