bus.vue 593 B

123456789101112131415161718192021222324252627
  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. if (userInfo) {
  15. // 如果在小程序中获取过用户信息
  16. const cardNumber = userInfo.card_number
  17. this.url = `${this.url}?card_number=${cardNumber}`
  18. } else {
  19. // 如果都没有获取过用户信息
  20. this.url = `${this.url}?type=weixin`
  21. }
  22. }
  23. }
  24. </script>
  25. <style></style>