hookehuyr

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

/*
* @Date: 2022-04-18 15:59:42
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-12-06 11:24:58
* @LastEditTime: 2023-02-16 10:01:56
* @FilePath: /data-table/src/store/index.js
* @Description: 文件描述
*/
......@@ -25,6 +25,7 @@ export const mainStore = defineStore('main', {
keepPages: ['default'], // 很坑爹,空值全部都缓存
fieldName: '',
formSetting: {}, // 表单数据收集设置
successInfo: {}, // 表单提交返回值
};
},
getters: {
......@@ -76,5 +77,8 @@ export const mainStore = defineStore('main', {
changeFormSetting (v) {
this.formSetting = v;
},
changeSuccessInfo (v) {
this.successInfo = v;
},
},
});
......
/*
* @Date: 2022-04-18 15:59:42
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-02-09 16:48:05
* @LastEditTime: 2023-02-15 18:20:03
* @FilePath: /data-table/src/utils/tools.js
* @Description: 文件描述
*/
......@@ -101,7 +101,10 @@ const changeURLArg = (url, arg, arg_val) => {
return url + '\n' + arg + '\n' + arg_val;
}
// 获取参数key/value值对
const getUrlParams = (url) => {
// 没有参数处理
if (url.split('?').length === 1) return false;
let arr = url.split('?');
let res = arr[1].split('&');
let items = {};
......
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-02-10 18:01:13
* @LastEditTime: 2023-02-16 10:18:37
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
......@@ -471,10 +471,18 @@ const onSubmit = async (values) => {
});
if (result.code) {
showSuccessToast("提交成功");
// 缓存表单返回值
store.changeSuccessInfo(result.data);
// 如果类型为跳转网页
if (result.data.commit_action === 'url') {
window.location.href = result.data.commit_url;
} else {
// 跳转成功页面
$router.push({
path: "/success",
});
}
}
} else {
console.warn(validOther().key + "不通过验证");
// // 图片上传控件报错提示
......
<!--
* @Date: 2022-06-29 18:18:02
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-29 18:18:09
* @FilePath: /tswj/src/views/test/404.vue
* @LastEditTime: 2023-02-16 10:20:19
* @FilePath: /data-table/src/views/success.vue
* @Description: 文件描述
-->
<template>
<div class="success-page">
<div style="padding-top: 2rem; padding-bottom: 2rem; text-align: center">
<div v-if="successInfo.commit_text_type === 'default'" class="text-wrapper">
<van-image
round
width="10rem"
......@@ -15,13 +15,13 @@
style="vertical-align: bottom"
:src="icon_success"
/>
<p style="font-size: 1.05rem; margin: 0.5rem; font-weight: bold">提交成功!</p>
<!-- <p style="font-size: 0.9rem; margin-bottom: 0.5rem">您的作品正在审核中</p> -->
<!-- <p style="font-size: 0.9rem">请耐心等待~~</p> -->
<p class="name">{{ successInfo.form_name }}</p>
<p class="text">{{ successInfo.commit_text }}</p>
</div>
<div style="padding: 0 15% 1rem 15%">
<div v-else class="rich-text" v-html="successInfo.commit_text" />
<!-- <div style="padding: 0 15% 1rem 15%">
<div class="button-plain" :style="styleObj" @click="handle">返回</div>
</div>
</div> -->
</div>
</template>
......@@ -54,7 +54,16 @@ const styleObj = {
color: "#FFFFFF",
};
onMounted(() => {});
// 获取成功返回信息
const store = mainStore();
const { successInfo } = storeToRefs(store);
const richText = '<div style="font-weight: bold;">123</div>'
onMounted(() => {
$('body').css('backgroundColor', 'white');
console.warn(successInfo.value);
});
const handle = () => {
$router.go(-1);
......@@ -63,6 +72,25 @@ const handle = () => {
<style lang="less" scoped>
.success-page {
.text-wrapper {
padding-top: 2rem;
padding-bottom: 2rem;
text-align: center;
.name {
font-size: 1.25rem;
margin: 0.5rem;
font-weight: bold;
}
.text {
font-size: 1.05rem;
margin: 0.5rem;
font-weight: bold;
}
}
.rich-text {
padding: 1rem 2rem;
white-space: pre-wrap;
}
.button-plain {
width: auto;
height: auto;
......