forked from gxwebsoft/mp-10550
优化细节
This commit is contained in:
@@ -9,9 +9,7 @@ import type { CmsAd, CmsAdParam } from './model';
|
||||
export async function pageCmsAd(params: CmsAdParam) {
|
||||
const res = await request.get<ApiResult<PageResult<CmsAd>>>(
|
||||
'/cms/cms-ad/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
@@ -25,9 +23,7 @@ export async function pageCmsAd(params: CmsAdParam) {
|
||||
export async function listCmsAd(params?: CmsAdParam) {
|
||||
const res = await request.get<ApiResult<CmsAd[]>>(
|
||||
'/cms/cms-ad',
|
||||
{
|
||||
params
|
||||
}
|
||||
params
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function uploadOssByPath(filePath: string) {
|
||||
let stsExpired = Taro.getStorageSync('stsExpiredAt');
|
||||
if (!sts || (stsExpired && dayjs().isBefore(dayjs(stsExpired)))) {
|
||||
// @ts-ignore
|
||||
const {data: {data: {credentials}}} = await request.get(`https://server.websoft.top/api/oss/getSTSToken`)
|
||||
const {data: {data: {credentials}}} = await request.get(`https://server.gxwebsoft.com/api/oss/getSTSToken`)
|
||||
Taro.setStorageSync('sts', credentials)
|
||||
Taro.setStorageSync('stsExpiredAt', credentials.expiration)
|
||||
sts = credentials
|
||||
@@ -66,7 +66,7 @@ export async function uploadFile() {
|
||||
const tempFilePath = res.tempFilePaths[0];
|
||||
// 上传图片到OSS
|
||||
Taro.uploadFile({
|
||||
url: 'https://server.websoft.top/api/oss/upload',
|
||||
url: 'https://server.gxwebsoft.com/api/oss/upload',
|
||||
filePath: tempFilePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export default defineAppConfig({
|
||||
pages: [
|
||||
'pages/index/index',
|
||||
'pages/category/index',
|
||||
'pages/order/order',
|
||||
'pages/cart/cart',
|
||||
'pages/user/user'
|
||||
@@ -20,10 +21,8 @@ export default defineAppConfig({
|
||||
{
|
||||
"root": "cms",
|
||||
"pages": [
|
||||
"about",
|
||||
"article",
|
||||
"detail",
|
||||
"help"
|
||||
'category/index',
|
||||
"detail/index"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -37,11 +36,13 @@ export default defineAppConfig({
|
||||
"address/add",
|
||||
"address/wxAddress",
|
||||
"help/index",
|
||||
"about/index"
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "shop",
|
||||
"pages": [
|
||||
'category/index',
|
||||
'orderDetail/index',
|
||||
'goodsDetail/index',
|
||||
'orderConfirm/index',
|
||||
@@ -88,7 +89,8 @@ export default defineAppConfig({
|
||||
},
|
||||
requiredPrivateInfos: [
|
||||
"getLocation",
|
||||
"chooseLocation"
|
||||
"chooseLocation",
|
||||
"chooseAddress"
|
||||
],
|
||||
permission: {
|
||||
"scope.userLocation": {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '关于我们',
|
||||
navigationBarBackgroundColor: '#ffe0e0'
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
function About() {
|
||||
return (
|
||||
<div>About</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default About
|
||||
@@ -1,3 +0,0 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '文章列表'
|
||||
})
|
||||
@@ -1,51 +0,0 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {ArrowRight} from '@nutui/icons-react-taro'
|
||||
import {pageCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
import Taro from '@tarojs/taro'
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
|
||||
/**
|
||||
* 文章终极列表
|
||||
* @constructor
|
||||
*/
|
||||
const Article = () => {
|
||||
const {params} = useRouter();
|
||||
const [categoryId, setCategoryId] = useState<number>(3494)
|
||||
const [list, setList] = useState<CmsArticle[]>([])
|
||||
|
||||
const reload = () => {
|
||||
if (params.id) {
|
||||
setCategoryId(Number(params.id))
|
||||
}
|
||||
pageCmsArticle({categoryId}).then(res => {
|
||||
if (res?.list) {
|
||||
setList(res?.list)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className={'px-3 mb-10'}>
|
||||
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-4'}>
|
||||
<div className={'bg-white min-h-36 w-full'}>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<div key={index} className={'flex justify-between items-center py-2'} onClick={() => Taro.navigateTo({url: `/cms/help?id=${item.articleId}`}) }>
|
||||
<div className={'text-sm'}>{item.title}</div>
|
||||
<ArrowRight color={'#cccccc'} size={18} />
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default Article
|
||||
25
src/cms/category/components/ArticleList.tsx
Normal file
25
src/cms/category/components/ArticleList.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import {Image, Cell} from '@nutui/nutui-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
|
||||
const ArticleList = (props: any) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'px-3'}>
|
||||
{props.data.map((item, index) => {
|
||||
return (
|
||||
<Cell
|
||||
title={item.title}
|
||||
extra={
|
||||
<Image src={item.image} mode={'aspectFit'} lazyLoad={false} width={100} height="100"/>
|
||||
}
|
||||
key={index}
|
||||
onClick={() => Taro.navigateTo({url: '/cms/detail/index?id=' + item.articleId})}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ArticleList
|
||||
54
src/cms/category/components/ArticleTabs.tsx
Normal file
54
src/cms/category/components/ArticleTabs.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {Tabs, Loading} from '@nutui/nutui-react-taro'
|
||||
import {pageCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
import ArticleList from "./ArticleList";
|
||||
|
||||
const ArticleTabs = (props: any) => {
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const [tab1value, setTab1value] = useState<string | number>('0')
|
||||
const [list, setList] = useState<CmsArticle[]>([])
|
||||
|
||||
const reload = async (value) => {
|
||||
const {data} = props
|
||||
pageCmsArticle({categoryId: data[value].navigationId, page: 1, limit: 10}).then((res) => {
|
||||
res && setList(res?.list || [])
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
.finally(() => {
|
||||
setTab1value(value)
|
||||
setLoading(false)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload(0).then()
|
||||
}, []);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<Loading className={'px-2'}>加载中</Loading>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tabs
|
||||
value={tab1value}
|
||||
onChange={(value) => {
|
||||
reload(value).then()
|
||||
}}
|
||||
>
|
||||
{props.data?.map((item, index) => {
|
||||
return (
|
||||
<Tabs.TabPane title={item.categoryName} key={index}/>
|
||||
)
|
||||
})}
|
||||
</Tabs>
|
||||
<ArticleList data={list}/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default ArticleTabs
|
||||
31
src/cms/category/components/Banner.tsx
Normal file
31
src/cms/category/components/Banner.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Swiper } from '@nutui/nutui-react-taro'
|
||||
import {CmsAd} from "@/api/cms/cmsAd/model";
|
||||
import {Image} from '@nutui/nutui-react-taro'
|
||||
import {getCmsAd} from "@/api/cms/cmsAd";
|
||||
|
||||
const MyPage = () => {
|
||||
const [item, setItem] = useState<CmsAd>()
|
||||
const reload = () => {
|
||||
getCmsAd(439).then(data => {
|
||||
setItem(data)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<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'} lazyLoad={false} style={{ height: item.height + 'px' }} />
|
||||
</Swiper.Item>
|
||||
))}
|
||||
</Swiper>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default MyPage
|
||||
4
src/cms/category/index.config.ts
Normal file
4
src/cms/category/index.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '文章列表',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
0
src/cms/category/index.scss
Normal file
0
src/cms/category/index.scss
Normal file
78
src/cms/category/index.tsx
Normal file
78
src/cms/category/index.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
|
||||
import {Loading} from '@nutui/nutui-react-taro'
|
||||
import {useEffect, useState} from "react"
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import {getCmsNavigation, listCmsNavigation} from "@/api/cms/cmsNavigation";
|
||||
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
|
||||
import {pageCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
import ArticleList from './components/ArticleList'
|
||||
import ArticleTabs from "./components/ArticleTabs";
|
||||
import './index.scss'
|
||||
|
||||
function Category() {
|
||||
const {params} = useRouter();
|
||||
const [categoryId, setCategoryId] = useState<number>(0)
|
||||
const [category, setCategory] = useState<CmsNavigation[]>([])
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const [nav, setNav] = useState<CmsNavigation>()
|
||||
const [list, setList] = useState<CmsArticle[]>([])
|
||||
|
||||
const reload = async () => {
|
||||
// 1.加载远程数据
|
||||
const id = Number(params.id)
|
||||
const nav = await getCmsNavigation(id)
|
||||
const categoryList = await listCmsNavigation({parentId: id})
|
||||
const shopGoods = await pageCmsArticle({categoryId: id})
|
||||
|
||||
// 2.赋值
|
||||
setCategoryId(id)
|
||||
setNav(nav)
|
||||
setList(shopGoods?.list || [])
|
||||
setCategory(categoryList)
|
||||
Taro.setNavigationBarTitle({
|
||||
title: `${nav?.categoryName}`
|
||||
})
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
reload().then(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
}, []);
|
||||
|
||||
useShareTimeline(() => {
|
||||
return {
|
||||
title: `${nav?.categoryName}_时里院子市集`,
|
||||
path: `/shop/category/index?id=${categoryId}`
|
||||
};
|
||||
});
|
||||
|
||||
useShareAppMessage(() => {
|
||||
return {
|
||||
title: `${nav?.categoryName}_时里院子市集`,
|
||||
path: `/shop/category/index?id=${categoryId}`,
|
||||
success: function (res) {
|
||||
console.log('分享成功', res);
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('分享失败', res);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<Loading className={'px-2'}>加载中</Loading>
|
||||
)
|
||||
}
|
||||
|
||||
if(category.length > 0){
|
||||
return <ArticleTabs data={category}/>
|
||||
}
|
||||
|
||||
return <ArticleList data={list}/>
|
||||
}
|
||||
|
||||
export default Category
|
||||
@@ -1,4 +0,0 @@
|
||||
.content{
|
||||
padding: 32px;
|
||||
line-height: 2.4rem;
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
import {Image, Tag} from '@nutui/nutui-react-taro'
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import {Divider} from '@nutui/nutui-react-taro'
|
||||
import dayjs from 'dayjs'
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model"
|
||||
import {Eye, Clock, PickedUp, Purse, Coupon} from '@nutui/icons-react-taro'
|
||||
import AddCartBar from "@/components/AddCartBar";
|
||||
// 显示html富文本
|
||||
import {View, RichText} from '@tarojs/components'
|
||||
import './detail.scss'
|
||||
import Line from "@/components/Gap";
|
||||
import {wxParse} from "@/utils/common";
|
||||
import {getCmsArticle} from "@/api/cms/cmsArticle";
|
||||
|
||||
function Detail() {
|
||||
const {params} = useRouter();
|
||||
// 文章详情
|
||||
const [item, setItem] = useState<CmsArticle>()
|
||||
// 浏览量
|
||||
const [views, setViews] = useState<number>()
|
||||
// 报名人数
|
||||
const [bmUsers, setBmUsers] = useState<number>()
|
||||
|
||||
const reload = () => {
|
||||
getCmsArticle(Number(params.id)).then(data => {
|
||||
if(data){
|
||||
data.content = wxParse(data.content)
|
||||
setItem(data)
|
||||
setViews(data.actualViews)
|
||||
setBmUsers(data.bmUsers)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={'bg-white'}>
|
||||
<Image src={item?.image} height={375} className={'bg-gray-50'}/>
|
||||
<div className={'p-3 font-bold text-lg'}>{item?.title}</div>
|
||||
<div className={'flex justify-between px-3'}>
|
||||
<Tag type={'success'}>{item?.categoryName}</Tag>
|
||||
<div className={'flex items-center gap-2 text-sm text-gray-400'}><Eye size={14}/>{views}</div>
|
||||
</div>
|
||||
{
|
||||
item?.model == 'pay' ? '' :
|
||||
<div className={'pt-2'}>
|
||||
{
|
||||
!item?.endTime ? '' :
|
||||
<div className={'flex px-3 py-1 items-center gap-2'}>
|
||||
<Clock size={14}/>
|
||||
<div
|
||||
className={'text-sm font-bold'}>{dayjs(item?.startTime).format('YYYY-MM-DD')} 至 {dayjs(item?.endTime).format('YYYY-MM-DD')}</div>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
!item?.price ? '' :
|
||||
<>
|
||||
<div className={'flex px-3 py-1 items-center gap-2'}>
|
||||
<Purse size={14}/>
|
||||
<div
|
||||
className={'text-sm font-bold'}>{item?.price == 0 ? '线下收费' : '¥' + item?.price}
|
||||
</div>
|
||||
</div>
|
||||
<Divider/>
|
||||
</>
|
||||
}
|
||||
<div className={'flex px-3 items-center gap-2'}>
|
||||
<PickedUp size={14}/>
|
||||
<div
|
||||
className={'text-sm font-bold'}>已报名 {bmUsers} 人 / 仅限校友报名
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<Divider/>
|
||||
<div className={'flex px-3 items-center gap-2'}>
|
||||
<Coupon size={14}/>
|
||||
<div
|
||||
className={'text-sm font-bold bg-white'}>活动详情
|
||||
</div>
|
||||
</div>
|
||||
<View className={'content text-gray-700 text-sm'}>
|
||||
<RichText nodes={item?.content}/>
|
||||
</View>
|
||||
<Line height={44}/>
|
||||
<AddCartBar />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Detail
|
||||
@@ -1,50 +0,0 @@
|
||||
.article-detail-page {
|
||||
padding: 15px;
|
||||
background-color: #fff;
|
||||
|
||||
.article-header {
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 15px;
|
||||
|
||||
.article-title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
|
||||
span {
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.article-content {
|
||||
line-height: 1.8;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
|
||||
.article-main-image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
margin-bottom: 15px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,53 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {Image} from '@nutui/nutui-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
import {useEffect, useState} from 'react'
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import {Loading} from '@nutui/nutui-react-taro'
|
||||
import {View, RichText} from '@tarojs/components'
|
||||
import {wxParse} from "@/utils/common";
|
||||
import {getCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import dayjs from "dayjs";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model"
|
||||
import Line from "@/components/Gap";
|
||||
import './index.scss'
|
||||
|
||||
const ArticleDetail = () => {
|
||||
const [article, setArticle] = useState<CmsArticle | null>(null);
|
||||
const router = Taro.getCurrentInstance().router;
|
||||
const articleId = router?.params?.id;
|
||||
function Detail() {
|
||||
const {params} = useRouter();
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
// 文章详情
|
||||
const [item, setItem] = useState<CmsArticle>()
|
||||
const reload = async () => {
|
||||
const item = await getCmsArticle(Number(params.id))
|
||||
|
||||
if (item) {
|
||||
item.content = wxParse(item.content)
|
||||
setItem(item)
|
||||
Taro.setNavigationBarTitle({
|
||||
title: `${item?.categoryName}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (articleId) {
|
||||
getCmsArticle(Number(articleId)).then(res => {
|
||||
setArticle(res);
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch article detail:", error);
|
||||
});
|
||||
}
|
||||
}, [articleId]);
|
||||
reload().then(() => {
|
||||
setLoading(false)
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (!article) {
|
||||
return <div>加载中...</div>;
|
||||
if (loading) {
|
||||
return (
|
||||
<Loading className={'px-2'}>加载中</Loading>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={'article-detail-page'}>
|
||||
<div className={'article-header'}>
|
||||
<h1 className={'article-title'}>{article.title}</h1>
|
||||
<div className={'article-meta'}>
|
||||
<span>作者:{article.author}</span>
|
||||
<span>发布时间:{dayjs(article.createTime).format('YYYY-MM-DD HH:mm')}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className={'article-content'}>
|
||||
{article.image && <Image src={article.image} className={'article-main-image'} />}
|
||||
<div dangerouslySetInnerHTML={{ __html: article.content || '' }} />
|
||||
</div>
|
||||
<div className={'bg-white'}>
|
||||
<div className={'p-4 font-bold text-lg'}>{item?.title}</div>
|
||||
<div className={'text-gray-400 text-sm px-4 '}>{item?.createTime}</div>
|
||||
<View className={'content px-3'}>
|
||||
<RichText nodes={item?.content}/>
|
||||
</View>
|
||||
<Line height={44}/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
export default ArticleDetail;
|
||||
export default Detail
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '文章详情'
|
||||
})
|
||||
@@ -1,45 +0,0 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model"
|
||||
// import ReactMarkdown from 'react-markdown';
|
||||
// 显示html富文本
|
||||
import {View, RichText} from '@tarojs/components'
|
||||
import './detail.scss'
|
||||
import Line from "@/components/Gap";
|
||||
import {wxParse} from "@/utils/common";
|
||||
import {getCmsArticle} from "@/api/cms/cmsArticle";
|
||||
|
||||
function Detail() {
|
||||
const {params} = useRouter();
|
||||
// 文章详情
|
||||
const [item, setItem] = useState<CmsArticle>()
|
||||
const reload = () => {
|
||||
getCmsArticle(Number(params.id)).then(data => {
|
||||
if(data){
|
||||
data.content = wxParse(data.content)
|
||||
setItem(data)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={'bg-white'}>
|
||||
<div className={'p-4 font-bold text-lg'}>{item?.title}</div>
|
||||
<div className={'text-gray-400 text-sm px-4 '}>{item?.createTime}</div>
|
||||
<View className={'content text-gray-700 text-sm'}>
|
||||
{
|
||||
item?.editor === 1 ?
|
||||
<RichText nodes={item?.content} /> :
|
||||
null
|
||||
}
|
||||
</View>
|
||||
<Line height={44}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Detail
|
||||
@@ -72,12 +72,12 @@ function GoodsList(props: any) {
|
||||
|
||||
const reloadMore = async () => {
|
||||
setPage(page + 1)
|
||||
reload();
|
||||
reload().then();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setPage(2)
|
||||
reload()
|
||||
reload().then()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
||||
@@ -202,6 +202,7 @@ function Cart() {
|
||||
src={item.image}
|
||||
width="80"
|
||||
height="80"
|
||||
lazyLoad={false}
|
||||
radius="8"
|
||||
className="flex-shrink-0"
|
||||
/>
|
||||
|
||||
@@ -21,7 +21,7 @@ const MyPage = () => {
|
||||
<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 + 'px' }} />
|
||||
<Image width="100%" height="100%" src={item.url} mode={'scaleToFill'} lazyLoad={false} style={{ height: item.height + 'px' }} />
|
||||
</Swiper.Item>
|
||||
))}
|
||||
</Swiper>
|
||||
|
||||
@@ -27,7 +27,7 @@ const BestSellers = () => {
|
||||
{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'}
|
||||
<Image src={item.image} mode={'aspectFit'} lazyLoad={false}
|
||||
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'}>
|
||||
|
||||
0
src/pages/index/GoodsList.scss
Normal file
0
src/pages/index/GoodsList.scss
Normal file
67
src/pages/index/GoodsList.tsx
Normal file
67
src/pages/index/GoodsList.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
import {useEffect, useState} from "react";
|
||||
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";
|
||||
import './GoodsList.scss'
|
||||
|
||||
|
||||
const BestSellers = () => {
|
||||
const [list, setList] = useState<ShopGoods[]>([])
|
||||
|
||||
const reload = () => {
|
||||
pageShopGoods({}).then(res => {
|
||||
setList(res?.list || []);
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'py-3'}>
|
||||
<div className={'flex flex-wrap justify-between items-start rounded-lg px-2'}>
|
||||
{list?.map((item, index) => {
|
||||
return (
|
||||
<div key={index} className={'flex flex-col rounded-lg bg-white shadow-sm mb-5'} style={{
|
||||
width: '48%'
|
||||
}}>
|
||||
<Image src={item.image} mode={'scaleToFill'} lazyLoad={false}
|
||||
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={'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>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default BestSellers
|
||||
@@ -9,8 +9,8 @@ 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 './Header.scss';
|
||||
import MySearch from "./MySearch";
|
||||
import './Header.scss';
|
||||
|
||||
const Header = () => {
|
||||
const [userInfo, setUserInfo] = useState<User>()
|
||||
@@ -93,7 +93,7 @@ const Header = () => {
|
||||
success: function () {
|
||||
if (code) {
|
||||
Taro.request({
|
||||
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
|
||||
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
|
||||
method: 'POST',
|
||||
data: {
|
||||
code,
|
||||
@@ -135,7 +135,7 @@ const Header = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
reload().then()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
||||
@@ -16,7 +16,7 @@ const Login = (props:any) => {
|
||||
success: function () {
|
||||
if (code) {
|
||||
Taro.request({
|
||||
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
|
||||
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
|
||||
method: 'POST',
|
||||
data: {
|
||||
code,
|
||||
|
||||
@@ -11,14 +11,25 @@ const Page = () => {
|
||||
const [navItems, setNavItems] = useState<CmsNavigation[]>([])
|
||||
|
||||
const reload = async () => {
|
||||
// 读取栏目
|
||||
const menus = await listCmsNavigation({model: 'links', hide: 0});
|
||||
setNavItems(menus || [])
|
||||
// 读取首页菜单
|
||||
const home = await listCmsNavigation({model: 'index'});
|
||||
if (home && home.length > 0) {
|
||||
// 读取首页导航条
|
||||
const menus = await listCmsNavigation({parentId: home[0].navigationId, hide: 0});
|
||||
setNavItems(menus || [])
|
||||
}
|
||||
};
|
||||
|
||||
const onNav = (row: CmsNavigation) => {
|
||||
console.log(row, 'eee')
|
||||
Taro.navigateTo({url: `${row.path}`})
|
||||
console.log('nav = ', row)
|
||||
console.log('path = ', `/${row.model}${row.path}`)
|
||||
if (row.model == 'goods') {
|
||||
return Taro.navigateTo({url: `/shop/category/index?id=${row.navigationId}`})
|
||||
}
|
||||
if (row.model == 'article') {
|
||||
return Taro.navigateTo({url: `/cms/category/index?id=${row.navigationId}`})
|
||||
}
|
||||
return Taro.navigateTo({url: `${row.path}`})
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +47,7 @@ const Page = () => {
|
||||
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}/>
|
||||
<Image src={item.icon} height={36} width={36} lazyLoad={false}/>
|
||||
<div className={'mt-1 text-gray-600'} style={{fontSize: '14px'}}>{item?.title}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,10 +4,13 @@ import Taro from '@tarojs/taro';
|
||||
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
|
||||
import {useEffect} from "react";
|
||||
import {getSiteInfo} from "@/api/layout";
|
||||
import {Sticky} from '@nutui/nutui-react-taro'
|
||||
import Menu from "./Menu";
|
||||
import Banner from "./Banner";
|
||||
import './index.scss'
|
||||
|
||||
// import GoodsList from "./GoodsList";
|
||||
|
||||
function Home() {
|
||||
|
||||
useShareTimeline(() => {
|
||||
@@ -94,18 +97,21 @@ function Home() {
|
||||
Taro.getUserInfo({
|
||||
success: (res) => {
|
||||
const avatar = res.userInfo.avatarUrl;
|
||||
console.log(avatar,'avatarUrl')
|
||||
console.log(avatar, 'avatarUrl')
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header/>
|
||||
<Sticky threshold={0}>
|
||||
<Header/>
|
||||
</Sticky>
|
||||
<div className={'flex flex-col mt-12'}>
|
||||
<Menu />
|
||||
<Banner />
|
||||
<Menu/>
|
||||
<Banner/>
|
||||
<BestSellers/>
|
||||
{/*<GoodsList/>*/}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ const OrderIcon = () => {
|
||||
success: function () {
|
||||
if (code) {
|
||||
Taro.request({
|
||||
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
|
||||
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
|
||||
method: 'POST',
|
||||
data: {
|
||||
code,
|
||||
@@ -187,13 +187,13 @@ const OrderIcon = () => {
|
||||
<div className={'flex flex-col justify-center items-center'} onClick={() => {
|
||||
onLogin(item, index)
|
||||
}}>
|
||||
<Image src={item.icon} height={28} width={28}/>
|
||||
<Image src={item.icon} height={28} width={28} lazyLoad={false}/>
|
||||
<div className={'mt-2'} style={{fontSize: '15px'}}>{item?.title}</div>
|
||||
</div>
|
||||
:
|
||||
<Button className={'text-white'} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
|
||||
<div className={'flex flex-col justify-center items-center'}>
|
||||
<Image src={item.icon} height={28} width={28}/>
|
||||
<Image src={item.icon} height={28} width={28} lazyLoad={false}/>
|
||||
<div className={'mt-2 text-gray-700'} style={{fontSize: '15px'}}>{item?.title}</div>
|
||||
</div>
|
||||
</Button>
|
||||
|
||||
@@ -107,7 +107,7 @@ function UserCard() {
|
||||
success: function () {
|
||||
if (code) {
|
||||
Taro.request({
|
||||
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
|
||||
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
|
||||
method: 'POST',
|
||||
data: {
|
||||
code,
|
||||
|
||||
31
src/shop/category/components/Banner.tsx
Normal file
31
src/shop/category/components/Banner.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Swiper } from '@nutui/nutui-react-taro'
|
||||
import {CmsAd} from "@/api/cms/cmsAd/model";
|
||||
import {Image} from '@nutui/nutui-react-taro'
|
||||
import {getCmsAd} from "@/api/cms/cmsAd";
|
||||
|
||||
const MyPage = () => {
|
||||
const [item, setItem] = useState<CmsAd>()
|
||||
const reload = () => {
|
||||
getCmsAd(439).then(data => {
|
||||
setItem(data)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<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'} lazyLoad={false} style={{ height: item.height + 'px' }} />
|
||||
</Swiper.Item>
|
||||
))}
|
||||
</Swiper>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default MyPage
|
||||
0
src/shop/category/components/GoodsList.scss
Normal file
0
src/shop/category/components/GoodsList.scss
Normal file
51
src/shop/category/components/GoodsList.tsx
Normal file
51
src/shop/category/components/GoodsList.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import {Image} from '@nutui/nutui-react-taro'
|
||||
import {Share} from '@nutui/icons-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import './GoodsList.scss'
|
||||
|
||||
|
||||
const GoodsList = (props: any) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'py-3'}>
|
||||
<div className={'flex flex-col justify-between items-center rounded-lg px-2'}>
|
||||
{props.data?.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={'aspectFit'} lazyLoad={false}
|
||||
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={'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>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default GoodsList
|
||||
4
src/shop/category/index.config.ts
Normal file
4
src/shop/category/index.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '商品分类',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
0
src/shop/category/index.scss
Normal file
0
src/shop/category/index.scss
Normal file
78
src/shop/category/index.tsx
Normal file
78
src/shop/category/index.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import GoodsList from './components/GoodsList'
|
||||
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
|
||||
import {Loading} from '@nutui/nutui-react-taro'
|
||||
import {useEffect, useState} from "react"
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import './index.scss'
|
||||
import {pageShopGoods} from "@/api/shop/shopGoods"
|
||||
import {ShopGoods} from "@/api/shop/shopGoods/model"
|
||||
import {getCmsNavigation} from "@/api/cms/cmsNavigation";
|
||||
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
|
||||
|
||||
function Category() {
|
||||
const {params} = useRouter();
|
||||
const [categoryId, setCategoryId] = useState<number>(0)
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const [nav, setNav] = useState<CmsNavigation>()
|
||||
const [list, setList] = useState<ShopGoods[]>([])
|
||||
|
||||
const reload = async () => {
|
||||
// 1.加载远程数据
|
||||
const id = Number(params.id)
|
||||
const nav = await getCmsNavigation(id)
|
||||
const shopGoods = await pageShopGoods({categoryId: id})
|
||||
|
||||
// 2.处理业务逻辑
|
||||
setCategoryId(id)
|
||||
setNav(nav)
|
||||
setList(shopGoods?.list || [])
|
||||
|
||||
// 3.设置标题
|
||||
Taro.setNavigationBarTitle({
|
||||
title: `${nav?.categoryName}`
|
||||
})
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
reload().then(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
}, []);
|
||||
|
||||
useShareTimeline(() => {
|
||||
return {
|
||||
title: `${nav?.categoryName}_时里院子市集`,
|
||||
path: `/shop/category/index?id=${categoryId}`
|
||||
};
|
||||
});
|
||||
|
||||
useShareAppMessage(() => {
|
||||
return {
|
||||
title: `${nav?.categoryName}_时里院子市集`,
|
||||
path: `/shop/category/index?id=${categoryId}`,
|
||||
success: function (res) {
|
||||
console.log('分享成功', res);
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('分享失败', res);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<Loading className={'px-2 text-center'}>加载中</Loading>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'flex flex-col'}>
|
||||
<GoodsList data={list} nav={nav}/>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Category
|
||||
@@ -129,7 +129,7 @@ const GoodsDetail = () => {
|
||||
<Swiper defaultValue={0} indicator height={'350px'}>
|
||||
{files.map((item) => (
|
||||
<Swiper.Item key={item}>
|
||||
<Image width="100%" height={'100%'} src={item.url} mode={'scaleToFill'}/>
|
||||
<Image width="100%" height={'100%'} src={item.url} mode={'scaleToFill'} lazyLoad={false}/>
|
||||
</Swiper.Item>
|
||||
))}
|
||||
</Swiper>
|
||||
|
||||
@@ -64,7 +64,7 @@ const OrderConfirm = () => {
|
||||
<CellGroup>
|
||||
<Cell>
|
||||
<div className={'flex items-center'}>
|
||||
<Image src={goods.image} width="80" height="80"/>
|
||||
<Image src={goods.image} width="80" height="80" lazyLoad={false}/>
|
||||
<div className={'ml-2'}>
|
||||
<div className={'text-sm font-bold'}>{goods.name}</div>
|
||||
<div className={'text-red-500 text-lg'}>¥{goods.price}</div>
|
||||
|
||||
@@ -91,7 +91,7 @@ const OrderDetail = () => {
|
||||
{orderGoodsList.map((item, index) => (
|
||||
<Cell key={index}>
|
||||
<div className={'flex items-center'}>
|
||||
<Image src={item.goodsImage} width="80" height="80" />
|
||||
<Image src={item.goodsImage} width="80" height="80" lazyLoad={false} />
|
||||
<div className={'ml-2'}>
|
||||
<div className={'text-sm font-bold'}>{item.goodsName}</div>
|
||||
<div className={'text-gray-500 text-xs'}>数量:{item.totalNum}</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '常见问题',
|
||||
navigationBarTitleText: '关于我们',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
|
||||
@@ -1,15 +1,30 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
import {listCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import {Collapse} from '@nutui/nutui-react-taro'
|
||||
import {ArrowDown} from '@nutui/icons-react-taro'
|
||||
import {Collapse, Avatar, Cell, Divider} from '@nutui/nutui-react-taro'
|
||||
import {ArrowRight} from '@nutui/icons-react-taro'
|
||||
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
|
||||
import {listCmsNavigation} from "@/api/cms/cmsNavigation";
|
||||
// 显示html富文本
|
||||
import {View, RichText} from '@tarojs/components'
|
||||
|
||||
|
||||
const Helper = () => {
|
||||
const [list, setList] = useState<CmsArticle[]>([])
|
||||
const [nav, setNav] = useState<CmsNavigation>()
|
||||
const [category, setCategory] = useState<CmsNavigation[]>([])
|
||||
|
||||
const reload = () => {
|
||||
listCmsArticle({model: 'help'}).then(res => {
|
||||
const reload = async () => {
|
||||
const navs = await listCmsNavigation({model: 'page', parentId: 0});
|
||||
if (navs.length > 0) {
|
||||
const nav = navs[0];
|
||||
setNav(nav);
|
||||
// 查询子栏目
|
||||
const category = await listCmsNavigation({parentId: nav.navigationId})
|
||||
setCategory(category)
|
||||
}
|
||||
|
||||
listCmsArticle({model: 'page'}).then(res => {
|
||||
setList(res)
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch goods detail:", error);
|
||||
@@ -17,25 +32,55 @@ const Helper = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
reload().then()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={'p-3'}>
|
||||
{list.map((item, index) => (
|
||||
<Collapse defaultActiveName={['1', '2']} expandIcon={<ArrowDown/>}>
|
||||
<Collapse.Item
|
||||
title={
|
||||
<div className={'flex items-center'}>
|
||||
<div className={'text-sm'}>{item.title}</div>
|
||||
</div>
|
||||
}
|
||||
name={`${index}`}
|
||||
>
|
||||
<div className={'text-sm'}>{item.comments}</div>
|
||||
</Collapse.Item>
|
||||
</Collapse>
|
||||
<div className={'px-3'}>
|
||||
<Cell>
|
||||
{nav && (
|
||||
<View className={'flex flex-col justify-center items-center w-full'}>
|
||||
<Avatar
|
||||
src={nav?.icon}
|
||||
size={'100'}
|
||||
/>
|
||||
<View className={'font-bold text-sm'}>
|
||||
{nav?.comments}
|
||||
</View>
|
||||
<View className={'text-left py-3 text-gray-600'}>
|
||||
<RichText
|
||||
nodes={'时里院子市集是一家B2C模式的会员电商平台,以健康安全食品,中国国家地理标志产品,药食同源产品等为主线,愿景是守护5亿家庭餐桌健康;选品原则是健康,好吃,方便,实惠。通过严格的筛选供货商,从选品、采购发货、仓储物流产品检测、售前售后等各环节严格把控,提升用户满意度。平台采取透明公开化,以持续为用户提供物美价廉的好产品为准准则,为用户创造价值为唯一宗旨,倡导终身用户,终身服务的经营理念。'}/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</Cell>
|
||||
{category.map((item, index) => (
|
||||
<Cell
|
||||
title={(
|
||||
<div className={'font-bold'} id={`${index}`}>
|
||||
{item.categoryName}
|
||||
</div>
|
||||
)}
|
||||
description={(
|
||||
<>
|
||||
<Divider/>
|
||||
<View className={'item flex justify-between items-center my-2'}>
|
||||
<View>{item.categoryName}</View>
|
||||
<ArrowRight size={16} className={'text-gray-400'}/>
|
||||
</View>
|
||||
<View className={'item flex justify-between items-center my-2'}>
|
||||
<View>{item.categoryName}</View>
|
||||
<ArrowRight size={16} className={'text-gray-400'}/>
|
||||
</View>
|
||||
</>
|
||||
)}
|
||||
>
|
||||
</Cell>
|
||||
))}
|
||||
<Cell className={'flex flex-col'}>
|
||||
<span>服务热线:0771-88888888</span>
|
||||
<span>工作日:9:00-18:00</span>
|
||||
</Cell>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,76 +1,75 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {Button, Cell, CellGroup, Input, TextArea, Form, Picker, Cascader} from '@nutui/nutui-react-taro'
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import {Button, Loading, CellGroup, Input, TextArea, Form} from '@nutui/nutui-react-taro'
|
||||
import {Scan, ArrowRight} from '@nutui/icons-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {View} from '@tarojs/components'
|
||||
import {Address} from '@nutui/nutui-react-taro'
|
||||
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
|
||||
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
|
||||
import {updateUserInfo} from "@/api/layout";
|
||||
import {getBszxClassForTree} from "@/api/bszx/bszxClass";
|
||||
import {getShopUserAddress, listShopUserAddress, updateShopUserAddress} from "@/api/shop/shopUserAddress";
|
||||
import RegionData from '@/api/json/regions-data.json';
|
||||
|
||||
const pickerOptions = [
|
||||
{value: 4, text: 'BeiJing'},
|
||||
{value: 1, text: 'NanJing'},
|
||||
{value: 2, text: 'WuXi'},
|
||||
{value: 8, text: 'DaQing'},
|
||||
{value: 9, text: 'SuiHua'},
|
||||
{value: 10, text: 'WeiFang'},
|
||||
{value: 12, text: 'ShiJiaZhuang'},
|
||||
]
|
||||
const AddUserAddress = () => {
|
||||
const {params} = useRouter();
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const [text, setText] = useState<string>('')
|
||||
const [optionsDemo1, setOptionsDemo1] = useState([])
|
||||
const [visible, setVisible] = useState(false)
|
||||
const [FormData, setFormData] = useState<ShopUserAddress>({})
|
||||
|
||||
const OrderConfirm = () => {
|
||||
const [list, setList] = useState<ShopUserAddress[]>([])
|
||||
const [classList, setClassList] = useState<any[]>()
|
||||
const [FormData, setFormData] = useState<ShopUserAddress>(
|
||||
{
|
||||
userId: undefined,
|
||||
name: undefined,
|
||||
phone: undefined,
|
||||
country: undefined,
|
||||
province: undefined,
|
||||
city: undefined,
|
||||
region: undefined,
|
||||
address: undefined,
|
||||
fullAddress: undefined,
|
||||
lat: undefined,
|
||||
lng: undefined,
|
||||
gender: undefined,
|
||||
type: undefined,
|
||||
isDefault: undefined,
|
||||
}
|
||||
)
|
||||
|
||||
const [navBarState, setNavBarState] = useState({
|
||||
visible: false
|
||||
})
|
||||
const changeNarBar = (visible) => {
|
||||
setNavBarState({
|
||||
visible
|
||||
})
|
||||
const reload = async () => {
|
||||
const address = await getShopUserAddress(Number(params.id))
|
||||
setFormData(address)
|
||||
// 设置所在地区
|
||||
setText(`${address.province} ${address.city} ${address.region}`)
|
||||
// 整理地区数据
|
||||
setRegionData()
|
||||
}
|
||||
|
||||
// 获取班级数据树
|
||||
getBszxClassForTree().then(res => {
|
||||
setClassList(res);
|
||||
})
|
||||
|
||||
const change6 = (value: any, path: any) => {
|
||||
const branch = path[0];
|
||||
changeNarBar(false)
|
||||
}
|
||||
|
||||
const reload = () => {
|
||||
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
|
||||
setList(res)
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch goods detail:", error);
|
||||
})
|
||||
/**
|
||||
* 处理地区数据
|
||||
*/
|
||||
function setRegionData() {
|
||||
// @ts-ignore
|
||||
setOptionsDemo1(RegionData?.map((a) => {
|
||||
return {
|
||||
value: a.label,
|
||||
text: a.label,
|
||||
children: a.children?.map((b) => {
|
||||
return {
|
||||
value: b.label,
|
||||
text: b.label,
|
||||
children: b.children?.map((c) => {
|
||||
return {
|
||||
value: c.label,
|
||||
text: c.label
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
const submitSucceed = (values: any) => {
|
||||
console.log(values, 'values')
|
||||
updateUserInfo(values).then(() => {
|
||||
const submitSucceed = async (values: any) => {
|
||||
|
||||
const defaultAddress = await listShopUserAddress({isDefault: true})
|
||||
if(!defaultAddress) return
|
||||
|
||||
const setNotDefault = await updateShopUserAddress({
|
||||
...defaultAddress[0],
|
||||
isDefault: false
|
||||
})
|
||||
if(!setNotDefault) return
|
||||
|
||||
updateShopUserAddress({
|
||||
...values,
|
||||
id: Number(params.id),
|
||||
province: FormData.province,
|
||||
city: FormData.city,
|
||||
region: FormData.region
|
||||
}).then(() => {
|
||||
Taro.showToast({title: `保存成功`, icon: 'success'})
|
||||
setTimeout(() => {
|
||||
return Taro.navigateBack()
|
||||
@@ -87,9 +86,15 @@ const OrderConfirm = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
reload().then(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
}, []);
|
||||
|
||||
if (loading) {
|
||||
return <Loading className={'px-2'}>加载中</Loading>
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form
|
||||
@@ -132,63 +137,47 @@ const OrderConfirm = () => {
|
||||
</CellGroup>
|
||||
<View className={'bg-gray-100 h-3'}></View>
|
||||
<CellGroup style={{padding: '4px 0'}}>
|
||||
<Form.Item name="name" label="收货人" required>
|
||||
<Form.Item name="name" label="收货人" initialValue={FormData.name} required>
|
||||
<Input placeholder="请输入收货人姓名"/>
|
||||
</Form.Item>
|
||||
<Form.Item name="phone" label="手机号" required>
|
||||
<Form.Item name="phone" label="手机号" initialValue={FormData.phone} required>
|
||||
<Input placeholder="请输入手机号"/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="所在地区"
|
||||
name="region"
|
||||
required
|
||||
initialValue={FormData.region}
|
||||
rules={[{message: '请输入您的所在地区'}]}
|
||||
required
|
||||
>
|
||||
<div className={'flex justify-between items-center'} onClick={() => changeNarBar(true)}>
|
||||
<Input placeholder="选择所在地区" disabled/>
|
||||
<div className={'flex justify-between items-center'} onClick={() => setVisible(true)}>
|
||||
<Input placeholder="选择所在地区" value={text} disabled/>
|
||||
<ArrowRight className={'text-gray-400'}/>
|
||||
</div>
|
||||
</Form.Item>
|
||||
<Form.Item name="address" label="收货地址" required>
|
||||
<Form.Item name="address" label="收货地址" initialValue={FormData.address} required>
|
||||
<Input placeholder="请输入详细收货地址"/>
|
||||
</Form.Item>
|
||||
</CellGroup>
|
||||
</Form>
|
||||
<Cascader
|
||||
popupProps={{
|
||||
className: 'cascader-popup',
|
||||
}}
|
||||
visible={navBarState.visible}
|
||||
optionKey={{valueKey: 'name', textKey: 'name', childrenKey: 'children'}}
|
||||
title="选择所在地区"
|
||||
options={classList}
|
||||
closeable
|
||||
onChange={change6}
|
||||
onClose={() => {
|
||||
changeNarBar(false)
|
||||
|
||||
<Address
|
||||
visible={visible}
|
||||
options={optionsDemo1}
|
||||
title="选择地址"
|
||||
onChange={(value, _) => {
|
||||
setFormData({
|
||||
...FormData,
|
||||
province: `${value[0]}`,
|
||||
city: `${value[1]}`,
|
||||
region: `${value[2]}`
|
||||
})
|
||||
setText(value.join(' '))
|
||||
}}
|
||||
onClose={() => setVisible(false)}
|
||||
/>
|
||||
|
||||
{/*<CellGroup>*/}
|
||||
{/* <Cell>*/}
|
||||
{/* <div className={'flex items-center'}>*/}
|
||||
{/* <Image src={goods.image} width="80" height="80"/>*/}
|
||||
{/* <div className={'ml-2'}>*/}
|
||||
{/* <div className={'text-sm font-bold'}>{goods.name}</div>*/}
|
||||
{/* <div className={'text-red-500 text-lg'}>¥{goods.price}</div>*/}
|
||||
{/* </div>*/}
|
||||
{/* </div>*/}
|
||||
{/* </Cell>*/}
|
||||
{/*</CellGroup>*/}
|
||||
|
||||
{/*<div className={'fixed-bottom'}>*/}
|
||||
{/* <div className={'total-price'}>*/}
|
||||
{/* 合计:<span className={'text-red-500 text-xl font-bold'}>¥{goods.price}</span>*/}
|
||||
{/* </div>*/}
|
||||
{/* <Button type="primary" size="large" className={'submit-btn'}>提交订单</Button>*/}
|
||||
{/*</div>*/}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default OrderConfirm;
|
||||
export default AddUserAddress;
|
||||
|
||||
@@ -4,17 +4,54 @@ import {Dongdong, ArrowRight, CheckNormal, Checked} from '@nutui/icons-react-tar
|
||||
import Taro from '@tarojs/taro'
|
||||
import {View} from '@tarojs/components'
|
||||
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
|
||||
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
|
||||
import {listShopUserAddress, removeShopUserAddress, updateShopUserAddress} from "@/api/shop/shopUserAddress";
|
||||
|
||||
const Address = () => {
|
||||
const [list, setList] = useState<ShopUserAddress[]>([{},{},{},{}])
|
||||
const [list, setList] = useState<ShopUserAddress[]>([])
|
||||
const [address, setAddress] = useState<ShopUserAddress>()
|
||||
|
||||
const reload = () => {
|
||||
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
|
||||
// setList(res)
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch goods detail:", error);
|
||||
listShopUserAddress({
|
||||
userId: Taro.getStorageSync('UserId')
|
||||
})
|
||||
.then(data => {
|
||||
setList(data || [])
|
||||
// 默认地址
|
||||
setAddress(data.find(item => item.isDefault))
|
||||
})
|
||||
.catch(() => {
|
||||
Taro.showToast({
|
||||
title: '获取地址失败',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
const onDefault = async (item) => {
|
||||
if(address){
|
||||
await updateShopUserAddress({
|
||||
...address,
|
||||
isDefault: false
|
||||
})
|
||||
}
|
||||
await updateShopUserAddress({
|
||||
id: item.id,
|
||||
isDefault: true
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '设置成功',
|
||||
icon: 'success'
|
||||
});
|
||||
reload();
|
||||
}
|
||||
|
||||
const onDel = async (id?: number) => {
|
||||
await removeShopUserAddress(id)
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
reload();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -35,26 +72,14 @@ const Address = () => {
|
||||
/>
|
||||
<Space>
|
||||
<Button onClick={() => Taro.navigateTo({url: '/user/address/add'})}>新增地址</Button>
|
||||
<Button type="success" fill="dashed">获取微信地址</Button>
|
||||
<Button type="success" fill="dashed"
|
||||
onClick={() => Taro.navigateTo({url: '/user/address/wxAddress'})}>获取微信地址</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</ConfigProvider>
|
||||
)
|
||||
}
|
||||
|
||||
if (list.length == 0) {
|
||||
return (
|
||||
<CellGroup>
|
||||
<Cell className={''}>
|
||||
<Space>
|
||||
<Button>新增地址</Button>
|
||||
<Button>获取微信地址</Button>
|
||||
</Space>
|
||||
</Cell>
|
||||
</CellGroup>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<CellGroup>
|
||||
@@ -70,46 +95,31 @@ const Address = () => {
|
||||
</div>
|
||||
</Cell>
|
||||
</CellGroup>
|
||||
{list.map((item,index) => (
|
||||
// <CellGroup key={item.id}>
|
||||
// <Cell title={item.name}
|
||||
// extra={
|
||||
// <Button
|
||||
// type="primary"
|
||||
// size="small"
|
||||
// >
|
||||
// 修改
|
||||
// </Button>
|
||||
// }
|
||||
// >
|
||||
// <div className={'text-sm'}>{item.fullAddress}</div>
|
||||
//
|
||||
// </Cell>
|
||||
// </CellGroup>
|
||||
{list.map((item, _) => (
|
||||
<Cell.Group>
|
||||
<Cell className={'flex flex-col gap-1'}>
|
||||
<View>
|
||||
<View className={'font-medium text-sm'}>赵四 13800010001</View>
|
||||
<View className={'font-medium text-sm'}>{item.name} {item.phone}</View>
|
||||
</View>
|
||||
<View className={'text-xs'}>
|
||||
广西壮族自治区南宁市青秀区金湖路13号
|
||||
{item.province} {item.city} {item.region} {item.address}
|
||||
</View>
|
||||
</Cell>
|
||||
<Cell
|
||||
align="center"
|
||||
title={
|
||||
<View className={'flex items-center gap-1'}>
|
||||
{index == 0 ? <Checked className={'text-green-600'} size={16}/> : <CheckNormal size={16} />}
|
||||
<View className={'flex items-center gap-1'} onClick={() => onDefault(item)}>
|
||||
{item.isDefault ? <Checked className={'text-green-600'} size={16}/> : <CheckNormal size={16}/>}
|
||||
<View className={'text-gray-400'}>默认地址</View>
|
||||
</View>
|
||||
}
|
||||
extra={
|
||||
<>
|
||||
<View className={'text-gray-400'}>
|
||||
<View className={'text-gray-400'} onClick={() => onDel(item.id)}>
|
||||
删除
|
||||
</View>
|
||||
<Divider direction={'vertical'}/>
|
||||
<View className={'text-gray-400'}>
|
||||
<View className={'text-gray-400'} onClick={() => Taro.navigateTo({url: '/user/address/add?id=' + item.id})}>
|
||||
修改
|
||||
</View>
|
||||
</>
|
||||
|
||||
@@ -1,90 +1,65 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {Button, Cell, CellGroup, Space, Empty, ConfigProvider} from '@nutui/nutui-react-taro'
|
||||
import {Dongdong} from '@nutui/icons-react-taro'
|
||||
import {useEffect} from "react";
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
|
||||
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
|
||||
import {addShopUserAddress} from "@/api/shop/shopUserAddress";
|
||||
|
||||
const Address = () => {
|
||||
const [list, setList] = useState<ShopUserAddress[]>([{
|
||||
id: 1,
|
||||
name: '张三',
|
||||
phone: '13800138000',
|
||||
country: '中国',
|
||||
province: '广东省',
|
||||
city: '广州市',
|
||||
region: '天河区',
|
||||
address: '黄埔大道西10号',
|
||||
fullAddress: '广东省广州市天河区黄埔大道西10号',
|
||||
lat: '23.129163',
|
||||
lng: '113.382391',
|
||||
gender: 1,
|
||||
type: 'home',
|
||||
isDefault: true,
|
||||
userId: 1,
|
||||
tenantId: 1,
|
||||
createTime: '2021-09-01 10:10:10',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '李四',
|
||||
phone: '13800138000',
|
||||
country: '中国',
|
||||
province: '广西壮族自治区',
|
||||
city: '南宁市',
|
||||
region: '青秀区',
|
||||
address: '青秀区民族大道100号',
|
||||
fullAddress: '广西壮族自治区南宁市青秀区民族大道100号',
|
||||
lat: '23.129163',
|
||||
lng: '113.382391',
|
||||
gender: 1,
|
||||
type: 'home',
|
||||
isDefault: true,
|
||||
userId: 1,
|
||||
tenantId: 1,
|
||||
createTime: '2021-09-01 10:10:10',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '张三',
|
||||
phone: '13800138000',
|
||||
country: '中国',
|
||||
province: '广西',
|
||||
city: '南宁市',
|
||||
region: '青秀区',
|
||||
address: '青秀区民族大道100号',
|
||||
fullAddress: '广西壮族自治区南宁市青秀区民族大道100号',
|
||||
lat: '23.129163',
|
||||
lng: '113.382391',
|
||||
gender: 1,
|
||||
type: 'home',
|
||||
isDefault: true,
|
||||
userId: 1,
|
||||
tenantId: 1,
|
||||
createTime: '2021-09-01 10:10:10',
|
||||
}])
|
||||
|
||||
const reload = () => {
|
||||
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
|
||||
// setList(res)
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch goods detail:", error);
|
||||
})
|
||||
/**
|
||||
* 从微信API获取用户收货地址
|
||||
* 调用微信原生地址选择界面,获取成功后保存到服务器并刷新列表
|
||||
*/
|
||||
const getWeChatAddress = () => {
|
||||
Taro.chooseAddress()
|
||||
.then(res => {
|
||||
// 格式化微信返回的地址数据为后端所需格式
|
||||
const addressData = {
|
||||
name: res.userName,
|
||||
phone: res.telNumber,
|
||||
country: res.nationalCode || '中国',
|
||||
province: res.provinceName,
|
||||
city: res.cityName,
|
||||
region: res.countyName,
|
||||
address: res.detailInfo,
|
||||
postalCode: res.postalCode,
|
||||
isDefault: false
|
||||
}
|
||||
console.log(res, 'addrs..')
|
||||
// 调用保存地址的API(假设存在该接口)
|
||||
addShopUserAddress(addressData)
|
||||
.then((msg) => {
|
||||
console.log(msg)
|
||||
Taro.showToast({
|
||||
title: `${msg}`,
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// 保存成功后返回
|
||||
Taro.navigateBack()
|
||||
}, 1000)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('保存地址失败:', error)
|
||||
Taro.showToast({title: '保存地址失败', icon: 'error'})
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('获取微信地址失败:', err)
|
||||
// 处理用户拒绝授权的情况
|
||||
if (err.errMsg.includes('auth deny')) {
|
||||
Taro.showModal({
|
||||
title: '授权失败',
|
||||
content: '请在设置中允许获取地址权限',
|
||||
showCancel: false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
getWeChatAddress()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{list.map((item) => (
|
||||
<div className={'flex flex-col bg-white my-3 py-1 px-4'}>
|
||||
<div className={'py-1'}>{item.province}{item.city}{item.region}</div>
|
||||
<div className={'py-1'}>{item.address}</div>
|
||||
<div className={'text-gray-500 py-1'}>{item.name} {item.phone}</div>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
import {listCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import {Collapse} from '@nutui/nutui-react-taro'
|
||||
import {Collapse, Image, SearchBar} from '@nutui/nutui-react-taro'
|
||||
import {ArrowDown} from '@nutui/icons-react-taro'
|
||||
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
|
||||
import {listCmsNavigation} from "@/api/cms/cmsNavigation";
|
||||
|
||||
|
||||
const Helper = () => {
|
||||
const [list, setList] = useState<CmsArticle[]>([])
|
||||
const [navigation, setNavigation] = useState<CmsNavigation>()
|
||||
|
||||
const [category, setCategory] = useState();
|
||||
const getData = () => {
|
||||
fetch("https://storage.360buyimg.com/nutui/3x/new-categoryData.js")
|
||||
.then((response) => response.json())
|
||||
.then((res) => {
|
||||
setCategory(res.categoryInfo.category)
|
||||
})
|
||||
.catch((err) => console.log("Oh, error", err));
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
const reload = async () => {
|
||||
const navs = await listCmsNavigation({model: 'help', parentId: 0});
|
||||
if (navs.length > 0) {
|
||||
const nav = navs[0];
|
||||
setNavigation(nav);
|
||||
}
|
||||
listCmsArticle({model: 'help'}).then(res => {
|
||||
setList(res)
|
||||
}).catch(error => {
|
||||
@@ -26,13 +25,35 @@ const Helper = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
getData();
|
||||
reload().then()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/*<Category category={category} showSecondLevelQuickNav={true}></Category>*/}
|
||||
<SearchBar shape="round" maxLength={5} className={'mt-2'} />
|
||||
{navigation && (
|
||||
<Image
|
||||
src={navigation.icon}
|
||||
mode={'scaleToFill'}
|
||||
className={'mt-2 mb-4 w-full'}
|
||||
height={120}
|
||||
lazyLoad={false}
|
||||
/>
|
||||
)}
|
||||
{list.map((item, index) => (
|
||||
<Collapse defaultActiveName={['1', '2']} expandIcon={<ArrowDown/>}>
|
||||
<Collapse.Item
|
||||
title={
|
||||
<div className={'flex items-center'}>
|
||||
<div className={'text-sm'}>{item.title}</div>
|
||||
</div>
|
||||
}
|
||||
name={`${index}`}
|
||||
>
|
||||
<div className={'text-sm'}>{item.comments}</div>
|
||||
</Collapse.Item>
|
||||
</Collapse>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ function Profile() {
|
||||
avatar: `${detail.avatarUrl}`,
|
||||
})
|
||||
Taro.uploadFile({
|
||||
url: 'https://server.websoft.top/api/oss/upload',
|
||||
url: 'https://server.gxwebsoft.com/api/oss/upload',
|
||||
filePath: detail.avatarUrl,
|
||||
name: 'file',
|
||||
header: {
|
||||
|
||||
@@ -233,11 +233,11 @@ function Index() {
|
||||
>
|
||||
<div className={'flex gap-2'}>
|
||||
<div onClick={uploadSfz1}>
|
||||
<Image src={FormData.sfz1}
|
||||
<Image src={FormData.sfz1} lazyLoad={false}
|
||||
radius="10%" width="80" height="80"/>
|
||||
</div>
|
||||
<div onClick={uploadSfz2}>
|
||||
<Image src={FormData.sfz2} mode={'scaleToFill'}
|
||||
<Image src={FormData.sfz2} mode={'scaleToFill'} lazyLoad={false}
|
||||
radius="10%" width="80" height="80"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -286,7 +286,7 @@ function Index() {
|
||||
]}
|
||||
>
|
||||
<div onClick={uploadZzImg}>
|
||||
<Image src={FormData.zzImg} mode={'scaleToFill'}
|
||||
<Image src={FormData.zzImg} mode={'scaleToFill'} lazyLoad={false}
|
||||
radius="10%" width="80" height="80"/>
|
||||
</div>
|
||||
</Form.Item>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// 租户ID
|
||||
export const TenantId = 10550;
|
||||
// 接口地址
|
||||
export const BaseUrl = 'https://cms-api.websoft.top/api';
|
||||
export const BaseUrl = 'https://cms.websoft.top/api';
|
||||
// 当前版本
|
||||
export const Version = 'v3.0.8';
|
||||
// 版权信息
|
||||
|
||||
@@ -3,8 +3,9 @@ import {BaseUrl, TenantId} from "@/utils/config";
|
||||
|
||||
let baseUrl = BaseUrl
|
||||
|
||||
// 开发环境
|
||||
if(process.env.NODE_ENV === 'development'){
|
||||
// baseUrl = 'http://localhost:9000/api'
|
||||
baseUrl = 'http://localhost:9000/api'
|
||||
}
|
||||
export function request<T>(options:any) {
|
||||
const token = Taro.getStorageSync('access_token');
|
||||
|
||||
@@ -4,7 +4,7 @@ import {User} from "@/api/system/user/model";
|
||||
// 模版套餐ID
|
||||
export const TEMPLATE_ID = 10258;
|
||||
// 服务接口
|
||||
export const SERVER_API_URL = 'https://server.websoft.top/api';
|
||||
export const SERVER_API_URL = 'https://server.gxwebsoft.com/api';
|
||||
// export const SERVER_API_URL = 'http://127.0.0.1:8000/api';
|
||||
/**
|
||||
* 保存用户信息到本地存储
|
||||
|
||||
Reference in New Issue
Block a user