框架整理完毕

This commit is contained in:
2025-07-08 15:12:54 +08:00
parent da00ee707a
commit 38f67616fc
9 changed files with 316 additions and 30 deletions

View File

@@ -3,7 +3,7 @@ export default defineAppConfig({
'pages/index/index',
'pages/kefu/kefu',
'pages/user/user',
'pages/study/study',
'pages/ai/index',
'pages/page/index'
],
"subpackages": [
@@ -49,6 +49,12 @@ export default defineAppConfig({
"detail"
]
},
{
"root": "expert",
"pages": [
"index"
]
},
],
window: {
backgroundTextStyle: 'dark',
@@ -69,7 +75,7 @@ export default defineAppConfig({
text: "首页",
},
{
pagePath: "pages/study/study",
pagePath: "pages/ai/index",
iconPath: "assets/tabbar/order.png",
selectedIconPath: "assets/tabbar/order-active.png",
text: "AI问答",

View File

@@ -156,3 +156,8 @@ button[open-type="chooseAvatar"] {
}
}
}
taro-rich-text-core[space]{
white-space: normal !important;
line-height: 1.8;
}

View File

@@ -12,7 +12,7 @@ function TabBar() {
Taro.switchTab({url: '/pages/index/index'})
}
if (index == 1) {
Taro.switchTab({url: '/pages/study/study'})
Taro.switchTab({url: '/pages/ai/index'})
}
if (index == 2) {
Taro.switchTab({url: '/pages/user/user'})

View File

@@ -0,0 +1,5 @@
export default definePageConfig({
navigationBarTitleText: '老兵风采',
navigationBarBackgroundColor: '#d32f2f',
navigationBarTextStyle: 'white'
})

186
src/expert/index.scss Normal file
View File

@@ -0,0 +1,186 @@
.veteran-page {
min-height: 100vh;
background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
.hero-section {
position: relative;
padding: 40px 20px 60px;
background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
overflow: hidden;
.hero-content {
position: relative;
z-index: 2;
text-align: center;
.hero-title {
font-size: 28px;
font-weight: bold;
color: #fff;
margin-bottom: 20px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.hero-subtitle {
font-size: 14px;
line-height: 1.6;
color: rgba(255, 255, 255, 0.9);
margin: 0 auto;
max-width: 320px;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
}
.hero-decoration {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
pointer-events: none;
.decoration-circle {
position: absolute;
top: -50px;
right: -50px;
width: 150px;
height: 150px;
border: 2px solid rgba(255, 255, 255, 0.1);
border-radius: 50%;
animation: rotate 20s linear infinite;
}
.decoration-star {
position: absolute;
bottom: 20px;
right: 30px;
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 10px solid rgba(255, 255, 255, 0.1);
transform: rotate(35deg);
&::before {
content: '';
position: absolute;
left: -15px;
top: 3px;
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 10px solid rgba(255, 255, 255, 0.1);
transform: rotate(-70deg);
}
}
}
}
.veteran-list {
padding: 20px 15px;
.veteran-card {
background: #fff;
border-radius: 12px;
margin-bottom: 15px;
padding: 20px;
display: flex;
align-items: flex-start;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
border: 2px solid #d32f2f;
transition: all 0.3s ease;
cursor: pointer;
&:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.veteran-avatar {
flex-shrink: 0;
margin-right: 15px;
.avatar-img {
width: 60px;
height: 60px;
border-radius: 50%;
object-fit: cover;
border: 3px solid #d32f2f;
background: #f5f5f5;
}
}
.veteran-info {
flex: 1;
.veteran-name {
font-size: 18px;
font-weight: bold;
color: #d32f2f;
margin: 0 0 8px 0;
}
.veteran-description {
font-size: 13px;
line-height: 1.5;
color: #666;
text-align: justify;
}
}
}
}
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* 响应式设计 */
@media (max-width: 375px) {
.veteran-page {
.hero-section {
padding: 30px 15px 50px;
.hero-content {
.hero-title {
font-size: 24px;
}
.hero-subtitle {
font-size: 13px;
}
}
}
.veteran-list {
padding: 15px 10px;
.veteran-card {
padding: 15px;
.veteran-avatar {
.avatar-img {
width: 50px;
height: 50px;
}
}
.veteran-info {
.veteran-name {
font-size: 16px;
}
.veteran-description {
font-size: 12px;
}
}
}
}
}
}

109
src/expert/index.tsx Normal file
View File

@@ -0,0 +1,109 @@
import {useEffect, useState} from "react";
import {pageCmsArticle} from "@/api/cms/cmsArticle";
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import Taro from '@tarojs/taro'
import {useRouter} from '@tarojs/taro'
import {Image} from '@nutui/nutui-react-taro'
import {getCmsNavigation, pageCmsNavigation} from "@/api/cms/cmsNavigation";
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
/**
* 文章终极列表
* @constructor
*/
const Index = () => {
const {params} = useRouter();
const [navigation, setNavigation] = useState<CmsNavigation>()
const [childCategory, setChildCategory] = useState<CmsNavigation[]>([])
const [list, setList] = useState<CmsArticle[]>([])
const reload = async () => {
// 获取栏目ID
const categoryId = Number(params.id);
// 当前栏目信息
const navs = await getCmsNavigation(categoryId);
// 二级栏目
const childCateogry = await pageCmsNavigation({parentId: categoryId});
// 终极新闻列表
const articles = await pageCmsArticle({categoryId});
// 当前栏目信息
if (navs) {
setNavigation(navs);
}
// 获取子级栏目
if (childCateogry) {
setChildCategory(childCateogry.list)
}
// 新闻列表
if (articles) {
setList(articles?.list || [])
}
}
useEffect(() => {
reload()
}, [])
return (
<>
<div style={{padding: navigation?.span + 'px'}}>
<Image src={navigation?.style} width={'100%'}
height={'auto'}/>
</div>
<div className={'bg-white rounded-lg py-3 px-2'}>
<div className={'grid grid-cols-2 gap-3'}>
{
// 子级栏目
childCategory.map((item, index) => {
return (
<div
key={index}
className={'flex flex-col justify-center items-center cursor-pointer'}
onClick={() => Taro.navigateTo({url: `./index?id=${item.navigationId}`})}
>
{/* 图片容器 */}
<div className={'w-full mb-2 flex justify-center bg-gray-50 rounded-lg'}>
<img
className={'object-cover rounded-lg'}
src={item.icon}
alt={item.title || ''}
/>
</div>
</div>
)
})
}
</div>
<div className={'grid grid-cols-3 gap-3'}>
{
// 终极文章列表
list.map((item, index) => {
return (
<div
key={index}
className={'flex flex-col items-center cursor-pointer my-1'}
onClick={() => Taro.navigateTo({url: `./detail?id=${item.articleId}`})}
>
{/* 图片容器 */}
<div className={'w-full mb-2 flex justify-center bg-gray-50 rounded-lg'}>
<img
className={'object-cover rounded-lg'}
src={item.image}
alt={item.title || ''}
/>
</div>
{/* 标题 */}
<div className={'text-xs text-center text-gray-800 leading-tight px-1'}>
{item.title}
</div>
</div>
)
})
}
</div>
</div>
</>
)
}
export default Index

View File

@@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: 'AI问答'
})

View File

@@ -1,24 +0,0 @@
import {useEffect} from "react";
import TabBar from "@/components/TabBar";
/**
* 文章终极列表
* @constructor
*/
const Study = () => {
const reload = async () => {
}
useEffect(() => {
reload().then(() => {
console.log('初始化完成')
})
}, [])
return (
<>
<TabBar/>
</>
)
}
export default Study

View File

@@ -6,6 +6,8 @@ export const TEMPLATE_ID = 10556;
// 服务接口
export const SERVER_API_URL = 'https://server.gxwebsoft.com/api';
// export const SERVER_API_URL = 'http://127.0.0.1:8000/api';
// 服务接口
export const APP_API_URL = 'http://127.0.0.1:9000/api';
/**
* 保存用户信息到本地存储
* @param token