|
@@ -27,13 +27,13 @@
|
|
|
</span>
|
|
|
<div class="share">
|
|
|
<span @click="setShowShare(!showShare, $event)">生成手机版链接</span>
|
|
|
- <div v-if="showShare">
|
|
|
+ <div v-show="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="hrefUrl" readonly>
|
|
|
- <span id="copyLink" :data-clipboard-text="hrefUrl">复制链接</span>
|
|
|
+ <canvas id="qrccode-canvas"></canvas>
|
|
|
+ <input v-if="showShare" :value="url" readonly>
|
|
|
+ <span v-if="showShare" id="copyLink" :data-clipboard-text="url">复制链接</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -83,6 +83,9 @@
|
|
|
<script>
|
|
|
import Clipboard from 'clipboard'
|
|
|
import SearchBox from '~components/main/Search.vue'
|
|
|
+
|
|
|
+let QRCode = require('qrcode')
|
|
|
+
|
|
|
export default {
|
|
|
name: 'store-header',
|
|
|
data () {
|
|
@@ -90,20 +93,11 @@ export default {
|
|
|
isOpen: false,
|
|
|
dialogVisible: false,
|
|
|
clipboard: {},
|
|
|
- showShare: false,
|
|
|
- hrefUrl: 'https://www.usoftmall.com'
|
|
|
-// config: {
|
|
|
-// value: 'https://www.baidu.com',
|
|
|
-// imagePath: '/images/all/default.png',
|
|
|
-// filter: 'color'
|
|
|
-// }
|
|
|
+ showShare: false
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
- SearchBox,
|
|
|
- VueQArt: (resolve) => {
|
|
|
- require(['vue-qart'], resolve)
|
|
|
- }
|
|
|
+ SearchBox
|
|
|
},
|
|
|
mounted () {
|
|
|
let _this = this
|
|
@@ -136,21 +130,23 @@ export default {
|
|
|
},
|
|
|
url: {
|
|
|
get: function () {
|
|
|
- this.hrefUrl = window.location.protocol + '//' + window.location.host + '/mobile/share/storeShare/' + this.storeInfo.uuid
|
|
|
- return '/mobile/share/storeShare/' + this.storeInfo.uuid
|
|
|
+ return window.location.protocol + '//' + window.location.host + '/mobile/share/storeShare/' + this.storeInfo.uuid
|
|
|
},
|
|
|
set: function () {
|
|
|
}
|
|
|
- },
|
|
|
- config () {
|
|
|
- return {
|
|
|
- value: window.location.protocol + '//' + window.location.host + this.url,
|
|
|
- imagePath: '/images/all/default.png',
|
|
|
- filter: 'color'
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ loadQRcode: function () {
|
|
|
+ let canvas = document.getElementById('qrccode-canvas')
|
|
|
+ QRCode.toCanvas(canvas, this.url, (error) => {
|
|
|
+ if (error) {
|
|
|
+ console.log(error)
|
|
|
+ } else {
|
|
|
+ console.log('QRcode success')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
closeDropDown () {
|
|
|
this.isOpen = false
|
|
|
},
|
|
@@ -234,6 +230,7 @@ export default {
|
|
|
},
|
|
|
setShowShare: function (flag, event) {
|
|
|
event.stopPropagation()
|
|
|
+ this.loadQRcode()
|
|
|
this.showShare = flag
|
|
|
}
|
|
|
}
|