cshenfu
2023-05-08 2469d92f4c189eb595216707f4b4f0786fadb23f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// 表单校验规则由 schema2code 生成,不建议直接修改校验规则,而建议通过 schema2code 生成, 详情: https://uniapp.dcloud.net.cn/uniCloud/schema
 
 
 
const validator = {
    "appid": {
        "rules": [{
                "required": true
            },
            {
                "format": "string"
            }
        ],
        "label": "AppID"
    },
    "name": {
        "rules": [{
            "format": "string"
        }],
        "label": "应用名称"
    },
    "title": {
        "rules": [{
            "format": "string"
        }],
        "label": "更新标题"
    },
    "contents": {
        "rules": [{
                "required": true
            },
            {
                "format": "string"
            }
        ],
        "label": "更新内容"
    },
    "platform": {
        "rules": [{
                "required": true
            },
            /* 此处不校验数据类型,因为platform在发布app端是单选,在发布wgt时可能是多选
            {
                "format": "array"
            }, */
            {
                "range": [{
                        "value": "Android",
                        "text": "安卓"
                    },
                    {
                        "value": "iOS",
                        "text": "苹果"
                    }
                ]
            }
        ],
        "label": "平台"
    },
    "type": {
        "rules": [{
                "required": true
            }, {
                "format": "string"
            },
            {
                "range": [{
                        "value": "native_app",
                        "text": "原生App安装包"
                    },
                    {
                        "value": "wgt",
                        "text": "wgt资源包"
                    }
                ]
            }
        ],
        "label": "安装包类型"
    },
    "version": {
        "rules": [{
                "required": true
            },
            {
                "format": "string"
            }
        ],
        "label": "版本号"
    },
    "min_uni_version": {
        "rules": [{
            "format": "string"
        }],
        "label": "原生App最低版本"
    },
    "url": {
        "rules": [{
            "required": true
        }, {
            "format": "string"
        }],
        "label": "包地址"
    },
    "stable_publish": {
        "rules": [{
            "format": "bool"
        }],
        "label": "上线发行"
    },
    "create_date": {
        "rules": [{
            "format": "timestamp"
        }],
        "label": "上传时间"
    },
    "is_silently": {
        "rules": [{
            "format": "bool"
        }],
        "label": "静默更新",
        "defaultValue": false
    },
    "is_mandatory": {
        "rules": [{
            "format": "bool"
        }],
        "label": "强制更新",
        "defaultValue": false
    }
}
 
const enumConverter = {
    "platform_valuetotext": [{
            "value": "Android",
            "text": "安卓"
        },
        {
            "value": "iOS",
            "text": "苹果"
        }
    ],
    "type_valuetotext": {
        "native_app": "原生App安装包",
        "wgt": "wgt资源包"
    }
}
 
export {
    validator,
    enumConverter
}