Skip to content

Commit

Permalink
提交华为input输入框校验-初版
Browse files Browse the repository at this point in the history
  • Loading branch information
supermap123 committed Nov 12, 2024
1 parent acc545c commit 1cb1d2f
Show file tree
Hide file tree
Showing 25 changed files with 654 additions and 51 deletions.
31 changes: 31 additions & 0 deletions SuperMap iEarth/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions SuperMap iEarth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"dependencies": {
"@ispeco/authentication-sdk": "^2.0.34",
"@ispeco/validators": "^1.0.18",
"axios": "^0.27.2",
"color": "^4.2.3",
"crypto-js": "^4.1.1",
Expand Down
12 changes: 12 additions & 0 deletions SuperMap iEarth/public/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,18 @@ const local_en = {
noSupportBaseMap:'The current layer does not support setting as default base image',
baseMapSetSuccess:'Successfully set as base image',
queryField: "Query Fields",

// input输入校验提示
INVALID_INPUT: "The input content is illegal",
INVALID_URL: "The URL entered cannot be accessed",
INVALID_FORMAT: "The URL format entered is incorrect",
OUT_OF_RANGE: "Out of range",
NO_LINE_BREAKS_OR_CARRIAGE_RETURNS: "Line breaks and carriage returns are not allowed",
FIELD_REQUIRED: "This field cannot be empty",
NUMERIC_ONLY: "This field can only input numbers",
TEXT_ONLY: "This field can only input text",
EXCEED_MAX_VALUE_ALLOWED: "Cannot exceed the maximum value",
BELOW_MIN_VALUE_ALLOWED: "Cannot be less than the minimum value",
}

window.local_en = local_en;
12 changes: 12 additions & 0 deletions SuperMap iEarth/public/locale/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,18 @@ const local_es = {
"noSupportBaseMap":'La capa actual no admite la configuración como base predeterminada',
"baseMapSetSuccess":'Se estableció con éxito como base',
"queryField": "Campo de consulta",

// input输入校验提示
"INVALID_INPUT": "El contenido de entrada no es legal",
"INVALID_URL": "No se puede acceder a la dirección web introducida",
"INVALID_FORMAT": "El formato de URL introducido no es correcto xib",
"OUT_OF_RANGE": "Fuera del alcance",
"NO_LINE_BREAKS_OR_CARRIAGE_RETURNS": "No se permiten saltos de línea y devoluciones de llamada",
"FIELD_REQUIRED": "El campo no puede estar vacío",
"NUMERIC_ONLY": "Este campo solo puede introducir números",
"TEXT_ONLY": "Este campo solo puede introducir texto",
"EXCEED_MAX_VALUE_ALLOWED": "No se puede superar el valor máximo",
"BELOW_MIN_VALUE_ALLOWED": "No puede ser inferior al mínimo",
}

window.local_es = local_es;
12 changes: 12 additions & 0 deletions SuperMap iEarth/public/locale/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,18 @@ const local_fr = {
"noSupportBaseMap":'Le calque actuel ne prend pas en charge le réglage comme carte de base par défaut',
"baseMapSetSuccess":'Définir avec succès comme carte de base',
"queryField": "Champs de requête",

// input输入校验提示
INVALID_INPUT: "Entrer du contenu n'est pas légal",
INVALID_URL: "L'URL saisie n'est pas accessible",
INVALID_FORMAT: "Le format de l'URL saisie est incorrect",
OUT_OF_RANGE: "Pas dans la portée",
NO_LINE_BREAKS_OR_CARRIAGE_RETURNS: "Les sauts de ligne et les retours chariot ne sont pas autorisés",
FIELD_REQUIRED: "Le champ ne peut pas être vide",
NUMERIC_ONLY: "Ce champ ne peut entrer que des chiffres",
TEXT_ONLY: "Ce champ ne peut entrer que du texte",
EXCEED_MAX_VALUE_ALLOWED: "Ne peut pas dépasser le maximum",
BELOW_MIN_VALUE_ALLOWED: "Ne peut être inférieur au minimum",
}

window.local_fr = local_fr;
12 changes: 12 additions & 0 deletions SuperMap iEarth/public/locale/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,18 @@ const local_ja = {
noSupportBaseMap:'現在のレイヤーはデフォルトのアンダーレイに設定することをサポートしていません',
baseMapSetSuccess:'アンダーレイへの設定に成功しました',
queryField: "クエリーフィールド",

// input输入校验提示
INVALID_INPUT: "入力内容が不正です",
INVALID_URL: "入力されたURLにアクセスできません",
INVALID_FORMAT: "入力されたURLフォーマットが正しくありません",
OUT_OF_RANGE: "範囲外",
NO_LINE_BREAKS_OR_CARRIAGE_RETURNS: "改行文字と改行文字の入力は許可されていません",
FIELD_REQUIRED: "このフィールドは空にすることはできません",
NUMERIC_ONLY: "このフィールドには数字しか入力できません",
TEXT_ONLY: "このフィールドにはテキストのみ入力できます",
EXCEED_MAX_VALUE_ALLOWED: "最大値を超えてはならない",
BELOW_MIN_VALUE_ALLOWED: "最小値より小さくすることはできません",
}

window.local_ja = local_ja;
12 changes: 12 additions & 0 deletions SuperMap iEarth/public/locale/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,18 @@ const local_ru = {
noSupportBaseMap:'Текущий слой не поддерживает настройки по умолчанию',
baseMapSetSuccess:'Успешно настроен как нижний рисунок',
queryField: "Поле запроса",

// input输入校验提示
INVALID_INPUT: "Введите контент незаконно.",
INVALID_URL: "Введённый URL недоступен",
INVALID_FORMAT: "Неверный формат URL",
OUT_OF_RANGE: "Нет.",
NO_LINE_BREAKS_OR_CARRIAGE_RETURNS: "Не допускается ввод символов переноса строк и возврата",
FIELD_REQUIRED: "Это поле не может быть пустым",
NUMERIC_ONLY: "Это поле может вводить только цифры.",
TEXT_ONLY: "Это поле может вводить только текст.",
EXCEED_MAX_VALUE_ALLOWED: "Не превышать максимума",
BELOW_MIN_VALUE_ALLOWED: "Не может быть меньше минимального",
}

window.local_ru = local_ru;
12 changes: 12 additions & 0 deletions SuperMap iEarth/public/locale/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,18 @@ const local_zh = {
noSupportBaseMap:'当前图层不支持设置为默认底图',
baseMapSetSuccess:'成功设置为底图',
queryField: "查询字段",

// input输入校验提示
INVALID_INPUT: "输入内容不合法",
INVALID_URL: "输入的URL无法访问",
INVALID_FORMAT: "输入的URL格式不正确",
OUT_OF_RANGE: "不在范围内",
NO_LINE_BREAKS_OR_CARRIAGE_RETURNS: "不允许输入换行符和回车符",
FIELD_REQUIRED: "该字段不能为空",
NUMERIC_ONLY: "该字段仅能输入数字",
TEXT_ONLY: "该字段仅能输入文字",
EXCEED_MAX_VALUE_ALLOWED: "不能超过最大值",
BELOW_MIN_VALUE_ALLOWED: "不能小于最小值",
}

window.local_zh = local_zh;
2 changes: 1 addition & 1 deletion SuperMap iEarth/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<dialog-content></dialog-content>
<loading-content></loading-content>
<n-notification-provider>
<n-message-provider>
<n-message-provider :max="3">
<message-content></message-content>
<I18n></I18n>
<layout></layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
>
<n-input
v-model:value="fromData.storageSceneCurrentTime"
disabled
clearable
/>
</n-form-item>
Expand All @@ -54,6 +55,7 @@
<n-input
v-model:value="fromData.scenePortalName"
:placeholder="$t('placeHolder')"
@input="handleNameChange"
clearable
/>
</n-form-item>
Expand All @@ -79,11 +81,13 @@
<n-input
v-model:value="fromData.scenePortalTages"
:placeholder="$t('placeHolder')"
@input="handleLabelChange"
clearable
/>
</n-form-item>

<n-form-item
<!-- 作者名称 -->
<!-- <n-form-item
label-width="0.8rem"
:label="$t('authorName')"
path="scenePortalUser"
Expand All @@ -97,7 +101,7 @@
:placeholder="$t('placeHolder')"
clearable
/>
</n-form-item>
</n-form-item> -->

<n-form-item
label-width="0.8rem"
Expand All @@ -123,6 +127,7 @@
:loading="state.isloading"
text-color="#fff"
attr-type="button"
:disabled="!state.isCheckPass"
@click="onSaveUserClk"
>
{{ $t("save") }}
Expand All @@ -146,6 +151,7 @@ import { usePanelStore } from "@/store/panelStore/index";
import { getRootUrl } from "@/tools/iportal/portalTools";
import { useLayerStore } from "@/store/layerStore/layer";
import i18n from "@/locale/index";
import { RuleCheckTypeEnum, inputRuleCheck } from "@/tools/inputRuleCheck";
const IportalStore = IportalStoreCreate();
const panelStore = usePanelStore();
Expand All @@ -162,6 +168,10 @@ let state = reactive({
sceneID: "",
loadingShow: false, // 模态框
isloading: false,
isCheckPass:false,
isNamePass:false,
isLabelPass:false,
isDescribePass:false,
});
// 表格数据
Expand All @@ -173,6 +183,34 @@ let fromData = reactive({
scenePortalDescription: "",
});
//检查输入是否合规:URL、Name、Token
function handleNameChange() {
fromData.scenePortalName = fromData.scenePortalName.trim();
const checkeResult = inputRuleCheck(fromData.scenePortalName, RuleCheckTypeEnum.Text);
if (!checkeResult.isPass) message.warning(checkeResult.message);
state.isNamePass = checkeResult.isPass;
computedCheckPass();
}
function handleLabelChange() {
fromData.scenePortalTages = fromData.scenePortalTages.trim();
const checkeResult = inputRuleCheck(fromData.scenePortalTages, RuleCheckTypeEnum.Text);
if (!checkeResult.isPass) message.warning(checkeResult.message);
state.isLabelPass = checkeResult.isPass;
computedCheckPass();
}
function handleDescribeChange() {
fromData.scenePortalDescription = fromData.scenePortalDescription.trim();
const checkeResult = inputRuleCheck(fromData.scenePortalDescription, RuleCheckTypeEnum.Text);
if (!checkeResult.isPass) message.warning(checkeResult.message);
state.isDescribePass = checkeResult.isPass;
computedCheckPass();
}
// 基于url、name和token在几种情况下,计算校验值是否正确
function computedCheckPass(){
state.isCheckPass = state.isNamePass && state.isLabelPass;
}
// 关闭保存面板
function close() {
panelStore.showSavePanel = false;
Expand Down
3 changes: 3 additions & 0 deletions SuperMap iEarth/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ if (location.href.indexOf('/apps') != -1) {
initPortal();
}

// 切换语言-cooike
// document.cookie = "language=en;"

// 检查iEarthConsole状态,以便打印输出信息
// localStorage.setItem("iEarthConsole", 'yes')
// localStorage.getItem("iEarthConsole");
Expand Down
Loading

0 comments on commit 1cb1d2f

Please sign in to comment.