richDemo.vue 1.4 KB

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