generated from ccsens_fe/uni-vue3-template
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.
58 lines
1.2 KiB
58 lines
1.2 KiB
<script>
|
|
import { useUserStoreWidthOut } from './store/modules/user'
|
|
import { useServiceStoreWidthOut } from './store/modules/service'
|
|
|
|
const userStore = useUserStoreWidthOut()
|
|
const serviceStore = useServiceStoreWidthOut()
|
|
|
|
export default {
|
|
async onLaunch() {
|
|
console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
|
|
console.log('App Launch')
|
|
try {
|
|
await uni.$u.api.login()
|
|
this.getCarInfo()
|
|
} catch (error) {
|
|
uni.$u.alertError(error)
|
|
}
|
|
},
|
|
onShow: function () {
|
|
console.log('App Show')
|
|
},
|
|
onHide: function () {
|
|
console.log('App Hide')
|
|
},
|
|
methods: {
|
|
async getCarInfo() {
|
|
try {
|
|
const res = await uni.$u.api.getCarInfo()
|
|
serviceStore.setCurrentCar(res)
|
|
setTimeout(() => {
|
|
this.getCarInfo()
|
|
}, 1000)
|
|
} catch (error) {
|
|
console.error(error);
|
|
serviceStore.setCurrentCar(null)
|
|
throw error
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
/*每个页面公共css */
|
|
@import '@/uni_modules/uni-scss/index.scss';
|
|
@import 'uni.scss';
|
|
@import '@/uni_modules/vk-uview-ui/index.scss';
|
|
|
|
// 设置整个项目的背景色
|
|
page {
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
uni-page-body {
|
|
min-height: 100%;
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
|