bus.vue 914 B

12345678910111213141516171819202122232425262728293031323334
  1. <template>
  2. <web-view :src="url" :progress="false"></web-view>
  3. </template>
  4. <script>
  5. export default {
  6. data() {
  7. return {
  8. url: 'https://chtech.ncjti.edu.cn/carstop/dist5/#/'
  9. }
  10. },
  11. onLoad() {
  12. // 获取小程序中的用户信息
  13. const userInfo = uni.getStorageSync('userinfo_storage_key')
  14. // 获取校园打卡小程序中的用户信息
  15. const clockIn_userInfo = uni.getStorageSync('userInfo')
  16. if (userInfo) {
  17. // 如果在小程序中获取过用户信息
  18. const cardNumber = userInfo.card_number
  19. this.url = `${this.url}?card_number=${cardNumber}`
  20. } else if (!userInfo && clockIn_userInfo) {
  21. // 如果在校园打卡小程序中获取过用户信息
  22. const cardNumber = clockIn_userInfo.cardNumber
  23. this.url = `${this.url}?card_number=${cardNumber}`
  24. } else {
  25. // 如果都没有获取过用户信息
  26. this.url = `${this.url}?type=weixin`
  27. }
  28. }
  29. }
  30. </script>
  31. <style></style>