zrg
2025-12-10 fa6f6875fcc426bbfab20f6ecbccb9d56ebc3ca1
pages/index/login.vue
@@ -45,17 +45,18 @@
                    <view class="apibtn" @tap="changeApi=true">修改服务器地址</view> -->
                </view>
            </view>
         <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>
            <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" @click="openServerSettingHandler">服务器设置</view>
            <view class="btn apibtn" @click="openServerSettingHandler">服务器设置</view>
        </view>
    </view>
</template>
@@ -78,10 +79,28 @@
                CommonUtils,
                arrayDataBases: [],
                DataBases: '',
            serverUrlandName:{"浙江智云迈思":'http://47.96.97.237/API/',"温州海诚光学":'http://122.228.39.234:7177/API/',"宁波惠康工业":'http://172.16.72.30:6699/API/'},
            serverUrlName:'浙江智云迈思',
                serverUrlandName: {
                    "浙江智云迈思": 'http://47.96.97.237/API/',
                    "温州海诚光学": 'http://122.228.39.234:7177/API/',
                    "宁波惠康工业": 'http://172.16.72.30:6699/API/',
                    "余姚兴达起动器": 'http://121.37.133.104/API/',
                "李林俊本地测试": 'http://localhost:8082/LuBaoAPI/',
               "杭州凯贝奈特": 'http://192.168.50.253:8080/API/',
               "杭州凯贝奈特外网": 'http://erp.hzcabinet.cn:9090/API/',
               "翁涛涛本地测试": 'http://localhost:81/API/',
               "陈镐哲本地测试": 'http://localhost:81/API/',
               "张瑞广本地测试": 'http://localhost:8082/API/',
               "余思杰本地测试": 'http://localhost:8082/LuBaoAPI/',
                    // 小卫内外网
               "苏州卫智科技-外网": 'http://221.224.60.42:8082/API_WW/',
               "苏州卫智科技-内网": 'http://172.16.20.233:8082/API_NW/',
                    // 四维尔内外网
                    "宁波四维尔-内网": "http://192.168.0.236:9010/API/",
                    "宁波四维尔-外网": "http://220.189.218.155:9010/API/",
                },
                serverUrlName: '浙江智云迈思',
                arrayOrganization: [],
                Organization: '',
                HOrgNameList: [],
@@ -89,7 +108,7 @@
                HOrgName: '',
                UserName: '', //admin    001
                PassWord: '', //123456
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API/',
                serverUrlCache: '',
            }
        },
@@ -100,8 +119,10 @@
                logindata = JSON.parse(logindata)
                this.HOrgName = logindata.HOrgName
                this.Organization = logindata.Organization
                this.UserName = logindata.UserName
                this.PassWord = logindata.PassWord
                this.UserName = logindata.HUserNumber
                this.PassWord = logindata.HPassWord
                // this.UserName = logindata.UserName
                // this.PassWord = logindata.PassWord
            }
            this.getOrganization()
            this.getDataBases()
@@ -124,24 +145,24 @@
            },
            confirmHandler() {
                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',
               })
            }
                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',
                    })
                }
            },
         close(){
            this.$refs.popup.close()
         },
            close() {
                this.$refs.popup.close()
            },
            openServerSettingHandler() {
                this.$refs.popup.open()
            },
@@ -170,7 +191,7 @@
            },
            getOrganization() {
            this.arrayOrganization = []
                this.arrayOrganization = []
                uni.request({
                    url: this.serverUrl + '/Web/GetOrganizations',
                    success: (res) => {
@@ -219,15 +240,22 @@
                        title: '登录中...',
                        mask: true
                    })
                    var data = {
                        UserName: this.UserName,
                        PassWord: this.PassWord,
                        HOrgName: this.HOrgName,
                        Organization: this.Organization
                    var data =
                    {
                        HUserNumber: this.UserName,
                        HPassWord: this.PassWord,
                        HStockOrgID: this.HOrgName,
                        HStockOrgName: this.Organization
                    }
                    //     UserName: this.UserName,
                    //     PassWord: this.PassWord,
                    //     HOrgName: this.HOrgName,
                    //     Organization: this.Organization
                    // }
                    uni.setStorageSync('loginData', JSON.stringify(data));
                    uni.request({
                        url: this.serverUrl + '/Web/GetUser',
                        url: this.serverUrl + 'WEBSController/GetUser_Json',
                        method: 'GET',
                        data: data,
                        success: (res) => {
@@ -246,6 +274,19 @@
                                uni.setStorageSync('login', "login");
                                uni.setStorageSync('Organization', this.Organization);
                                uni.setStorageSync('OrganizationID', this.HOrgName);
                        //存储部门 职员 仓库 等信息
                        uni.setStorageSync('HDeptID', res.data.data[0].HDeptID); //部门
                        uni.setStorageSync('HDeptName', res.data.data[0].HDeptName);
                        uni.setStorageSync('HEmpID', res.data.data[0].HEmpID); //职员
                        uni.setStorageSync('HEmpName', res.data.data[0].HEmpName);
                        uni.setStorageSync('HSCWHID', res.data.data[0].HSCWHID); //调入仓库
                        uni.setStorageSync('HSCWHName', res.data.data[0].HSCWHName);
                        uni.setStorageSync('HWhID', res.data.data[0].HWhID);//对应仓库
                        uni.setStorageSync('HWhName', res.data.data[0].HWhName);
                        uni.setStorageSync('HWorkCenterID', res.data.data[0].HWorkCenterID);//工作中心
                        uni.setStorageSync('HWorkCenterName', res.data.data[0].HWorkCenterName);
                        uni.setStorageSync('HSecManagerID', res.data.data[0].HSecManagerID); //对应验收
                        uni.setStorageSync('HSecManagerName', res.data.data[0].HSecManagerName);
                                this.CommonUtils.setServerUrl(this.serverUrl)
                                uni.reLaunch({
                                    url: '/pages/index/index'
@@ -261,6 +302,42 @@
                            })
                        },
                    });
                    // uni.request({
                    //     url: this.serverUrl + '/Web/GetUser',
                    //     method: 'GET',
                    //     data: data,
                    //     success: (res) => {
                    //         console.log(res)
                    //         uni.hideLoading()
                    //         uni.showToast({
                    //             title: res.data.Message,
                    //             icon: 'none'
                    //         })
                    //         if (res.data.count == 1) {
                    //             setLoginData(data)
                    //             setUserInfo(res.data.data[0])
                    //             uni.setStorageSync('HUserName', res.data.data[0].Czymc);
                    //             uni.setStorageSync('HBillerID', res.data.data[0].HK3UserID);
                    //             uni.setStorageSync('SourceFlag', false);
                    //             uni.setStorageSync('login', "login");
                    //             uni.setStorageSync('Organization', this.Organization);
                    //             uni.setStorageSync('OrganizationID', this.HOrgName);
                    //             this.CommonUtils.setServerUrl(this.serverUrl)
                    //             uni.reLaunch({
                    //                 url: '/pages/index/index'
                    //             })
                    //         }
                    //     },
                    //     fail: (res) => {
                    //         console.log(res);
                    //         uni.hideLoading()
                    //         uni.showToast({
                    //             title: '接口请求失败',
                    //             icon: 'none'
                    //         })
                    //     },
                    // });
                }
            }
        }