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

449 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"></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: '848rpx',
  151. }
  152. },
  153. onLoad({ thesisId }) {
  154. const windowWidth = uni.getSystemInfoSync().windowWidth
  155. this.coverImageHeight = `${(windowWidth) * 848 / 714}px`
  156. this.getData(thesisId)
  157. },
  158. onShareAppMessage(res) {
  159. return {
  160. title: this.posterData.paperDesc,
  161. imageUrl: this.posterData.paperImage,
  162. path: this.posterData.path,
  163. }
  164. },
  165. computed: {
  166. posterData() {
  167. const { id, title, image, paperDesc, paperImage } = this.details || {}
  168. return {
  169. paperDesc: paperDesc || title,
  170. paperImage: paperImage || image || '',
  171. path: `pages_order/thesis/index?thesisId=${id}`
  172. }
  173. },
  174. hasPoster() {
  175. const { paperImage } = this.details || {}
  176. return !!paperImage
  177. }
  178. },
  179. methods: {
  180. async getData(thesisId) {
  181. try {
  182. this.details = await this.$fetch('queryThesisTwoById', { thesisId })
  183. } catch (err) {
  184. }
  185. },
  186. getFileType(fileName) {
  187. const pdfReg = /(.pdf)$/g
  188. // const officeReg = /(doc|docx|ppt|pptx|xls|xlsx)$/g
  189. return pdfReg.test(fileName) ? 'pdf' : ''
  190. },
  191. downloadFile(url) {
  192. console.log('downloadFile', url)
  193. uni.downloadFile({
  194. url, // 文件地址
  195. success: (downloadRes) => {
  196. console.log('downloadRes', downloadRes)
  197. if (downloadRes.statusCode === 200) {
  198. uni.openDocument({
  199. showMenu: true,
  200. filePath: downloadRes.tempFilePath,
  201. success: () => console.log('打开成功')
  202. });
  203. } else {
  204. uni.showToast({ title: '下载失败', icon: 'none' });
  205. }
  206. },
  207. fail: (err) => {
  208. console.log('downloadFile fail', err)
  209. uni.showToast({ title: '网络异常', icon: 'none' });
  210. }
  211. });
  212. },
  213. jumpToPoster() {
  214. uni.setStorageSync('posterData', this.posterData)
  215. uni.navigateTo({
  216. url: `/pages_order/thesis/poster`
  217. })
  218. },
  219. },
  220. }
  221. </script>
  222. <style scoped lang="scss">
  223. .page__view {
  224. background: #FFFFFF;
  225. padding-bottom: 62rpx;
  226. &.with-bottom {
  227. padding-bottom: calc(62rpx + 110rpx + env(safe-area-inset-bottom));
  228. }
  229. }
  230. .cover-image {
  231. position: relative;
  232. width: 100%;
  233. background: #FFFFFF;
  234. .img {
  235. width: 100%;
  236. height: 100%;
  237. }
  238. .shadow {
  239. position: absolute;
  240. top: 0;
  241. left: 0;
  242. width: 100%;
  243. height: 100%;
  244. // background: linear-gradient(transparent, #FFFFFF);
  245. background: linear-gradient(transparent, #FFFFFF 90%, #FFFFFF);
  246. }
  247. }
  248. .page-title {
  249. position: absolute;
  250. padding: 0 36rpx;
  251. transform: translateY(-100%);
  252. font-size: 60rpx;
  253. font-weight: 700;
  254. color: #4783F9;
  255. &-line {
  256. margin: 12rpx 0 24rpx 0;
  257. width: 120rpx;
  258. height: 8rpx;
  259. background: #4783F9;
  260. }
  261. }
  262. .section {
  263. width: 100%;
  264. padding: 0 18rpx;
  265. box-sizing: border-box;
  266. & + & {
  267. margin-top: 40rpx;
  268. }
  269. &-header {
  270. display: flex;
  271. align-items: center;
  272. justify-content: flex-start;
  273. column-gap: 15rpx;
  274. padding-left: 18rpx;
  275. font-size: 32rpx;
  276. font-weight: 700;
  277. color: #000000;
  278. &-line {
  279. width: 11rpx;
  280. height: 45rpx;
  281. border-radius: 6rpx;
  282. background-image: linear-gradient(#FFFFFF, #4883F9);
  283. }
  284. }
  285. &-content {
  286. margin-top: 37rpx;
  287. .paragraph {
  288. width: 100%;
  289. padding: 22rpx;
  290. box-sizing: border-box;
  291. white-space: pre-line;
  292. font-size: 28rpx;
  293. color: #000000;
  294. background: #F8F8F8;
  295. border-radius: 15rpx;
  296. }
  297. .table {
  298. width: 100%;
  299. border-radius: 15rpx;
  300. overflow: hidden;
  301. &-row {
  302. display: grid;
  303. grid-template-columns: 218rpx auto;
  304. background: #EEEEEE;
  305. &:nth-child(2n) {
  306. background: #DEDEDE;
  307. }
  308. }
  309. &-cell {
  310. display: inline-flex;
  311. flex-direction: column;
  312. align-items: flex-start;
  313. justify-content: center;
  314. padding: 17rpx;
  315. box-sizing: border-box;
  316. font-family: PingFang SC;
  317. font-weight: 400;
  318. font-size: 28rpx;
  319. white-space: pre-wrap;
  320. color: #080808;
  321. &:first-child {
  322. border-right: 1rpx solid #E5E5E5;
  323. }
  324. }
  325. }
  326. /deep/ .uv-read-more__toggle {
  327. justify-content: flex-end;
  328. }
  329. /deep/ .uv-read-more__toggle__text .uv-text__value {
  330. color: $uni-color !important;
  331. font-size: 22rpx !important;
  332. }
  333. &.attachment {
  334. .file {
  335. justify-content: space-between;
  336. padding: 32rpx 15rpx 32rpx 26rpx;
  337. background: #f8f8f8;
  338. border-radius: 15rpx;
  339. &-info {
  340. display: flex;
  341. // align-items: flex-end;
  342. align-items: center;
  343. }
  344. &-icon {
  345. width: 64rpx;
  346. height: auto;
  347. }
  348. &-detail {
  349. margin-left: 14rpx;
  350. .title {
  351. font-size: 30rpx;
  352. color: #000000;
  353. }
  354. .desc {
  355. font-size: 28rpx;
  356. color: #999999;
  357. }
  358. }
  359. .btn {
  360. padding: 7rpx 30rpx;
  361. font-size: 28rpx;
  362. color: #FFFFFF;
  363. background: #4883f9;
  364. border-radius: 27rpx;
  365. }
  366. }
  367. .file + .file {
  368. margin-top: 21rpx;
  369. }
  370. }
  371. }
  372. }
  373. .bottom {
  374. position: fixed;
  375. left: 0;
  376. bottom: 0;
  377. width: 100vw;
  378. height: 110rpx;
  379. padding-bottom: env(safe-area-inset-bottom);
  380. background: #FFFFFF;
  381. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  382. .btns {
  383. column-gap: 34rpx;
  384. }
  385. .btn {
  386. padding: 20rpx 90rpx;
  387. font-size: 28rpx;
  388. color: #FFFFFF;
  389. background: #4883F9;
  390. border-radius: 42rpx;
  391. &-share {
  392. background: #FFD019;
  393. }
  394. }
  395. }
  396. </style>