From 2563324bb55eee5238619ed4fc7f02b8e5d169d4 Mon Sep 17 00:00:00 2001 From: veypi Date: Thu, 12 Oct 2023 03:44:19 +0800 Subject: [PATCH] crud cfgpage --- oab/migrations/20220720220617_base.sql | 3 +- oab/src/api/user.rs | 11 +- oaweb/package.json | 2 + oaweb/src/App.vue | 8 - oaweb/src/assets/icon.js | 2 +- oaweb/src/components/crud.vue | 242 +++++++++++--- oaweb/src/components/vinput/index.ts | 9 + oaweb/src/components/vinput/index.vue | 422 +++++++++++++++++++++++++ oaweb/src/css/app.scss | 60 ++++ oaweb/src/css/quasar.variables.scss | 19 +- oaweb/src/layouts/AppLayout.vue | 2 +- oaweb/src/libs/util.ts | 3 + oaweb/src/models/index.ts | 34 ++ oaweb/src/pages/AppCfg.vue | 69 +++- oaweb/src/pages/AppUser.vue | 8 +- oaweb/yarn.lock | 10 + 16 files changed, 816 insertions(+), 88 deletions(-) create mode 100644 oaweb/src/components/vinput/index.ts create mode 100644 oaweb/src/components/vinput/index.vue diff --git a/oab/migrations/20220720220617_base.sql b/oab/migrations/20220720220617_base.sql index 99bbfde..1b85ac1 100644 --- a/oab/migrations/20220720220617_base.sql +++ b/oab/migrations/20220720220617_base.sql @@ -41,7 +41,8 @@ CREATE TABLE IF NOT EXISTS `app` `join_method` int NOT NULL DEFAULT 0, `role_id` varchar(32), - `redirect` varchar(255), + `host` varchar(255) NOT NULL DEFAULT '', + `redirect` varchar(255) NOT NULL DEFAULT '', `status` int NOT NULL COMMENT '状态(0:ok,1:disabled)' DEFAULT 0, PRIMARY KEY (`id`) USING BTREE diff --git a/oab/src/api/user.rs b/oab/src/api/user.rs index 7fc52c8..8ea8154 100644 --- a/oab/src/api/user.rs +++ b/oab/src/api/user.rs @@ -14,12 +14,10 @@ use crate::{ }; use actix_web::{delete, get, head, http, post, web, HttpResponse, Responder}; use base64; +use chrono::{DateTime, Local, NaiveDateTime}; use proc::access_read; use rand::Rng; -use sea_orm::{ - ActiveModelTrait, ColumnTrait, - EntityTrait, QueryFilter, TransactionTrait, -}; +use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, QueryFilter, TransactionTrait}; use serde::{Deserialize, Serialize}; use tracing::info; @@ -148,7 +146,6 @@ pub async fn register( Ok(p) => p, Err(_) => return Err(Error::ArgInvalid("password".to_string())), }; - info!("{}", p); let mut u = models::user::Model::default(); u.username = q.username.clone(); u.id = uuid::Uuid::new_v4().to_string().replace("-", ""); @@ -158,6 +155,10 @@ pub async fn register( u.icon = Some(format!("/media/icon/usr/{:04}.jpg", idx)); u.space = 300; u.used = 0; + info!("{}", u.created.to_string()); + u.created = Local::now().naive_utc(); + u.updated = Local::now().naive_utc(); + info!("{}", u.created.to_string()); u.into() } }; diff --git a/oaweb/package.json b/oaweb/package.json index 29a95b8..91167be 100644 --- a/oaweb/package.json +++ b/oaweb/package.json @@ -15,6 +15,7 @@ "dependencies": { "@quasar/extras": "^1.16.4", "@toast-ui/editor": "^3.2.2", + "@types/validator": "^13.11.2", "@veypi/msg": "^0.1.1", "@veypi/oaer": "^0.0.1", "@veypi/one-icon": "2", @@ -26,6 +27,7 @@ "mitt": "^3.0.1", "pinia": "^2.0.11", "quasar": "^2.6.0", + "validator": "^13.11.0", "vite-plugin-rewrite-all": "^1.0.1", "vue": "^3.0.0", "vue-i18n": "^9.2.2", diff --git a/oaweb/src/App.vue b/oaweb/src/App.vue index b90cd5d..9c9493b 100644 --- a/oaweb/src/App.vue +++ b/oaweb/src/App.vue @@ -41,12 +41,4 @@ body, :root { --z-index: 1; } - -.page-h1 { - font-size: 2.5rem; - line-height: 2.5rem; - margin-left: 2.5rem; - margin-top: 1.5rem; - margin-bottom: 2rem; -} diff --git a/oaweb/src/assets/icon.js b/oaweb/src/assets/icon.js index f74032a..be2ce60 100644 --- a/oaweb/src/assets/icon.js +++ b/oaweb/src/assets/icon.js @@ -1 +1 @@ -window._iconfont_svg_string_3335115='',function(h){var c=(c=document.getElementsByTagName("script"))[c.length-1],l=c.getAttribute("data-injectcss"),c=c.getAttribute("data-disable-injectsvg");if(!c){var t,a,o,i,e,v=function(c,l){l.parentNode.insertBefore(c,l)};if(l&&!h.__iconfont__svg__cssinject__){h.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}t=function(){var c,l=document.createElement("div");l.innerHTML=h._iconfont_svg_string_3335115,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(c=document.body).firstChild?v(l,c.firstChild):c.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(a=function(){document.removeEventListener("DOMContentLoaded",a,!1),t()},document.addEventListener("DOMContentLoaded",a,!1)):document.attachEvent&&(o=t,i=h.document,e=!1,s(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,d())})}function d(){e||(e=!0,o())}function s(){try{i.documentElement.doScroll("left")}catch(c){return void setTimeout(s,50)}d()}}(window); \ No newline at end of file +window._iconfont_svg_string_3335115='',function(l){var c=(c=document.getElementsByTagName("script"))[c.length-1],h=c.getAttribute("data-injectcss"),c=c.getAttribute("data-disable-injectsvg");if(!c){var t,a,o,i,e,v=function(c,h){h.parentNode.insertBefore(c,h)};if(h&&!l.__iconfont__svg__cssinject__){l.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}t=function(){var c,h=document.createElement("div");h.innerHTML=l._iconfont_svg_string_3335115,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(c=document.body).firstChild?v(h,c.firstChild):c.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(a=function(){document.removeEventListener("DOMContentLoaded",a,!1),t()},document.addEventListener("DOMContentLoaded",a,!1)):document.attachEvent&&(o=t,i=l.document,e=!1,s(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,d())})}function d(){e||(e=!0,o())}function s(){try{i.documentElement.doScroll("left")}catch(c){return void setTimeout(s,50)}d()}}(window); \ No newline at end of file diff --git a/oaweb/src/components/crud.vue b/oaweb/src/components/crud.vue index 58da47c..a039c59 100644 --- a/oaweb/src/components/crud.vue +++ b/oaweb/src/components/crud.vue @@ -6,21 +6,35 @@ --> - + diff --git a/oaweb/src/components/vinput/index.ts b/oaweb/src/components/vinput/index.ts new file mode 100644 index 0000000..b0e3a19 --- /dev/null +++ b/oaweb/src/components/vinput/index.ts @@ -0,0 +1,9 @@ +/* +* @name: index +* @author: veypi +* @date: 2022-04-03 14:56 +* @description:index +*/ + +import index from './index.vue' +export default index diff --git a/oaweb/src/components/vinput/index.vue b/oaweb/src/components/vinput/index.vue new file mode 100644 index 0000000..d2b9b84 --- /dev/null +++ b/oaweb/src/components/vinput/index.vue @@ -0,0 +1,422 @@ + + + + + diff --git a/oaweb/src/css/app.scss b/oaweb/src/css/app.scss index ecac98f..0844dc0 100644 --- a/oaweb/src/css/app.scss +++ b/oaweb/src/css/app.scss @@ -1 +1,61 @@ // app global css in SCSS form + +:root { + transition: all 0.2s linear; + --base-color: #000; + --base-bg: #f5f5f5; + --base-bg-1: #e0e0e0; + --base-bg-2: #d0d0d0; + --base-bg-3: #c0c0c0; + + --header-bg: #d0d0d0; + + --color-primary: #2196f3; + --color-secondary: #03a9f4; + --color-accent: #ff9800; + --color-error: #f44336; + --color-warning: #ff5722; + --color-info: #ffc107; + --color-success: #4caf50; + + --input-line-default: #002f55; + --input-line-shine: #1467ff; + --input-line-error: var(--color-error); +} + +.page-h1 { + font-size: 2.5rem; + line-height: 2.5rem; + margin-left: 2.5rem; + margin-top: 1.5rem; + margin-bottom: 2rem; +} + +.div-center { + @apply flex justify-center items-center; +} + +.div-btn { + @apply cursor-pointer transition duration-500 ease-in-out transform hover:scale-110 hover:opacity-50; +} + +.div-btn hr { + right: 50%; + position: absolute; + bottom: 1px; + width: 0; + border: var(--color-primary) solid 1px; + visibility: hidden; + transition: all 0.2s linear; +} + +.div-btn:hover { + /*border-bottom: #03a9f4 1px solid;*/ +} + +.div-btn:hover hr { + visibility: visible; + width: 80%; + right: 10%; +} + diff --git a/oaweb/src/css/quasar.variables.scss b/oaweb/src/css/quasar.variables.scss index 3b789ee..35e6e19 100644 --- a/oaweb/src/css/quasar.variables.scss +++ b/oaweb/src/css/quasar.variables.scss @@ -15,14 +15,15 @@ // src/css/quasar.variables.sass -$primary : #f74d22; -$secondary : #fa9243; -$accent : #9C27B0; -$dark : #1d1d1d; -$dark-page : #121212; + $primary : #f74d22; + $secondary : #fa9243; + $accent : #9C27B0; -$positive : #21BA45; -$negative : #ff0000; -$info : #28d4ce; -$warning : #f2e638; + $dark : #1d1d1d; + $dark-page : #121212; + + $positive : #21BA45; + $negative : #ff0000; + $info : #28d4ce; + $warning : #f2e638; diff --git a/oaweb/src/layouts/AppLayout.vue b/oaweb/src/layouts/AppLayout.vue index eb86295..931d354 100644 --- a/oaweb/src/layouts/AppLayout.vue +++ b/oaweb/src/layouts/AppLayout.vue @@ -5,7 +5,7 @@ * Distributed under terms of the MIT license. -->