接入产品cms
Showing
4 changed files
with
121 additions
and
67 deletions
... | @@ -80,6 +80,7 @@ module.exports = { | ... | @@ -80,6 +80,7 @@ module.exports = { |
80 | newsList : "/pingan_hklife_webapi/cms/news/list", | 80 | newsList : "/pingan_hklife_webapi/cms/news/list", |
81 | newsDetail : "/pingan_hklife_webapi/cms/news/get", | 81 | newsDetail : "/pingan_hklife_webapi/cms/news/get", |
82 | companyOutline : "/pingan_hklife_webapi/cms/company/outline", | 82 | companyOutline : "/pingan_hklife_webapi/cms/company/outline", |
83 | productInfo : "/pingan_hklife_webapi/cms/product", | ||
83 | 84 | ||
84 | config : "/pingan_hklife_webapi/config" | 85 | config : "/pingan_hklife_webapi/config" |
85 | } | 86 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -23,17 +23,17 @@ export default { | ... | @@ -23,17 +23,17 @@ export default { |
23 | loading: false, | 23 | loading: false, |
24 | showTips: false, | 24 | showTips: false, |
25 | data: { | 25 | data: { |
26 | firstName: "玛丽", | 26 | // firstName: "玛丽", |
27 | lastName: "何", | 27 | // lastName: "何", |
28 | birthDate: "1999-07-15", | 28 | // birthDate: "1999-07-15", |
29 | idNo: "H4099030", | 29 | // idNo: "H4099030", |
30 | idType: "40" | 30 | // idType: "40" |
31 | 31 | ||
32 | // firstName: "", | 32 | firstName: "", |
33 | // lastName: "", | 33 | lastName: "", |
34 | // birthDate: "", | 34 | birthDate: "", |
35 | // idNo: "", | 35 | idNo: "", |
36 | // idType: "" | 36 | idType: "" |
37 | } | 37 | } |
38 | } | 38 | } |
39 | }, | 39 | }, | ... | ... |
... | @@ -37,6 +37,10 @@ export default { | ... | @@ -37,6 +37,10 @@ export default { |
37 | playerOptions: {}, | 37 | playerOptions: {}, |
38 | bannerTipsVisible: true, | 38 | bannerTipsVisible: true, |
39 | productList: [], | 39 | productList: [], |
40 | // 全部的信息 | ||
41 | sourceData: {}, | ||
42 | bottomBtnType: "", | ||
43 | bottomBtnLink: "" | ||
40 | } | 44 | } |
41 | }, | 45 | }, |
42 | components: {}, | 46 | components: {}, |
... | @@ -59,54 +63,59 @@ export default { | ... | @@ -59,54 +63,59 @@ export default { |
59 | onHideBannerTipsHandler() { | 63 | onHideBannerTipsHandler() { |
60 | this.bannerTipsVisible = false; | 64 | this.bannerTipsVisible = false; |
61 | }, | 65 | }, |
62 | 66 | // fetchBanner() { | |
63 | fetchBanner() { | 67 | // return new Promise((resolve, reject) => { |
64 | return new Promise((resolve, reject) => { | 68 | // httpPost({ |
65 | httpPost({ | 69 | // url: api.banner |
66 | url: api.banner | 70 | // }).then(res => { |
67 | }).then(res => { | 71 | // resolve(res); |
68 | resolve(res); | 72 | // }); |
69 | }); | 73 | // }); |
70 | }); | 74 | // }, |
71 | }, | 75 | // fetchIndexVideo() { |
72 | fetchIndexVideo() { | 76 | // return new Promise((resolve, reject) => { |
73 | return new Promise((resolve, reject) => { | 77 | // httpPost({ |
74 | httpPost({ | 78 | // url: api.indexVideo |
75 | url: api.indexVideo | 79 | // }).then(res => { |
76 | }).then(res => { | 80 | // sessionStorage.setItem("_video_url", res.videoUrl); |
77 | sessionStorage.setItem("_video_url", res.videoUrl); | 81 | // sessionStorage.setItem("_poster_url", res.posterUrl); |
78 | sessionStorage.setItem("_poster_url", res.posterUrl); | 82 | // resolve(res); |
79 | resolve(res); | 83 | // }); |
80 | }); | 84 | // }); |
85 | // }, | ||
86 | bottomBtnHandle() { | ||
87 | this.btnNavigateTo(this.bottomBtnType, this.bottomBtnLink); | ||
88 | }, | ||
89 | btnNavigateTo(type, link) { | ||
90 | switch (type) { | ||
91 | case "none": | ||
92 | break; | ||
93 | case "news": | ||
94 | this.$router.push({ | ||
95 | path: "/news/detail", | ||
96 | query: { | ||
97 | c: link | ||
98 | } | ||
81 | }); | 99 | }); |
82 | }, | 100 | break; |
83 | refreshBanner() { | 101 | case "product": |
84 | let key = this.locale; | 102 | break; |
85 | if (key == "zh") { | 103 | case "vhis": |
86 | key = "cn"; | 104 | this.$router.push({ |
105 | path: "/vhis", | ||
106 | query: { | ||
107 | p: link | ||
87 | } | 108 | } |
88 | let bannerList = []; | ||
89 | this.bannerCandidateList.forEach(element => { | ||
90 | bannerList.push(element[key]); | ||
91 | }); | 109 | }); |
92 | 110 | break; | |
93 | bannerList = [{ | 111 | default: |
94 | pcBannerUrl: "@/assets/images/vhis/kv.png", | 112 | location.href = link; |
95 | mobileBannerUrl: "@/assets/images/vhis/kv.png", | 113 | break; |
96 | btns: [{ | 114 | } |
97 | n: "立即報價", | ||
98 | c: "#f05a23", | ||
99 | t: "vhis", | ||
100 | l: "endowment", | ||
101 | }] | ||
102 | }] | ||
103 | |||
104 | this.$set(this, 'bannerList', bannerList); | ||
105 | console.log("bannerList:", bannerList); | ||
106 | }, | 115 | }, |
107 | refreshVideoPlayer() { | 116 | refreshVideoPlayer(videoUrl, posterUrl) { |
108 | let videoUrl = sessionStorage.getItem("_video_url"); | 117 | // let videoUrl = sessionStorage.getItem("_video_url"); |
109 | let posterUrl = sessionStorage.getItem("_poster_url"); | 118 | // let posterUrl = sessionStorage.getItem("_poster_url"); |
110 | let playerOptions = { | 119 | let playerOptions = { |
111 | width: 800, | 120 | width: 800, |
112 | height: 450, | 121 | height: 450, |
... | @@ -157,19 +166,63 @@ export default { | ... | @@ -157,19 +166,63 @@ export default { |
157 | }, | 166 | }, |
158 | initData() { | 167 | initData() { |
159 | this.initProduct(); | 168 | this.initProduct(); |
160 | this.fetchBanner().then(res => { | 169 | let targetData = null; |
161 | this.bannerCandidateList = res; | 170 | switch (this.locale) { |
162 | this.refreshBanner(); | 171 | case "zh": |
163 | }); | 172 | targetData = this.sourceData.confCn; |
164 | this.fetchIndexVideo().then(res => { | 173 | break; |
165 | this.refreshVideoPlayer(); | 174 | case "en": |
166 | }); | 175 | targetData = this.sourceData.confEn; |
167 | }, | 176 | break; |
177 | case "tc": | ||
178 | targetData = this.sourceData.confTc; | ||
179 | break; | ||
180 | } | ||
181 | if (targetData) { | ||
182 | let bannerList = [{ | ||
183 | pcBannerUrl: targetData.pcBannerUrl, | ||
184 | mobileBannerUrl: targetData.mobileBannerUrl, | ||
185 | btns: targetData.btnDescribe | ||
186 | }]; | ||
187 | this.$set(this, 'bannerList', bannerList); | ||
188 | console.log(this.bannerList); | ||
189 | |||
190 | this.refreshVideoPlayer(targetData.videoUrl, targetData.videoPlayer); | ||
191 | // 设置标题 | ||
192 | document.title = targetData.productName; | ||
193 | |||
194 | this.bottomBtnType = targetData.bottomUrlType; | ||
195 | this.bottomBtnLink = targetData.bottomUrlLink; | ||
196 | } | ||
197 | // this.fetchBanner().then(res => { | ||
198 | // this.bannerCandidateList = res; | ||
199 | // this.refreshBanner(); | ||
200 | // }); | ||
201 | // this.fetchIndexVideo().then(res => { | ||
202 | // this.refreshVideoPlayer(); | ||
203 | // }); | ||
204 | }, | ||
205 | initActivity() { | ||
206 | let d = localStorage.getItem("voluntaryInfo"); | ||
207 | if (d) { | ||
208 | try { | ||
209 | this.sourceData = JSON.parse(d); | ||
210 | this.initData(); | ||
211 | } catch (e) { | ||
212 | } | ||
213 | } | ||
214 | } | ||
168 | }, | 215 | }, |
169 | mounted() { | 216 | mounted() { |
170 | this.initData(); | 217 | this.initActivity(); |
171 | }, | 218 | }, |
172 | created() { | 219 | created() { |
173 | 220 | httpGet({ url: api.productInfo, data: { code: "voluntary" } }).then(res => { | |
221 | if (res) { | ||
222 | localStorage.setItem("voluntaryInfo", JSON.stringify(res)); | ||
223 | this.sourceData = res; | ||
224 | } | ||
225 | this.initData(); | ||
226 | }) | ||
174 | } | 227 | } |
175 | } | 228 | } | ... | ... |
... | @@ -7,8 +7,8 @@ | ... | @@ -7,8 +7,8 @@ |
7 | <div class="banner banner-pc"> | 7 | <div class="banner banner-pc"> |
8 | <swiper :options="swiperOption"> | 8 | <swiper :options="swiperOption"> |
9 | <swiper-slide v-for="(item,index) in bannerList" :key="index"> | 9 | <swiper-slide v-for="(item,index) in bannerList" :key="index"> |
10 | <!-- <img class="banner-img" :src="item.pcBannerUrl"> --> | 10 | <img class="banner-img" :src="item.pcBannerUrl"> |
11 | <img :src="require('@/assets/images/vhis/kv.png')"> | 11 | <!-- <img :src="require('@/assets/images/vhis/kv.png')"> --> |
12 | <div class="btn-wrap"> | 12 | <div class="btn-wrap"> |
13 | <div v-for="(btnItem, btnIndex) in item.btns" :key="btnIndex"> | 13 | <div v-for="(btnItem, btnIndex) in item.btns" :key="btnIndex"> |
14 | <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> | 14 | <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 @@ | ... | @@ -166,7 +166,7 @@ |
166 | </div> | 166 | </div> |
167 | 167 | ||
168 | <!-- 立即投保 --> | 168 | <!-- 立即投保 --> |
169 | <div class="submit-btn"> | 169 | <div class="submit-btn" @click="bottomBtnHandle()"> |
170 | 立即投保 | 170 | 立即投保 |
171 | </div> | 171 | </div> |
172 | 172 | ... | ... |
-
Please register or sign in to post a comment