首页有数据则不请求

This commit is contained in:
2021-12-02 11:35:19 +08:00
parent b9e0f54b4d
commit a859aab071

View File

@@ -220,8 +220,8 @@ export default {
// }, // },
// { title: "无数据", publicTime: "无数据", area: "无数据" }, // { title: "无数据", publicTime: "无数据", area: "无数据" },
// { title: "无数据", publicTime: "无数据", area: "无数据" } // { title: "无数据", publicTime: "无数据", area: "无数据" }
], ]
}, }
// prjList: [{}, {}] // prjList: [{}, {}]
// prjList: [ // prjList: [
// { // {
@@ -282,7 +282,7 @@ export default {
// ] // ]
// } // }
// ] // ]
}, }
}; };
}, },
created() { created() {
@@ -312,7 +312,12 @@ export default {
// } else { // } else {
// this.onInit(); // this.onInit();
// } // }
if (!sessionStorage.getItem("homeData")) {
this.onInit(); this.onInit();
} else {
let d = JSON.parse(sessionStorage.getItem("homeData"));
this.data = d.data.data;
}
this.setLocationAplus(); this.setLocationAplus();
// SetTicket(this.$route.query.ticket); // SetTicket(this.$route.query.ticket);
$(".logout").css("display", "none"); $(".logout").css("display", "none");
@@ -327,15 +332,18 @@ export default {
//debugger; //debugger;
if (from.name == "final" && to.name == "index") { if (from.name == "final" && to.name == "index") {
ZWJSBridge.close() ZWJSBridge.close()
.then((result) => { .then(result => {
console.log( console.log(
"1201-index页面的close回调3--form-to:" + from.name + "->" + to.name "1201-index页面的close回调3--form-to:" + from.name + "->" + to.name
); );
console.log(result); console.log(result);
}) })
.catch((error) => { .catch(error => {
console.log( console.log(
"1201-index页面的close回调异常4--form-to:" + from.name + "->" + to.name "1201-index页面的close回调异常4--form-to:" +
from.name +
"->" +
to.name
); );
console.log(error); console.log(error);
}); });
@@ -356,10 +364,10 @@ export default {
type: "POST", type: "POST",
data: { data: {
ticket: ticket:
this.$route.query.ticket || window.sessionStorage.getItem("ticket"), this.$route.query.ticket || window.sessionStorage.getItem("ticket")
}, },
appKey: "es4b8zmz+2001833218+dehllx", appKey: "es4b8zmz+2001833218+dehllx",
onSuccess: (data) => { onSuccess: data => {
this.loading = false; this.loading = false;
window.sessionStorage.setItem("homeData", JSON.stringify(data)); window.sessionStorage.setItem("homeData", JSON.stringify(data));
if (data.data.success) { if (data.data.success) {
@@ -374,7 +382,7 @@ export default {
message: "登录超时,请重新登录", message: "登录超时,请重新登录",
duration: 3000, duration: 3000,
type: "info", type: "info",
center: true, center: true
}); });
setTimeout(() => { setTimeout(() => {
window.location.replace( window.location.replace(
@@ -386,20 +394,20 @@ export default {
message: "请求出错", message: "请求出错",
duration: 3000, duration: 3000,
type: "error", type: "error",
center: true, center: true
}); });
} }
} }
}, },
onFail: (err) => { onFail: err => {
this.loading = false; this.loading = false;
this.$notify({ this.$notify({
title: "错误", title: "错误",
message: "请求失败", message: "请求失败",
duration: 3000, duration: 3000,
type: "error", type: "error"
}); });
}, }
}); });
}, },
toOlderMode() { toOlderMode() {
@@ -429,8 +437,8 @@ export default {
this.$router.push({ this.$router.push({
name: "projectSelect", name: "projectSelect",
params: { params: {
type: type, type: type
}, }
}); });
}, },
// 直接跳转分户评估结果页面 // 直接跳转分户评估结果页面
@@ -441,8 +449,8 @@ export default {
name: "evaluatePage", name: "evaluatePage",
params: { params: {
fhpgId: id, fhpgId: id,
type, type
}, }
}); });
}, },
// 直接跳转协议结果pdf // 直接跳转协议结果pdf
@@ -452,8 +460,8 @@ export default {
this.$router.push({ this.$router.push({
name: "showPdf", name: "showPdf",
params: { params: {
id, id
}, }
}); });
}, },
// 加载项目数统计信息 // 加载项目数统计信息
@@ -468,38 +476,38 @@ export default {
$("#app").removeClass("old_app3"); $("#app").removeClass("old_app3");
this.$router.push({ this.$router.push({
name: "policyInfo", name: "policyInfo",
params: { id }, params: { id }
}); });
}, },
setZwUserAplus(Userid, userName) { setZwUserAplus(Userid, userName) {
// 设置用户信息埋点 // 设置用户信息埋点
aplus_queue.push({ aplus_queue.push({
action: "aplus.setMetaInfo", action: "aplus.setMetaInfo",
arguments: ["_hold", "BLOCK"], arguments: ["_hold", "BLOCK"]
}); });
aplus_queue.push({ aplus_queue.push({
action: "aplus.setMetaInfo", action: "aplus.setMetaInfo",
arguments: ["_user_nick", userName], // this.userInfoData.username], arguments: ["_user_nick", userName] // this.userInfoData.username],
}); });
aplus_queue.push({ aplus_queue.push({
action: "aplus.setMetaInfo", action: "aplus.setMetaInfo",
arguments: ["_user_id", Userid], arguments: ["_user_id", Userid]
}); });
aplus_queue.push({ aplus_queue.push({
action: "aplus.setMetaInfo", action: "aplus.setMetaInfo",
arguments: ["_hold", "START"], arguments: ["_hold", "START"]
}); });
}, },
setLocationAplus() { setLocationAplus() {
ZWJSBridge.onReady(() => { ZWJSBridge.onReady(() => {
// console.log("初始化完成后执行bridge方法"); // console.log("初始化完成后执行bridge方法");
ZWJSBridge.getUserType() ZWJSBridge.getUserType()
.then((result1) => { .then(result1 => {
// console.log("getUserType():" + JSON.stringify(result1)); // console.log("getUserType():" + JSON.stringify(result1));
// console.log("result1.userType:" + result1.userType); // console.log("result1.userType:" + result1.userType);
//经纬度 //经纬度
ZWJSBridge.getLocation() ZWJSBridge.getLocation()
.then((result2) => { .then(result2 => {
// console.log("getLocation():" + JSON.stringify(result2)); // console.log("getLocation():" + JSON.stringify(result2));
// console.log("result2.longitude:" + result2.longitude); // console.log("result2.longitude:" + result2.longitude);
// console.log("result2.latitude:" + result2.latitude); // console.log("result2.latitude:" + result2.latitude);
@@ -507,7 +515,7 @@ export default {
action: "aplus.sendPV", action: "aplus.sendPV",
arguments: [ arguments: [
{ {
is_auto: false, is_auto: false
}, },
{ {
isMini: true, isMini: true,
@@ -515,16 +523,16 @@ export default {
miniAppName: "房屋征收", miniAppName: "房屋征收",
long: result2.longitude, long: result2.longitude,
lati: result2.latitude, lati: result2.latitude,
userType: result1.userType, userType: result1.userType
}, }
], ]
}); });
}) })
.catch((error) => { .catch(error => {
// console.log(error); // console.log(error);
}); });
}) })
.catch((error) => { .catch(error => {
// console.log(error); // console.log(error);
}); });
}); });
@@ -533,7 +541,7 @@ export default {
//this.$router.push("http://localhost:8080/#/"); //this.$router.push("http://localhost:8080/#/");
//扫一扫 //扫一扫
ZWJSBridge.scan({ type: "qrCode" }) ZWJSBridge.scan({ type: "qrCode" })
.then((data) => { .then(data => {
// data =>{"text" : "扫描到的内容"} // data =>{"text" : "扫描到的内容"}
if (data.text.indexOf("http") > -1) { if (data.text.indexOf("http") > -1) {
window.location.replace(data.text); window.location.replace(data.text);
@@ -542,15 +550,15 @@ export default {
message: data.text, message: data.text,
duration: 3000, duration: 3000,
type: "info", type: "info",
center: true, center: true
}); });
} }
}) })
.catch((error) => { .catch(error => {
console.log(error); console.log(error);
}); });
}, }
}, }
}; };
</script> </script>