docs: 更新优惠券相关文档- 新增优惠券API集成文档
- 新增优惠券卡片对齐修复文档 - 新增优惠券状态显示调试文档 - 新增优惠券组件警告修复文档- 更新用ShopInfo Hook字段迁移文档 - 更新Arguments关键字修复文档
This commit is contained in:
@@ -2,21 +2,23 @@ import {useEffect, useState} from "react";
|
||||
import Taro from '@tarojs/taro';
|
||||
import {Button, Space} from '@nutui/nutui-react-taro'
|
||||
import {TriangleDown} from '@nutui/icons-react-taro'
|
||||
import {Popup, Avatar, NavBar} from '@nutui/nutui-react-taro'
|
||||
import {getShopInfo, getUserInfo, getWxOpenId} from "@/api/layout";
|
||||
import {Avatar, NavBar} from '@nutui/nutui-react-taro'
|
||||
import {getUserInfo, getWxOpenId} from "@/api/layout";
|
||||
import {TenantId} from "@/config/app";
|
||||
import {getOrganization} from "@/api/system/organization";
|
||||
import {myUserVerify} from "@/api/system/userVerify";
|
||||
import {CmsWebsite} from "@/api/cms/cmsWebsite/model";
|
||||
import {User} from "@/api/system/user/model";
|
||||
import { useShopInfo } from '@/hooks/useShopInfo';
|
||||
import MySearch from "./MySearch";
|
||||
import './Header.scss';
|
||||
|
||||
const Header = (props: any) => {
|
||||
const [userInfo, setUserInfo] = useState<User>()
|
||||
// 使用新的useShopInfo Hook
|
||||
const {
|
||||
getWebsiteName,
|
||||
getWebsiteLogo
|
||||
} = useShopInfo();
|
||||
|
||||
const [IsLogin, setIsLogin] = useState<boolean>(true)
|
||||
const [config, setConfig] = useState<CmsWebsite>()
|
||||
const [showBasic, setShowBasic] = useState(false)
|
||||
const [statusBarHeight, setStatusBarHeight] = useState<number>()
|
||||
|
||||
const reload = async () => {
|
||||
@@ -25,16 +27,11 @@ const Header = (props: any) => {
|
||||
setStatusBarHeight(res.statusBarHeight)
|
||||
},
|
||||
})
|
||||
// 获取站点信息
|
||||
getShopInfo().then((data) => {
|
||||
setConfig(data);
|
||||
console.log(userInfo)
|
||||
})
|
||||
// 注意:商店信息现在通过useShopInfo自动管理,不需要手动获取
|
||||
// 获取用户信息
|
||||
getUserInfo().then((data) => {
|
||||
if (data) {
|
||||
setIsLogin(true);
|
||||
setUserInfo(data)
|
||||
console.log('用户信息>>>', data.phone)
|
||||
// 保存userId
|
||||
Taro.setStorageSync('UserId', data.userId)
|
||||
@@ -87,7 +84,7 @@ const Header = (props: any) => {
|
||||
}
|
||||
|
||||
/* 获取用户手机号 */
|
||||
const handleGetPhoneNumber = ({detail}) => {
|
||||
const handleGetPhoneNumber = ({detail}: {detail: {code?: string, encryptedData?: string, iv?: string}}) => {
|
||||
const {code, encryptedData, iv} = detail
|
||||
Taro.login({
|
||||
success: function () {
|
||||
@@ -157,9 +154,9 @@ const Header = (props: any) => {
|
||||
<Space>
|
||||
<Avatar
|
||||
size="22"
|
||||
src={config?.websiteLogo}
|
||||
src={getWebsiteLogo()}
|
||||
/>
|
||||
<span style={{color: '#000'}}>{config?.websiteName}</span>
|
||||
<span style={{color: '#000'}}>{getWebsiteName()}</span>
|
||||
</Space>
|
||||
</Button>
|
||||
<TriangleDown size={9}/>
|
||||
@@ -168,23 +165,13 @@ const Header = (props: any) => {
|
||||
<div style={{display: 'flex', alignItems: 'center', gap: '8px'}}>
|
||||
<Avatar
|
||||
size="22"
|
||||
src={config?.websiteLogo}
|
||||
src={getWebsiteLogo()}
|
||||
/>
|
||||
<span className={'text-white'}>{config?.websiteName}</span>
|
||||
<span className={'text-white'}>{getWebsiteName()}</span>
|
||||
<TriangleDown className={'text-white'} size={9}/>
|
||||
</div>
|
||||
)}>
|
||||
</NavBar>
|
||||
<Popup
|
||||
visible={showBasic}
|
||||
position="bottom"
|
||||
style={{width: '100%', height: '100%'}}
|
||||
onClose={() => {
|
||||
setShowBasic(false)
|
||||
}}
|
||||
>
|
||||
<div style={{padding: '12px 0', fontWeight: 'bold', textAlign: 'center'}}>车辆信息</div>
|
||||
</Popup>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user