16 changed files with 882 additions and 194 deletions
@ -0,0 +1,312 @@ |
|||
<template> |
|||
<div class="law-query-page"> |
|||
<!-- 顶部导航栏 --> |
|||
<van-nav-bar title="法律查询" left-text="关闭" left-arrow @click-left="onClickLeft"> |
|||
</van-nav-bar> |
|||
|
|||
<!-- 内容区域 --> |
|||
<div class="content-area"> |
|||
<!-- 搜索框 --> |
|||
<div class="search-section"> |
|||
<van-search |
|||
v-model="searchKeyword" |
|||
placeholder="请输入关键词搜索" |
|||
show-action |
|||
@search="onSearch" |
|||
> |
|||
<template #action> |
|||
<van-button size="small" type="primary" @click="onSearch">搜索</van-button> |
|||
</template> |
|||
</van-search> |
|||
</div> |
|||
|
|||
<!-- 法律分类 --> |
|||
<div class="category-section"> |
|||
<div class="section-title">法律分类</div> |
|||
<div class="category-grid"> |
|||
<div |
|||
class="category-item" |
|||
v-for="(item, index) in categoryList" |
|||
:key="index" |
|||
@click="onCategoryClick(item)" |
|||
> |
|||
<div class="category-icon" :class="item.iconBg"> |
|||
<img :src="item.icon" alt="" /> |
|||
</div> |
|||
<div class="category-name">{{ item.name }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 常用法律 --> |
|||
<div class="law-section"> |
|||
<div class="section-title">常用法律</div> |
|||
<van-cell-group> |
|||
<van-cell |
|||
v-for="(law, index) in lawList" |
|||
:key="index" |
|||
:title="law.title" |
|||
:label="law.desc" |
|||
is-link |
|||
@click="onLawClick(law)" |
|||
/> |
|||
</van-cell-group> |
|||
</div> |
|||
|
|||
<!-- 法律知识问答 --> |
|||
<div class="qa-section"> |
|||
<div class="section-title">法律知识问答</div> |
|||
<div class="qa-list"> |
|||
<div |
|||
class="qa-item" |
|||
v-for="(qa, index) in qaList" |
|||
:key="index" |
|||
@click="onQaClick(qa)" |
|||
> |
|||
<div class="qa-question">{{ qa.question }}</div> |
|||
<div class="qa-answer">{{ qa.answer }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 底部导航栏 --> |
|||
<div class="footer_body"> |
|||
<footer-nav></footer-nav> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup name="lawQuery"> |
|||
import { ref } from 'vue'; |
|||
import { showToast } from 'vant'; |
|||
import 'vant/es/toast/style'; |
|||
|
|||
const router = useRouter(); |
|||
|
|||
// 搜索关键词 |
|||
const searchKeyword = ref(''); |
|||
|
|||
// 法律分类列表 |
|||
const categoryList = ref([ |
|||
{ name: '宪法', icon: '', iconBg: 'icon-red' }, |
|||
{ name: '民法', icon: '', iconBg: 'icon-blue' }, |
|||
{ name: '刑法', icon: '', iconBg: 'icon-green' }, |
|||
{ name: '行政法', icon: '', iconBg: 'icon-orange' }, |
|||
{ name: '经济法', icon: '', iconBg: 'icon-purple' }, |
|||
{ name: '劳动法', icon: '', iconBg: 'icon-yellow' }, |
|||
{ name: '商法', icon: '', iconBg: 'icon-pink' }, |
|||
{ name: '诉讼法', icon: '', iconBg: 'icon-cyan' }, |
|||
]); |
|||
|
|||
// 常用法律列表 |
|||
const lawList = ref([ |
|||
{ title: '中华人民共和国宪法', desc: '国家根本大法' }, |
|||
{ title: '中华人民共和国民法典', desc: '社会生活的百科全书' }, |
|||
{ title: '中华人民共和国刑法', desc: '规定犯罪与刑罚' }, |
|||
{ title: '中华人民共和国行政法', desc: '规范行政行为' }, |
|||
{ title: '中华人民共和国劳动法', desc: '保护劳动者权益' }, |
|||
]); |
|||
|
|||
// 法律知识问答列表 |
|||
const qaList = ref([ |
|||
{ |
|||
question: '什么是行政处罚?', |
|||
answer: '行政处罚是指行政机关依法对违反行政管理秩序的公民、法人或者其他组织,以减损权益或者增加义务的方式予以惩戒的行为。' |
|||
}, |
|||
{ |
|||
question: '企业需要遵守哪些法律法规?', |
|||
answer: '企业需要遵守公司法、劳动法、税法、环境保护法、安全生产法等相关法律法规。' |
|||
}, |
|||
{ |
|||
question: '什么是行政复议?', |
|||
answer: '行政复议是指公民、法人或者其他组织认为具体行政行为侵犯其合法权益,向行政机关提出行政复议申请,行政机关受理并作出决定的活动。' |
|||
}, |
|||
]); |
|||
|
|||
// 返回上一页 |
|||
const onClickLeft = () => { |
|||
router.back(); |
|||
}; |
|||
|
|||
// 搜索 |
|||
const onSearch = () => { |
|||
if (!searchKeyword.value.trim()) { |
|||
showToast('请输入搜索关键词'); |
|||
return; |
|||
} |
|||
showToast(`搜索:${searchKeyword.value}`); |
|||
}; |
|||
|
|||
// 点击分类 |
|||
const onCategoryClick = (item) => { |
|||
showToast(`选择分类:${item.name}`); |
|||
}; |
|||
|
|||
// 点击法律 |
|||
const onLawClick = (law) => { |
|||
showToast(`查看:${law.title}`); |
|||
}; |
|||
|
|||
// 点击问答 |
|||
const onQaClick = (qa) => { |
|||
showToast('查看详情'); |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
.law-query-page { |
|||
display: flex; |
|||
flex-direction: column; |
|||
height: 100%; |
|||
background: #f5f7fa; |
|||
} |
|||
|
|||
.content-area { |
|||
flex: 1; |
|||
overflow-y: auto; |
|||
padding: 0.27rem; |
|||
padding-bottom: 1.5rem; |
|||
} |
|||
|
|||
/* ===== 搜索区域 ===== */ |
|||
.search-section { |
|||
background: #fff; |
|||
border-radius: 0.2rem; |
|||
padding: 0.2rem; |
|||
margin-bottom: 0.27rem; |
|||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); |
|||
} |
|||
|
|||
/* ===== 分类区域 ===== */ |
|||
.category-section { |
|||
background: #fff; |
|||
border-radius: 0.2rem; |
|||
padding: 0.3rem; |
|||
margin-bottom: 0.27rem; |
|||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); |
|||
} |
|||
|
|||
.section-title { |
|||
font-size: 0.37rem; |
|||
font-weight: 600; |
|||
color: #333; |
|||
margin-bottom: 0.25rem; |
|||
padding-left: 0.1rem; |
|||
} |
|||
|
|||
.category-grid { |
|||
display: grid; |
|||
grid-template-columns: repeat(4, 1fr); |
|||
gap: 0.2rem; |
|||
} |
|||
|
|||
.category-item { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
padding: 0.25rem 0; |
|||
} |
|||
|
|||
.category-icon { |
|||
width: 1.2rem; |
|||
height: 1.2rem; |
|||
border-radius: 50%; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
margin-bottom: 0.15rem; |
|||
background: #f0f0f0; |
|||
} |
|||
|
|||
.category-icon img { |
|||
width: 0.6rem; |
|||
height: 0.6rem; |
|||
} |
|||
|
|||
.icon-red { background: #ffebee; } |
|||
.icon-blue { background: #e3f2fd; } |
|||
.icon-green { background: #e8f5e9; } |
|||
.icon-orange { background: #fff3e0; } |
|||
.icon-purple { background: #f3e5f5; } |
|||
.icon-yellow { background: #fffde7; } |
|||
.icon-pink { background: #fce4ec; } |
|||
.icon-cyan { background: #e0f7fa; } |
|||
|
|||
.category-name { |
|||
font-size: 0.28rem; |
|||
color: #666; |
|||
text-align: center; |
|||
} |
|||
|
|||
/* ===== 法律列表 ===== */ |
|||
.law-section { |
|||
background: #fff; |
|||
border-radius: 0.2rem; |
|||
padding: 0.3rem; |
|||
margin-bottom: 0.27rem; |
|||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); |
|||
} |
|||
|
|||
:deep(.van-cell) { |
|||
font-size: 0.32rem; |
|||
padding: 0.25rem 0; |
|||
border-bottom: 1px solid #f5f5f5; |
|||
|
|||
&:last-child { |
|||
border-bottom: none; |
|||
} |
|||
} |
|||
|
|||
:deep(.van-cell__title) { |
|||
font-size: 0.34rem; |
|||
color: #333; |
|||
} |
|||
|
|||
:deep(.van-cell__label) { |
|||
font-size: 0.28rem; |
|||
color: #999; |
|||
} |
|||
|
|||
/* ===== 问答区域 ===== */ |
|||
.qa-section { |
|||
background: #fff; |
|||
border-radius: 0.2rem; |
|||
padding: 0.3rem; |
|||
margin-bottom: 0.27rem; |
|||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); |
|||
} |
|||
|
|||
.qa-list { |
|||
.qa-item { |
|||
padding: 0.25rem 0; |
|||
border-bottom: 1px solid #f5f5f5; |
|||
|
|||
&:last-child { |
|||
border-bottom: none; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.qa-question { |
|||
font-size: 0.34rem; |
|||
color: #333; |
|||
font-weight: 500; |
|||
margin-bottom: 0.1rem; |
|||
} |
|||
|
|||
.qa-answer { |
|||
font-size: 0.3rem; |
|||
color: #999; |
|||
line-height: 1.6; |
|||
display: -webkit-box; |
|||
-webkit-line-clamp: 2; |
|||
-webkit-box-orient: vertical; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
/* ===== 底部导航 ===== */ |
|||
.footer_body { |
|||
flex-shrink: 0; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue