feat: 增加日期格式化

- 格式化首页的日期内容
- 修复预览跳转正常使用
This commit is contained in:
Huangzhe
2025-05-23 17:21:22 +08:00
parent c855b846cb
commit 611b37cbf5
3 changed files with 11 additions and 2 deletions

View File

@@ -56,6 +56,7 @@ export const useQuestionStore = defineStore('questionStore', () => {
} }
}); });
data = data.data; data = data.data;
console.log(`data:`, data);
// 多语言 // 多语言
data.languageType = [ data.languageType = [
data?.survey?.style?.is_en_tips ? 'en' : '', data?.survey?.style?.is_en_tips ? 'en' : '',
@@ -65,6 +66,7 @@ export const useQuestionStore = defineStore('questionStore', () => {
// console.log(`l value:`, l.value); // console.log(`l value:`, l.value);
data.language = l.value; data.language = l.value;
questionsData.value = data; questionsData.value = data;
} }
return { return {

3
src/utils/date.ts Normal file
View File

@@ -0,0 +1,3 @@
export function formatTime(time: string, split = ' ', join = ' '){
return time.split(split).join(join)
}

View File

@@ -19,6 +19,7 @@ import {
} from '@/views/Survey/hooks/useSurveyData'; } from '@/views/Survey/hooks/useSurveyData';
import ai from '@/assets/img/analysis/ai.svg'; import ai from '@/assets/img/analysis/ai.svg';
import { ref } from 'vue'; import { ref } from 'vue';
import { formatTime } from '@/utils/date';
const form = ref({ const form = ref({
page: 0, page: 0,
@@ -66,7 +67,8 @@ function toPreview(item: SurveyItem) {
query: { query: {
sn: item.sn, sn: item.sn,
name: item.project_name, name: item.project_name,
source: 0 source: 0,
is_template: 1
} }
}); });
} }
@@ -183,7 +185,9 @@ function copyItem(item: SurveyItem) {
<!-- 问卷时间 --> <!-- 问卷时间 -->
<div class="flex align-center"> <div class="flex align-center">
<img src="@/assets/img/publish/time.png" alt="" /> <img src="@/assets/img/publish/time.png" alt="" />
<el-text size="small"> 创建时间 {{ survey.created_at }}</el-text> <el-text size="small">
创建时间 {{ formatTime(survey.created_at, '-', '.') }}
</el-text>
</div> </div>
</el-space> </el-space>
</div> </div>