|
|
@ -33,64 +33,23 @@ |
|
|
|
<div class="flex-1" style="width: 100%; height: 50rem;"> |
|
|
|
<div class="rounded-lg bg-white p-3" style="height: 100%;"> |
|
|
|
<div data-tname="倒计时" data-pid="1472861916249726976" data-uid="1217647686598135808" data-rid="rid333" data-tid="tid444" data-did="did555" style="height:300px;width:100%"> |
|
|
|
<div data-root="p1494569464917921792" style="height: 100%; width: 100%;"> |
|
|
|
倒计时:<div class="test-1-num">60</div> |
|
|
|
<div data-root="p1494589750644051968" style="height: 100%; width: 100%;"> |
|
|
|
<button class="bg-blue-500 text-xs rounded py-2 px-3 text-white border-none" onclick="p1494589750644051968.toJump()">跳转路径</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<script> |
|
|
|
var p1494569464917921792_config = { |
|
|
|
getToken: 'https://www.tall.wiki/gateway/tall/v1.0/users/userId' |
|
|
|
var p1494589750644051968_config = { |
|
|
|
url: 'https://www.baidu.com/' |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<script> |
|
|
|
var p1494569464917921792 = { |
|
|
|
token: '', |
|
|
|
projectId: '', |
|
|
|
roleId: '', |
|
|
|
dom: '', |
|
|
|
num: 60, |
|
|
|
|
|
|
|
init() { |
|
|
|
this.dom = document.querySelector("div[data-root=p1494569464917921792]"); |
|
|
|
var domBox = this.dom.parentNode; |
|
|
|
// var title = this.dom.querySelector('.title'); |
|
|
|
|
|
|
|
// 倒计时 |
|
|
|
setInterval(() => { |
|
|
|
this.num--; |
|
|
|
this.dom.querySelector(".test-1-num").innerHTML = this.num; |
|
|
|
}, 1000); |
|
|
|
|
|
|
|
// 获取父元素携带的参数 |
|
|
|
var userId = domBox.getAttribute("data-uid"); |
|
|
|
this.projectId = domBox.getAttribute("data-pid"); |
|
|
|
this.roleId = domBox.getAttribute("data-rid"); |
|
|
|
this.token = domBox.getAttribute("data-token"); |
|
|
|
// 初始化的时候 获取token |
|
|
|
this.getTokenByUserId(userId); |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取token |
|
|
|
getTokenByUserId(userId) { |
|
|
|
var that = this |
|
|
|
fetch(`${p1494569464917921792_config.getToken}?userId=${userId}`) |
|
|
|
.then(function(response) { |
|
|
|
return response.json(); |
|
|
|
}) |
|
|
|
.then(function(res) { |
|
|
|
const { success, code, data, msg } = res; |
|
|
|
if (success && code === 200) { |
|
|
|
that.token = data.token; |
|
|
|
} else { |
|
|
|
console.log('msg: ', msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
var p1494589750644051968 = { |
|
|
|
toJump() { |
|
|
|
window.location.href = p1494589750644051968_config.url; |
|
|
|
} |
|
|
|
} |
|
|
|
p1494569464917921792.init() |
|
|
|
</script> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|