diff --git a/src/app.config.ts b/src/app.config.ts index 1fb8a38..e510941 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -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问答", diff --git a/src/app.scss b/src/app.scss index 85f0cbf..46e83e0 100644 --- a/src/app.scss +++ b/src/app.scss @@ -156,3 +156,8 @@ button[open-type="chooseAvatar"] { } } } + +taro-rich-text-core[space]{ + white-space: normal !important; + line-height: 1.8; +} diff --git a/src/components/TabBar.tsx b/src/components/TabBar.tsx index a3b3dfe..31860b9 100644 --- a/src/components/TabBar.tsx +++ b/src/components/TabBar.tsx @@ -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'}) diff --git a/src/expert/index.config.ts b/src/expert/index.config.ts new file mode 100644 index 0000000..3118acd --- /dev/null +++ b/src/expert/index.config.ts @@ -0,0 +1,5 @@ +export default definePageConfig({ + navigationBarTitleText: '老兵风采', + navigationBarBackgroundColor: '#d32f2f', + navigationBarTextStyle: 'white' +}) diff --git a/src/expert/index.scss b/src/expert/index.scss new file mode 100644 index 0000000..da2819e --- /dev/null +++ b/src/expert/index.scss @@ -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; + } + } + } + } + } +} diff --git a/src/expert/index.tsx b/src/expert/index.tsx new file mode 100644 index 0000000..17a051f --- /dev/null +++ b/src/expert/index.tsx @@ -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() + const [childCategory, setChildCategory] = useState([]) + const [list, setList] = useState([]) + + 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 ( + <> +
+ +
+
+
+ { + // 子级栏目 + childCategory.map((item, index) => { + return ( +
Taro.navigateTo({url: `./index?id=${item.navigationId}`})} + > + {/* 图片容器 */} +
+ {item.title +
+
+ ) + }) + } +
+
+ { + // 终极文章列表 + list.map((item, index) => { + return ( +
Taro.navigateTo({url: `./detail?id=${item.articleId}`})} + > + {/* 图片容器 */} +
+ {item.title +
+ {/* 标题 */} +
+ {item.title} +
+
+ ) + }) + } +
+
+ + ) +} +export default Index diff --git a/src/pages/study/study.config.ts b/src/pages/study/study.config.ts deleted file mode 100644 index 5a4c284..0000000 --- a/src/pages/study/study.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: 'AI问答' -}) diff --git a/src/pages/study/study.tsx b/src/pages/study/study.tsx deleted file mode 100644 index a0e978d..0000000 --- a/src/pages/study/study.tsx +++ /dev/null @@ -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 ( - <> - - - ) -} -export default Study diff --git a/src/utils/server.ts b/src/utils/server.ts index 06bd3db..8eb03d4 100644 --- a/src/utils/server.ts +++ b/src/utils/server.ts @@ -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