Background.vue
2.51 KB
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
<template>
  <div class="background">
    <div class="text">
      <p>随时随地,发生有趣事。</p>
      <p>上传故事,分享你的研学之旅!</p>
    </div>
    <ul class="icons">
      <li @click="goFoot">
        <img src="../assets/headGS.png" alt="" />
        <p>发布故事</p>
      </li>
      <li @click="saoYiSao">
        <img src="../assets/headDK.png" alt="" />
        <p>一键打卡</p>
      </li>
    </ul>
    <div class="close">
      <van-icon name="cross" @click="close" />
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      background: false,
      userInfo: '',
    }
  },
  created() {
    var userInfo = localStorage.getItem('userInfo')
    if (userInfo) {
      this.userInfo = JSON.parse(userInfo)
    }
  },
  methods: {
    close() {
      this.$parent.backgroundShow('')
    },
    goFoot() {
      this.$router.push({ path: '/Foot', query: { tabId: 1 } })
    },
    saoYiSao() {
      let isLogin = this.checkLogin()
      if (!isLogin) return
      if (process.env.NODE_ENV === 'production' && this.common.isWeiXin()) {
        window.open(`http://sao315.com/w/api/saoyisao?redirect_uri=https://zlyanxue.cn/wap/index.html%23/MyClassList`)
      } else {
        this.$router.push({ name: 'MyClassList', query: { qrresult: '188' } })
      }
    },
    // 判断是否已登录
    checkLogin() {
      if (process.env.NODE_ENV != 'production') return true
      const userInfo = JSON.parse(localStorage.getItem('userInfo'))
      if (!userInfo?.phone) {
        localStorage.setItem('prePage', 'HomeYX')
        localStorage.setItem('prePageQuery', JSON.stringify({ showTab: this.$route.query.showTab }))
        this.$router.push({ name: 'LoginPublic' })
        return false
      }
      return true
    },
  },
}
</script>
<style lang="stylus" scoped>
.background {
  position: fixed;
  width: 100%;
  height: 100%;
  background-color: rgba(214, 214, 214, 0.9);
  z-index: 50000;
  left: 0;
  top: 0;
  .text {
    position: absolute;
    top: 10%;
    left: 0;
    width: 100%;
    padding-left: 20px;
    font-size: 1.6rem;
  }
  .icons {
    overflow: hidden;
    position: absolute;
    left: 0;
    bottom: 50px;
    width: 100%;
    li {
      float: left;
      width: 33.33%;
      text-align: center;
      img {
        width: 50%;
      }
      p {
        font-size: 1.4rem;
      }
    }
  }
  .close {
    position: absolute;
    width: 100%;
    text-align: center;
    bottom: 0;
    left: 0;
    padding: 10px 0;
    font-size: 1.8rem;
  }
}
</style>