48 lines
1023 B
Vue
48 lines
1023 B
Vue
<script>
|
|
export default {
|
|
onLaunch: function(options) {
|
|
console.log('App Launch')
|
|
|
|
// #ifdef H5
|
|
// 解析 URL 路径中的设备编号(如 /A1036)
|
|
const path = window.location.pathname;
|
|
const segments = path.split('/').filter(Boolean);
|
|
if (segments.length > 0) {
|
|
const last = segments[segments.length - 1];
|
|
// 匹配设备编号格式:大写字母开头 + 大写字母/数字
|
|
if (/^[A-Z][A-Z0-9]+$/.test(last)) {
|
|
uni.redirectTo({
|
|
url: '/pages/index/index?device_id=' + last
|
|
});
|
|
return;
|
|
}
|
|
}
|
|
// #endif
|
|
},
|
|
onShow: function() {
|
|
console.log('App Show')
|
|
},
|
|
onHide: function() {
|
|
console.log('App Hide')
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
/*每个页面公共css */
|
|
@import '@/uni_modules/uni-scss/index.scss';
|
|
/* #ifndef APP-NVUE */
|
|
@import '@/static/customicons.css';
|
|
// 设置整个项目的背景色
|
|
page {
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
/* #endif */
|
|
.example-info {
|
|
font-size: 14px;
|
|
color: #333;
|
|
padding: 10px;
|
|
}
|
|
</style>
|