爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.9 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
  1. <script>
  2. import routerInterception from '@/utils/router-interception.js'
  3. import config from '/config.js'
  4. export default {
  5. globalData: {
  6. flag: 1,
  7. login_status: true,
  8. phone: null,
  9. bannerList: [],
  10. pricePreviewList: [],
  11. configData: [],
  12. qr_path: ''
  13. },
  14. onLaunch: function() {
  15. routerInterception()
  16. this.getBannerList()
  17. this.getPricePreviewList()
  18. this.getConfigData()
  19. this.getQrCode()
  20. // console.log(this.$utils)
  21. console.log('App Launch')
  22. },
  23. onLoad: function() {
  24. this.getBannerList()
  25. this.getQrCode();
  26. console.log('App Show')
  27. },
  28. onHide: function() {
  29. console.log('App Hide')
  30. },
  31. methods: {
  32. getBannerList() {
  33. // 假设 this.$api 可用
  34. this.$api && this.$api('getBanner', {}, res => {
  35. if (res && res.code === 200 && Array.isArray(res.result)) {
  36. getApp().globalData.bannerList = res.result
  37. console.log(getApp().globalData.bannerList, 'bannerList')
  38. uni.$emit('bannerListUpdated')
  39. }
  40. })
  41. },
  42. getPricePreviewList() {
  43. this.$api && this.$api('getPricePreviewClassList', {}, res => {
  44. if (res && res.success && Array.isArray(res.result)) {
  45. getApp().globalData.pricePreviewList = res.result
  46. uni.$emit('pricePreviewListUpdated')
  47. }
  48. })
  49. },
  50. getConfigData() {
  51. this.$api('getConfig', {}, res => {
  52. console.log('Config data response:', JSON.parse(JSON.stringify(res)))
  53. if (res && res.success && Array.isArray(res.result)) {
  54. getApp().globalData.configData = res.result
  55. // console.log('Config data set:', JSON.parse(JSON.stringify(this.configData)) )
  56. }
  57. })
  58. },
  59. getQrCode() {
  60. // console.log(config.baseUrl,'config.baseUrl')
  61. let that = this;
  62. if (!uni.getStorageSync('token')) {
  63. return
  64. }
  65. uni.getImageInfo({
  66. src: `${config.baseUrl}/recycle-admin/applet/promotion/getInviteCode?token=${uni.getStorageSync('token')}`,
  67. success: res => {
  68. getApp().globalData.configData.qr_path = res.path
  69. console.log(getApp().globalData.configData.qr_path,
  70. 'getApp().globalData.configData.qr_path')
  71. },
  72. fail: err => {
  73. console.log(err)
  74. }
  75. })
  76. }
  77. }
  78. }
  79. </script>
  80. <style>
  81. /* // @import "./uni_modules/vk-uview-ui/index.scss"; */
  82. /*每个页面公共css */
  83. .uni-tabbar-bottom {
  84. display: none;
  85. }
  86. .icon {
  87. width: 50rpx;
  88. height: 50rpx;
  89. }
  90. .nav-bar {
  91. /* margin-top: calc(70rpx + env(safe-area-inset-top)); */
  92. height: 30%;
  93. display: flex;
  94. justify-content: center;
  95. }
  96. /* 每个页面公共css */
  97. /* 解决小程序和app滚动条的问题 */
  98. ::-webkit-scrollbar {
  99. display: none;
  100. width: 0 !important;
  101. height: 0 !important;
  102. -webkit-appearance: none;
  103. background: transparent;
  104. color: transparent;
  105. }
  106. /* 解决H5的问题 */
  107. uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
  108. display: none;
  109. width: 0 !important;
  110. height: 0 !important;
  111. -webkit-appearance: none;
  112. background: transparent;
  113. color: transparent;
  114. }
  115. </style>