订单列表对接
This commit is contained in:
@@ -4,12 +4,11 @@ import { useMemo, useRef, useState } from "react"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type item = {title:string, img:string, url:string, id:number}
|
||||
|
||||
type params = {
|
||||
list?: item[]
|
||||
}
|
||||
|
||||
export default ({list = []}: params) => {
|
||||
|
||||
const [pageIndex, setPageIndex] = useState(1)
|
||||
const pageRef = useRef<any>(null)
|
||||
|
||||
@@ -26,13 +25,13 @@ export default ({list = []}: params) => {
|
||||
<Swiper className={styles.swiper_item} circular={true} onAnimationFinish={(e) => swiperChange(e)}>
|
||||
{list.map((item) => {
|
||||
return <SwiperItem key={item.id}>
|
||||
<View className={styles.image_item} >
|
||||
<Image mode="aspectFill" src={formatImgUrl(item)}></Image>
|
||||
</View>
|
||||
<View className={styles.image_item} >
|
||||
<Image mode="aspectFill" src={formatImgUrl(item)}></Image>
|
||||
</View>
|
||||
</SwiperItem>
|
||||
})}
|
||||
</Swiper>
|
||||
<View className={styles.page} ref={pageRef}>{pageIndex+'/'+pageCount}</View>
|
||||
{(list.length > 0)&&<View className={styles.page} ref={pageRef}>{pageIndex+'/'+pageCount}</View>}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
export default {
|
||||
navigationBarTitleText: '详情',
|
||||
enablePullDownRefresh: true,
|
||||
backgroundTextStyle: 'dark'
|
||||
backgroundTextStyle: 'dark',
|
||||
enableShareAppMessage: true
|
||||
}
|
||||
|
||||
+19
-17
@@ -1,5 +1,5 @@
|
||||
|
||||
import { Button, CustomWrapper, Image, RichText, ScrollView, Swiper, SwiperItem, Text, View } from '@tarojs/components'
|
||||
import { Button, CustomWrapper, Image, RichText, Text, View } from '@tarojs/components'
|
||||
import Taro, { useDidShow, usePullDownRefresh, useRouter, useShareAppMessage } from '@tarojs/taro';
|
||||
import classnames from "classnames";
|
||||
import DesSwiper from './components/swiper';
|
||||
@@ -7,13 +7,11 @@ import OrderCount from './components/orderCount';
|
||||
import ShopCart from '@/components/shopCart';
|
||||
import Preview,{colorItem} from './components/preview';
|
||||
import styles from './index.module.scss'
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {formatHashTag, formatImgUrl} from '@/common/fotmat'
|
||||
import useManualPullDownRefresh from '@/use/useManualPullDownRefresh';
|
||||
import { goLink } from '@/common/common';
|
||||
import useUserInfo from '@/use/useUserInfo';
|
||||
import {GetProductDetailApi} from '@/api/material'
|
||||
import useLogin from '@/use/useLogin';
|
||||
import { useSelector } from '@/reducers/hooks';
|
||||
|
||||
type item = {title:string, img:string, url:string, id:number}
|
||||
|
||||
@@ -49,14 +47,12 @@ export default (props:params) => {
|
||||
},[productInfo])
|
||||
|
||||
const [showCart, setShowCart] = useState(false)
|
||||
|
||||
const [showOrderCount, setShowOrderCount] = useState(false)
|
||||
|
||||
const html = `
|
||||
<img style="width:100%" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic24.nipic.com%2F20121021%2F10910884_100200815001_2.jpg&refer=http%3A%2F%2Fpic24.nipic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652257920&t=9353dda34f18ae2fe6803f3da35954bb">
|
||||
`
|
||||
|
||||
|
||||
//弹窗提示
|
||||
const [colorInfo, setColorInfo] = useState<colorItem>()
|
||||
const [showPreview, setShowPreview] = useState(false)
|
||||
const getColorItem = (item) => {
|
||||
@@ -67,6 +63,7 @@ export default (props:params) => {
|
||||
setShowPreview(true)
|
||||
}
|
||||
|
||||
//收藏功能
|
||||
const [collectStatus, setCollectStatus] = useState(false)
|
||||
const changeCollect = () => {
|
||||
setCollectStatus(!collectStatus)
|
||||
@@ -77,18 +74,26 @@ export default (props:params) => {
|
||||
})
|
||||
}
|
||||
|
||||
//转发分享
|
||||
const userObj = useSelector(state => state.userInfo)
|
||||
useShareAppMessage(res => {
|
||||
let path = ''
|
||||
let title = ''
|
||||
let imageUrl = ''
|
||||
if (res.from === 'button') {
|
||||
// 来自页面内转发按钮
|
||||
console.log(res.target)
|
||||
path = `/pages/details/index?id=${userObj.sort_code.shareShortDetail}`
|
||||
title = productName as string
|
||||
// imageUrl =
|
||||
} else {
|
||||
path = `/pages/details/index?id=${userObj.sort_code.shareShortPage}`
|
||||
title = '陆盈电子商城'
|
||||
}
|
||||
return {
|
||||
title: '自定义转发标题',
|
||||
path: '/pages/details/index?id=10',
|
||||
imageUrl: ''
|
||||
title,
|
||||
path,
|
||||
imageUrl,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
//开始下单
|
||||
const placeOrder = async (e:any) => {
|
||||
@@ -108,7 +113,6 @@ export default (props:params) => {
|
||||
//页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getProductDetail()
|
||||
|
||||
})
|
||||
|
||||
|
||||
@@ -123,13 +127,11 @@ export default (props:params) => {
|
||||
<View className={styles.share}>
|
||||
<View className={classnames('iconfont icon-fenxiang', styles.miconfont)}></View>
|
||||
<View className={styles.text}>分享</View>
|
||||
|
||||
<Button open-type="share" className={styles.shareBtn}></Button>
|
||||
</View>
|
||||
<View className={styles.collect}>
|
||||
<View className={classnames('iconfont icon-shoucang', styles.miconfont, collectStatus&&styles.collected)} onClick={() => changeCollect()}></View>
|
||||
<View className={styles.text}>收藏</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.des_data}>
|
||||
|
||||
Reference in New Issue
Block a user