diff --git a/components.d.ts b/components.d.ts index 7b3424c..41c15ba 100644 --- a/components.d.ts +++ b/components.d.ts @@ -28,7 +28,7 @@ declare module 'vue' { ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTag: typeof import('element-plus/es')['ElTag'] ElText: typeof import('element-plus/es')['ElText'] - Index: typeof import('./src/components/Navigation/Index.vue')['default'] + Index: typeof import('./src/components/Analysis/Index.vue')['default'] MarketItem: typeof import('./src/components/MarketItem/MarketItem.vue')['default'] RichText: typeof import('./src/components/RichText.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/api/survey/index.js b/src/api/survey/index.js index 60be77c..40c983b 100644 --- a/src/api/survey/index.js +++ b/src/api/survey/index.js @@ -17,7 +17,12 @@ export function getSurveyInfo(sn) { }); } -// 问题分析接口 +/** + * 问题分析接口 + * @param sn + * @param data {import('@/api/types/analysis.js').AnalysisParam} + * @returns {Promise> | *} + */ export function surveyAnalysis(sn, data) { return request({ url: `/console/surveys/${sn}/chart_analysis`, diff --git a/src/api/types/analysis.d.ts b/src/api/types/analysis.d.ts new file mode 100644 index 0000000..aca36b2 --- /dev/null +++ b/src/api/types/analysis.d.ts @@ -0,0 +1,5 @@ +type page = { page: number; } +type per_page = { per_page: number }; +type source = { source: 1 | 2 }; + +type AnalysisParam = page & per_page & Partial \ No newline at end of file diff --git a/src/assets/css/theme.scss b/src/assets/css/theme.scss index 020d699..017203b 100644 --- a/src/assets/css/theme.scss +++ b/src/assets/css/theme.scss @@ -1 +1,3 @@ $theme-color: #71b73c; +$card-radius: 10px; +$gap: 10px; \ No newline at end of file diff --git a/src/assets/img/analysis/ai.png b/src/assets/img/analysis/ai.png new file mode 100644 index 0000000..5a9d9e7 Binary files /dev/null and b/src/assets/img/analysis/ai.png differ diff --git a/src/components/Analysis/Index.vue b/src/components/Analysis/Index.vue new file mode 100644 index 0000000..70fade4 --- /dev/null +++ b/src/components/Analysis/Index.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/src/views/Home/components/MineTask/hooks/useSurvey.ts b/src/components/Analysis/hooks/useSurvey.ts similarity index 100% rename from src/views/Home/components/MineTask/hooks/useSurvey.ts rename to src/components/Analysis/hooks/useSurvey.ts diff --git a/src/components/Search/Index.vue~ b/src/components/Search/Index.vue~ deleted file mode 100644 index b17ba7a..0000000 --- a/src/components/Search/Index.vue~ +++ /dev/null @@ -1,60 +0,0 @@ - - - - - diff --git a/src/components/YlTable/Index.vue b/src/components/YlTable/Index.vue new file mode 100644 index 0000000..89b1f33 --- /dev/null +++ b/src/components/YlTable/Index.vue @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index d23b030..b0e3c64 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -87,7 +87,7 @@ const router = createRouter({ component: () => import( '@/views/Home/components/CreateSurvey/components/IntelligentGeneration/Index.vue' - ) + ) }, { path: '/search', name: 'search', @@ -97,6 +97,11 @@ const router = createRouter({ path: '/template-market', name: 'templateMarket', component: () => import('@/views/Home/components/Market/Index.vue') + }, { + path: '/analysis', + name: 'analysis', + meta: {}, + component: () => import('@/views/Survey/views/Analysis/Index.vue') } ] }, diff --git a/src/views/Home/Index.vue b/src/views/Home/Index.vue index ec449aa..8b67e2a 100644 --- a/src/views/Home/Index.vue +++ b/src/views/Home/Index.vue @@ -9,7 +9,7 @@ import { getUserInfo } from '@/api/common/index.js'; import { showFailToast } from 'vant'; import appBridge from '@/assets/js/appBridge'; import ImageSlider from './components/ImageSlider/Index.vue'; -import MineTask from '@/views/Home/components/MineTask/Index.vue'; +import MineTask from '@/components/Analysis/Index.vue'; import Navigation from '@/components/Navigation/Index.vue'; const contentShow = ref(false); diff --git a/src/views/Home/components/MineTask/Index.vue b/src/views/Home/components/MineTask/Index.vue deleted file mode 100644 index 41d5b19..0000000 --- a/src/views/Home/components/MineTask/Index.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - - - diff --git a/src/views/Survey/Index.vue b/src/views/Survey/Index.vue index 932447b..c715fa6 100644 --- a/src/views/Survey/Index.vue +++ b/src/views/Survey/Index.vue @@ -33,9 +33,10 @@ import { onMounted } from 'vue'; import NewSurvey from '@/views/Home/components/NewSurvey/index.vue'; import EmptyContainer from '@/views/Survey/components/EmptyContainer.vue'; -import SurveyItem from '@/views/Survey/components/SuvreyItem.vue'; +import SurveyItem from '@/views/Survey/components/SurveyItem.vue'; import { form, fetchSurveys, loading, finished, survey, searchValue } from '@/views/Survey/hooks/useSurveyData'; + const blurs = () => { form.value.page = 1; form.value.project_name = searchValue.value; @@ -75,6 +76,7 @@ onMounted(() => { .new-survey-container { margin-top: 10px; + .new-survey_item { margin: 0 10px 10px; padding: 10px 0 8px 7px; diff --git a/src/views/Survey/components/SurveyItem.vue b/src/views/Survey/components/SurveyItem.vue new file mode 100644 index 0000000..00ef844 --- /dev/null +++ b/src/views/Survey/components/SurveyItem.vue @@ -0,0 +1,357 @@ + + + + + \ No newline at end of file diff --git a/src/views/Survey/components/SuvreyItem.vue b/src/views/Survey/components/SurveyItem.vue~ similarity index 82% rename from src/views/Survey/components/SuvreyItem.vue rename to src/views/Survey/components/SurveyItem.vue~ index 42f0070..4d4edfa 100644 --- a/src/views/Survey/components/SuvreyItem.vue +++ b/src/views/Survey/components/SurveyItem.vue~ @@ -11,12 +11,13 @@ import { showDialog, showFailToast, showSuccessToast } from 'vant'; import { finish } from '@/api/survey'; import { copySurveys } from '@/api/home'; import { useRouter } from 'vue-router'; -import { form, fetchSurveys, deleteItem, saveTemplate } from '@/views/Survey/hooks/useSurveyData'; +import { form, fetchSurveys, deleteItem, saveTemplate, currentSurvey } from '@/views/Survey/hooks/useSurveyData'; // router const router = useRouter(); const survey = defineModel('survey', { required: true }); +const isAnalysis = defineModel('isAnalysis', { default: true, type: Boolean }); function setImg(code: number) { const imageMap: { [key: number]: string } = { @@ -33,7 +34,7 @@ function setImg(code: number) { return imageMap[code] || png11; }; -function editItem(item) { +function editItem(item: SurveyItem) { router.push({ path: '/create', query: { @@ -42,7 +43,7 @@ function editItem(item) { }); }; -function toPreview(item) { +function toPreview(item: SurveyItem) { router.push({ path: '/preview', query: { @@ -51,9 +52,25 @@ function toPreview(item) { source: 0 } }); -}; +} -function toPublish(item) { +/** + * 跳转 统计分析 页面 + * @param item + */ +function toAnalysis(item: SurveyItem) { + // 设置当前的节点信息 + currentSurvey.value = item; + // 跳转 + router.push({ + path: '/analysis', + query: { + sn: item.sn + } + }); +} + +function toPublish(item: SurveyItem) { if (item.status === 1) { showDialog({ title: `确定要取消投放${item.project_name}?`, @@ -80,7 +97,7 @@ function toPublish(item) { } }; -function copyItem(item) { +function copyItem(item: SurveyItem) { showDialog({ title: `确认复制问卷${item.project_name} ?`, showCancelButton: true, @@ -100,7 +117,7 @@ function copyItem(item) { .catch(() => { // on cancel }); -}; +} @@ -118,13 +135,15 @@ function copyItem(item) { {{ `${survey.start_time} 至 ${survey.end_time ?? '无限期'}` }} + + AI 洞察
Content Icon @@ -134,35 +153,35 @@ function copyItem(item) {
- + {{ survey.source === 1 ? '移动端' : 'PC端' }}
- + {{ survey.created_at }}
-
+
@@ -184,25 +203,24 @@ function copyItem(item) {
-
+
编辑 - - - - - - - - + + + + + + - 预览 + 统计 + {{ survey.status === 1 ? '结束投放' : '开启投放' }} diff --git a/src/views/Survey/hooks/useSurveyData.ts b/src/views/Survey/hooks/useSurveyData.ts index 09fdf0e..4fc62b2 100644 --- a/src/views/Survey/hooks/useSurveyData.ts +++ b/src/views/Survey/hooks/useSurveyData.ts @@ -9,6 +9,7 @@ import { showFailToast, showToast } from 'vant'; +import { getSurveysDetail } from '@/api/design'; const form = ref({ page: 0, @@ -21,6 +22,15 @@ const survey = ref([]); const total = ref(0); const loading = ref(false); const finished = ref(false); +const currentSurvey = ref(); + +async function fetchSingleSurvey(sn: string) { + const res = await getSurveysDetail(sn); + // console.log(res); + if (res.data.code === 0) { + currentSurvey.value = res.data.data; + } +} async function fetchSurveys() { const params = { @@ -53,9 +63,9 @@ async function fetchSurveys() { } else { // Toast() } -}; +} -function deleteItem(item) { +function deleteItem(item: SurveyItem) { showDialog({ title: `确认删除问卷${item.project_name} ?`, showCancelButton: true, @@ -78,7 +88,7 @@ function deleteItem(item) { }; // 保存为模板 -async function saveTemplate(item) { +async function saveTemplate(item: SurveyItem) { const data = JSON.parse(JSON.stringify(item)); const res = await saveTemplates(item.sn, data); if (res.data.code === 200 || res.data.code === 201) { @@ -90,6 +100,18 @@ async function saveTemplate(item) { showFailToast(res.data); } } -; -export { form, fetchSurveys, loading, finished, survey, total, searchValue, deleteItem, saveTemplate }; \ No newline at end of file +export { + form, + fetchSurveys, + loading, + finished, + survey, + total, + searchValue, + deleteItem, + saveTemplate, + currentSurvey, + fetchSingleSurvey +} + ; \ No newline at end of file diff --git a/src/views/Survey/views/Analysis/Index.vue b/src/views/Survey/views/Analysis/Index.vue new file mode 100644 index 0000000..3161b17 --- /dev/null +++ b/src/views/Survey/views/Analysis/Index.vue @@ -0,0 +1,46 @@ + + + + + \ No newline at end of file diff --git a/src/views/Survey/views/Analysis/components/LogicInfo.vue b/src/views/Survey/views/Analysis/components/LogicInfo.vue new file mode 100644 index 0000000..a966154 --- /dev/null +++ b/src/views/Survey/views/Analysis/components/LogicInfo.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/views/Survey/views/Analysis/components/types/logicInfo.d.ts b/src/views/Survey/views/Analysis/components/types/logicInfo.d.ts new file mode 100644 index 0000000..d513755 --- /dev/null +++ b/src/views/Survey/views/Analysis/components/types/logicInfo.d.ts @@ -0,0 +1,3 @@ +type LogicInfoTab = { + title: string, +} \ No newline at end of file diff --git a/src/views/Survey/views/Analysis/hooks/useAnalysis.ts b/src/views/Survey/views/Analysis/hooks/useAnalysis.ts new file mode 100644 index 0000000..0d5cecf --- /dev/null +++ b/src/views/Survey/views/Analysis/hooks/useAnalysis.ts @@ -0,0 +1,17 @@ +import { surveyAnalysis } from '@/api/survey'; +import {ref} from 'vue'; + +const questionAnalysis = ref() +const params: AnalysisParam = { + page: 1, + per_page: 30, + source: 1 +}; + +async function useFetchAnalysis(sn:string) { + const res = await surveyAnalysis(sn, params); + questionAnalysis.value = res.data.data + console.log(`question analysis`,questionAnalysis.value); +} + +export { useFetchAnalysis, questionAnalysis }; \ No newline at end of file diff --git a/src/views/UserSpace/Index.vue b/src/views/UserSpace/Index.vue deleted file mode 100644 index e69de29..0000000