| | |
| | | <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"> |
| | | <uni-popup-dialog title="服务器设置" mode="input" @confirm="confirmHandler" :before-close="true" |
| | | @close="close"> |
| | | <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> |
| | | <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> |
| | | </view> |
| | | </template> |
| | | |
| | | |
| | | <script> |
| | | import { |
| | | setLoginData, |
| | | setUserInfo |
| | | } from "@/utils/auth.js"; |
| | | import hFormAlert from '@/components/h-form-alert/h-form-alert.vue'; |
| | | import { |
| | | CommonUtils |
| | | } from "../../utils/common"; |
| | | export default { |
| | | components: { |
| | | hFormAlert |
| | | }, |
| | | data() { |
| | | return { |
| | | 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/', |
| | | "余姚兴达起动器": 'http://121.37.133.104/API/', |
| | | "苏州卫智科技-外网": 'http://221.224.60.42:8082/API_WW/', |
| | | "苏州卫智科技-内网": 'http://172.16.20.233:8082/API_NW/', |
| | | "翁涛涛本地测试": 'http://localhost:81/API/', |
| | | "陈镐哲本地测试": 'http://localhost:81/API/', |
| | | }, |
| | | serverUrlName: '浙江智云迈思', |
| | | |
| | | arrayOrganization: [], |
| | | Organization: '', |
| | | HOrgNameList: [], |
| | | |
| | | |
| | | HOrgName: '', |
| | | UserName: '', //admin 001 |
| | | PassWord: '', //123456 |
| | | changeApi: false, |
| | | serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API', |
| | | serverUrlCache: '', |
| | | } |
| | | }, |
| | | onLoad() { |
| | | onShow() { |
| | | var logindata = uni.getStorageSync('loginData') || '' |
| | | // console.log(logindata) |
| | | if (logindata) { |
| | | 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.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() |
| | | }, |
| | |
| | | await this.$nextTick(() => { |
| | | this.Organization = this.arrayOrganization[0] |
| | | this.HOrgName = this.HOrgNameList[0] |
| | | |
| | | |
| | | let org = uni.getStorageSync('Organization') |
| | | let orgName = uni.getStorageSync('OrganizationID') |
| | | let orgHas = Array.from(this.arrayOrganization).findIndex((e) => e == org) |
| | | if(org && (orgHas != -1)) { |
| | | if (org && (orgHas != -1)) { |
| | | this.Organization = org |
| | | this.HOrgName = orgName |
| | | } |
| | | }) |
| | | }, |
| | | 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() |
| | |
| | | this.DataBases = this.arrayDataBases[e.detail.value] |
| | | uni.setStorageSync('DataBases', this.DataBases); |
| | | }, |
| | | |
| | | |
| | | getOrganization() { |
| | | this.arrayOrganization = [] |
| | | uni.request({ |
| | | url: this.serverUrl + '/Web/GetOrganizations', |
| | | success: (res) => { |
| | |
| | | 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) { |
| | | uni.showToast({ |
| | |
| | | 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) => { |
| | |
| | | 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' |
| | | }) |
| | |
| | | }) |
| | | }, |
| | | }); |
| | | |
| | | // 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' |
| | | // }) |
| | | // }, |
| | | // }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | |
| | | <style lang="scss" scoped> |
| | | .bg-img { |
| | | position: fixed; |
| | |
| | | left: 0; |
| | | z-index: -1; |
| | | } |
| | | |
| | | |
| | | .container { |
| | | width: 100%; |
| | | height: 100%; |
| | |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | |
| | | |
| | | .title { |
| | | margin-top: 174rpx; |
| | | font-size: 47rpx; |
| | | font-weight: bold; |
| | | color: #FFFFFF; |
| | | } |
| | | |
| | | |
| | | .box { |
| | | width: 682rpx; |
| | | position: relative; |
| | | top: 120rpx; |
| | | display: flex; |
| | | justify-content: center; |
| | | |
| | | |
| | | .logo { |
| | | width: 155rpx; |
| | | height: 155rpx; |
| | |
| | | z-index: 9; |
| | | background-color: rgba(255, 255, 255, 0.5); |
| | | border-radius: 100%; |
| | | |
| | | |
| | | image { |
| | | width: 100%; |
| | | height: 100%; |
| | |
| | | background-color: #f0f3f7; |
| | | } |
| | | } |
| | | |
| | | |
| | | .login { |
| | | width: 100%; |
| | | height: 480rpx; |
| | |
| | | border-radius: 25rpx 0 25rpx 0; |
| | | box-shadow: 0 6rpx 24rpx 8rpx rgba(21, 99, 210, 0.14); |
| | | padding-top: 160rpx; |
| | | |
| | | |
| | | .item { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | margin-right: 38rpx; |
| | | margin-bottom: 70rpx; |
| | | |
| | | |
| | | .left { |
| | | font-size: 34rpx; |
| | | font-weight: 400; |
| | | color: #3C3C3C; |
| | | } |
| | | |
| | | |
| | | .right { |
| | | width: 441rpx; |
| | | height: 68rpx; |
| | | background: #EBEBEB; |
| | | border-radius: 10rpx; |
| | | |
| | | |
| | | input { |
| | | height: 100%; |
| | | padding: 0 30rpx; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // .api{ |
| | | // margin-left: 30rpx; |
| | | // font-size: 27rpx; |
| | |
| | | // } |
| | | } |
| | | } |
| | | |
| | | |
| | | .btn { |
| | | width: 540rpx; |
| | | height: 92rpx; |
| | |
| | | text-align: center; |
| | | font-size: 36rpx; |
| | | } |
| | | |
| | | |
| | | .apibtn { |
| | | margin-top: 50rpx; |
| | | background: #eec18e; |
| | | box-shadow: 0rpx 0rpx 44rpx 7rpx rgba(253, 186, 118, 0.3); |
| | | } |
| | | } |
| | | |
| | | |
| | | .popup-content { |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 30rpx; |
| | | |
| | | |
| | | .pop-item { |
| | | border: #EBEBEB 2rpx solid; |
| | | border-radius: 10rpx; |
| | | padding: 14rpx 8rpx; |
| | | } |
| | | |
| | | |
| | | >picker { |
| | | background-color: #EBEBEB; |
| | | } |