吉光研途前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

470 lines
13 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view :class="['page__view', hasPoster ? 'with-bottom' : '']">
  3. <!-- 导航栏 -->
  4. <navbar :title="details.title" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="cover-image" :style="{ height: coverImageHeight }">
  6. <image class="img" :src="details.image" mode="scaleToFill" ></image>
  7. <view class="shadow" :style="{ height: coverImageShadowHeight }"></view>
  8. </view>
  9. <view class="page-title">
  10. <view>{{ details.title }}</view>
  11. <view class="page-title-line"></view>
  12. </view>
  13. <view class="section" v-if="details.cotentModuleOne">
  14. <view class="section-header">
  15. <view class="section-header-line"></view>
  16. <view>{{ details.titleModuleOne }}</view>
  17. </view>
  18. <view class="section-content">
  19. <view class="paragraph">
  20. <uv-parse :content="details.cotentModuleOne"></uv-parse>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="section" v-if="details.cotentModuleTwo">
  25. <view class="section-header">
  26. <view class="section-header-line"></view>
  27. <view>{{ details.titleModuleTwo }}</view>
  28. </view>
  29. <view class="section-content">
  30. <view class="paragraph">
  31. <uv-parse :content="details.cotentModuleTwo"></uv-parse>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="section" v-if="details.cotentModuleThree">
  36. <view class="section-header">
  37. <view class="section-header-line"></view>
  38. <view>{{ details.titleModuleThree }}</view>
  39. </view>
  40. <view class="section-content">
  41. <view class="paragraph">
  42. <uv-parse :content="details.cotentModuleThree"></uv-parse>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="section" v-if="details.educationExcelOneList && details.educationExcelOneList.length">
  47. <view class="section-header">
  48. <view class="section-header-line"></view>
  49. <view>{{ details.titleExcelOne }}</view>
  50. </view>
  51. <view class="section-content">
  52. <uv-read-more show-height="300rpx" :toggle="true" textIndent="0" closeText="展开" :shadowStyle="{ backgroundImage: 'linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #fff 80%)', paddingTop: '100rpx', marginTop: '-100rpx' }">
  53. <view class="table">
  54. <view class="table-row" v-for="row in details.educationExcelOneList" :key="row.id">
  55. <view class="table-cell">{{ row.columnOne }}</view>
  56. <view class="table-cell">{{ row.columnTwo }}</view>
  57. </view>
  58. </view>
  59. </uv-read-more>
  60. </view>
  61. </view>
  62. <view class="section" v-if="details.cotentModuleFour">
  63. <view class="section-header">
  64. <view class="section-header-line"></view>
  65. <view>{{ details.titleModuleFour }}</view>
  66. </view>
  67. <view class="section-content">
  68. <view class="paragraph">
  69. <uv-parse :content="details.cotentModuleFour"></uv-parse>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="section" v-if="details.cotentModuleFive">
  74. <view class="section-header">
  75. <view class="section-header-line"></view>
  76. <view>{{ details.titleModuleFive }}</view>
  77. </view>
  78. <view class="section-content">
  79. <view class="paragraph">
  80. <uv-parse :content="details.cotentModuleFive"></uv-parse>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="section" v-if="details.educationExcelTwoList && details.educationExcelTwoList.length">
  85. <view class="section-header">
  86. <view class="section-header-line"></view>
  87. <view>{{ details.titleExcelTwo }}</view>
  88. </view>
  89. <view class="section-content">
  90. <uv-read-more show-height="300rpx" :toggle="true" textIndent="0" closeText="展开" :shadowStyle="{ backgroundImage: 'linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #fff 80%)', paddingTop: '100rpx', marginTop: '-100rpx' }">
  91. <view class="table">
  92. <view class="table-row" v-for="row in details.educationExcelTwoList" :key="row.id">
  93. <view class="table-cell">{{ row.columnOne }}</view>
  94. <view class="table-cell">{{ row.columnTwo }}</view>
  95. </view>
  96. </view>
  97. </uv-read-more>
  98. </view>
  99. </view>
  100. <view class="section" v-if="details.cotentModuleSix">
  101. <view class="section-header">
  102. <view class="section-header-line"></view>
  103. <view>{{ details.titleModuleSix }}</view>
  104. </view>
  105. <view class="section-content">
  106. <view class="paragraph">
  107. <uv-parse :content="details.cotentModuleSix"></uv-parse>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="section" v-if="details.cotentModuleSeven">
  112. <view class="section-header">
  113. <view class="section-header-line"></view>
  114. <view>{{ details.titleModuleSeven }}</view>
  115. </view>
  116. <view class="section-content">
  117. <view class="paragraph">
  118. <uv-parse :content="details.cotentModuleSeven"></uv-parse>
  119. </view>
  120. </view>
  121. </view>
  122. <!-- 附加材料 -->
  123. <view class="section" v-if="details.educationDocumentTwoList && details.educationDocumentTwoList.length">
  124. <view class="section-header">
  125. <view class="section-header-line"></view>
  126. <view>附加材料</view>
  127. </view>
  128. <view class="section-content attachment">
  129. <view class="flex file" v-for="item in details.educationDocumentTwoList" :key="item.id">
  130. <view class="file-info">
  131. <template v-if="item.type == 'pdf'">
  132. <image class="file-icon" src="@/static/image/icon-pdf.png" mode="widthFix"></image>
  133. </template>
  134. <template v-else>
  135. <image class="file-icon" src="@/static/image/icon-word.png" mode="widthFix"></image>
  136. </template>
  137. <view class="file-detail">
  138. <view class="title">{{ item.title }}</view>
  139. <!-- <view class="desc">{{ `${getFileType(item.document)} ${item.size || '-'}MB` }}</view> -->
  140. </view>
  141. </view>
  142. <button class="btn" @click="downloadFile(item.document)">下载</button>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="flex bottom" v-if="hasPoster">
  147. <view class="flex btns">
  148. <button class="btn" @click="jumpToPoster">保存海报</button>
  149. <button class="btn btn-share" open-type="share">分享文章</button>
  150. </view>
  151. </view>
  152. </view>
  153. </template>
  154. <script>
  155. export default {
  156. data() {
  157. return {
  158. details: {},
  159. coverImageHeight: '566rpx',
  160. coverImageShadowHeight: '113rpx'
  161. }
  162. },
  163. onLoad({ thesisId }) {
  164. const windowWidth = uni.getSystemInfoSync().windowWidth
  165. const coverImageHeight = (windowWidth) * 566 / 714
  166. const coverImageShadowHeight = (windowWidth) * 113 / 714
  167. this.coverImageHeight = `${coverImageHeight}px`
  168. this.coverImageShadowHeight = `${coverImageShadowHeight}px`
  169. this.getData(thesisId)
  170. },
  171. onShareAppMessage(res) {
  172. return {
  173. title: this.posterData.paperDesc,
  174. imageUrl: this.posterData.paperImage,
  175. path: this.posterData.path,
  176. }
  177. },
  178. computed: {
  179. posterData() {
  180. const { id, title, image, paperDesc, paperImage } = this.details || {}
  181. return {
  182. paperDesc: paperDesc || title,
  183. paperImage: paperImage || image || '',
  184. path: `pages_order/thesis/index?thesisId=${id}`
  185. }
  186. },
  187. hasPoster() {
  188. const { paperImage } = this.details || {}
  189. return !!paperImage
  190. }
  191. },
  192. methods: {
  193. async getData(thesisId) {
  194. try {
  195. this.details = await this.$fetch('queryThesisTwoById', { thesisId })
  196. } catch (err) {
  197. }
  198. },
  199. getFileType(fileName) {
  200. const pdfReg = /(.pdf)$/g
  201. // const officeReg = /(doc|docx|ppt|pptx|xls|xlsx)$/g
  202. return pdfReg.test(fileName) ? 'pdf' : ''
  203. },
  204. downloadFile(url) {
  205. console.log('downloadFile', url)
  206. uni.downloadFile({
  207. url, // 文件地址
  208. success: (downloadRes) => {
  209. console.log('downloadRes', downloadRes)
  210. if (downloadRes.statusCode === 200) {
  211. uni.openDocument({
  212. showMenu: true,
  213. filePath: downloadRes.tempFilePath,
  214. success: () => console.log('打开成功')
  215. });
  216. } else {
  217. uni.showToast({ title: '下载失败', icon: 'none' });
  218. }
  219. },
  220. fail: (err) => {
  221. console.log('downloadFile fail', err)
  222. uni.showToast({ title: '网络异常', icon: 'none' });
  223. }
  224. });
  225. },
  226. jumpToPoster() {
  227. uni.setStorageSync('posterData', this.posterData)
  228. uni.navigateTo({
  229. url: `/pages_order/thesis/poster`
  230. })
  231. },
  232. },
  233. }
  234. </script>
  235. <style scoped lang="scss">
  236. .page__view {
  237. background: #FFFFFF;
  238. padding-bottom: 62rpx;
  239. &.with-bottom {
  240. padding-bottom: calc(62rpx + 110rpx + env(safe-area-inset-bottom));
  241. }
  242. }
  243. .cover-image {
  244. position: relative;
  245. width: 100%;
  246. background: #FFFFFF;
  247. .img {
  248. width: 100%;
  249. height: 100%;
  250. }
  251. .shadow {
  252. position: absolute;
  253. bottom: 0;
  254. left: 0;
  255. width: 100%;
  256. height: 100%;
  257. background: linear-gradient(transparent, #FFFFFF);
  258. }
  259. }
  260. .page-title {
  261. padding: 0 26rpx;
  262. font-size: 60rpx;
  263. font-weight: 700;
  264. color: $uni-color;
  265. &-line {
  266. margin: 12rpx 0 24rpx 0;
  267. width: 120rpx;
  268. height: 8rpx;
  269. background: $uni-color;
  270. }
  271. }
  272. .section {
  273. width: 100%;
  274. padding: 0 26rpx;
  275. box-sizing: border-box;
  276. & + & {
  277. margin-top: 40rpx;
  278. }
  279. &-header {
  280. display: flex;
  281. align-items: center;
  282. justify-content: flex-start;
  283. column-gap: 15rpx;
  284. font-size: 32rpx;
  285. font-weight: 700;
  286. color: $uni-color;
  287. &-line {
  288. width: 18rpx;
  289. height: 52rpx;
  290. border-radius: 9rpx;
  291. background-image: linear-gradient(#E2DDFF, #6851A7);
  292. }
  293. }
  294. &-content {
  295. margin-top: 37rpx;
  296. .paragraph {
  297. width: 100%;
  298. padding: 30rpx;
  299. box-sizing: border-box;
  300. white-space: pre-line;
  301. font-size: 24rpx;
  302. color: #595757;
  303. background: linear-gradient(to right, rgba($color: #E2DDFF, $alpha: 0.54), rgba($color: #C8C3FD, $alpha: 0.54));
  304. border-radius: 15rpx;
  305. }
  306. .table {
  307. width: 100%;
  308. border-radius: 10rpx;
  309. overflow: hidden;
  310. &-row {
  311. display: grid;
  312. grid-template-columns: 218rpx auto;
  313. background: rgba($color: #C8C3FD, $alpha: 0.63);
  314. &:nth-child(2n) {
  315. background: rgba($color: #C8C3FD, $alpha: 0.26);
  316. }
  317. }
  318. &-cell {
  319. display: inline-flex;
  320. flex-direction: column;
  321. align-items: flex-start;
  322. justify-content: center;
  323. padding: 17rpx;
  324. box-sizing: border-box;
  325. font-family: PingFang SC;
  326. font-weight: 400;
  327. // font-size: 28rpx;
  328. white-space: pre-wrap;
  329. // color: #080808;
  330. font-size: 18rpx;
  331. line-height: 1.5;
  332. color: #595757;
  333. &:first-child {
  334. align-items: center;
  335. text-align: center;
  336. font-size: 22rpx;
  337. line-height: 1.4;
  338. font-weight: 600;
  339. border-right: 1rpx solid #E5E5E5;
  340. }
  341. }
  342. }
  343. /deep/ .uv-read-more__toggle {
  344. // justify-content: flex-end;
  345. padding: 10rpx 0;
  346. background: linear-gradient(to right, rgba($color: #E2DDFF, $alpha: 0.67), rgba($color: #C8C3FD, $alpha: 0.67), rgba($color: #E1DCFF, $alpha: 0.67));
  347. }
  348. /deep/ .uv-read-more__toggle__text .uv-text__value {
  349. color: #9D9DF9 !important;
  350. font-size: 20rpx !important;
  351. }
  352. &.attachment {
  353. .file {
  354. justify-content: space-between;
  355. padding: 32rpx 15rpx 32rpx 26rpx;
  356. background: #f8f8f8;
  357. border-radius: 15rpx;
  358. &-info {
  359. display: flex;
  360. // align-items: flex-end;
  361. align-items: center;
  362. }
  363. &-icon {
  364. width: 64rpx;
  365. height: auto;
  366. }
  367. &-detail {
  368. margin-left: 14rpx;
  369. .title {
  370. font-size: 30rpx;
  371. color: #000000;
  372. }
  373. .desc {
  374. font-size: 28rpx;
  375. color: #999999;
  376. }
  377. }
  378. .btn {
  379. padding: 7rpx 30rpx;
  380. font-size: 28rpx;
  381. color: #FFFFFF;
  382. background: $uni-color;
  383. border-radius: 27rpx;
  384. }
  385. }
  386. .file + .file {
  387. margin-top: 21rpx;
  388. }
  389. }
  390. }
  391. }
  392. .bottom {
  393. position: fixed;
  394. left: 0;
  395. bottom: 0;
  396. width: 100vw;
  397. height: 94rpx;
  398. padding-bottom: env(safe-area-inset-bottom);
  399. background: #FFFFFF;
  400. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  401. .btns {
  402. column-gap: 34rpx;
  403. }
  404. .btn {
  405. padding: 12rpx 70rpx;
  406. font-size: 32rpx;
  407. font-weight: 600;
  408. line-height: 1.2;
  409. color: #FFFFFF;
  410. background: $uni-color;
  411. border-radius: 30rpx;
  412. &-share {
  413. background: #9E96CC;
  414. }
  415. }
  416. }
  417. </style>