diff --git a/App.vue b/App.vue index 36c1cff..7c86708 100644 --- a/App.vue +++ b/App.vue @@ -1,7 +1,30 @@ + + diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index 0bfab77..1614240 100644 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -1,6 +1,6 @@ @@ -14,11 +14,42 @@ export default { uni.navigateTo({ url: '/pages/answer/answer' }) + }, + + async getDetail (id) { + const res = await this.$u.api.baseFormShow({ + table_name: 'map_points', + 'with_relations[0]': 'image', + 'with_relations[1]': 'video', + id + }) + + return res + }, + async getVrs (id) { + const res = await this.$u.api.baseFormIndex({ + table_name: 'map_point_contents', + 'with_relations[0]': 'image', + 'with_relations[1]': 'video', + 'filter[0][key]': 'map_point_id', + 'filter[0][op]': 'eq', + 'filter[0][value]': id + }) + + return res } }, - onLoad() { + onLoad(option) { window.toAnswer = this.toAnswer - } + + this.$nextTick(() => { + this.$refs['iframe'].onload = async () => { + let detail = await this.getDetail(option.id) + let vrs = await this.getVrs(option.id) + this.$refs['iframe'].contentWindow.setDomData({ detail , vrs }) + } + }) + }, } diff --git a/pages/map/map.vue b/pages/map/map.vue index a06109a..c19fd79 100644 --- a/pages/map/map.vue +++ b/pages/map/map.vue @@ -13,9 +13,9 @@ v-for="(item, index) in pointers" :key="index" :style="{ 'transform': `translate(calc(${area.w * item.x / 100}px - 50%),calc(${area.h * item.y / 100}px - 50%))` }" - @click="$u.throttle(toDetail)"> + @click="$u.throttle(() => toDetail(index))">
- +
@@ -23,7 +23,7 @@ :style="{ 'transform': translateText(item.d) }"> - 苏州革命博物馆 + {{ item.name }} @@ -100,15 +100,41 @@ export default { }; }, methods: { - toDetail () { + toDetail (id) { uni.navigateTo({ - url: '/pages/detail/detail' + url: `/pages/detail/detail?id=${id}` }) }, load () { this.area.w = this.$refs['image'].getBoundingClientRect().width this.area.h = this.$refs['image'].getBoundingClientRect().height + }, + + async getPoints () { + function convertToEquivalentAngle(angle) { + if (angle > 180) { + return angle - 360; + } else if (angle < -180) { + return angle + 360; + } else { + return angle; + } + } + this.pointers = [] + const res = await this.$u.api.baseFormIndex({ + table_name: 'map_points', + with_relations: ['image'] + }) + this.pointers = res.data.map((i, index) => { + return { + name: i.name, + x: typeof i.x === 'string' ? Number(i.x) : 0, + y: typeof i.y === 'string' ? Number(i.y) : 0, + d: convertToEquivalentAngle(30 * index + 1), + image: i.image + } + }) } }, @@ -130,6 +156,9 @@ export default { }, mounted() { + }, + onShow() { + this.getPoints() } } diff --git a/static/certificate-bkg.png b/static/certificate-bkg.png new file mode 100644 index 0000000..706e3b7 Binary files /dev/null and b/static/certificate-bkg.png differ diff --git a/static/certificate-word.png b/static/certificate-word.png new file mode 100644 index 0000000..a1577ac Binary files /dev/null and b/static/certificate-word.png differ diff --git a/static/html/explanation.html b/static/html/explanation.html index 85ae6c4..a102272 100644 --- a/static/html/explanation.html +++ b/static/html/explanation.html @@ -241,7 +241,7 @@ timer = setInterval(function() { index = ($(".swiper-btn li.on").index() + 1) % length; console.log(index); - $('..swiper-btn li').eq(index).stop().addClass('on'); + $('.swiper-btn li').eq(index).stop().addClass('on'); $('.swiper-btn li').eq(index).siblings('li').stop().removeClass('on'); $('.swiper-list[data-num=' + index + ']').stop().fadeIn().siblings(".swiper-list").stop().hide(); if(index == 0){ @@ -304,6 +304,10 @@ }); + function setDomData (obj) { + let { detail, vrs } = obj; + console.log($('.newstext').children('p')[1].innerHTML = obj.a) + } diff --git a/static/html/skin/default/css/css.css b/static/html/skin/default/css/css.css index 4a69aba..ca050fd 100644 --- a/static/html/skin/default/css/css.css +++ b/static/html/skin/default/css/css.css @@ -142,7 +142,7 @@ textarea::-webkit-input-placeholder{ color:#aaa; } -moz-box-sizing: border-box; } .common-title img{ - + } .vrbox{ margin-top: -1rem; @@ -243,7 +243,7 @@ textarea::-webkit-input-placeholder{ color:#aaa; } background-image: url(../images/bg1.png); background-repeat: no-repeat; background-position: left center; - + } .study-party{ float: left; @@ -319,7 +319,7 @@ textarea::-webkit-input-placeholder{ color:#aaa; } width: 30.511%; } -.studyContent{ +.studyContent{ padding: 1.8rem 1.6rem; } .tit-top{ @@ -359,8 +359,8 @@ textarea::-webkit-input-placeholder{ color:#aaa; } background: -moz-linear-gradient(rgba(255,255,255,.8), rgba(255,255,255,1)); background: -o-linear-gradient(rgba(255,255,255,.8), rgba(255,255,255,1)); background: -webkit-linear-gradient(rgba(255,255,255,.8), rgba(255,255,255,1)); - -} + +} .lookMore::after{ content: " "; display: inline-block; diff --git a/store/index.js b/store/index.js index 5581918..a8e4cc6 100644 --- a/store/index.js +++ b/store/index.js @@ -33,7 +33,7 @@ const store = new Vuex.Store({ // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量 // 加上vuex_前缀,是防止变量名冲突,也让人一目了然 vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {}, - vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '', + vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '1945|mGcboS5ApGYxvWUUJNk2ytorapfOU18d20AgiXqJ', // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 vuex_version: '1.0.0', },