_fileId.vue 8.3 KB

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