richDemo.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view >
  3. <view class="pdf-container">
  4. <web-view
  5. v-if="pdfUrl"
  6. :src="pdfUrl"
  7. class="web-view"
  8. ></web-view>
  9. </view>
  10. <view>
  11. <mp-html :content="content" />
  12. </view>
  13. </view>
  14. </template>
  15. <script setup>
  16. import CryptoJS from 'crypto-js';
  17. import {
  18. toast
  19. } from "@/utils/common";
  20. import {
  21. onLoad
  22. } from "@dcloudio/uni-app";
  23. import {
  24. zhaoshengZhaopinInfo
  25. } from '@/api/login.js'
  26. import cacheManager from '@/utils/cacheManager.js'
  27. import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
  28. import {
  29. ref
  30. } from 'vue';
  31. const content = ref('')
  32. const pdfUrl = ref('')
  33. onLoad(() => {
  34. getZhaopinInfo()
  35. })
  36. function getZhaopinInfo() {
  37. zhaoshengZhaopinInfo({}).then(res => {
  38. console.log('res', res);
  39. content.value = res.data.content
  40. pdfUrl.value = res.data.pdfUrl
  41. })
  42. }
  43. </script>
  44. <style lang="scss">
  45. .lli-demo-page {
  46. display: flex;
  47. flex-direction: column;
  48. height: 100vh;
  49. padding-bottom: 60rpx;
  50. box-sizing: border-box;
  51. .demo-scroll-view {
  52. overflow-y: auto;
  53. flex: 1;
  54. }
  55. .content-view {
  56. padding: 24px;
  57. box-sizing: border-box;
  58. }
  59. .demo-title {
  60. margin: 24px 0 10px;
  61. }
  62. }
  63. .pdf-container {
  64. width: 100%;
  65. height: 500px; // 固定高度
  66. position: relative;
  67. overflow: hidden;
  68. border: 1px solid #eee;
  69. margin-top: 20px;
  70. .web-view {
  71. width: 100%;
  72. height: 100%;
  73. display: block;
  74. }
  75. }
  76. </style>