feat(survey): 优化问卷列表页面
- 添加搜索功能,用户可以按项目名称搜索问卷 - 调整问卷列表项的样式,优化布局 - 移除多余的 padding 样式 - 更新 base.scss 中的变量定义
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
--van-cascader-active-color: var(--primary-color);
|
--van-cascader-active-color: var(--primary-color);
|
||||||
--status-bar-height: 20px;
|
--status-bar-height: 20px;
|
||||||
--sticky-top-height: calc(var(--status-bar-height) + calc(var(--van-nav-bar-height) + 13px));
|
--sticky-top-height: calc(var(--status-bar-height) + calc(var(--van-nav-bar-height) + 13px));
|
||||||
|
--van-radius-sm: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* semantic color variables for this project */
|
/* semantic color variables for this project */
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.van-cell {
|
.van-cell {
|
||||||
padding: 8px !important;
|
//padding: 8px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.van-divider {
|
.van-divider {
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="survey-search">
|
<div class="survey-search">
|
||||||
<van-search class="theme-background" :border="false" background="#71b73c"></van-search>
|
<van-search
|
||||||
|
class="theme-background"
|
||||||
|
:border="false"
|
||||||
|
background="#71b73c"
|
||||||
|
v-model="searchValue"
|
||||||
|
@blur="blurs"
|
||||||
|
@search="blurs"
|
||||||
|
></van-search>
|
||||||
</div>
|
</div>
|
||||||
<div class="new-survey-container container">
|
<div class="new-survey-container container">
|
||||||
<van-list
|
<van-list
|
||||||
@@ -103,9 +110,18 @@ const loading = ref(false);
|
|||||||
const finished = ref(false);
|
const finished = ref(false);
|
||||||
const form = ref({
|
const form = ref({
|
||||||
page: 0,
|
page: 0,
|
||||||
pageSize: 10
|
pageSize: 10,
|
||||||
|
project_name: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const searchValue = ref('');
|
||||||
|
|
||||||
|
const blurs = () => {
|
||||||
|
form.value.page = 1;
|
||||||
|
form.value.project_name = searchValue.value;
|
||||||
|
survey.value = [];
|
||||||
|
fetchSurveys();
|
||||||
|
};
|
||||||
const onLoad = () => {
|
const onLoad = () => {
|
||||||
// 异步更新数据
|
// 异步更新数据
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -113,11 +129,12 @@ const onLoad = () => {
|
|||||||
fetchSurveys();
|
fetchSurveys();
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
const fetchSurveys = async() => {
|
const fetchSurveys = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
page: form.value.page,
|
page: form.value.page,
|
||||||
per_page: form.value.pageSize,
|
per_page: form.value.pageSize,
|
||||||
group_id: 0
|
group_id: 0,
|
||||||
|
project_name: searchValue.value
|
||||||
};
|
};
|
||||||
const res = await getSurveysPage(params);
|
const res = await getSurveysPage(params);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -150,7 +167,7 @@ const deleteItem = (item) => {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#03B03C'
|
confirmButtonColor: '#03B03C'
|
||||||
})
|
})
|
||||||
.then(async() => {
|
.then(async () => {
|
||||||
const res = await deleteSurveys(item.sn);
|
const res = await deleteSurveys(item.sn);
|
||||||
if (res.data.message) {
|
if (res.data.message) {
|
||||||
showToast(res.data.message);
|
showToast(res.data.message);
|
||||||
@@ -174,7 +191,7 @@ const copyItem = (item) => {
|
|||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#03B03C'
|
confirmButtonColor: '#03B03C'
|
||||||
})
|
})
|
||||||
.then(async() => {
|
.then(async () => {
|
||||||
const res = await copySurveys(item.sn);
|
const res = await copySurveys(item.sn);
|
||||||
if (res.data.code === 200 || res.data.code === 201) {
|
if (res.data.code === 200 || res.data.code === 201) {
|
||||||
showSuccessToast('复制成功');
|
showSuccessToast('复制成功');
|
||||||
@@ -215,7 +232,7 @@ const editItem = (item) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 保存为模板
|
// 保存为模板
|
||||||
const saveTemplate = async(item) => {
|
const saveTemplate = async (item) => {
|
||||||
const data = JSON.parse(JSON.stringify(item));
|
const data = JSON.parse(JSON.stringify(item));
|
||||||
const res = await saveTemplates(item.sn, data);
|
const res = await saveTemplates(item.sn, data);
|
||||||
if (res.data.code === 200 || res.data.code === 201) {
|
if (res.data.code === 200 || res.data.code === 201) {
|
||||||
@@ -259,12 +276,12 @@ onMounted(() => {
|
|||||||
|
|
||||||
.new-survey-container {
|
.new-survey-container {
|
||||||
//min-height: calc(100vh - 100px);
|
//min-height: calc(100vh - 100px);
|
||||||
padding: 1px;
|
//padding: 1px;
|
||||||
|
|
||||||
//background: linear-gradient(to bottom, $theme-color 200px, #f2f2f2 300px);
|
//background: linear-gradient(to bottom, $theme-color 200px, #f2f2f2 300px);
|
||||||
|
|
||||||
.new-survey_item {
|
.new-survey_item {
|
||||||
margin: 10px;
|
margin: 0 10px 10px 10px;
|
||||||
padding: 10px 0 8px 7px;
|
padding: 10px 0 8px 7px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
@@ -354,5 +371,9 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.new-survey_item + .new-survey_item {
|
||||||
|
margin: 0 10px 10px 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user