forked from gxwebsoft/mp-10550
修复已知问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '商品列表',
|
||||
navigationBarTitleText: '购物车',
|
||||
navigationBarTextStyle: 'black',
|
||||
navigationStyle: 'custom'
|
||||
})
|
||||
@@ -4,7 +4,7 @@ import {Space, NavBar} from '@nutui/nutui-react-taro'
|
||||
import {Search, Received, Scan} from '@nutui/icons-react-taro'
|
||||
import GoodsList from "@/components/GoodsList";
|
||||
|
||||
function Kefu() {
|
||||
function Cart() {
|
||||
const [statusBarHeight, setStatusBarHeight] = useState<number>()
|
||||
|
||||
useShareTimeline(() => {
|
||||
@@ -64,4 +64,4 @@ function Kefu() {
|
||||
);
|
||||
}
|
||||
|
||||
export default Kefu;
|
||||
export default Cart;
|
||||
@@ -7,7 +7,7 @@ import {getCmsAd} from "@/api/cms/cmsAd";
|
||||
const MyPage = () => {
|
||||
const [item, setItem] = useState<CmsAd>()
|
||||
const reload = () => {
|
||||
getCmsAd(433).then(data => {
|
||||
getCmsAd(439).then(data => {
|
||||
setItem(data)
|
||||
})
|
||||
}
|
||||
@@ -18,10 +18,10 @@ const MyPage = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Swiper defaultValue={0} height={item?.height} indicator style={{ height: item?.height, display: 'none' }}>
|
||||
<Swiper defaultValue={0} height={item?.height} indicator style={{ height: item?.height + 'px', display: 'none' }}>
|
||||
{item?.imageList?.map((item) => (
|
||||
<Swiper.Item key={item}>
|
||||
<Image width="100%" height="100%" src={item.url} mode={'scaleToFill'} style={{ height: item.height }} />
|
||||
<Image width="100%" height="100%" src={item.url} mode={'scaleToFill'} style={{ height: item.height + 'px' }} />
|
||||
</Swiper.Item>
|
||||
))}
|
||||
</Swiper>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {Image, Space, Tag, Divider} from '@nutui/nutui-react-taro'
|
||||
import {Cart} from '@nutui/icons-react-taro'
|
||||
import {Image} from '@nutui/nutui-react-taro'
|
||||
import {Share} from '@nutui/icons-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ShopGoods} from "@/api/shop/shopGoods/model";
|
||||
import {pageShopGoods} from "@/api/shop/shopGoods";
|
||||
@@ -9,11 +9,11 @@ import './BestSellers.scss'
|
||||
|
||||
const BestSellers = () => {
|
||||
const [list, setList] = useState<ShopGoods[]>([])
|
||||
|
||||
const reload = () => {
|
||||
pageShopGoods({}).then(res => {
|
||||
setList(res?.list || []);
|
||||
})
|
||||
console.log(list)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -21,48 +21,45 @@ const BestSellers = () => {
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className={'py-0'}>
|
||||
<div className={'flex flex-col justify-between items-center rounded-lg px-2'}>
|
||||
{list?.map((item, index) => {
|
||||
return (
|
||||
<div key={index} className={'flex flex-col rounded-lg bg-white shadow-sm w-full mb-5'}
|
||||
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}>
|
||||
<Image src={item.image} mode={'scaleToFill'}
|
||||
radius="10px 10px 0 0" height="180"/>
|
||||
<div className={'flex flex-col p-2 rounded-lg'}>
|
||||
<div>
|
||||
<div className={'car-no text-sm'}>{item.name} #{item.goodsId}</div>
|
||||
<div className={'flex justify-between text-xs py-1'}>
|
||||
<span className={'text-orange-500'}>丰江桥佛手瓜面,非油炸,Q弹爽口,营养丰</span>
|
||||
<span className={'text-gray-400'}>已售 {item.sales}</span>
|
||||
</div>
|
||||
<Space>
|
||||
<Tag plain round background={'#ff0000'}>会客厅循环劵<Divider direction={'vertical'} style={{
|
||||
borderStyle: 'dashed', padding: '0',
|
||||
borderColor: '#fd8989', margin: '0 5px'
|
||||
}}/>每拍2减10元</Tag>
|
||||
<Tag plain round background={'#ff0000'}>会客厅专享<Divider direction={'vertical'} style={{
|
||||
borderStyle: 'dashed', padding: '0',
|
||||
borderColor: '#fd8989', margin: '0 5px'
|
||||
}}/>拍1减3元</Tag>
|
||||
</Space>
|
||||
<div className={'flex justify-between items-center py-2'}>
|
||||
<div className={'flex text-red-500 text-xl items-baseline'}>
|
||||
<span className={'text-xs'}>¥</span>
|
||||
<span className={'font-bold text-2xl'}>19.9</span>
|
||||
<>
|
||||
<div className={'py-3'}>
|
||||
<div className={'flex flex-col justify-between items-center rounded-lg px-2'}>
|
||||
{list?.map((item, index) => {
|
||||
return (
|
||||
<div key={index} className={'flex flex-col rounded-lg bg-white shadow-sm w-full mb-5'}>
|
||||
<Image src={item.image} mode={'scaleToFill'}
|
||||
radius="10px 10px 0 0" height="180"
|
||||
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
|
||||
<div className={'flex flex-col p-2 rounded-lg'}>
|
||||
<div>
|
||||
<div className={'car-no text-sm'}>{item.name}</div>
|
||||
<div className={'flex justify-between text-xs py-1'}>
|
||||
<span className={'text-orange-500'}>{item.comments}</span>
|
||||
<span className={'text-gray-400'}>已售 {item.sales}</span>
|
||||
</div>
|
||||
<div className={'buy-btn'}>
|
||||
<div className={'cart-icon'}><Cart size={20} className={'mx-4 mt-2'} /></div>
|
||||
<div className={'text-white pl-4 pr-5'}>购买</div>
|
||||
<div className={'flex justify-between items-center py-2'}>
|
||||
<div className={'flex text-red-500 text-xl items-baseline'}>
|
||||
<span className={'text-xs'}>¥</span>
|
||||
<span className={'font-bold text-2xl'}>{item.price}</span>
|
||||
</div>
|
||||
<div className={'buy-btn'}>
|
||||
<div className={'cart-icon'}>
|
||||
<Share size={20} className={'mx-4 mt-2'}
|
||||
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
|
||||
</div>
|
||||
<div className={'text-white pl-4 pr-5'}
|
||||
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}>购买
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default BestSellers
|
||||
|
||||
8
src/pages/index/Header.scss
Normal file
8
src/pages/index/Header.scss
Normal file
@@ -0,0 +1,8 @@
|
||||
.header-bg{
|
||||
background: linear-gradient(to bottom, #03605c, #18ae4f);
|
||||
height: 335px;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
}
|
||||
@@ -6,9 +6,11 @@ import {Popup, Avatar, NavBar} from '@nutui/nutui-react-taro'
|
||||
import {getSiteInfo, getUserInfo, getWxOpenId} from "@/api/layout";
|
||||
import {TenantId} from "@/utils/config";
|
||||
import {getOrganization} from "@/api/system/organization";
|
||||
import {myUserVerify} from "@/api/system/userVerify";
|
||||
import {myTenantList, myUserVerify} from "@/api/system/userVerify";
|
||||
import {CmsWebsite} from "@/api/cms/cmsWebsite/model";
|
||||
import {User} from "@/api/system/user/model";
|
||||
import './Header.scss';
|
||||
import MySearch from "./MySearch";
|
||||
|
||||
const Header = () => {
|
||||
const [userInfo, setUserInfo] = useState<User>()
|
||||
@@ -33,7 +35,7 @@ const Header = () => {
|
||||
if (data) {
|
||||
setIsLogin(true);
|
||||
setUserInfo(data)
|
||||
console.log('用户信息>>>',data.phone)
|
||||
console.log('用户信息>>>', data.phone)
|
||||
// 保存userId
|
||||
Taro.setStorageSync('UserId', data.userId)
|
||||
// 获取openId
|
||||
@@ -46,27 +48,27 @@ const Header = () => {
|
||||
})
|
||||
}
|
||||
// 是否已认证
|
||||
if(data.certification){
|
||||
Taro.setStorageSync('Certification','1')
|
||||
if (data.certification) {
|
||||
Taro.setStorageSync('Certification', '1')
|
||||
}
|
||||
// 机构ID
|
||||
Taro.setStorageSync('OrganizationId',data.organizationId)
|
||||
Taro.setStorageSync('OrganizationId', data.organizationId)
|
||||
// 父级机构ID
|
||||
if(Number(data.organizationId) > 0){
|
||||
if (Number(data.organizationId) > 0) {
|
||||
getOrganization(Number(data.organizationId)).then(res => {
|
||||
Taro.setStorageSync('OrganizationParentId',res.parentId)
|
||||
Taro.setStorageSync('OrganizationParentId', res.parentId)
|
||||
})
|
||||
}
|
||||
// 管理员
|
||||
const isKdy = data.roles?.findIndex(item => item.roleCode == 'admin')
|
||||
if(isKdy != -1){
|
||||
if (isKdy != -1) {
|
||||
Taro.setStorageSync('RoleName', '管理')
|
||||
Taro.setStorageSync('RoleCode', 'admin')
|
||||
return false;
|
||||
}
|
||||
// 注册用户
|
||||
const isUser = data.roles?.findIndex(item => item.roleCode == 'user')
|
||||
if(isUser != -1){
|
||||
if (isUser != -1) {
|
||||
Taro.setStorageSync('RoleName', '注册用户')
|
||||
Taro.setStorageSync('RoleCode', 'user')
|
||||
return false;
|
||||
@@ -78,10 +80,14 @@ const Header = () => {
|
||||
});
|
||||
// 认证信息
|
||||
myUserVerify({status: 1}).then(data => {
|
||||
if(data?.realName){
|
||||
Taro.setStorageSync('RealName',data.realName)
|
||||
if (data?.realName) {
|
||||
Taro.setStorageSync('RealName', data.realName)
|
||||
}
|
||||
})
|
||||
//
|
||||
myTenantList({page: 2, page_size: 50}).then(res => {
|
||||
console.log(res, '...res...lei')
|
||||
})
|
||||
}
|
||||
|
||||
/* 获取用户手机号 */
|
||||
@@ -107,7 +113,7 @@ const Header = () => {
|
||||
TenantId
|
||||
},
|
||||
success: function (res) {
|
||||
if(res.data.code == 1){
|
||||
if (res.data.code == 1) {
|
||||
Taro.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'error',
|
||||
@@ -138,6 +144,9 @@ const Header = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'fixed top-0 header-bg'}>
|
||||
<MySearch done={reload}/>
|
||||
</div>
|
||||
<NavBar
|
||||
style={{marginTop: `${statusBarHeight}px`, marginBottom: '0px', backgroundColor: 'transparent'}}
|
||||
onBackClick={() => {
|
||||
@@ -162,8 +171,8 @@ const Header = () => {
|
||||
size="22"
|
||||
src={config?.websiteLogo}
|
||||
/>
|
||||
{config?.websiteName}
|
||||
<TriangleDown size={9}/>
|
||||
<span className={'text-white'}>{config?.websiteName}</span>
|
||||
<TriangleDown className={'text-white'} size={9}/>
|
||||
</div>
|
||||
)}>
|
||||
</NavBar>
|
||||
|
||||
@@ -30,20 +30,18 @@ const Page = () => {
|
||||
|
||||
return (
|
||||
loading ? (<Loading>加载中</Loading>) :
|
||||
<div className={'p-3'}>
|
||||
<div className={'rounded-2xl'}>
|
||||
<div className={'flex justify-between pb-2 px-1'}>
|
||||
{
|
||||
navItems.map((item, index) => (
|
||||
<div key={index} className={'text-center'} onClick={() => onNav(item)}>
|
||||
<div className={'flex flex-col justify-center items-center'}>
|
||||
<Image src={item.icon} height={36} width={36}/>
|
||||
<div className={'mt-2 text-gray-600'} style={{fontSize: '14px'}}>{item?.title}</div>
|
||||
</div>
|
||||
<div className={'p-2 z-50 mt-1'}>
|
||||
<div className={'flex justify-between pb-2 p-2 bg-white rounded-xl shadow-sm'}>
|
||||
{
|
||||
navItems.map((item, index) => (
|
||||
<div key={index} className={'text-center'} onClick={() => onNav(item)}>
|
||||
<div className={'flex flex-col justify-center items-center p-1'}>
|
||||
<Image src={item.icon} height={36} width={36}/>
|
||||
<div className={'mt-1 text-gray-600'} style={{fontSize: '14px'}}>{item?.title}</div>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -22,15 +22,16 @@ function MySearch(props) {
|
||||
|
||||
|
||||
return (
|
||||
<div className={'z-20 left-0 w-full'}>
|
||||
<div className={'z-50 left-0 w-full'}>
|
||||
<div className={'px-2'}>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
background: '#fff',
|
||||
background: '#ffffff',
|
||||
padding: '0 7px',
|
||||
borderRadius: '20px'
|
||||
borderRadius: '20px',
|
||||
marginTop: '100px',
|
||||
}}
|
||||
>
|
||||
<Search size={18} className={'ml-2 text-gray-400'}/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import Header from './Header';
|
||||
import MySearch from "./MySearch";
|
||||
import BestSellers from './BestSellers';
|
||||
import Taro from '@tarojs/taro';
|
||||
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
|
||||
@@ -103,10 +102,9 @@ function Home() {
|
||||
return (
|
||||
<>
|
||||
<Header/>
|
||||
<MySearch done={reload}/>
|
||||
<div className={'flex flex-col mt-3'}>
|
||||
<Banner />
|
||||
<div className={'flex flex-col mt-12'}>
|
||||
<Menu />
|
||||
<Banner />
|
||||
<BestSellers/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user