diff --git a/src/app.config.ts b/src/app.config.ts index 51c4030..1fb8a38 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -3,7 +3,8 @@ export default defineAppConfig({ 'pages/index/index', 'pages/kefu/kefu', 'pages/user/user', - 'pages/study/study' + 'pages/study/study', + 'pages/page/index' ], "subpackages": [ { @@ -40,7 +41,14 @@ export default defineAppConfig({ "index", "detail" ] - } + }, + { + "root": "honor", + "pages": [ + "index", + "detail" + ] + }, ], window: { backgroundTextStyle: 'dark', @@ -51,7 +59,7 @@ export default defineAppConfig({ tabBar: { custom: false, color: "#8a8a8a", - selectedColor: "#9a23d4", + selectedColor: "#d81e06", backgroundColor: "#ffffff", list: [ { diff --git a/src/app.scss b/src/app.scss index c5ded95..d2cf1a5 100644 --- a/src/app.scss +++ b/src/app.scss @@ -7,7 +7,7 @@ @tailwind utilities; page{ - background-color: #f5f5f5; + background-color: #ffefef; background-repeat: no-repeat; background-size: 100%; background-position: bottom; diff --git a/src/app.ts b/src/app.ts index da26cd0..f0cd313 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,5 +1,5 @@ import {useEffect} from 'react' -import Taro from '@tarojs/taro' +// import Taro from '@tarojs/taro' import {useDidShow, useDidHide} from '@tarojs/taro' // 全局样式 @@ -12,7 +12,7 @@ function App(props) { // 对应 onShow useDidShow(() => { - Taro.hideTabBar() + // Taro.hideTabBar() }) // 对应 onHide diff --git a/src/assets/tabbar/home-active.png b/src/assets/tabbar/home-active.png index 9b4aec7..68b8131 100644 Binary files a/src/assets/tabbar/home-active.png and b/src/assets/tabbar/home-active.png differ diff --git a/src/assets/tabbar/home.png b/src/assets/tabbar/home.png index 12a12e8..bd05325 100644 Binary files a/src/assets/tabbar/home.png and b/src/assets/tabbar/home.png differ diff --git a/src/assets/tabbar/order-active.png b/src/assets/tabbar/order-active.png index 4aa1ea9..a20d4c8 100644 Binary files a/src/assets/tabbar/order-active.png and b/src/assets/tabbar/order-active.png differ diff --git a/src/assets/tabbar/order.png b/src/assets/tabbar/order.png index 4d306d2..897fdd1 100644 Binary files a/src/assets/tabbar/order.png and b/src/assets/tabbar/order.png differ diff --git a/src/assets/tabbar/shop-active.png b/src/assets/tabbar/shop-active.png deleted file mode 100644 index ed2cfc3..0000000 Binary files a/src/assets/tabbar/shop-active.png and /dev/null differ diff --git a/src/assets/tabbar/shop.png b/src/assets/tabbar/shop.png deleted file mode 100644 index 7b49930..0000000 Binary files a/src/assets/tabbar/shop.png and /dev/null differ diff --git a/src/assets/tabbar/store-active.png b/src/assets/tabbar/store-active.png deleted file mode 100644 index 86948d8..0000000 Binary files a/src/assets/tabbar/store-active.png and /dev/null differ diff --git a/src/assets/tabbar/store.png b/src/assets/tabbar/store.png deleted file mode 100644 index 0c5ae1c..0000000 Binary files a/src/assets/tabbar/store.png and /dev/null differ diff --git a/src/assets/tabbar/user-active.png b/src/assets/tabbar/user-active.png index e68a132..1284488 100644 Binary files a/src/assets/tabbar/user-active.png and b/src/assets/tabbar/user-active.png differ diff --git a/src/assets/tabbar/user.png b/src/assets/tabbar/user.png index 0cee24d..b1213a0 100644 Binary files a/src/assets/tabbar/user.png and b/src/assets/tabbar/user.png differ diff --git a/src/components/TabBar.tsx b/src/components/TabBar.tsx index 5f346ac..a3b3dfe 100644 --- a/src/components/TabBar.tsx +++ b/src/components/TabBar.tsx @@ -1,28 +1,35 @@ -import { Tabbar } from '@nutui/nutui-react-taro' -import { Home, User, Date } from '@nutui/icons-react-taro' +import {Tabbar} from '@nutui/nutui-react-taro' +import {Home, User, Date} from '@nutui/icons-react-taro' import Taro from '@tarojs/taro' -function TabBar(){ - return ( - { - console.log(index) - if(index == 0){ - Taro.switchTab({ url: '/pages/index/index' }) - } - if(index == 1){ - Taro.navigateTo({ url: '/pages/study/study' }) - } - if(index == 2){ - Taro.switchTab({ url: '/pages/user/user' }) - } - }} - > - } /> - } /> - } /> - - ) +function TabBar() { + return ( + { + console.log(index) + if (index == 0) { + Taro.switchTab({url: '/pages/index/index'}) + } + if (index == 1) { + Taro.switchTab({url: '/pages/study/study'}) + } + if (index == 2) { + Taro.switchTab({url: '/pages/user/user'}) + } + }} + style={{ + display: 'none', + zIndex: 100, + backgroundColor: '#fff', + boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)', + }} + > + }/> + }/> + }/> + + ) } + export default TabBar; diff --git a/src/honor/detail.config.ts b/src/honor/detail.config.ts new file mode 100644 index 0000000..349c0e2 --- /dev/null +++ b/src/honor/detail.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '详情', + navigationBarBackgroundColor: '#ffe0e0' +}) diff --git a/src/honor/detail.scss b/src/honor/detail.scss new file mode 100644 index 0000000..94aed36 --- /dev/null +++ b/src/honor/detail.scss @@ -0,0 +1,128 @@ +.content { + padding: 32px; + line-height: 2.4rem; + + // 富文本内容样式 + :global { + // 段落样式 + p { + margin: 16px 0; + line-height: 1.8; + text-align: justify; + } + + // 标题样式 + h1, h2, h3, h4, h5, h6 { + margin: 24px 0 16px 0; + font-weight: bold; + line-height: 1.4; + } + + h1 { font-size: 24px; } + h2 { font-size: 22px; } + h3 { font-size: 20px; } + h4 { font-size: 18px; } + h5 { font-size: 16px; } + h6 { font-size: 14px; } + + // 图片样式 + img { + max-width: 100%; + height: auto; + border-radius: 8px; + margin: 16px 0; + display: block; + } + + // 列表样式 + ul, ol { + margin: 16px 0; + padding-left: 24px; + + li { + margin: 8px 0; + line-height: 1.6; + } + } + + // 引用样式 + blockquote { + margin: 16px 0; + padding: 16px; + background-color: #f5f5f5; + border-left: 4px solid #ddd; + border-radius: 4px; + + p { + margin: 0; + font-style: italic; + } + } + + // 代码样式 + code { + background-color: #f5f5f5; + padding: 2px 6px; + border-radius: 4px; + font-family: 'Courier New', monospace; + font-size: 14px; + } + + pre { + background-color: #f5f5f5; + padding: 16px; + border-radius: 8px; + overflow-x: auto; + margin: 16px 0; + + code { + background: none; + padding: 0; + } + } + + // 表格样式 + table { + width: 100%; + border-collapse: collapse; + margin: 16px 0; + + th, td { + border: 1px solid #ddd; + padding: 12px; + text-align: left; + } + + th { + background-color: #f5f5f5; + font-weight: bold; + } + } + + // 链接样式 + a { + color: #1890ff; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } + + // 分割线样式 + hr { + margin: 24px 0; + border: none; + border-top: 1px solid #eee; + } + + // 强调样式 + strong, b { + font-weight: bold; + } + + em, i { + font-style: italic; + } + } +} diff --git a/src/honor/detail.tsx b/src/honor/detail.tsx new file mode 100644 index 0000000..1fa7125 --- /dev/null +++ b/src/honor/detail.tsx @@ -0,0 +1,52 @@ +import {useEffect, useState} from 'react' +import {Tag} from '@nutui/nutui-react-taro' +import {useRouter} from '@tarojs/taro' +import {Divider} from '@nutui/nutui-react-taro' +import {CmsArticle} from "@/api/cms/cmsArticle/model" +import {Eye} from '@nutui/icons-react-taro' +// 显示html富文本 +import {View, RichText} from '@tarojs/components' +import './detail.scss' +import Line from "@/components/Gap"; +import {getCmsArticle} from "@/api/cms/cmsArticle"; + +function Detail() { + const {params} = useRouter(); + // 文章详情 + const [item, setItem] = useState() + // 浏览量 + const [views, setViews] = useState() + + const reload = () => { + getCmsArticle(Number(params.id)).then(data => { + if (data) { + setItem(data) + setViews(data.actualViews) + } + }) + } + + useEffect(() => { + reload(); + }, []); + + return ( +
+
{item?.title}
+
+ {item?.categoryName} +
{views}
+
+ + + + + +
+ ) +} + +export default Detail diff --git a/src/honor/index.config.ts b/src/honor/index.config.ts new file mode 100644 index 0000000..d3c99ed --- /dev/null +++ b/src/honor/index.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '图文列表' +}) diff --git a/src/honor/index.tsx b/src/honor/index.tsx new file mode 100644 index 0000000..bda112f --- /dev/null +++ b/src/honor/index.tsx @@ -0,0 +1,86 @@ +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} from "@/api/cms/cmsNavigation"; +import {CmsNavigation} from "@/api/cms/cmsNavigation/model"; + +/** + * 文章终极列表 + * @constructor + */ +const Index = () => { + const {params} = useRouter(); + const [navigation, setNavigation] = useState() + const [list, setList] = useState([]) + + const reload = async () => { + // 获取栏目ID + const categoryId = Number(params.id); + // 当前栏目信息 + const navs = await getCmsNavigation(categoryId); + // 终极新闻列表 + const articles = await pageCmsArticle({categoryId}); + + // 当前栏目信息 + if (navs) { + setNavigation(navs); + } + // 新闻列表 + if (articles) { + setList(articles?.list || []) + } + } + + useEffect(() => { + reload() + }, []) + + return ( + <> +
+ +
+
+ { + // 终极文章列表 + list.map((item, index) => { + return ( +
Taro.navigateTo({url: `./detail?id=${item.articleId}`})} + > + {/* 标题 */} +
+ A {item.title} +
+
+ ) + }) + } +
+ + ) +} +export default Index diff --git a/src/pages/index/index.scss b/src/pages/index/index.scss index 0a07e09..75a631d 100644 --- a/src/pages/index/index.scss +++ b/src/pages/index/index.scss @@ -3,7 +3,7 @@ page { .mobile-container { width: 100%; - min-height: 100vh; + min-height: 90vh; // PC端样式 //@media screen and (min-width: 768px) { diff --git a/src/pages/page/index.scss b/src/pages/page/index.scss new file mode 100644 index 0000000..94aed36 --- /dev/null +++ b/src/pages/page/index.scss @@ -0,0 +1,128 @@ +.content { + padding: 32px; + line-height: 2.4rem; + + // 富文本内容样式 + :global { + // 段落样式 + p { + margin: 16px 0; + line-height: 1.8; + text-align: justify; + } + + // 标题样式 + h1, h2, h3, h4, h5, h6 { + margin: 24px 0 16px 0; + font-weight: bold; + line-height: 1.4; + } + + h1 { font-size: 24px; } + h2 { font-size: 22px; } + h3 { font-size: 20px; } + h4 { font-size: 18px; } + h5 { font-size: 16px; } + h6 { font-size: 14px; } + + // 图片样式 + img { + max-width: 100%; + height: auto; + border-radius: 8px; + margin: 16px 0; + display: block; + } + + // 列表样式 + ul, ol { + margin: 16px 0; + padding-left: 24px; + + li { + margin: 8px 0; + line-height: 1.6; + } + } + + // 引用样式 + blockquote { + margin: 16px 0; + padding: 16px; + background-color: #f5f5f5; + border-left: 4px solid #ddd; + border-radius: 4px; + + p { + margin: 0; + font-style: italic; + } + } + + // 代码样式 + code { + background-color: #f5f5f5; + padding: 2px 6px; + border-radius: 4px; + font-family: 'Courier New', monospace; + font-size: 14px; + } + + pre { + background-color: #f5f5f5; + padding: 16px; + border-radius: 8px; + overflow-x: auto; + margin: 16px 0; + + code { + background: none; + padding: 0; + } + } + + // 表格样式 + table { + width: 100%; + border-collapse: collapse; + margin: 16px 0; + + th, td { + border: 1px solid #ddd; + padding: 12px; + text-align: left; + } + + th { + background-color: #f5f5f5; + font-weight: bold; + } + } + + // 链接样式 + a { + color: #1890ff; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } + + // 分割线样式 + hr { + margin: 24px 0; + border: none; + border-top: 1px solid #eee; + } + + // 强调样式 + strong, b { + font-weight: bold; + } + + em, i { + font-style: italic; + } + } +} diff --git a/src/pages/page/index.tsx b/src/pages/page/index.tsx new file mode 100644 index 0000000..6f31700 --- /dev/null +++ b/src/pages/page/index.tsx @@ -0,0 +1,47 @@ +import {useEffect, useState} from 'react' +import {useRouter} from '@tarojs/taro' +import {Divider} from '@nutui/nutui-react-taro' +import {CmsArticle} from "@/api/cms/cmsArticle/model" +// 显示html富文本 +import {View, RichText} from '@tarojs/components' +import './index.scss' +import {getCmsNavigation} from "@/api/cms/cmsNavigation"; + +function Detail() { + const {params} = useRouter(); + // 文章详情 + const [item, setItem] = useState() + // 正文 + const [content, setContent] = useState('') + + const reload = async () => { + const nav = await getCmsNavigation(Number(params.id)); + if(nav){ + setItem(nav) + } + if(nav.design?.content){ + setContent(nav.design?.content) + } + } + + useEffect(() => { + reload().then(); + }, []); + + return ( +
+
+
{item?.title}
+ + + + +
+
+ ) +} + +export default Detail diff --git a/src/pages/user/components/UserCard.tsx b/src/pages/user/components/UserCard.tsx index f1f00a8..a88c097 100644 --- a/src/pages/user/components/UserCard.tsx +++ b/src/pages/user/components/UserCard.tsx @@ -1,112 +1,79 @@ -import {Button} from '@nutui/nutui-react-taro' import {Avatar, Tag, Space} from '@nutui/nutui-react-taro' -import Taro from '@tarojs/taro'; import {useEffect, useState} from "react"; import {User} from "@/api/system/user/model"; import navTo from "@/utils/common"; -import {TenantId} from "@/utils/config"; +import Taro from '@tarojs/taro' +import {getUserInfo} from "@/api/layout"; function UserCard() { - const [IsLogin, setIsLogin] = useState(false) - const [userInfo, setUserInfo] = useState() + const [IsLogin, setIsLogin] = useState(false) + const [userInfo, setUserInfo] = useState() - useEffect(() => { - reload() - }, []); + useEffect(() => { + reload().then() + }, []); - const reload = () => { - - }; - - /* 获取用户手机号 */ - const handleGetPhoneNumber = ({detail}) => { - const {code, encryptedData, iv} = detail - Taro.login({ - success: function () { - if (code) { - Taro.request({ - url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone', - method: 'POST', - data: { - code, - encryptedData, - iv, - notVerifyPhone: true, - refereeId: 0, - sceneType: 'save_referee', - tenantId: TenantId - }, - header: { - 'content-type': 'application/json', - TenantId - }, - success: function (res) { - Taro.setStorageSync('access_token', res.data.data.access_token) - Taro.setStorageSync('UserId', res.data.data.user.userId) - setUserInfo(res.data.data.user) - setIsLogin(true) - } - }) - } else { - console.log('登录失败!') + const reload = async () => { + setIsLogin(true) + if(Taro.getStorageSync('UserId')){ + setUserInfo(await getUserInfo()) } - } - }) - } + }; - return ( - <> -
-
-
-
- { - IsLogin ? ( - - ) : ( - - ) - } -
-
{IsLogin ? userInfo?.mobile : '请点击头像登录'}
- {IsLogin ? ( - - -
{'注册用户'}
-
- {/*{*/} - {/* userInfo?.organizationName && (*/} - {/* */} - {/*
{userInfo?.organizationName}
*/} - {/*
*/} - {/* )*/} - {/*}*/} -
- ) : ''} -
+ return ( + <> +
+
+
+
+ { + IsLogin && ( + + ) + } + { + !IsLogin && ( + + ) + } +
+ {IsLogin ? ( + + +
{'注册用户'}
+
+ {/*{*/} + {/* userInfo?.organizationName && (*/} + {/* */} + {/*
{userInfo?.organizationName}
*/} + {/*
*/} + {/* )*/} + {/*}*/} +
+ ) : ''} +
+
+
navTo('/user/profile/profile', true)}> + {'个人资料'} +
+
+
-
navTo('/user/profile/profile', true)}> - {'个人资料'} -
-
-
-
- + - ) + ) } export default UserCard; diff --git a/src/pages/user/components/UserCell.tsx b/src/pages/user/components/UserCell.tsx index ab3bfdd..2ef5530 100644 --- a/src/pages/user/components/UserCell.tsx +++ b/src/pages/user/components/UserCell.tsx @@ -2,16 +2,19 @@ import {Cell, InfiniteLoading} from '@nutui/nutui-react-taro' import navTo from "@/utils/common"; import UserFooter from "./UserFooter"; import Taro from '@tarojs/taro' -import {ArrowRight, ShieldCheck, Truck, LogisticsError} from '@nutui/icons-react-taro' -import {CSSProperties, useEffect, useState} from "react"; +import {ArrowRight, Headphones} from '@nutui/icons-react-taro' +import {CSSProperties, useEffect} from "react"; const UserCell = () => { - const [roleName, setRoleName] = useState('') const InfiniteUlStyle: CSSProperties = { height: '88vh', padding: '16px', overflowY: 'auto', overflowX: 'hidden', + backgroundImage: 'url(https://oss.wsdns.cn/20250707/fc6234359d394788879ee64e27f76d2e.png?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90)', + backgroundSize: 'cover', + backgroundRepeat: 'no-repeat', + backgroundPosition: 'bottom' } const onLogout = () => { Taro.showModal({ @@ -33,7 +36,7 @@ const UserCell = () => { } useEffect(() => { - setRoleName(Taro.getStorageSync('RoleCode')) + }, []); return ( @@ -45,193 +48,18 @@ const UserCell = () => { className="nutui-cell-clickable" title={
- - 实名认证 + + 联系我们
} align="center" extra={} onClick={() => { - navTo('/user/userVerify/index', true) + Taro.navigateTo({url: '/pages/page/index?id=4355'}) }} /> - { - (roleName === 'kuaidi' || roleName == 'zhandian') && ( - <> - - - - 实名认证审核 -
- } - align="center" - extra={} - onClick={() => { - navTo('/user/userVerify/admin', true) - }} - /> - - - - - 违章记录 - - } - align="center" - extra={} - onClick={() => { - navTo('/hjm/violation/list', true) - }} - /> - - - ) - } - { - roleName === 'kuaidiyuan' && ( - <> - - - - 车辆信息 - - } - align="center" - extra={} - onClick={() => { - navTo('/user/car/index', true) - }} - /> - - - - - 报险记录 - - } - align="center" - extra={} - onClick={() => { - navTo('/hjm/bx/bx', true) - }} - /> - - - ) - } - { - roleName === 'jiaojing' && ( - - - - 违章记录 - - } - align="center" - extra={} - onClick={() => { - navTo('/hjm/violation/list', true) - }} - /> - - ) - } - {/**/} - {/* 管理*/} - {/* */} - {/*}>*/} - {/* */} - {/* */} - {/* 分析*/} - {/* */} - {/* }*/} - {/* align="center"*/} - {/* extra={}*/} - {/* onClick={() => {*/} - {/* navTo('/bszx/bm-cert/bm-cert', true)*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* 客户*/} - {/* */} - {/* }*/} - {/* align="center"*/} - {/* extra={}*/} - {/* onClick={() => {*/} - {/* navTo('/bszx/pay-log/pay-log', true)*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* 折扣*/} - {/* */} - {/* }*/} - {/* align="center"*/} - {/* extra={}*/} - {/* onClick={() => {*/} - {/* navTo('/user/profile/profile', true)*/} - {/* }}*/} - {/* />*/} - {/**/} - {/**/} - {/* 设置与帮助*/} - {/* */} - {/*}>*/} - {/* }*/} - {/* onClick={() => Taro.navigateTo({url: '/website/modify'})}*/} - {/* />*/} - {/* }*/} - {/* onClick={() => {*/} - {/* navTo('/user/profile/profile', true)*/} - {/* }}*/} - {/* />*/} - {/* }*/} - {/* onClick={() => {*/} - {/* navTo('/user/profile/profile', true)*/} - {/* }}*/} - {/* />*/} - {/**/} 账号管理 @@ -244,13 +72,13 @@ const UserCell = () => { extra={} onClick={() => navTo('/user/profile/profile', true)} /> - } - onClick={() => navTo('/passport/sms-login', true)} - /> + {/*}*/} + {/* onClick={() => navTo('/passport/sms-login', true)}*/} + {/*/>*/} { const [openLoginByPhone, setOpenLoginByPhone] = useState(false) const [clickNum, setClickNum] = useState(0) @@ -48,7 +48,7 @@ const UserFooter = () => { <>
当前版本:{Version}
-
Copyright © { new Date().getFullYear() } {Copyright}
+ {/*
Copyright © { new Date().getFullYear() } {Copyright}
*/}
{ }, []); return ( -
+