Skip to content

Commit 2043a54

Browse files
committed
feat: merge
2 parents 81a9fe6 + d10827a commit 2043a54

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+18234
-40
lines changed

.github/workflows/build-demos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ jobs:
5252
working-directory: ./demos/with-vue2.6
5353
run: |
5454
pnpm install --no-frozen-lockfile
55-
pnpm run build
55+
pnpm run build
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: build-uniapp-vue2
2+
3+
on:
4+
push:
5+
branches: ["main", "develop"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [16.x, 18.x, 20.x, 21.x, 22.x] # not support node >= 23.x and node<=16.x
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
24+
- name: Build with-uniapp-vue2
25+
working-directory: ./demos/with-uniapp-vue2
26+
run: |
27+
yarn install
28+
yarn run build:h5
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: build-uniapp-vue3
2+
3+
on:
4+
push:
5+
branches: ["main", "develop"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x, 20.x, 21.x, 22.x, 23.x, 24.x] # node>=18.x
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
24+
- name: Build with-uniapp-vue3
25+
working-directory: ./demos/with-uniapp-vue3
26+
run: |
27+
yarn install
28+
yarn run build:h5

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ alpha(功能测试)、beta(集成测试)为我们的非正式版本,
125125
> 如果使用 vue2.7,可参考 demos => [vue-demo](https://github.com/Ezviz-OpenBiz/EZUIKit-JavaScript-npm/tree/master/demos/vue-demo)
126126
127127
> 如果使用 vue2.6,可参考 demos => [with-vue2.6](https://github.com/Ezviz-OpenBiz/EZUIKit-JavaScript-npm/tree/master/demos/with-vue2.6)
128+
>
129+
> 如果使用 uniapp + vue3 ,可参考 demos => [with-uniapp-vue3](https://github.com/Ezviz-OpenBiz/EZUIKit-JavaScript-npm/tree/master/demos/with-uniapp-vue3)
130+
>
131+
> 如果使用 uniapp + vue2 ,可参考 demos => [with-uniapp-vue2](https://github.com/Ezviz-OpenBiz/EZUIKit-JavaScript-npm/tree/master/demos/with-uniapp-vue2)
128132
129133
#### tips
130134

demos/react-demo/src/Inspection.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React from "react";
2+
import EZUIKit from "ezuikit-js";
3+
4+
class App extends React.Component {
5+
constructor(props) {
6+
super(props);
7+
this.player = null;
8+
this.state = {
9+
deviceList: [
10+
{
11+
width: 600,
12+
height: 400,
13+
accessToken: 'at.79xun36c3txmf3j452p1vc8ubaaf9r0q-361vhe7edi-1cekmll-f541jowsm',
14+
url: 'ezopen://open.ys7.com/C69625501/1.live',
15+
template: 'pcLive'
16+
},
17+
{
18+
width: 600,
19+
height: 400,
20+
accessToken: 'at.79xun36c3txmf3j452p1vc8ubaaf9r0q-361vhe7edi-1cekmll-f541jowsm',
21+
url: 'ezopen://open.ys7.com/BC7799091/1.live',
22+
template: 'pcLive'
23+
}
24+
]
25+
}
26+
}
27+
componentDidMount() {
28+
this.init();
29+
}
30+
31+
init = () => {
32+
console.log(document.getElementById('player'), this.state.deviceList);
33+
const inspection = new EZUIKit.EZUIKitInspectionUI(this.playerRef.current, { list: this.state.deviceList, pageSize: 2 })
34+
};
35+
36+
render() {
37+
return (
38+
<div className="demo">
39+
<h2>视频模式使用示例:</h2>
40+
<div>
41+
<div id="player"></div>
42+
</div>
43+
<div>
44+
<button onClick={this.init}>init</button>
45+
</div>
46+
</div>
47+
);
48+
}
49+
}
50+
51+
export default App;

demos/vue-demo/src/components/Player.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="hello-ezuikit-js">
2+
<div class="player-box">
33
<div>
44
<div id="video-container" style="width: 600px; height: 400px"></div>
55
</div>

demos/with-uniapp-vue2/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
node_modules/
3+
unpackage/
4+
dist/
5+
6+
# local env files
7+
.env.local
8+
.env.*.local
9+
10+
# Log files
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
15+
# Editor directories and files
16+
.project
17+
.idea
18+
.vscode
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw*

demos/with-uniapp-vue2/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# with-uniapp-vue2
2+
3+
## Project setup
4+
```
5+
yarn install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
yarn run dev:h5
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
yarn run build:h5
16+
```
17+
18+
## 接入
19+
20+
[./src/components/Player.vue](./src/components/Player.vue)
21+
22+
## 源码地址
23+
24+
https://github.com/Ezviz-OpenBiz/EZUIKit-JavaScript-npm/tree/master/demos/with-uniapp-vue2
25+
26+
27+
## uniapp 插件
28+
29+
https://github.com/Ezviz-OpenBiz/UniEzOpenSDK
30+
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<<<<<<< HEAD
2+
const webpack = require('webpack')
3+
const plugins = []
4+
5+
if (process.env.UNI_OPT_TREESHAKINGNG) {
6+
plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js'))
7+
}
8+
9+
if (
10+
(
11+
process.env.UNI_PLATFORM === 'app-plus' &&
12+
process.env.UNI_USING_V8
13+
) ||
14+
(
15+
process.env.UNI_PLATFORM === 'h5' &&
16+
process.env.UNI_H5_BROWSER === 'builtin'
17+
)
18+
) {
19+
const path = require('path')
20+
21+
const isWin = /^win/.test(process.platform)
22+
23+
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
24+
25+
const input = normalizePath(process.env.UNI_INPUT_DIR)
26+
try {
27+
plugins.push([
28+
require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
29+
{
30+
file (file) {
31+
file = normalizePath(file)
32+
if (file.indexOf(input) === 0) {
33+
return path.relative(input, file)
34+
}
35+
return false
36+
}
37+
}
38+
])
39+
} catch (e) { }
40+
}
41+
42+
process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
43+
process.UNI_LIBRARIES.forEach(libraryName => {
44+
plugins.push([
45+
'import',
46+
{
47+
'libraryName': libraryName,
48+
'customName': (name) => {
49+
return `${libraryName}/lib/${name}/${name}`
50+
}
51+
}
52+
])
53+
})
54+
55+
if (process.env.UNI_PLATFORM !== 'h5') {
56+
plugins.push('@babel/plugin-transform-runtime')
57+
}
58+
59+
const config = {
60+
presets: [
61+
[
62+
'@vue/app',
63+
{
64+
modules: webpack.version[0] > 4 ? 'auto' : 'commonjs',
65+
useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
66+
}
67+
]
68+
],
69+
plugins
70+
}
71+
72+
const UNI_H5_TEST = '**/@dcloudio/uni-h5/dist/index.umd.min.js'
73+
if (process.env.NODE_ENV === 'production') {
74+
config.overrides = [{
75+
test: UNI_H5_TEST,
76+
compact: true,
77+
}]
78+
} else {
79+
config.ignore = [UNI_H5_TEST]
80+
}
81+
82+
module.exports = config
83+
=======
84+
const webpack = require('webpack')
85+
const plugins = []
86+
87+
if (process.env.UNI_OPT_TREESHAKINGNG) {
88+
plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js'))
89+
}
90+
91+
if (
92+
(
93+
process.env.UNI_PLATFORM === 'app-plus' &&
94+
process.env.UNI_USING_V8
95+
) ||
96+
(
97+
process.env.UNI_PLATFORM === 'h5' &&
98+
process.env.UNI_H5_BROWSER === 'builtin'
99+
)
100+
) {
101+
const path = require('path')
102+
103+
const isWin = /^win/.test(process.platform)
104+
105+
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
106+
107+
const input = normalizePath(process.env.UNI_INPUT_DIR)
108+
try {
109+
plugins.push([
110+
require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
111+
{
112+
file (file) {
113+
file = normalizePath(file)
114+
if (file.indexOf(input) === 0) {
115+
return path.relative(input, file)
116+
}
117+
return false
118+
}
119+
}
120+
])
121+
} catch (e) { }
122+
}
123+
124+
process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
125+
process.UNI_LIBRARIES.forEach(libraryName => {
126+
plugins.push([
127+
'import',
128+
{
129+
'libraryName': libraryName,
130+
'customName': (name) => {
131+
return `${libraryName}/lib/${name}/${name}`
132+
}
133+
}
134+
])
135+
})
136+
137+
if (process.env.UNI_PLATFORM !== 'h5') {
138+
plugins.push('@babel/plugin-transform-runtime')
139+
}
140+
141+
const config = {
142+
presets: [
143+
[
144+
'@vue/app',
145+
{
146+
modules: webpack.version[0] > 4 ? 'auto' : 'commonjs',
147+
useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
148+
}
149+
]
150+
],
151+
plugins
152+
}
153+
154+
const UNI_H5_TEST = '**/@dcloudio/uni-h5/dist/index.umd.min.js'
155+
if (process.env.NODE_ENV === 'production') {
156+
config.overrides = [{
157+
test: UNI_H5_TEST,
158+
compact: true,
159+
}]
160+
} else {
161+
config.ignore = [UNI_H5_TEST]
162+
}
163+
164+
module.exports = config
165+
>>>>>>> 210a1f252ad5cbfed5e05c854b2db97d7d42b800

0 commit comments

Comments
 (0)