hookehuyr

✨ feat(提交成功反馈页面): 联调API接口

1 /* 1 /*
2 * @Date: 2022-04-18 15:59:42 2 * @Date: 2022-04-18 15:59:42
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-12-06 11:24:58 4 + * @LastEditTime: 2023-02-16 10:01:56
5 * @FilePath: /data-table/src/store/index.js 5 * @FilePath: /data-table/src/store/index.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -25,6 +25,7 @@ export const mainStore = defineStore('main', { ...@@ -25,6 +25,7 @@ export const mainStore = defineStore('main', {
25 keepPages: ['default'], // 很坑爹,空值全部都缓存 25 keepPages: ['default'], // 很坑爹,空值全部都缓存
26 fieldName: '', 26 fieldName: '',
27 formSetting: {}, // 表单数据收集设置 27 formSetting: {}, // 表单数据收集设置
28 + successInfo: {}, // 表单提交返回值
28 }; 29 };
29 }, 30 },
30 getters: { 31 getters: {
...@@ -76,5 +77,8 @@ export const mainStore = defineStore('main', { ...@@ -76,5 +77,8 @@ export const mainStore = defineStore('main', {
76 changeFormSetting (v) { 77 changeFormSetting (v) {
77 this.formSetting = v; 78 this.formSetting = v;
78 }, 79 },
80 + changeSuccessInfo (v) {
81 + this.successInfo = v;
82 + },
79 }, 83 },
80 }); 84 });
......
1 /* 1 /*
2 * @Date: 2022-04-18 15:59:42 2 * @Date: 2022-04-18 15:59:42
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-02-09 16:48:05 4 + * @LastEditTime: 2023-02-15 18:20:03
5 * @FilePath: /data-table/src/utils/tools.js 5 * @FilePath: /data-table/src/utils/tools.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -101,7 +101,10 @@ const changeURLArg = (url, arg, arg_val) => { ...@@ -101,7 +101,10 @@ const changeURLArg = (url, arg, arg_val) => {
101 return url + '\n' + arg + '\n' + arg_val; 101 return url + '\n' + arg + '\n' + arg_val;
102 } 102 }
103 103
104 +// 获取参数key/value值对
104 const getUrlParams = (url) => { 105 const getUrlParams = (url) => {
106 + // 没有参数处理
107 + if (url.split('?').length === 1) return false;
105 let arr = url.split('?'); 108 let arr = url.split('?');
106 let res = arr[1].split('&'); 109 let res = arr[1].split('&');
107 let items = {}; 110 let items = {};
......
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: 2023-02-10 18:01:13 4 + * @LastEditTime: 2023-02-16 10:18:37
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -471,9 +471,17 @@ const onSubmit = async (values) => { ...@@ -471,9 +471,17 @@ const onSubmit = async (values) => {
471 }); 471 });
472 if (result.code) { 472 if (result.code) {
473 showSuccessToast("提交成功"); 473 showSuccessToast("提交成功");
474 - $router.push({ 474 + // 缓存表单返回值
475 - path: "/success", 475 + store.changeSuccessInfo(result.data);
476 - }); 476 + // 如果类型为跳转网页
477 + if (result.data.commit_action === 'url') {
478 + window.location.href = result.data.commit_url;
479 + } else {
480 + // 跳转成功页面
481 + $router.push({
482 + path: "/success",
483 + });
484 + }
477 } 485 }
478 } else { 486 } else {
479 console.warn(validOther().key + "不通过验证"); 487 console.warn(validOther().key + "不通过验证");
......
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: 2022-06-29 18:18:09 4 + * @LastEditTime: 2023-02-16 10:20:19
5 - * @FilePath: /tswj/src/views/test/404.vue 5 + * @FilePath: /data-table/src/views/success.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
9 <div class="success-page"> 9 <div class="success-page">
10 - <div style="padding-top: 2rem; padding-bottom: 2rem; text-align: center"> 10 + <div v-if="successInfo.commit_text_type === 'default'" class="text-wrapper">
11 <van-image 11 <van-image
12 round 12 round
13 width="10rem" 13 width="10rem"
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
15 style="vertical-align: bottom" 15 style="vertical-align: bottom"
16 :src="icon_success" 16 :src="icon_success"
17 /> 17 />
18 - <p style="font-size: 1.05rem; margin: 0.5rem; font-weight: bold">提交成功!</p> 18 + <p class="name">{{ successInfo.form_name }}</p>
19 - <!-- <p style="font-size: 0.9rem; margin-bottom: 0.5rem">您的作品正在审核中</p> --> 19 + <p class="text">{{ successInfo.commit_text }}</p>
20 - <!-- <p style="font-size: 0.9rem">请耐心等待~~</p> -->
21 </div> 20 </div>
22 - <div style="padding: 0 15% 1rem 15%"> 21 + <div v-else class="rich-text" v-html="successInfo.commit_text" />
22 + <!-- <div style="padding: 0 15% 1rem 15%">
23 <div class="button-plain" :style="styleObj" @click="handle">返回</div> 23 <div class="button-plain" :style="styleObj" @click="handle">返回</div>
24 - </div> 24 + </div> -->
25 </div> 25 </div>
26 </template> 26 </template>
27 27
...@@ -54,7 +54,16 @@ const styleObj = { ...@@ -54,7 +54,16 @@ const styleObj = {
54 color: "#FFFFFF", 54 color: "#FFFFFF",
55 }; 55 };
56 56
57 -onMounted(() => {}); 57 +// 获取成功返回信息
58 +const store = mainStore();
59 +const { successInfo } = storeToRefs(store);
60 +
61 +const richText = '<div style="font-weight: bold;">123</div>'
62 +
63 +onMounted(() => {
64 + $('body').css('backgroundColor', 'white');
65 + console.warn(successInfo.value);
66 +});
58 67
59 const handle = () => { 68 const handle = () => {
60 $router.go(-1); 69 $router.go(-1);
...@@ -63,6 +72,25 @@ const handle = () => { ...@@ -63,6 +72,25 @@ const handle = () => {
63 72
64 <style lang="less" scoped> 73 <style lang="less" scoped>
65 .success-page { 74 .success-page {
75 + .text-wrapper {
76 + padding-top: 2rem;
77 + padding-bottom: 2rem;
78 + text-align: center;
79 + .name {
80 + font-size: 1.25rem;
81 + margin: 0.5rem;
82 + font-weight: bold;
83 + }
84 + .text {
85 + font-size: 1.05rem;
86 + margin: 0.5rem;
87 + font-weight: bold;
88 + }
89 + }
90 + .rich-text {
91 + padding: 1rem 2rem;
92 + white-space: pre-wrap;
93 + }
66 .button-plain { 94 .button-plain {
67 width: auto; 95 width: auto;
68 height: auto; 96 height: auto;
......