@x-edu/live-player 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-edu/live-player",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "main": "dist/XEduLivePlayer.common.js",
5
5
  "scripts": {
6
6
  "start": "cross-env SDP_ENV=local gms dev",
@@ -1,119 +1,119 @@
1
- import React, { useEffect, useState } from 'react'
2
- import dayjs from 'dayjs'
3
- import classNames from 'classnames'
4
- import Avatar from '@/component/Avatar'
5
- import Icon from '@/component/Icon'
6
- import Action from './Action'
7
- import { formatLikesCount, formatUVCount } from '@/util/liveCountUtil'
8
- import { getResourceLikes } from '@/service/like'
9
- import DefaultCover from './img/live.png'
10
- import PlayImg from './img/play.svg'
11
- import dianZan from './img/dianzan.svg'
12
- import yiYue from './img/yiguankan.svg'
13
- import style from './index.module.less'
14
-
15
- const TagName = {
16
- 0: '预告',
17
- 1: '直播中',
18
- 2: '回放',
19
- 3: '直播中' // 实际是暂停
20
- }
21
-
22
- export default function ListItem({
23
- data,
24
- subscription,
25
- onDetailClick,
26
- handleLogin,
27
- isLogin,
28
- onSubscribe
29
- }) {
30
- const {
31
- live_id: liveId,
32
- live_name: liveName,
33
- begin_time: beginTime,
34
- end_time: endTime,
35
- cover_url: coverUrl,
36
- status
37
- } = data
38
-
39
- const [liveExt, setLiveExt] = useState({})
40
- useEffect(() => {
41
- (async () => {
42
- const res = await getResourceLikes(liveId)
43
- setLiveExt(res || {})
44
- })()
45
- }, [])
46
-
47
- const handleDetailClick = async () => {
48
- if (data.login && !isLogin) {
49
- handleLogin(data)
50
- return
51
- }
52
- if (onDetailClick) {
53
- onDetailClick(data)
54
- } else {
55
- // 默认跳转中小学
56
- window.open(`https://basic.smartedu.cn/publicLive/${liveId}}`)
57
- }
58
- }
59
-
60
- return (
61
- <div
62
- className={style.container}
63
- onClick={handleDetailClick}
64
- >
65
- <div className={style.left}>
66
- <Avatar
67
- src={coverUrl || DefaultCover}
68
- errorImg={DefaultCover}
69
- className={style.avatar}
70
- />
71
- <div className={classNames(style.tag, style[`tag${status}`])}>
72
- {status === 1 || status === 3 ? <img src={PlayImg} alt="" /> : null}
73
- {TagName[status]}
74
- </div>
75
- </div>
76
- <div className={style.right}>
77
- <div className={style['right-top']}>
78
- <div className={style.title}>{liveName}</div>
79
- </div>
80
- <div className={style['right-bottom']}>
81
- <div className={style.time}>
82
- <Icon type="web_icon_shijian_fill" className={style['time-icon']} />
83
- {status === 2 ? (
84
- <>
85
- {`${dayjs(beginTime).format('YYYY/MM/DD HH:mm')}-${dayjs(endTime).format('HH:mm')}`}
86
- </>
87
- ) : (
88
- <>
89
- {dayjs(beginTime).format('YYYY/MM/DD HH:mm')}
90
- 开始
91
- </>
92
- )}
93
-
94
- <div className={style.like_sty}>
95
- <div className={style.icon_bottom}>
96
- <img src={yiYue} />
97
- {formatUVCount(liveExt.total_uv || 0)}
98
- </div>
99
- <div className={style.icon_bottom}>
100
- <img src={dianZan} alt="" />
101
- {formatLikesCount(liveExt.like_count || 0)}
102
- </div>
103
- </div>
104
- </div>
105
- <div>
106
- <Action
107
- data={data}
108
- subscription={subscription}
109
- onActionDetailClick={handleDetailClick}
110
- handleLogin={handleLogin}
111
- isLogin={isLogin}
112
- onSubscribe={onSubscribe}
113
- />
114
- </div>
115
- </div>
116
- </div>
117
- </div>
118
- )
119
- }
1
+ import React, { useEffect, useState } from 'react'
2
+ import dayjs from 'dayjs'
3
+ import classNames from 'classnames'
4
+ import Avatar from '@/component/Avatar'
5
+ import Icon from '@/component/Icon'
6
+ import Action from './Action'
7
+ import { formatLikesCount, formatUVCount } from '@/util/liveCountUtil'
8
+ import { getResourceLikes } from '@/service/like'
9
+ import DefaultCover from './img/live.png'
10
+ import PlayImg from './img/play.svg'
11
+ import dianZan from './img/dianzan.svg'
12
+ import yiYue from './img/yiguankan.svg'
13
+ import style from './index.module.less'
14
+
15
+ const TagName = {
16
+ 0: '预告',
17
+ 1: '直播中',
18
+ 2: '回放',
19
+ 3: '直播中' // 实际是暂停
20
+ }
21
+
22
+ export default function ListItem({
23
+ data,
24
+ subscription,
25
+ onDetailClick,
26
+ handleLogin,
27
+ isLogin,
28
+ onSubscribe
29
+ }) {
30
+ const {
31
+ live_id: liveId,
32
+ live_name: liveName,
33
+ begin_time: beginTime,
34
+ end_time: endTime,
35
+ cover_url: coverUrl,
36
+ status
37
+ } = data
38
+
39
+ const [liveExt, setLiveExt] = useState({})
40
+ useEffect(() => {
41
+ (async () => {
42
+ const res = await getResourceLikes(liveId)
43
+ setLiveExt(res || {})
44
+ })()
45
+ }, [])
46
+
47
+ const handleDetailClick = async () => {
48
+ if (data.login && !isLogin) {
49
+ handleLogin(data)
50
+ return
51
+ }
52
+ if (onDetailClick) {
53
+ onDetailClick(data)
54
+ } else {
55
+ // 默认跳转中小学
56
+ window.open(`https://basic.smartedu.cn/publicLive/${liveId}}`)
57
+ }
58
+ }
59
+
60
+ return (
61
+ <div
62
+ className={style.container}
63
+ onClick={handleDetailClick}
64
+ >
65
+ <div className={style.left}>
66
+ <Avatar
67
+ src={coverUrl || DefaultCover}
68
+ errorImg={DefaultCover}
69
+ className={style.avatar}
70
+ />
71
+ <div className={classNames(style.tag, style[`tag${status}`])}>
72
+ {status === 1 || status === 3 ? <img src={PlayImg} alt="" /> : null}
73
+ {TagName[status]}
74
+ </div>
75
+ </div>
76
+ <div className={style.right}>
77
+ <div className={style['right-top']}>
78
+ <div className={style.title}>{liveName}</div>
79
+ </div>
80
+ <div className={style['right-bottom']}>
81
+ <div className={style.time}>
82
+ <Icon type="web_icon_shijian_fill" className={style['time-icon']} />
83
+ {status === 2 ? (
84
+ <>
85
+ {`${dayjs(beginTime).format('YYYY/MM/DD HH:mm')}-${dayjs(endTime).format('HH:mm')}`}
86
+ </>
87
+ ) : (
88
+ <>
89
+ {dayjs(beginTime).format('YYYY/MM/DD HH:mm')}
90
+ 开始
91
+ </>
92
+ )}
93
+
94
+ <div className={style.like_sty}>
95
+ <div className={style.icon_bottom}>
96
+ <img src={yiYue} />
97
+ {formatUVCount(liveExt.total_uv || 0)}
98
+ </div>
99
+ <div className={style.icon_bottom}>
100
+ <img src={dianZan} alt="" />
101
+ {formatLikesCount(liveExt.like_count || 0)}
102
+ </div>
103
+ </div>
104
+ </div>
105
+ <div>
106
+ <Action
107
+ data={data}
108
+ subscription={subscription}
109
+ onActionDetailClick={handleDetailClick}
110
+ handleLogin={handleLogin}
111
+ isLogin={isLogin}
112
+ onSubscribe={onSubscribe}
113
+ />
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ )
119
+ }
@@ -95,23 +95,25 @@
95
95
  }
96
96
  }
97
97
  .like_sty {
98
- color: rgba(204, 204, 204, 1);
98
+ color: #999;
99
99
  display: flex;
100
100
  align-items: center;
101
101
  margin-left: 40px;
102
102
  .icon_bottom {
103
103
  margin-right: 30px;
104
+ //styleName: web正文-常规14px;
104
105
  font-family: PingFang SC;
105
- font-size: 12px;
106
+ font-size: 14px;
106
107
  font-weight: 400;
108
+ line-height: 22px;
107
109
  letter-spacing: 0px;
108
110
  text-align: left;
109
111
  display: flex;
110
112
  align-items: center;
111
113
 
112
114
  img {
113
- width: 14px;
114
- height: 14px;
115
+ width: 16px;
116
+ height: 16px;
115
117
  margin-right: 5px;
116
118
  color: rgba(204, 204, 204, 1);
117
119
  }