138 lines
3.5 KiB
Vue
138 lines
3.5 KiB
Vue
<script>
|
||
var call
|
||
var data_call
|
||
var ble_id = "1231"
|
||
var ble_url
|
||
|
||
var user_info
|
||
|
||
// 在文件顶部添加一个变量来存储当前连接的MAC地址
|
||
var current_connected_mac = null;
|
||
|
||
export default {
|
||
globalData: {
|
||
userInfo: null,
|
||
topicTypeIndex: 0,
|
||
token: "",
|
||
isShow: true,
|
||
bleInfo: {
|
||
current_connected_mac: null,
|
||
ble_id: "1231",
|
||
ble_url: null,
|
||
devicesList: [],
|
||
}
|
||
},
|
||
onLaunch() {
|
||
console.log('小程序启动了');
|
||
|
||
// 一启动就调用 Vuex 中的检查更新 action
|
||
},
|
||
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 () {
|
||
const updateManager = uni.getUpdateManager();
|
||
updateManager.onCheckForUpdate(function(res) {
|
||
// 请求完新版本信息的回调
|
||
});
|
||
|
||
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: "知道了"
|
||
});
|
||
});
|
||
},
|
||
onHide: function () {
|
||
|
||
},
|
||
onLoad() {
|
||
|
||
},
|
||
methods: {
|
||
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) {
|
||
// 新的版本下载失败
|
||
});
|
||
},
|
||
get_ble_name(callback) {
|
||
if (callback != undefined) {
|
||
console.log('关闭蓝牙接口', ble_id);
|
||
}
|
||
},
|
||
// 请求图片
|
||
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);
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
|
||
<style lang="scss">
|
||
/*每个页面公共css */
|
||
@import "uview-ui/index.scss";
|
||
@import "./common/css/iconfont.css";
|
||
// 自定义tabar样式修改
|
||
::v-deep.u-tabbar__content__item__text{
|
||
font-size: 20rpx !important;
|
||
bottom: 10rpx !important;
|
||
}
|
||
page{
|
||
background-color: #f8f8f8;
|
||
}
|
||
</style>
|