Browse Source

feat: 去除多余代码修正分页参数

whh 9 months ago
parent
commit
7e7a94b728

+ 4 - 4
package-lock.json

@@ -38,7 +38,7 @@
         "dayjs": "^1.11.11",
         "npm-run-all2": "^6.1.2",
         "postcss": "^8.4.38",
-        "tailwindcss": "^3.4.3",
+        "tailwindcss": "^3.4.4",
         "typescript": "~5.4.0",
         "vite": "^5.2.8",
         "vite-plugin-vue-devtools": "^7.0.25",
@@ -6733,9 +6733,9 @@
       }
     },
     "node_modules/tailwindcss": {
-      "version": "3.4.3",
-      "resolved": "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.4.3.tgz",
-      "integrity": "sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A==",
+      "version": "3.4.4",
+      "resolved": "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.4.4.tgz",
+      "integrity": "sha512-ZoyXOdJjISB7/BcLTR6SEsLgKtDStYyYZVLsUtWChO4Ps20CBad7lfJKVDiejocV4ME1hLmyY0WJE3hSDcmQ2A==",
       "dev": true,
       "dependencies": {
         "@alloc/quick-lru": "^5.2.0",

+ 1 - 1
package.json

@@ -42,7 +42,7 @@
     "dayjs": "^1.11.11",
     "npm-run-all2": "^6.1.2",
     "postcss": "^8.4.38",
-    "tailwindcss": "^3.4.3",
+    "tailwindcss": "^3.4.4",
     "typescript": "~5.4.0",
     "vite": "^5.2.8",
     "vite-plugin-vue-devtools": "^7.0.25",

+ 0 - 48
src/components/Chat/ChatBaseCard.vue

@@ -1,25 +1,7 @@
 <script setup>
-import { computed, unref } from 'vue';
-import { useMessage } from 'naive-ui';
-import { useClipboard } from '@vueuse/core'
-import MarkdownIt from 'markdown-it';
-import hljs from 'highlight.js';
-import mila from 'markdown-it-link-attributes';
-import mdKatex from 'markdown-it-katex';
-
 import { SvgIcon } from '@/components';
-import { chatApi } from "@/api/chat"
-
 
 const props = defineProps({
-  id: {
-    type: [String, Number],
-    default: ''
-  },
-  content: {
-    type: String,
-    default: ''
-  },
   loading: {
     type: Boolean,
     default: false
@@ -28,14 +10,6 @@ const props = defineProps({
     type: Boolean,
     default: false
   },
-  isSatisfied: {
-    type: Number,
-    default: 2
-  },
-  toggleVisibleIcons: {
-    type: Boolean,
-    default: false
-  },
   loadingText: {
     type: String,
     default: "内容生成中..."
@@ -88,27 +62,5 @@ const props = defineProps({
     background: #fff;
   }
 
-  .answer-btn-group {
-    @include flex(x, center, end);
-    padding-top: 6px;
-
-    .btn {
-      @include flex(x, center, center);
-      @include layout(28px, 28px, 4px);
-      color: #89909B;
-      cursor: pointer;
-
-      &:hover, &_active {
-        background: #DBEFFF;
-        color: #2454FF;
-      }
-    }
-
-    .line {
-      @include layout(1px, 12px, 0);
-      margin: 0 5px;
-      background: #D3D0E1;
-    }
-  }
 }
 </style>

+ 0 - 1
src/components/Chat/ChatText.vue

@@ -5,7 +5,6 @@ import hljs from 'highlight.js';
 import mila from 'markdown-it-link-attributes';
 import markdownItMath from 'markdown-it-math';
 import mdKatex from '@iktakahiro/markdown-it-katex';
-import mathjax from 'markdown-it-mathjax';
 
 const props = defineProps({
   content: {

+ 5 - 5
src/composables/useInfinite.js

@@ -2,14 +2,14 @@ import { ref, unref, onMounted, computed } from "vue";
 import { chatApi } from '@/api/chat';
 
 export const useInfinite = (path, props) => {
-  const pageParams = ref({ page: 1, pageSize: 20 });
+  const pageParams = ref({ pageNum: 1, pageSize: 20 });
 
   const recordList = ref([]);
   const isFetching = ref(false);
   const counter = ref(0);
   const noMore = ref(false);
 
-  const isMore = computed(() => pageParams.value.page * pageParams.value.pageSize < counter.value);
+  const isMore = computed(() => pageParams.value.pageNum * pageParams.value.pageSize < counter.value);
 
   const addHistoryRecord = record => {
     recordList.value.unshift(...record);
@@ -28,7 +28,7 @@ export const useInfinite = (path, props) => {
     counter.value = total;
 
     if (unref(isMore)) {
-      pageParams.value.page ++;
+      pageParams.value.pageNum ++;
     } else {
       noMore.value = true;
     }
@@ -37,7 +37,7 @@ export const useInfinite = (path, props) => {
   }
 
   const onReset = async () => {
-    const { rows, total } = await initRecordData({page:1, pageSize: (pageParams.value.page * pageParams.value.pageSize) + 1});
+    const { rows, total } = await initRecordData({pageNum:1, pageSize: (pageParams.value.page * pageParams.value.pageSize) + 1});
 
     recordList.value = rows;
     counter.value = total;
@@ -45,7 +45,7 @@ export const useInfinite = (path, props) => {
   }
 
   const onRestore = async (params) => {
-    pageParams.value = { page: 1, pageSize: 20 };
+    pageParams.value = { pageNum: 1, pageSize: 20 };
     const { rows, total } = await initRecordData(params);
     recordList.value = rows;
     counter.value = total;

+ 10 - 15
yarn.lock

@@ -364,10 +364,10 @@
   resolved "https://registry.npmmirror.com/@emotion/hash/-/hash-0.8.0.tgz"
   integrity sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==
 
-"@esbuild/darwin-x64@0.20.2":
+"@esbuild/win32-x64@0.20.2":
   version "0.20.2"
-  resolved "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz"
-  integrity sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==
+  resolved "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz"
+  integrity sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==
 
 "@iktakahiro/markdown-it-katex@^4.0.1":
   version "4.0.1"
@@ -465,10 +465,10 @@
     estree-walker "^2.0.2"
     picomatch "^2.3.1"
 
-"@rollup/rollup-darwin-x64@4.18.0":
+"@rollup/rollup-win32-x64-msvc@4.18.0":
   version "4.18.0"
-  resolved "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz"
-  integrity sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==
+  resolved "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz"
+  integrity sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==
 
 "@trysound/sax@0.2.0":
   version "0.2.0"
@@ -1799,11 +1799,6 @@ fs-extra@^11.2.0:
     jsonfile "^6.0.1"
     universalify "^2.0.0"
 
-fsevents@~2.3.2, fsevents@~2.3.3:
-  version "2.3.3"
-  resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz"
-  integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
-
 function-bind@^1.1.2:
   version "1.1.2"
   resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz"
@@ -3630,10 +3625,10 @@ svgo@^2.8.0:
     picocolors "^1.0.0"
     stable "^0.1.8"
 
-tailwindcss@^3.4.3:
-  version "3.4.3"
-  resolved "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.4.3.tgz"
-  integrity sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A==
+tailwindcss@^3.4.4:
+  version "3.4.4"
+  resolved "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.4.4.tgz"
+  integrity sha512-ZoyXOdJjISB7/BcLTR6SEsLgKtDStYyYZVLsUtWChO4Ps20CBad7lfJKVDiejocV4ME1hLmyY0WJE3hSDcmQ2A==
   dependencies:
     "@alloc/quick-lru" "^5.2.0"
     arg "^5.0.2"