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 token = await getToken(uid);
const carInfo = await getBindCar(pid,token);
if(carInfo && carInfo.length) {
domChild[0].innerHTML = `平车${carNumber}`
if(carInfo && carInfo.carId) {
domChild[0].innerHTML = `平车${carInfo.carSerial}`
domChild[0].style.display = 'block'
} else {
domChild[1].style.display = 'block'
@ -101,7 +101,8 @@
*/
async function getBindCar(projectId,token) {
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',
headers: {
'Content-Type': 'application/json;charset=utf-8',
@ -110,6 +111,7 @@
body: JSON.stringify(params)
});
const json = await response.json();
console.log('data', json.data)
return json.data;
}
/*
@ -119,6 +121,7 @@
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)

15
route.js

@ -5,3 +5,18 @@ get('/blog').to.json({
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