zhengjinyi 1 年間 前
コミット
21f527c1c6

+ 2 - 2
.env.development

@@ -1,6 +1,6 @@
 VITE_ENV = 'development'
 
-VITE_BASE_URL = 'https://core-b.caimei365.com'
+VITE_BASE_URL = 'https://core.caimei365.com'
 
 VITE_BASE_HTTP = 'https://material-b.caimei365.com'
 
@@ -8,4 +8,4 @@ VITE_BASE_OSS = 'https://caimei-oss.oss-cn-shenzhen.aliyuncs.com/beta/archiveFil
 
 VITE_IMAGE_URL = 'https://static.caimei365.com/'
 
-VITE_HTTP_URL = 'http://120.79.25.27:8009'
+VITE_HTTP_URL = 'https://www.caimei365.com'

+ 3 - 3
src/App.vue

@@ -1,17 +1,17 @@
-<script setup lang="ts">
+<!--<script setup lang="ts">
 import { watch } from 'vue';
 import { useRoute } from 'vue-router';
 
 const route = useRoute()
 watch(() => route.query, () => {
-  if (!sessionStorage.getItem('isDetailRefresh') && route.fullPath !== '/login') {
+  if (!sessionStorage.getItem('isDetailRefresh') && route.fullPath !== '/login' && route.fullPath !== '/database/add') {
 		sessionStorage.setItem('isDetailRefresh', '1')
     window.location.reload()
 	}
 }, {
   immediate: true,
 })
-</script>
+</script>-->
 
 <template>
   <Suspense>

+ 11 - 15
src/Hooks/useCopyText.ts

@@ -1,23 +1,19 @@
 import { showNotify } from 'vant';
 import { statisticAddContext } from '@/api/context/context';
+import Clipboard from 'clipboard'
 
 const useCopyText = async (text: string, authorId: string) => {
     await statisticAddContext({ type: 1, authorId })
-    if (navigator.clipboard && navigator.clipboard.writeText) {
-        navigator.clipboard.writeText(text)
-            .then(() => {
-                showNotify('已成功复制!'); // 提示复制成功信息
-            })
-            .catch(() => {
-                const oInput = document.createElement('input');
-                oInput.value = text;
-                document.body.appendChild(oInput);
-                oInput.select(); // 选择对象
-                document.execCommand("Copy"); // 执行浏览器复制命令
-                document.body.removeChild(oInput);
-                showNotify('已成功复制!'); // 提示复制成功信息
-            }); 
-    }
+    const clipboard = new Clipboard('.copy', {
+          text: function () {
+            return text
+          }
+        })
+        clipboard.on('success', () => {
+          showNotify('已成功复制!'); // 提示复制成功信息
+          // 释放内存
+          clipboard.destroy()
+        })
 }
 
 export default useCopyText

+ 8 - 8
src/Hooks/useWeChatShare.ts

@@ -63,17 +63,16 @@ export const shareOptions: shareOptions[] = [
 const useWeChatShare = async (params: shareParams) => {
 	const isWeChat = () => /MicroMessenger/i.test(navigator.userAgent)
 	const linkParams =
-		import.meta.env.VITE_HTTP_URL +
-		(Number(params.type) === 7 ? '/encyclopedia/detail-' : '/info/detail-') +
-		params.id +
-		(Number(params.type) === 6 ? "-1.html" : ".html");
+		Number(params.type) === 7
+			? import.meta.env.VITE_HTTP_URL + '/encyclopedia/detail-' + params.id + '.html'
+			: import.meta.env.VITE_HTTP_URL + '/info/detail-' + params.id + '-1.html'
 	if (sessionStorage.getItem('isDetailRefresh')) {
 		sessionStorage.removeItem('isDetailRefresh')
 	}
 	if (!isWeChat()) return params.isShowToast && showToast('请在微信浏览器中分享')
 	const { data } = await getShareConfig({
 		appId: 'wx91c4152b60ca91a3',
-		url: location.href,
+		url: Number(params.type) > 5 ? import.meta.env.VITE_HTTP_URL : location.href,
 	})
 	console.log(data)
 	wx.config({
@@ -84,12 +83,13 @@ const useWeChatShare = async (params: shareParams) => {
 		signature: data?.signature!,
 		jsApiList: config.jsApiList,
 	})
-	const obj = shareOptions.filter((e) => e.type === params.type)[0] || {}
+	const obj = shareOptions.filter(e => e.type === params.type)[0] || {}
 	const link =
 		Number(params.type) < 5
 			? import.meta.env.VITE_BASE_HTTP +
-			`/preview?t=${params.type}&id=${params.id}&uid=${params.userId || ''}&suid=${params.suid || ''}&spId=${params.spId || ''
-			}`
+			  `/preview?t=${params.type}&id=${params.id}&uid=${params.userId || ''}&suid=${params.suid || ''}&spId=${
+					params.spId || ''
+			  }`
 			: linkParams
 	const shareConfig: wx.IonMenuShareAppMessage = {
 		title: obj.text,

+ 1 - 1
src/router/index.ts

@@ -25,7 +25,7 @@ router.beforeEach((to, _, next) => {
 	}
 	if (token) {
 		if (to.path === '/login') {
-			next('/database/index?t=0')
+			next('/database/index')
 			return
 		}
 		next()

+ 2 - 2
src/store/tab/tab.ts

@@ -7,7 +7,7 @@ export const useTabStore = defineStore('myTabStore', {
 		stageStatus: '',
 		productId: 0,
 		labelIds: '',
-		searchValue: '',
+		title: '',
 		allStatus: '1'
 	}),
 	actions: {
@@ -16,7 +16,7 @@ export const useTabStore = defineStore('myTabStore', {
 			this.type = step?.type!
 			this.productId = step?.productId
 			this.labelIds = step?.labelIds
-			this.searchValue = step?.searchValue!
+			this.title = step?.title!
 			this.allStatus = step?.allStatus!
 		}
 	},

+ 3 - 3
src/store/tab/tab.type.ts

@@ -2,10 +2,10 @@ import { IArchiveRequest } from "@/types/api/context.type"
 import { DFindParams, DScrollTab, IAllStatus } from "@/types/views/database.type"
 
 export type DTabStore = {
-	type: DFindParams<DScrollTab, 'type'>
+	type: DFindParams<DScrollTab, 'type'> | string
 	labelIds: DFindParams<IArchiveRequest, 'labelIds'>
 	stageStatus: DFindParams<IArchiveRequest, 'stageStatus'>
 	productId: DFindParams<IArchiveRequest, 'productId'>
-	searchValue: string
-	allStatus: DFindParams<IAllStatus, 'allStatus'>
+	title: string
+	allStatus?: DFindParams<IAllStatus, 'allStatus'>
 }

+ 1 - 1
src/types/views/database.type.ts

@@ -30,7 +30,7 @@ export type ChangeTabEmit = DFindParams<DScrollTab, 'type'>
 
 export type DetailParams = {
   id?: string,
-  type: ChangeTabEmit
+  type: ChangeTabEmit | string
   pageNum?: number
   content?: string
   index?: number

+ 2 - 0
src/views/Database/add.vue

@@ -44,6 +44,7 @@ import type { FormInstance, FormRules } from "element-plus";
 import { useRouter } from "vue-router";
 import { useUserInfoState } from "@/store/user/user";
 import { addAllStatusForm } from "@/api/context/context";
+import { showToast } from 'vant';
 const router = useRouter();
 const { serviceProviderId } = useUserInfoState()
 const formRef = ref<FormInstance>();
@@ -76,6 +77,7 @@ const onSubmit = (formEl: FormInstance | undefined) => {
       const data = await addAllStatusForm(formLabelAlign)
       if (data.code === 0) {
         router.back()
+        showToast('新增话术成功')
       }
     } else {
       console.log("error submit!", fields);

+ 4 - 3
src/views/Database/components/context-contain.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="box" :style="{paddingBottom: route.query.t === '5' ? '100px' : ''}">
+  <div class="box" :style="{paddingBottom: DType === '5' ? '100px' : ''}">
     <slot name="head" :data="props" />
     <div v-for="(d, i) in dataList" :key="i">
       <div class="shareFile">
@@ -36,9 +36,10 @@
 import { DDataBaseListAll, DEmit } from "@/types/views/database.type";
 import FileContent from "./file-content.vue";
 import { ref, computed } from 'vue';
-import { useRouter, useRoute } from 'vue-router'
+import { useRouter } from 'vue-router'
+import { useTabStore } from '@/store/tab/tab';
+const { type: DType } = useTabStore()
 const router = useRouter()
-const route = useRoute()
 const pageNum = ref<number>(1);
 const emit = defineEmits<DEmit>();
 

+ 12 - 16
src/views/Database/components/context-head.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <div class="title" v-if="route.query.t === '0'">{{ controlText }}</div>
+    <div class="title" v-if="type !== '0'">{{ controlText }}</div>
     <div v-if="type === '5'" class="enterprise">
       <van-tabs v-model:active="form.allStatus" shrink>
         <van-tab
@@ -23,38 +23,34 @@ import {
   tabList,
   allStatusList,
 } from "@/types/views/database.type";
-import { ref, computed, watch } from 'vue';
+import { ref, computed, watch, toRefs } from 'vue';
 import { DTabStore } from "@/store/tab/tab.type";
-import { useRoute } from "vue-router";
-const route = useRoute();
+import { useTabStore } from '@/store/tab/tab';
+
 const props = defineProps<{
-  type: ChangeTabEmit
+  type: ChangeTabEmit | string
   index: number
 }>();
+const { type: Dtype } = toRefs(useTabStore())
 const form = ref<Pick<DTabStore, 'type'> & Pick<DTabStore, 'allStatus'>>({
-  type: route.query.t as ChangeTabEmit,
+  type: props.type,
   allStatus: "1",
 });
 const emit = defineEmits<DEmit>();
-watch(
-  () => route.query,
-  () => {
-    form.value.allStatus = '1'
-  },
-  {
-    deep: true,
-  }
-);
 watch(
   () => form.value.allStatus,
   () => {
     emit("handle-all-status", { type: props.type, allStatus: form.value.allStatus, index: props.index });
   }
 );
-
+watch(() => Dtype.value, (val) => {
+  console.log('tab变化', val)
+  form.value.allStatus = '1'
+})
 const controlText = computed<DFindParams<DScrollTab, "text">>(
   () => tabList.filter((e) => e.type === props.type)[0].text
 );
+console.log(props.type, controlText.value)
 </script>
 
 <style scoped lang="scss">

+ 2 - 20
src/views/Database/components/context-share.vue

@@ -1,7 +1,6 @@
 <template>
   <div class="share" v-if="type === '5'">
-    <!--<div class="show" @click.stop="useCopyText(props.content!, props.id!)">复制话术内容</div>-->
-    <el-button class="show copy" type="text" @click="handleCopy(props.content!, props.id!)">复制话术内容</el-button>
+    <el-button class="show copy" type="text" @click="useCopyText(props.content!, props.id!)">复制话术内容</el-button>
     <div class="showNum" v-if="allStatus === 1">已使用:{{ props.pv || 0 }}次</div>
   </div>
   <div class="share" v-else>
@@ -22,7 +21,6 @@
 </template>
 
 <script setup lang="ts">
-import Clipboard from 'clipboard'
 import { DArchiveResultData } from "@/types/api/context.type";
 import { DFindParams, DScrollTab, tabList } from "@/types/views/database.type";
 import { computed } from "vue";
@@ -31,8 +29,7 @@ import { useRouter } from "vue-router";
 import useWeChatShare from "@/Hooks/useWeChatShare";
 import { useUserInfoState } from "@/store/user/user";
 import getFileImg from "@/Hooks/useFileImage";
-import { statisticAddContext } from "@/api/context/context";
-import { showNotify } from 'vant';
+import useCopyText from '@/Hooks/useCopyText';
 
 const props = defineProps<DArchiveResultData>();
 const { serviceProviderId, userId } = useUserInfoState();
@@ -42,7 +39,6 @@ const imageLink = computed<string>(() => {
   if (props.type !== "3") return props.image as string;
   else return getFileImg(props.waters![0] && props.waters![0].split('?')[0]).img as string;
 });
-console.log(imageLink.value)
 const controlText = computed<DFindParams<DScrollTab, "text">>(
   () => tabList.filter((e) => e.type === props.type)[0].text
 );
@@ -57,20 +53,6 @@ const handleDetail = ($event: DArchiveResultData) => {
   router.push("/database/detail?id=" + $event.id + "&t=" + $event.type);
   console.log($event.type);
 };
-
-const handleCopy = async (content: string, authorId: string) => {
-  await statisticAddContext({ type: 1, authorId })
-  const clipboard = new Clipboard('.copy', {
-        text: function () {
-          return content
-        }
-      })
-      clipboard.on('success', () => {
-        showNotify('已成功复制!'); // 提示复制成功信息
-        // 释放内存
-        clipboard.destroy()
-      })
-}
 </script>
 
 <style scoped lang="scss">

+ 2 - 1
src/views/Database/components/high-light-text.vue

@@ -10,11 +10,12 @@
 </template>
 
 <script setup lang="ts">
-defineProps<{
+const props = defineProps<{
   keywords: string;
   text: string;
   isTitle: boolean;
 }>();
+console.log(props)
 </script>
 
 <style scoped lang="scss">

+ 6 - 4
src/views/Database/components/scroll-tap-btn.vue

@@ -6,7 +6,7 @@
         :key="i.type"
         :label="i.text"
         @handle-emit="handleChangeTab(i)"
-        :class="route.query.t === i.type ? 'active' : ''"
+        :class="type === i.type ? 'active' : ''"
         backgroundColor="#fff"
         color="#666666"
       />
@@ -16,9 +16,11 @@
 
 <script setup lang="ts">
 import { DScrollTab, DEmit, tabList } from '@/types/views/database.type';
-import { useRoute } from 'vue-router';
-
-const route = useRoute()
+//import { useRoute } from 'vue-router';
+import { useTabStore } from "@/store/tab/tab";
+import { toRefs } from 'vue';
+//const route = useRoute()
+const { type } = toRefs(useTabStore());
 
 const emit = defineEmits<DEmit>()
 const handleChangeTab = (event: DScrollTab): void => {

+ 2 - 2
src/views/Database/components/search-head.vue

@@ -92,7 +92,7 @@ import { getLabelKeyList, getStoreList } from "@/api/context/context";
 import { CheckboxInstance, showToast, DropdownMenuInstance } from "vant";
 import { ILabelKeyRequest, IStoreRequest } from "@/types/api/context.type";
 import { useTabStore } from "@/store/tab/tab";
-const { searchValue, labelIds } = useTabStore();
+const { title, labelIds } = useTabStore();
 const activePadding = ref<string>("20vw 1vw 1vw 1vw"); // vue 样式
 const handleOpen = (val: number) => {
   activePadding.value = val < 2 ? "20vw 1vw 1vw 1vw" : "5vw 1vw 1vw 1vw";
@@ -107,7 +107,7 @@ const labelKeyParams = ref<ILabelKeyRequest>({
   pageSize: 10,
   v: "",
 }); // 搜索条件
-const value = ref<string>(searchValue || ""); // 标题搜索
+const value = ref<string>(title || ""); // 标题搜索
 const checked = ref<Array<number | null>>(
   labelIds?.split(",").map((e) => Number(e)) || []
 ); // 默认选中 多选

+ 3 - 3
src/views/Database/components/text-file-content.vue

@@ -5,9 +5,9 @@
       <van-image fit="contain" :src="getFileImg(props?.waters![0].split('?')[0] as string).img" v-else />
     </div>
     <div class="title">
-      <div class="t1"><high-light-text v-if="title" :keywords="searchValue" :text="title!" :is-title="true"/></div>
+      <div class="t1"><high-light-text v-if="title" :keywords="DTitle || ''" :text="title!" :is-title="true"/></div>
       <div class="t2" v-if="!showFileContent()">
-        <high-light-text v-if="content" :keywords="searchValue" :text="content!" :is-title="false"/>
+        <high-light-text v-if="content" :keywords="DTitle || ''" :text="content!" :is-title="false"/>
       </div>
     </div>
   </div>
@@ -20,7 +20,7 @@ import { useTabStore } from "@/store/tab/tab";
 import { toRefs, computed } from 'vue';
 import getFileImg from "@/Hooks/useFileImage";
 
-const { searchValue } = toRefs(useTabStore());
+const { title: DTitle } = toRefs(useTabStore());
 const props = defineProps<DArchiveResultData>();
 
 const showFileContent = (): boolean => ["3", "6"].indexOf(props.type as string) !== -1;

+ 2 - 2
src/views/Database/components/video-img-content.vue

@@ -3,7 +3,7 @@
     <div class="text-title">
       <high-light-text
         v-if="props.title"
-        :keywords="searchValue"
+        :keywords="DTitle || ''"
         :text="props.title!"
         :is-title="true"
       />
@@ -27,7 +27,7 @@ import highLightText from "./high-light-text.vue";
 import { DArchiveResultData } from "@/types/api/context.type";
 import { toRefs, computed } from "vue";
 import ImageContent from "./image-content.vue";
-const { searchValue } = toRefs(useTabStore());
+const { title: DTitle } = toRefs(useTabStore());
 
 const props = defineProps<DArchiveResultData>();
 

+ 36 - 67
src/views/Database/data-all/index.vue

@@ -4,7 +4,7 @@
       :type="data.type"
       :data-list="data.dataList"
       :show-more="data.showMore"
-      v-if="data.type !== '0' && isShowType(data)"
+      v-if="isShowType(data) && data.type !== '0'"
       :index="i"
       @handle-see-more="handleSeeMore"
     >
@@ -24,9 +24,9 @@
       </template>
     </context-contain>
   </div>
-  <div class="bottom-btn" v-if="reqParams.type === '5' && isAddStatus">
+  <div class="bottom-btn" v-if="reqParams!.type! === '5' && isAddStatus">
     <data-button
-      @handle-emit="router.push('/database/add')"
+      @handle-emit="bindRouter"
       backgroundColor="#FF5B00"
       color="#FFFFFF"
       label="添加话术"
@@ -35,46 +35,33 @@
 </template>
 
 <script setup lang="ts">
-import { computed, ref, watch, onMounted } from "vue";
+import { ref, watch } from "vue";
 import contextContain from "../components/context-contain.vue";
 import { DDataBaseListAll, DetailParams, tabList } from "@/types/views/database.type";
 import contextHead from "../components/context-head.vue";
 import contextShare from "../components/context-share.vue";
-import { useRouter, useRoute, LocationQueryValue } from "vue-router";
 import { getArchiveList } from "@/api/context/context";
-import { IArchiveRequest } from "@/types/api/context.type";
 import { useUserInfoState } from "@/store/user/user";
 import { myDecrypt } from "@/util/authStorage";
-import useWeChatShare from "@/Hooks/useWeChatShare";
-
+//import useWeChatShare from "@/Hooks/useWeChatShare";
+import { DTabStore } from "@/store/tab/tab.type";
+import { useTabStore } from '@/store/tab/tab';
 const { userId } = useUserInfoState();
-const router = useRouter();
-const route = useRoute();
+const { allStatus } = useTabStore()
+const bindRouter = () => window.location.href = '/database/add'
 const dataList = ref<DDataBaseListAll[] | null>(null);
-const routeQuery = (str: LocationQueryValue | LocationQueryValue[]) =>
-  str === "0" ? "" : str;
-const reqParams = computed<IArchiveRequest>(
-  () =>
-    ({
-      type: routeQuery(route.query.t),
-      title: route.query.sv,
-      productId: routeQuery(route.query.pId),
-      labelIds: routeQuery(route.query.lId),
-      stageStatus: routeQuery(route.query.ss),
-      spId: "",
-      userId: userId,
-    } as IArchiveRequest)
-);
+const props = defineProps<DTabStore>()
+const reqParams = ref<Record<string, any>>()
 const isAddStatus = ref<boolean>(false);
 const isEmpty = ref<boolean>(false);
 const isShowType = (data: DDataBaseListAll): boolean => {
-  if (routeQuery(route.query.t) !== "") {
-    return routeQuery(route.query.t) === data.type;
+  if (reqParams.value!.type !== "") {
+    return reqParams.value!.type === data.type;
   } else {
     return true;
   }
 };
-const formParams = ref({ allStatus: "1" });
+const formParams = ref({ allStatus, userId: userId as string });
 const reqArchiveList = async (res?: DetailParams) => {
   if (!res) {
     const { data } = await getArchiveList({ ...reqParams.value, ...formParams.value });
@@ -89,7 +76,7 @@ const reqArchiveList = async (res?: DetailParams) => {
     }));
     isEmpty.value = data?.length === 0;
   } else {
-    const { data } = await getArchiveList({ ...reqParams.value, ...res! });
+    const { data } = await getArchiveList({ ...reqParams.value, ...formParams.value, ...res! });
     const DcreptoList = data?.map((e) => ({
       ...e,
       waters: myDecrypt(e.waters! as string[]),
@@ -102,39 +89,31 @@ const reqArchiveList = async (res?: DetailParams) => {
       ...DcreptoList!,
     ];
     isEmpty.value =
-      dataList.value![res.index!]!.dataList.length === 0 && reqParams.value.type !== "";
+      dataList.value![res.index!]!.dataList.length === 0;
     dataList.value![res.index!]!.showMore = res.pageNum! > 1 && data?.length! < 5;
   }
 };
-const isSearch = () => {
-  if (route.query.t !== '0') {
-    return true
-  }
-  if (
-    (route.query.lId !== "0" && route.query.lId !== "") ||
-    route.query.sv !== "" ||
-    (route.query.pId !== "0" && route.query.pId !== "") ||
-    (route.query.ss !== "0" && route.query.ss !== "")
-  ) {
-    return true;
+
+const valueChange = (form: Record<string, any>): Record<string, any> => {
+  const f: Record<string, any> = {}
+  for (const key in form) {
+    f[key] = (form[key] === '0' || form[key] === 0) ? '' : form[key]; 
   }
-};
-watch(
-  () => route.query,
-  () => {
-    console.log("路由变化", route);
-    if (route.path === "/database/index" && isSearch()) {
-      formParams.value.allStatus = "1";
-      reqArchiveList();
-    } else {
-      dataList.value = []
-    }
-  },
-  {
-    immediate: true,
+  console.log(f);
+  return f
+}
+watch(() => props, (val) => {
+  reqParams.value = valueChange(val)
+  formParams.value.allStatus = '1'
+  if (Object.values(reqParams.value).some(e => !!e && e !== '')) {
+    reqArchiveList()
+  } else {
+    dataList.value = []
   }
-);
-
+}, {
+  immediate: true,
+  deep: true,
+})
 const handleSeeMore = ($event: DetailParams) => {
   console.log("查看更多", $event.index);
   reqArchiveList($event);
@@ -143,18 +122,8 @@ const handleAllStatus = ($event: DetailParams) => {
   console.log("改变成企业", $event);
   formParams.value.allStatus = $event.allStatus!;
   reqArchiveList($event);
-  isAddStatus.value = $event.allStatus === "2";
+  isAddStatus.value = formParams.value.allStatus === "2";
 };
-onMounted(() => {
-  useWeChatShare({
-    type: '3',
-    id: '1',
-    imageUrl: '',
-    spId: 0,
-    isShowToast: false,
-    suid: 0,
-  });
-})
 </script>
 
 <style lang="scss" scoped>

+ 6 - 19
src/views/Database/detail.vue

@@ -23,8 +23,7 @@
     <p class="foot-mark">{{ form?.keywords?.split(',').join('、') }}</p>
     <div class="data-btn">
       <data-button @handle-emit="handleClick" backgroundColor="#FFF" color="#FF5B00" label="查看文件" v-if="type === '3'" />
-      <data-button @handle-emit="handleCopy(form!.content!, form!.id!)" backgroundColor="#FFF" color="#FF5B00"
-        label="复制文本" v-if="type === '5'" />
+      <van-button @click="useCopyText(form!.content!, form!.id!)" class="copy" v-if="type === '5'" plain>复制文本</van-button>
       <data-button @handle-emit="
         useWeChatShare({
           type: form?.type!,
@@ -40,7 +39,6 @@
 </template>
 
 <script setup lang="ts">
-//import useCopyText from '@/Hooks/useCopyText'
 import useWeChatShare from '@/Hooks/useWeChatShare'
 import ImageContent from './components/image-content.vue'
 import { getArchiveFormDetails } from '@/api/context/context'
@@ -51,9 +49,7 @@ import { useRoute, useRouter } from 'vue-router'
 import getFileImg from '@/Hooks/useFileImage'
 import { useUserInfoState } from '@/store/user/user'
 import { myDecrypt } from '@/util/authStorage'
-import Clipboard from 'clipboard'
-import { statisticAddContext } from "@/api/context/context";
-import { showNotify } from 'vant';
+import useCopyText from '@/Hooks/useCopyText';
 
 const route = useRoute()
 const router = useRouter()
@@ -84,19 +80,6 @@ const getArchiveForm = async () => {
 const move = () => {
   document.body.style.position = 'static'
 }
-const handleCopy = async (content: string, authorId: string) => {
-  await statisticAddContext({ type: 1, authorId })
-  const clipboard = new Clipboard('.copy', {
-        text: function () {
-          return content
-        }
-      })
-      clipboard.on('success', () => {
-        showNotify('已成功复制!'); // 提示复制成功信息
-        // 释放内存
-        clipboard.destroy()
-      })
-}
 onActivated(() => {
   getArchiveForm()
   move()
@@ -183,4 +166,8 @@ onActivated(() => {
     margin-bottom: 12px;
   }
 }
+.copy {
+  width: 100%;
+  color: $basicColor;
+}
 </style>

+ 20 - 25
src/views/Database/index.vue

@@ -4,7 +4,14 @@
     <scroll-tap-btn @handle-tab-emit="handleTabEmit" />
   </div>
   <div class="container">
-    <router-view />
+    <data-all
+      :type="(form.type! as ChangeTabEmit)"
+      :label-ids="form.labelIds"
+      :product-id="form.productId"
+      :stage-status="form.stageStatus"
+      :title="form.title"
+      :all-status="form.allStatus"
+    />
   </div>
 </template>
 
@@ -16,45 +23,33 @@ import type {
   SearchEmitParams,
   ChangeEmitParams,
   DScrollTab,
+  ChangeTabEmit,
 } from "@/types/views/database.type";
-import { ref, toRefs } from 'vue';
-import { useRouter } from "vue-router";
+import { ref, toRefs } from "vue";
 import { DTabStore } from "@/store/tab/tab.type";
-const { type } = toRefs(useTabStore());
+import DataAll from "./data-all/index.vue";
+const { type, labelIds, productId, title, stageStatus } = toRefs(useTabStore());
 const { updatedTabStore } = useTabStore();
-const router = useRouter();
 
 const form = ref<DTabStore>({
-  labelIds: '',
-  productId: '',
-  stageStatus: '',
+  labelIds: labelIds.value,
+  productId: productId.value,
+  stageStatus: stageStatus.value,
   type: type.value,
-  searchValue: '',
-  allStatus: "1",
+  title: title.value,
 });
-
-const routerLink = () => {
-  router.push(
-    `/database/index?t=${form.value.type || "0"}&lId=${form.value.labelIds || ""}&sv=${
-      form.value.searchValue || ""
-    }&pId=${form.value.productId || ""}&ss=${form.value.stageStatus || ""}`
-  );
-};
 const handleSearch = (event: SearchEmitParams) => {
-  form.value = { ...form.value, ...{ searchValue: event } }
+  form.value = { ...form.value, ...{ title: event } };
   updatedTabStore(form.value);
-  routerLink();
 };
 const handleChange = (event: ChangeEmitParams) => {
-  form.value = { ...form.value, ...event }
+  form.value = { ...form.value, ...event };
   updatedTabStore(form.value);
-  routerLink();
 };
 const handleTabEmit = (event: DScrollTab): void => {
-  console.log('tab', event)
-  form.value = { ...form.value, ...event }
+  console.log("tab", event);
+  form.value = { ...form.value, ...event };
   updatedTabStore(form.value);
-  routerLink();
 };
 </script>
 

+ 1 - 1
src/views/Login/index.vue

@@ -60,7 +60,7 @@ const onSubmit = async () => {
     console.log(data);
     if (code === 0) {
       showLoadingToast(msg!);
-      window.location.href = '/database/index?t=0&lId=&sv=&pId=&ss='
+      window.location.href = '/database/index'
     } else {
       showLoadingToast(msg!);
     }