|
|
@ -47,10 +47,13 @@ |
|
|
|
<!-- 示例插件2 id=100--> |
|
|
|
<button class="bg-blue-500 py-2 px-5 rounded text-white" onclick="p100.show()">测试组建2</button> |
|
|
|
|
|
|
|
<div data-pid="1402932548627206144" data-uid="1323567842540523520" data-rid="rid333" data-tid="tid444" data-did="did555" style="height:40px;width:100px"> |
|
|
|
<div data-root="p101"> |
|
|
|
<button class="bg-green-500 py-1 px-3 rounded text-white" style="display:none" onclick="p101.bindOne(this)">插件测试</button> |
|
|
|
<button class="bg-blue-500 py-1 px-3 rounded text-white" style="display:none" onclick="p101.bindTwo(this)">绑定平车</button> |
|
|
|
<div data-pid="1402932548627206144" data-uid="1323567842540523520" data-rid="rid333" data-tid="tid444" data-did="did555" style="height:40px;width:250px"> |
|
|
|
<div data-root="p1419895529168707584" class="flex justify-between"> |
|
|
|
<button class="bg-green-500 py-1 px-3 rounded text-white" style="display:none" onclick="p1419895529168707584.bindOne(this)"></button> |
|
|
|
<button class="bg-blue-500 py-1 px-3 rounded text-white" style="display:none" onclick="p1419895529168707584.bindOne(this)">绑定平车</button> |
|
|
|
<div style="width:100px;height:30px" onclick="p1419895529168707584.bindOne(this)" > |
|
|
|
<img style="height:100%;width:100" src="https://www.tall.wiki/staticrec/photos/zkpc.jpg"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
@ -66,9 +69,9 @@ |
|
|
|
2.根据返回的数据,判断显示哪个btn |
|
|
|
*/ |
|
|
|
;(async function() { |
|
|
|
var dom = document.querySelector("div[data-root=p101]"); |
|
|
|
var dom = document.querySelector("div[data-root=p1419895529168707584]"); |
|
|
|
var domBox = dom.parentNode; |
|
|
|
var domChild = document.querySelectorAll('div[data-root=p101]>button'); |
|
|
|
var domChild = document.querySelectorAll('div[data-root=p1419895529168707584]>button'); |
|
|
|
const uid = domBox.getAttribute('data-uid'); |
|
|
|
const pid = domBox.getAttribute('data-pid'); |
|
|
|
const token = await getToken(uid); |
|
|
@ -114,19 +117,14 @@ |
|
|
|
console.log('data', json.data) |
|
|
|
return json.data; |
|
|
|
} |
|
|
|
/* |
|
|
|
1. p101插件的所有事件及属性 |
|
|
|
*/ |
|
|
|
const p101 = { |
|
|
|
const p1419895529168707584 = { |
|
|
|
bindOne(that) { |
|
|
|
console.log(that.parentNode.parentNode) |
|
|
|
console.log('data-pid',that.parentNode.parentNode.getAttribute('data-pid')) |
|
|
|
location.href = 'https://www.baidu.com' |
|
|
|
}, |
|
|
|
bindTwo(that) { |
|
|
|
console.log(that.parentNode.parentNode) |
|
|
|
console.log('data-uid',that.parentNode.parentNode.getAttribute('data-uid')) |
|
|
|
location.href = 'https://www.baidu.com' |
|
|
|
console.log(that) |
|
|
|
const pId = that.parentNode.parentNode.getAttribute('data-pid'); |
|
|
|
const rId = that.parentNode.parentNode.getAttribute('data-rid'); |
|
|
|
const uId = that.parentNode.parentNode.getAttribute('data-uid'); |
|
|
|
const tId = that.parentNode.parentNode.getAttribute('data-tid'); |
|
|
|
location.href = `https://www.tall.wiki/qc/choice?projectId=${pId}&roleId=${rId}&userId=${uId}&id=${tId}`; |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|