unityText.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. box-sizing: border-box;
  13. }
  14. html {
  15. background-color: transparent;
  16. }
  17. body {
  18. background-color: transparent;
  19. }
  20. .main {
  21. background-color: transparent;
  22. width: 100vw;
  23. height: 78vh;
  24. padding: 60px 40px 40px;
  25. }
  26. .title {
  27. font-weight: 700;
  28. font-size: 20px;
  29. line-height: 28px;
  30. text-align: center;
  31. margin-bottom: 30px;
  32. }
  33. .text {
  34. width: 100%;
  35. overflow-y: auto;
  36. }
  37. .text p {
  38. font-size: 14px;
  39. letter-spacing: 2px;
  40. margin-bottom: 10px;
  41. min-height: 10px;
  42. line-height: 24px;
  43. }
  44. .text .media-wrap {
  45. text-align: center;
  46. margin: 10px 0;
  47. }
  48. .text .media-wrap img {
  49. max-width: 100%;
  50. }
  51. .text::-webkit-scrollbar {
  52. /*滚动条整体样式*/
  53. width: 3px;
  54. /*高宽分别对应横竖滚动条的尺寸*/
  55. height: 1px;
  56. }
  57. .text::-webkit-scrollbar-thumb {
  58. /*滚动条里面小方块*/
  59. border-radius: 10px;
  60. -webkit-box-shadow: inset 0 0 5px transparent;
  61. background: #a64735;
  62. }
  63. .text::-webkit-scrollbar-track {
  64. /*滚动条里面轨道*/
  65. -webkit-box-shadow: inset 0 0 5px transparent;
  66. border-radius: 10px;
  67. background: transparent;
  68. }
  69. </style>
  70. <body>
  71. <div class="main">
  72. <div class="title"></div>
  73. <div class="text"></div>
  74. </div>
  75. </body>
  76. <script>
  77. // const baseUrl = 'https://sit-chaozhoubwg.4dage.com'
  78. const baseUrl = ''
  79. const urlAll = window.location.href
  80. if (urlAll.includes('?id=')) {
  81. const arr = urlAll.split('?id=')
  82. const id = arr[1] || ''
  83. if (id) {
  84. fetch(`${baseUrl}/api/show/questionnaire/detail/${id}`)
  85. .then(response => response.json())
  86. .then(data => {
  87. console.log(data)
  88. const titleDom = document.querySelector('.title')
  89. titleDom.innerHTML = data.data.name
  90. const textDom = document.querySelector('.text')
  91. textDom.innerHTML = data.data.description
  92. const titleHeight = titleDom.clientHeight
  93. const mainDom = document.querySelector('.main')
  94. const heightAll = mainDom.clientHeight
  95. textDom.style.height = heightAll - (titleHeight + 130) + 'px'
  96. });
  97. }
  98. }
  99. </script>
  100. </html>