package.vue 4.9 KB

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