- 创建 .editorconfig 文件统一代码风格配置 - 配置 .eslintrc 使用 taro/react 规则集 - 完善 .gitignore 忽略编译产物和敏感文件 - 添加 admin/article/add 页面实现文章管理功能 - 添加 dealer/apply/add 页面实现经销商申请功能 - 添加 dealer/bank/add 页面实现银行卡管理功能 - 添加 dealer/customer/add 页面实现客户管理功能 - 添加 user/address/add 页面实现用户地址管理功能 - 添加 user/chat/message/add 页面实现消息功能 - 添加 user/gift/add 页面实现礼品管理功能 - 配置各页面导航栏标题和样式 - 实现表单验证和数据提交功能 - 集成图片上传和头像选择功能 - 添加日期选择和数据校验逻辑 - 实现编辑和新增模式切换 - 集成用户权限和角色管理功能
78 lines
2.3 KiB
TypeScript
78 lines
2.3 KiB
TypeScript
import {useEffect, useState} from "react";
|
|
import {useRouter} from '@tarojs/taro'
|
|
import {CellGroup, Cell, Loading, Avatar} from '@nutui/nutui-react-taro'
|
|
import {View,Text} from '@tarojs/components'
|
|
import {ArrowRight} from '@nutui/icons-react-taro'
|
|
import {getShopChatMessage, updateShopChatMessage} from "@/api/shop/shopChatMessage";
|
|
import {ShopChatMessage} from "@/api/shop/shopChatMessage/model";
|
|
import navTo from "@/utils/common";
|
|
|
|
const AddMessageDetail = () => {
|
|
const {params} = useRouter();
|
|
const [loading, setLoading] = useState<boolean>(true)
|
|
const [item, setItem] = useState<ShopChatMessage>()
|
|
|
|
const reload = () => {
|
|
const id = params.id ? Number(params.id) : undefined
|
|
if (id) {
|
|
getShopChatMessage(id).then(data => {
|
|
setItem(data)
|
|
setLoading(false)
|
|
updateShopChatMessage({
|
|
...data,
|
|
status: 1
|
|
}).then(() => {
|
|
console.log('设为已读')
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
useEffect(() => {
|
|
reload()
|
|
}, []);
|
|
|
|
if (loading) {
|
|
return <Loading className={'px-2'}>加载中</Loading>
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Cell style={{
|
|
display: 'none'
|
|
}} title={item?.formUserId ? (
|
|
<View className={'flex items-center'}>
|
|
<Avatar src={item.formUserAvatar}/>
|
|
<View className={'ml-2 flex flex-col'}>
|
|
<Text>{item.formUserAlias || item.formUserName}</Text>
|
|
<Text className={'text-gray-300'}>{item.formUserPhone}</Text>
|
|
</View>
|
|
</View>
|
|
) : '选择发送对象'} extra={(
|
|
<ArrowRight color="#cccccc" className={item ? 'mt-2' : ''} size={item ? 20 : 18}/>
|
|
)}
|
|
onClick={() => navTo(`/dealer/team/index`, true)}/>
|
|
<CellGroup>
|
|
<Cell title={'发布人'} extra={item?.formUserAlias || item?.formUserName}/>
|
|
<Cell title={'创建时间'} extra={item?.createTime}/>
|
|
<Cell title={'状态'} extra={
|
|
item?.status === 0 ? '未读' : '已读'
|
|
}/>
|
|
{/*<Cell title={(*/}
|
|
{/* <>*/}
|
|
{/* <Text>{'消息内容:'}</Text>*/}
|
|
{/* <Text>{item?.content}</Text>*/}
|
|
{/* </>*/}
|
|
{/*)} />*/}
|
|
</CellGroup>
|
|
<CellGroup>
|
|
<Cell title={(
|
|
<Text>{item?.content}</Text>
|
|
)} />
|
|
</CellGroup>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default AddMessageDetail;
|