<script>
import { queryDictDataCache } from './common/api/dictionary.js'
import { getImageUrl } from '@/common/api/basic'


export default {
    onLaunch: function () {
        
        // uni.onPushMessage((res) => {
        //     console.log("收到推送消息：",res) //监听推送消息
        // })
        console.log(window)
        // this.connect()
        console.log('App Launch')

        let devCode = uni.getStorageSync('devCode')
        if (!devCode) {
            uni.getSystemInfo({
                success: (result) => {
                    uni.setStorageSync('devCode', result.deviceId)
                },
            })
        }
        uni.onPushMessage((res) => {
            console.log('收到推送消息：', res.data.payload.path) //监听推送消息
            if (res.data.payload && res.data.payload.path) {
                uni.setStorageSync('messageParams', {
                    engineeringName: '',
                    engineeringId: '', //工程ID
                    projectName: '',
                    projectId: '', //項目ID
                    deviceName: '',
                    deviceId: '', //设备ID
                    lineName: '',
                    lineId: '', //测点ID
                    type: res.data.payload.path.split('type=')[1],
                })
                uni.switchTab({
                    url: res.data.payload.path,
                })
                // uni.navigateTo({
                //     url: res.data.payload.path,
                // })
            }
        })
    },
    onHide: function () {
        console.log('App Hide')
    },

    methods: {},
}
</script>

<style lang="scss">
/*每个页面公共css */
@import './common/css/base.scss';
@import '@/static/iconfont/iconfont.css';

/deep/ uni-tabbar .uni-tabbar__badge {
    width: auto;
    height: 28rpx;
    line-height: 28rpx;
    border-radius: 28rpx;
    min-width: 28rpx;
    font-size: 20rpx;
    padding: 0 8rpx;
}
// .uni-page-refresh__path {
//     stroke: #007aff !important; /* 改成你想要的颜色，比如红色 #ff0000 */
// }
// .uni-page-refresh__icon {
//     fill: #007aff !important; /* 改成你想要的颜色，比如红色 #ff0000 */
// }
</style>
