From bc7cca2032fbc9c359ab80080b6da2421a29d6d2 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期四, 11 九月 2025 15:10:51 +0800
Subject: [PATCH] 修改登录服务器选择功能,采购入库光标默认根据客户设置
---
pages/index/login.vue | 91 ++++++++++++++++-----------------------------
1 files changed, 32 insertions(+), 59 deletions(-)
diff --git a/pages/index/login.vue b/pages/index/login.vue
index 4656d3f..04f5812 100644
--- a/pages/index/login.vue
+++ b/pages/index/login.vue
@@ -45,28 +45,17 @@
<view class="apibtn" @tap="changeApi=true">淇敼鏈嶅姟鍣ㄥ湴鍧�</view> -->
</view>
</view>
- <!-- <hFormAlert v-if="changeApi" placeholder="璇疯緭鍏ユ湇鍔″櫒鍦板潃" @confirm="confirm" @cancel="cancel"></hFormAlert> -->
- <uni-popup ref="popup" type="center">
- <uni-popup-dialog title="鏈嶅姟鍣ㄨ缃�" mode="input" @confirm="confirmHandler">
- <view class="popup-content">
- <picker class="pop-item" :range="arrayServerOrganization" :value="serverOrganization"
- @change="serverOrganizationChange">
- <view class="right" style="display: flex;align-items: center;">
- <input type="text" disabled v-model="serverOrganization" placeholder="璇烽�夋嫨褰撳墠缁勭粐">
- <uni-icons type="forward" color="#808080"
- style="border-left: 1px solid #aaaaaa;padding: 0 8rpx;" size="18"></uni-icons>
- </view>
- </picker>
- <view class="pop-item">
- <input type="text" :value="serverUrlCache" placeholder="璇疯緭鍏ユ湇鍔″櫒鍦板潃" />
- </view>
- </view>
- </uni-popup-dialog>
- </uni-popup>
-
+ <uni-popup ref="popup" type="center">
+ <uni-popup-dialog title="鏈嶅姟鍣ㄨ缃�" mode="input" @confirm="confirmHandler" :before-close="true" @close="close">
+ <view class="popup-content">
+ <input type="text" v-model="serverUrlName" placeholder="璇疯緭鍏ユ湇鍔″櫒鍚嶇О">
+ </view>
+ </uni-popup-dialog>
+ </uni-popup>
+
<view class="btn" @tap="submit">鐧� 褰�</view>
- <!-- <view class="btn apibtn" @tap="changeApi=true">鏈嶅姟鍣ㄨ缃�</view> -->
- <view class="btn apibtn" @click="openServerSettingHandler">鏈嶅姟鍣ㄨ缃�</view>
+ <view class="btn apibtn" @click="openServerSettingHandler">鏈嶅姟鍣ㄨ缃�</view>
+
</view>
</view>
</template>
@@ -89,13 +78,10 @@
CommonUtils,
arrayDataBases: [],
DataBases: '',
-
- arrayServerOrganization: ["娴欐睙鏅轰簯杩堟��", "娓╁窞娴疯瘹"],
- arrayServerOrganizationValues: [
- 'http://47.96.97.237/API/',
- 'http://122.228.39.234:7177/API/'
- ],
- serverOrganization: '',
+
+ serverUrlandName:{"娴欐睙鏅轰簯杩堟��":'http://47.96.97.237/API/',"娓╁窞娴疯瘹鍏夊":'http://122.228.39.234:7177/API/',"瀹佹尝鎯犲悍宸ヤ笟":'http://172.16.72.30:6699/API/'},
+ serverUrlName:'娴欐睙鏅轰簯杩堟��',
+
arrayOrganization: [],
Organization: '',
HOrgNameList: [],
@@ -103,7 +89,6 @@
HOrgName: '',
UserName: '', //admin 001
PassWord: '', //123456
- changeApi: false,
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
serverUrlCache: '',
}
@@ -118,16 +103,6 @@
this.UserName = logindata.UserName
this.PassWord = logindata.PassWord
}
-
- this.serverUrlCache = this.serverUrl
- console.log('this.serverUrlCache: ', this.serverUrlCache);
- let index = this.arrayServerOrganizationValues.findIndex((e) => {
- return e == this.serverUrlCache
- })
- if (index == -1) {
- index = 0
- }
- this.serverOrganization = this.arrayServerOrganization[index]
this.getOrganization()
this.getDataBases()
},
@@ -147,22 +122,26 @@
}
})
},
- confirm(e) {
- console.log(e)
- uni.setStorageSync('serverUrl', e)
- this.serverUrl = e
- this.changeApi = false
- this.getOrganization()
- },
confirmHandler() {
- uni.setStorageSync('serverUrl', this.serverUrlCache)
- this.serverUrl = this.serverUrlCache
- // this.changeApi = false
- this.getOrganization()
+ console.log(this.serverUrlName)
+ console.log(this.serverUrlandName[this.serverUrlName])
+ let url = this.serverUrlandName[this.serverUrlName];
+ if(url!=undefined){
+ uni.setStorageSync('serverUrl', url)
+ this.serverUrl = url
+ this.changeApi = false
+ this.getOrganization()
+ this.$refs.popup.close()
+ }else{
+ uni.showToast({
+ title: '鏈嶅姟鍣ㄥ悕绉伴敊璇閲嶆柊杈撳叆',
+ icon: 'none',
+ })
+ }
},
- cancel() {
- this.changeApi = false
- },
+ close(){
+ this.$refs.popup.close()
+ },
openServerSettingHandler() {
this.$refs.popup.open()
},
@@ -218,12 +197,6 @@
// console.log(e.detail.value)
this.Organization = this.arrayOrganization[e.detail.value]
this.HOrgName = this.HOrgNameList[e.detail.value]
- },
- serverOrganizationChange(e) {
- // console.log(e.detail.value)
- let index = e.detail.value
- this.serverOrganization = this.arrayServerOrganization[index]
- this.serverUrlCache = this.arrayServerOrganizationValues[index]
},
submit() {
if (!this.Organization) {
--
Gitblit v1.9.1