From 1ca03dddf573fbdc54a971892fd3fe7f848feb66 Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Fri, 18 Aug 2023 11:17:38 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E5=93=81=E7=89=8C=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 6 + .../brand/list/components/BrandView.config.ts | 3 + src/pages/brand/list/components/BrandView.tsx | 176 ++++++++++++++++++ src/pages/brand/list/list.config.ts | 4 + src/pages/brand/list/list.module.scss | 43 +++++ src/pages/brand/list/list.tsx | 84 +++++++++ 6 files changed, 316 insertions(+) create mode 100644 src/pages/brand/list/components/BrandView.config.ts create mode 100644 src/pages/brand/list/components/BrandView.tsx create mode 100644 src/pages/brand/list/list.config.ts create mode 100644 src/pages/brand/list/list.module.scss create mode 100644 src/pages/brand/list/list.tsx diff --git a/src/app.config.ts b/src/app.config.ts index 9126b65..2ac1731 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -69,6 +69,12 @@ export default defineAppConfig({ 'userInfo/userInfo', 'courseAdmin/courseAdmin', ] + }, + { + root: 'pages/brand', + pages: [ + 'list/list', + ] } ], lazyCodeLoading: "requiredComponents" diff --git a/src/pages/brand/list/components/BrandView.config.ts b/src/pages/brand/list/components/BrandView.config.ts new file mode 100644 index 0000000..67241a3 --- /dev/null +++ b/src/pages/brand/list/components/BrandView.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '登记', +}) diff --git a/src/pages/brand/list/components/BrandView.tsx b/src/pages/brand/list/components/BrandView.tsx new file mode 100644 index 0000000..16c8e89 --- /dev/null +++ b/src/pages/brand/list/components/BrandView.tsx @@ -0,0 +1,176 @@ +import {FC, useCallback, useEffect, useState} from "react"; +import {Form, Input, View} from "@tarojs/components"; +import Taro, {useRouter} from "@tarojs/taro"; +import {userApi, loginApi, LoginParams, meetingAPi, Meeting} from "@/api"; +import {Profile} from '@/store' +import {regexTel} from "@/utils/regu"; +import MyButton from "@/components/button/MyButton"; + +interface Params { + meeting_id: string + phone_number?: string + user_name?: string +} + +const MeetingLogin: FC = () => { + const {setUser, setToken, setCompany} = Profile.useContainer() + const [codeTime, setCodeTime] = useState(0) + const [phone_number, setPhone_number] = useState() + const [userName, setUserName] = useState('') + const [code, setCode] = useState('') + const [h5params, setH5Params] = useState(null) + const [meeting, setMeeting] = useState(null) + const params = useRouter().params as unknown as Params + + useEffect(() => { + loginApi.getMeetingParams().then((res) => { + setH5Params(res) + }) + if (params.user_name && params.phone_number) { + setPhone_number(Number(params.phone_number)) + setUserName(params.user_name) + Taro.showToast({title: '验证码错误', icon: 'error'}) + } + }, []) + + + useEffect(() => { + if (codeTime > 0) { + setTimeout(() => { + setCodeTime(codeTime - 1) + }, 1000) + } + }, [codeTime]) + + Taro.useLoad(() => { + meetingAPi.meetingInfo(params.meeting_id).then(res => { + if (res.type !== 1) { + Taro.showModal({ + title: res.type === 0 ? '暂未开始' : '二维码已过期', + success() { + Taro.reLaunch({url: '/pages/login/login'}) + } + }) + return + } + setMeeting(res.data) + }) + }) + + function submit(e) { + const value = e.detail.value + if (!value.user_name) { + Taro.showToast({title: '请写用户名', icon: "error"}) + return + } + + if (!regexTel.exec(value.phone_number)) { + Taro.showToast({title: '手机号错误', icon: 'error'}) + return + } + + if (!value.phone_code) { + Taro.showToast({title: '请获取手机验证码', icon: 'error'}) + return; + } + + if (process.env.TARO_ENV === 'h5') { + if (h5params == null) { + Taro.showToast({title: '页面参数错误,请刷新页面!', icon: 'error'}) + return; + } + location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?" + + "appid=" + h5params!.appid + + "&redirect_uri=" + + encodeURIComponent( + h5params!.route + + `?dep_id=${meeting?.dep_id}&company_id=${meeting?.companyId}&phone_number=${value.phone_number}&user_name=${value.user_name}&meeting_id=${params.meeting_id}&phone_code=${value.phone_code}` + ) + + "&response_type=code" + + "&scope=snsapi_userinfo" + + "#wechat_redirect"; + } else { + Taro.login({ + success: async (res) => { + const data = await userApi.meetingSave({ + ...value, + code: res.code, + meeting_id: params.meeting_id + }) + setCompany(data.company) + setUser(data.user) + setToken(data.token) + Taro.switchTab({url: '/pages/index/index'}) + }, + fail: () => { + Taro.showToast({title: '获取微信登录失败', icon: "error"}) + } + }) + } + } + + const getCode = useCallback(async () => { + if (codeTime > 0) return; + if (!phone_number || !regexTel.exec(String(phone_number))) { + Taro.showToast({title: '请输入正确的手机号', icon: 'error'}) + return + } + + try { + await userApi.getCode(phone_number) + Taro.showToast({title: '请注意查收', icon: "none"}) + setCodeTime(60) + } catch (e) { + Taro.showToast({title: '获取短信验证码失败', icon: "error"}) + } + }, [codeTime, phone_number]) + + return ( + +
+ + + 用户名 + setUserName(e.detail.value)}/> + + + + 手机号 + setPhone_number(Number(e.detail.value))}/> + + + + + 验证码 + + setCode(e.detail.value)} + placeholder='输入验证码'/> + + {codeTime > 0 ? `${codeTime}` : '获取验证码'} + + + + + 登记 +
+
+ ) +} + + +export default MeetingLogin diff --git a/src/pages/brand/list/list.config.ts b/src/pages/brand/list/list.config.ts new file mode 100644 index 0000000..8617280 --- /dev/null +++ b/src/pages/brand/list/list.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '见面会记录', + onReachBottomDistance: 30 +}) diff --git a/src/pages/brand/list/list.module.scss b/src/pages/brand/list/list.module.scss new file mode 100644 index 0000000..075fb8b --- /dev/null +++ b/src/pages/brand/list/list.module.scss @@ -0,0 +1,43 @@ +.meeting { + display: flex; + justify-content: space-between; + margin-bottom: 20rpx; +} + +.title { + position: relative; + flex: 1; + width: 70%; + background: #fff; + padding: 20rpx; + border-radius: 10rpx; + overflow: hidden; + box-sizing: border-box; +} + + +.overdue { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + text-align: center; + color: #fff; + display: flex; + justify-content: center; + align-items: center; + background: rgba(#000, .8); +} + + +.del { + border-radius: 10rpx; + background: #FF3A2F; + display: flex; + align-items: center; + color: #fff; + width: 100rpx; + justify-content: center; + margin-left: 20rpx; +} diff --git a/src/pages/brand/list/list.tsx b/src/pages/brand/list/list.tsx new file mode 100644 index 0000000..bbd5b0d --- /dev/null +++ b/src/pages/brand/list/list.tsx @@ -0,0 +1,84 @@ +import {FC, useCallback, useEffect, useState} from "react"; +import {View} from "@tarojs/components"; +import {Meeting, meetingAPi} from "@/api"; +import styles from './meetings.module.scss' +import Taro, {useReachBottom} from "@tarojs/taro"; +import Empty from "@/components/empty/empty"; +import {formatDate} from "@/utils/time"; + +const MeetingsConfig: FC = () => { + const [page, setPage] = useState(1) + const [meeting, setMeeting] = useState([]) + const [total, setTotal] = useState(0) + + const getData = useCallback(async () => { + try { + const res = await meetingAPi.setList(1, 10) + setTotal(res.total) + setMeeting([ + ...(meeting || []), + ...res.data + ]) + } catch (e) { + } + }, [page]) + + function del(id: number, index: number) { + try { + Taro.showModal({ + title: '确定删除', + async success({confirm}) { + if (confirm) { + await meetingAPi.del(id) + + const oldMeeting: Meeting[] = JSON.parse(JSON.stringify(meeting)) + oldMeeting.splice(index, 1) + setMeeting(oldMeeting) + } + } + }) + } catch (e) { + } + } + + function jumpInfo(item: Meeting) { + if (Date.now() > item.estimate_end_time || item.status > 0) { + return + } + Taro.navigateTo({url: `/pages/manage/spotMeeting/spotMeeting?id=${item.id}`}) + } + + useReachBottom(useCallback(() => { + if (meeting?.length < total) { + setPage(page + 1) + } + }, [total, meeting])) + + useEffect(() => { + getData() + }, [page]) + + return ( + + + { + meeting.length ? + meeting.map((d, index) => + jumpInfo(d)}> + {d.name} + {formatDate(new Date(d.estimate_start_time), "MM-dd")} 至 {formatDate(new Date(d.estimate_start_time), "MM-dd")} + { + (Date.now() > d.estimate_end_time || d.status > 1) && + {d.status > 1 ? '已结束' : "已过期"} + + } + + del(d.id, index)}>删除 + ) + : + } + + ) +} + +export default MeetingsConfig From 1d054012bb519d73f3064edba7d8923b0d84e60e Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Sat, 19 Aug 2023 15:51:37 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E5=93=81=E7=89=8C=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/brand.ts | 22 +++++++++++++++ src/api/index.ts | 1 + src/pages/brand/list/list.config.ts | 2 +- src/pages/brand/list/list.tsx | 42 +++++++++++++++-------------- 4 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 src/api/brand.ts diff --git a/src/api/brand.ts b/src/api/brand.ts new file mode 100644 index 0000000..d33b2e1 --- /dev/null +++ b/src/api/brand.ts @@ -0,0 +1,22 @@ +import {request} from "@/api/request"; + +export type BrandRecord = { + id: number + introductory_video: string[] + brand_album: string[] + graphic_introduction: string + disabled: number +} + +export const brandApi = { + list(page: number , page_size: number) { + return request<{ + data: BrandRecord[], + total: number + }>(`/api/v1/department/index?page=${page}&page_size=${page_size}` , "GET") + }, + /** 学习记录 */ + info(id: number) { + return request(`/api/v1/user/record/${id}`, "GET") + }, +} diff --git a/src/api/index.ts b/src/api/index.ts index bfc8739..c5f843b 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -5,3 +5,4 @@ export * from './meeting' export * from './public' export * from './manage' export * from './course' +export * from './brand' diff --git a/src/pages/brand/list/list.config.ts b/src/pages/brand/list/list.config.ts index 8617280..89c2e86 100644 --- a/src/pages/brand/list/list.config.ts +++ b/src/pages/brand/list/list.config.ts @@ -1,4 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '见面会记录', + navigationBarTitleText: '品牌列表', onReachBottomDistance: 30 }) diff --git a/src/pages/brand/list/list.tsx b/src/pages/brand/list/list.tsx index bbd5b0d..c7d5a9a 100644 --- a/src/pages/brand/list/list.tsx +++ b/src/pages/brand/list/list.tsx @@ -1,24 +1,28 @@ import {FC, useCallback, useEffect, useState} from "react"; import {View} from "@tarojs/components"; -import {Meeting, meetingAPi} from "@/api"; -import styles from './meetings.module.scss' +import {brandApi, BrandRecord, Meeting} from "@/api"; +import styles from './list.module.scss' import Taro, {useReachBottom} from "@tarojs/taro"; import Empty from "@/components/empty/empty"; import {formatDate} from "@/utils/time"; +import brandView from "@/pages/brand/list/components/BrandView"; const MeetingsConfig: FC = () => { const [page, setPage] = useState(1) - const [meeting, setMeeting] = useState([]) + const [brands, setBrands] = useState([]) const [total, setTotal] = useState(0) - const getData = useCallback(async () => { + useEffect(() => { + getData() + }, [page]) + + const getData = useCallback( async () => { try { - const res = await meetingAPi.setList(1, 10) - setTotal(res.total) - setMeeting([ - ...(meeting || []), - ...res.data - ]) + // const res = await brandApi.list(1, 10) + // setTotal(res.total) + // setBrands([ + // ...res.data + // ]) } catch (e) { } }, [page]) @@ -31,9 +35,9 @@ const MeetingsConfig: FC = () => { if (confirm) { await meetingAPi.del(id) - const oldMeeting: Meeting[] = JSON.parse(JSON.stringify(meeting)) + const oldMeeting: Meeting[] = JSON.parse(JSON.stringify(brandView)) oldMeeting.splice(index, 1) - setMeeting(oldMeeting) + setBrands(oldMeeting) } } }) @@ -49,21 +53,19 @@ const MeetingsConfig: FC = () => { } useReachBottom(useCallback(() => { - if (meeting?.length < total) { + if (brands?.length < total) { setPage(page + 1) } - }, [total, meeting])) + }, [total, brands])) + - useEffect(() => { - getData() - }, [page]) return ( { - meeting.length ? - meeting.map((d, index) => + brands.length ? + brands.map((d, index) => jumpInfo(d)}> {d.name} {formatDate(new Date(d.estimate_start_time), "MM-dd")} 至 {formatDate(new Date(d.estimate_start_time), "MM-dd")} @@ -75,7 +77,7 @@ const MeetingsConfig: FC = () => { del(d.id, index)}>删除 ) - : + : } ) From 159bf2aed488d8158cdca03f68bec39f8b9940ee Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Sat, 19 Aug 2023 18:21:06 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E5=93=81=E7=89=8C=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- .gitignore | 1 + src/api/brand.ts | 8 +- src/app.config.ts | 1 + src/app.scss | 8 + src/pages/brand/info/info.config.ts | 4 + src/pages/brand/info/info.module.scss | 31 +++ src/pages/brand/info/info.tsx | 57 ++++++ .../brand/list/components/BrandView.config.ts | 3 - src/pages/brand/list/components/BrandView.tsx | 176 ------------------ src/pages/brand/list/list.module.scss | 60 +++--- src/pages/brand/list/list.tsx | 64 ++----- 12 files changed, 150 insertions(+), 265 deletions(-) create mode 100644 src/pages/brand/info/info.config.ts create mode 100644 src/pages/brand/info/info.module.scss create mode 100644 src/pages/brand/info/info.tsx delete mode 100644 src/pages/brand/list/components/BrandView.config.ts delete mode 100644 src/pages/brand/list/components/BrandView.tsx diff --git a/.env b/.env index 1eee7ad..f96406d 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -TARO_APP_API=https://yjx.dev.yaojiankang.top +TARO_APP_API=https://shopfix.yaojiankang.top #TARO_APP_API=https://playedu.yaojiankang.top TARO_APP_LGOIN=true diff --git a/.gitignore b/.gitignore index b7dd2d1..35f7392 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ deploy_versions/ node_modules/ .DS_Store .swc +.env diff --git a/src/api/brand.ts b/src/api/brand.ts index d33b2e1..705706c 100644 --- a/src/api/brand.ts +++ b/src/api/brand.ts @@ -1,6 +1,7 @@ import {request} from "@/api/request"; export type BrandRecord = { + name: string; id: number introductory_video: string[] brand_album: string[] @@ -9,14 +10,15 @@ export type BrandRecord = { } export const brandApi = { + /** 品牌列表 */ list(page: number , page_size: number) { return request<{ data: BrandRecord[], total: number - }>(`/api/v1/department/index?page=${page}&page_size=${page_size}` , "GET") + }>(`/home/v1/brand/list?page=${page}&page_size=${page_size}` , "GET") }, - /** 学习记录 */ + /** 品牌详情 */ info(id: number) { - return request(`/api/v1/user/record/${id}`, "GET") + return request(`/home/v1/brand/${id}`, "GET") }, } diff --git a/src/app.config.ts b/src/app.config.ts index 9c0163b..540429a 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -80,6 +80,7 @@ export default defineAppConfig({ root: 'pages/brand', pages: [ 'list/list', + 'info/info', ] } ], diff --git a/src/app.scss b/src/app.scss index 6df0891..5fc0794 100644 --- a/src/app.scss +++ b/src/app.scss @@ -325,4 +325,12 @@ .border-none{border: none} +.text-row1 { + display: -webkit-box; + text-overflow: ellipsis; + overflow: hidden; + -webkit-box-orient:vertical; + -webkit-line-clamp:1; +} + diff --git a/src/pages/brand/info/info.config.ts b/src/pages/brand/info/info.config.ts new file mode 100644 index 0000000..2a0a86b --- /dev/null +++ b/src/pages/brand/info/info.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '', + onReachBottomDistance: 30 +}) diff --git a/src/pages/brand/info/info.module.scss b/src/pages/brand/info/info.module.scss new file mode 100644 index 0000000..f13b13d --- /dev/null +++ b/src/pages/brand/info/info.module.scss @@ -0,0 +1,31 @@ +.box { + display: flex; + margin-bottom: 20rpx; + background-color: #fff; + border-radius: 16rpx; + padding: 24rpx; + box-sizing: border-box; +} +.image{ + width: 128rpx; + height:128rpx; + background-color: pink; + border-radius: 8rpx; +} +.rightBox{ + padding-left: 24rpx; + box-sizing: border-box; + flex: 1; +} +.desc{ + font-size: 24rpx; + font-weight: 500; + color: #909795; + line-height: 34rpx; + display: -webkit-box; + text-overflow: ellipsis; + overflow: hidden; + -webkit-box-orient:vertical; + -webkit-line-clamp:2; +} + diff --git a/src/pages/brand/info/info.tsx b/src/pages/brand/info/info.tsx new file mode 100644 index 0000000..395ec1c --- /dev/null +++ b/src/pages/brand/info/info.tsx @@ -0,0 +1,57 @@ +import {FC, useCallback, useEffect, useState} from "react"; +import {Image, Swiper, SwiperItem, View} from "@tarojs/components"; +import {brandApi, BrandRecord} from "@/api"; +import Taro, {useRouter} from "@tarojs/taro"; + +type Params = { + id: number +} +const MeetingsConfig: FC = () => { + const {id} = useRouter().params as unknown as Params + const [brandInfo, setBrandInfo] = useState() + + useEffect(() => { + getData() + }, [id]) + + const getData = async () => { + try { + const data = await brandApi.info(id) + Taro.setNavigationBarTitle({title:data.name}) + setBrandInfo(data) + } catch (e) { + } + } + + + return ( + + { + // brands.length ? brands.map((d) => + // jumpInfo(d.id)} className={styles.box} key={d.id}> + // + // + // {d.name} + // {d.graphic_introduction.repeat(30)} + // + // ) + // : + + { brandInfo?.brand_album?.length + && brandInfo?.brand_album.map((d) => + + + ) + } + + } + + ); +} + +export default MeetingsConfig diff --git a/src/pages/brand/list/components/BrandView.config.ts b/src/pages/brand/list/components/BrandView.config.ts deleted file mode 100644 index 67241a3..0000000 --- a/src/pages/brand/list/components/BrandView.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '登记', -}) diff --git a/src/pages/brand/list/components/BrandView.tsx b/src/pages/brand/list/components/BrandView.tsx deleted file mode 100644 index 16c8e89..0000000 --- a/src/pages/brand/list/components/BrandView.tsx +++ /dev/null @@ -1,176 +0,0 @@ -import {FC, useCallback, useEffect, useState} from "react"; -import {Form, Input, View} from "@tarojs/components"; -import Taro, {useRouter} from "@tarojs/taro"; -import {userApi, loginApi, LoginParams, meetingAPi, Meeting} from "@/api"; -import {Profile} from '@/store' -import {regexTel} from "@/utils/regu"; -import MyButton from "@/components/button/MyButton"; - -interface Params { - meeting_id: string - phone_number?: string - user_name?: string -} - -const MeetingLogin: FC = () => { - const {setUser, setToken, setCompany} = Profile.useContainer() - const [codeTime, setCodeTime] = useState(0) - const [phone_number, setPhone_number] = useState() - const [userName, setUserName] = useState('') - const [code, setCode] = useState('') - const [h5params, setH5Params] = useState(null) - const [meeting, setMeeting] = useState(null) - const params = useRouter().params as unknown as Params - - useEffect(() => { - loginApi.getMeetingParams().then((res) => { - setH5Params(res) - }) - if (params.user_name && params.phone_number) { - setPhone_number(Number(params.phone_number)) - setUserName(params.user_name) - Taro.showToast({title: '验证码错误', icon: 'error'}) - } - }, []) - - - useEffect(() => { - if (codeTime > 0) { - setTimeout(() => { - setCodeTime(codeTime - 1) - }, 1000) - } - }, [codeTime]) - - Taro.useLoad(() => { - meetingAPi.meetingInfo(params.meeting_id).then(res => { - if (res.type !== 1) { - Taro.showModal({ - title: res.type === 0 ? '暂未开始' : '二维码已过期', - success() { - Taro.reLaunch({url: '/pages/login/login'}) - } - }) - return - } - setMeeting(res.data) - }) - }) - - function submit(e) { - const value = e.detail.value - if (!value.user_name) { - Taro.showToast({title: '请写用户名', icon: "error"}) - return - } - - if (!regexTel.exec(value.phone_number)) { - Taro.showToast({title: '手机号错误', icon: 'error'}) - return - } - - if (!value.phone_code) { - Taro.showToast({title: '请获取手机验证码', icon: 'error'}) - return; - } - - if (process.env.TARO_ENV === 'h5') { - if (h5params == null) { - Taro.showToast({title: '页面参数错误,请刷新页面!', icon: 'error'}) - return; - } - location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?" + - "appid=" + h5params!.appid + - "&redirect_uri=" + - encodeURIComponent( - h5params!.route + - `?dep_id=${meeting?.dep_id}&company_id=${meeting?.companyId}&phone_number=${value.phone_number}&user_name=${value.user_name}&meeting_id=${params.meeting_id}&phone_code=${value.phone_code}` - ) + - "&response_type=code" + - "&scope=snsapi_userinfo" + - "#wechat_redirect"; - } else { - Taro.login({ - success: async (res) => { - const data = await userApi.meetingSave({ - ...value, - code: res.code, - meeting_id: params.meeting_id - }) - setCompany(data.company) - setUser(data.user) - setToken(data.token) - Taro.switchTab({url: '/pages/index/index'}) - }, - fail: () => { - Taro.showToast({title: '获取微信登录失败', icon: "error"}) - } - }) - } - } - - const getCode = useCallback(async () => { - if (codeTime > 0) return; - if (!phone_number || !regexTel.exec(String(phone_number))) { - Taro.showToast({title: '请输入正确的手机号', icon: 'error'}) - return - } - - try { - await userApi.getCode(phone_number) - Taro.showToast({title: '请注意查收', icon: "none"}) - setCodeTime(60) - } catch (e) { - Taro.showToast({title: '获取短信验证码失败', icon: "error"}) - } - }, [codeTime, phone_number]) - - return ( - -
- - - 用户名 - setUserName(e.detail.value)}/> - - - - 手机号 - setPhone_number(Number(e.detail.value))}/> - - - - - 验证码 - - setCode(e.detail.value)} - placeholder='输入验证码'/> - - {codeTime > 0 ? `${codeTime}` : '获取验证码'} - - - - - 登记 -
-
- ) -} - - -export default MeetingLogin diff --git a/src/pages/brand/list/list.module.scss b/src/pages/brand/list/list.module.scss index 075fb8b..f13b13d 100644 --- a/src/pages/brand/list/list.module.scss +++ b/src/pages/brand/list/list.module.scss @@ -1,43 +1,31 @@ -.meeting { +.box { display: flex; - justify-content: space-between; margin-bottom: 20rpx; + background-color: #fff; + border-radius: 16rpx; + padding: 24rpx; + box-sizing: border-box; } - -.title { - position: relative; - flex: 1; - width: 70%; - background: #fff; - padding: 20rpx; - border-radius: 10rpx; - overflow: hidden; +.image{ + width: 128rpx; + height:128rpx; + background-color: pink; + border-radius: 8rpx; +} +.rightBox{ + padding-left: 24rpx; box-sizing: border-box; + flex: 1; } - - -.overdue { - position: absolute; - top: 0; - bottom: 0; - right: 0; - left: 0; - text-align: center; - color: #fff; - display: flex; - justify-content: center; - align-items: center; - background: rgba(#000, .8); +.desc{ + font-size: 24rpx; + font-weight: 500; + color: #909795; + line-height: 34rpx; + display: -webkit-box; + text-overflow: ellipsis; + overflow: hidden; + -webkit-box-orient:vertical; + -webkit-line-clamp:2; } - -.del { - border-radius: 10rpx; - background: #FF3A2F; - display: flex; - align-items: center; - color: #fff; - width: 100rpx; - justify-content: center; - margin-left: 20rpx; -} diff --git a/src/pages/brand/list/list.tsx b/src/pages/brand/list/list.tsx index c7d5a9a..cc1b746 100644 --- a/src/pages/brand/list/list.tsx +++ b/src/pages/brand/list/list.tsx @@ -1,11 +1,9 @@ import {FC, useCallback, useEffect, useState} from "react"; -import {View} from "@tarojs/components"; -import {brandApi, BrandRecord, Meeting} from "@/api"; +import {Image, View} from "@tarojs/components"; +import {brandApi, BrandRecord} from "@/api"; import styles from './list.module.scss' import Taro, {useReachBottom} from "@tarojs/taro"; import Empty from "@/components/empty/empty"; -import {formatDate} from "@/utils/time"; -import brandView from "@/pages/brand/list/components/BrandView"; const MeetingsConfig: FC = () => { const [page, setPage] = useState(1) @@ -18,38 +16,18 @@ const MeetingsConfig: FC = () => { const getData = useCallback( async () => { try { - // const res = await brandApi.list(1, 10) - // setTotal(res.total) - // setBrands([ - // ...res.data - // ]) + const res = await brandApi.list(1, 10) + setTotal(res.total) + setBrands([ + ...res.data + ]) } catch (e) { } }, [page]) - function del(id: number, index: number) { - try { - Taro.showModal({ - title: '确定删除', - async success({confirm}) { - if (confirm) { - await meetingAPi.del(id) - const oldMeeting: Meeting[] = JSON.parse(JSON.stringify(brandView)) - oldMeeting.splice(index, 1) - setBrands(oldMeeting) - } - } - }) - } catch (e) { - } - } - - function jumpInfo(item: Meeting) { - if (Date.now() > item.estimate_end_time || item.status > 0) { - return - } - Taro.navigateTo({url: `/pages/manage/spotMeeting/spotMeeting?id=${item.id}`}) + function jumpInfo(id: number) { + Taro.navigateTo({url: `/pages/brand/info/info?id=${id}`}) } useReachBottom(useCallback(() => { @@ -62,22 +40,16 @@ const MeetingsConfig: FC = () => { return ( - { - brands.length ? - brands.map((d, index) => - jumpInfo(d)}> - {d.name} - {formatDate(new Date(d.estimate_start_time), "MM-dd")} 至 {formatDate(new Date(d.estimate_start_time), "MM-dd")} - { - (Date.now() > d.estimate_end_time || d.status > 1) && - {d.status > 1 ? '已结束' : "已过期"} - - } - - del(d.id, index)}>删除 - ) - : + brands.length ? brands.map((d) => + jumpInfo(d.id)} className={styles.box} key={d.id}> + + + {d.name} + {d.graphic_introduction.repeat(30)} + + ) + : } ) From 9b5c25151f576ca246288c114c75ba646b29e59e Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Mon, 21 Aug 2023 16:40:34 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E5=93=81=E7=89=8C=E8=AF=A6=E6=83=85&?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/brand.ts | 18 +++- src/app.config.ts | 1 + src/app.scss | 3 + .../textCollapse/collapse.module.scss | 5 ++ src/components/textCollapse/collapse.tsx | 90 +++++++++++++++++++ src/pages/brand/article/article.config.ts | 4 + src/pages/brand/article/article.tsx | 28 ++++++ src/pages/brand/info/info.module.scss | 88 ++++++++++++------ src/pages/brand/info/info.tsx | 69 ++++++++++---- src/pages/brand/list/list.module.scss | 1 + src/pages/brand/list/list.tsx | 4 +- 11 files changed, 266 insertions(+), 45 deletions(-) create mode 100644 src/components/textCollapse/collapse.module.scss create mode 100644 src/components/textCollapse/collapse.tsx create mode 100644 src/pages/brand/article/article.config.ts create mode 100644 src/pages/brand/article/article.tsx diff --git a/src/api/brand.ts b/src/api/brand.ts index 705706c..9d7d020 100644 --- a/src/api/brand.ts +++ b/src/api/brand.ts @@ -3,11 +3,17 @@ import {request} from "@/api/request"; export type BrandRecord = { name: string; id: number - introductory_video: string[] + introductory_video: string brand_album: string[] graphic_introduction: string disabled: number } +export type ArticleRecord = { + title: string + page_view: number + created_at: string + content: string +} export const brandApi = { /** 品牌列表 */ @@ -21,4 +27,14 @@ export const brandApi = { info(id: number) { return request(`/home/v1/brand/${id}`, "GET") }, + /** 文章列表 */ + articleList(owner_id: number ) { + return request<{ + list: ArticleRecord[], + total: number + }>(`/home/v1/article/list?owner_id=${owner_id}&page=1&page_size=1000` , "GET") + }, + articleInfo(id: number ) { + return request(`/home/v1/article/${id}` , "GET") + }, } diff --git a/src/app.config.ts b/src/app.config.ts index 540429a..301055e 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -81,6 +81,7 @@ export default defineAppConfig({ pages: [ 'list/list', 'info/info', + 'article/article', ] } ], diff --git a/src/app.scss b/src/app.scss index 5fc0794..c3aaf7e 100644 --- a/src/app.scss +++ b/src/app.scss @@ -269,6 +269,9 @@ .text-body { color: #212529;} .text-muted { color: #909795;} +.lh-28 {line-height: 28rpx} +.lh-40 {line-height: 40rpx} + /* 圆角 */ .rounded { border-radius: 8rpx;} diff --git a/src/components/textCollapse/collapse.module.scss b/src/components/textCollapse/collapse.module.scss new file mode 100644 index 0000000..e937475 --- /dev/null +++ b/src/components/textCollapse/collapse.module.scss @@ -0,0 +1,5 @@ +.expansion{ + display: inline-block; + padding: 0 10rpx; + color: #00d6ac; +} diff --git a/src/components/textCollapse/collapse.tsx b/src/components/textCollapse/collapse.tsx new file mode 100644 index 0000000..bd2666f --- /dev/null +++ b/src/components/textCollapse/collapse.tsx @@ -0,0 +1,90 @@ +import {View, Text} from '@tarojs/components'; +import {ITouchEvent} from '@tarojs/components/types/common'; +import Taro from "@tarojs/taro"; +import {FC, useEffect, useState} from "react"; +import styles from './collapse.module.scss' + +interface Props { + text: string +} + +const LineEllipsis:FC = ({text}:Props) => { + const [disabled, setDisabled] = useState(false) + const [isExpansioned, setIsExpansioned] = useState(false) + const [overflow, setOverflow] = useState(false) + + useEffect(()=>{ + init() + },[text]) + + function init () { + Taro.nextTick(() => { + const query = Taro.createSelectorQuery() + query.select('#Text').boundingClientRect() + query.exec((res) => { + console.log({res}) + const height = res[0].height + if(height <= 30) { + setDisabled(true) + }else{ + setOverflow(true) + } + }) + }) + } + + function handleExpend (e?: ITouchEvent) { + e && e.stopPropagation(); + setOverflow(false) + setIsExpansioned(true) + } + + function handleHide (e?: ITouchEvent) { + e && e.stopPropagation(); + setOverflow(true) + setIsExpansioned(false) + }; + + function toggle () { + if (disabled) return; + if (isExpansioned) { + handleHide(); + } else { + handleExpend(); + } + } + + return ( + + + {text} + {!overflow && isExpansioned && ( + + 收起 + + )} + + {overflow && ( + + ...展开 + + )} + + ); + // } +} + +export default LineEllipsis; diff --git a/src/pages/brand/article/article.config.ts b/src/pages/brand/article/article.config.ts new file mode 100644 index 0000000..1029aac --- /dev/null +++ b/src/pages/brand/article/article.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '文章详情', + onReachBottomDistance: 30 +}) diff --git a/src/pages/brand/article/article.tsx b/src/pages/brand/article/article.tsx new file mode 100644 index 0000000..e2b3556 --- /dev/null +++ b/src/pages/brand/article/article.tsx @@ -0,0 +1,28 @@ +import {FC, useEffect, useState} from "react"; +import {View} from "@tarojs/components"; +import Taro, {useRouter} from "@tarojs/taro"; +import {ArticleRecord, brandApi} from "@/api"; + + +const article:FC = () => { + const {id} = useRouter().params as unknown as { id: number} + const [articleInfo,setArticleInfo] = useState() + useEffect(() => { + getData() + }, [id]) + + const getData = async () => { + try { + const data = await brandApi.articleInfo(id) + Taro.setNavigationBarTitle({title:data.title}) + setArticleInfo(data) + } catch (e) { + } + } + function helloWorld() { + const html = articleInfo?.content; + return + } + return helloWorld() +} +export default article diff --git a/src/pages/brand/info/info.module.scss b/src/pages/brand/info/info.module.scss index f13b13d..11abb71 100644 --- a/src/pages/brand/info/info.module.scss +++ b/src/pages/brand/info/info.module.scss @@ -1,31 +1,65 @@ -.box { - display: flex; - margin-bottom: 20rpx; - background-color: #fff; - border-radius: 16rpx; - padding: 24rpx; - box-sizing: border-box; -} -.image{ - width: 128rpx; - height:128rpx; +.swiper{ + width:750rpx; + height:600rpx; background-color: pink; - border-radius: 8rpx; } -.rightBox{ - padding-left: 24rpx; +.body{ + border-radius: 32rpx 32rpx 0 0; + background-color:cadetblue; + width: 750rpx; box-sizing: border-box; - flex: 1; -} -.desc{ - font-size: 24rpx; - font-weight: 500; - color: #909795; - line-height: 34rpx; - display: -webkit-box; - text-overflow: ellipsis; - overflow: hidden; - -webkit-box-orient:vertical; - -webkit-line-clamp:2; -} + display: flex; + flex-direction: column; + min-height: 80vh; + position: absolute; + top: 520rpx; + .top{ + padding:40rpx 30rpx 30rpx 30rpx; + border-radius: 32rpx; + background-color: #fff; + .title{ + font-size: 32rpx; + font-weight: bold; + color: #323635; + line-height:44rpx; + } + } + .bottom{ + margin-top: 20rpx; + flex:1; + background-color: #fff; + border-radius: 32rpx 32rpx 0 0; + width: 100%; + .box { + display: flex; + background-color: #fff; + border-radius: 16rpx; + padding: 30rpx; + box-sizing: border-box; + } + .inner{ + flex:1; + display: flex; + padding-bottom: 24rpx; + border-bottom: 2rpx solid #F5F8F7; + .image{ + width: 172rpx; + height:128rpx; + background-color: pink; + border-radius: 8rpx; + } + .leftBox{ + padding-right: 24rpx; + box-sizing: border-box; + flex: 1; + } + .desc{ + font-size: 22rpx; + font-weight: 500; + color: #909795; + line-height: 32rpx + } + } + } +} diff --git a/src/pages/brand/info/info.tsx b/src/pages/brand/info/info.tsx index 395ec1c..aae011c 100644 --- a/src/pages/brand/info/info.tsx +++ b/src/pages/brand/info/info.tsx @@ -1,14 +1,18 @@ import {FC, useCallback, useEffect, useState} from "react"; -import {Image, Swiper, SwiperItem, View} from "@tarojs/components"; -import {brandApi, BrandRecord} from "@/api"; +import {Image, Swiper, SwiperItem, Text, Video, View} from "@tarojs/components"; +import {ArticleRecord, brandApi, BrandRecord} from "@/api"; +import styles from './info.module.scss' import Taro, {useRouter} from "@tarojs/taro"; +import LineEllipsis from "@/components/textCollapse/collapse"; +import Empty from "@/components/empty/empty"; type Params = { id: number } -const MeetingsConfig: FC = () => { +const BrandInfo: FC = () => { const {id} = useRouter().params as unknown as Params const [brandInfo, setBrandInfo] = useState() + const [articleList,setArticleList] = useState() useEffect(() => { getData() @@ -19,29 +23,38 @@ const MeetingsConfig: FC = () => { const data = await brandApi.info(id) Taro.setNavigationBarTitle({title:data.name}) setBrandInfo(data) + const data1 = await brandApi.articleList(id) + setArticleList(data1.list) } catch (e) { + // setBrandInfo({disabled: 0, graphic_introduction: "", id: 0, introductory_video: "", name: "", brand_album:['1','2','3']}) } } return ( - + { - // brands.length ? brands.map((d) => - // jumpInfo(d.id)} className={styles.box} key={d.id}> - // - // - // {d.name} - // {d.graphic_introduction.repeat(30)} - // - // ) - // : + + ) { brandInfo?.brand_album?.length && brandInfo?.brand_album.map((d) => @@ -49,9 +62,35 @@ const MeetingsConfig: FC = () => { ) } + } + + + {brandInfo?.name} + + + + { + articleList?.length ? + articleList.map((i)=> + {Taro.navigateTo({url: `/pages/brand/article/article?id=${i.id}`})}}> + + + {i.title} + {i.created_at} {i.page_view}阅读 + + {/**/} + + + + ) + : + } + + + ); } -export default MeetingsConfig +export default BrandInfo diff --git a/src/pages/brand/list/list.module.scss b/src/pages/brand/list/list.module.scss index f13b13d..25cd50a 100644 --- a/src/pages/brand/list/list.module.scss +++ b/src/pages/brand/list/list.module.scss @@ -23,6 +23,7 @@ color: #909795; line-height: 34rpx; display: -webkit-box; + word-break: break-all; text-overflow: ellipsis; overflow: hidden; -webkit-box-orient:vertical; diff --git a/src/pages/brand/list/list.tsx b/src/pages/brand/list/list.tsx index cc1b746..cbe848e 100644 --- a/src/pages/brand/list/list.tsx +++ b/src/pages/brand/list/list.tsx @@ -5,7 +5,7 @@ import styles from './list.module.scss' import Taro, {useReachBottom} from "@tarojs/taro"; import Empty from "@/components/empty/empty"; -const MeetingsConfig: FC = () => { +const BrandList: FC = () => { const [page, setPage] = useState(1) const [brands, setBrands] = useState([]) const [total, setTotal] = useState(0) @@ -55,4 +55,4 @@ const MeetingsConfig: FC = () => { ) } -export default MeetingsConfig +export default BrandList From b0c75b3e1626f03dbfb68d921f6d0825be528d6f Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 21 Aug 2023 16:52:45 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/brand/info/info.tsx | 4 ++-- src/pages/business/sort/sort.tsx | 2 +- src/pages/home/components/feature.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/brand/info/info.tsx b/src/pages/brand/info/info.tsx index 395ec1c..943f7be 100644 --- a/src/pages/brand/info/info.tsx +++ b/src/pages/brand/info/info.tsx @@ -1,4 +1,4 @@ -import {FC, useCallback, useEffect, useState} from "react"; +import {FC, useEffect, useState} from "react"; import {Image, Swiper, SwiperItem, View} from "@tarojs/components"; import {brandApi, BrandRecord} from "@/api"; import Taro, {useRouter} from "@tarojs/taro"; @@ -43,7 +43,7 @@ const MeetingsConfig: FC = () => { indicatorDots > { brandInfo?.brand_album?.length - && brandInfo?.brand_album.map((d) => + && brandInfo?.brand_album?.map((d) => ) diff --git a/src/pages/business/sort/sort.tsx b/src/pages/business/sort/sort.tsx index f01c221..e2cd428 100644 --- a/src/pages/business/sort/sort.tsx +++ b/src/pages/business/sort/sort.tsx @@ -7,7 +7,7 @@ type SortType = '' interface Params { id: number type: SortType - jumpUrl: () => void + jumpUrl: (data:Record) => void } const Sort: FC = () => { diff --git a/src/pages/home/components/feature.tsx b/src/pages/home/components/feature.tsx index c430b5f..c70cd79 100644 --- a/src/pages/home/components/feature.tsx +++ b/src/pages/home/components/feature.tsx @@ -8,7 +8,7 @@ import Taro from "@tarojs/taro"; const Feature: FC = () => { const list = [ - {url: '', image: article, text: '品牌'}, + {url: '/pages/brand/list/list', image: article, text: '品牌'}, {url: '', image: health, text: '健康管理'}, {url: '', image: profession, text: '专业技能'}, {url: '', image: illness, text: '疾病知识'}, From c7c99d6730366d09aecb13657cd149f6fd252413 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 21 Aug 2023 17:14:43 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=88=86=E5=8C=85=E7=AE=A1=E7=90=86=E6=96=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/brand.ts | 1 + src/app.config.ts | 14 +-- src/components/textCollapse/collapse.tsx | 2 +- src/pages/brand/article/article.config.ts | 4 - src/pages/brand/article/article.tsx | 28 ------ src/pages/brand/info/info.config.ts | 4 - src/pages/brand/info/info.module.scss | 65 ------------- src/pages/brand/info/info.tsx | 96 ------------------- src/pages/brand/list/list.config.ts | 4 - src/pages/brand/list/list.module.scss | 32 ------- src/pages/brand/list/list.tsx | 58 ----------- src/pages/home/components/feature.tsx | 2 +- .../home/components/feature_recommended.tsx | 6 +- .../{ => preview}/health/health.config.ts | 0 .../{ => preview}/health/health.module.scss | 0 src/pages/{ => preview}/health/health.tsx | 2 +- .../videoFull/videoFull.config.ts | 0 .../videoFull/videoFull.tsx | 0 18 files changed, 14 insertions(+), 304 deletions(-) delete mode 100644 src/pages/brand/article/article.config.ts delete mode 100644 src/pages/brand/article/article.tsx delete mode 100644 src/pages/brand/info/info.config.ts delete mode 100644 src/pages/brand/info/info.module.scss delete mode 100644 src/pages/brand/info/info.tsx delete mode 100644 src/pages/brand/list/list.config.ts delete mode 100644 src/pages/brand/list/list.module.scss delete mode 100644 src/pages/brand/list/list.tsx rename src/pages/{ => preview}/health/health.config.ts (100%) rename src/pages/{ => preview}/health/health.module.scss (100%) rename src/pages/{ => preview}/health/health.tsx (94%) rename src/pages/{business => preview}/videoFull/videoFull.config.ts (100%) rename src/pages/{business => preview}/videoFull/videoFull.tsx (100%) diff --git a/src/api/brand.ts b/src/api/brand.ts index 9d7d020..6770503 100644 --- a/src/api/brand.ts +++ b/src/api/brand.ts @@ -7,6 +7,7 @@ export type BrandRecord = { brand_album: string[] graphic_introduction: string disabled: number + introductory_video_resource:any } export type ArticleRecord = { title: string diff --git a/src/app.config.ts b/src/app.config.ts index 094ed13..8e793b3 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -6,7 +6,6 @@ export default defineAppConfig({ 'pages/login/login', 'pages/check/check', 'pages/my/my', - 'pages/health/health', ], window: { backgroundTextStyle: 'light', @@ -59,7 +58,6 @@ export default defineAppConfig({ 'curHistory/curHistory', 'hourHistory/hourHistory', 'courType/courType', - 'videoFull/videoFull', // 资源id 视频全屏 'sort/sort', // 公共二级分类 ] }, @@ -80,13 +78,15 @@ export default defineAppConfig({ ] }, { - root: 'pages/brand', + root: 'pages/preview', pages: [ - 'list/list', - 'info/info', - 'article/article', + 'brand/list/list', + 'brand/info/info', + 'brand/article/article', + 'health/health', // 健康 + 'videoFull/videoFull', // 资源id 视频全屏 ] - } + }, ], lazyCodeLoading: "requiredComponents" }) diff --git a/src/components/textCollapse/collapse.tsx b/src/components/textCollapse/collapse.tsx index bd2666f..dac317a 100644 --- a/src/components/textCollapse/collapse.tsx +++ b/src/components/textCollapse/collapse.tsx @@ -8,7 +8,7 @@ interface Props { text: string } -const LineEllipsis:FC = ({text}:Props) => { +const LineEllipsis:FC = ({text}:Props) => { const [disabled, setDisabled] = useState(false) const [isExpansioned, setIsExpansioned] = useState(false) const [overflow, setOverflow] = useState(false) diff --git a/src/pages/brand/article/article.config.ts b/src/pages/brand/article/article.config.ts deleted file mode 100644 index 1029aac..0000000 --- a/src/pages/brand/article/article.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '文章详情', - onReachBottomDistance: 30 -}) diff --git a/src/pages/brand/article/article.tsx b/src/pages/brand/article/article.tsx deleted file mode 100644 index e2b3556..0000000 --- a/src/pages/brand/article/article.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import {FC, useEffect, useState} from "react"; -import {View} from "@tarojs/components"; -import Taro, {useRouter} from "@tarojs/taro"; -import {ArticleRecord, brandApi} from "@/api"; - - -const article:FC = () => { - const {id} = useRouter().params as unknown as { id: number} - const [articleInfo,setArticleInfo] = useState() - useEffect(() => { - getData() - }, [id]) - - const getData = async () => { - try { - const data = await brandApi.articleInfo(id) - Taro.setNavigationBarTitle({title:data.title}) - setArticleInfo(data) - } catch (e) { - } - } - function helloWorld() { - const html = articleInfo?.content; - return - } - return helloWorld() -} -export default article diff --git a/src/pages/brand/info/info.config.ts b/src/pages/brand/info/info.config.ts deleted file mode 100644 index 2a0a86b..0000000 --- a/src/pages/brand/info/info.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '', - onReachBottomDistance: 30 -}) diff --git a/src/pages/brand/info/info.module.scss b/src/pages/brand/info/info.module.scss deleted file mode 100644 index 11abb71..0000000 --- a/src/pages/brand/info/info.module.scss +++ /dev/null @@ -1,65 +0,0 @@ -.swiper{ - width:750rpx; - height:600rpx; - background-color: pink; -} -.body{ - border-radius: 32rpx 32rpx 0 0; - background-color:cadetblue; - width: 750rpx; - box-sizing: border-box; - display: flex; - flex-direction: column; - min-height: 80vh; - position: absolute; - top: 520rpx; - .top{ - padding:40rpx 30rpx 30rpx 30rpx; - border-radius: 32rpx; - background-color: #fff; - .title{ - font-size: 32rpx; - font-weight: bold; - color: #323635; - line-height:44rpx; - } - } - .bottom{ - margin-top: 20rpx; - flex:1; - background-color: #fff; - border-radius: 32rpx 32rpx 0 0; - width: 100%; - .box { - display: flex; - background-color: #fff; - border-radius: 16rpx; - padding: 30rpx; - box-sizing: border-box; - } - .inner{ - flex:1; - display: flex; - padding-bottom: 24rpx; - border-bottom: 2rpx solid #F5F8F7; - .image{ - width: 172rpx; - height:128rpx; - background-color: pink; - border-radius: 8rpx; - } - .leftBox{ - padding-right: 24rpx; - box-sizing: border-box; - flex: 1; - } - .desc{ - font-size: 22rpx; - font-weight: 500; - color: #909795; - line-height: 32rpx - } - } - - } -} diff --git a/src/pages/brand/info/info.tsx b/src/pages/brand/info/info.tsx deleted file mode 100644 index aae011c..0000000 --- a/src/pages/brand/info/info.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import {FC, useCallback, useEffect, useState} from "react"; -import {Image, Swiper, SwiperItem, Text, Video, View} from "@tarojs/components"; -import {ArticleRecord, brandApi, BrandRecord} from "@/api"; -import styles from './info.module.scss' -import Taro, {useRouter} from "@tarojs/taro"; -import LineEllipsis from "@/components/textCollapse/collapse"; -import Empty from "@/components/empty/empty"; - -type Params = { - id: number -} -const BrandInfo: FC = () => { - const {id} = useRouter().params as unknown as Params - const [brandInfo, setBrandInfo] = useState() - const [articleList,setArticleList] = useState() - - useEffect(() => { - getData() - }, [id]) - - const getData = async () => { - try { - const data = await brandApi.info(id) - Taro.setNavigationBarTitle({title:data.name}) - setBrandInfo(data) - const data1 = await brandApi.articleList(id) - setArticleList(data1.list) - } catch (e) { - // setBrandInfo({disabled: 0, graphic_introduction: "", id: 0, introductory_video: "", name: "", brand_album:['1','2','3']}) - } - } - - - return ( - - { - - - ) - { brandInfo?.brand_album?.length - && brandInfo?.brand_album.map((d) => - - - ) - } - - - } - - - {brandInfo?.name} - - - - { - articleList?.length ? - articleList.map((i)=> - {Taro.navigateTo({url: `/pages/brand/article/article?id=${i.id}`})}}> - - - {i.title} - {i.created_at} {i.page_view}阅读 - - {/**/} - - - - ) - : - } - - - - - ); -} - -export default BrandInfo diff --git a/src/pages/brand/list/list.config.ts b/src/pages/brand/list/list.config.ts deleted file mode 100644 index 89c2e86..0000000 --- a/src/pages/brand/list/list.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '品牌列表', - onReachBottomDistance: 30 -}) diff --git a/src/pages/brand/list/list.module.scss b/src/pages/brand/list/list.module.scss deleted file mode 100644 index 25cd50a..0000000 --- a/src/pages/brand/list/list.module.scss +++ /dev/null @@ -1,32 +0,0 @@ -.box { - display: flex; - margin-bottom: 20rpx; - background-color: #fff; - border-radius: 16rpx; - padding: 24rpx; - box-sizing: border-box; -} -.image{ - width: 128rpx; - height:128rpx; - background-color: pink; - border-radius: 8rpx; -} -.rightBox{ - padding-left: 24rpx; - box-sizing: border-box; - flex: 1; -} -.desc{ - font-size: 24rpx; - font-weight: 500; - color: #909795; - line-height: 34rpx; - display: -webkit-box; - word-break: break-all; - text-overflow: ellipsis; - overflow: hidden; - -webkit-box-orient:vertical; - -webkit-line-clamp:2; -} - diff --git a/src/pages/brand/list/list.tsx b/src/pages/brand/list/list.tsx deleted file mode 100644 index cbe848e..0000000 --- a/src/pages/brand/list/list.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import {FC, useCallback, useEffect, useState} from "react"; -import {Image, View} from "@tarojs/components"; -import {brandApi, BrandRecord} from "@/api"; -import styles from './list.module.scss' -import Taro, {useReachBottom} from "@tarojs/taro"; -import Empty from "@/components/empty/empty"; - -const BrandList: FC = () => { - const [page, setPage] = useState(1) - const [brands, setBrands] = useState([]) - const [total, setTotal] = useState(0) - - useEffect(() => { - getData() - }, [page]) - - const getData = useCallback( async () => { - try { - const res = await brandApi.list(1, 10) - setTotal(res.total) - setBrands([ - ...res.data - ]) - } catch (e) { - } - }, [page]) - - - function jumpInfo(id: number) { - Taro.navigateTo({url: `/pages/brand/info/info?id=${id}`}) - } - - useReachBottom(useCallback(() => { - if (brands?.length < total) { - setPage(page + 1) - } - }, [total, brands])) - - - - return ( - - { - brands.length ? brands.map((d) => - jumpInfo(d.id)} className={styles.box} key={d.id}> - - - {d.name} - {d.graphic_introduction.repeat(30)} - - ) - : - } - - ) -} - -export default BrandList diff --git a/src/pages/home/components/feature.tsx b/src/pages/home/components/feature.tsx index c70cd79..f82dd0b 100644 --- a/src/pages/home/components/feature.tsx +++ b/src/pages/home/components/feature.tsx @@ -8,7 +8,7 @@ import Taro from "@tarojs/taro"; const Feature: FC = () => { const list = [ - {url: '/pages/brand/list/list', image: article, text: '品牌'}, + {url: '/pages/preview/brand/list/list', image: article, text: '品牌'}, {url: '', image: health, text: '健康管理'}, {url: '', image: profession, text: '专业技能'}, {url: '', image: illness, text: '疾病知识'}, diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index 3222604..1444989 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -27,14 +27,14 @@ const FeatureRecommended: FC = () => { {title: "品牌TOP3", url: '', detailsUrl: '', data: []}, { title: "健康知识TOP3", - url: '/pages/health/health', - detailsUrl: '/pages/business/videoFull/videoFull?url=', + url: '/pages/preview/health/health', + detailsUrl: '/pages/preview/videoFull/videoFull?url=', data: [] }, { url: '', title: "专业技能TOP3", - detailsUrl: '/pages/business/videoFull/videoFull?url=', + detailsUrl: '/pages/preview/videoFull/videoFull?url=', data: [] }, {title: "疾病知识TOP3", url: '', detailsUrl: '', data: []}, diff --git a/src/pages/health/health.config.ts b/src/pages/preview/health/health.config.ts similarity index 100% rename from src/pages/health/health.config.ts rename to src/pages/preview/health/health.config.ts diff --git a/src/pages/health/health.module.scss b/src/pages/preview/health/health.module.scss similarity index 100% rename from src/pages/health/health.module.scss rename to src/pages/preview/health/health.module.scss diff --git a/src/pages/health/health.tsx b/src/pages/preview/health/health.tsx similarity index 94% rename from src/pages/health/health.tsx rename to src/pages/preview/health/health.tsx index 60e0f18..b85116a 100644 --- a/src/pages/health/health.tsx +++ b/src/pages/preview/health/health.tsx @@ -26,7 +26,7 @@ const Health: FC = () => { function jump(url: string, id: number) { HomeApi.healthSetPlay(id) - Taro.navigateTo({url: '/pages/business/videoFull/videoFull?url=' + url}) + Taro.navigateTo({url: '/pages/preview/videoFull/videoFull?url=' + url}) } return ( diff --git a/src/pages/business/videoFull/videoFull.config.ts b/src/pages/preview/videoFull/videoFull.config.ts similarity index 100% rename from src/pages/business/videoFull/videoFull.config.ts rename to src/pages/preview/videoFull/videoFull.config.ts diff --git a/src/pages/business/videoFull/videoFull.tsx b/src/pages/preview/videoFull/videoFull.tsx similarity index 100% rename from src/pages/business/videoFull/videoFull.tsx rename to src/pages/preview/videoFull/videoFull.tsx From 5f0da7ce0ff6db30265f728a8e3d38cd737e495c Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 21 Aug 2023 17:15:03 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E5=93=81=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../preview/brand/article/article.config.ts | 4 + src/pages/preview/brand/article/article.tsx | 28 ++++++ src/pages/preview/brand/info/info.config.ts | 4 + src/pages/preview/brand/info/info.module.scss | 65 +++++++++++++ src/pages/preview/brand/info/info.tsx | 97 +++++++++++++++++++ src/pages/preview/brand/list/list.config.ts | 4 + src/pages/preview/brand/list/list.module.scss | 32 ++++++ src/pages/preview/brand/list/list.tsx | 57 +++++++++++ 8 files changed, 291 insertions(+) create mode 100644 src/pages/preview/brand/article/article.config.ts create mode 100644 src/pages/preview/brand/article/article.tsx create mode 100644 src/pages/preview/brand/info/info.config.ts create mode 100644 src/pages/preview/brand/info/info.module.scss create mode 100644 src/pages/preview/brand/info/info.tsx create mode 100644 src/pages/preview/brand/list/list.config.ts create mode 100644 src/pages/preview/brand/list/list.module.scss create mode 100644 src/pages/preview/brand/list/list.tsx diff --git a/src/pages/preview/brand/article/article.config.ts b/src/pages/preview/brand/article/article.config.ts new file mode 100644 index 0000000..1029aac --- /dev/null +++ b/src/pages/preview/brand/article/article.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '文章详情', + onReachBottomDistance: 30 +}) diff --git a/src/pages/preview/brand/article/article.tsx b/src/pages/preview/brand/article/article.tsx new file mode 100644 index 0000000..e2b3556 --- /dev/null +++ b/src/pages/preview/brand/article/article.tsx @@ -0,0 +1,28 @@ +import {FC, useEffect, useState} from "react"; +import {View} from "@tarojs/components"; +import Taro, {useRouter} from "@tarojs/taro"; +import {ArticleRecord, brandApi} from "@/api"; + + +const article:FC = () => { + const {id} = useRouter().params as unknown as { id: number} + const [articleInfo,setArticleInfo] = useState() + useEffect(() => { + getData() + }, [id]) + + const getData = async () => { + try { + const data = await brandApi.articleInfo(id) + Taro.setNavigationBarTitle({title:data.title}) + setArticleInfo(data) + } catch (e) { + } + } + function helloWorld() { + const html = articleInfo?.content; + return + } + return helloWorld() +} +export default article diff --git a/src/pages/preview/brand/info/info.config.ts b/src/pages/preview/brand/info/info.config.ts new file mode 100644 index 0000000..2a0a86b --- /dev/null +++ b/src/pages/preview/brand/info/info.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '', + onReachBottomDistance: 30 +}) diff --git a/src/pages/preview/brand/info/info.module.scss b/src/pages/preview/brand/info/info.module.scss new file mode 100644 index 0000000..11abb71 --- /dev/null +++ b/src/pages/preview/brand/info/info.module.scss @@ -0,0 +1,65 @@ +.swiper{ + width:750rpx; + height:600rpx; + background-color: pink; +} +.body{ + border-radius: 32rpx 32rpx 0 0; + background-color:cadetblue; + width: 750rpx; + box-sizing: border-box; + display: flex; + flex-direction: column; + min-height: 80vh; + position: absolute; + top: 520rpx; + .top{ + padding:40rpx 30rpx 30rpx 30rpx; + border-radius: 32rpx; + background-color: #fff; + .title{ + font-size: 32rpx; + font-weight: bold; + color: #323635; + line-height:44rpx; + } + } + .bottom{ + margin-top: 20rpx; + flex:1; + background-color: #fff; + border-radius: 32rpx 32rpx 0 0; + width: 100%; + .box { + display: flex; + background-color: #fff; + border-radius: 16rpx; + padding: 30rpx; + box-sizing: border-box; + } + .inner{ + flex:1; + display: flex; + padding-bottom: 24rpx; + border-bottom: 2rpx solid #F5F8F7; + .image{ + width: 172rpx; + height:128rpx; + background-color: pink; + border-radius: 8rpx; + } + .leftBox{ + padding-right: 24rpx; + box-sizing: border-box; + flex: 1; + } + .desc{ + font-size: 22rpx; + font-weight: 500; + color: #909795; + line-height: 32rpx + } + } + + } +} diff --git a/src/pages/preview/brand/info/info.tsx b/src/pages/preview/brand/info/info.tsx new file mode 100644 index 0000000..0ac2089 --- /dev/null +++ b/src/pages/preview/brand/info/info.tsx @@ -0,0 +1,97 @@ +import {FC, useEffect, useState} from "react"; +import {Image, Swiper, SwiperItem, Text, Video, View} from "@tarojs/components"; +import {ArticleRecord, brandApi, BrandRecord} from "@/api"; +import styles from './info.module.scss' +import Taro, {useRouter} from "@tarojs/taro"; +import LineEllipsis from "@/components/textCollapse/collapse"; +import Empty from "@/components/empty/empty"; + +type Params = { + id: number +} +const BrandInfo: FC = () => { + const {id} = useRouter().params as unknown as Params + const [brandInfo, setBrandInfo] = useState() + const [articleList, setArticleList] = useState() + + useEffect(() => { + getData() + }, [id]) + + const getData = async () => { + try { + const data = await brandApi.info(id) + Taro.setNavigationBarTitle({title: data.name}) + setBrandInfo(data) + const data1 = await brandApi.articleList(id) + setArticleList(data1.list) + } catch (e) { + // setBrandInfo({disabled: 0, graphic_introduction: "", id: 0, introductory_video: "", name: "", brand_album:['1','2','3']}) + } + } + + + return ( + + { + + + ) + {brandInfo?.brand_album?.length + && brandInfo?.brand_album?.map((d) => + + + ) + } + + + } + + + {brandInfo?.name} + + + + { + articleList?.length ? + articleList.map((i: any) => + { + Taro.navigateTo({url: `/pages/preview/brand/article/article?id=${i.id}`}) + }}> + + + {i.title} + {i.created_at} {i.page_view}阅读 + + {/**/} + + + ) + : + } + + + + + ); +} + +export default BrandInfo diff --git a/src/pages/preview/brand/list/list.config.ts b/src/pages/preview/brand/list/list.config.ts new file mode 100644 index 0000000..89c2e86 --- /dev/null +++ b/src/pages/preview/brand/list/list.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '品牌列表', + onReachBottomDistance: 30 +}) diff --git a/src/pages/preview/brand/list/list.module.scss b/src/pages/preview/brand/list/list.module.scss new file mode 100644 index 0000000..25cd50a --- /dev/null +++ b/src/pages/preview/brand/list/list.module.scss @@ -0,0 +1,32 @@ +.box { + display: flex; + margin-bottom: 20rpx; + background-color: #fff; + border-radius: 16rpx; + padding: 24rpx; + box-sizing: border-box; +} +.image{ + width: 128rpx; + height:128rpx; + background-color: pink; + border-radius: 8rpx; +} +.rightBox{ + padding-left: 24rpx; + box-sizing: border-box; + flex: 1; +} +.desc{ + font-size: 24rpx; + font-weight: 500; + color: #909795; + line-height: 34rpx; + display: -webkit-box; + word-break: break-all; + text-overflow: ellipsis; + overflow: hidden; + -webkit-box-orient:vertical; + -webkit-line-clamp:2; +} + diff --git a/src/pages/preview/brand/list/list.tsx b/src/pages/preview/brand/list/list.tsx new file mode 100644 index 0000000..2ea9aef --- /dev/null +++ b/src/pages/preview/brand/list/list.tsx @@ -0,0 +1,57 @@ +import {FC, useCallback, useEffect, useState} from "react"; +import {Image, View} from "@tarojs/components"; +import {brandApi, BrandRecord} from "@/api"; +import styles from './list.module.scss' +import Taro, {useReachBottom} from "@tarojs/taro"; +import Empty from "@/components/empty/empty"; + +const BrandList: FC = () => { + const [page, setPage] = useState(1) + const [brands, setBrands] = useState([]) + const [total, setTotal] = useState(0) + + useEffect(() => { + getData() + }, [page]) + + const getData = useCallback(async () => { + try { + const res = await brandApi.list(1, 10) + setTotal(res.total) + setBrands([ + ...res.data + ]) + } catch (e) { + } + }, [page]) + + + function jumpInfo(id: number) { + Taro.navigateTo({url: `/pages/preview/brand/info/info?id=${id}`}) + } + + useReachBottom(useCallback(() => { + if (brands?.length < total) { + setPage(page + 1) + } + }, [total, brands])) + + + return ( + + { + brands.length ? brands.map((d) => + jumpInfo(d.id)} className={styles.box} key={d.id}> + + + {d.name} + {d.graphic_introduction.repeat(30)} + + ) + : + } + + ) +} + +export default BrandList From 8aa2be65f5d8430cd5c0da1c81467de248bcdc9d Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Mon, 21 Aug 2023 18:03:08 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E7=96=BE=E7=97=85=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 1 + .../preview/illness/article/article.config.ts | 4 ++ .../illness/article/article.module.scss | 34 ++++++++++++ src/pages/preview/illness/article/article.tsx | 51 ++++++++++++++++++ src/static/img/doubleDown.png | Bin 0 -> 1143 bytes 5 files changed, 90 insertions(+) create mode 100644 src/pages/preview/illness/article/article.config.ts create mode 100644 src/pages/preview/illness/article/article.module.scss create mode 100644 src/pages/preview/illness/article/article.tsx create mode 100644 src/static/img/doubleDown.png diff --git a/src/app.config.ts b/src/app.config.ts index 8e793b3..3839a51 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -85,6 +85,7 @@ export default defineAppConfig({ 'brand/article/article', 'health/health', // 健康 'videoFull/videoFull', // 资源id 视频全屏 + 'illness/article/article' ] }, ], diff --git a/src/pages/preview/illness/article/article.config.ts b/src/pages/preview/illness/article/article.config.ts new file mode 100644 index 0000000..2a0a86b --- /dev/null +++ b/src/pages/preview/illness/article/article.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '', + onReachBottomDistance: 30 +}) diff --git a/src/pages/preview/illness/article/article.module.scss b/src/pages/preview/illness/article/article.module.scss new file mode 100644 index 0000000..da98846 --- /dev/null +++ b/src/pages/preview/illness/article/article.module.scss @@ -0,0 +1,34 @@ +.fixedBox{ + position: absolute; + width: 100vw; + height: 100vh; + background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1), rgba(255, 255, 255, 1)); + &-inner{ + position: absolute; + width: 100vw; + top:45vh; + display: flex; + flex-direction: column; + align-items: center; + &-icon{ + image{ + width: 32rpx; + height: 32rpx; + } + } + &-box{ + margin-top: 24rpx; + width: 680rpx; + left:35rpx; + height: 76rpx; + background-color: #45D4A8; + color:#fff; + line-height: 76rpx; + text-align: center; + font-size: 32rpx; + font-weight: 500; + border-radius: 8rpx 8rpx 8rpx 8rpx; + } + + } +} diff --git a/src/pages/preview/illness/article/article.tsx b/src/pages/preview/illness/article/article.tsx new file mode 100644 index 0000000..476807c --- /dev/null +++ b/src/pages/preview/illness/article/article.tsx @@ -0,0 +1,51 @@ +import {FC, useEffect, useState} from "react"; +import {Image, Text, View} from "@tarojs/components"; +import Taro, {useRouter} from "@tarojs/taro"; +import {ArticleRecord, brandApi} from "@/api"; +import styles from './article.module.scss' +import down from '@/static/img/doubleDown.png' +import {Profile} from "@/store"; + + +const article:FC = () => { + const {token} = Profile.useContainer() + const {id} = useRouter().params as unknown as { id: number} + const [articleInfo,setArticleInfo] = useState() + useEffect(() => { + getData() + }, [id]) + + const getData = async () => { + Taro.setNavigationBarTitle({title:'疾病文章详情'}) + try { + const data = await brandApi.articleInfo(id) + Taro.setNavigationBarTitle({title:data.title}) + setArticleInfo(data) + } catch (e) { + } + } + function helloWorld() { + const html = articleInfo?.content; + return ( + <> + + { + !token && + + + + + + + 登录查看更多内容 + + + + } + + + ) + } + return helloWorld() +} +export default article diff --git a/src/static/img/doubleDown.png b/src/static/img/doubleDown.png new file mode 100644 index 0000000000000000000000000000000000000000..ac02334fad07b1278ef02c1e290a8e848a72edf1 GIT binary patch literal 1143 zcmYjP3rtgI6uzacIxLTcl}tp~(qIb9U}B<GKh5&OXVzP&BjjgkpgCgBk$I0UwHTS>h6@A<#;-S2$o{JH;$ zT(v4JG$s^5kg%L=r3UtQ_;-~MqVngTY_JIqYgF5jP9k<3@T1&ac{_ppFYur!3VUyF zFGP;xyk4)(X2URyrs=`KL5ITu3<-~qbUK|Lj|UqXA_(F>eEx$5V52ApO%JdG7{?KA zH^#E0n3p-8l1vZ*vC-r9y#+KG|ruGiA<-)~Fon2j*ySuMky>|V^joY{T`t2A- zkQD9W+#b*1(4W4Mk-tVq#~%CrPsYdpemXHZIXyiy^X&QT?A(ig=U*-?EH1@u?J0t* zY0Ob>%X@o``R<8=2U^5FL#DX1PKJAaP>!LxUr%?)RV$qz&Q(jUH|6TXRnD|*`_!W4 z;Z)h|!Lp~{DvDATd#im@WAdh3FMYE~l6Si_0}*#?k_GF^n)@CmkF+Z`*DN)iD`EGI zpaqrUnzq!0#0a7PvApkqI4h~S*e<6^$4{*&zNOKk-wRaI!<5c>;QmBw$jy8$YO$u9 zF6`K}YcjtM)ta_tMNMDPA2+8WPhp4xOwki2I=?^E|TNGq>}SR;C`F3BobnQA!d zNVBZopB6cc{>Xh*TWpMNsH=*0=%u1N<@(DD36$~DmZ3wLRr>bIcp=%6xYxPcRBb4Y zPDh51NXM$f6b0y(XXV24;?&Tzn)(KVwOah-y?muMzM|^R8EorniSZ-zaqAa7dw)|S z_q<2%Sz9G$W>sU8z;3XWthK*s{{2|YL=0Z)@9$5>2mEZteAveG7kB)!XqkuGgyig0 KD?7Ir*ZmLS2f4`r literal 0 HcmV?d00001 From 73cfd07fcae1e64193ec8d8233f14df1bf5e2ea8 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 21 Aug 2023 18:13:52 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E4=B8=93=E4=B8=9A=E7=9F=A5=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/home.ts | 7 +++ src/app.config.ts | 1 + src/pages/home/components/feature.tsx | 4 +- .../home/components/feature_recommended.tsx | 20 +++++--- src/pages/preview/health/health.tsx | 17 ++++--- .../preview/profession/profession.config.ts | 4 ++ src/pages/preview/profession/profession.tsx | 51 +++++++++++++++++++ 7 files changed, 88 insertions(+), 16 deletions(-) create mode 100644 src/pages/preview/profession/profession.config.ts create mode 100644 src/pages/preview/profession/profession.tsx diff --git a/src/api/home.ts b/src/api/home.ts index 3b39499..0bf1f18 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -1,4 +1,5 @@ import {request} from "@/api/request"; +import {Category} from "@/api/public"; export interface AdwareParams { key: string @@ -52,5 +53,11 @@ export const HomeApi = { /** 技能 */ skillTop(count: number) { return request('/home/v1/skill/top', "GET", {count}) + }, + skillCategory() { + return request('/home/v1/skill/category', "GET") + }, + skillList(categoryId: number, page: number, page_size: number) { + return request('/home/v1/skill/index', "GET", {categoryId, page, page_size}) } } diff --git a/src/app.config.ts b/src/app.config.ts index 8e793b3..8a383d5 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -83,6 +83,7 @@ export default defineAppConfig({ 'brand/list/list', 'brand/info/info', 'brand/article/article', + 'profession/profession', 'health/health', // 健康 'videoFull/videoFull', // 资源id 视频全屏 ] diff --git a/src/pages/home/components/feature.tsx b/src/pages/home/components/feature.tsx index f82dd0b..0ab46de 100644 --- a/src/pages/home/components/feature.tsx +++ b/src/pages/home/components/feature.tsx @@ -9,8 +9,8 @@ import Taro from "@tarojs/taro"; const Feature: FC = () => { const list = [ {url: '/pages/preview/brand/list/list', image: article, text: '品牌'}, - {url: '', image: health, text: '健康管理'}, - {url: '', image: profession, text: '专业技能'}, + {url: '/pages/preview/health/health', image: health, text: '健康管理'}, + {url: '/pages/preview/profession/profession', image: profession, text: '专业技能'}, {url: '', image: illness, text: '疾病知识'}, ] diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index 1444989..779a5e7 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -24,17 +24,22 @@ interface Data { const FeatureRecommended: FC = () => { const [data, setData] = useState([ - {title: "品牌TOP3", url: '', detailsUrl: '', data: []}, + { + title: "品牌TOP3", + url: '/pages/preview/brand/list/list', + detailsUrl: '/pages/preview/brand/info/info', + data: [] + }, { title: "健康知识TOP3", url: '/pages/preview/health/health', - detailsUrl: '/pages/preview/videoFull/videoFull?url=', + detailsUrl: '/pages/preview/videoFull/videoFull', data: [] }, { - url: '', + url: '/pages/preview/profession/profession', title: "专业技能TOP3", - detailsUrl: '/pages/preview/videoFull/videoFull?url=', + detailsUrl: '/pages/preview/videoFull/videoFull', data: [] }, {title: "疾病知识TOP3", url: '', detailsUrl: '', data: []}, @@ -49,7 +54,7 @@ const FeatureRecommended: FC = () => { title: d.name, imageUrl: d.brand_album, description: d.graphic_introduction, - path: '', + path: `?id=${d.id}`, })) } catch (e) { } @@ -65,7 +70,7 @@ const FeatureRecommended: FC = () => { title: d.title, imageUrl: d.url_path, description: d.introduction, - path: d.resource.url + path: `?url=${d.resource.url}` })) } catch (e) { } @@ -81,7 +86,7 @@ const FeatureRecommended: FC = () => { imageUrl: d.url_path, description: '', title: d.resource.name, - path: d.resource.url + path: `?url=${d.resource.url}` })) } catch (e) { } @@ -99,7 +104,6 @@ const FeatureRecommended: FC = () => { }, []) function jump(url: string) { - console.log(url) Taro.navigateTo({url}) } diff --git a/src/pages/preview/health/health.tsx b/src/pages/preview/health/health.tsx index b85116a..d6d59b4 100644 --- a/src/pages/preview/health/health.tsx +++ b/src/pages/preview/health/health.tsx @@ -4,6 +4,7 @@ import {HomeApi} from "@/api"; import Taro, {useReachBottom} from "@tarojs/taro"; import styles from './health.module.scss' import play from '@/static/img/play.png' +import Empty from "@/components/empty/empty"; const Health: FC = () => { const [page, setPage] = useState(1) @@ -33,12 +34,16 @@ const Health: FC = () => { { - data.map(d => jump(d.resource.url, d.id)}> - - - {d.title} - {d.video_view}观看 - ) + data.length > 0 + ? data.map(d => jump(d.resource.url, d.id)}> + + + {d.title} + {d.video_view}观看 + ) + : } diff --git a/src/pages/preview/profession/profession.config.ts b/src/pages/preview/profession/profession.config.ts new file mode 100644 index 0000000..72f4ae5 --- /dev/null +++ b/src/pages/preview/profession/profession.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '专业知识', + onReachBottomDistance: 30 +}) diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx new file mode 100644 index 0000000..806da8b --- /dev/null +++ b/src/pages/preview/profession/profession.tsx @@ -0,0 +1,51 @@ +import {View} from "@tarojs/components"; +import {HomeApi} from "@/api"; +import {useEffect, useState} from "react"; +import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; +import Empty from "@/components/empty/empty"; + +const Profession = () => { + const [tabs, setTabs] = useState([]) + const [page, setPage] = useState(1) + const [categoryId, setCategoryId] = useState(null) + const [data, setData] = useState([]) + + async function getData(categoryId: number) { + const res = await HomeApi.skillList(categoryId, page, 10) + } + + useEffect(() => { + categoryId && getData(categoryId) + }, [categoryId, page]) + + async function getCategory() { + const res = await HomeApi.skillCategory() + const newTabs = res.map(d => ({title: d.name, value: d.id})) + setTabs(newTabs) + setCategoryId(newTabs[0].value as number) + } + + function tabsChange(tab: OnChangOpt) { + setPage(1) + setCategoryId(tab.tab?.value as number) + } + + useEffect(() => { + getCategory().then() + }, []) + + return ( + <> + + + + + { + data.length > 0 + ? data.map(d => {JSON.stringify(d)}) + : + } + + ) +} +export default Profession From 8985b3c6c3bcac2e3c8b9ffcc94fe123f5cfcd65 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 21 Aug 2023 18:26:03 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E4=B8=93=E4=B8=9A=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/home.ts | 2 +- src/pages/preview/profession/profession.tsx | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/api/home.ts b/src/api/home.ts index 0bf1f18..f8817b0 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -58,6 +58,6 @@ export const HomeApi = { return request('/home/v1/skill/category', "GET") }, skillList(categoryId: number, page: number, page_size: number) { - return request('/home/v1/skill/index', "GET", {categoryId, page, page_size}) + return request<{ data: Kill[], total: number }>('/home/v1/skill/index', "GET", {categoryId, page, page_size}) } } diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx index 806da8b..4d93131 100644 --- a/src/pages/preview/profession/profession.tsx +++ b/src/pages/preview/profession/profession.tsx @@ -1,17 +1,21 @@ -import {View} from "@tarojs/components"; +import {Image, View} from "@tarojs/components"; import {HomeApi} from "@/api"; import {useEffect, useState} from "react"; import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; import Empty from "@/components/empty/empty"; +import Taro from "@tarojs/taro"; const Profession = () => { const [tabs, setTabs] = useState([]) const [page, setPage] = useState(1) const [categoryId, setCategoryId] = useState(null) - const [data, setData] = useState([]) + const [data, setData] = useState([]) + const [total, setTotal] = useState(0) async function getData(categoryId: number) { const res = await HomeApi.skillList(categoryId, page, 10) + setTotal(res.total) + setData(res.data) } useEffect(() => { @@ -30,6 +34,10 @@ const Profession = () => { setCategoryId(tab.tab?.value as number) } + function jump(url: string) { + Taro.navigateTo({url: '/pages/preview/videoFull/videoFull?url=' + url}) + } + useEffect(() => { getCategory().then() }, []) @@ -42,7 +50,10 @@ const Profession = () => { { data.length > 0 - ? data.map(d => {JSON.stringify(d)}) + ? data.map(d => jump(d.resource.url)}> + + {d.resource.name} + ) : } From 2c1a5797617d96ba6c0e0ec092d0ecd7d6c59163 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Tue, 22 Aug 2023 11:03:23 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E4=B8=93=E4=B8=9A=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E6=BB=91=E5=8A=A8=E5=88=97=E8=A1=A8=20&&=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../preview/profession/profession.config.ts | 1 - .../preview/profession/profession.module.scss | 20 ++++ src/pages/preview/profession/profession.tsx | 107 ++++++++++++++---- 3 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 src/pages/preview/profession/profession.module.scss diff --git a/src/pages/preview/profession/profession.config.ts b/src/pages/preview/profession/profession.config.ts index 72f4ae5..d182329 100644 --- a/src/pages/preview/profession/profession.config.ts +++ b/src/pages/preview/profession/profession.config.ts @@ -1,4 +1,3 @@ export default definePageConfig({ navigationBarTitleText: '专业知识', - onReachBottomDistance: 30 }) diff --git a/src/pages/preview/profession/profession.module.scss b/src/pages/preview/profession/profession.module.scss new file mode 100644 index 0000000..e2c9fc3 --- /dev/null +++ b/src/pages/preview/profession/profession.module.scss @@ -0,0 +1,20 @@ +.height { + height: calc(100vh - 80rpx - env(safe-area-inset-bottom)); + overflow: hidden; + box-sizing: border-box; +} + +.killBox { + background: #fff; + padding: 20rpx; + box-sizing: border-box; + display: flex; + margin-bottom: 20rpx; + + Image, + image { + width: 200rpx; + margin-right: 20rpx; + border-radius: 10rpx; + } +} diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx index 4d93131..cb26871 100644 --- a/src/pages/preview/profession/profession.tsx +++ b/src/pages/preview/profession/profession.tsx @@ -1,26 +1,60 @@ -import {Image, View} from "@tarojs/components"; +import {Image, ScrollView, Swiper, SwiperItem, View} from "@tarojs/components"; import {HomeApi} from "@/api"; import {useEffect, useState} from "react"; import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs"; import Empty from "@/components/empty/empty"; import Taro from "@tarojs/taro"; +import styles from './profession.module.scss' + +interface KillData { + data: Kill[] + total: number + page: number +} const Profession = () => { const [tabs, setTabs] = useState([]) - const [page, setPage] = useState(1) const [categoryId, setCategoryId] = useState(null) - const [data, setData] = useState([]) - const [total, setTotal] = useState(0) + const [data, setData] = useState>(new Map) - async function getData(categoryId: number) { - const res = await HomeApi.skillList(categoryId, page, 10) - setTotal(res.total) - setData(res.data) + /** + * more 开启加载更多 + */ + async function getData(more = false) { + if (categoryId) { + const oldData = new Map(data) + const categoryData = oldData.get(categoryId) + const page = more ? (categoryData?.page || 0) + 1 : categoryData?.page || 1 + + /** 无更多 */ + if (more && categoryData && categoryData.data.length >= categoryData.total) { + return + } + + const res = await HomeApi.skillList(categoryId!, page, 10) + const dataList = res.data.reduce((pre, cur) => { + const index = pre.findIndex(d => d.id === cur.id) + if (index === -1) { + pre.push(cur) + } else { + pre.splice(index, 1, cur) + } + return pre + }, categoryData?.data || []) + oldData.delete(categoryId) + + oldData.set(categoryId, { + data: dataList, + total: res.total, + page: page + }) + setData(oldData) + } } useEffect(() => { - categoryId && getData(categoryId) - }, [categoryId, page]) + categoryId && getData() + }, [categoryId]) async function getCategory() { const res = await HomeApi.skillCategory() @@ -30,7 +64,6 @@ const Profession = () => { } function tabsChange(tab: OnChangOpt) { - setPage(1) setCategoryId(tab.tab?.value as number) } @@ -38,24 +71,52 @@ const Profession = () => { Taro.navigateTo({url: '/pages/preview/videoFull/videoFull?url=' + url}) } - useEffect(() => { - getCategory().then() - }, []) + function swiperChange(e) { + const categoryId = tabs[e.target.current].value + setCategoryId(Number(categoryId)) + } + + Taro.useLoad(getCategory) + + function KillList(data: KillData): JSX.Element { + if (!data?.data?.length) { + return + } + return ( + getData(true)} + className={styles.height}> + { + data.data.map(d => + jump(d.resource.url)} > + + {d.resource.name} + + ) + } + + ) + } + return ( <> - + - { - data.length > 0 - ? data.map(d => jump(d.resource.url)}> - - {d.resource.name} - ) - : - } + d.value === categoryId)} + onChange={swiperChange} + className={styles.height} + style={{paddingTop: '10px'}}> + { + tabs.map(d => + {KillList(data.get(Number(d.value))!)} + ) + } + ) } From 71d2f77b3042b4890fefbe3b8e77acd1d76088ab Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Tue, 22 Aug 2023 11:17:17 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E5=93=81=E7=89=8C=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=93=81=E7=89=8C=E8=AF=A6=E6=83=85=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/brand.ts | 1 + src/pages/preview/brand/info/info.module.scss | 17 +++++++++++--- src/pages/preview/brand/info/info.tsx | 22 ++++++++++++------- src/pages/preview/brand/list/list.tsx | 4 ++-- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/api/brand.ts b/src/api/brand.ts index 6770503..4e636c3 100644 --- a/src/api/brand.ts +++ b/src/api/brand.ts @@ -1,6 +1,7 @@ import {request} from "@/api/request"; export type BrandRecord = { + logo: string; name: string; id: number introductory_video: string diff --git a/src/pages/preview/brand/info/info.module.scss b/src/pages/preview/brand/info/info.module.scss index 11abb71..9362555 100644 --- a/src/pages/preview/brand/info/info.module.scss +++ b/src/pages/preview/brand/info/info.module.scss @@ -1,16 +1,27 @@ +page{ + background-color: #fff !important; +} .swiper{ width:750rpx; height:600rpx; - background-color: pink; +} +.curIndexBox{ + position: absolute; + top:450rpx; + right:30rpx; + background-color: rgba(0,0,0,0.5); + border-radius: 30rpx; + padding: 5rpx 30rpx; + color:#fff; } .body{ border-radius: 32rpx 32rpx 0 0; - background-color:cadetblue; + background-color:#f1f8f6; width: 750rpx; box-sizing: border-box; display: flex; flex-direction: column; - min-height: 80vh; + min-height: 600rpx; position: absolute; top: 520rpx; .top{ diff --git a/src/pages/preview/brand/info/info.tsx b/src/pages/preview/brand/info/info.tsx index 0ac2089..f5ab470 100644 --- a/src/pages/preview/brand/info/info.tsx +++ b/src/pages/preview/brand/info/info.tsx @@ -13,6 +13,7 @@ const BrandInfo: FC = () => { const {id} = useRouter().params as unknown as Params const [brandInfo, setBrandInfo] = useState() const [articleList, setArticleList] = useState() + const [curIndex,setCurIndex] = useState(1) useEffect(() => { getData() @@ -30,22 +31,26 @@ const BrandInfo: FC = () => { } } + function onChange(e){ + console.log(e) + setCurIndex(+e.detail.current+1) + } return ( - { - + { brandInfo?.introductory_video_resource?.url && ) + } {brandInfo?.brand_album?.length - && brandInfo?.brand_album?.map((d) => + && brandInfo?.brand_album?.split(',').map((d) => - + ) } - - } + + {curIndex} / {brandInfo?.brand_album?.split(',').length + ((brandInfo && brandInfo.introductory_video_resource) ? 1:0)} + {brandInfo?.name} diff --git a/src/pages/preview/brand/list/list.tsx b/src/pages/preview/brand/list/list.tsx index 2ea9aef..fac5737 100644 --- a/src/pages/preview/brand/list/list.tsx +++ b/src/pages/preview/brand/list/list.tsx @@ -42,10 +42,10 @@ const BrandList: FC = () => { { brands.length ? brands.map((d) => jumpInfo(d.id)} className={styles.box} key={d.id}> - + {d.name} - {d.graphic_introduction.repeat(30)} + {d.graphic_introduction} ) : From 08da33234840e370f596c4f58f7da5b1bcec71a2 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Tue, 22 Aug 2023 11:21:54 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=AD=A6=E4=B9=A0?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/curriculum.ts | 18 +++++++++++++----- src/api/home.ts | 4 ++++ .../home/components/feature_recommended.tsx | 8 +++++++- src/pages/my/components/header/time.tsx | 18 +++++++++--------- src/pages/preview/profession/profession.tsx | 4 ++-- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/api/curriculum.ts b/src/api/curriculum.ts index b304600..ecaec40 100644 --- a/src/api/curriculum.ts +++ b/src/api/curriculum.ts @@ -34,10 +34,18 @@ export interface HourPlayData { } export interface Course { - courses: Curriculum[] - learn_course_records: unknown - user_course_hour_count: unknown - stats: CueStats + /** 完成 */ + finished_count: number; + /** 未完成 */ + not_finished_count: number + /** 选修课时数量 */ + not_required_count: number + /** 必修课时数量 */ + required_count: number + /** 今天 */ + today_learn_time: number + /** 累计 */ + total_learn_time: number } interface AnswerRecord { @@ -87,7 +95,7 @@ export const curriculum = { }, /** 课程进度 */ course() { - return request(`/api/v1/user/courses`, "GET") + return request(`/api/v1/user/all/course/info`, "GET") }, /** 课程结束 */ curEnd(courseId: number, id: number, data: CurEndParam) { diff --git a/src/api/home.ts b/src/api/home.ts index f8817b0..da8a404 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -59,5 +59,9 @@ export const HomeApi = { }, skillList(categoryId: number, page: number, page_size: number) { return request<{ data: Kill[], total: number }>('/home/v1/skill/index', "GET", {categoryId, page, page_size}) + }, + /** 疾病知识 */ + illness(page: number, page_size: number) { + return request('/home/v1/article/illness_list', "GET", {page, page_size}) } } diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index 779a5e7..3250dc8 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -93,8 +93,14 @@ const FeatureRecommended: FC = () => { return [] } + /** 疾病 */ + async function getIllness() { + const res = await HomeApi.illness(1, 3) + console.log(res) + } + useEffect(() => { - Promise.all([getBrand(), getHealth(), getKill()]).then(([brand, health, kill]) => { + Promise.all([getBrand(), getHealth(), getKill(), getIllness()]).then(([brand, health, kill]) => { const oldData: Data[] = JSON.parse(JSON.stringify(data)) oldData[0].data = brand oldData[1].data = health diff --git a/src/pages/my/components/header/time.tsx b/src/pages/my/components/header/time.tsx index c542e33..a2aeeda 100644 --- a/src/pages/my/components/header/time.tsx +++ b/src/pages/my/components/header/time.tsx @@ -22,8 +22,8 @@ const Time: FC = () => { const [list, setList] = useState([ {title: '今日时长', time: '00:00', src: time1}, {title: '累计时长', time: '00:00', src: time2}, - {title: '必修课', time: '0/0', src: curriculum1, type: 1}, - {title: '选修课', time: '0/0', src: curriculum2, type: 2}, + {title: '必修课', time: '0', src: curriculum1, type: 1}, + {title: '选修课', time: '0', src: curriculum2, type: 2}, {title: '已完成', time: '0', src: over, type: 3}, {title: '未完成', time: '0', src: incomplete, type: 4}, ]) @@ -31,14 +31,14 @@ const Time: FC = () => { Taro.useDidShow(async () => { try { - const {stats} = await curriculum.course() + const res = await curriculum.course() const oldList: List[] = JSON.parse(JSON.stringify(list)) - oldList[0].time = formatMinute(stats.today_learn_duration) - oldList[1].time = formatMinute(stats.learn_duration) - oldList[2].time = stats.required_course_count - oldList[3].time = stats.nun_required_course_count - oldList[4].time = stats.required_finished_course_count + stats.nun_required_finished_course_count - oldList[5].time = stats.total_course_count - (stats.required_finished_course_count + stats.nun_required_finished_course_count) + oldList[0].time = formatMinute(res.today_learn_time) + oldList[1].time = formatMinute(res.total_learn_time) + oldList[2].time = res.required_count + oldList[3].time = res.not_required_count + oldList[4].time = res.finished_count + oldList[5].time = res.not_finished_count setList(oldList) } catch (e) { } diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx index cb26871..3c98948 100644 --- a/src/pages/preview/profession/profession.tsx +++ b/src/pages/preview/profession/profession.tsx @@ -89,7 +89,7 @@ const Profession = () => { className={styles.height}> { data.data.map(d => - jump(d.resource.url)} > + jump(d.resource.url)}> {d.resource.name} @@ -107,7 +107,7 @@ const Profession = () => { d.value === categoryId)} + current={tabs.findIndex(d => d.value === categoryId)} onChange={swiperChange} className={styles.height} style={{paddingTop: '10px'}}> From fcd166e2ed34bf3bf32e58da30d5cb43b72153be Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Tue, 22 Aug 2023 15:26:23 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E7=96=BE=E7=97=85=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/illness.ts | 15 +++++ src/app.config.ts | 2 + src/pages/preview/illness/list/list.config.ts | 4 ++ .../preview/illness/list/list.module.scss | 34 ++++++++++ src/pages/preview/illness/list/list.tsx | 66 +++++++++++++++++++ 5 files changed, 121 insertions(+) create mode 100644 src/api/illness.ts create mode 100644 src/pages/preview/illness/list/list.config.ts create mode 100644 src/pages/preview/illness/list/list.module.scss create mode 100644 src/pages/preview/illness/list/list.tsx diff --git a/src/api/illness.ts b/src/api/illness.ts new file mode 100644 index 0000000..7e1aa21 --- /dev/null +++ b/src/api/illness.ts @@ -0,0 +1,15 @@ +import {request} from "@/api/request"; + + +export const illnessApi = { + /** 疾病列表 */ + list(id:number,page: number , page_size: number) { + return request<{ + list: any[], + total: number, + }>(`/home/v1/illness/list?page=${page}&page_size=${page_size}&id=${id}` , "GET") + }, + articleInfo(id: number ) { + return request<{ content: string }>(`/home/v1/article/${id}` , "GET") + }, +} diff --git a/src/app.config.ts b/src/app.config.ts index 4435b93..2476b10 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -86,6 +86,8 @@ export default defineAppConfig({ 'profession/profession', 'health/health', // 健康 'videoFull/videoFull', // 资源id 视频全屏 + 'illness/list/list', + 'illness/info/info', 'illness/article/article' ] }, diff --git a/src/pages/preview/illness/list/list.config.ts b/src/pages/preview/illness/list/list.config.ts new file mode 100644 index 0000000..2a0a86b --- /dev/null +++ b/src/pages/preview/illness/list/list.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '', + onReachBottomDistance: 30 +}) diff --git a/src/pages/preview/illness/list/list.module.scss b/src/pages/preview/illness/list/list.module.scss new file mode 100644 index 0000000..a232e59 --- /dev/null +++ b/src/pages/preview/illness/list/list.module.scss @@ -0,0 +1,34 @@ +page{ + background-color: #fff !important; +} +.box { + display: flex; + margin-bottom: 20rpx; + background-color: #fff; + border-radius: 16rpx; + box-sizing: border-box; +} +.image{ + width: 128rpx; + height:128rpx; + background-color: pink; + border-radius: 8rpx; +} +.rightBox{ + padding-left: 24rpx; + box-sizing: border-box; + flex: 1; +} +.desc{ + font-size: 24rpx; + font-weight: 500; + color: #909795; + line-height: 34rpx; + display: -webkit-box; + word-break: break-all; + text-overflow: ellipsis; + overflow: hidden; + -webkit-box-orient:vertical; + -webkit-line-clamp:2; +} + diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx new file mode 100644 index 0000000..ebbccd9 --- /dev/null +++ b/src/pages/preview/illness/list/list.tsx @@ -0,0 +1,66 @@ +import {FC, useCallback, useEffect, useState} from "react"; +import {Image, View} from "@tarojs/components"; +import {brandApi, BrandRecord} from "@/api"; +import styles from './list.module.scss' +import Taro, {useReachBottom} from "@tarojs/taro"; +import Empty from "@/components/empty/empty"; +import Collapse from "@/components/collapse/collapse"; +import {illnessApi} from "@/api/illness"; +import {apis} from "@tarojs/plugin-platform-h5/dist/dist/definition.json"; +import setNavigationBarTitle = apis.setNavigationBarTitle; + +const BrandList: FC = () => { + const [page, setPage] = useState(1) + const [brands, setBrands] = useState([]) + const [total, setTotal] = useState(0) + + useEffect(() => { + getData() + }, [page]) + + const getData = useCallback(async () => { + try { + const data = await illnessApi.list(22,1, 100) + setTotal(data.total) + setBrands([ + ...data.list + ]) + Taro.setNavigationBarTitle({title: data.list?.[0].resourceCategories?.[0]?.name ?? '文章列表'}) + } catch (e) { + } + }, [page]) + + + useReachBottom(useCallback(() => { + if (brands?.length < total) { + setPage(page + 1) + } + }, [total, brands])) + + + return ( + + { + brands.length && + brands.map((d) => + + + + { + d.articles?.map((d) => + {Taro.navigateTo({url: `/pages/preview/illness/article/article?id=${d.id}`})}} className='mt-2 font-28 ml-5'>{d.title} + + ) + } + + }> + + + ) + } + + ) +} + +export default BrandList From d2157d1561066f482076fa892d064515c4a471f4 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Tue, 22 Aug 2023 15:27:08 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/home.ts | 5 +- src/api/public.ts | 1 + src/app.config.ts | 3 +- src/pages/home/components/feature.tsx | 2 +- .../home/components/feature_recommended.tsx | 27 +++++-- src/pages/preview/illness/sort/sort.config.ts | 3 + .../preview/illness/sort/sort.module.scss | 71 ++++++++++++++++++ src/pages/preview/illness/sort/sort.tsx | 71 ++++++++++++++++++ src/static/img/first.png | Bin 453 -> 681 bytes src/static/img/second.png | Bin 457 -> 791 bytes src/static/img/third.png | Bin 466 -> 853 bytes types/home.d.ts | 9 ++- 12 files changed, 183 insertions(+), 9 deletions(-) create mode 100644 src/pages/preview/illness/sort/sort.config.ts create mode 100644 src/pages/preview/illness/sort/sort.module.scss create mode 100644 src/pages/preview/illness/sort/sort.tsx diff --git a/src/api/home.ts b/src/api/home.ts index da8a404..e6ef81c 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -62,6 +62,9 @@ export const HomeApi = { }, /** 疾病知识 */ illness(page: number, page_size: number) { - return request('/home/v1/article/illness_list', "GET", {page, page_size}) + return request<{ list: Illness[], total: number }>('/home/v1/article/illness_list', "GET", {page, page_size}) + }, + category(type: number) { + return request('/home/v1/category/index/info?type=' + type, "GET") } } diff --git a/src/api/public.ts b/src/api/public.ts index 8337e6d..b8c363a 100644 --- a/src/api/public.ts +++ b/src/api/public.ts @@ -6,6 +6,7 @@ export interface Category { parent_chain: string parent_id: number sort: number + resource_category?: Category[] } interface CategoryList { diff --git a/src/app.config.ts b/src/app.config.ts index 4435b93..24cfbcc 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -86,7 +86,8 @@ export default defineAppConfig({ 'profession/profession', 'health/health', // 健康 'videoFull/videoFull', // 资源id 视频全屏 - 'illness/article/article' + 'illness/article/article', + 'illness/sort/sort' ] }, ], diff --git a/src/pages/home/components/feature.tsx b/src/pages/home/components/feature.tsx index 0ab46de..9f1a6f0 100644 --- a/src/pages/home/components/feature.tsx +++ b/src/pages/home/components/feature.tsx @@ -11,7 +11,7 @@ const Feature: FC = () => { {url: '/pages/preview/brand/list/list', image: article, text: '品牌'}, {url: '/pages/preview/health/health', image: health, text: '健康管理'}, {url: '/pages/preview/profession/profession', image: profession, text: '专业技能'}, - {url: '', image: illness, text: '疾病知识'}, + {url: '/pages/preview/illness/sort/sort', image: illness, text: '疾病知识'}, ] function jump(url) { diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index 3250dc8..d74dcd6 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -42,7 +42,12 @@ const FeatureRecommended: FC = () => { detailsUrl: '/pages/preview/videoFull/videoFull', data: [] }, - {title: "疾病知识TOP3", url: '', detailsUrl: '', data: []}, + { + title: "疾病知识TOP3", + url: '/pages/preview/illness/sort/sort', + detailsUrl: '/pages/preview/illness/article/article', + data: [] + }, ]) /** 品牌 */ @@ -94,17 +99,29 @@ const FeatureRecommended: FC = () => { } /** 疾病 */ - async function getIllness() { - const res = await HomeApi.illness(1, 3) - console.log(res) + async function getIllness(): Promise { + try { + const res = await HomeApi.illness(1, 3) + return res.list.map(d => ({ + id: d.id, + imageUrl: '', + description: d.content, + title: d.title, + path: `?id=${d.id}` + })) + } catch (e) { + } + return [] } useEffect(() => { - Promise.all([getBrand(), getHealth(), getKill(), getIllness()]).then(([brand, health, kill]) => { + Promise.all([getBrand(), getHealth(), getKill(), getIllness()]).then(([brand, health, kill, illness]) => { const oldData: Data[] = JSON.parse(JSON.stringify(data)) oldData[0].data = brand oldData[1].data = health oldData[2].data = kill + console.log(illness) + oldData[3].data = illness setData(oldData) }) }, []) diff --git a/src/pages/preview/illness/sort/sort.config.ts b/src/pages/preview/illness/sort/sort.config.ts new file mode 100644 index 0000000..b7d09ab --- /dev/null +++ b/src/pages/preview/illness/sort/sort.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '疾病知识', +}) diff --git a/src/pages/preview/illness/sort/sort.module.scss b/src/pages/preview/illness/sort/sort.module.scss new file mode 100644 index 0000000..c0c2030 --- /dev/null +++ b/src/pages/preview/illness/sort/sort.module.scss @@ -0,0 +1,71 @@ +.firstOrder { + width: 300rpx; + height: calc(100vh - env(safe-area-inset-bottom)); + + View { + width: 100%; + text-align: center; + min-height: 100rpx; + color: #323635; + display: flex; + align-items: center; + padding: 10rpx; + box-sizing: border-box; + justify-content: center; + } +} + +/** 选中 */ +.select { + color: #45D4A8 !important; + font-weight: bold; + position: relative; + transition: all 200ms; + + &:after { + content: ''; + display: block; + width: 8rpx; + height: 60rpx; + background: #45D4A8; + position: absolute; + left: 0; + top: 0; + bottom: 0; + margin: auto; + border-radius: 10rpx; + } +} + +.tree { + padding: 0 15rpx; + background: #fff; + box-sizing: border-box; + height: calc(100vh - env(safe-area-inset-bottom)); +} + +.name { + font-size: 32rpx; + font-weight: bold; + color: #323635; + padding: 40rpx 0 40rpx 15rpx; +} + +.secondaryBox { + display: flex; + flex-wrap: wrap; + align-items: flex-start; +} + +.secondary { + width: 50%; + padding: 0 15rpx; + box-sizing: border-box; + color: #323635; + text-align: center; + line-height: 60rpx; + background: #F5F8F7; + border-radius: 8rpx; + margin-bottom: 20rpx; + background-clip: content-box; +} diff --git a/src/pages/preview/illness/sort/sort.tsx b/src/pages/preview/illness/sort/sort.tsx new file mode 100644 index 0000000..c4e9781 --- /dev/null +++ b/src/pages/preview/illness/sort/sort.tsx @@ -0,0 +1,71 @@ +import {ScrollView, View} from "@tarojs/components"; +import {FC, useState} from "react"; +import {Category, HomeApi} from "@/api"; +import Taro from "@tarojs/taro"; +import styles from './sort.module.scss' + +const prefix = 'SORT' +const Sort: FC = () => { + const [data, setData] = useState([]) + const [select, setSelect] = useState(null) + + async function getData() { + const res = await HomeApi.category(3) + setData(res) + if (res.length) { + setSelect(`${prefix}-${res[0].id}`) + } + } + + function jump(id: number) { + console.log(id) + } + + Taro.useLoad(getData) + + return ( + + + { + data.map(d => setSelect(`${prefix}-${d.id}`)} + className={`${select === `${prefix}-${d.id}` && styles.select}`}> + {d.name} + ) + } + + + + { + data.map(d => + {d.name} + + { + d.resource_category?.map(c => jump(d.id)} + key={d.id} + className={styles.secondary}> + {c.name} + ) + } + + + ) + } + + + ) +} + +export default Sort diff --git a/src/static/img/first.png b/src/static/img/first.png index 7aa104458de9dfccd8284e040dc5f19b0d8e67e8..08837997845bc7bd8adf7bfd2abacfbb4b8ef1b7 100644 GIT binary patch delta 644 zcmV-~0(AOR4wQm;f+H;nK#{5yEzM*dF{&s zIFC;5YOtvTdLnOQ3tOe>SC^$7xE9u9UTqVM=m3o9Gbz_JJ$R9w<|cO)N@~`DJT;lA zg*F87HJAg~)zj3=3$_lF@}+Pu-vMLdE%eAkxR-5*m<+=h`vtJGLdh3iTL8H{04ZQ2 znd#%M+X*ufhJQZRFSkX>f%DSeAOl#jYZmaOPYy8o{A^Kx`Sr~Zi4gS9y^?^ZXNm)? z+yjvqg&vUvB!Z`k0(e&KgNTnJ9eE_@Al~1_1cLRykXbzqEfCrWQlA1+dW!d*EXqMy zLo1Bv916~4qB;8Cw!Lh1MKHs1E-yGz>)cl9)1k()$HrQPW2=qi3=HA6yuYCB| zFa-gYm|0c6-;HzvP#GxAZ$LmAq;yqoS>h#9%|cFX0okJH?UqJGaj9TlZ#`2$K@zN1 eZtEFz+QJ`!0~c;3kV$6%0000O8Ey!;YL|< zA&t`diAXDvS|TFlKOpVGiZBsP#El!Zn>B3nPTQl6pMG98%Fc6hI&aVC`#qhWbNF;N zCj=k>bhLarot2O5cn_17g+3oorjzNk1s{(+7C;uIrz8vbaDOzV*TF+zLb9*>?ZPC3 z_lM(p9o!wbH3Rm?^a5`8Ml=IO};S2*P z(o*dNVMcsCqagcq00<0Gd`4~ru>}In*@Tc>DhOS)nKcQ~_3oyG&;y9=e;`H`rPEeD zxtuC?)?}BfU4LaNPv!-zGsn$m^iO?(H=$nIi)*HX*7e^6UwIu40o;V-|Iy7o6nYD5 zJ)W=YKRK{YM!g;7ap9r>Rhhm71b1HIiI$Rvne(5-qy?lNJTcVuTF?o=5FpQ*fWR}T zT=x1>H)$l&In4+#H-%POE0oGHAX1qeQ=p%5G3<@=ff(P8@Do=g)D9=LNf8iNM|gh-Geff8)^u_?7hD4-&?6fU%dC{XEcpV`$dShg*g z@D96qZ)U#l&CHj1H0kj&?Bk*dw`YF|ye{|t5_ra3yCTTf>wm%L>*Qhz@i?O42t-lL zT3m9Ej4==aj6vq9K|D{VY|a1P73(nkVSmbBMuwXoDw!{_!O z7K`n$S6HgB8h>5E(n3fzUc#f%A!phi95o)tF{2R^;~v#omzv7u^SRm2X?sD#gF|Tv z4i_5aEEavS+% z&tWOFh`{`OMyb+ZU;my6j73F|lobpFWSM4LG|=0}6n{x(`XA6}aJH%v`T{*>ru+ym zhm+FG6i59%y;(EJ<9S#w)L?yW4O6}e#5d#FE}pbgUw2PN0%<&4ti3ENY1TizYhcBZ zdb{2(gJ6&klyULbDvgQSt5*;SN8tZ7xx=37pSov^EmO~%uBQM!QoGuTlf|+WN8URj z2%>7u1%E+6Jg#0cB0M37!=c$&{rQ}M-A*MjTP-+MQj)PO3xObfo{u|xIN;@v&Dfpf z`04KKyu}h|VL-v23%xCXfK|rfUR{0tD`ki#&F$^&#W|p7jN#hP;x z$!b8IZ5{VnBGF7lTE?X3V(Yy~vtQ?c2iI@jXlzNv+diTHv30ezmB&T)0zhq+Y(|KQ zO$|2NS2e%11hQ)FcCN!z@sJVh01l=AY;wTkh8ce|+3i~|QHoPW0>$@rYil*Y*+IDU l=Zr=ZBJ8#%n>SmpegllHGFSCrOhNzv002ovPDHLkV1iiNZa)A3 delta 419 zcmV;U0bKr<2FU}EFnL_ulWJ zyIP$g*yy%elLgc(Raro-T#*G-i)988zzm6zDut4j0RiYtWq(vL-Q)|FuGyKQb{kbp zrCeV24hq?vEFhoB$^vp}T^5i{rDXw`WQy%4DKSzyk(A9K6;H?llCi4>2-DUFv+ct9 zZ9n!gWX#MBN?gW{0NR%*2}C#~UDwCnnlC2|-WVlB0nVOV@0*VO#G}!5HV|N7>OUX? znyg^k<#wOjCV%Sag~Q>QanLa{mWP25a81VNmdopXviElysG}JTMRwRQ{6sX#Y?h1P zdeJ9-Re;@1JwqQFnt)qlN5`2HGwUv^ zJEQsF|1$jlxqRoG@0>F<*ILCO01T|fmu5dzs;<}Ukl0+#Ykv~@LP=<*v25iGh`{R| zz`BiErX_Z0XMwDCNNu$NZgk@quPF?g1HX!Y zv=`sQ_FoM6P)7ek`u+}3=7Uy1s6CCnE?89tWU&GED1QhE8CnK&Z8d-_8JB4E)%{fg z1beb(9tBShL;BHZ4B)E1YY1R=q(GS*(K7Be%LS%ry%4NPyI|S66W)eWuq=nD*t3sAb`N5< zv%w$(c7M@e<&Ap)uIsj#S%5v~EZFPDO#54~=VnuJ5T1Srg38DAn5JTi+=Tg&9*AvqPz?A1QF)W4D>tyC1}pMUD2!q- zqI7{QHkda!G?6^z0*ll7Wns8sMqccx2bEg3!GBtPCD-D}!leKX_}&fo?1EW{yj~&s zT>P1b{lOy_5=sBFE0>s103iH7F}y@{b#rcEaR?7a4czg4owLZsNU7&> w-YX818BQ>=v}6daCdkgX3r{JG*u^ZRXnoqK=3^ZA|gJ?HQ# zJS!jo0aWaK+zpwol`TH(1Vzcy-%`T+t$^AH5}T810e9=;Vt?yv3z1Hnw`-$95aKAK zblSXG^*ep1U2n!$hSh3ty*#8AaJ4kx=mT43yS4vs^K#LrHiCcGf|SS@706ooOvM z1bzr|{{<4nk$(YiUS)sC^z#ldjg#>f53^(vK-nwg&vSLvpk7;0Js5Ge=%)uqCYl%j(wZ5mA9whe+U9T#v8$SFhwJ8Bsf;7z) z$-8VdAex9|CmklA2y}R&ZXY$xNTu7i0Q=I>h_~340VNHB5-S)Y?1HX&>c{qfDu@>u WIpP}InyIA#0000 Date: Tue, 22 Aug 2023 16:47:31 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/home.ts | 1 + src/app.config.ts | 3 --- src/pages/home/components/adware.tsx | 13 +++++++--- .../home/components/feature_recommended.tsx | 2 +- src/pages/home/home.module.scss | 2 ++ src/pages/home/home.tsx | 4 +-- src/pages/index/index.module.scss | 26 +++++++++++++++++++ src/pages/preview/illness/list/list.tsx | 11 +++----- src/pages/preview/illness/sort/sort.tsx | 2 +- .../preview/videoFull/videoFull.module.scss | 11 ++++++++ src/pages/preview/videoFull/videoFull.tsx | 3 ++- 11 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 src/pages/preview/videoFull/videoFull.module.scss diff --git a/src/api/home.ts b/src/api/home.ts index e6ef81c..5d39f6a 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -16,6 +16,7 @@ export interface AdwareLinkType { } export interface AdwareType { + image_path:string advert_link: AdwareLinkType scope_id: number | string id: number diff --git a/src/app.config.ts b/src/app.config.ts index a2fadac..35b5f24 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -86,11 +86,8 @@ export default defineAppConfig({ 'profession/profession', 'health/health', // 健康 'videoFull/videoFull', // 资源id 视频全屏 - 'illness/article/article', 'illness/sort/sort', 'illness/list/list', - 'illness/info/info', - 'illness/article/article' ] }, ], diff --git a/src/pages/home/components/adware.tsx b/src/pages/home/components/adware.tsx index fbe7b6e..37c68bd 100644 --- a/src/pages/home/components/adware.tsx +++ b/src/pages/home/components/adware.tsx @@ -3,7 +3,6 @@ import {FC, useState} from "react"; import {AdwareType, HomeApi} from "@/api"; import Taro from "@tarojs/taro"; import styles from '../home.module.scss' -import {jumpAdware} from "@/utils/pathFormt"; const Adware: FC = () => { const [data, setData] = useState([]) @@ -13,6 +12,14 @@ const Adware: FC = () => { setData(res) } + function jumpAdware(url: string) { + if (url.substring(0, 3) === 'wx:') { + Taro.navigateTo({ + url: url.substring(3, url.length) + }) + } + } + Taro.useLoad(getAdware) return ( @@ -23,7 +30,7 @@ const Adware: FC = () => { mode='scaleToFill' lazyLoad fadeIn - onClick={() => jumpAdware(data[0].advert_link)} + onClick={() => jumpAdware(data[0].image_path)} className={styles.adware}/> } { @@ -39,7 +46,7 @@ const Adware: FC = () => { mode='widthFix' lazyLoad fadeIn - onClick={() => jumpAdware(d.advert_link)} + onClick={() => jumpAdware(d.image_path)} style={{width: "100%"}}/> )} diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index d74dcd6..1ff842c 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -142,7 +142,7 @@ const FeatureRecommended: FC = () => { key={c.id} onClick={() => jump(d.detailsUrl + c.path)}> - + diff --git a/src/pages/home/home.module.scss b/src/pages/home/home.module.scss index 30eb09a..c9954e3 100644 --- a/src/pages/home/home.module.scss +++ b/src/pages/home/home.module.scss @@ -1,3 +1,5 @@ + + .content { position: relative; padding: 0 20px; diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index 93d07f3..63ef0a7 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -15,8 +15,8 @@ const Home: FC = () => { const {token, empty} = Profile.useContainer() return ( - - 康一诺 + + 康一诺 diff --git a/src/pages/index/index.module.scss b/src/pages/index/index.module.scss index b58360c..e130875 100644 --- a/src/pages/index/index.module.scss +++ b/src/pages/index/index.module.scss @@ -1,3 +1,29 @@ +.header { + text-align: center; + font-weight: bold; + font-size: 34rpx; + position: fixed; + width: 100%; + left: 0; + top: 0; + height: 70rpx; + overflow: hidden; + + &:after { + min-height: 100vh; + position: absolute; + top: 0; + left: -10%; + width: 120%; + content: ''; + display: block; + background: linear-gradient(40deg, #fff 50rpx, #caf0e2, #92ecc5) no-repeat; + min-height: 100vh; + background-size: 100% 600rpx; + z-index: -1; + } +} + .content { position: relative; padding: 0 20px; diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index ebbccd9..2a3d08d 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -1,15 +1,12 @@ import {FC, useCallback, useEffect, useState} from "react"; -import {Image, View} from "@tarojs/components"; -import {brandApi, BrandRecord} from "@/api"; +import { View} from "@tarojs/components"; import styles from './list.module.scss' -import Taro, {useReachBottom} from "@tarojs/taro"; -import Empty from "@/components/empty/empty"; +import Taro, {useReachBottom, useRouter} from "@tarojs/taro"; import Collapse from "@/components/collapse/collapse"; import {illnessApi} from "@/api/illness"; -import {apis} from "@tarojs/plugin-platform-h5/dist/dist/definition.json"; -import setNavigationBarTitle = apis.setNavigationBarTitle; const BrandList: FC = () => { + const params = useRouter().params as unknown as {id:number} const [page, setPage] = useState(1) const [brands, setBrands] = useState([]) const [total, setTotal] = useState(0) @@ -20,7 +17,7 @@ const BrandList: FC = () => { const getData = useCallback(async () => { try { - const data = await illnessApi.list(22,1, 100) + const data = await illnessApi.list(params.id,1, 100) setTotal(data.total) setBrands([ ...data.list diff --git a/src/pages/preview/illness/sort/sort.tsx b/src/pages/preview/illness/sort/sort.tsx index c4e9781..2530d5f 100644 --- a/src/pages/preview/illness/sort/sort.tsx +++ b/src/pages/preview/illness/sort/sort.tsx @@ -18,7 +18,7 @@ const Sort: FC = () => { } function jump(id: number) { - console.log(id) + Taro.navigateTo({url: '/pages/preview/illness/list/list?id=' + id}) } Taro.useLoad(getData) diff --git a/src/pages/preview/videoFull/videoFull.module.scss b/src/pages/preview/videoFull/videoFull.module.scss new file mode 100644 index 0000000..94766d1 --- /dev/null +++ b/src/pages/preview/videoFull/videoFull.module.scss @@ -0,0 +1,11 @@ +.video { + width: 100%; + height: 100vh; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + margin: auto; + background: #000; +} diff --git a/src/pages/preview/videoFull/videoFull.tsx b/src/pages/preview/videoFull/videoFull.tsx index c88333b..7f33431 100644 --- a/src/pages/preview/videoFull/videoFull.tsx +++ b/src/pages/preview/videoFull/videoFull.tsx @@ -1,6 +1,7 @@ import {Video} from "@tarojs/components"; import {FC} from "react"; import Taro from "@tarojs/taro"; +import styles from './videoFull.module.scss' interface Props { url: string @@ -10,7 +11,7 @@ const VideoFull: FC = () => { const {url} = Taro.useRouter().params return (