<template>
	<view class="page">
		<view class="list_info">
			<!-- 基础设置组 -->
			<view class="item" v-for="(item, index) in basicSettings" :key="index" @click="goWeb(item.path, item.name)">
				<view class="item-left">
					<image class="icon" :src="item.icon" mode="widthFix"></image>
					<text>{{ item.name }}</text>
				</view>
				<view class="item-right">
					<switch v-if="item.switch == 1" checked color="#FFCC33" style="transform:scale(0.7)" />
					<image v-else class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix"></image>
				</view>
			</view>

		</view>


		<DialogBox ref="DialogBox"></DialogBox>
	</view>
</template>
<script>
import channel from "@/common/channel.js";
export default {
	components: {},
	data() {
		return {
			title: '',
			sel: 1,
			myinfo: {},
			version: '',
			basicSettings: [{
				'name': '隐私政策',
				'desc': '',
				'path': 'https://e.zhichao.art/web/yszc.php',
				'icon': '../../static/me/security.png'
			},
			{
				'name': '用户协议',
				'desc': '',
				'path': 'https://e.zhichao.art/web/yhxy.php',
				'icon': '../../static/me/profile.png'
			},
			{
				'name': '创作社区公约说明',
				'desc': '',
				'path': 'https://e.zhichao.art/web/sqgy.php',
				'icon': '../../static/me/profile.png'
			},
				// {
				// 	'name': '应用权限隐私清单',
				// 	'desc': '',
				// 	'path': 'https://e.zhichao.art/web/yyqx.php',
				// 	'icon': '../../static/me/profile.png'
				// } 
			],
		}
	},
	onLoad() {
		// this.getAppVersion()
		let channelStr = channel && channel.getCurrentStore() && channel.getCurrentStore().channel;
		if (channelStr && channelStr == 'oppo') {
			this.basicSettings= [{
				'name': '隐私政策',
				'desc': '',
				'path': 'https://e.zhichao.art/web/yszc.php',
				'icon': '../../static/me/security.png'
			},
			{
				'name': '用户协议',
				'desc': '',
				'path': 'https://e.zhichao.art/web/yhxy.php',
				'icon': '../../static/me/profile.png'
			},
			{
				'name': '算法备案公示',
				'desc': '',
				'path': 'https://e.zhichao.art/web/sfbeian.php',
				'icon': '../../static/me/profile.png'
			} 
				// {
				// 	'name': '应用权限隐私清单',
				// 	'desc': '',
				// 	'path': 'https://e.zhichao.art/web/yyqx.php',
				// 	'icon': '../../static/me/profile.png'
				// } 
			]
		} else {
			this.basicSettings= [{
				'name': '隐私政策',
				'desc': '',
				'path': 'https://e.zhichao.art/web/yszc.php',
				'icon': '../../static/me/security.png'
			},
			{
				'name': '用户协议',
				'desc': '',
				'path': 'https://e.zhichao.art/web/yhxy.php',
				'icon': '../../static/me/profile.png'
			},
			{
				'name': '创作社区公约说明',
				'desc': '',
				'path': 'https://e.zhichao.art/web/sqgy.php',
				'icon': '../../static/me/profile.png'
			},
				// {
				// 	'name': '应用权限隐私清单',
				// 	'desc': '',
				// 	'path': 'https://e.zhichao.art/web/yyqx.php',
				// 	'icon': '../../static/me/profile.png'
				// } 
			]

		}
	},
	onShow() {
		// this.loadData();
	},
	methods: {
		goWeb(url, title) {
			uni.navigateTo({
				url: `/pages/webview/index?url=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}`
			})
		},
		onBack() { },
		chkSel() {
			if (this.sel == 1) {
				this.sel = 0;
			} else {
				this.sel = 1;
			}
		},
		goPage(page) {
			if (page == 'delete') {
				this.DelMem();
			} else if (page == 'yszc') {

				// #ifdef APP-PLUS
				plus.runtime.openURL('https://e.zhichao.art/web/yszc.php') // plus.runtime.openWeb(href);
				// #endif

				// #ifdef H5
				window.open('https://e.zhichao.art/web/yszc.php')
				// #endif
			} else if (page == 'kefu') {
				let that = this;
				// #ifdef APP-PLUS
				plus.share.getServices(res => {
					const wechat = res.find(i => i.id === 'weixin')
					if (wechat) {
						wechat.openCustomerServiceChat({
							corpid: 'wwbc06aa8311b6ac08',
							// url: 'https://work.weixin.qq.com/kfid/kfc4b0bcb4038d00a50'
							url: that.myinfo.wxkf
						}, src => {
							console.log("success:")
						}, err => {
							console.log("error:")
						})
					} else {
						uni.showToast({
							title: '没有检测到微信，请先安装',
							icon: "error"
						});
					}
				});
				// #endif

			} else if (page != '') {
				uni.navigateTo({
					url: page,
				})
			}
		},
	}
}
</script>

<style scoped lang="scss">
@import 'xieyi.scss';
</style>