<template>
	<view>
		<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
			:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
			@success="form1.props.show = false;refresh();"></vk-data-form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form1: {
					// 表单请求数据，此处可以设置默认值
					data: {
						sort: 0
					},
					// 表单属性
					props: {
						// 表单请求地址
						action: "admin/site_config/sys/update",
						// 表单字段显示规则
						columns: [
							{
								title: "基本信息",
								type: "bar-title",
								placeholder: ""
							},
							{
								key: "siteLogo",
								title: "LOGO",
								type: "image",
								placeholder: "请上传LOGO",
								limit: 1
							},
							{
								key: "siteTitle",
								title: "网站标题",
								type: "text",
								placeholder: "请输入网站标题"
							},
							{
								key: "siteDesc",
								title: "网站描述",
								type: "text",
								placeholder: "请输入网站描述"
							},
							{
								key: "siteCopyright",
								title: "版权信息",
								type: "text",
								placeholder: "请输入版权信息"
							},
							{
								key: "siteIcpNumber",
								title: "ICP备案号",
								type: "text",
								placeholder: "请输入ICP备案号"
							},
							{
								title: "联系方式",
								type: "bar-title",
								placeholder: ""
							},
							{
								key: "companyName",
								title: "公司名称",
								type: "text",
								placeholder: "请输入公司名称"
							},
							{
								key: "companyAddress",
								title: "公司地址",
								type: "text",
								placeholder: "请输入公司地址"
							},
							{
								key: "companyPhone",
								title: "公司电话",
								type: "text",
								placeholder: "请输入公司电话"
							},
							{
								key: "companyEmail",
								title: "公司邮箱",
								type: "text",
								placeholder: "请输入公司邮箱"
							},
							{
								key: "companyServicePhone",
								title: "客服热线",
								type: "text",
								placeholder: "请输入客服热线"
							},
							{
								key: "companyMobileSiteImage",
								title: "手机站二维码",
								type: "image",
								limit: 1,
								placeholder: "请上传收手机站上二维码"
							},
							{
								key: "companyGzhImage",
								title: "公众号二维码",
								type: "image",
								limit: 1,
								placeholder: "请上传公众号二维码"
							},
						],
						// 表单验证规则
						rules: {
							sort: [{
								type: 'number',
								message: '排序值必须为数字'
							}],
							name:[
								{ required:true, message:'分类名称不能为空', trigger:'blur' },
							],
						},
						// add 代表添加 update 代表修改
						formType: "",
						// 是否显示表单的弹窗
						show: false
					}
				},
			};
		},
		onLoad() {
			// 
			vk.callFunction({
				url: 'admin/site_config/sys/detail',
				title: '请求中...',
				success: (res) => {
					this.form1.data = res.data
				}
			});
		},
		methods: {
			
		},
		
	}
</script>

<style lang="scss">

</style>
