Files
zsxt_nbzs_h5/FrontCode2/sunshine_levy/src/views/policyInfo/policyInfo.vue

125 lines
3.0 KiB
Vue

<template>
<div
class="container"
v-loading="loading"
element-loading-text="页面加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="#FFFFFF"
>
<div class="title">{{ info.title }}</div>
<div class="date">{{ modifyDate(info.publicTime) }}</div>
<hr />
<div class="content"></div>
</div>
</template>
<script>
import { mgop } from "@aligov/jssdk-mgop";
import { changeBottomStyle } from "@/olderMode/1.js";
import $ from "jquery";
export default {
data() {
return {
loading: true,
info: {
title: "无数据",
publicTime: "无数据"
}
};
},
created() {
if (sessionStorage.getItem("mode") == "older") {
changeBottomStyle();
}
this.onInit();
},
mounted() {
if (sessionStorage.getItem("mode") == "older") {
$(".container").addClass("old_container");
}
},
methods: {
// 获取数据
onInit() {
if (this.$route.params.id) {
window.sessionStorage.setItem("zszcId", this.$route.params.id);
}
mgop({
api: "mgop.kykj.houseexpropriat.getpoliciesinfo",
host: "https://mapi.zjzwfw.gov.cn/",
dataType: "JSON",
type: "POST",
data: {
ticket: window.sessionStorage.getItem("ticket"),
id: window.sessionStorage.getItem("zszcId")
},
appKey: "es4b8zmz+2001833218+dehllx",
onSuccess: data => {
this.loading = false;
if (data.data.success) {
const { data: res } = data;
this.info = res.data;
let content = document.querySelector(".content");
content.innerHTML = res.data.contents;
} else {
let code = [6501, 6001];
if (code.indexOf(data.data.bizCode) != -1) {
this.$message({
message: "请求超时,请重新登录",
duration: 3000,
type: "info",
center: true
});
setTimeout(() => {
window.location.replace(
"https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=fwzs"
);
}, 3000);
} else {
this.$message({
message: "请求出错",
duration: 3000,
type: "error",
center: true
});
}
}
},
onFail: function(err) {
this.loading = false;
this.$notify({
title: "错误",
message: "请求失败",
type: "error",
duration: 3000
});
}
});
},
modifyDate(date) {
return (date + "").substr(0, 10);
}
}
};
</script>
<style lang="less" scoped>
.container {
padding: 20px;
.title {
text-align: center;
font-weight: bolder;
font-size: 16px;
}
.date {
text-align: center;
margin: 10px 0;
font-size: 16px;
}
}
.old_container {
.title,
.date {
font-size: 22px;
}
}
</style>