feat(user): 新增站内消息功能
- 添加聊天消息相关API和模型定义 - 实现消息列表、消息详情和发送消息页面 - 集成消息功能到首页和团队页面 -优化用户模型,增加别名字段
This commit is contained in:
@@ -9,8 +9,13 @@ import navTo from "@/utils/common";
|
||||
const MyGrid = () => {
|
||||
const [list, setList] = useState<CmsNavigation[]>([])
|
||||
const reload = async () => {
|
||||
const menu = await listCmsNavigation({home: 0})
|
||||
setList(menu)
|
||||
// 读取首页菜单
|
||||
const home = await listCmsNavigation({model: 'index'});
|
||||
const homeId = home[0].navigationId;
|
||||
if(homeId){
|
||||
const menu = await listCmsNavigation({home: 0, parentId: homeId})
|
||||
setList(menu)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -24,10 +29,7 @@ const MyGrid = () => {
|
||||
// @ts-ignore
|
||||
return (
|
||||
<>
|
||||
<View className={'p-4'}
|
||||
style={{
|
||||
marginTop: '5vh'
|
||||
}}>
|
||||
<View className={'p-4'}>
|
||||
<View className={' bg-white rounded-2xl py-4'}>
|
||||
<View className={'title font-medium px-4'}>功能菜单</View>
|
||||
<Divider />
|
||||
|
||||
@@ -14,9 +14,10 @@ const Page = () => {
|
||||
const reload = async () => {
|
||||
// 读取首页菜单
|
||||
const home = await listCmsNavigation({model: 'index'});
|
||||
if (home && home.length > 0) {
|
||||
const homeId = home[0].navigationId;
|
||||
if (homeId) {
|
||||
// 读取首页导航条
|
||||
const menus = await listCmsNavigation({parentId: home[0].navigationId, hide: 0});
|
||||
const menus = await listCmsNavigation({parentId: homeId, hide: 0});
|
||||
setNavItems(menus || [])
|
||||
}
|
||||
};
|
||||
|
||||
47
src/pages/index/PopUpAd.tsx
Normal file
47
src/pages/index/PopUpAd.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
import { Dialog } from '@nutui/nutui-react-taro'
|
||||
import {getCmsNavigation} from "@/api/cms/cmsNavigation";
|
||||
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
|
||||
import {RichText} from '@tarojs/components'
|
||||
|
||||
const PopUpAd = () => {
|
||||
const [visible, setVisible] = useState(false)
|
||||
const [item, setItem] = useState<CmsNavigation>()
|
||||
const reload = async () => {
|
||||
const navigation = await getCmsNavigation(4426)
|
||||
if(navigation && navigation.hide == 0){
|
||||
setItem(navigation)
|
||||
setVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload().then()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog
|
||||
title={
|
||||
<div className={'font-bold mb-3'}>重要通知</div>
|
||||
}
|
||||
footer={null}
|
||||
closeIcon
|
||||
closeIconPosition="top-right"
|
||||
style={{
|
||||
// @ts-ignore
|
||||
'--nutui-dialog-close-color': '#8c8c8c',
|
||||
}}
|
||||
onConfirm={() => setVisible(false)}
|
||||
onCancel={() => setVisible(false)}
|
||||
visible={visible}
|
||||
onClose={() => {
|
||||
setVisible(false)
|
||||
}}
|
||||
>
|
||||
<RichText nodes={item?.design?.content}/>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default PopUpAd
|
||||
@@ -10,6 +10,7 @@ import Menu from "./Menu";
|
||||
import Banner from "./Banner";
|
||||
import './index.scss'
|
||||
import Grid from "@/pages/index/Grid";
|
||||
import PopUpAd from "@/pages/index/PopUpAd";
|
||||
|
||||
function Home() {
|
||||
// 吸顶状态
|
||||
@@ -117,6 +118,7 @@ function Home() {
|
||||
<BestSellers/>
|
||||
<Grid />
|
||||
</View>
|
||||
<PopUpAd />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user