Commit 2177fc7a30efc46d865c50387f84397fc3188e94

Authored by zhiyangdu
1 parent 3b9e490f

分享参数获取

Showing 1 changed file with 36 additions and 15 deletions
src/pages/index/index.vue
1 <template> 1 <template>
2 <div> 2 <div>
  3 + <!-- H5唤起App组件 -->
  4 + <call-app-box v-if="!isCNLive.value"
  5 + :callApps="$parent.callApps">
  6 + </call-app-box>
3 <div class="box"> 7 <div class="box">
4 <div class="btn_box"> 8 <div class="btn_box">
5 <div @click="link(1)" class="btn"> 9 <div @click="link(1)" class="btn">
@@ -23,6 +27,7 @@ @@ -23,6 +27,7 @@
23 </template> 27 </template>
24 28
25 <script> 29 <script>
  30 + import callAppBox from "@/components/callAppBox/callAppBox";
26 export default { 31 export default {
27 name: 'index', 32 name: 'index',
28 data () { 33 data () {
@@ -30,28 +35,44 @@ @@ -30,28 +35,44 @@
30 35
31 } 36 }
32 }, 37 },
  38 + components: {
  39 + callAppBox
  40 + },
33 created(){ 41 created(){
34 document.title = "大众体育" 42 document.title = "大众体育"
35 }, 43 },
  44 + mounted(){
  45 + // 获取并设置分享参数
  46 + this.$parent.getShareData({
  47 + type: 23,
  48 + id: 1,
  49 + url: ""
  50 + });
  51 + },
36 methods: { 52 methods: {
37 link(index){ 53 link(index){
38 - var items;  
39 - if(index==1){  
40 - items={  
41 - "title": "线上赛事",  
42 - "type": "29",  
43 - "shop_type": "",  
44 - "to": "0"  
45 - }  
46 - }else if(index==2){  
47 - items={  
48 - "title": "线下赛事",  
49 - "type": "30",  
50 - "shop_type": "{\"id\":\"3\",\"title\":\"\\u7ebf\\u4e0b\\u8d5b\\u4e8b\"}",  
51 - "to": this.getParams(this.mode).shop.apiAddress + "/html/sports-china/1/#/", 54 + // 区分app内点击还是app外点击
  55 + if(this.isCNLive.value){
  56 +
  57 + }else {
  58 + var items;
  59 + if(index==1){
  60 + items={
  61 + "title": "线上赛事",
  62 + "type": "29",
  63 + "shop_type": "",
  64 + "to": "0"
  65 + }
  66 + }else if(index==2){
  67 + items={
  68 + "title": "线下赛事",
  69 + "type": "30",
  70 + "shop_type": "{\"id\":\"3\",\"title\":\"\\u7ebf\\u4e0b\\u8d5b\\u4e8b\"}",
  71 + "to": this.getParams(this.mode).shop.apiAddress + "/html/sports-china/1/#/",
  72 + }
52 } 73 }
  74 + this.$parent.gotoDetail(items)
53 } 75 }
54 - this.$parent.gotoDetail(items)  
55 76
56 } 77 }
57 } 78 }