<template>
	<view class="container">
		<view class="padding-wrap">
			<view class="nav-list" @click="goPage('/pages/setting/user')">
				<text style="flex:1;">远端设置</text>
				<uni-icons type="right" size="18" color="#999"></uni-icons>
			</view>
			<view class="nav-list" @click="goPage('/pages/setting/other')">
				<text style="flex:1;">常用报警位置设置</text>
				<uni-icons type="right" size="18" color="#999"></uni-icons>
			</view>
			<view class="nav-list" @click="doSetAuto">
				<text style="flex:1;">设置自启、后台运行</text>
			</view>
			<view class="nav-list" @click="doSetBattery">
				<text style="flex:1;">电池优化白名单配置</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		methods: {
			goPage(url) {
				uni.navigateTo({
					url: url
				})
			},
			//电池白名单
			doSetBattery() {
				// getApp().goIgnoreBattery();
				uni.showModal({
					title: '忽略电池优化',
					content: '忽略后才能在后台保持连接接收消息通知，请前往设置！',
					showCancel: false,
					confirmText: '去设置',
					success: (res) => {
						if (res.confirm) {
							var main = plus.android.runtimeMainActivity();
							var Intent = plus.android.importClass('android.content.Intent'); //导入插件
							var Settings = plus.android.importClass('android.provider.Settings'); //导入插件
							var intent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY); //打开耗电详情
							// var Uri = plus.android.importClass('android.net.Uri');
							// var pkName = main.getPackageName();//获取包名
							// var packageUri = Uri.parse("package:" + pkName);
							// var intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, packageUri);//打开应用信息
							intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
							main.startActivity(intent); //执行
						}
					}
				});
			},
			//设置自启动
			doSetAuto() {
				getApp().onAutoStart();
			},
		}
	}
</script>

<style lang="scss" scoped>
	page,
	.container {
		min-height: 100vh;
		background-color: #FFFFFF;

		/deep/.uni-forms-item__label {
			color: #031945;
			font-size: 28upx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
		}

		/deep/.uni-easyinput__content {
			height: 99upx;
			border: 0;
			border-bottom: 1px solid #D6D8DF;
			;
			border-radius: 0;
		}

		/deep/.uni-easyinput__content-input {
			font-size: 28upx;
			height: 99upx;
		}

		/deep/.uni-input-placeholder {
			color: #90959D;
			font-size: 28upx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
		}
	}

	.padding-wrap {
		padding: 30upx;
	}

	.nav-list {
		display: flex;
		align-items: center;
		color: #90959D;
		line-height: 40upx;
		font-size: 28upx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		border-bottom: 1px solid #D6D8DF;
		padding: 17upx 0;
		margin-bottom: 17upx;
	}
</style>