增加点标注rtmp属性
This commit is contained in:
@ -166,6 +166,8 @@ class BillboardObject extends Base {
|
||||
this.options.attribute.link.content || []
|
||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
||||
this.options.attribute.rtmp = this.options.attribute.rtmp || {}
|
||||
this.options.attribute.rtmp.content = this.options.attribute.rtmp.content || []
|
||||
this.options.attribute.camera = this.options.attribute.camera || {}
|
||||
this.options.attribute.camera.content =
|
||||
this.options.attribute.camera.content || []
|
||||
@ -245,6 +247,12 @@ class BillboardObject extends Base {
|
||||
let font = getFontFamily(that.labelFontFamily) || 'Helvetica'
|
||||
let url = that.replaceHost(that.options.billboard.image, that.options.host)
|
||||
that._frameImages = []
|
||||
if(url) {
|
||||
that.options.billboard.image = url
|
||||
}
|
||||
else {
|
||||
that.options.billboard.image = that.getSourceRootPath() + '/img/A-ablu-blank.png'
|
||||
}
|
||||
if (url && url.endsWith('gif')) {
|
||||
isGlf = true
|
||||
switch (that.options.heightMode) {
|
||||
@ -480,6 +488,11 @@ class BillboardObject extends Base {
|
||||
// value: '传感器',
|
||||
// key: 'sensor'
|
||||
// },
|
||||
{
|
||||
name: 'rtmp',
|
||||
value: 'rtmp',
|
||||
key: 'rtmp'
|
||||
},
|
||||
{
|
||||
name: '全景图',
|
||||
value: '全景图',
|
||||
@ -1435,6 +1448,170 @@ class BillboardObject extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
get attributeRtmp() {
|
||||
return this.options.attribute.rtmp.content
|
||||
}
|
||||
|
||||
set attributeRtmp(v) {
|
||||
this.options.attribute.rtmp.content = v
|
||||
if (
|
||||
!this._DialogObject ||
|
||||
!this._DialogObject._element ||
|
||||
!this._DialogObject._element.content ||
|
||||
this._DialogObject._element.content.getElementsByClassName(
|
||||
'attribute-content-rtmp'
|
||||
).length == 0
|
||||
) {
|
||||
return
|
||||
}
|
||||
let table = this._DialogObject._element.content
|
||||
.getElementsByClassName('attribute-content-rtmp')[1]
|
||||
.getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
tableContent.innerHTML = ''
|
||||
if (this.options.attribute.rtmp.content.length > 0) {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
||||
} else {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
||||
}
|
||||
for (let i = 0; i < this.options.attribute.rtmp.content.length; i++) {
|
||||
let tr =
|
||||
`
|
||||
<div class="tr">
|
||||
<div class="td">` +
|
||||
this.options.attribute.rtmp.content[i].name +
|
||||
`</div>
|
||||
<div class="td">` +
|
||||
this.options.attribute.rtmp.content[i].url +
|
||||
`</div>
|
||||
<div class="td">
|
||||
<button @click="rtmpEdit">编辑</button>
|
||||
<button @click="rtmpDelete">删除</button>
|
||||
</div>
|
||||
</div>`
|
||||
let trElm = document.createRange().createContextualFragment(tr)
|
||||
tableContent.appendChild(trElm)
|
||||
}
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
let fun = {
|
||||
rtmpEdit: async index => {
|
||||
this.attributeRtmp = await this.options.attribute.rtmp.content
|
||||
let table = this._DialogObject._element.content
|
||||
.getElementsByClassName('attribute-content-rtmp')[1]
|
||||
.getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
if (index === i) {
|
||||
let height = item[i].offsetHeight
|
||||
let html = `
|
||||
<div class="td">
|
||||
<input class="input" type="text">
|
||||
</div>
|
||||
<div class="td">
|
||||
<textarea class="input link-edit" type="text"></textarea>
|
||||
</div>
|
||||
<div class="td">
|
||||
<button @click="confirmEdit">确认</button>
|
||||
<button @click="cancelEdit">取消</button>
|
||||
</div>`
|
||||
item[i].innerHTML = html
|
||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
||||
textareaElm.style.height = height - 10 + 'px'
|
||||
let td = item[i].getElementsByClassName('td')
|
||||
td[0].getElementsByClassName(
|
||||
'input'
|
||||
)[0].value = this.options.attribute.rtmp.content[index].name
|
||||
td[1].getElementsByClassName(
|
||||
'input'
|
||||
)[0].value = this.options.attribute.rtmp.content[index].url
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] || !btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', e => {
|
||||
if (typeof fun[m.value] === 'function') {
|
||||
fun[m.value](
|
||||
{
|
||||
name: td[0].getElementsByClassName('input')[0].value,
|
||||
url: td[1].getElementsByClassName('input')[0].value
|
||||
},
|
||||
i
|
||||
)
|
||||
}
|
||||
})
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
rtmpDelete: i => {
|
||||
this.options.attribute.rtmp.content.splice(i, 1)
|
||||
this.attributeRtmp = this.options.attribute.rtmp.content
|
||||
},
|
||||
|
||||
confirmEdit: (value, i) => {
|
||||
let name = value.name && value.name.replace(/\s/g, '')
|
||||
let url = value.url && value.url.replace(/\s/g, '')
|
||||
if (name && url) {
|
||||
this.options.attribute.rtmp.content[i] = value
|
||||
} else {
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '名称或链接不能为空!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
this.attributeRtmp = this.options.attribute.rtmp.content
|
||||
},
|
||||
cancelEdit: () => {
|
||||
this.attributeRtmp = this.options.attribute.rtmp.content
|
||||
},
|
||||
fileSelect: (value, i) => {
|
||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
||||
fileElm.click()
|
||||
fileElm.removeEventListener('change', fileSelect)
|
||||
fileElm.addEventListener('change', fileSelect)
|
||||
}
|
||||
}
|
||||
let fileSelect = event => {
|
||||
if (event.target.value) {
|
||||
let td = item[
|
||||
event.target.getAttribute('index')
|
||||
].getElementsByClassName('td')
|
||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
||||
event.target.value = null
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] || !btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', e => {
|
||||
if (typeof fun[m.value] === 'function') {
|
||||
fun[m.value](i)
|
||||
}
|
||||
})
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get attributeGoods() {
|
||||
return this.options.attribute.goods.content
|
||||
}
|
||||
@ -2155,6 +2332,7 @@ class BillboardObject extends Base {
|
||||
this.alt = this.originalOptions.position.alt || 0
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
this.attributeRtmp = this.options.attribute.rtmp.content
|
||||
this.attributeCamera = this.options.attribute.camera.content
|
||||
this.attributeGoods = this.options.attribute.goods.content
|
||||
this.attributeISC = this.options.attribute.isc.content
|
||||
|
||||
Reference in New Issue
Block a user