<script>
	import time from "@/common/time.js"
	import {
		set_base_url
	} from '@/common/set_base_url.js'

	export default {
		onLaunch: function() {
			console.log('App Launch')
			// 启动初始化

			// 煤矿鉴别-名称
			uni.setStorageSync('mine_code', 'ningmeijituan');
			// uni.setStorageSync('mine_code', 'ningdongyunying');
			// uni.setStorageSync('mine_code', 'shicaocun');
			// uni.setStorageSync('mine_code', 'meihuajing');
			// uni.setStorageSync('mine_code', 'zaoquan');
			// uni.setStorageSync('mine_code', 'qingshuiying');
			// uni.setStorageSync('mine_code', 'wuyegongsi');
			// uni.setStorageSync('mine_code', 'jinjiaqu');
			// uni.setStorageSync('mine_code', 'jinjiaqu_neiwang');
			// uni.setStorageSync('mine_code', 'yangchangwan');
			// uni.setStorageSync('mine_code', 'jinfeng');
			// uni.setStorageSync('mine_code', 'jinfeng_neiwang');
			// uni.setStorageSync('mine_code', 'lingxin');
			// uni.setStorageSync('mine_code', 'renjiazhuang');
			// uni.setStorageSync('mine_code', 'renjiazhuang_neiwang');
			
			// console.log(set_base_url(uni.getStorageSync('mine_code')))
			
			// uni.setStorageSync('base_url',set_base_url(uni.getStorageSync('mine_code')))
			
			// 设置自动化系统接口内外网域名
			if(uni.getStorageSync('mine_code').indexOf('_neiwang') == -1){
				uni.setStorageSync('unified_automation_system_url','http://video.nxjiewei.com:8011/api')
			}else{
				uni.setStorageSync('unified_automation_system_url','http://n.video.nxjiewei.com:8011/api')
			}
		},
		onShow: function() {
			console.log('App Show')

			uni.setStorageSync('onShow', new Date().format("yyyy-MM-dd h:m"))

		},
		onHide: function() {
			console.log('App Hide')

			this.$api.user_recordDuration({
				start_date: uni.getStorageSync('onShow'),
				end_date: new Date().format("yyyy-MM-dd h:m")
			}).then((res) => {
				// console.log(res)
			})

		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@font-face {
		font-family: my-fzdbsjt;
		src: url('~@/static/font/FangZhengDaBiaoSongJianTi-1.ttf');
	}

	page {
		// font-family: $tdw-base-font;

	}

	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
	}
</style>
