爱简收旧衣按件回收前端代码仓库
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.
 
 
 
 

124 lines
2.9 KiB

<script>
import routerInterception from '@/utils/router-interception.js'
import config from '/config.js'
export default {
globalData: {
flag: 1,
login_status: true,
phone: null,
bannerList: [],
pricePreviewList: [],
configData: [],
qr_path: ''
},
onLaunch: function() {
routerInterception()
this.getBannerList()
this.getPricePreviewList()
this.getConfigData()
this.getQrCode()
// console.log(this.$utils)
console.log('App Launch')
},
onLoad: function() {
this.getBannerList()
this.getQrCode();
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
methods: {
getBannerList() {
// 假设 this.$api 可用
this.$api && this.$api('getBanner', {}, res => {
if (res && res.code === 200 && Array.isArray(res.result)) {
getApp().globalData.bannerList = res.result
console.log(getApp().globalData.bannerList, 'bannerList')
uni.$emit('bannerListUpdated')
}
})
},
getPricePreviewList() {
this.$api && this.$api('getPricePreviewClassList', {}, res => {
if (res && res.success && Array.isArray(res.result)) {
getApp().globalData.pricePreviewList = res.result
uni.$emit('pricePreviewListUpdated')
}
})
},
getConfigData() {
this.$api('getConfig', {}, res => {
console.log('Config data response:', JSON.parse(JSON.stringify(res)))
if (res && res.success && Array.isArray(res.result)) {
getApp().globalData.configData = res.result
// console.log('Config data set:', JSON.parse(JSON.stringify(this.configData)) )
}
})
},
getQrCode() {
// console.log(config.baseUrl,'config.baseUrl')
let that = this;
if (!uni.getStorageSync('token')) {
return
}
uni.getImageInfo({
src: `${config.baseUrl}/recycle-admin/applet/promotion/getInviteCode?token=${uni.getStorageSync('token')}`,
success: res => {
getApp().globalData.configData.qr_path = res.path
console.log(getApp().globalData.configData.qr_path,
'getApp().globalData.configData.qr_path')
},
fail: err => {
console.log(err)
}
})
}
}
}
</script>
<style>
/* // @import "./uni_modules/vk-uview-ui/index.scss"; */
/*每个页面公共css */
.uni-tabbar-bottom {
display: none;
}
.icon {
width: 50rpx;
height: 50rpx;
}
.nav-bar {
/* margin-top: calc(70rpx + env(safe-area-inset-top)); */
height: 30%;
display: flex;
justify-content: center;
}
/* 每个页面公共css */
/* 解决小程序和app滚动条的问题 */
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}
/* 解决H5的问题 */
uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}
</style>