===优化

This commit is contained in:
禺狨 2023-03-22 18:53:21 +08:00
parent c032727588
commit 954386df83
7 changed files with 11 additions and 11 deletions

View File

@ -26,7 +26,7 @@ export const UploadImageSub = (props: PropsInterface) => {
onChange(info: any) {
const { status, response } = info.file;
if (status === "done") {
if (response.code == 0) {
if (response.code === 0) {
message.success(`${info.file.name} 上传成功`);
} else {
message.error(response.msg);

View File

@ -387,7 +387,7 @@ export const CourseCreate: React.FC<PropInterface> = ({
setVideoVisible(false);
}}
onSelected={(arr: any, videos: any) => {
if (chapterType == 0) {
if (chapterType === 0) {
selectData(arr, videos);
} else {
selectChapterData(arr, videos);

View File

@ -362,14 +362,14 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
<div className="float-left mt-24">
<SelectResource
defaultKeys={
chapterType == 0 ? hours : chapterHours[addvideoCurrent]
chapterType === 0 ? hours : chapterHours[addvideoCurrent]
}
open={videoVisible}
onCancel={() => {
setVideoVisible(false);
}}
onSelected={(arr: any, videos: any) => {
if (chapterType == 0) {
if (chapterType === 0) {
selectData(arr, videos);
} else {
selectChapterData(arr, videos);

View File

@ -73,7 +73,7 @@ export const CoursePage = () => {
text={"分类"}
onUpdate={(keys: any, title: any) => {
setCategoryIds(keys);
if (typeof title == "string") {
if (typeof title === "string") {
setLabel(title);
} else {
setLabel(title.props.children[0]);

View File

@ -154,7 +154,7 @@ export const ResourceImagesPage = () => {
text={"图片"}
onUpdate={(keys: any, title: any) => {
setCategoryIds(keys);
if (typeof title == "string") {
if (typeof title === "string") {
setLabel(title);
} else {
setLabel(title.props.children[0]);

View File

@ -169,7 +169,7 @@ export const ResourceVideosPage = () => {
text={"视频"}
onUpdate={(keys: any, title: any) => {
setCategoryIds(keys);
if (typeof title == "string") {
if (typeof title === "string") {
setLabel(title);
} else {
setLabel(title.props.children[0]);

View File

@ -92,7 +92,7 @@ export function ValidataCredentials(value: any) {
let regIdCard =
/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
if (regIdCard.test(value)) {
if (value.length == 18) {
if (value.length === 18) {
var idCardWi = new Array(
7,
9,
@ -120,15 +120,15 @@ export function ValidataCredentials(value: any) {
var idCardMod = idCardWiSum % 11; //计算出校验码所在数组的位置
var idCardLast = value.substring(17); //得到最后一位身份证号码
//如果等于2则说明校验码是10身份证号码最后一位应该是X
if (idCardMod == 2) {
if (idCardLast == "X" || idCardLast == "x") {
if (idCardMod === 2) {
if (idCardLast === "X" || idCardLast === "x") {
return true;
} else {
return false;
}
} else {
//用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
if (idCardLast == idCardY[idCardMod]) {
if (idCardLast === idCardY[idCardMod]) {
return true;
} else {
return false;