吉光研途前端代码仓库
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.

450 lines
12 KiB

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