3e4494f5 by joe

接入产品cms

1 parent c549c0a9
......@@ -80,6 +80,7 @@ module.exports = {
newsList : "/pingan_hklife_webapi/cms/news/list",
newsDetail : "/pingan_hklife_webapi/cms/news/get",
companyOutline : "/pingan_hklife_webapi/cms/company/outline",
productInfo : "/pingan_hklife_webapi/cms/product",
config : "/pingan_hklife_webapi/config"
}
\ No newline at end of file
......
......@@ -23,17 +23,17 @@ export default {
loading: false,
showTips: false,
data: {
firstName: "玛丽",
lastName: "何",
birthDate: "1999-07-15",
idNo: "H4099030",
idType: "40"
// firstName: "玛丽",
// lastName: "何",
// birthDate: "1999-07-15",
// idNo: "H4099030",
// idType: "40"
// firstName: "",
// lastName: "",
// birthDate: "",
// idNo: "",
// idType: ""
firstName: "",
lastName: "",
birthDate: "",
idNo: "",
idType: ""
}
}
},
......
......@@ -37,6 +37,10 @@ export default {
playerOptions: {},
bannerTipsVisible: true,
productList: [],
// 全部的信息
sourceData: {},
bottomBtnType: "",
bottomBtnLink: ""
}
},
components: {},
......@@ -59,54 +63,59 @@ export default {
onHideBannerTipsHandler() {
this.bannerTipsVisible = false;
},
fetchBanner() {
return new Promise((resolve, reject) => {
httpPost({
url: api.banner
}).then(res => {
resolve(res);
});
});
},
fetchIndexVideo() {
return new Promise((resolve, reject) => {
httpPost({
url: api.indexVideo
}).then(res => {
sessionStorage.setItem("_video_url", res.videoUrl);
sessionStorage.setItem("_poster_url", res.posterUrl);
resolve(res);
});
// fetchBanner() {
// return new Promise((resolve, reject) => {
// httpPost({
// url: api.banner
// }).then(res => {
// resolve(res);
// });
// });
// },
// fetchIndexVideo() {
// return new Promise((resolve, reject) => {
// httpPost({
// url: api.indexVideo
// }).then(res => {
// sessionStorage.setItem("_video_url", res.videoUrl);
// sessionStorage.setItem("_poster_url", res.posterUrl);
// resolve(res);
// });
// });
// },
bottomBtnHandle() {
this.btnNavigateTo(this.bottomBtnType, this.bottomBtnLink);
},
btnNavigateTo(type, link) {
switch (type) {
case "none":
break;
case "news":
this.$router.push({
path: "/news/detail",
query: {
c: link
}
});
},
refreshBanner() {
let key = this.locale;
if (key == "zh") {
key = "cn";
break;
case "product":
break;
case "vhis":
this.$router.push({
path: "/vhis",
query: {
p: link
}
let bannerList = [];
this.bannerCandidateList.forEach(element => {
bannerList.push(element[key]);
});
bannerList = [{
pcBannerUrl: "@/assets/images/vhis/kv.png",
mobileBannerUrl: "@/assets/images/vhis/kv.png",
btns: [{
n: "立即報價",
c: "#f05a23",
t: "vhis",
l: "endowment",
}]
}]
this.$set(this, 'bannerList', bannerList);
console.log("bannerList:", bannerList);
break;
default:
location.href = link;
break;
}
},
refreshVideoPlayer() {
let videoUrl = sessionStorage.getItem("_video_url");
let posterUrl = sessionStorage.getItem("_poster_url");
refreshVideoPlayer(videoUrl, posterUrl) {
// let videoUrl = sessionStorage.getItem("_video_url");
// let posterUrl = sessionStorage.getItem("_poster_url");
let playerOptions = {
width: 800,
height: 450,
......@@ -157,19 +166,63 @@ export default {
},
initData() {
this.initProduct();
this.fetchBanner().then(res => {
this.bannerCandidateList = res;
this.refreshBanner();
});
this.fetchIndexVideo().then(res => {
this.refreshVideoPlayer();
});
},
let targetData = null;
switch (this.locale) {
case "zh":
targetData = this.sourceData.confCn;
break;
case "en":
targetData = this.sourceData.confEn;
break;
case "tc":
targetData = this.sourceData.confTc;
break;
}
if (targetData) {
let bannerList = [{
pcBannerUrl: targetData.pcBannerUrl,
mobileBannerUrl: targetData.mobileBannerUrl,
btns: targetData.btnDescribe
}];
this.$set(this, 'bannerList', bannerList);
console.log(this.bannerList);
this.refreshVideoPlayer(targetData.videoUrl, targetData.videoPlayer);
// 设置标题
document.title = targetData.productName;
this.bottomBtnType = targetData.bottomUrlType;
this.bottomBtnLink = targetData.bottomUrlLink;
}
// this.fetchBanner().then(res => {
// this.bannerCandidateList = res;
// this.refreshBanner();
// });
// this.fetchIndexVideo().then(res => {
// this.refreshVideoPlayer();
// });
},
initActivity() {
let d = localStorage.getItem("voluntaryInfo");
if (d) {
try {
this.sourceData = JSON.parse(d);
this.initData();
} catch (e) {
}
}
}
},
mounted() {
this.initData();
this.initActivity();
},
created() {
httpGet({ url: api.productInfo, data: { code: "voluntary" } }).then(res => {
if (res) {
localStorage.setItem("voluntaryInfo", JSON.stringify(res));
this.sourceData = res;
}
this.initData();
})
}
}
......
......@@ -7,8 +7,8 @@
<div class="banner banner-pc">
<swiper :options="swiperOption">
<swiper-slide v-for="(item,index) in bannerList" :key="index">
<!-- <img class="banner-img" :src="item.pcBannerUrl"> -->
<img :src="require('@/assets/images/vhis/kv.png')">
<img class="banner-img" :src="item.pcBannerUrl">
<!-- <img :src="require('@/assets/images/vhis/kv.png')"> -->
<div class="btn-wrap">
<div v-for="(btnItem, btnIndex) in item.btns" :key="btnIndex">
<div class="banner-btn" v-if="btnItem.n && btnItem.t && btnItem.c" @click="btnNavigateTo(btnItem.t,btnItem.l)" :style="{backgroundColor:btnItem.c}">{{btnItem.n}}</div>
......@@ -166,7 +166,7 @@
</div>
<!-- 立即投保 -->
<div class="submit-btn">
<div class="submit-btn" @click="bottomBtnHandle()">
立即投保
</div>
......