shaogen1995 1 年之前
父節點
當前提交
ec61ba4f08
共有 2 個文件被更改,包括 131 次插入7 次删除
  1. 124 0
      public/unityText.html
  2. 7 7
      src/pages/A6_1ques/A6Qtopic/QTadd.tsx

+ 124 - 0
public/unityText.html

@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html lang="zh">
+
+<head>
+  <meta charset="UTF-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title>Document</title>
+</head>
+<style>
+  * {
+    margin: 0;
+    padding: 0;
+    box-sizing: border-box;
+  }
+
+  html {
+    background-color: transparent;
+  }
+
+  body {
+    background-color: transparent;
+  }
+
+  .main {
+    background-color: transparent;
+    width: 100vw;
+    height: 78vh;
+    padding: 60px 40px 40px;
+  }
+
+  .title {
+    font-weight: 700;
+    font-size: 20px;
+    line-height: 28px;
+    text-align: center;
+    margin-bottom: 30px;
+  }
+
+  .text {
+    width: 100%;
+    overflow-y: auto;
+  }
+
+  .text p {
+    font-size: 14px;
+    letter-spacing: 2px;
+    margin-bottom: 10px;
+    min-height: 10px;
+    line-height: 24px;
+  }
+
+  .text .media-wrap {
+    text-align: center;
+    margin: 10px 0;
+  }
+
+  .text .media-wrap img {
+    max-width: 100%;
+  }
+
+  .text::-webkit-scrollbar {
+    /*滚动条整体样式*/
+    width: 3px;
+    /*高宽分别对应横竖滚动条的尺寸*/
+    height: 1px;
+  }
+
+  .text::-webkit-scrollbar-thumb {
+    /*滚动条里面小方块*/
+    border-radius: 10px;
+    -webkit-box-shadow: inset 0 0 5px transparent;
+    background: #a64735;
+  }
+
+  .text::-webkit-scrollbar-track {
+    /*滚动条里面轨道*/
+    -webkit-box-shadow: inset 0 0 5px transparent;
+    border-radius: 10px;
+    background: transparent;
+  }
+</style>
+
+<body>
+  <div class="main">
+    <div class="title"></div>
+    <div class="text"></div>
+
+  </div>
+</body>
+
+<script>
+  // const baseUrl = 'https://sit-chaozhoubwg.4dage.com'
+  const baseUrl = ''
+  const urlAll = window.location.href
+  if (urlAll.includes('?id=')) {
+    const arr = urlAll.split('?id=')
+    const id = arr[1] || ''
+    if (id) {
+      fetch(`${baseUrl}/api/show/questionnaire/detail/${id}`)
+        .then(response => response.json())
+        .then(data => {
+          console.log(data)
+
+          const titleDom = document.querySelector('.title')
+          titleDom.innerHTML = data.data.name
+
+          const textDom = document.querySelector('.text')
+          textDom.innerHTML = data.data.description
+
+          const titleHeight = titleDom.clientHeight
+
+          const mainDom = document.querySelector('.main')
+
+          const heightAll = mainDom.clientHeight
+
+          textDom.style.height = heightAll - (titleHeight + 130) + 'px'
+        });
+    }
+  }
+
+
+</script>
+
+</html>

+ 7 - 7
src/pages/A6_1ques/A6Qtopic/QTadd.tsx

@@ -92,9 +92,9 @@ function QTadd({ moInfo, closeFu, tableLen, upTableFu, fatherId }: Props) {
   // 题目的数组
   const [list, setList] = useState<A6QListType[]>([]);
 
-  useEffect(() => {
-    console.log("------", list);
-  }, [list]);
+  // useEffect(() => {
+  //   console.log("------", list);
+  // }, [list]);
 
   // 点击新增题目
   const addListFu = useCallback(
@@ -106,15 +106,15 @@ function QTadd({ moInfo, closeFu, tableLen, upTableFu, fatherId }: Props) {
         setList([
           ...list,
           {
-            id: Date.now() - 1000,
+            id: Date.now(),
             name: "",
             type: "单选",
             skip: "不需要",
             custom: false,
             num: 1,
             sList: [
-              { id: Date.now() - 900, txt: "", skip2: false, num2: 1 },
-              { id: Date.now() - 800, txt: "", skip2: false, num2: 1 },
+              { id: Date.now() - 100, txt: "", skip2: false, num2: 1 },
+              { id: Date.now() - 200, txt: "", skip2: false, num2: 1 },
             ],
           },
         ]);
@@ -127,7 +127,7 @@ function QTadd({ moInfo, closeFu, tableLen, upTableFu, fatherId }: Props) {
                 ? [
                     ...v.sList,
                     {
-                      id: Date.now() - 700 - i * 10,
+                      id: Date.now() - 300 - i * 10,
                       txt: "",
                       skip2: false,
                       num2: 1,