From 2d2756dc0e61ed8cd38c2796daf5cacdfdd49bf2 Mon Sep 17 00:00:00 2001
From: jialh <1972868360@qq.com>
Date: 星期三, 20 八月 2025 18:46:54 +0800
Subject: [PATCH] 更新
---
pages/index/authOwner.vue | 111 +++++++++++++++++++++++++++++++++----------------------
1 files changed, 67 insertions(+), 44 deletions(-)
diff --git a/pages/index/authOwner.vue b/pages/index/authOwner.vue
index 6c11a90..1c8cbed 100644
--- a/pages/index/authOwner.vue
+++ b/pages/index/authOwner.vue
@@ -12,17 +12,18 @@
</view>
<view class="cu-form-group arrow" v-if="communityId" @tap="chooseRoom">
<view class="title">鎴垮眿</view>
- <input readonly v-model="roomName" class="text-right" placeholder="璇烽�夋嫨鎴垮眿" icon="arrow"></input>
+ <input readonly v-model="roomName" class="text-right" placeholder="璇烽�夋嫨鎴垮眿" icon="arrow"></input>
<text class='cuIcon-right'></text>
</view>
<view class="block__title">浜哄憳淇℃伅</view>
- <view class="cu-form-group">
- <view class="title">浜哄憳鍚嶇О</view>
- <input v-model="ownerName" placeholder="璇疯緭鍏ュ悕绉�" class="text-right"></input>
- </view>
+ <!-- <view class="cu-form-group">
+ <view class="title">浜哄憳鍚嶇О</view>
+ <input v-model="ownerName" placeholder="璇疯緭鍏ュ悕绉�" class="text-right"></input>
+ </view> -->
<view class="cu-form-group">
<view class="title">鎵嬫満鍙�</view>
- <input v-model="link" disabled="disabled" placeholder="璇疯緭鍏ユ墜鏈哄彿" class="text-right"></input>
+ <input v-model="link" placeholder="璇疯緭鍏ユ墜鏈哄彿" class="text-right"></input>
+ <text v-if="errorMessage" class="error-message">{{ errorMessage }}</text>
</view>
<view class="cu-form-group">
<view class="title">浜哄憳绫诲瀷</view>
@@ -32,33 +33,38 @@
</view>
</picker>
</view>
-
+
<view class="flex flex-direction margin-top margin-bottom">
<button class="cu-btn bg-blue margin-tb-sm lg" @click="_doAuthOwner()">鎻愪氦</button>
</view>
-
</view>
</template>
<script>
- import {getCommunitys} from '../../api/community/communityApi.js';
- import {getUserTel} from '../../api/user/userApi.js';
- import {authOwner} from '../../api/owner/ownerApi.js';
+ import {
+ getCommunitys
+ } from '../../api/community/communityApi.js';
+ import {
+ getUserTel
+ } from '../../api/user/userApi.js';
+ import {
+ authOwner
+ } from '../../api/owner/ownerApi.js';
+
export default {
data() {
return {
communityIndex: 0,
- communityId:'',
- roomId:'',
- roomName:'',
- link:'',
- ownerName:'',
+ communityId: '',
+ roomId: '',
+ roomName: '',
+ link: '',
+ ownerName: '',
communitys: [{
communityId: '',
name: '璇烽�夋嫨灏忓尯'
}],
- "typeCds": [
- {
+ typeCds: [{
value: '1001',
name: '涓氫富'
},
@@ -67,8 +73,9 @@
name: '鎴愬憳'
}
],
- "typeCdIndex": 0,
- "ownerTypeCd": "1001",
+ typeCdIndex: 0,
+ ownerTypeCd: "1001",
+ errorMessage: '' // 鏂板涓�涓敤浜庡瓨鏀鹃敊璇俊鎭殑瀛楁
}
},
onLoad(options) {
@@ -77,7 +84,7 @@
},
onShow() {
let _selectRoom = uni.getStorageSync('selectRoom');
- if(_selectRoom){
+ if (_selectRoom) {
this.roomName = _selectRoom.roomName;
this.roomId = _selectRoom.roomId;
uni.removeStorageSync('selectRoom');
@@ -89,41 +96,56 @@
let selected = this.communitys[this.communityIndex] //鑾峰彇閫変腑鐨勬暟缁�
this.communityId = selected.communityId; //閫変腑鐨刬d
},
- _loadCommunitys:function(){
- let _that =this;
+ _loadCommunitys: function() {
+ let _that = this;
getCommunitys({
- page:1,
- row:500
- }).then(_communitys=>{
- _communitys.forEach(_c=>{
+ page: 1,
+ row: 500
+ }).then(_communitys => {
+ _communitys.forEach(_c => {
_that.communitys.push(_c);
})
-
})
},
- chooseRoom:function(){
+ chooseRoom: function() {
uni.navigateTo({
- url:'/pages/family/selectRoom?communityId='+this.communityId
+ url: '/pages/family/selectRoom?communityId=' + this.communityId
})
},
- _changeTypeCd: function(e){
+ _changeTypeCd: function(e) {
this.typeCdIndex = e.detail.value;
this.ownerTypeCd = this.typeCds[this.typeCdIndex].value;
},
- _doAuthOwner:function(){
+ _doAuthOwner: function() {
+ 姝e垯楠岃瘉鎵嬫満鍙锋牸寮�
+ const phoneRegex = /^1[3-9]\d{9}$/; // 姝g‘鐨勬墜鏈哄彿鏍煎紡
+ if (!phoneRegex.test(this.link)) {
+ this.errorMessage = '璇疯緭鍏ユ湁鏁堢殑鎵嬫満鍙�'; // 璁剧疆閿欒淇℃伅
+ return; // 濡傛灉鎵嬫満鍙锋牸寮忎笉瀵癸紝鍋滄鎵ц
+ } else {
+ this.errorMessage = ''; // 娓呴櫎閿欒淇℃伅
+ }
+
authOwner({
- communityId:this.communityId,
- roomName:this.roomName,
- roomId:this.roomId,
- link:this.link,
- ownerName:this.ownerName,
- ownerTypeCd:this.ownerTypeCd,
- }).then(_data=>{
- //todo 璺宠浆鍒拌璇佸巻鍙查〉闈�
+ communityId: this.communityId,
+ roomName: this.roomName,
+ roomId: this.roomId,
+ link: this.link,
+ ownerName: this.ownerName,
+ ownerTypeCd: this.ownerTypeCd,
+ }).then(_data => {
+ // todo 璺宠浆鍒拌璇佸巻鍙查〉闈�
uni.navigateTo({
- url:'/pages/index/authOwnerLog'
+ url: '/pages/index/authOwnerLog'
})
- })
+ }).catch(err => {
+ // 澶勭悊閿欒鎯呭喌
+ wx.showToast({
+ icon: 'none',
+ title: err || '璁よ瘉澶辫触锛岃閲嶈瘯' // 鎻愪緵涓�涓粯璁ょ殑閿欒鎻愮ず
+ });
+ });
+
}
}
}
@@ -138,7 +160,8 @@
padding: 40rpx 30rpx 20rpx;
}
- .button_up_blank {
- height: 40rpx;
+ .error-message {
+ color: red;
+ /* 閿欒淇℃伅鐨勭孩鑹插瓧浣� */
}
</style>
\ No newline at end of file
--
Gitblit v1.8.0