feat:首页联调
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
// import { ref } from 'vue';
|
||||
import { consoleSurveys } from '@/api/home/index.js';
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { consoleSurveys, getQuestionList } from '@/api/home/index.js';
|
||||
import { snQuestions, saveQuestions } from '@/api/design/index.js';
|
||||
import { surveys } from './Hooks/useRequestHooks';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useCounterStore } from '@/stores/counter';
|
||||
import { storeToRefs } from 'pinia';
|
||||
@@ -11,6 +10,7 @@ const counterStore = useCounterStore();
|
||||
const store = storeToRefs(counterStore);
|
||||
|
||||
const router = useRouter();
|
||||
const surveys = ref([]);
|
||||
|
||||
const createdQuestion = (item) => {
|
||||
const query = {
|
||||
@@ -44,6 +44,28 @@ const createdQuestion = (item) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 添加获取问卷列表的方法
|
||||
const getList = () => {
|
||||
getQuestionList().then((res) => {
|
||||
if (res.data.code === 0) {
|
||||
if (res.data.data) {
|
||||
res.data.data.forEach((item) => {
|
||||
if (item.parentCode && item.parentCode === 1) {
|
||||
surveys.value.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
surveys.value.push({});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 在组件挂载时调用
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -57,7 +79,7 @@ const createdQuestion = (item) => {
|
||||
class="survey"
|
||||
@click="createdQuestion(survey)"
|
||||
>
|
||||
<img width="45px" :src="survey.icon" alt=" " />
|
||||
<img :src="survey.image" alt="" width="40" />
|
||||
<span>{{ survey.title }}</span>
|
||||
</van-col>
|
||||
</van-row>
|
||||
|
||||
Reference in New Issue
Block a user