Explorar o código

收藏和错题的模式更改2(防止部分极端情况)

JXDS18FUJT %!s(int64=2) %!d(string=hai) anos
pai
achega
2c441fa27f
Modificáronse 3 ficheiros con 7 adicións e 5 borrados
  1. 4 4
      src/views/collection/index.vue
  2. 2 0
      src/views/home/children/test/index.vue
  3. 1 1
      vite.config.ts

+ 4 - 4
src/views/collection/index.vue

@@ -143,7 +143,7 @@ const sendWrongSync = (column: { text: string; value: number }) => {
 						})
 						.then((res) => {
 							wrongList.value = res.data;
-							window.localStorage.setItem(userWrongKey, JSON.stringify(wrongList.value));
+							window.localStorage.setItem(userWrongKey, JSON.stringify(wrongList.value||[]));
 						});
 				});
 			break;
@@ -170,7 +170,7 @@ const sendWrongSync = (column: { text: string; value: number }) => {
 				})
 				.then((res) => {
 					wrongList.value = res.data;
-					window.localStorage.setItem(userWrongKey, JSON.stringify(wrongList.value));
+					window.localStorage.setItem(userWrongKey, JSON.stringify(wrongList.value||[]));
 				});
 			break;
 	}
@@ -197,7 +197,7 @@ const sendCollectSync = (column: { text: string; value: number }) => {
 						})
 						.then((res) => {
 							collectionList.value = res.data;
-							window.localStorage.setItem(userCollectKey, JSON.stringify(collectionList.value));
+							window.localStorage.setItem(userCollectKey, JSON.stringify(collectionList.value||[]));
 						});
 				});
 			break;
@@ -224,7 +224,7 @@ const sendCollectSync = (column: { text: string; value: number }) => {
 				})
 				.then((res) => {
 					collectionList.value = res.data;
-					window.localStorage.setItem(userCollectKey, JSON.stringify(collectionList.value));
+					window.localStorage.setItem(userCollectKey, JSON.stringify(collectionList.value||[]));
 				});
 			break;
 	}

+ 2 - 0
src/views/home/children/test/index.vue

@@ -39,6 +39,7 @@ import { Toast } from "vant";
 import { useRouter } from "vue-router";
 import { openApi } from "@/api/index";
 import wx from "weixin-js-sdk-ts";
+
 const store = useStore();
 const carTypeRef = ref<any>(null);
 const { createWxConfig } = useWxSign();
@@ -77,6 +78,7 @@ const carTypeChange = (e: string) => {
 	store.commit("setCatType", e);
 };
 onBeforeMount(() => {
+	useUpdateUserInfo()
 	// const router = useRouter();
 	// console.log(router.currentRoute.value);
 });

+ 1 - 1
vite.config.ts

@@ -36,7 +36,7 @@ export default defineConfig({
 				rewrite: (path) => path.replace(/^\/dev-api/, ""),
 			},
 			"/prod-api": {
-				target: "https://jpcj-admin.zzxcx.net/jpcj-admin",
+				target: "https://jpcj.zzxcx.net/jpcj-admin",
 				changeOrigin: true,
 				secure: false,
 				rewrite: (path) => path.replace(/^\/prod-api/, ""),