mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-26 15:02:21 +03:00
взаимодействие с порталом
This commit is contained in:
30
src/lang.js
30
src/lang.js
@@ -1,32 +1,18 @@
|
|||||||
export default {
|
export default {
|
||||||
ru: {
|
ru: {
|
||||||
"login.email": "Введите email",
|
"login.email": "Email",
|
||||||
"login.pass": "Введите пароль",
|
"login.pass": "Пароль",
|
||||||
"login.login": "Вход",
|
"login.login": "Вход",
|
||||||
err_of_registration: "Ошибка регестрации",
|
"profile.update": "Обновить",
|
||||||
err_of_login: "Ошибка входа в систему",
|
ok_success: "Задача запущена",
|
||||||
err_user_exist: "Такой пользователь уже был зарегестрирован",
|
err_order_exist: "Ваша задача выполняется! Cледующию задачу можно будет запустить после завершения",
|
||||||
err_user_not_exist: "Такой пользователь не был зарегестрирован",
|
|
||||||
err_pass: "Неправильный пароль",
|
|
||||||
err_empty_fullname: "Пустое поле имени",
|
|
||||||
err_empty_user: "Пустое поле Email адреса",
|
|
||||||
err_not_email: "Неправильно введен Email",
|
|
||||||
err_pass_lenth: "Пароль должен быть от 4 до 10 символов",
|
|
||||||
ok_success_login: "Вы вошли в систему",
|
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
"login.email": "Email",
|
"login.email": "Email",
|
||||||
"login.pass": "Password",
|
"login.pass": "Password",
|
||||||
"login.login": "Login",
|
"login.login": "Login",
|
||||||
err_of_registration: "Ошибка регестрации",
|
"profile.update": "Update",
|
||||||
err_of_login: "Ошибка входа в систему",
|
ok_success: "Задача запущена",
|
||||||
err_user_exist: "Такой пользователь уже был зарегестрирован",
|
err_order_exist: "Ваша задача выполняется! Cледующию задачу можно будет запустить после завершения",
|
||||||
err_user_not_exist: "Такой пользователь не был зарегестрирован",
|
|
||||||
err_pass: "Неправильный пароль",
|
|
||||||
err_empty_fullname: "Пустое поле имени",
|
|
||||||
err_empty_user: "Пустое поле Email адреса",
|
|
||||||
err_not_email: "Неправильно введен Email",
|
|
||||||
err_pass_lenth: "Пароль должен быть от 4 до 10 символов",
|
|
||||||
ok_success_login: "Вы вошли в систему",
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
export let myProfileJson;
|
export let myProfileJson;
|
||||||
|
|
||||||
let errors = [];
|
let errors = [];
|
||||||
|
|
||||||
let allmodeinfo = null;
|
let allmodeinfo = null;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
@@ -30,23 +31,22 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const post = async (user) => {
|
const update = async () => {
|
||||||
errors = [];
|
|
||||||
try {
|
try {
|
||||||
let res = await fetch("https://portal.iotmanager.org/api/auth/login", {
|
let res = await fetch("https://portal.iotmanager.org/compiler/esporder", {
|
||||||
mode: "cors",
|
mode: "cors",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify(user),
|
body: JSON.stringify(myProfileJson),
|
||||||
});
|
});
|
||||||
const content = await res.json();
|
const content = await res.json();
|
||||||
//console.log(content);
|
//console.log(content);
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
errors = [{ msg: "ok_success_login" }];
|
errors = [{ msg: "ok_success" }];
|
||||||
saveToken(content.message);
|
console.log(content.message);
|
||||||
} else {
|
} else {
|
||||||
errors = content.message;
|
errors = content.message;
|
||||||
}
|
}
|
||||||
@@ -54,57 +54,70 @@
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveToken = async (token) => {
|
|
||||||
console.log("token to be saved: ", token);
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if show}
|
{#if show}
|
||||||
{#if allmodeinfo && myProfileJson}
|
{#if myProfileJson.username}
|
||||||
<div class="my-4">
|
{#if allmodeinfo && myProfileJson}
|
||||||
<div class="grd-1col1">
|
<div class="my-4">
|
||||||
<Card title={myProfileJson.projectProp.platformio.default_envs}>
|
<div class="grd-1col1">
|
||||||
<div class="grid grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-12 2xl:grid-cols-12 gap-4">
|
<Card title="">
|
||||||
{#each myProfileJson.modules.virtual_elments as m, i}
|
<div class="grid grid-cols-2">
|
||||||
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]}
|
<p class="text-center">{myProfileJson.projectProp.platformio.default_envs}</p>
|
||||||
<div>
|
<p class="text-center">{myProfileJson.username}</p>
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
</div>
|
||||||
<p on:click={() => (m.active = !m.active)} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}</p>
|
<div class="grid my-4 grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-12 2xl:grid-cols-12 gap-4">
|
||||||
</div>
|
{#each myProfileJson.modules.virtual_elments as m, i}
|
||||||
{/if}
|
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]}
|
||||||
|
<div>
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
|
<p on:click={() => ((m.active = !m.active), (m.touched = true))} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none {m.touched ? 'border border-gray-400' : 'border border-green-100'} text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
{#each myProfileJson.modules.sensors as m, i}
|
||||||
|
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]}
|
||||||
|
<div>
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
|
<p on:click={() => ((m.active = !m.active), (m.touched = true))} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none {m.touched ? 'border border-gray-400' : 'border border-green-100'} text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
{#each myProfileJson.modules.executive_devices as m, i}
|
||||||
|
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]}
|
||||||
|
<div>
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
|
<p on:click={() => ((m.active = !m.active), (m.touched = true))} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none {m.touched ? 'border border-gray-400' : 'border border-green-100'} text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
{#each myProfileJson.modules.screens as m, i}
|
||||||
|
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]}
|
||||||
|
<div>
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
|
<p on:click={() => ((m.active = !m.active), (m.touched = true))} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none {m.touched ? 'border border-gray-400' : 'border border-green-100'} text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{#each errors as e, i}
|
||||||
|
<p class="text-red-500 p-0 m-0 font-bold text-xs italic">{$t(e.msg)}</p>
|
||||||
{/each}
|
{/each}
|
||||||
{#each myProfileJson.modules.sensors as m, i}
|
<button class="btn-lg mt-6" on:click={() => update()}>{$t("profile.update")}</button>
|
||||||
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]}
|
</Card>
|
||||||
<div>
|
</div>
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
||||||
<p on:click={() => (m.active = !m.active)} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}</p>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
{#each myProfileJson.modules.executive_devices as m, i}
|
|
||||||
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]}
|
|
||||||
<div>
|
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
||||||
<p on:click={() => (m.active = !m.active)} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}</p>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
{#each myProfileJson.modules.screens as m, i}
|
|
||||||
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]}
|
|
||||||
<div>
|
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
||||||
<p on:click={() => (m.active = !m.active)} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}</p>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
</div></Card>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{:else}
|
||||||
|
<div class="my-4">
|
||||||
|
<div class="grd-1col1">
|
||||||
|
<Card title="Сервер недоступен" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<div class="my-4">
|
<div class="my-4">
|
||||||
<div class="grd-1col1">
|
<div class="grd-1col1">
|
||||||
<Card title="Сервер недоступен" />
|
<Card title="Укажите Ваш email который вы использовали при регистрации" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user