Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf400e0

Browse files
committed
[fix]修复移动端切换主题无效问题
1 parent 5a4e19c commit bf400e0

File tree

5 files changed

+35
-19
lines changed

5 files changed

+35
-19
lines changed

demos/base-demo/ezuikit.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25448,6 +25448,7 @@ class MobilePtz {
2544825448
mobileContainer.style = `display:inline-block;width: ${this.jSPlugin.width}px;text-align:center;`;
2544925449
var mobileContainerTitle = document.createElement('div');
2545025450
mobileContainerTitle.className = "live-ptz-title";
25451+
mobileContainerTitle.id = "live-ptz-title";
2545125452
mobileContainerTitle.innerHTML = "云台控制";
2545225453
const ptzWrap = document.createElement('div');
2545325454
ptzWrap.id = "mobile-ez-ptz-item";
@@ -26134,14 +26135,6 @@ class Theme {
2613426135
if (!this.jSPlugin.Talk) {
2613526136
this.jSPlugin.Talk = new Talk(this.jSPlugin);
2613626137
}
26137-
if (matchEzopenUrl(jSPlugin.url).type === 'live') {
26138-
if (this.isMobile) {
26139-
this.MobilePtz = new MobilePtz(jSPlugin);
26140-
this.Ptz = new Ptz(jSPlugin);
26141-
} else {
26142-
this.Ptz = new Ptz(jSPlugin);
26143-
}
26144-
}
2614526138
}
2614626139
fetchThemeData(themeId) {
2614726140
const url = `${this.jSPlugin.env.domain}/jssdk/ezopen/template/getDetail?accessToken=${this.jSPlugin.accessToken}&id=${themeId}`;
@@ -26172,6 +26165,7 @@ class Theme {
2617226165
}
2617326166
changeTheme(options) {
2617426167
if(typeof options === 'string') {
26168+
this.jSPlugin.themeId = options;
2617526169
switch (this.jSPlugin.themeId) {
2617626170
case 'pcLive':
2617726171
this.themeData = pcLiveData.data;
@@ -26933,6 +26927,11 @@ class Theme {
2693326927
this.isNeedRenderFooter = lodash.findIndex(footer.btnList, (v)=>{
2693426928
return v.isrender > 0;
2693526929
}) >= 0;
26930+
["date-switch-container-wrap","rec-type-container-wrap","mobile-rec-wrap","mobile-ez-ptz-container"].forEach((item,index)=> {
26931+
if(document.getElementById(item)) {
26932+
document.getElementById(item).parentElement.removeChild(document.getElementById(item));
26933+
}
26934+
});
2693626935
if (this.isNeedRenderHeader) {
2693726936
if (!document.getElementById(`${this.jSPlugin.id}-headControl`)) {
2693826937
const headerContainer = document.createElement('div');
@@ -27020,6 +27019,15 @@ class Theme {
2702027019
this.Rec = new Rec(this.jSPlugin);
2702127020
}
2702227021
}
27022+
var isNeedRenderPTZ = (lodash.findIndex(this.themeData.header.btnList, (v)=>{
27023+
return (v.iconId === 'pantile' && v.isrender === 1);
27024+
}) >= 0 || (this.isMobile && matchEzopenUrl(this.jSPlugin.url).type.indexOf('live') !== -1)) && !this.jSPlugin.disabledPTZ;
27025+
if (isNeedRenderPTZ) {
27026+
this.MobilePtz = new MobilePtz(this.jSPlugin);
27027+
this.Ptz = new Ptz(this.jSPlugin);
27028+
} else {
27029+
this.Ptz = new Ptz(this.jSPlugin);
27030+
}
2702327031
// 监听全屏事件触发
2702427032
const fullscreenchange = () => {
2702527033
const { expend, webExpend } = this.decoderState.state;

demos/react-demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@testing-library/react": "^9.5.0",
88
"@testing-library/user-event": "^7.2.1",
99
"axios": "^0.19.2",
10-
"ezuikit-js": "^0.5.0",
10+
"ezuikit-js": "^0.5.2",
1111
"react": "^16.13.1",
1212
"react-dom": "^16.13.1",
1313
"react-scripts": "3.4.1"

demos/vue-demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"dependencies": {
1111
"core-js": "^3.6.4",
12-
"ezuikit-js": "^0.5.0",
12+
"ezuikit-js": "^0.5.2",
1313
"vue": "^2.6.11"
1414
},
1515
"devDependencies": {

ezuikit.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25448,6 +25448,7 @@ class MobilePtz {
2544825448
mobileContainer.style = `display:inline-block;width: ${this.jSPlugin.width}px;text-align:center;`;
2544925449
var mobileContainerTitle = document.createElement('div');
2545025450
mobileContainerTitle.className = "live-ptz-title";
25451+
mobileContainerTitle.id = "live-ptz-title";
2545125452
mobileContainerTitle.innerHTML = "云台控制";
2545225453
const ptzWrap = document.createElement('div');
2545325454
ptzWrap.id = "mobile-ez-ptz-item";
@@ -26134,14 +26135,6 @@ class Theme {
2613426135
if (!this.jSPlugin.Talk) {
2613526136
this.jSPlugin.Talk = new Talk(this.jSPlugin);
2613626137
}
26137-
if (matchEzopenUrl(jSPlugin.url).type === 'live') {
26138-
if (this.isMobile) {
26139-
this.MobilePtz = new MobilePtz(jSPlugin);
26140-
this.Ptz = new Ptz(jSPlugin);
26141-
} else {
26142-
this.Ptz = new Ptz(jSPlugin);
26143-
}
26144-
}
2614526138
}
2614626139
fetchThemeData(themeId) {
2614726140
const url = `${this.jSPlugin.env.domain}/jssdk/ezopen/template/getDetail?accessToken=${this.jSPlugin.accessToken}&id=${themeId}`;
@@ -26172,6 +26165,7 @@ class Theme {
2617226165
}
2617326166
changeTheme(options) {
2617426167
if(typeof options === 'string') {
26168+
this.jSPlugin.themeId = options;
2617526169
switch (this.jSPlugin.themeId) {
2617626170
case 'pcLive':
2617726171
this.themeData = pcLiveData.data;
@@ -26933,6 +26927,11 @@ class Theme {
2693326927
this.isNeedRenderFooter = lodash.findIndex(footer.btnList, (v)=>{
2693426928
return v.isrender > 0;
2693526929
}) >= 0;
26930+
["date-switch-container-wrap","rec-type-container-wrap","mobile-rec-wrap","mobile-ez-ptz-container"].forEach((item,index)=> {
26931+
if(document.getElementById(item)) {
26932+
document.getElementById(item).parentElement.removeChild(document.getElementById(item));
26933+
}
26934+
});
2693626935
if (this.isNeedRenderHeader) {
2693726936
if (!document.getElementById(`${this.jSPlugin.id}-headControl`)) {
2693826937
const headerContainer = document.createElement('div');
@@ -27020,6 +27019,15 @@ class Theme {
2702027019
this.Rec = new Rec(this.jSPlugin);
2702127020
}
2702227021
}
27022+
var isNeedRenderPTZ = (lodash.findIndex(this.themeData.header.btnList, (v)=>{
27023+
return (v.iconId === 'pantile' && v.isrender === 1);
27024+
}) >= 0 || (this.isMobile && matchEzopenUrl(this.jSPlugin.url).type.indexOf('live') !== -1)) && !this.jSPlugin.disabledPTZ;
27025+
if (isNeedRenderPTZ) {
27026+
this.MobilePtz = new MobilePtz(this.jSPlugin);
27027+
this.Ptz = new Ptz(this.jSPlugin);
27028+
} else {
27029+
this.Ptz = new Ptz(this.jSPlugin);
27030+
}
2702327031
// 监听全屏事件触发
2702427032
const fullscreenchange = () => {
2702527033
const { expend, webExpend } = this.decoderState.state;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ezuikit-js",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"description": "ezuikit javascript for npm",
55
"main": "ezuikit.js",
66
"scripts": {

0 commit comments

Comments
 (0)