diff --git a/config/index.js b/config/index.js index 873bee4..c6e3f18 100644 --- a/config/index.js +++ b/config/index.js @@ -20,13 +20,14 @@ const config = { framework: 'react', compiler: 'webpack5', cache: { - enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache + enable: true // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache }, sass: {}, alias: { "@": path.resolve(__dirname, '..', 'src') }, mini: { + debugReact: true, postcss: { pxtransform: { enable: true, diff --git a/src/api/illness.ts b/src/api/illness.ts index 5d26a16..2fc86bd 100644 --- a/src/api/illness.ts +++ b/src/api/illness.ts @@ -1,11 +1,13 @@ import {request} from "@/api/request"; export interface Illness { - name: string; - description: string; - resource: any; - album: string[] - created_at:string + illness: { + name: string; + description: string; + resource: any; + album: string[] + created_at: string + } list: { list: any[], total: number @@ -18,7 +20,6 @@ export const illnessApi = { return request<{ list: any[], total: number }>(`/home/v1/illness/list`, "GET", {page, page_size, id}) }, articleInfo(owner_id: number, page: number, page_size: number) { - return request<{ illness: Illness }> - (`/home/v1/article/illness_list`, "GET", {page, page_size, owner_id}) + return request(`/home/v1/article/illness_list`, "GET", {page, page_size, owner_id}) }, } diff --git a/src/app.scss b/src/app.scss index af88b78..260f4e9 100644 --- a/src/app.scss +++ b/src/app.scss @@ -1,5 +1,5 @@ @import "static/css/module"; -@import 'taro-ui/dist/style/index.scss'; +//@import 'taro-ui/dist/style/index.scss'; .flex {display: flex !important;flex-direction:row} .flex-row{ flex-direction:row!important} diff --git a/src/components/image/image.tsx b/src/components/image/image.tsx index b68cc44..82fb967 100644 --- a/src/components/image/image.tsx +++ b/src/components/image/image.tsx @@ -24,7 +24,6 @@ const Img: FC = ({src, mode = 'aspectFill', width, fallback = shard, ...p const imgAnimation = Taro.createAnimation({duration: 0}).opacity(0).step() const [animationData, setAnimationData] = useState(imgAnimation.export()) - useEffect(() => { if (!isError && props.fit) { Taro.getImageInfo({ diff --git a/src/components/learningRecord/learningRecord.tsx b/src/components/learningRecord/learningRecord.tsx index 8e3db5c..38944e0 100644 --- a/src/components/learningRecord/learningRecord.tsx +++ b/src/components/learningRecord/learningRecord.tsx @@ -5,7 +5,7 @@ import LineChart from "@/components/lineChart/lineChart"; import {CSSProperties, FC, useEffect, useState} from "react"; import {StatisticsParam, userApi} from "@/api"; import styles from './learningRecord.module.scss' -// import Spin from "@/components/spinner"; +import Spin from "@/components/spinner"; import {Profile} from "@/store"; import Taro from "@tarojs/taro"; import debounce from "@/utils/debounce"; @@ -44,7 +44,7 @@ interface Props { */ const LearningRecord: FC = ({userId, style, className}) => { const [lineData, setLineData] = useState([]) - // const [loading, setLoading] = useState(false) + const [loading, setLoading] = useState(false) const {token} = Profile.useContainer() async function getStatistics(data: StatisticsParam) { @@ -64,21 +64,26 @@ const LearningRecord: FC = ({userId, style, className}) => { Taro.navigateTo({url: '/pages/login/login'}) return } - // getStatistics(tab?.value! as StatisticsParam) - debounce(()=>{ - // console.log(this,'this') - getStatistics(tab?.value! as StatisticsParam) + setLoading(true) + debounce(() => { + try { + getStatistics(tab?.value! as StatisticsParam).then() + } catch (e) { + } + setLoading(false) }) } useEffect(() => { - userId && setTimeout(() => {getStatistics(tabList[0].value)},500) + userId && setTimeout(() => { + getStatistics(tabList[0].value) + }, 500) }, [userId]) return ( - {/**/} + {loading && } 总共学习 diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index 2514196..f30351b 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -51,8 +51,8 @@ const Home: FC = () => { cancelBack leftNode={ <> - - 信桂 + + 信桂 } > diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index 3902939..2c0c6b3 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -15,7 +15,7 @@ const BrandList: FC = () => { const [enable, setEnable] = useState(true) useEffect(() => { - getData().then() + getData() }, [page]) const getData = useCallback(async () => { diff --git a/src/pages/preview/videoFull/videoFull.tsx b/src/pages/preview/videoFull/videoFull.tsx index 8fa6846..20f60a1 100644 --- a/src/pages/preview/videoFull/videoFull.tsx +++ b/src/pages/preview/videoFull/videoFull.tsx @@ -91,12 +91,12 @@ const VideoFull: FC = () => { data ? <>