Watch Conditions - Registration Watch
1. Configuration Information
1.1 Registration Watch Condition Settings
Interface: AuthSettingItemInfo
| Property | Description | Type |
|---|---|---|
authType |
Condition type | Info |
privacyContent |
Privacy statement content | string |
privacyStatus |
Whether privacy statement is enabled | YN |
infoAuthTips |
Welcome title | string |
infoDesc |
Prompt message | string |
infoEntryText |
Entry text | null | string |
1.2 Registration Watch Form Options
Interface: AuthInfoItem
| Property | Description | Type |
|---|---|---|
type |
Form type | AuthInfoType |
name |
Information title | string |
placeholder |
Information description | string |
sms |
Whether SMS verification is required | YN |
options |
Dropdown option list, separated by commas | string |
1.3 Registration Watch Option Types
Enum: AuthInfoType
| Constant | Enum Member | Description |
|---|---|---|
'name' |
AuthInfoType.Name |
Name |
'text' |
AuthInfoType.Text |
Text |
'mobile' |
AuthInfoType.Mobile |
Phone number |
'option' |
AuthInfoType.Option |
Dropdown option |
'number' |
AuthInfoType.Number |
Numeric value |
2. Usage
2.1 Get Registration Watch Form Settings List
Api Method: getAuthInfoFields(): AuthInfoItem[]
Return Value Description: Form settings list, type AuthInfoItem[]
Example:
const formFields = watchCore.auth.getAuthInfoFields();
formFields.forEach(fieldItem => {
console.log('表单项信息', fieldItem);
console.log('表单类型', fieldItem.type);
});
2.2 Verify Registration Watch
Use verifyInfoAuth to pass formValues for registration watch verification. If the backend has set a phone number registration option, the three fields phoneNumber, areaCode, and smsCore must also be provided.
Api Method: verifyInfoAuth(params: VerifyInfoAuthParam): Promise<VerifyInfoAuthResult>
Parameter Description:
- params: Call parameters, type
VerifyInfoAuthParam, required. Detailed type description is as follows:
| Parameter | Description | Type | Required | Default |
|---|---|---|---|---|
phoneNumber |
Phone number | string |
No | - |
areaCode |
Phone area code | string |
No | - |
smsCode |
SMS verification code | string |
No | - |
formValues |
Registration form data | string[] |
Yes | - |
Return Value Description: Authorization result, type Promise<VerifyInfoAuthResult>
Example:
// 登记观看表单列表结构示例:
// [mobile(手机号码), name(姓名), text(职业), number(年龄), option(城市->广州,深圳,佛山,惠州)]
// 执行登记观看验证
async function toDoAuthInfo(form) {
const result = await watchCore.auth.verifyInfoAuth({
code,
});
if (result.success) {
await handleAuthVerifySuccess(result);
} else {
await handleAuthVerifyFail(result);
}
}
// 提交的表单内容
toDoAuthInfo({
phoneNumber: '18012345678',
areaCode: '+86',
smsCode: '76431',
formValues: ['18012345678', '李小明', '前端开发工程师', '18', '广州'],
});
2.3 Login Registration Watch
When the backend has set a phone number form option and the viewer has previously submitted a registration form, the loginInfoAuth method can be called with the phone number information for verification. If registration data already exists, the viewer can directly enter the watch page.
Api Method: loginInfoAuth(params: LoginInfoAuthParams): Promise<LoginInfoAuthResult>
Parameter Description:
- params: Call parameters, type
LoginInfoAuthParams, required. Detailed type description is as follows:
| Parameter | Description | Type | Required | Default |
|---|---|---|---|---|
phoneNumber |
Phone number | string |
Yes | - |
areaCode |
Phone area code | string |
Yes | - |
Return Value Description: Login result, type Promise<LoginInfoAuthResult>
Example:
async function submitAuthLogin(phoneNumber, areaCode) {
const result = await watchCore.auth.loginInfoAuth({
phoneNumber: phoneNumber,
areaCode: areaCode,
});
if (result.success) {
handleAuthVerifySuccess(result);
} else {
handleAuthVerifyFail(result);
}
}
