chuangte_bike_newxcx/App.vue

138 lines
3.5 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: [],
}
},
2025-12-20 14:29:10 +08:00
onLaunch() {
console.log('小程序启动了');
// 一启动就调用 Vuex 中的检查更新 action
},
2025-04-01 21:35:30 +08:00
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)
})
},
onShow: function () {
2025-12-20 14:29:10 +08:00
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
});
2025-09-22 17:08:55 +08:00
2025-12-20 14:29:10 +08:00
updateManager.onUpdateReady(function(res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
showCancel: false,
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function(res) {
// 新的版本下载失败
console.log('download error')
uni.showModal({
title: '提示',
content: '新版小程序下载失败\n请自行退出程序手动卸载本程序再运行',
confirmText: "知道了"
});
});
2025-04-01 21:35:30 +08:00
},
onHide: function () {
2023-12-05 16:45:28 +08:00
2025-12-20 14:29:10 +08:00
},
onLoad() {
2025-04-01 21:35:30 +08:00
},
methods: {
2025-12-20 14:29:10 +08:00
checkUpdataWxapp() {
console.log(111);
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
});
updateManager.onUpdateReady(function (res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,重启应用以更新',
success(res) {
if (res.confirm) {
// 用户点击确定
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
} else if (res.cancel) {
// 用户点击取消
}
}
});
});
updateManager.onUpdateFailed(function (res) {
// 新的版本下载失败
});
},
2025-04-01 21:35:30 +08:00
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>