|
@@ -39,9 +39,10 @@
|
|
|
<div class="m-html" v-html="detail.content"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="j-footer">
|
|
|
+ <div class="j-footer" ref="footer">
|
|
|
<div class="j-button-group">
|
|
|
- <button class="j-button-confirm" @click="goBuy(detail.id)">立即购买</button>
|
|
|
+ <!-- <button class="j-button-confirm" data-need-bind-phone @click="goBuy(detail.id)">立即购买</button> -->
|
|
|
+ <button class="j-button-confirm" data-need-bind-phone>立即购买</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -51,6 +52,8 @@
|
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
|
import { mapMutations, mapActions } from 'vuex'
|
|
|
import { Skeleton } from 'vant'
|
|
|
+declare const $: any
|
|
|
+
|
|
|
@Component({
|
|
|
name: 'detail',
|
|
|
components: {
|
|
@@ -72,6 +75,15 @@ export default class Home extends Vue {
|
|
|
protected saveReportInfo!: any
|
|
|
protected clearBuyState!: any
|
|
|
|
|
|
+ injectBindPhoneScript = {
|
|
|
+ wx: [
|
|
|
+ '/js/check-bind-phone.js'
|
|
|
+ ],
|
|
|
+ app: [
|
|
|
+ '/jyapp/js/check-bind-phone.js'
|
|
|
+ ]
|
|
|
+ }
|
|
|
+
|
|
|
skeletonShow = true
|
|
|
// detail = {
|
|
|
// id: 12,
|
|
@@ -107,18 +119,31 @@ export default class Home extends Vue {
|
|
|
if (res.error_code === 0 && res.data) {
|
|
|
this.detail = res.data
|
|
|
this.skeletonShow = false
|
|
|
+ this.$nextTick(() => this.loadScript(this.injectBindPhoneScript[this.$env.platform]))
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ $('.j-button-confirm').on('click', () => this.goBuy(this.detail.id))
|
|
|
}
|
|
|
|
|
|
goBuy (id) {
|
|
|
this.saveReportInfo(this.detail)
|
|
|
if (this.disWord) {
|
|
|
- this.$router.push(`/buy/${id}?disWord=${this.disWord}`)
|
|
|
+ this.$router.push(`/buy/${id}?disWord=${this.disWord}&t=${+new Date()}`)
|
|
|
} else {
|
|
|
- this.$router.push(`/buy/${id}`)
|
|
|
+ this.$router.push(`/buy/${id}?t=${+new Date()}`)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ loadScript (urls) {
|
|
|
+ if (!urls) return console.log('urls为空')
|
|
|
+ const dom: any = this.$refs.footer
|
|
|
+ urls.forEach(item => {
|
|
|
+ const script = document.createElement('script')
|
|
|
+ script.src = `${item}?v=${+new Date()}`
|
|
|
+ dom.parentNode.insertBefore(script, dom)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss">
|