unityText.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. min-height: 10px;
  41. line-height: 24px;
  42. }
  43. .text .media-wrap {
  44. text-align: center;
  45. margin: 10px 0;
  46. }
  47. .text .media-wrap img {
  48. max-width: 100%;
  49. }
  50. .text::-webkit-scrollbar {
  51. /*滚动条整体样式*/
  52. width: 3px;
  53. /*高宽分别对应横竖滚动条的尺寸*/
  54. height: 1px;
  55. }
  56. .text::-webkit-scrollbar-thumb {
  57. /*滚动条里面小方块*/
  58. border-radius: 10px;
  59. -webkit-box-shadow: inset 0 0 5px transparent;
  60. background: #a64735;
  61. }
  62. .text::-webkit-scrollbar-track {
  63. /*滚动条里面轨道*/
  64. -webkit-box-shadow: inset 0 0 5px transparent;
  65. border-radius: 10px;
  66. background: transparent;
  67. }
  68. </style>
  69. <body>
  70. <div class="main">
  71. <div class="title"></div>
  72. <div class="text"></div>
  73. </div>
  74. </body>
  75. <script>
  76. // const baseUrl = 'https://sit-chaozhoubwg.4dage.com'
  77. const baseUrl = ''
  78. const urlAll = window.location.href
  79. if (urlAll.includes('?id=')) {
  80. const arr = urlAll.split('?id=')
  81. const id = arr[1] || ''
  82. if (id) {
  83. fetch(`${baseUrl}/api/show/questionnaire/detail/${id}`)
  84. .then(response => response.json())
  85. .then(data => {
  86. console.log(data)
  87. const titleDom = document.querySelector('.title')
  88. titleDom.innerHTML = data.data.name
  89. const textDom = document.querySelector('.text')
  90. textDom.innerHTML = data.data.description
  91. const titleHeight = titleDom.clientHeight
  92. const mainDom = document.querySelector('.main')
  93. const heightAll = mainDom.clientHeight
  94. textDom.style.height = heightAll - (titleHeight + 130) + 'px'
  95. });
  96. }
  97. }
  98. </script>
  99. </html>