完善搜索功能:
1. 添加搜索方法实现,支持关键词搜索 2. 实现取消搜索功能,清空搜索结果 3. 添加搜索结果展示组件 4. 优化搜索结果样式,使用Element Plus风格 5. 添加搜索输入验证,防止空搜索
This commit is contained in:
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
@@ -66,5 +66,12 @@
|
|||||||
"stylelint.configFile": "./node_modules/@yl/yili-fe-lint-config/stylelintrc.js", // 该选项指定了 stylelint 应使用的配置文件路径。此项设置会覆盖所有其他位置查找的 stylelint 配置文件
|
"stylelint.configFile": "./node_modules/@yl/yili-fe-lint-config/stylelintrc.js", // 该选项指定了 stylelint 应使用的配置文件路径。此项设置会覆盖所有其他位置查找的 stylelint 配置文件
|
||||||
"stylelint.customSyntax": "postcss-scss", // 配置stylelint使用的预处理器
|
"stylelint.customSyntax": "postcss-scss", // 配置stylelint使用的预处理器
|
||||||
"stylelint.stylelintPath": "./node_modules/@yl/yili-fe-lint-config/node_modules/stylelint", // 指定stylelint安装路径
|
"stylelint.stylelintPath": "./node_modules/@yl/yili-fe-lint-config/node_modules/stylelint", // 指定stylelint安装路径
|
||||||
"stylelint.validate": ["html", "css", "scss", "less", "vue"]
|
"stylelint.validate": [
|
||||||
|
"html",
|
||||||
|
"css",
|
||||||
|
"scss",
|
||||||
|
"less",
|
||||||
|
"vue"
|
||||||
|
],
|
||||||
|
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||||
}
|
}
|
||||||
|
|||||||
4
auto-imports.d.ts
vendored
4
auto-imports.d.ts
vendored
@@ -5,4 +5,6 @@
|
|||||||
// Generated by unplugin-auto-import
|
// Generated by unplugin-auto-import
|
||||||
// biome-ignore lint: disable
|
// biome-ignore lint: disable
|
||||||
export {}
|
export {}
|
||||||
declare global {}
|
declare global {
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
15
components.d.ts
vendored
15
components.d.ts
vendored
@@ -9,28 +9,38 @@ declare module 'vue' {
|
|||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
Contenteditable: typeof import('./src/components/contenteditable.vue')['default']
|
Contenteditable: typeof import('./src/components/contenteditable.vue')['default']
|
||||||
ElButton: typeof import('element-plus/es')['ElButton']
|
ElButton: typeof import('element-plus/es')['ElButton']
|
||||||
|
ElCard: typeof import('element-plus/es')['ElCard']
|
||||||
|
ElCarousel: typeof import('element-plus/es')['ElCarousel']
|
||||||
|
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
|
||||||
|
ElCol: typeof import('element-plus/es')['ElCol']
|
||||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
||||||
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
||||||
|
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||||
ElInput: typeof import('element-plus/es')['ElInput']
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
ElOption: typeof import('element-plus/es')['ElOption']
|
ElOption: typeof import('element-plus/es')['ElOption']
|
||||||
|
ElRow: typeof import('element-plus/es')['ElRow']
|
||||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||||
ElSpace: typeof import('element-plus/es')['ElSpace']
|
ElSpace: typeof import('element-plus/es')['ElSpace']
|
||||||
ElTable: typeof import('element-plus/es')['ElTable']
|
ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||||
|
ElTag: typeof import('element-plus/es')['ElTag']
|
||||||
ElText: typeof import('element-plus/es')['ElText']
|
ElText: typeof import('element-plus/es')['ElText']
|
||||||
|
Index: typeof import('./src/components/Navigation/Index.vue')['default']
|
||||||
RichText: typeof import('./src/components/RichText.vue')['default']
|
RichText: typeof import('./src/components/RichText.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
||||||
VanButton: typeof import('vant/es')['Button']
|
VanButton: typeof import('vant/es')['Button']
|
||||||
|
VanCard: typeof import('vant/es')['Card']
|
||||||
VanCell: typeof import('vant/es')['Cell']
|
VanCell: typeof import('vant/es')['Cell']
|
||||||
VanCellGroup: typeof import('vant/es')['CellGroup']
|
VanCellGroup: typeof import('vant/es')['CellGroup']
|
||||||
VanCheckbox: typeof import('vant/es')['Checkbox']
|
VanCheckbox: typeof import('vant/es')['Checkbox']
|
||||||
VanCheckboxGroup: typeof import('vant/es')['CheckboxGroup']
|
VanCheckboxGroup: typeof import('vant/es')['CheckboxGroup']
|
||||||
VanCol: typeof import('vant/es')['Col']
|
|
||||||
VanDivider: typeof import('vant/es')['Divider']
|
VanDivider: typeof import('vant/es')['Divider']
|
||||||
VanField: typeof import('vant/es')['Field']
|
VanField: typeof import('vant/es')['Field']
|
||||||
|
VanGrid: typeof import('vant/es')['Grid']
|
||||||
|
VanGridItem: typeof import('vant/es')['GridItem']
|
||||||
VanIcon: typeof import('vant/es')['Icon']
|
VanIcon: typeof import('vant/es')['Icon']
|
||||||
VanList: typeof import('vant/es')['List']
|
VanList: typeof import('vant/es')['List']
|
||||||
VanNavBar: typeof import('vant/es')['NavBar']
|
VanNavBar: typeof import('vant/es')['NavBar']
|
||||||
@@ -39,12 +49,13 @@ declare module 'vue' {
|
|||||||
VanPopup: typeof import('vant/es')['Popup']
|
VanPopup: typeof import('vant/es')['Popup']
|
||||||
VanRadio: typeof import('vant/es')['Radio']
|
VanRadio: typeof import('vant/es')['Radio']
|
||||||
VanRadioGroup: typeof import('vant/es')['RadioGroup']
|
VanRadioGroup: typeof import('vant/es')['RadioGroup']
|
||||||
VanRow: typeof import('vant/es')['Row']
|
|
||||||
VanSearch: typeof import('vant/es')['Search']
|
VanSearch: typeof import('vant/es')['Search']
|
||||||
|
VanSpace: typeof import('vant/es')['Space']
|
||||||
VanStepper: typeof import('vant/es')['Stepper']
|
VanStepper: typeof import('vant/es')['Stepper']
|
||||||
VanSwitch: typeof import('vant/es')['Switch']
|
VanSwitch: typeof import('vant/es')['Switch']
|
||||||
VanTab: typeof import('vant/es')['Tab']
|
VanTab: typeof import('vant/es')['Tab']
|
||||||
VanTabs: typeof import('vant/es')['Tabs']
|
VanTabs: typeof import('vant/es')['Tabs']
|
||||||
|
VanTag: typeof import('vant/es')['Tag']
|
||||||
YLCascader: typeof import('./src/components/YLCascader.vue')['default']
|
YLCascader: typeof import('./src/components/YLCascader.vue')['default']
|
||||||
YLInput: typeof import('./src/components/YLInput.vue')['default']
|
YLInput: typeof import('./src/components/YLInput.vue')['default']
|
||||||
YLPicker: typeof import('./src/components/YLPicker.vue')['default']
|
YLPicker: typeof import('./src/components/YLPicker.vue')['default']
|
||||||
|
|||||||
12769
package-lock.json
generated
12769
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -26,15 +26,14 @@
|
|||||||
"element-plus": "^2.7.8",
|
"element-plus": "^2.7.8",
|
||||||
"js-base64": "^3.7.7",
|
"js-base64": "^3.7.7",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^3.0.2",
|
||||||
"regenerator-runtime": "^0.14.1",
|
"regenerator-runtime": "^0.14.1",
|
||||||
"shrinkpng": "^1.2.0-beta.1",
|
"shrinkpng": "^1.2.0-beta.1",
|
||||||
"sortablejs": "^1.15.6",
|
"sortablejs": "^1.15.6",
|
||||||
"uuid": "^11.1.0",
|
"uuid": "^11.1.0",
|
||||||
"vant": "^4.9.17",
|
"vant": "^4.9.17",
|
||||||
"vconsole": "^3.15.1",
|
"vconsole": "^3.15.1",
|
||||||
"vite-plugin-vue": "^0.0.1",
|
"vue": "^3.5.13",
|
||||||
"vue": "^3.4.29",
|
|
||||||
"vue-icons-plus": "^0.1.8",
|
"vue-icons-plus": "^0.1.8",
|
||||||
"vue-router": "^4.3.3",
|
"vue-router": "^4.3.3",
|
||||||
"vuex": "^4.1.0"
|
"vuex": "^4.1.0"
|
||||||
@@ -63,7 +62,7 @@
|
|||||||
"postcss-pxtorem": "^6.1.0",
|
"postcss-pxtorem": "^6.1.0",
|
||||||
"sass": "^1.85.1",
|
"sass": "^1.85.1",
|
||||||
"sass-loader": "^16.0.5",
|
"sass-loader": "^16.0.5",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.2.2",
|
||||||
"unplugin-auto-import": "^0.18.6",
|
"unplugin-auto-import": "^0.18.6",
|
||||||
"unplugin-vue-components": "^0.27.5",
|
"unplugin-vue-components": "^0.27.5",
|
||||||
"vite": "^6.0.0",
|
"vite": "^6.0.0",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export function getSurveysPage(params) {
|
|||||||
params
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 复制问卷
|
// 复制问卷
|
||||||
export function copySurveys(sn) {
|
export function copySurveys(sn) {
|
||||||
// source=1 表明是移动端问卷
|
// source=1 表明是移动端问卷
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* color palette from <https://github.com/vuejs/theme> */
|
/* color palette from <https://github.com/vuejs/theme> */
|
||||||
:root {
|
:root {
|
||||||
--primary-color: #71b73c;
|
--primary-color: #70B937;
|
||||||
--van-primary-color: #71b73c;
|
--van-primary-color: #71b73c;
|
||||||
--vt-c-white: #fff;
|
--vt-c-white: #fff;
|
||||||
--vt-c-white-soft: #f8f8f8;
|
--vt-c-white-soft: #f8f8f8;
|
||||||
|
|||||||
73
src/components/Navigation/Index.vue
Normal file
73
src/components/Navigation/Index.vue
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { AiFillHome } from 'vue-icons-plus/ai';
|
||||||
|
import { h, ref } from 'vue';
|
||||||
|
import { useRouter, type RouteLocationRaw } from 'vue-router';
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const navigation = ref([
|
||||||
|
{
|
||||||
|
title: '主页',
|
||||||
|
link: {
|
||||||
|
name: 'home',
|
||||||
|
path: '/home'
|
||||||
|
},
|
||||||
|
icon: h(AiFillHome)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '伊调研',
|
||||||
|
link: {
|
||||||
|
name: 'home',
|
||||||
|
path: '/home'
|
||||||
|
},
|
||||||
|
icon: h(AiFillHome)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '我的',
|
||||||
|
link: {
|
||||||
|
name: '',
|
||||||
|
path: '/survey'
|
||||||
|
},
|
||||||
|
icon: h(AiFillHome)
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle changing of navigation
|
||||||
|
* @param {object} nav - the navigation item selected
|
||||||
|
*/
|
||||||
|
function handleChangeNav(nav: any) {
|
||||||
|
const params = {} as RouteLocationRaw
|
||||||
|
// 如果有 name 表示,优先取 name 参数
|
||||||
|
nav.link.name.length != 0 ? (params.name = nav.link.name as string) : (params.path = nav.link.path)
|
||||||
|
router.push(params)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="navigation">
|
||||||
|
<section @click="handleChangeNav(item)" v-for="item in navigation" :key="item.title" class="navigation-item">
|
||||||
|
<component :is="item.icon"></component>
|
||||||
|
<div>{{ item.title }}</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.navigation {
|
||||||
|
width: 100vw;
|
||||||
|
background-color: white;
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row;
|
||||||
|
justify-content: space-around;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0px;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navigation-item {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: column nowrap;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
56
src/components/Search/Index.vue
Normal file
56
src/components/Search/Index.vue
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<template>
|
||||||
|
<section class="search-container">
|
||||||
|
<van-search v-model="value" :placeholder="placeholder" @search="searchMethod" @cancel="emitCancel"
|
||||||
|
style="--van-search-padding: 0;">
|
||||||
|
</van-search>
|
||||||
|
<el-text>
|
||||||
|
搜索
|
||||||
|
</el-text>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
const value = ref('');
|
||||||
|
/**
|
||||||
|
* @description 搜索方法
|
||||||
|
*/
|
||||||
|
const searchMethod = defineModel('search', {
|
||||||
|
type: Function,
|
||||||
|
default: () => void 0
|
||||||
|
});
|
||||||
|
const placeholder = defineModel('placeholder', {
|
||||||
|
type: String,
|
||||||
|
default: '请输入搜索关键词'
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.search-container {
|
||||||
|
:deep(.van-search) {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 10px;
|
||||||
|
border-radius: 0;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-text) {
|
||||||
|
margin: 0 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #999;
|
||||||
|
cursor: pointer;
|
||||||
|
justify-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
border-radius: 18px;
|
||||||
|
border : solid 2px var(--primary-color);
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
|
||||||
|
width: 100vw;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 60px;
|
||||||
|
padding: 0 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,14 +2,8 @@
|
|||||||
<div class="common-layout container">
|
<div class="common-layout container">
|
||||||
<!-- title 标题和搜索栏 -->
|
<!-- title 标题和搜索栏 -->
|
||||||
<header class="header">
|
<header class="header">
|
||||||
<van-nav-bar
|
<van-nav-bar class="navbar-header" :title="$route.meta.title" left-arrow safe-area-inset-top :border="false"
|
||||||
class="navbar-header"
|
@click-left="goBack">
|
||||||
:title="$route.meta.title"
|
|
||||||
left-arrow
|
|
||||||
safe-area-inset-top
|
|
||||||
:border="false"
|
|
||||||
@click-left="goBack"
|
|
||||||
>
|
|
||||||
<template #left>
|
<template #left>
|
||||||
<van-icon name="left-long" class-prefix="mobilefont" size="18" style="color: #fff" />
|
<van-icon name="left-long" class-prefix="mobilefont" size="18" style="color: #fff" />
|
||||||
</template>
|
</template>
|
||||||
@@ -23,12 +17,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { RouterView, useRouter, useRoute } from 'vue-router';
|
import { RouterView, useRoute, useRouter } from 'vue-router';
|
||||||
import appBridge from '@/assets/js/appBridge';
|
import appBridge from '@/assets/js/appBridge';
|
||||||
import { onMounted, onUnmounted } from 'vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
// const router = useRouter();
|
||||||
|
|
||||||
function goBack () {
|
function goBack () {
|
||||||
if (window.history.length > 1 && route.name !== 'home') {
|
if (window.history.length > 1 && route.name !== 'home') {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router';
|
|||||||
import layout from '@/layouts/index.vue';
|
import layout from '@/layouts/index.vue';
|
||||||
import Design from '@/views/Design/Index.vue';
|
import Design from '@/views/Design/Index.vue';
|
||||||
import Redirect from '@/layouts/redirect.vue';
|
import Redirect from '@/layouts/redirect.vue';
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
routes: [
|
routes: [
|
||||||
@@ -71,12 +72,27 @@ const router = createRouter({
|
|||||||
},
|
},
|
||||||
component: () => import('@/views/Survey/views/Preview/Index.vue')
|
component: () => import('@/views/Survey/views/Preview/Index.vue')
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/publish',
|
path: '/publish',
|
||||||
name: 'publish',
|
name: 'publish',
|
||||||
meta: { title: '问卷投放' },
|
meta: { title: '问卷投放' },
|
||||||
component: () => import('../views/Survey/views/Publish/Index.vue')
|
component: () => import('../views/Survey/views/Publish/Index.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'intelligentGeneration',
|
||||||
|
name: 'intelligentGeneration',
|
||||||
|
meta: {
|
||||||
|
title: '智能创建'
|
||||||
|
},
|
||||||
|
component: () =>
|
||||||
|
import(
|
||||||
|
'@/views/Home/components/CreateSurvey/components/IntelligentGeneration/Index.vue'
|
||||||
|
)
|
||||||
|
}, {
|
||||||
|
path: '/search',
|
||||||
|
name: 'search',
|
||||||
|
meta: {},
|
||||||
|
component: () => import("@/views/HomeSearch/Index.vue")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
36
src/stores/piniaStore/survey.ts
Normal file
36
src/stores/piniaStore/survey.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
|
export const useSurveyStore = defineStore('survey', () => {
|
||||||
|
const questions = ref<string[]>([]);
|
||||||
|
const answers = ref<Record<string, string>>({});
|
||||||
|
|
||||||
|
const totalQuestions = computed(() => questions.value.length);
|
||||||
|
const answeredCount = computed(() => Object.keys(answers.value).length);
|
||||||
|
const isComplete = computed(() => answeredCount.value === totalQuestions.value);
|
||||||
|
|
||||||
|
function addQuestion(question: string) {
|
||||||
|
questions.value.push(question);
|
||||||
|
}
|
||||||
|
|
||||||
|
function answerQuestion(question: string, answer: string) {
|
||||||
|
if (questions.value.includes(question)) {
|
||||||
|
answers.value[question] = answer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetSurvey() {
|
||||||
|
answers.value = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
questions,
|
||||||
|
answers,
|
||||||
|
totalQuestions,
|
||||||
|
answeredCount,
|
||||||
|
isComplete,
|
||||||
|
addQuestion,
|
||||||
|
answerQuestion,
|
||||||
|
resetSurvey,
|
||||||
|
};
|
||||||
|
});
|
||||||
@@ -4,7 +4,7 @@ import { showToast } from 'vant';
|
|||||||
// import router from '@/router/index';
|
// import router from '@/router/index';
|
||||||
// import { A_COMMON_CLEAR_TOKEN } from '@/stores/constance/constance.common.js';
|
// import { A_COMMON_CLEAR_TOKEN } from '@/stores/constance/constance.common.js';
|
||||||
|
|
||||||
import * as config from '@/config.js';
|
import * as config from '@/config';
|
||||||
// import {proxyUrl} from config.default
|
// import {proxyUrl} from config.default
|
||||||
// const NODE_ENV = import.meta.env.VITE_APP_ENV;
|
// const NODE_ENV = import.meta.env.VITE_APP_ENV;
|
||||||
const baseURL = config.default.proxyUrl;
|
const baseURL = config.default.proxyUrl;
|
||||||
@@ -25,7 +25,14 @@ service.interceptors.request.use(
|
|||||||
if (!config.headers) {
|
if (!config.headers) {
|
||||||
config.headers.Accept = 'application/json';
|
config.headers.Accept = 'application/json';
|
||||||
}
|
}
|
||||||
config.headers.Authorization = `${localStorage.getItem('plantToken')}`;
|
let plantToken = localStorage.getItem('plantToken');
|
||||||
|
// 如果 token 不存在, 试图尝试让用户输入 token ,然后放入本地 token 内容中
|
||||||
|
// 仅限开发环境中
|
||||||
|
if (!plantToken && !import.meta.env.PROD) {
|
||||||
|
plantToken = prompt('token 不存在,请输入 plant token');
|
||||||
|
localStorage.setItem('plantToken');
|
||||||
|
}
|
||||||
|
config.headers.Authorization = `${plantToken}`;
|
||||||
config.headers.Source = 1;
|
config.headers.Source = 1;
|
||||||
// if (!config.headers.remoteIp) {
|
// if (!config.headers.remoteIp) {
|
||||||
// config.baseURL += '/api';
|
// config.baseURL += '/api';
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { showFailToast } from 'vant';
|
|||||||
import appBridge from '@/assets/js/appBridge';
|
import appBridge from '@/assets/js/appBridge';
|
||||||
import ImageSlider from './components/ImageSlider/Index.vue';
|
import ImageSlider from './components/ImageSlider/Index.vue';
|
||||||
import MineTask from '@/views/Home/components/MineTask/Index.vue';
|
import MineTask from '@/views/Home/components/MineTask/Index.vue';
|
||||||
|
import Navigation from "@/components/Navigation/Index.vue"
|
||||||
|
|
||||||
const contentShow = ref(false);
|
const contentShow = ref(false);
|
||||||
|
|
||||||
@@ -50,11 +51,13 @@ onMounted(async () => {
|
|||||||
<!-- 最新问卷 -->
|
<!-- 最新问卷 -->
|
||||||
<!--<last-survey/>-->
|
<!--<last-survey/>-->
|
||||||
<!-- 模板市场 -->
|
<!-- 模板市场 -->
|
||||||
<!-- <Market />-->
|
<Market/>
|
||||||
<!--底部新建问卷-->
|
<!--底部新建问卷-->
|
||||||
<NewSurvey/>
|
<NewSurvey/>
|
||||||
|
|
||||||
<mine-task/>
|
<mine-task/>
|
||||||
|
|
||||||
|
<navigation/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ onMounted(() => {
|
|||||||
<img :src="homePen" alt="" />
|
<img :src="homePen" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="surveys">
|
<div class="surveys">
|
||||||
|
<div @click="$router.push({ name: 'intelligentGeneration' })">AI 智能创建</div>
|
||||||
<div
|
<div
|
||||||
v-for="survey in surveys"
|
v-for="survey in surveys"
|
||||||
:key="survey.title"
|
:key="survey.title"
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const url =
|
||||||
|
'https://yiligpt.x.digitalyili.com/aiagent/assistant/78907182-cc42-4072-abae-86ef67c1ecd3/share?token=123123&source=app';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<iframe style="height: 100%; width: 100%" :src="url" frameborder="0"></iframe>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
@@ -6,7 +6,9 @@
|
|||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-icon :size="24" color="#409EFF"><DataAnalysis /></el-icon>
|
<el-icon :size="24" color="#409EFF">
|
||||||
|
<DataAnalysis />
|
||||||
|
</el-icon>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="20">
|
<el-col :span="20">
|
||||||
<h3>{{ item.title }}</h3>
|
<h3>{{ item.title }}</h3>
|
||||||
@@ -18,8 +20,6 @@
|
|||||||
</el-carousel-item>
|
</el-carousel-item>
|
||||||
</el-carousel>
|
</el-carousel>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { ref, useTemplateRef } from 'vue';
|
import { ref, useTemplateRef } from 'vue';
|
||||||
import { showToast } from 'vant';
|
import { showToast } from 'vant';
|
||||||
import { useSetPieChart } from '@/hooks/chart/usePieChart';
|
import { useSetPieChart } from '@/hooks/chart/usePieChart';
|
||||||
|
import { getSurveysPage } from "@/api/home"
|
||||||
// 饼图 dom 结构
|
// 饼图 dom 结构
|
||||||
const pieChart = useTemplateRef<HTMLSpanElement>('pieChart');
|
const pieChart = useTemplateRef<HTMLSpanElement>('pieChart');
|
||||||
|
|
||||||
@@ -24,10 +24,26 @@ const taskData = ref({
|
|||||||
|
|
||||||
// 图表数据
|
// 图表数据
|
||||||
const chartData = ref([
|
const chartData = ref([
|
||||||
{ name: '选项1', value: 66.77, color: '#F56C6C' },
|
{
|
||||||
{ name: '选项2', value: 33.33, color: '#F7BA2A' },
|
name: '选项1',
|
||||||
{ name: '选项3', value: 0, color: '#67C23A' },
|
value: 66.77,
|
||||||
{ name: '选项4', value: 0, color: '#409EFF' }
|
color: '#F56C6C'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '选项2',
|
||||||
|
value: 33.33,
|
||||||
|
color: '#F7BA2A'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '选项3',
|
||||||
|
value: 0,
|
||||||
|
color: '#67C23A'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '选项4',
|
||||||
|
value: 0,
|
||||||
|
color: '#409EFF'
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 导航按钮点击事件
|
// 导航按钮点击事件
|
||||||
@@ -38,6 +54,14 @@ const handlePrev = () => {
|
|||||||
const handleNext = () => {
|
const handleNext = () => {
|
||||||
showToast('点击了下一个问题');
|
showToast('点击了下一个问题');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getSurveysPage({
|
||||||
|
page: 1,
|
||||||
|
per_page: 3,
|
||||||
|
group_id: 0
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="new_survey">
|
<div class="new_survey">
|
||||||
|
<div v-if="$route.name !== 'home'">
|
||||||
<van-button type="primary" block color="#70B937" @click="create">
|
<van-button type="primary" block color="#70B937" @click="create">
|
||||||
<span class="fw-bold">+</span> 新建问卷
|
<span class="fw-bold">+</span> 新建问卷
|
||||||
</van-button>
|
</van-button>
|
||||||
@@ -7,9 +8,17 @@
|
|||||||
<create-question :createdNewPage="false"></create-question>
|
<create-question :createdNewPage="false"></create-question>
|
||||||
</van-popup>
|
</van-popup>
|
||||||
</div>
|
</div>
|
||||||
|
<navigation/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import CreateQuestion from '@/views/Home/components/CreateSurvey/CreateQuestion.vue';
|
import CreateQuestion from '@/views/Home/components/CreateSurvey/CreateQuestion.vue';
|
||||||
|
import Navigation from "@/components/Navigation/Index.vue"
|
||||||
|
import {useRoute } from "vue-router"
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
console.log(route.name)
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
function create() {
|
function create() {
|
||||||
show.value = true;
|
show.value = true;
|
||||||
|
|||||||
60
src/views/HomeSearch/Index.vue
Normal file
60
src/views/HomeSearch/Index.vue
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import Search from '@/components/Search/Index.vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
|
interface SearchItem {
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const searchResult = ref<SearchItem[]>([])
|
||||||
|
|
||||||
|
const searchMethod = (value: string) => {
|
||||||
|
if (!value.trim()) {
|
||||||
|
ElMessage.warning('请输入搜索关键词')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 这里模拟搜索结果,实际应用中应该调用 API
|
||||||
|
searchResult.value = [
|
||||||
|
{ id: 1, name: `搜索结果1: ${value}` },
|
||||||
|
{ id: 2, name: `搜索结果2: ${value}` },
|
||||||
|
{ id: 3, name: `搜索结果3: ${value}` }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const emitCancel = () => {
|
||||||
|
searchResult.value = []
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section>
|
||||||
|
<Search
|
||||||
|
placeholder="请输入搜索关键词"
|
||||||
|
@search="searchMethod"
|
||||||
|
@cancel="emitCancel"
|
||||||
|
show-action
|
||||||
|
/>
|
||||||
|
<div class="search-result">
|
||||||
|
<div class="search-result-item" v-for="item in searchResult" :key="item.id">
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.search-result {
|
||||||
|
padding: 16px;
|
||||||
|
|
||||||
|
&-item {
|
||||||
|
padding: 12px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
<b v-html="item.project_name"></b>
|
<b v-html="item.project_name"></b>
|
||||||
</el-text>
|
</el-text>
|
||||||
<el-text>{{ item.answer_num }}份</el-text>
|
<el-text>{{ item.answer_num }}份</el-text>
|
||||||
|
<el-text size="small" v-if=item.is_time>{{`${item.start_time} 至 ${item.end_time ?? '无限期'}`}}</el-text>
|
||||||
</div>
|
</div>
|
||||||
<div class="survey_item_info_status">
|
<div class="survey_item_info_status">
|
||||||
<el-space spacer="|">
|
<el-space spacer="|">
|
||||||
@@ -64,7 +65,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--问卷描述-->
|
<!--问卷描述-->
|
||||||
<div v-if="item.introduction">
|
<div v-if="item.introduction">
|
||||||
<div v-html="item.introduction" class="survey_item_info_desc"></div>
|
<!--<div v-html="item.introduction" class="survey_item_info_desc"></div>-->
|
||||||
|
<section>
|
||||||
|
<el-text size="small" >回收数量</el-text>
|
||||||
|
{{item.answer_num}}
|
||||||
|
</section>
|
||||||
|
<section >
|
||||||
|
<el-text size="small">回收数量进度</el-text>
|
||||||
|
{{item.recycle_progress}}
|
||||||
|
</section>
|
||||||
|
<section >
|
||||||
|
<el-text size="small">投放时间进度 </el-text>
|
||||||
|
{{ item.recycle_time }}
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- action 功能位置 -->
|
<!-- action 功能位置 -->
|
||||||
|
|||||||
0
src/views/UserSpace/Index.vue
Normal file
0
src/views/UserSpace/Index.vue
Normal file
Reference in New Issue
Block a user