|
@@ -25,6 +25,17 @@
|
|
|
<img src="/images/all/songguo.png">
|
|
|
<a @click="goWebChat()" class="contact_btn">联系卖家</a>
|
|
|
</span>
|
|
|
+ <div class="share">
|
|
|
+ <span @click="setShowShare(!showShare, $event)">生成手机版链接</span>
|
|
|
+ <div v-if="showShare">
|
|
|
+ <i class="icon-guanbi1 iconfont" @click="setShowShare(false, $event)"></i>
|
|
|
+ <h1>分享链接</h1>
|
|
|
+ <p>随时随地使用手机查看店铺现货</p>
|
|
|
+ <vue-q-art :config="config"></vue-q-art>
|
|
|
+ <input :value="url" readonly>
|
|
|
+ <span id="copyLink" :data-clipboard-text="url">复制链接</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="clearfix"></div>
|
|
@@ -70,17 +81,44 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import Clipboard from 'clipboard'
|
|
|
import SearchBox from '~components/main/Search.vue'
|
|
|
export default {
|
|
|
name: 'store-header',
|
|
|
data () {
|
|
|
return {
|
|
|
isOpen: false,
|
|
|
- dialogVisible: false
|
|
|
+ dialogVisible: false,
|
|
|
+ clipboard: {},
|
|
|
+ showShare: false
|
|
|
+// config: {
|
|
|
+// value: 'https://www.baidu.com',
|
|
|
+// imagePath: '/images/all/default.png',
|
|
|
+// filter: 'color'
|
|
|
+// }
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
- SearchBox
|
|
|
+ SearchBox,
|
|
|
+ VueQArt: (resolve) => {
|
|
|
+ require(['vue-qart'], resolve)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ let _this = this
|
|
|
+ _this.url = window.location.href
|
|
|
+ _this.clipboard = new Clipboard('#copyLink')
|
|
|
+ _this.clipboard.on('success', e => {
|
|
|
+ _this.clipboard.destroy()
|
|
|
+ _this.$message.success('已复制到剪切板')
|
|
|
+ })
|
|
|
+ _this.clipboard.on('error', e => {
|
|
|
+ _this.$message.error('浏览器不支持自动复制,请手动复制')
|
|
|
+ _this.clipboard.destroy()
|
|
|
+ })
|
|
|
+ document.addEventListener('click', function () {
|
|
|
+ _this.showShare = false
|
|
|
+ })
|
|
|
},
|
|
|
computed: {
|
|
|
storeInfo () {
|
|
@@ -94,6 +132,20 @@ export default {
|
|
|
},
|
|
|
tab () {
|
|
|
return this.$store.state.chat.tab.tab.data
|
|
|
+ },
|
|
|
+ url: {
|
|
|
+ get: function () {
|
|
|
+ return '/mobile/share/storeShare/' + this.storeInfo.uuid
|
|
|
+ },
|
|
|
+ set: function () {
|
|
|
+ }
|
|
|
+ },
|
|
|
+ config () {
|
|
|
+ return {
|
|
|
+ value: this.url,
|
|
|
+ imagePath: '/images/all/default.png',
|
|
|
+ filter: 'color'
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -177,6 +229,10 @@ export default {
|
|
|
newTab.location.href = 'https://im.ubtob.com/chat/visit?gid=' + response.data.content
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ setShowShare: function (flag, event) {
|
|
|
+ event.stopPropagation()
|
|
|
+ this.showShare = flag
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -475,4 +531,50 @@ export default {
|
|
|
background: #ef7f03;
|
|
|
border-radius: 2px;
|
|
|
}
|
|
|
+ .icon-style .share {
|
|
|
+ display: inline-block;
|
|
|
+ margin-left: 5px;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+ .icon-style .share > span {
|
|
|
+ color: #4290f7;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .icon-style .share > div {
|
|
|
+ position: absolute;
|
|
|
+ top: 26px;
|
|
|
+ left: -94px;
|
|
|
+ width: 300px;
|
|
|
+ height: 380px;
|
|
|
+ background: #fff;
|
|
|
+ box-shadow: 1px 1px 4px 0 #ccbebe;
|
|
|
+ z-index: 1;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .icon-style .share > div input {
|
|
|
+ display: inline-block;
|
|
|
+ width: 140px;
|
|
|
+ overflow: hidden;
|
|
|
+ height: 35px;
|
|
|
+ vertical-align: middle;
|
|
|
+ }
|
|
|
+ .icon-style .share > div span {
|
|
|
+ display: inline-block;
|
|
|
+ color: #fff;
|
|
|
+ background: #4290f7;
|
|
|
+ height: 36px;
|
|
|
+ line-height: 36px;
|
|
|
+ width: 70px;
|
|
|
+ font-style: normal;
|
|
|
+ vertical-align: middle;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .icon-style .share > div i {
|
|
|
+ position: absolute;
|
|
|
+ right: 10px;
|
|
|
+ top: 5px;
|
|
|
+ cursor: pointer;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
</style>
|