live-h5-audience 2.0.13 → 4.1.0
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/README.md +89 -173
- package/dist/index.css +81 -0
- package/dist/index.esm.js +3167 -0
- package/dist/index.umd.js +3176 -0
- package/package.json +29 -60
- package/dist/live-h5-audience.common.js +0 -10750
- package/dist/live-h5-audience.css +0 -31
- package/dist/static/fonts/element-icons.2fad952a.woff +0 -0
- package/dist/static/fonts/element-icons.6f0a7632.ttf +0 -0
- package/dist/static/img/101.4a3f982f.png +0 -0
- package/dist/static/img/103.ca403801.png +0 -0
- package/dist/static/img/Lark.7987e873.png +0 -0
- package/dist/static/img/backytwo.0bb0fa02.png +0 -0
- package/dist/static/img/bag.9bd1c8bb.png +0 -0
- package/dist/static/img/check.742fd216.svg +0 -1
- package/dist/static/img/close.1bdba43a.png +0 -0
- package/dist/static/img/couponbg.ff40c5a6.png +0 -0
- package/dist/static/img/dashboard.28a2a850.svg +0 -1
- package/dist/static/img/defultephoto.846f7985.png +0 -0
- package/dist/static/img/delete.85820e02.svg +0 -1
- package/dist/static/img/endbag.22de7519.png +0 -0
- package/dist/static/img/example.894f4689.svg +0 -1
- package/dist/static/img/eye-open.26bf09f4.svg +0 -1
- package/dist/static/img/eye.e4fe315c.svg +0 -1
- package/dist/static/img/form.f3ed6fee.svg +0 -1
- package/dist/static/img/gift.946c1aa9.png +0 -0
- package/dist/static/img/kl.f0d4ef53.png +0 -0
- package/dist/static/img/lemon2.045418e0.png +0 -0
- package/dist/static/img/link.9c719b73.svg +0 -1
- package/dist/static/img/nested.c948fb38.svg +0 -1
- package/dist/static/img/noData.f2e140b3.png +0 -0
- package/dist/static/img/notStart.f7d9f489.png +0 -0
- package/dist/static/img/overdue.65960b51.png +0 -0
- package/dist/static/img/password.d4f0f275.svg +0 -1
- package/dist/static/img/phone.5641c174.svg +0 -1
- package/dist/static/img/product.c86c65fd.png +0 -0
- package/dist/static/img/redbag.bd36700b.png +0 -0
- package/dist/static/img/stop.ffb3b9d5.png +0 -0
- package/dist/static/img/table.fe7671a5.svg +0 -1
- package/dist/static/img/tree.59ecebc1.svg +0 -1
- package/dist/static/img/user.caeddd9e.svg +0 -1
- package/dist/static/img/xl.5d59c9a0.png +0 -0
- package/dist/static/img/yanzheng.5e7a84f8.svg +0 -1
package/README.md
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
# live-h5-audience
|
|
2
2
|
|
|
3
|
-
直播 H5 观众端完整应用 npm 包 -
|
|
3
|
+
直播 H5 观众端完整应用 npm 包 - v4.0.0
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 功能特性
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- 📦 商品展示
|
|
14
|
-
- 🎯 讲师详情
|
|
7
|
+
- 🎥 直播间功能:视频播放、聊天互动、礼物打赏
|
|
8
|
+
- 📋 房间列表:展示所有可用直播房间
|
|
9
|
+
- 💬 聊天室:实时弹幕和评论
|
|
10
|
+
- 🎁 礼物系统:支持多种礼物打赏
|
|
11
|
+
- 🔴 红包功能:红包互动
|
|
12
|
+
- 👤 个人中心:用户信息管理
|
|
15
13
|
|
|
16
14
|
## 安装
|
|
17
15
|
|
|
@@ -19,217 +17,135 @@
|
|
|
19
17
|
npm install live-h5-audience
|
|
20
18
|
```
|
|
21
19
|
|
|
22
|
-
##
|
|
23
|
-
|
|
24
|
-
### 方式一:独立挂载(推荐)
|
|
25
|
-
|
|
26
|
-
在你的项目中创建一个容器,然后挂载整个应用:
|
|
20
|
+
## 依赖要求
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<div>
|
|
31
|
-
<div id="live-h5-app"></div>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
22
|
+
使用此包前,你的项目需要安装以下依赖:
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
mounted() {
|
|
40
|
-
// 初始化并挂载直播 H5 应用
|
|
41
|
-
const { vm, router, store } = initLiveH5App(this.$root.constructor, {
|
|
42
|
-
containerId: '#live-h5-app',
|
|
43
|
-
apiBaseUrl: 'https://your-api-domain.com/api'
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
// 可以访问实例
|
|
47
|
-
this.liveH5App = vm
|
|
48
|
-
this.liveH5Router = router
|
|
49
|
-
this.liveH5Store = store
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
beforeDestroy() {
|
|
53
|
-
// 清理资源
|
|
54
|
-
if (this.liveH5App) {
|
|
55
|
-
this.liveH5App.$destroy()
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
</script>
|
|
24
|
+
```bash
|
|
25
|
+
npm install vue@^2.6.0 vue-router@^3.0.0 vuex@^3.0.0 vant@^2.5.0 element-ui@^2.7.0 vue-bus@^1.2.1
|
|
60
26
|
```
|
|
61
27
|
|
|
62
|
-
|
|
28
|
+
## 快速开始
|
|
63
29
|
|
|
64
|
-
|
|
30
|
+
### 方式一:插件模式(推荐)
|
|
65
31
|
|
|
66
32
|
```javascript
|
|
33
|
+
// main.js
|
|
67
34
|
import Vue from 'vue'
|
|
68
|
-
import LiveH5 from 'live-h5-audience'
|
|
69
35
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// 自定义配置
|
|
75
|
-
config: {
|
|
76
|
-
// 你的配置项
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
```
|
|
36
|
+
// 1. 安装 Vant
|
|
37
|
+
import Vant from 'vant'
|
|
38
|
+
import 'vant/lib/index.css'
|
|
39
|
+
Vue.use(Vant)
|
|
80
40
|
|
|
81
|
-
|
|
41
|
+
// 2. 安装 ElementUI
|
|
42
|
+
import ElementUI from 'element-ui'
|
|
43
|
+
import 'element-ui/lib/theme-chalk/index.css'
|
|
44
|
+
Vue.use(ElementUI)
|
|
82
45
|
|
|
83
|
-
|
|
46
|
+
// 3. 安装 VueBus
|
|
47
|
+
import VueBus from 'vue-bus'
|
|
48
|
+
Vue.use(VueBus)
|
|
84
49
|
|
|
85
|
-
|
|
86
|
-
import
|
|
87
|
-
import
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
const yourRouter = new VueRouter({
|
|
92
|
-
routes: [
|
|
93
|
-
// 你的路由
|
|
94
|
-
...router.options.routes
|
|
95
|
-
]
|
|
50
|
+
// 4. 引入 Live H5
|
|
51
|
+
import LiveH5 from 'live-h5-audience'
|
|
52
|
+
import 'live-h5-audience/dist/index.css'
|
|
53
|
+
Vue.use(LiveH5, {
|
|
54
|
+
apiBaseUrl: 'https://api.example.com', // API 基础地址
|
|
55
|
+
defaultRoute: '/roomList' // 默认路由
|
|
96
56
|
})
|
|
97
57
|
|
|
98
|
-
// 创建 Vue 实例
|
|
58
|
+
// 5. 创建 Vue 实例
|
|
99
59
|
new Vue({
|
|
100
|
-
router
|
|
60
|
+
router,
|
|
101
61
|
store,
|
|
102
62
|
render: h => h(App)
|
|
103
63
|
}).$mount('#app')
|
|
104
64
|
```
|
|
105
65
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
### 核心对象
|
|
109
|
-
|
|
110
|
-
- `App` - Vue 根组件
|
|
111
|
-
- `router` - Vue Router 实例(包含所有路由配置)
|
|
112
|
-
- `store` - Vuex Store 实例(包含所有状态管理)
|
|
113
|
-
- `initLiveH5App(Vue, options)` - 初始化应用函数
|
|
114
|
-
|
|
115
|
-
### 初始化配置选项
|
|
66
|
+
### 方式二:完整应用模式
|
|
116
67
|
|
|
117
68
|
```javascript
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
routerConfig: {}, // 路由配置覆盖
|
|
122
|
-
storeConfig: {} // Store 配置覆盖
|
|
123
|
-
})
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## 路由说明
|
|
127
|
-
|
|
128
|
-
应用包含以下路由:
|
|
129
|
-
|
|
130
|
-
| 路径 | 名称 | 组件 | 说明 |
|
|
131
|
-
|------|------|------|------|
|
|
132
|
-
| `/` | login | 登录页 | 用户登录 |
|
|
133
|
-
| `/roomList` | roomList | 房间列表 | 直播房间列表 |
|
|
134
|
-
| `/mylikeList` | mylikeList | 关注列表 | 我的关注 |
|
|
135
|
-
| `/couponList` | couponList | 优惠券 | 我的优惠券 |
|
|
136
|
-
| `/tellerDetail` | tellerDetail | 讲师详情 | 讲师详情页 |
|
|
137
|
-
| `/personalCenter` | personalCenter | 个人中心 | 个人中心 |
|
|
138
|
-
| `/updateName` | updateName | 修改昵称 | 修改昵称 |
|
|
139
|
-
| `/settingdy` | settingdy | 开播提醒 | 设置开播提醒 |
|
|
140
|
-
| `/liveRoom` | liveRoom | 直播间 | 直播房间页面 |
|
|
141
|
-
| `/liveRoom/productDetail` | productDetail | 商品详情 | 商品详情页 |
|
|
142
|
-
| `/rosApp` | rosApp | 唤起App | 唤起 App |
|
|
143
|
-
| `/productDetail` | productDetail | 商品详情 | 商品详情页 |
|
|
144
|
-
|
|
145
|
-
## API 配置
|
|
146
|
-
|
|
147
|
-
### 配置 API 基础地址
|
|
148
|
-
|
|
149
|
-
```javascript
|
|
150
|
-
// 方式一:初始化时配置
|
|
151
|
-
initLiveH5App(Vue, {
|
|
152
|
-
apiBaseUrl: 'https://your-api-domain.com/api'
|
|
153
|
-
})
|
|
69
|
+
import Vue from 'vue'
|
|
70
|
+
import { initLiveH5App } from 'live-h5-audience'
|
|
71
|
+
import 'live-h5-audience/dist/index.css'
|
|
154
72
|
|
|
155
|
-
//
|
|
156
|
-
Vue
|
|
157
|
-
|
|
73
|
+
// 初始化独立应用
|
|
74
|
+
const { vm, router, store } = initLiveH5App(Vue, {
|
|
75
|
+
containerId: '#live-h5-app',
|
|
76
|
+
apiBaseUrl: 'https://api.example.com',
|
|
77
|
+
defaultRoute: '/roomList'
|
|
158
78
|
})
|
|
159
79
|
```
|
|
160
80
|
|
|
161
|
-
|
|
81
|
+
## Demo 项目
|
|
162
82
|
|
|
163
|
-
|
|
164
|
-
// 在组件中访问
|
|
165
|
-
this.$apiBaseUrl
|
|
166
|
-
```
|
|
83
|
+
查看 `demo-simple` 目录获取完整的使用示例。
|
|
167
84
|
|
|
168
|
-
|
|
85
|
+
### 运行 Demo
|
|
169
86
|
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
87
|
+
```bash
|
|
88
|
+
cd demo-simple
|
|
89
|
+
npm install
|
|
90
|
+
npm run dev
|
|
174
91
|
```
|
|
175
92
|
|
|
176
|
-
##
|
|
93
|
+
## 配置选项
|
|
177
94
|
|
|
178
|
-
|
|
95
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
96
|
+
|------|------|--------|------|
|
|
97
|
+
| apiBaseUrl | String | - | API 基础地址 |
|
|
98
|
+
| containerId | String | '#live-h5-app' | 挂载容器 ID |
|
|
99
|
+
| defaultRoute | String | '/roomList' | 默认路由 |
|
|
179
100
|
|
|
180
|
-
##
|
|
101
|
+
## 路由
|
|
181
102
|
|
|
182
|
-
|
|
103
|
+
直播模块使用以下路由前缀:
|
|
183
104
|
|
|
184
|
-
|
|
105
|
+
| 路由 | 说明 |
|
|
106
|
+
|------|------|
|
|
107
|
+
| `/roomList` | 房间列表 |
|
|
108
|
+
| `/liveRoom/:id` | 直播间 |
|
|
109
|
+
| `/personal` | 个人中心 |
|
|
185
110
|
|
|
186
|
-
|
|
187
|
-
|------|---------|------|
|
|
188
|
-
| `vue` | ^2.6.0 | Vue 核心框架 |
|
|
189
|
-
| `vue-router` | ^3.0.0 | 路由管理 |
|
|
190
|
-
| `vuex` | ^3.0.0 | 状态管理 |
|
|
191
|
-
| `vant` | ^2.5.0 | 移动端组件库 |
|
|
192
|
-
| `element-ui` | ^2.7.0 | 桌面端组件库 |
|
|
193
|
-
|
|
194
|
-
### 包内依赖(dependencies)
|
|
195
|
-
|
|
196
|
-
以下依赖已**打包**在 npm 包中:
|
|
197
|
-
|
|
198
|
-
- `axios` - HTTP 请求
|
|
199
|
-
- `vue-bus` - 事件总线
|
|
200
|
-
- `flv.js` - FLV 播放器
|
|
201
|
-
- `video.js` - 视频播放器
|
|
202
|
-
- `xgplayer` - 西瓜播放器
|
|
203
|
-
- `tim-js-sdk` - 腾讯 IM SDK
|
|
204
|
-
- 以及其他功能依赖
|
|
111
|
+
## 注意事项
|
|
205
112
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
113
|
+
1. 必须先安装并引入 Vant、ElementUI、VueBus 等依赖
|
|
114
|
+
2. 确保 Vant 和 ElementUI 样式已正确引入
|
|
115
|
+
3. 包已外部化所有依赖,不会重复打包
|
|
116
|
+
4. 主文件大小约 1.1 MB
|
|
210
117
|
|
|
211
|
-
##
|
|
118
|
+
## 开发
|
|
212
119
|
|
|
213
120
|
```bash
|
|
214
|
-
#
|
|
121
|
+
# 开发模式
|
|
215
122
|
npm run dev
|
|
216
123
|
|
|
217
|
-
#
|
|
218
|
-
npm run build
|
|
219
|
-
|
|
220
|
-
# 构建 npm 库
|
|
124
|
+
# 构建 npm 包
|
|
221
125
|
npm run build:lib
|
|
222
126
|
|
|
223
|
-
#
|
|
127
|
+
# 合并 chunk 文件
|
|
128
|
+
node merge-chunks.js
|
|
129
|
+
|
|
130
|
+
# 发布到 npm(需要 OTP)
|
|
131
|
+
npm publish --access public --otp=<你的OTP码>
|
|
132
|
+
|
|
133
|
+
# 或使用完整发布脚本
|
|
224
134
|
npm run publish:lib
|
|
225
135
|
```
|
|
226
136
|
|
|
227
|
-
##
|
|
137
|
+
## 文件说明
|
|
138
|
+
|
|
139
|
+
构建后的文件结构:
|
|
228
140
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
141
|
+
```
|
|
142
|
+
dist/
|
|
143
|
+
├── index.umd.js # 主文件 (约 1.1 MB)
|
|
144
|
+
├── index.css # 样式文件 (约 60 KB)
|
|
145
|
+
└── static/ # 静态资源
|
|
146
|
+
├── img/ # 图片
|
|
147
|
+
└── ...
|
|
148
|
+
```
|
|
233
149
|
|
|
234
150
|
## License
|
|
235
151
|
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* Make clicks pass-through */
|
|
2
|
+
#nprogress {
|
|
3
|
+
pointer-events: none;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
#nprogress .bar {
|
|
7
|
+
background: #29d;
|
|
8
|
+
|
|
9
|
+
position: fixed;
|
|
10
|
+
z-index: 1031;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 2px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Fancy blur effect */
|
|
19
|
+
#nprogress .peg {
|
|
20
|
+
display: block;
|
|
21
|
+
position: absolute;
|
|
22
|
+
right: 0px;
|
|
23
|
+
width: 100px;
|
|
24
|
+
height: 100%;
|
|
25
|
+
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
|
|
26
|
+
opacity: 1.0;
|
|
27
|
+
|
|
28
|
+
-webkit-transform: rotate(3deg) translate(0px, -4px);
|
|
29
|
+
-ms-transform: rotate(3deg) translate(0px, -4px);
|
|
30
|
+
transform: rotate(3deg) translate(0px, -4px);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Remove these to get rid of the spinner */
|
|
34
|
+
#nprogress .spinner {
|
|
35
|
+
display: block;
|
|
36
|
+
position: fixed;
|
|
37
|
+
z-index: 1031;
|
|
38
|
+
top: 15px;
|
|
39
|
+
right: 15px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#nprogress .spinner-icon {
|
|
43
|
+
width: 18px;
|
|
44
|
+
height: 18px;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
|
|
47
|
+
border: solid 2px transparent;
|
|
48
|
+
border-top-color: #29d;
|
|
49
|
+
border-left-color: #29d;
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
|
|
52
|
+
-webkit-animation: nprogress-spinner 400ms linear infinite;
|
|
53
|
+
animation: nprogress-spinner 400ms linear infinite;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nprogress-custom-parent {
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
position: relative;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.nprogress-custom-parent #nprogress .spinner,
|
|
62
|
+
.nprogress-custom-parent #nprogress .bar {
|
|
63
|
+
position: absolute;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@-webkit-keyframes nprogress-spinner {
|
|
67
|
+
0% { -webkit-transform: rotate(0deg); }
|
|
68
|
+
100% { -webkit-transform: rotate(360deg); }
|
|
69
|
+
}
|
|
70
|
+
@keyframes nprogress-spinner {
|
|
71
|
+
0% { transform: rotate(0deg); }
|
|
72
|
+
100% { transform: rotate(360deg); }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@import "../theme/main.css";
|
|
76
|
+
.live-h5-app-root {
|
|
77
|
+
height: 100%;
|
|
78
|
+
width: 100%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/*# sourceMappingURL=App.vue.map */
|