chuangte_bike_newxcx/App.vue

115 lines
2.8 KiB
Vue
Raw Normal View History

2023-11-27 09:57:03 +08:00
<script>
2025-04-01 21:35:30 +08:00
var call
var data_call
var ble_id = "1231"
var ble_url
2023-12-05 16:45:28 +08:00
2025-04-01 21:35:30 +08:00
var user_info
2023-12-05 16:45:28 +08:00
2025-04-01 21:35:30 +08:00
// 在文件顶部添加一个变量来存储当前连接的MAC地址
var current_connected_mac = null;
2023-12-05 16:45:28 +08:00
2025-04-01 21:35:30 +08:00
export default {
globalData: {
userInfo: null,
topicTypeIndex: 0,
token: "",
isShow: true,
bleInfo: {
current_connected_mac: null,
ble_id: "1231",
ble_url: null,
devicesList: [],
}
},
created() {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen()
// #endif
console.log('App @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Launch')
// #ifndef APP-PLUS
console.log('App 1111111111111Launch')
// #endif
// 添加以下代码,将方法绑定到 uni 全局对象
uni.$emit('init_app_methods', {
set_ble_mac: this.set_ble_mac.bind(this)
})
},
onLaunch(options) {
2025-09-22 17:08:55 +08:00
// console.log('执行');
// this.getimg()
2025-04-01 21:35:30 +08:00
uni.setInnerAudioOption({
obeyMuteSwitch: false
})
2025-11-08 09:37:13 +08:00
if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
console.log('onCheckForUpdate====', res)
// 请求完新版本信息的回调
if (res.hasUpdate) {
console.log('res.hasUpdate====')
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
console.log('success====', res)
// res: {errMsg: "showModal: ok", cancel: false, confirm: true}
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
wx.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
})
})
}
})
}
2025-04-01 21:35:30 +08:00
},
onShow: function () {
2025-09-22 17:08:55 +08:00
2025-04-01 21:35:30 +08:00
},
onHide: function () {
2023-12-05 16:45:28 +08:00
2025-04-01 21:35:30 +08:00
},
methods: {
get_ble_name(callback) {
if (callback != undefined) {
console.log('关闭蓝牙接口', ble_id);
}
2023-12-05 16:45:28 +08:00
},
2025-09-22 17:08:55 +08:00
// 请求图片
getimg(){
this.$u.get(`/app/app/detail?id=${this.$store.state.appid}`).then(res =>{
if(res.code == 200){
this.$store.state.app = res.data
console.log(this.$store.state.app);
}
})
}
2023-11-27 09:57:03 +08:00
}
2025-04-01 21:35:30 +08:00
}
2023-11-27 09:57:03 +08:00
</script>
2025-04-01 21:35:30 +08:00
2023-12-05 16:45:28 +08:00
<style lang="scss">
2023-11-27 09:57:03 +08:00
/*每个页面公共css */
2023-12-05 16:45:28 +08:00
@import "uview-ui/index.scss";
@import "./common/css/iconfont.css";
// 自定义tabar样式修改
2025-09-22 17:08:55 +08:00
::v-deep.u-tabbar__content__item__text{
2023-12-05 16:45:28 +08:00
font-size: 20rpx !important;
bottom: 10rpx !important;
}
page{
background-color: #f8f8f8;
}
2023-11-27 09:57:03 +08:00
</style>