package.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="page">
  3. <van-list
  4. v-model="isLoadingMore"
  5. :finished="finished"
  6. :immediate-check="false"
  7. :finished-text="total ? '没有更多了' : ''"
  8. @load="onLoadMore"
  9. >
  10. <div class="page-top flex flex-col justify-center items-center">
  11. <img
  12. class="logo"
  13. src="https://static.caimei365.com/www/authentic/pc/ldm-logo-rect.png"
  14. />
  15. <div class="name mt-2">
  16. Bring you into a new era<br />
  17. of high-tech non-invasive beauty care
  18. </div>
  19. </div>
  20. <div class="page-content">
  21. <div class="list">
  22. <div
  23. class="section flex justify-between items-center"
  24. v-for="item in list"
  25. :key="item.fileId"
  26. >
  27. <div class="info">
  28. <div class="name" v-text="item.fileName"></div>
  29. <div class="download" @click="downloadLink(item)">点击下载</div>
  30. </div>
  31. </div>
  32. </div>
  33. <!-- 列表为空 -->
  34. <SimpleEmpty
  35. v-if="!total && !isRequest"
  36. description="敬请期待~"
  37. ></SimpleEmpty>
  38. </div>
  39. </van-list>
  40. </div>
  41. </template>
  42. <script>
  43. import { mapGetters } from 'vuex'
  44. import downloadLink from '@/utils/download-link'
  45. import { debounce } from '~/utils'
  46. export default {
  47. layout: 'app-ldm',
  48. data() {
  49. return {
  50. isLoadingMore: true,
  51. finished: false,
  52. isRequest: true,
  53. listQuery: {
  54. fileType: 2,
  55. fileTitle: '',
  56. authUserId: '',
  57. pageNum: 1,
  58. pageSize: 4,
  59. },
  60. list: [],
  61. total: 0,
  62. }
  63. },
  64. computed: {
  65. ...mapGetters(['userInfo', 'supplierInfo']),
  66. },
  67. mounted() {
  68. this.fetchList()
  69. },
  70. methods: {
  71. // 下载方法
  72. downloadLink(item) {
  73. const url = `${process.env.BASE_URL}/download/file?ossName=${item.fileDownloadUrl}&fileName=${item.fileName}`
  74. downloadLink(url)
  75. },
  76. // 获取列表
  77. fetchList: debounce(async function () {
  78. try {
  79. this.isLoadingMore = true
  80. this.listQuery.authUserId = this.userInfo.authUserId
  81. const res = await this.$http.api.getFileList(this.listQuery)
  82. this.list = [...this.list, ...res.data.list]
  83. this.finished = !res.data.hasNextPage
  84. this.total = res.data.total
  85. this.isLoadingMore = false
  86. this.listQuery.pageNum += 1
  87. } catch (error) {
  88. console.log(error)
  89. }
  90. }, 400),
  91. // 页码变化
  92. onPagiantionChange(index) {
  93. this.listQuery.pageNum = index
  94. this.fetchList()
  95. },
  96. // 加载更多
  97. onLoadMore() {
  98. this.fetchList()
  99. },
  100. },
  101. }
  102. </script>
  103. <style scoped lang="scss">
  104. /* scss中可以用mixin来扩展 */
  105. @mixin ellipsis($line: 1) {
  106. overflow: hidden;
  107. text-overflow: ellipsis;
  108. display: -webkit-box;
  109. -webkit-line-clamp: $line;
  110. -webkit-box-orient: vertical;
  111. }
  112. @media screen and (min-width: 768px) {
  113. .page-top {
  114. height: 466px;
  115. .logo {
  116. height: 61px;
  117. width: 311px;
  118. display: block;
  119. }
  120. .name {
  121. font-size: 19px;
  122. color: #221815;
  123. margin-top: 80px;
  124. text-align: center;
  125. line-height: 36px;
  126. text-transform: uppercase;
  127. }
  128. }
  129. .page-content {
  130. width: 973px;
  131. margin: 0 auto;
  132. .list {
  133. .section {
  134. position: relative;
  135. padding: 32px 16px;
  136. background: #fff;
  137. border-bottom: 1px solid #d8d8d8;
  138. &:first-child {
  139. border-top: 1px solid #d8d8d8;
  140. }
  141. .info {
  142. .name {
  143. width: 800px;
  144. font-size: 19px;
  145. color: #404040;
  146. line-height: 1.5;
  147. text-align: justify;
  148. @include ellipsis(1);
  149. }
  150. .download {
  151. position: absolute;
  152. right: 16px;
  153. bottom: 50%;
  154. transform: translateY(50%);
  155. font-size: 16px;
  156. color: #0080ed;
  157. cursor: pointer;
  158. &::after {
  159. content: '>';
  160. margin-left: 8px;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. }
  168. @media screen and (max-width: 768px) {
  169. .page-top {
  170. height: 76.4vw;
  171. .logo {
  172. height: 11.5vw;
  173. width: 59vw;
  174. display: block;
  175. }
  176. .name {
  177. font-size: 3.5vw;
  178. color: #221815;
  179. margin-top: 15vw;
  180. text-align: center;
  181. line-height: 6.6vw;
  182. text-transform: uppercase;
  183. }
  184. }
  185. .page-content {
  186. .list {
  187. .section {
  188. position: relative;
  189. padding: 6vw 2.6vw;
  190. margin: 0 4vw;
  191. background: #fff;
  192. border-bottom: 0.1vw solid #d8d8d8;
  193. &:first-child {
  194. border-top: 0.1vw solid #d8d8d8;
  195. }
  196. .info {
  197. .name {
  198. width: 66vw;
  199. font-size: 3.6vw;
  200. color: #404040;
  201. line-height: 1.5;
  202. text-align: justify;
  203. @include ellipsis(1);
  204. }
  205. .download {
  206. position: absolute;
  207. right: 2.6vw;
  208. bottom: 50%;
  209. transform: translateY(50%);
  210. font-size: 3vw;
  211. color: #0080ed;
  212. cursor: pointer;
  213. &::after {
  214. content: '>';
  215. margin-left: 8px;
  216. }
  217. }
  218. }
  219. }
  220. }
  221. }
  222. }
  223. </style>