diff --git a/index.html b/index.html
index bd4ce31..1f16713 100644
--- a/index.html
+++ b/index.html
@@ -48,9 +48,8 @@
-
-
-
+
+
@@ -61,68 +60,8 @@
alert(this.name)
}
}
- /*
- 1.进页面首先查询绑定状态
- 2.根据返回的数据,判断显示哪个btn
- */
- ;(async function() {
- var dom = document.querySelector("div[data-root=p101]");
- var domBox = dom.parentNode;
- var domChild = document.querySelectorAll('div[data-root=p101]>button');
- const uid = domBox.getAttribute('data-uid');
- const pid = domBox.getAttribute('data-pid');
- const token = await getToken(uid);
- const carInfo = await getBindCar(pid,token);
- if(carInfo && carInfo.length) {
- domChild[0].innerHTML = `平车${carNumber}`
- domChild[0].style.display = 'block'
- } else {
- domChild[1].style.display = 'block'
- }
- })();
- /*
- 根据uid获取token接口
- */
- async function getToken(uid) {
- var token = ''
- await fetch(`https://www.tall.wiki/gateway/tall/v1.0/users/userId?userId=${uid}`)
- .then(function(response) {
- return response.json();
- })
- .then(function(myJson) {
- token = myJson.data.token
- });
- return token
- }
- /*
- 查询绑定好的平车
- 1. 有则显示 平车+编号 按钮
- 2. 无泽显示 绑定平车 按钮
- */
- async function getBindCar(projectId,token) {
- const params = { param: { projectId } }
- const response = await fetch('https://www.tall.wiki/gateway/wisdomcar/car/queryBindingCar', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json;charset=utf-8',
- 'Authorization': 'Bearer ' + token,
- },
- body: JSON.stringify(params)
- });
- const json = await response.json();
- return json.data;
- }
- /*
- 1. p101插件的所有事件及属性
- */
- const p101 = {
- bindOne(that) {
- console.log(that.parentNode.parentNode)
- console.log('data-pid',that.parentNode.parentNode.getAttribute('data-pid'))
- },
- bindTwo(that) {
- console.log(that.parentNode.parentNode)
- console.log('data-uid',that.parentNode.parentNode.getAttribute('data-uid'))
+ const p102 = {
+ jumpDetails() {
location.href = 'https://www.baidu.com'
}
};