Browse Source

mock数据修改及添加

1-baogao
aBin 4 years ago
parent
commit
4f6c0e8c4a
  1. 9
      index.html
  2. 15
      route.js

9
index.html

@ -73,8 +73,8 @@
const pid = domBox.getAttribute('data-pid'); const pid = domBox.getAttribute('data-pid');
const token = await getToken(uid); const token = await getToken(uid);
const carInfo = await getBindCar(pid,token); const carInfo = await getBindCar(pid,token);
if(carInfo && carInfo.length) { if(carInfo && carInfo.carId) {
domChild[0].innerHTML = `平车${carNumber}` domChild[0].innerHTML = `平车${carInfo.carSerial}`
domChild[0].style.display = 'block' domChild[0].style.display = 'block'
} else { } else {
domChild[1].style.display = 'block' domChild[1].style.display = 'block'
@ -101,7 +101,8 @@
*/ */
async function getBindCar(projectId,token) { async function getBindCar(projectId,token) {
const params = { param: { projectId } } const params = { param: { projectId } }
const response = await fetch('https://www.tall.wiki/gateway/wisdomcar/car/queryBindingCar', { // const response = await fetch('https://www.tall.wiki/gateway/wisdomcar/car/queryBind', {
const response = await fetch('/queryBind', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json;charset=utf-8', 'Content-Type': 'application/json;charset=utf-8',
@ -110,6 +111,7 @@
body: JSON.stringify(params) body: JSON.stringify(params)
}); });
const json = await response.json(); const json = await response.json();
console.log('data', json.data)
return json.data; return json.data;
} }
/* /*
@ -119,6 +121,7 @@
bindOne(that) { bindOne(that) {
console.log(that.parentNode.parentNode) console.log(that.parentNode.parentNode)
console.log('data-pid',that.parentNode.parentNode.getAttribute('data-pid')) console.log('data-pid',that.parentNode.parentNode.getAttribute('data-pid'))
location.href = 'https://www.baidu.com'
}, },
bindTwo(that) { bindTwo(that) {
console.log(that.parentNode.parentNode) console.log(that.parentNode.parentNode)

15
route.js

@ -5,3 +5,18 @@ get('/blog').to.json({
title: 'Hello world' title: 'Hello world'
} }
}) })
post('/queryBind').to.json({
code: 200,
msg: 'ok',
data: {
patientCarId: 111,
patientId: 222,
carId: 333,
carSerial: '123',
name: '张小斌',
startTime: 1627378802858,
endTime: 1627378902858,
},
success: true
})

Loading…
Cancel
Save