_fileId.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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. .page {
  109. margin-bottom: 16px;
  110. }
  111. .page-top {
  112. height: 360px;
  113. background: url(~assets/theme-images/normal/pc/banner-doc.png);
  114. background-size: auto 360px;
  115. background-position: center;
  116. .logo {
  117. display: block;
  118. width: 120px;
  119. height: 120px;
  120. border-radius: 50%;
  121. background: #fff;
  122. }
  123. .name {
  124. font-size: 30px;
  125. color: #fff;
  126. }
  127. }
  128. .page-content {
  129. width: 1200px;
  130. margin: 0 auto;
  131. background-color: #fff;
  132. margin-top: 16px;
  133. box-sizing: border-box;
  134. overflow: hidden;
  135. padding: 32px 0;
  136. .el-breadcrumb {
  137. margin: 0 24px 32px;
  138. }
  139. .list-header,
  140. .list-body {
  141. font-size: 14px;
  142. color: #282828;
  143. .col {
  144. &:nth-child(1) {
  145. flex: 1;
  146. }
  147. &:nth-child(2),
  148. &:nth-child(3),
  149. &:nth-child(4) {
  150. width: 120px;
  151. text-align: center;
  152. }
  153. }
  154. }
  155. .list-header {
  156. .row {
  157. display: flex;
  158. justify-content: space-between;
  159. padding: 0 24px 16px;
  160. }
  161. }
  162. .list-body {
  163. .row {
  164. line-height: 70px;
  165. color: #666666;
  166. padding: 0 24px;
  167. transition: all 0.4s;
  168. &:hover {
  169. background: #fffaf3;
  170. }
  171. .section {
  172. display: flex;
  173. justify-content: space-between;
  174. border-top: 1px solid #f7f7f7;
  175. &.mobile {
  176. display: none;
  177. }
  178. }
  179. img {
  180. display: inline-block;
  181. width: 32px;
  182. height: 32px;
  183. background: #eee;
  184. margin-right: 24px;
  185. }
  186. .file-name {
  187. cursor: pointer;
  188. transition: all 0.4s;
  189. margin-left: 24px;
  190. &:hover {
  191. color: #bc1724;
  192. }
  193. }
  194. .control {
  195. display: flex;
  196. justify-content: center;
  197. align-items: center;
  198. .download {
  199. display: block;
  200. width: 24px;
  201. height: 24px;
  202. background: url(~assets/theme-images/common/pc-icon-download.png)
  203. no-repeat center;
  204. background-size: 24px;
  205. margin: 0 auto;
  206. cursor: pointer;
  207. &:hover {
  208. background-image: url(~assets/theme-images/common/pc-icon-download-hover.png);
  209. }
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. // 移动 端
  217. @media screen and (max-width: 768px) {
  218. .page-top {
  219. height: 46vw;
  220. background: url(~assets/theme-images/normal/h5/banner-doc.png);
  221. background-size: auto 46vw;
  222. background-position: center;
  223. .logo {
  224. display: block;
  225. width: 14.8vw;
  226. height: 14.8vw;
  227. border-radius: 50%;
  228. background: #fff;
  229. }
  230. .name {
  231. font-size: 4vw;
  232. color: #fff;
  233. text-align: center;
  234. margin: 0 3.2vw;
  235. }
  236. }
  237. .page-content {
  238. position: relative;
  239. padding: 8vw 0;
  240. .el-breadcrumb {
  241. margin: 0 4vw 4vw;
  242. }
  243. .list-header {
  244. display: none;
  245. }
  246. .list-body {
  247. font-size: 3.6vw;
  248. color: #282828;
  249. .row {
  250. color: #666666;
  251. padding: 0 4vw;
  252. .section {
  253. display: flex;
  254. justify-content: space-between;
  255. align-items: center;
  256. border-bottom: 0.1vw solid #f7f7f7;
  257. height: 17.6vw;
  258. &.pc {
  259. display: none;
  260. }
  261. .file-cover {
  262. img {
  263. width: 8.8vw;
  264. height: 8.8vw;
  265. background: #eee;
  266. }
  267. }
  268. .file-content {
  269. flex: 1;
  270. margin: 0 4.8vw;
  271. .file-name {
  272. font-size: 3.6vw;
  273. @include ellipsis(1);
  274. }
  275. .file-info {
  276. font-size: 3vw;
  277. color: #999999;
  278. margin-top: 1.6vw;
  279. .size {
  280. margin-left: 4vw;
  281. }
  282. }
  283. }
  284. .control {
  285. width: 6.4vw;
  286. height: 6.4vw;
  287. .download {
  288. display: block;
  289. width: 6.4vw;
  290. height: 6.4vw;
  291. background: url(~assets/theme-images/common/h5-icon-download.png)
  292. no-repeat center;
  293. background-size: 6.4vw;
  294. margin: 0 auto;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. }
  301. }
  302. </style>