Watch Conditions - Registration Watch
1. Settings Information
1.1 Registration Watch Condition Settings Information
Interface: AuthSettingItemInfo
| Property Name | Description | Type |
|---|---|---|
authType |
Condition Type | Info |
enabled |
Enabled | null | YN |
privacyContent |
Privacy Statement Content | string |
privacyStatus |
Enable Privacy Statement | YN |
infoAuthTips |
Welcome Title | string |
infoDesc |
Prompt Message | string |
infoEntryText |
Entry Text | null | string |
1.2 Registration Watch Form Options
Interface: AuthInfoItem
| Property Name | Description | Type |
|---|---|---|
type |
Form Type | AuthInfoType |
name |
Information Title | string |
placeholder |
Information Description | string |
sms |
Requires SMS Verification | YN |
options |
Dropdown Options List, Separated by Commas | string |
required |
Required | YN |
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
Pass verifyInfoAuth with formValues to verify registration watch. 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 Name | Description | Type | Required | Default Value |
|---|---|---|---|---|
phoneNumber |
Phone Number | string |
No | - |
areaCode |
Phone Area Code | string |
No | - |
smsCode |
SMS Verification Code | string |
No | - |
formValues |
Registration Information | 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 already submitted a registration form, the loginInfoAuth method can be called with the phone number information for verification. If registration information 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 Name | Description | Type | Required | Default Value |
|---|---|---|---|---|
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);
}
}
