fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!--
 * @Author: wuyue
 * @Date: 2022-11-30 11:44:04
 * @LastEditTime: 2022-12-12 11:14:58
 * @LastEditors: wuyue
 * @Descripttion:下架商品页
 * @version:
-->
<template>
  <div>
    <van-nav-bar title="商品已下架" left-arrow @click-left="onClickLeft" />
    <div class="top-tip">
      <img src="../../assets/images/logo.png" />
      <span class="tip-text">打开五粮液新零售,查看更多商品</span>
      <van-button type="danger" size="mini" @click="isDownloadApp">立即打开</van-button>
    </div>
    <div class="content">
      <img src="../../assets/images/offIcon.png" />
    </div>
    <guide-open :openStatus.sync="openStatus"></guide-open>
  </div>
</template>
<script>
import openAppMixin from './openAppMixin.js'
import guideOpen from '@/components/pop-up/guideOpen.vue'
 
export default {
  mixins: [openAppMixin],
  components: { guideOpen },
  data() {
    return {
      WeiXin: '', // 微信
      flag: true, // pc
      openStatus: false,
    }
  },
  methods: {
    isDownloadApp() {
      this.isWeiXin();
      if (this.WeiXin) {
        this.openStatus = true
      } else {
        // 通用协议地址
        let commSchemeUrl = "uni.wlyxls.commodity.share://wlyxlslaunch?shopspuId=''&enable=false";
        // 首次尝试打开 App 并跳转
        if (this.$root.isIos) {
          commSchemeUrl = `${process.env.VUE_APP_IOS_QRCODE_URL}/home`;
        }
        this.openApp(commSchemeUrl)
        console.log(this.$root.isIos);
      }
    },
    // 点击箭头关闭页面
    onClickLeft() {
      const userAgent = navigator.userAgent;
      this.isWeiXin();
      this.isPc();
      if (this.WeiXin) {
        window.WeixinJSBridge.call('closeWindow');
      }
      if (!this.flag) {
        window.opener = null;
        window.open('about:blank', '_self', '').close();
      }
      if (
        userAgent.includes('Firefox') ||
        userAgent.includes('Chrome')
      ) {
        window.location.href = 'about:blank';
      } else {
        window.opener = null;
        window.open('about:blank', '_self');
        window.close();
      }
    },
    isWeiXin() {
      const ua = window.navigator.userAgent.toLowerCase();
      if (ua.match(/MicroMessenger/i) == 'micromessenger') {
        this.WeiXin = true;
      } else {
        this.WeiXin = false;
      }
    },
    isPc() {
      const userAgent = navigator.userAgent;
      const Agents = [
        'Android',
        'iPhone',
        'SymbianOS',
        'Windows Phone',
        'iPad',
        'iPod',
      ];
      for (let v = 0; v < Agents.length; v++) {
        if (userAgent.includes(Agents[v])) {
          this.flag = false;
          break;
        }
      }
    },
  }
}
</script>
<style lang="scss" scoped>
/deep/.van-nav-bar .van-icon {
  color: rgba(0, 0, 0, 0.88);
}
 
.top-tip {
  display: flex;
  padding: 8px 16px;
  background: rgba(248, 248, 248, 1);
 
  .tip-text {
    line-height: 64px;
    color: rgba(0, 0, 0, 1);
    font-size: 28px;
    font-weight: 400;
    display: inline-block;
  }
 
  /deep/.van-button {
    font-size: 28px;
    font-weight: 400;
    background: rgb(217, 39, 27);
    border-radius: 4px;
    padding: 12px 20px;
    border-radius: 8px;
    line-height: 64px;
    margin-left: auto;
    margin-top: auto;
    margin-bottom: auto;
  }
}
 
.content {
  display: flex;
  justify-content: center;
  margin-top: 250px;
}
</style>