소스 검색

添加注册账号控制,添加用户详细页面账号信息无法编辑,添加默认用户在数据库

zhangxike 6 일 전
부모
커밋
36783e6f64
3개의 변경된 파일16개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      pages/mine/person/PersonDetail.uvue
  2. 10 0
      pages/register.uvue
  3. BIN
      static/db/QT800.db

+ 6 - 6
pages/mine/person/PersonDetail.uvue

@@ -7,7 +7,7 @@
 				<form>
 					<view class="uni-form-item uni-row">
 						<view class="title">登录账号</view>
-						<input class="uni-input" name="username" :value="username" @input="inputUsername"/>
+						<input class="uni-input inputDisabled" name="username" :value="username" disabled = "true"/>
 					</view>
 					<view class="uni-form-item uni-row">
 						<view class="title">用户姓名</view>
@@ -80,9 +80,6 @@
 			this.getUser(id)
 		},
 		methods: {
-			inputUsername(event : UniInputEvent) {
-				this.user.username = event.detail.value
-			},
 			inputName(event : UniInputEvent) {
 				this.user.name = event.detail.value
 			},
@@ -128,7 +125,7 @@
 					})
 					return
 				}
-				if (this.user.username == null && this.user.name == null && this.user.password == null && this.user.confirmPassword == null) {
+				if (this.user.name == null && this.user.password == null && this.user.confirmPassword == null) {
 					uni.showToast({
 						title: "没有做修改",
 						icon: "error"
@@ -137,7 +134,6 @@
 				}
 				
 
-
 				getList('app_user', 'id', this.id, null, null, null).then((res : UTSJSONObject) => {
 					let userList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>();
 					console.log(userList);
@@ -215,4 +211,8 @@
 	.title {
 		width: 100rpx;
 	}
+	
+	.inputDisabled {
+		background-color: #dfdfdf;
+	}
 </style>

+ 10 - 0
pages/register.uvue

@@ -102,6 +102,16 @@ import { getCodeImg, register, RegForm} from '@/api/login'
             title: '请输入您的账号',
             icon: 'error'
           });
+        } else if (this.registerForm.username.length < 4 || this.registerForm.username.length > 20) {
+          uni.showToast({
+            title: '账号长度需在4-20位之间',
+            icon: 'error'
+          });
+        } else if (!/^[a-zA-Z0-9]+$/.test(this.registerForm.username)) {
+          uni.showToast({
+            title: '账号只能包含字母和数字',
+            icon: 'error'
+          });
         } else if (this.registerForm.password == "") {
           uni.showToast({
             title: '请输入您的密码',

BIN
static/db/QT800.db