|
@@ -0,0 +1,158 @@
|
|
|
+<template>
|
|
|
+ <div id="guide-button">
|
|
|
+ <template v-if="showButtonList">
|
|
|
+ <div id="old-exhibition">
|
|
|
+ <img class="exbutton"
|
|
|
+ id='bt1'
|
|
|
+ src="@/assets/images/exbutton.png"/>
|
|
|
+ <div class="button-text black-text">
|
|
|
+ <a :href="oldUrl">往届博博会</a></div></div>
|
|
|
+ <div id="cloud-exhibition">
|
|
|
+ <img class="exbutton"
|
|
|
+ id='bt2'
|
|
|
+ src="@/assets/images/exbutton.png"/>
|
|
|
+ <div class="button-text black-text">
|
|
|
+ <a :href="cloudUrl">参加云展</a></div></div>
|
|
|
+ </template>
|
|
|
+ <div id="mainbutton" >
|
|
|
+ <img class="exbutton"
|
|
|
+ @touchstart='goStart'
|
|
|
+ @touchmove='goMove'
|
|
|
+ @touchend="goEnd"
|
|
|
+ id='bt3'
|
|
|
+ src="@/assets/images/mainbutton.png"/>
|
|
|
+ <div class="button-text"><a :href="clickUrl">点击看展</a></div>
|
|
|
+ <img :class="[showButtonList?'':'arrowDown','arrow']"
|
|
|
+ src="@/assets/images/arrow.png"
|
|
|
+ @click.self="buttonList"></div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name:'GuideButton',
|
|
|
+ data(){
|
|
|
+ return{
|
|
|
+ showButtonList:false,
|
|
|
+ cloudUrl:'http://www.expo-museums.com/Index/column/id/162',
|
|
|
+ oldUrl:'http://www.expo-museums.com/Index/history/column/143',
|
|
|
+ clickUrl:'',
|
|
|
+ startTime:0,
|
|
|
+ endTime:0,
|
|
|
+ hit:false,
|
|
|
+ timeOutEvent: 0 // 长按事件定时器
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ buttonList(){
|
|
|
+ this.showButtonList = !this.showButtonList;
|
|
|
+ console.log('buttonlist',this.showButtonList);
|
|
|
+ },
|
|
|
+ goStart(event) {
|
|
|
+ let _this = this;
|
|
|
+ event.preventDefault();
|
|
|
+ clearTimeout(_this.timeOutEvent);
|
|
|
+ // 开始触摸
|
|
|
+ _this.timeOutEvent = setTimeout(() => {
|
|
|
+ // 长按3秒
|
|
|
+
|
|
|
+ _this.timeOutEvent = 0
|
|
|
+ console.log('处理长按事件');
|
|
|
+ this.showButtonList = true;
|
|
|
+ }, 2000)
|
|
|
+ },
|
|
|
+ goMove(event) {
|
|
|
+ event.preventDefault();
|
|
|
+ // 看具体需求
|
|
|
+ // clearTimeout(this.timeOutEvent)
|
|
|
+ // this.timeOutEvent = 0
|
|
|
+ console.log(event.targetTouches);
|
|
|
+ let touch = event.targetTouches[0];
|
|
|
+ var ele = document.elementFromPoint(touch.pageX, touch.pageY);
|
|
|
+ // console.log(event.changedTouches);
|
|
|
+ console.log('移动中',ele);
|
|
|
+ },
|
|
|
+ goEnd(){
|
|
|
+ let _this = this;
|
|
|
+ clearTimeout(this.timeOutEvent)
|
|
|
+ if(_this.timeOutEvent !== 0){
|
|
|
+ console.log('处理单击事件')
|
|
|
+ }else{
|
|
|
+ console.log('处理长按结束事件');
|
|
|
+ this.showButtonList = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+#guide-button>div:hover .button-text{
|
|
|
+ color:#ffffff;
|
|
|
+}
|
|
|
+#mainbutton {
|
|
|
+ position: absolute;
|
|
|
+ top:5.6rem;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 18.9rem;
|
|
|
+ height: 4.3rem;
|
|
|
+ z-index:9999;
|
|
|
+ /* background: linear-gradient(180deg, #D16914, transparent);
|
|
|
+ border-radius: 6px;
|
|
|
+ opacity: 0.8; */
|
|
|
+}
|
|
|
+.arrow{
|
|
|
+ position: inherit;
|
|
|
+ top:30%;
|
|
|
+ right:1.7rem;
|
|
|
+ width:1.2rem;
|
|
|
+}
|
|
|
+.arrow.arrowDown{
|
|
|
+ transform-origin: center;
|
|
|
+ transform:rotate(180deg);
|
|
|
+
|
|
|
+}
|
|
|
+.exbutton{
|
|
|
+ width:18.9rem;
|
|
|
+ opacity: 0.8;
|
|
|
+}
|
|
|
+div.button-text{
|
|
|
+ position:absolute;
|
|
|
+ top:40%; left:50%;
|
|
|
+ transform:translate(-50%,-50%);
|
|
|
+ display: block;
|
|
|
+ text-align: center;
|
|
|
+ font-weight: normal;
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 1rem;
|
|
|
+ font-family: "Microsoft YaHei", "serif";
|
|
|
+ opacity: 1;
|
|
|
+}
|
|
|
+div.black-text{
|
|
|
+ color:#000000;
|
|
|
+}
|
|
|
+#cloud-exhibition{
|
|
|
+ position: absolute;
|
|
|
+ top:2.8rem;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 18.9rem;
|
|
|
+ height: 4.3rem;
|
|
|
+ z-index:999;
|
|
|
+}
|
|
|
+#old-exhibition{
|
|
|
+ position: absolute;
|
|
|
+ top:0;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 18.9rem;
|
|
|
+ height: 4.3rem;
|
|
|
+ z-index:999;
|
|
|
+}
|
|
|
+a{
|
|
|
+ text-decoration: inherit;
|
|
|
+ color:inherit;
|
|
|
+}
|
|
|
+</style>
|