hookehuyr

fix 提交表单成功后,把成功信息保存到缓冲避免URL太长的问题

1 <!-- 1 <!--
2 * @Date: 2022-07-18 10:22:22 2 * @Date: 2022-07-18 10:22:22
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-11-27 16:23:08 4 + * @LastEditTime: 2025-02-13 10:32:51
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -965,11 +965,13 @@ const successHandle = () => { // 表单成功提交后续操作 ...@@ -965,11 +965,13 @@ const successHandle = () => { // 表单成功提交后续操作
965 if (successInfo.value.commit_action === 'url') { 965 if (successInfo.value.commit_action === 'url') {
966 window.location.href = successInfo.value.commit_url; 966 window.location.href = successInfo.value.commit_url;
967 } else { 967 } else {
968 + // 把成功信息写进cookies
969 + Cookies.set(`form_${successInfo.value.id}_s_i`, JSON.stringify(successInfo.value));
968 // 跳转成功页面 970 // 跳转成功页面
969 $router.push({ 971 $router.push({
970 path: "/success", 972 path: "/success",
971 query: { 973 query: {
972 - successInfo: JSON.stringify(successInfo.value), 974 + successId: successInfo.value.id,
973 }, 975 },
974 }); 976 });
975 } 977 }
......
1 <!-- 1 <!--
2 * @Date: 2022-06-29 18:18:02 2 * @Date: 2022-06-29 18:18:02
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-16 16:46:34 4 + * @LastEditTime: 2025-02-13 10:32:22
5 * @FilePath: /data-table/src/views/success.vue 5 * @FilePath: /data-table/src/views/success.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -58,12 +58,13 @@ const styleObj = { ...@@ -58,12 +58,13 @@ const styleObj = {
58 const store = mainStore(); 58 const store = mainStore();
59 // const { successInfo } = storeToRefs(store); 59 // const { successInfo } = storeToRefs(store);
60 const successInfo = ref({}); 60 const successInfo = ref({});
61 +const successId = $route.query.successId;
61 62
62 const richText = '<div style="font-weight: bold;">123</div>' 63 const richText = '<div style="font-weight: bold;">123</div>'
63 64
64 onMounted(() => { 65 onMounted(() => {
65 $('body').css('backgroundColor', 'white'); 66 $('body').css('backgroundColor', 'white');
66 - successInfo.value = JSON.parse($route.query.successInfo) 67 + successInfo.value = Cookies.get(`form_${successId}_s_i`) ? JSON.parse(Cookies.get(`form_${successId}_s_i`)) : '';
67 }); 68 });
68 69
69 const handle = () => { 70 const handle = () => {
......