<template>
|
<div id="app">
|
<router-view />
|
</div>
|
</template>
|
|
<script>
|
import { watch } from "vue";
|
import { setSessionGuid, setNewView, storage } from "./assets/js/userAction";
|
import tool from "./assets/js/toolClass";
|
|
export default {
|
name: "App",
|
data() {
|
return {
|
imgsrc: require("@/assets/images/officialAccount.jpg"),
|
};
|
},
|
created() {
|
// 在移动端打开Pc网站时的提示
|
if (
|
window.navigator.userAgent.match(
|
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
|
)
|
) {
|
this.$alert(
|
"<p style='text-align:left;'>请在PC端打开此网页,或扫描下方二维码关注我社公众号,单击菜单栏中的“教学服务”浏览相关信息、申请样书或下载教材配套的资源。</p><img src='" +
|
this.imgsrc +
|
"'>",
|
"提示",
|
{
|
dangerouslyUseHTMLString: true,
|
center: true,
|
customClass: "msgbox",
|
}
|
);
|
}
|
|
//在页面加载时读取sessionStorage里的状态信息
|
if (sessionStorage.getItem("store")) {
|
this.$store.replaceState(
|
Object.assign(
|
{},
|
this.$store.state,
|
JSON.parse(sessionStorage.getItem("store"))
|
)
|
);
|
sessionStorage.removeItem("store");
|
}
|
|
//在页面刷新时将vuex里的信息保存到sessionStorage里
|
window.addEventListener("beforeunload", () => {
|
sessionStorage.setItem("store", JSON.stringify(this.$store.state));
|
});
|
},
|
watch: {
|
$route(to, from) {
|
// if (to.path.indexOf("AdminLogin") == -1 && from.path.indexOf("AdminLogin") == -1) {
|
// const detailList = ["/bookStore/detail", "teachingServices/detail"];
|
// if (detailList.includes(to.path)) {
|
// if (to.path == "/bookStore/detail") {
|
// setNewView("productId", to.query.id);
|
// } else {
|
// setNewView("cmsItemId", to.query.id);
|
// }
|
// }
|
// let sessionGuid = storage.get("sessionGuid");
|
// const token = tool.getCookie("websiteFrontToken");
|
// if (!sessionGuid) {
|
// setSessionGuid();
|
// }
|
// sessionStorage.setItem("fromPath", from.fullPath.substring(1));
|
// sessionStorage.setItem("toPath", to.fullPath.substring(1));
|
// }
|
},
|
},
|
};
|
</script>
|
|
<style lang="less">
|
@import "~@/assets/css/base.css";
|
@import "~@/assets/css/common.css";
|
|
html,
|
body,
|
#app {
|
width: 100%;
|
height: 100%;
|
background-color: #f1f8f4;
|
.msgbox {
|
width: 380px !important;
|
}
|
}
|
</style>
|
<style lang="less">
|
// 富文本容器,保留富文本默认样式,所见即所得
|
.richTextBox {
|
line-height: 1.4;
|
font-size: 14px;
|
* {
|
margin: revert;
|
padding: revert;
|
border: revert;
|
font: revert;
|
vertical-align: revert;
|
}
|
}
|
</style>
|
<style lang="less" scoped></style>
|