shenwu hace 6 meses
padre
commit
abdb1b474d

+ 1 - 0
src/components/PupPetry/BookTypeTabs/index.less

@@ -4,6 +4,7 @@
     display: flex;
     justify-content: flex-start;
     flex-wrap: wrap;
+    transition:all 1s ease;
     .typeTab{
         width: 25%;    
         padding: 15px;

BIN
src/icon/copy.png


+ 10 - 2
src/pages/bookrack/index.tsx

@@ -33,6 +33,7 @@ const Index: React.FC<Props> = ({ store }) => {
         records: []
     })
     const [pageShow, setPageShow] = useState(false)
+    const [showEmpty, setShowEmpty] = useState(false)
     const actions = (id) => {
         return [
             {
@@ -61,7 +62,11 @@ const Index: React.FC<Props> = ({ store }) => {
         setPageShow(false)
     });
     const getList = (params) => {
+        showEmpty && setShowEmpty(false)
         bookrackList(params).then((res: any) => {
+            if (res?.data?.data?.total === 0) {
+                !showEmpty && setShowEmpty(true)
+             }
             setReadData(res.data.data)
             return res
         })
@@ -113,13 +118,16 @@ const Index: React.FC<Props> = ({ store }) => {
         >
             <View className={"index pd_btm"}>
                 {
-                    readData?.records?.length > 0 ? readData?.records?.map((item: any, index: number) => {
+                    readData?.records?.length > 0 && readData?.records?.map((item: any, index: number) => {
                         return <View key={item.bookId} style={{ margin: '30rpx' }}>
                             <SwipeAction actions={actions(item.bookId)}>
                                 <BookboxRowSmall {...item} />
                             </SwipeAction>
                         </View>
-                    }) : <Empty />
+                    })
+                }
+                {
+                    showEmpty && <Empty />
                 }
             </View>
         </ScrollViewHoc>

+ 12 - 7
src/pages/classify/index.tsx

@@ -26,13 +26,12 @@ const Index = forwardRef((props: Props) => {
     const [pageShow, setPageShow] = useState(false)//防止小程序切换页面组件不会被真实卸载,阻止不必要的操作
     const [isFixed, setIsFixed] = useState(false)
     const [open, setOpen] = useState(false)
-    let openRef = useRef<any>(null)
+    const [showEmpty, setShowEmpty] = useState(false)
     // 获取分类列表
     useEffect(() => {
         if (pageShow) {
             let { workDirection } = bookStore
             getBookCategoryList(workDirection)
-
         }
     }, [bookStore.workDirection, pageShow]); // Dependency array, runs effect only once on mount and unmount
     //获取书籍列表
@@ -40,7 +39,12 @@ const Index = forwardRef((props: Props) => {
         if (pageShow) {
             let { workDirection } = bookStore
             let { categoryId } = classifyStore
-            categoryId.id != 0 && classifyStore.categoryId && getList({ workDirection, categoryId: categoryId.id, pageNum: 1, pageSize: 10 })
+            showEmpty && setShowEmpty(false)
+            categoryId.id != 0 && classifyStore.categoryId && getList({ workDirection, categoryId: categoryId.id, pageNum: 1, pageSize: 10 }).then((res: any) => {
+                if (res?.data?.data?.total === 0) {
+                   !showEmpty && setShowEmpty(true)
+                }
+            })
         }
     }, [bookStore.workDirection, classifyStore.categoryId, pageShow])
     // 使用 useDidShow 代替 onShow
@@ -103,7 +107,6 @@ const Index = forwardRef((props: Props) => {
         }
         return {}
     })
-    
     return (
 
         <View className='index'>
@@ -120,12 +123,14 @@ const Index = forwardRef((props: Props) => {
             }} load={load} refresh={refresh} reloadState={open} filterClassName='.classList' navHeight={indexStore.navHeight}>
                 <View className='w  row for_top1 pd_btm'>
                     {
-                        bookStore?.bookList?.records?.length > 0 ? bookStore?.bookList?.records?.map((item, index) => {
+                        bookStore?.bookList?.records?.length > 0 && bookStore?.bookList?.records?.map((item, index) => {
                             return <>
                                 <View key={item.bookId} ><BookboxRowBig {...item} /></View>
                             </>
-                        }) :
-                            <Empty />
+                        })
+                    }
+                    {
+                        showEmpty && <Empty />
                     }
                 </View>
             </ScrollViewHoc>

+ 24 - 10
src/pages/my/index.less

@@ -61,17 +61,28 @@ page {
                         flex-wrap: wrap;
                         flex: 1;
 
-                        .ID {
-                            font-size: 32px;
-                            font-family: PingFangSC-Medium, PingFang SC;
-                            font-weight: 500;
-                            color: @cl_666;
-                            overflow: hidden;
-                            text-overflow: ellipsis;
-                            white-space: nowrap;
-                            margin-right: 8px;
+                        .name_id {
+                            display: flex;
+                            align-items: center;
+                            .copy {
+                                width: 36px;
+                                height: 40px;
+                            }
+                            .ID {
+                                display: inline-block;
+                                font-size: 32px;
+                                font-family: PingFangSC-Medium, PingFang SC;
+                                font-weight: 500;
+                                color: @cl_666;
+                                overflow: hidden;
+                                text-overflow: ellipsis;
+                                white-space: nowrap;
+                                margin-right: 8px;
+                                width: 70%;
+                            }
                         }
 
+
                         .grade {
                             height: 36px;
                             width: 90px;
@@ -251,9 +262,11 @@ page {
                     flex-flow: column;
                     float: left;
                     align-items: center;
-                    &:nth-child(2){
+
+                    &:nth-child(2) {
                         margin-left: 86rpx;
                     }
+
                     text:last-child {
                         width: 48rpx;
                         height: 34rpx;
@@ -266,6 +279,7 @@ page {
                         font-style: normal;
                         text-transform: none;
                     }
+
                     text:first-child {
                         height: 50rpx;
                         font-family: PingFang SC, PingFang SC;

+ 41 - 10
src/pages/my/index.tsx

@@ -1,6 +1,6 @@
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
 import Taro, { useDidHide, useShareAppMessage } from '@tarojs/taro'
-import { View, Text, Image, Navigator } from '@tarojs/components'
+import { View, Text, Image, Navigator, Button } from '@tarojs/components'
 import { observer, inject } from 'mobx-react'
 import './index.less'
 import { Store } from '@src/app'
@@ -15,7 +15,7 @@ interface Props {
 function My(props: Props) {
     let { userInfoStore, indexStore } = props.store
     const [payType, setPayType] = useState<"shubi" | "vip">("shubi")
-
+    let [wxUser, setWxUser] = useState<any>(null)
     //支付弹窗
     const payBtn = (e, type) => {
         e.stopPropagation()
@@ -45,20 +45,51 @@ function My(props: Props) {
         }
         return {}
     })
+    useEffect(() => {
+    }, [])
+
+    const getUserInfo = () => {
+        // if(!wxUser){
+        //     Taro.getUserProfile({
+        //         desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+        //         success: (res) => {
+        //             // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
+        //             console.log("res", res)
+        //             setWxUser(res.userInfo)
+        //         }
+        //     })
+        // }
+    }
+    const copy = () => {
+        Taro.setClipboardData({
+            data: userInfoStore?.userInfo?.openId || "",
+            success: function (res) {
+                Taro.getClipboardData({
+                    success: function (res) {
+                        Taro.showToast({
+                            title: "复制成功",
+                            icon: "success"
+                        })
+                    }
+                })
+            }
+        })
+    }
     return <View className='my'>
         <View className="userInfo">
             <View className="userInfo_box">
                 {/* 个人信息 */}
-                <View className="top" >
-                    <View className="left">
+                <View className="top" onClick={getUserInfo}>
+                    <View className="left" >
                         <View className="avtai">
-                            <Image mode="widthFix" lazy-load src={userInfoStore.userInfo?.avatarUrl ? userInfoStore.userInfo?.avatarUrl : require('../../icon/avatar.jpg')} />
+                            {/* || (userInfoStore.userInfo?.avatarUrl ? userInfoStore.userInfo?.avatarUrl : require('../../icon/avatar.jpg')) */}
+                            <Image mode="widthFix" lazy-load src={"https://test-book-content.oss-cn-hangzhou.aliyuncs.com/bookImageFE90FDA493CE46C694B423F4F4EA7BCB.jpg"} />
                         </View>
                         <View className="name" style={userInfoStore.isAuth ? { width: Taro.pxTransform(120) } : {}}>
-                            {
-                                userInfoStore?.userInfo?.nickname ? <View className="ID">{userInfoStore?.userInfo?.nickname || ""}</View> :
-                                    <View className="ID">{userInfoStore?.userInfo?.openId}</View>
-                            }
+                            <View className='name_id'>
+                                <Text className="ID">ID:{userInfoStore?.userInfo?.nickname || userInfoStore?.userInfo?.openId}</Text>
+                                <Image onClick={copy} className='copy' lazy-load src={require('../../icon/copy.png')} />
+                            </View>
                             {
                                 userInfoStore.isVip && <View className="grade">
                                     <Image lazy-load src={require('../../icon/grade.png')} />