# Conflicts:
#	src/pages/preview/search/search/components/list.tsx
#	src/pages/preview/search/search/index.config.ts
#	src/pages/preview/search/search/index.module.scss
#	src/pages/preview/search/search/index.tsx
v2
一杯沧海 1 year ago
commit 29006f34f3
  1. 2
      src/api/brand.ts
  2. 1
      src/api/manage.ts
  3. 2
      src/app.scss
  4. 11
      src/components/learningRecord/learningRecord.tsx
  5. 25
      src/hooks/storageDep.ts
  6. 32
      src/pages/business/courType/courType.tsx
  7. 1
      src/pages/business/curHistory/curHistory.tsx
  8. 39
      src/pages/business/history/history.tsx
  9. 34
      src/pages/home/components/curRecommended.tsx
  10. 6
      src/pages/home/home.tsx
  11. 28
      src/pages/index/index.tsx
  12. 5
      src/pages/login/login.tsx
  13. 13
      src/pages/manage/courseAdmin/components/search.tsx
  14. 8
      src/pages/manage/courseAdmin/courseAdmin.module.scss
  15. 16
      src/pages/manage/courseAdmin/courseAdmin.tsx
  16. 1
      src/pages/manage/depAdmin/depAdmin.tsx
  17. 53
      src/pages/manage/selectDep/selectDep.tsx
  18. 3
      src/pages/manage/userInfo/userInfo.tsx
  19. 36
      src/pages/preview/brand/article/article.module.scss
  20. 32
      src/pages/preview/brand/article/article.tsx
  21. 13
      src/pages/preview/brand/info/info.tsx
  22. 26
      src/pages/preview/brand/list/list.tsx
  23. 2
      src/pages/preview/health/health.tsx
  24. 43
      src/pages/preview/illness/article/article.module.scss
  25. 22
      src/pages/preview/illness/article/article.tsx
  26. 17
      src/pages/preview/illness/list/list.tsx
  27. 1
      src/pages/preview/illness/sort/sort.module.scss
  28. 14
      src/pages/preview/illness/sort/sort.tsx
  29. 1
      src/pages/preview/profession/profession.tsx
  30. BIN
      src/static/img/del.png
  31. 18
      src/utils/time.tsx

@ -11,12 +11,14 @@ export type BrandRecord = {
introductory_video_resource: any
article_count: number
created_at: string
page_view:number
}
export type ArticleRecord = {
title: string
page_view: number
created_at: string
content: string
brands: BrandRecord[]
}
export const brandApi = {

@ -46,7 +46,6 @@ export interface depCurProps {
interface AddCurProps {
course_id: number[]
dep_id: number[]
is_required: (1 | 0)[]
}

@ -270,7 +270,7 @@
.text-hover-danger { color: #a71d2a;}
.text-light { color: #f8f9fa;}
.text-hover-light { color: #cbd3da;}
.text-dark { color: #343a40;}
.text-dark { color: #323635;}
.text-hover-dark{ color: #121416;}
.text-body { color: #212529;}
.text-muted { color: #909795;}

@ -5,7 +5,7 @@ import LineChart from "@/components/lineChart/lineChart";
import {CSSProperties, FC, useEffect, useState} from "react";
import {StatisticsParam, userApi} from "@/api";
import styles from './learningRecord.module.scss'
import Spin from "@/components/spinner";
// import Spin from "@/components/spinner";
import {Profile} from "@/store";
import Taro from "@tarojs/taro";
import debounce from "@/utils/debounce";
@ -44,20 +44,19 @@ interface Props {
*/
const LearningRecord: FC<Props> = ({userId, style, className}) => {
const [lineData, setLineData] = useState<any[]>([])
const [loading, setLoading] = useState(false)
// const [loading, setLoading] = useState(false)
const {token} = Profile.useContainer()
async function getStatistics(data: StatisticsParam) {
if (!userId) return;
try {
setLoading(true)
if (!userId) return;
setLineData([])
const res = await userApi.statistics(userId, data)
const everyDayValue = everyDay(data.start_time, Number(data.end_time), res.data)
setLineData(everyDayValue)
} catch (e) {
setLineData([])
}
setLoading(false)
}
function tabChange({tab}: OnChangOpt<StatisticsParam>) {
@ -79,7 +78,7 @@ const LearningRecord: FC<Props> = ({userId, style, className}) => {
return (<View className={[styles.box, className].filter(Boolean).join(' ')} style={{display: 'block', ...style}}>
<Tabs tabList={tabList} onChange={tabChange} backMode/>
<View style={{position: "relative"}}>
<Spin enable={loading} block/>
{/*<Spin enable={loading} block/>*/}
<View className={styles.total}>
<Text style={{margin: '0 10px', color: '#00D6AC'}}>

@ -1,14 +1,12 @@
import Taro from "@tarojs/taro";
const KET = 'SELECT_DEP'
const KET_REQUIRED = 'SELECT_REQUIRED'
/** 部门 */
function set(data: number[]) {
Taro.setStorageSync(KET, data)
}
function get(): number[] {
const deps = Taro.getStorageSync(KET)
if (deps && deps.length) {
@ -23,28 +21,7 @@ function removeDeps() {
Taro.removeStorageSync(KET)
}
/** 必修选修 */
function removeRequired() {
Taro.removeStorageSync(KET_REQUIRED)
}
function setRequired(data: number[]) {
Taro.setStorageSync(KET_REQUIRED, data)
}
/** getRequired 比 set后调用 */
function getRequired(): (0 | 1)[] {
const deps = Taro.getStorageSync(KET_REQUIRED)
if (deps && deps.length) {
removeRequired()
return deps
}
return []
}
function remove() {
removeRequired()
removeDeps()
}
@ -52,6 +29,4 @@ export default {
set,
get,
remove,
setRequired,
getRequired
}

@ -57,17 +57,27 @@ const CourType: FC = () => {
})
return (
<View className='py-2 flex justify-between flex-wrap '>
{data.length > 0 ? data.map(c =>
<VideoCover
thumb={c.thumb}
title={c.title}
id={c.id}
depId={c.id}
key={c.id}
time={formatMinute(c.course_duration)}
/>) : <Empty name='暂无数据'/>}
</View>
<>
{
data.length > 0 ?
<>
<View className='py-2 flex justify-between flex-wrap'>
{
data.map(c => <VideoCover
thumb={c.thumb}
title={c.title}
id={c.id}
depId={c.id}
key={c.id}
time={formatMinute(c.course_duration)}
/>)
}
</View>
<View className='text-center font-24 text-dark'></View>
</>
: <Empty name='暂无数据'/>
}
</>
)
}

@ -106,6 +106,7 @@ const CurHistory = () => {
/>
</View>)
}
<View className='text-center font-24 text-dark mt-3'></View>
</View>
: <Empty name='暂无学习记录'/>
}

@ -1,7 +1,7 @@
import {Text, View} from "@tarojs/components";
import styles from './history.module.scss'
import Taro from "@tarojs/taro";
import {useEffect, useState} from "react";
import React, {useEffect, useState} from "react";
import {formatMinute} from "@/utils/time";
import Empty from "@/components/empty/empty";
import {userApi} from "@/api";
@ -27,21 +27,28 @@ const History = () => {
return (
<View className='mt-3'>
{data.length ? data.map((d, index) =>
<View key={index} className={styles.category} onClick={() => jump(d.userCourseRecord.course_id)}>
<View className={styles.thumb}>
<Img src={d.thumb} className={styles.image} width={300} height={188}/>
<View
className={styles.count}>{d.userCourseRecord.hour_count}/{d.userCourseRecord.finished_count}</View>
</View>
<View className={styles.text}>
<View>{d.title}</View>
<View className={styles.describe}>
<Text className='mr-4'>{formatMinute(durations[d.id])}</Text>
<Text>{(d.userCourseRecord.finished_count / d.userCourseRecord.hour_count * 100).toFixed(0)}%</Text>
</View>
</View>
</View>) : <Empty name='无观看记录'/>}
{
data.length ? <> {
data.map((d, index) =>
<View key={index} className={styles.category} onClick={() => jump(d.userCourseRecord.course_id)}>
<View className={styles.thumb}>
<Img src={d.thumb} className={styles.image} width={300} height={188}/>
<View
className={styles.count}>{d.userCourseRecord.hour_count}/{d.userCourseRecord.finished_count}</View>
</View>
<View className={styles.text}>
<View>{d.title}</View>
<View className={styles.describe}>
<Text className='mr-4'>{formatMinute(durations[d.id])}</Text>
<Text>{(d.userCourseRecord.finished_count / d.userCourseRecord.hour_count * 100).toFixed(0)}%</Text>
</View>
</View>
</View>)
}
<View className='text-center font-24 text-dark mt-3'></View>
</>
: <Empty name='无观看记录'/>
}
</View>
)
}

@ -1,12 +1,28 @@
import {FC, ReactNode, useEffect, useState} from "react";
import {Image, View} from "@tarojs/components";
import {HomeApi} from "@/api";
import {useReachBottom} from "@tarojs/taro";
import Taro, {useReachBottom} from "@tarojs/taro";
import styles from "../home.module.scss";
import VideoCover from "@/components/videoCover/videoCover";
import courseTag from '@/static/img/courseTag.png'
import {rfc33392time} from "@/utils/day";
import Img from "@/components/image/image";
import {beforeTime} from "@/utils/time";
const toArticlePage = (d: any) => {
console.log({d})
switch (d.owner_type) {
case 1:
Taro.navigateTo({
url: `/pages/preview/brand/article/article?id=${d.id}`
})
return
case 2:
Taro.navigateTo({
url: `/pages/preview/illness/article/article?id=${d.id}`
})
return
}
}
const CurRecommended: FC = () => {
const [page, setPage] = useState(1)
@ -44,15 +60,15 @@ const CurRecommended: FC = () => {
<View className="mb-5">
<View className='text-center my-2'></View>
<View className='bg-white rounded-20 clip'>
{articles.map((d, i) => <View className='p-3 relative'>
{i > 0 && <View className='absolute top left right divided ml-3 mr-3' />}
<View className="font-34 bold text-black">{d.title}</View>
{articles.map((d, i) => <View className='p-3 relative' onClick={() => toArticlePage(d)}>
{i > 0 && <View className='absolute top left right divided ml-3 mr-3'/>}
<View className="font-34 text-black">{d.title}</View>
{(d.intro || '').length > 40 && (<View className='flex mt-1'>
<View className="flex-1 font-24 lh1_5">{d.intro}</View>
{d.cover && <Img className='ml-l' width={140} height={100} src={d.cover} errorType="acquiesce" />}
<View className="flex-1 font-24 lh1_5">{d.intro}</View>
{d.cover && <Img className='ml-l' width={140} height={100} src={d.cover} errorType="acquiesce"/>}
</View>)}
<View className="flex mt-3 justify-between font-24 text-muted">
<View>{rfc33392time(d.created_at).split(' ')[0]}</View>
<View>{beforeTime(d.created_at)}</View>
<View> {d.page_view || 0}</View>
</View>
</View>)}
@ -86,7 +102,7 @@ const CurRecommended: FC = () => {
<>
{examines}
{videos}
<View className='text-center text-muted font-28'>- -</View>
<View className='text-center font-24 text-dark'></View>
</>
)
}

@ -1,4 +1,4 @@
import {FC, useEffect, useState} from "react";
import {FC, useState} from "react";
import {Image, View, Text} from "@tarojs/components";
import styles from "./home.module.scss";
import Adware from "@/pages/home/components/adware";
@ -27,14 +27,14 @@ const Home: FC = () => {
Taro.navigateTo({url: '/pages/login/login'})
}
useEffect(() => {
Taro.useDidShow(() => {
HomeApi.home().then(res => {
setData(res)
})
setTimeout(() => {
setEnable(false)
}, 600)
}, [])
})
Taro.usePageScroll((e) => {
const v = (Math.min(e.scrollTop / navbarHeight, 1) * 0.9).toFixed(6)

@ -5,7 +5,9 @@ import {VideoList} from "@/pages/index/components/videoList";
import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs";
import {CoursesKey, publicApi} from "@/api/public";
import NavigationBar from "@/components/navigationBar/navigationBar";
// import Taro from "@tarojs/taro";
import Spin from "@/components/spinner";
import Img from "@/components/image/image";
import {beforeTime} from "@/utils/time";
const category: TabList[] = [
{title: "企选课程", value: 'is_required'},
@ -37,26 +39,38 @@ const Index: FC = () => {
const AuditMode: FC = () => {
const [auditMode, setAuditMode] = useState(false)
const [articles, setArticles] = useState<any[]>([])
const [enable, setEnable] = useState(true)
useEffect(() => {
publicApi.course({page: 1, pageSize: 10}).then(res => {
setAuditMode(res.audit_mode)
setArticles(res.articles)
// if(res.audit_mode){
// Taro.setTabBarItem({index: 1, text: '文章'})
// }
setEnable(false)
})
}, [])
return (
<>
<Spin enable={enable} overlay/>
{
auditMode ?
<>
<NavigationBar text='文章' cancelBack/>
<View className='p-2'>
<NavigationBar text='文章列表' cancelBack/>
<View className='bg-white rounded-20 clip'>
{
articles.map(d => <View className='mb-2 p-2 bg-white'>{d.title}</View>)
articles.map((d, i) => <View className='p-3 relative'>
{i > 0 && <View className='absolute top left right divided ml-3 mr-3'/>}
<View className="font-34 bold text-black">{d.title}</View>
{(d.intro || '').length > 40 && (<View className='flex mt-1'>
<View className="flex-1 font-24 lh1_5">{d.intro}</View>
{d.cover && <Img className='ml-l' width={140} height={100} src={d.cover} errorType="acquiesce"/>}
</View>)}
<View className="flex mt-3 justify-between font-24 text-muted">
<View>{beforeTime(d.created_at)}</View>
<View> {d.page_view || 0}</View>
</View>
</View>)
}
</View>
<View className='text-center font-24 text-dark mt-2'></View>
</>
: <Index/>
}

@ -57,10 +57,8 @@ const Login: FC = () => {
setToken(token)
setCompany(company)
setLoading(false)
Taro.switchTab({url: '/pages/home/home'})
Taro.navigateBack()
} else {
Taro.setStorageSync('openid', catch_key)
Taro.reLaunch({url: '/pages/check/check'})
}
@ -98,7 +96,6 @@ const Login: FC = () => {
<View style={{flex: 1}}>{error}</View>
<Icon name={'close'} onClick={() => setError(null)}/>
</View> : null}
{/*{process.env.TARO_APP_LGOIN === 'true' && <MyButton onClick={TESTLOGIN}>线下登录</MyButton>}*/}
</View>
)

@ -17,6 +17,7 @@ export const Search: FC<Props> = ({param, setParam}) => {
const [show, setShow] = useState(false)
const [deps, setDeps] = useState<Manage[]>([])
const [depId, setDepId] = useState<number>(param.dep_id)
const [title, setTitle] = useState(param.title)
async function getDepList() {
try {
@ -53,19 +54,21 @@ export const Search: FC<Props> = ({param, setParam}) => {
<>
<View className={styles.searchBox}>
<View className={styles.searchInput}>
<Icon name='search' size={18}/>
<Icon name='search' size={18} color='#909795'/>
<Input
adjustPosition={false}
type='text'
confirmType='search'
placeholder='搜索名称'
placeholder='搜索课程名称'
className='ml-1 flex-1'
value={param.title}
value={title}
onInput={(e) => setTitle(e.detail.value)}
onConfirm={(e) => setParam({
...param,
title: e.detail.value,
page: 1
})}/>
})}
/>
</View>
<View onClick={() => setShow(true)}>
<Text></Text>
@ -99,7 +102,7 @@ export const Search: FC<Props> = ({param, setParam}) => {
</View>)
}
<View className='flex justify-around mt-2'>
<View className='flex justify-around mt-2 align-center'>
<View onClick={() => setShow(false)}>
<MyButton type='default' fillet width={150}></MyButton>
</View>

@ -3,6 +3,9 @@
padding: 24rpx 30rpx;
display: flex;
justify-content: space-between;
position: sticky;
top: 0;
border-bottom: 1px solid #F5F8F7;
}
.searchInput {
@ -13,7 +16,6 @@
padding-left: 24rpx;
background: #F5F8F7;
border-radius: 32rpx;
color: #909795;
overflow: hidden;
}
@ -65,7 +67,7 @@
}
.curList {
padding-bottom: 100px;
padding-bottom: calc(env(safe-area-inset-bottom) + 63rpx);
}
.add {
@ -83,4 +85,6 @@
display: flex;
justify-content: space-between;
padding: 30rpx;
align-items: center;
box-sizing: border-box;
}

@ -124,13 +124,12 @@ const CourseAdmin: FC = () => {
Taro.useDidShow(useCallback(async () => {
const dep_id = storageDep.get()
const is_required = storageDep.getRequired()
if (!dep_id.length || !is_required.length || !curs.length) return;
if (!dep_id.length || !curs.length) return;
try {
await ManageApi.addCur({course_id: curs, dep_id, is_required})
await ManageApi.addCur({course_id: curs, dep_id})
Taro.showToast({title: '修改成功'})
// deps 中没有 筛选条件中的depid 删除已选的课程
if (param.dep_id && dep_id.includes(param.dep_id)) {
@ -151,15 +150,15 @@ const CourseAdmin: FC = () => {
return (
<View>
<Spin enable={enable} overlay/>
<>
<Search param={param} setParam={setParam}/>
<Spin enable={enable} overlay/>
<View className={styles.curList}>
{
data?.map((d, index) => <View key={d.id} className={styles.curBox}>
<View className={styles.curTitle} onClick={() => addCurs(d.id)}>
{batch && <Radio
color='#45D4A8'
checked={curs.includes(d.id)}
style={{marginTop: '30px'}}
onClick={() => addCurs(d.id)}/>}
@ -172,6 +171,7 @@ const CourseAdmin: FC = () => {
</View>
</View>)
}
<View className='text-center font-24 text-dark mt-3'></View>
</View>
<View className={styles.add}>
@ -182,13 +182,13 @@ const CourseAdmin: FC = () => {
}
{
batch && <View className={styles.addBatch}>
<Radio onClick={all} checked={data.length === curs.length}> </Radio>
<Radio onClick={all} checked={data.length === curs.length} color='#45D4A8'> </Radio>
<Text onClick={() => setBatch(false)}></Text>
<MyButton size='mini' onClick={() => batchChangDep(curs)}>{curs.length}</MyButton>
</View>
}
</View>
</View>
</>
)
}

@ -158,6 +158,7 @@ const DepAdmin: FC = () => {
onClick={() => Taro.navigateTo({url: '/pages/manage/userInfo/userInfo?userId=' + d.id})}
content={['学员', '管理员', '超级管理员'][d.role_type]}
/>)}
<View className='text-center font-24 text-dark mt-3'></View>
{!manages.length && !users.length && <Empty name='暂无数据'/>}

@ -1,5 +1,5 @@
import React, {FC, useCallback, useEffect, useState} from "react";
import {Checkbox, Switch, View} from "@tarojs/components";
import {Checkbox, View} from "@tarojs/components";
import Taro from "@tarojs/taro";
import {curriculum} from "@/api";
import PopPut from "@/components/popPut/popPut";
@ -13,10 +13,9 @@ import Spin from "@/components/spinner";
* required
*/
const SelectDep: FC = () => {
const params = Taro.getCurrentInstance()?.router?.params as { depIds: string, required: string | undefined }
const params = Taro.getCurrentInstance()?.router?.params as { depIds: string}
const [ids, setIds] = useState<number[]>([])
const [deps, setDeps] = useState<Manage[]>([])
const [required, setRequired] = useState<number[]>([])
const [enable, setEnable] = useState(true)
useEffect(() => {
@ -25,7 +24,6 @@ const SelectDep: FC = () => {
})
setEnable(false)
setIds(JSON.parse(params.depIds))
setRequired(JSON.parse(params.required || "[]"))
}, [])
const onChange = useCallback((id: number) => {
@ -35,51 +33,19 @@ const SelectDep: FC = () => {
...ids,
id
])
if (params.required) {
setRequired([...required, 0])
}
} else {
const oldIds: number[] = JSON.parse(JSON.stringify(ids))
oldIds.splice(index, 1)
setIds(oldIds)
if (params.required) {
const oldRequired: number[] = JSON.parse(JSON.stringify(required))
oldRequired.splice(index, 1)
setRequired(oldRequired)
}
}
}, [ids])
function ok() {
storageDep.set(ids)
storageDep.setRequired(required)
Taro.navigateBack({delta: 1})
}
function isRequired(dep_id: number): boolean {
const index = ids.indexOf(dep_id)
if (index === -1) {
return false
} else {
return !!required?.[index]
}
}
function requiredChange(dep_id: number, value: boolean) {
const index = ids.indexOf(dep_id)
if (index === -1) {
setIds([...ids, dep_id])
setRequired([...required, value ? 1 : 0])
} else {
const oldRequired: number[] = JSON.parse(JSON.stringify(required))
oldRequired.splice(index, 1, value ? 1 : 0)
setRequired(oldRequired)
}
}
return (
<View className='px-2 bg-white'>
<Spin overlay enable={enable}/>
@ -90,21 +56,10 @@ const SelectDep: FC = () => {
key={d.id}
title={d.name}
chevron
leftImage={folder}
content={
params?.required ?
<View className='flex align-center'>
<Switch
color='#45d4a8'
onClick={() => event?.stopImmediatePropagation()}
checked={isRequired(d.id)}
onChange={(e) => requiredChange(d.id, e.detail.value)}/>
</View>
: null
}
/>
leftImage={folder}/>
</View>
</View>)}
<View className='text-center font-24 text-dark mt-3'></View>
<View className={'my-3'}>
<MyButton onClick={ok}></MyButton>

@ -58,7 +58,6 @@ const UserInfo: FC = () => {
useEffect(() => {
userApi.info(userId).then(res => {
setData(res)
})
@ -76,7 +75,7 @@ const UserInfo: FC = () => {
<View className={styles.page}>
<Info data={data}/>
<LearningRecord userId={userId}/>
<LearningRecord userId={userId} style={{padding: '20px'}}/>
<View className='mt-2'>

@ -1,30 +1,33 @@
.fixedBox{
.fixedBox {
position: fixed;
z-index: 1000;
top:0;
top: 0;
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{
&-inner {
position: absolute;
width: 100vw;
top:45vh;
top: 45vh;
display: flex;
flex-direction: column;
align-items: center;
&-icon{
image{
&-icon {
image {
width: 32rpx;
height: 32rpx;
}
}
&-box{
&-box {
margin-top: 24rpx;
width: 680rpx;
left:35rpx;
left: 35rpx;
height: 76rpx;
background-color: #45D4A8;
color:#fff;
color: #fff;
line-height: 76rpx;
text-align: center;
font-size: 32rpx;
@ -34,3 +37,18 @@
}
}
.article {
font-size: 30rpx;
display: flex;
margin-bottom: 40rpx;
}
.articleImag {
border-radius: 100rpx;
}
.articleTitle {
font-size: 40rpx;
margin-bottom: 50rpx;
}

@ -2,12 +2,14 @@ import {FC, useCallback, useEffect, useMemo, useState} from "react";
import {Image, Text, View} from "@tarojs/components";
import Taro, {useRouter} from "@tarojs/taro";
import {ArticleRecord, brandApi} from "@/api";
import styles from "@/pages/preview/illness/article/article.module.scss";
import styles from "./article.module.scss";
import down from "@/static/img/doubleDown.png";
import {Profile} from "@/store";
import {parse} from "@/utils/marked/marked";
import Empty from "@/components/empty/empty";
import Spin from "@/components/spinner";
import {beforeTime} from "@/utils/time";
import Img from "@/components/image/image";
const article: FC = () => {
@ -25,8 +27,8 @@ const article: FC = () => {
const query = Taro.createSelectorQuery()
query.select('#childrenNode').boundingClientRect((res) => {
if (!Array.isArray(res)) {
console.log({childrenNode: res})
setUltra(pageHeight * .45 <= res.height)
console.log({childrenNode: res})
setUltra(pageHeight * .45 <= res.height)
}
}).exec()
}, 300)
@ -59,8 +61,25 @@ const article: FC = () => {
overflow: !token ? 'hidden' : 'auto'
}}>
<View id="childrenNode">
<View className={styles.articleTitle}>{articleInfo?.title}</View>
{
children.length > 0 ? children : <Empty name='暂无数据'/>
children.length > 0 ?
<View>
{
articleInfo?.brands.map(d => <View className={styles.article}>
<Img src={d.logo} width={80} height={80} className={styles.articleImag}/>
<View className='ml-2'>
<View>{d?.name}</View>
<View className='flex mt-1 text-muted font-24'>
<View className='mr-2'>{beforeTime(articleInfo?.created_at)} . </View>
<View> {articleInfo.page_view || 1}</View>
</View>
</View>
</View>)
}
{children}
</View>
: <Empty name='暂无数据'/>
}
</View>
</View>
@ -71,9 +90,8 @@ const article: FC = () => {
<View className={styles['fixedBox-inner-icon']}>
<Image src={down}/>
</View>
<View className={styles['fixedBox-inner-box']} onClick={() => {
Taro.navigateTo({url: '/pages/login/login'})
}}>
<View className={styles['fixedBox-inner-box']}
onClick={() => Taro.navigateTo({url: '/pages/login/login'})}>
<Text></Text>
</View>
</View>

@ -113,11 +113,9 @@ const BrandInfo: FC = () => {
</View>
<View className={styles['bottom']}>
{
articleList?.length ?
articleList.map((i: any) =>
<View className={styles.box} onClick={() => {
Taro.navigateTo({url: `/pages/preview/brand/article/article?id=${i.id}`})
}}>
articleList?.length ? <>{
articleList.map((i: any) => <View className={styles.box}
onClick={() => Taro.navigateTo({url: `/pages/preview/brand/article/article?id=${i.id}`})}>
<View className={styles.inner}>
<View className={styles.leftBox}>
<View className='font-weight mb-2 font-28 lh-40'>{i.title}</View>
@ -127,8 +125,9 @@ const BrandInfo: FC = () => {
<Img width={172} height={128} src={i.cover}/>
</View>
</View>
</View>
)
</View>)}
<View className='text-center font-24 text-dark'></View>
</>
: <Empty name='空空如也'/>
}
</View>

@ -5,7 +5,7 @@ import Taro, {useReachBottom} from "@tarojs/taro";
import Empty from "@/components/empty/empty";
import Spinner from "@/components/spinner";
import Img from "@/components/image/image";
import {formatDate} from "@/utils/time";
import {beforeTime} from "@/utils/time";
const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onClick}) => {
let media: ReactNode
@ -16,7 +16,7 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl
/>
} else if (data.brand_album) {
media = <Img
width={712}
// width={712}
height={320}
src={data.brand_album.split(",")[0]}
mode="aspectFill"
@ -27,26 +27,32 @@ const BrandItem: FC<{ data: BrandRecord; onClick: VoidFunction }> = ({data, onCl
return (
<View className="bg-white flex flex-column justify-stretch mb-2_4 rounded-10 clip">
{media}
<View className="p-3" onClick={onClick}>
<View className='font-weight mb-2 font-32 flex align-center'>
<View className='mb-2 font-32 flex'>
<Img
width={32}
height={32}
width={76}
height={76}
src={data.logo}
mode='aspectFill'
errorType='avatar'
className="rounded-10 clip"
style={{background: '#ededed'}}
/>
<View className="ml-1 flex-1">
<View className="ml-2 flex-1">
<View className="text-row1 font-28">{data.name}</View>
<View className='font-24 mt-1 text-dark'>{beforeTime(data.created_at)}·</View>
</View>
</View>
<View className="font-24 text-muted mb-4 text-row3" style={{lineHeight: 1.4}}>
<View>
{media}
</View>
<View className="font-24 text-muted mb-4 text-row3 mt-2" style={{lineHeight: 1.4}}>
{data.graphic_introduction}
</View>
<View className="flex gap20rpx font-24 text-muted">
<View>{formatDate(new Date(data.created_at), "YY-MM-dd hh:mm:ss")}</View>
<View className="flex-1"></View>
<View>{data.article_count || 0}</View>
<View>{(Math.random() * 100).toFixed(0)}</View>
@ -105,7 +111,7 @@ const BrandList: FC = () => {
content = (
<>
{brands.map(d => <BrandItem data={d} key={d.id} onClick={() => jumpInfo(d.id)}/>)}
<View style={{width: '710rpx', textAlign: 'center', color: '#999'}} className="font-28 mt-3">{text}</View>
<View className='text-center font-24 text-dark mt-3'>{text}</View>
</>
)
} else {

@ -55,7 +55,7 @@ const Health: FC = () => {
</View>
</View>)}
</View>
<View className="font-28 mt-3 text-center text-muted"></View>
<View className='text-center font-24 text-dark mt-2'></View>
</>
: <Empty name='暂无数据'/>
}

@ -1,4 +1,4 @@
.botmBox{
.botmBox {
z-index: 99;
position: fixed;
bottom: 0;
@ -10,7 +10,8 @@
justify-content: center;
align-items: center;
background: #F5F8F7;
view{
view {
width: 560rpx;
height: 76rpx;
background: #45D4A8;
@ -22,33 +23,37 @@
line-height: 76rpx;
}
}
.fixedBox{
.fixedBox {
position: fixed;
z-index: 100;
top:0;
top: 0;
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{
&-inner {
position: absolute;
width: 100vw;
top:45vh;
top: 45vh;
display: flex;
flex-direction: column;
align-items: center;
&-icon{
image{
&-icon {
image {
width: 32rpx;
height: 32rpx;
}
}
&-box{
&-box {
margin-top: 24rpx;
width: 680rpx;
left:35rpx;
left: 35rpx;
height: 76rpx;
background-color: #45D4A8;
color:#fff;
color: #fff;
line-height: 76rpx;
text-align: center;
font-size: 32rpx;
@ -58,3 +63,19 @@
}
}
.article {
font-size: 30rpx;
display: flex;
margin-bottom: 40rpx;
}
.articleImag {
border-radius: 100rpx;
}
.articleTitle {
font-size: 40rpx;
margin-bottom: 50rpx;
}

@ -6,7 +6,8 @@ import styles from './article.module.scss'
import down from '@/static/img/doubleDown.png'
import {Profile} from "@/store";
import {parse} from "@/utils/marked/marked";
import {formatDate} from "@/utils/time";
import {beforeTime} from "@/utils/time";
import Img from "@/components/image/image";
const article: FC = () => {
const {token} = Profile.useContainer()
@ -58,9 +59,20 @@ const article: FC = () => {
height: !token ? Taro.getWindowInfo().windowHeight - 60 + 'px' : 'auto',
overflow: !token ? 'hidden' : 'auto'
}}>
<View className='text-center'>
<View className='font-50 font-weight '>{articleInfo?.title}</View>
<View className='mt-2'>{formatDate(new Date(articleInfo?.created_at || 0), "YY-mm-dd hh:mm:dd")}</View>
<View>
<View className={styles.articleTitle}>{articleInfo?.title}</View>
{
articleInfo?.brands.map(d => <View className={styles.article}>
<Img src={d.logo} width={80} height={80} className={styles.articleImag} errorType="avatar"/>
<View className='ml-2'>
<View>{d?.name}</View>
<View className='flex mt-1 text-muted font-24'>
<View className='mr-2'>{beforeTime(articleInfo?.created_at)} . </View>
<View> {articleInfo.page_view || 1}</View>
</View>
</View>
</View>)
}
</View>
<View></View>
{children}
@ -93,11 +105,9 @@ const article: FC = () => {
}
</View>
</PageContainer>
</>
)
}
return helloWorld()
}
export default article

@ -50,13 +50,16 @@ const BrandList: FC = () => {
<Spin enable={enable} overlay/>
{
articles.length > 0 ?
<View className='bg-white'>
{
articles.map((d, index) => <View key={d.id} className={styles.articles} onClick={() => jump(d.id)}>
{index + 1} . {d.title}
</View>)
}
</View>
<>
<View className='bg-white'>
{
articles.map((d, index) => <View key={d.id} className={styles.articles} onClick={() => jump(d.id)}>
{index + 1} . {d.title}
</View>)
}
</View>
<View className='text-center font-24 text-dark mt-3'></View>
</>
: <Empty name='暂无文章'/>
}
</View>

@ -58,6 +58,7 @@
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #323635;
position: relative;
}
.list {

@ -96,14 +96,14 @@ const Sort: FC = () => {
scrollY
className={styles.tree}
scrollWithAnimation>
<Spin enable={loading} block/>
{
loading ? <Spin enable={loading}/> : <>
{
list.length ?
list.map(d => <View className={styles.list} onClick={() => jump(d.id)}>{d.name}</View>)
: <Empty name='暂无数据'/>
}
</>
list.length ?
<>
{list.map(d => <View className={styles.list} onClick={() => jump(d.id)}>{d.name}</View>)}
<View className='text-center font-24 text-dark mt-3'></View>
</>
: <Empty name='暂无数据'/>
}
</ScrollView>
</View>

@ -104,6 +104,7 @@ const Profession = () => {
</View>
)
}
<View className='text-center font-24 text-dark mt-2'></View>
</ScrollView>
)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

@ -147,3 +147,21 @@ export function everyDay(start_time: number, end_time: number, data: Record<numb
return []
}
}
/** 时间前 */
export function beforeTime(time?: string): string {
const initiateTime = new Date(time || 0).getTime()
const today = Date.now()
const timeDifference = Math.floor((today - initiateTime) / 86400000)
if (timeDifference <= 0) {
return '今天'
} else if (timeDifference >= 365) {
return `${Math.floor(timeDifference / 365)}年前`
} else if (timeDifference >= 31) {
return `${Math.floor(timeDifference / 31)}月前`
} else if (timeDifference >= 7) {
return `${Math.floor(timeDifference / 7)}星期前`
} else {
return `${timeDifference}天前`
}
}

Loading…
Cancel
Save