_fileId.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="page">
  3. <div class="page-top flex flex-col justify-center items-center">
  4. <span class="name mt-2" v-text="supplierInfo.shopName + '资料库'"></span>
  5. </div>
  6. <div class="page-content">
  7. <!-- 面包屑 -->
  8. <el-breadcrumb separator-class="el-icon-arrow-right">
  9. <el-breadcrumb-item :to="{ path: `${routePrefix}/docs/0` }"
  10. >全部文件</el-breadcrumb-item
  11. >
  12. <template v-for="(item, index) in crumbList">
  13. <template v-if="index === crumbList.length - 1">
  14. <el-breadcrumb-item :key="item.id">
  15. <span class="cell">{{ item.fileName }}</span>
  16. </el-breadcrumb-item>
  17. </template>
  18. <template v-else>
  19. <el-breadcrumb-item
  20. :key="item.id"
  21. :to="{ path: `${routePrefix}/docs/${item.id}` }"
  22. >
  23. <span>{{ item.fileName | crumbFormat }}</span>
  24. </el-breadcrumb-item>
  25. </template>
  26. </template>
  27. </el-breadcrumb>
  28. <!-- 列表 -->
  29. <div class="list-header">
  30. <div class="row">
  31. <div class="col">文件名</div>
  32. <div class="col">时间</div>
  33. <div class="col">大小</div>
  34. <div class="col">操作</div>
  35. </div>
  36. </div>
  37. <div class="list-body">
  38. <div class="row" v-for="item in list" :key="item.id">
  39. <div class="section pc">
  40. <div class="col">
  41. <doc-icon :type="item.fileType" :src="item.screenshot" />
  42. <span
  43. class="file-name"
  44. @click="onRowClick(item)"
  45. v-text="item.fileName"
  46. ></span>
  47. </div>
  48. <div class="col">{{ item.saveTime | dateFormat }}</div>
  49. <div class="col">
  50. <span v-if="item.packageType > 0">{{
  51. item.fileSize | fileSize
  52. }}</span>
  53. <span v-else>-</span>
  54. </div>
  55. <div class="col control">
  56. <div class="download" @click="onDownload(item, $event)"></div>
  57. </div>
  58. </div>
  59. <div class="section mobile">
  60. <div class="col file-cover">
  61. <doc-icon :type="item.fileType" :src="item.screenshot" />
  62. </div>
  63. <div class="col file-content" @click="onRowClick(item)">
  64. <div class="file-name" v-if="item.fileType === 'article'">
  65. {{ item.fileName | fileNameFormat }}
  66. </div>
  67. <div class="file-name" v-else>{{ item.fileName }}</div>
  68. <div class="file-info">
  69. <span class="date">{{ item.saveTime | dateFormat }}</span>
  70. <span class="size">
  71. <span v-if="item.packageType > 0">{{
  72. item.fileSize | fileSize
  73. }}</span>
  74. <span v-else>-</span>
  75. </span>
  76. </div>
  77. </div>
  78. <div class="col control">
  79. <div class="download" @click="onDownload(item, $event)"></div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import fileListMixin from '@/mixins/fileList'
  89. export default {
  90. layout: 'app',
  91. mixins: [fileListMixin],
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. /* scss中可以用mixin来扩展 */
  96. @mixin ellipsis($line: 1) {
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. display: -webkit-box;
  100. -webkit-line-clamp: $line;
  101. -webkit-box-orient: vertical;
  102. }
  103. // pc 端
  104. @media screen and (min-width: 768px) {
  105. .page {
  106. margin-bottom: 16px;
  107. }
  108. .page-top {
  109. height: 360px;
  110. @include themify($themes) {
  111. background: themed('pc-banner-doc');
  112. background-size: auto 360px;
  113. }
  114. .logo {
  115. display: block;
  116. width: 120px;
  117. height: 120px;
  118. border-radius: 50%;
  119. background: #fff;
  120. }
  121. .name {
  122. font-size: 30px;
  123. color: #fff;
  124. }
  125. }
  126. .page-content {
  127. width: 1200px;
  128. margin: 0 auto;
  129. background-color: #fff;
  130. margin-top: 16px;
  131. box-sizing: border-box;
  132. overflow: hidden;
  133. padding: 32px 0;
  134. .el-breadcrumb {
  135. margin: 0 24px 32px;
  136. }
  137. .list-header,
  138. .list-body {
  139. font-size: 14px;
  140. color: #282828;
  141. .col {
  142. &:nth-child(1) {
  143. flex: 1;
  144. }
  145. &:nth-child(2),
  146. &:nth-child(3),
  147. &:nth-child(4) {
  148. width: 120px;
  149. text-align: center;
  150. }
  151. }
  152. }
  153. .list-header {
  154. .row {
  155. display: flex;
  156. justify-content: space-between;
  157. padding: 0 24px 16px;
  158. }
  159. }
  160. .list-body {
  161. .row {
  162. line-height: 70px;
  163. color: #666666;
  164. padding: 0 24px;
  165. transition: all 0.4s;
  166. &:hover {
  167. background: #fff1f2;
  168. }
  169. .section {
  170. display: flex;
  171. justify-content: space-between;
  172. border-top: 1px solid #f7f7f7;
  173. &.mobile {
  174. display: none;
  175. }
  176. }
  177. img {
  178. display: inline-block;
  179. width: 32px;
  180. height: 32px;
  181. background: #eee;
  182. margin-right: 24px;
  183. }
  184. .file-name {
  185. cursor: pointer;
  186. transition: all 0.4s;
  187. margin-left: 24px;
  188. &:hover {
  189. color: #bc1724;
  190. }
  191. }
  192. .control {
  193. display: flex;
  194. justify-content: center;
  195. align-items: center;
  196. .download {
  197. display: block;
  198. width: 24px;
  199. height: 24px;
  200. background: url(~assets/theme-images/common/pc-icon-download.png)
  201. no-repeat center;
  202. background-size: 24px;
  203. margin: 0 auto;
  204. cursor: pointer;
  205. &:hover {
  206. background-image: url(~assets/theme-images/common/pc-icon-download-hover.png);
  207. }
  208. }
  209. }
  210. }
  211. }
  212. }
  213. }
  214. // 移动 端
  215. @media screen and (max-width: 768px) {
  216. .page-top {
  217. height: 46vw;
  218. @include themify($themes) {
  219. background: themed('h5-banner-doc');
  220. background-size: auto 46vw;
  221. }
  222. .logo {
  223. display: block;
  224. width: 14.8vw;
  225. height: 14.8vw;
  226. border-radius: 50%;
  227. background: #fff;
  228. }
  229. .name {
  230. font-size: 4vw;
  231. color: #fff;
  232. }
  233. }
  234. .page-content {
  235. position: relative;
  236. padding: 8vw 0;
  237. .el-breadcrumb {
  238. margin: 0 4vw 4vw;
  239. }
  240. .list-header {
  241. display: none;
  242. }
  243. .list-body {
  244. font-size: 3.6vw;
  245. color: #282828;
  246. .row {
  247. color: #666666;
  248. padding: 0 4vw;
  249. .section {
  250. display: flex;
  251. justify-content: space-between;
  252. align-items: center;
  253. border-bottom: 0.1vw solid #f7f7f7;
  254. height: 17.6vw;
  255. &.pc {
  256. display: none;
  257. }
  258. .file-cover {
  259. img {
  260. width: 8.8vw;
  261. height: 8.8vw;
  262. background: #eee;
  263. }
  264. }
  265. .file-content {
  266. flex: 1;
  267. margin: 0 4.8vw;
  268. .file-name {
  269. font-size: 3.6vw;
  270. @include ellipsis(1);
  271. }
  272. .file-info {
  273. font-size: 3vw;
  274. color: #999999;
  275. margin-top: 1.6vw;
  276. .size {
  277. margin-left: 4vw;
  278. }
  279. }
  280. }
  281. .control {
  282. width: 6.4vw;
  283. height: 6.4vw;
  284. .download {
  285. display: block;
  286. width: 6.4vw;
  287. height: 6.4vw;
  288. background: url(~assets/theme-images/common/h5-icon-download.png)
  289. no-repeat center;
  290. background-size: 6.4vw;
  291. margin: 0 auto;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. }
  298. }
  299. </style>