@@ -4,57 +4,52 @@
< view class = "haotoplogo" >
< image src = "/static/haotop/image/logo/Start.jpg" mode = "aspectFit" class = "logoimg" > < / image >
< / view >
<!-- < div v-if = "loginType === 'currentPhone'" > - - >
<!-- < u-tabs :list = "list" :is-scroll = "false" :current = "current" @change ="onClickItem" > < / u -tabs > -- >
<!-- < view v-if = "current === 0" > - - >
< view class = "list" >
< template v-if = "isDevelopment" >
< view class = "list-call" >
< view class = "iconfont icon-link" style = "font-size: 22px;color:#5473e8;" > < / view >
< view style = "width: 100%;" >
< view class = "server-selector" @click ="showServerPicker" >
< text > { { getApiUrlLabel ( ) } } < / text >
< view class = "iconfont icon-arrow-down" style = "font-size: 16px;" > < / view >
< / view >
< / view >
<!-- < div v-if = "loginType === 'currentPhone'" > - - >
<!-- < u-tabs :list = "list" :is-scroll = "false" :current = "current" @change ="onClickItem" > < / u -tabs > -- >
<!-- < view v-if = "current === 0" > - - >
< view class = "list" >
< template v-if = "isDevelopment" >
< view class = "list-call" >
< view class = "iconfont icon-link" style = "font-size: 22px;color:#5473e8;" > < / view >
< view style = "width: 100%;" >
< view class = "server-selector" @click ="showServerPicker" >
< text > { { getApiUrlLabel ( ) } } < / text >
< view class = "iconfont icon-arrow-down" style = "font-size: 16px;" > < / view >
< / view >
< view class = "list-call" v-if = "selectedApiUrl === 'custom'" >
< ! - - 当选择自定义时显示输入框 - - >
< input
class = "u-input"
type = "text"
v-model = "customApiUrl"
maxlength = "100"
placeholder = "请输入服务器地址"
@blur ="handleBlurInputUrl"
/ >
< / view >
< / template >
< view class = "list-call" >
< view class = "iconfont icon-avatar" style = "font-size: 22px;color:#5473e8;" > < / view >
< input class = "u-input" type = "text" v-model = "login.username" maxlength="32"
:placeholder = "$t('login.placeholderAccount')" value = "admin" @input ="clearInput" />
< u -icon :size = "50" v-if = "showClearIcon" name="close-circle-fill" color="#c0c4cc" class="u-clear-icon" @click="clearIcon" />
< / view >
< view class = "list-call" >
< view class = "iconfont icon-key " style = "font-size: 22px;color:#5473e8;" > < / view >
< input class = "u-input" type = "text" v-model = "login.password" maxlength="32"
:placeholder = "$t('login.placeholderPassword')" :password = "!showPassword " value = "admin123" / >
< image class = "u-icon-right"
: src = "'/static/aidex/login/eye_' + (showPassword ? 'open' : 'close') + '.png'"
@click ="showPass()" > < / image >
< / view >
< div style = "padding:15rpx 0 0;" >
<!-- < view class = "register" >
< / view >
< view class = "list-call " v-if = "selectedApiUrl === 'custom'" >
< ! - - 当选择自定义时显示输入框 - - >
< input class = "u-input" type = "text " v-model = "customApiUrl" maxlength="100" placeholder="请输入服务器地址"
@blur ="handleBlurInputUrl" / >
< / view >
< / template >
< view class = "list-call" >
< view class = "iconfont icon-avatar" style = "font-size: 22px;color:#5473e8;" > < / view >
< input class = "u-input" type = "text" v-model = "login.username" maxlength="32"
:placeholder = "$t('login.placeholderAccount')" value = "admin" @input ="clearInput" / >
< u-icon :size = "50" v-if = "showClearIcon" name="close-circle-fill" color="#c0c4cc" class="u-clear-icon"
@click ="clearIcon" / >
< / view >
< view class = "list-call" >
< view class = "iconfont icon-key" style = "font-size: 22px;color:#5473e8;" > < / view >
< input class = "u-input" type = "text" v-model = "login.password" maxlength="32"
:placeholder = "$t('login.placeholderPassword')" :password = "!showPassword" value = "admin123" / >
< image class = "u-icon-right" : src = "'/static/aidex/login/eye_' + (showPassword ? 'open' : 'close') + '.png'"
@click ="showPass()" > < / image >
< / view >
< div style = "padding:15rpx 0 0;" >
<!-- < view class = "register" >
< navigator class = "register-link" url = "forget" open -type = " navigate " > { { $t ( 'login.forget' ) } }
< / navigator >
< navigator class = "register-link" url = "reg" open -type = " navigate " > { { $t ( 'login.reg' ) } } < / navigator >
< / view > -- >
< u-checkbox v-model = "remember" active-color="#5473e8" > {{ $ t ( ' login.autoLogin ' ) }} < / u -checkbox >
< / div >
< / view >
< button class = "button" :disabled = "login.loading" @click ="submit('1')" :loading = "login.loading" > < text > 登录 < / text > < / button >
<!-- < view class = "login-bottom-box" >
< u-checkbox v-model = "remember" active-color="#5473e8" > {{ $ t ( ' login.autoLogin ' ) }} < / u -checkbox >
< / div >
< / view >
< button class = "button" :disabled = "login.loading" @click ="submit('1')"
:loading = "login.loading" > < text > 登录 < / text > < / button >
<!-- < view class = "login-bottom-box" >
< u-divider > 更多登录方式 < / u-divider >
< view class = "oauth2" >
< u-icon class = "u-icon" size = "100" color = "#36c956" name = "weixin-circle-fill"
@@ -66,8 +61,8 @@
登录即代表您已阅读并同意 < u-link href = "#" > 用户协议 < / u-link > 与 < u-link href = "#" > 隐私政策 < / u-link >
< / view >
< / view > -- >
<!-- < / view > -- >
<!-- < view v-if = "current === 1" >
<!-- < / view > -- >
<!-- < view v-if = "current === 1" >
< view class = "list" >
< view class = "list-call" >
< view class = "iconfont icon-shouji" style = "font-size: 22px;color:#5473e8;" > < / view >
@@ -95,164 +90,294 @@
< / view >
< / view > -- >
<!-- < / div > -- >
<!-- < / div > -- >
<!-- < div v-if = "loginType !== 'currentPhone'" > - - >
<!-- < view class = "currentPhone-box" > -- >
<!-- < view class = "number-text" > 183 * * * * 1005 < / view > -- >
<!-- < view class = "other-text" > 认证服务由中国移动提供 。 < / view > -- >
<!-- < u-button type = "primary" @click ="submit('3')" > 本机号码一键登录 < / u -button > -- >
<!-- < u-button @click ="qiehuanLogin()" > 其他登录方式 < / u -button > -- >
<!-- < / view > -- >
<!-- < view class = "login-bottom-box" > -- >
<!-- < view class = "copyright" > -- >
<!-- 登录即代表您已阅读并同意 < u-link href = "#" > 用户协议 < / u-link > 与 < u-link href = "#" > 隐私政策 < / u-link > -- >
<!-- < / view > -- >
<!-- < / view > -- >
<!-- < / div > -- >
< u-picker
v-model = "showApiUrlPicker"
mode = "selector"
:range = "apiUrlList"
range -key = " label "
@confirm ="onApiUrlConfirm"
@cancel ="showApiUrlPicker = false"
> < / u-picker >
<!-- < div v-if = "loginType !== 'currentPhone'" > - - >
<!-- < view class = "currentPhone-box" > -- >
<!-- < view class = "number-text" > 183 * * * * 1005 < / view > -- >
<!-- < view class = "other-text" > 认证服务由中国移动提供 。 < / view > -- >
<!-- < u-button type = "primary" @click ="submit('3')" > 本机号码一键登录 < / u -button > -- >
<!-- < u-button @click ="qiehuanLogin()" > 其他登录方式 < / u -button > -- >
<!-- < / view > -- >
<!-- < view class = "login-bottom-box" > -- >
<!-- < view class = "copyright" > -- >
<!-- 登录即代表您已阅读并同意 < u-link href = "#" > 用户协议 < / u-link > 与 < u-link href = "#" > 隐私政策 < / u-link > -- >
<!-- < / view > -- >
<!-- < / view > -- >
<!-- < / div > -- >
< u-picker v-model = "showApiUrlPicker" mode="selector" :range="apiUrlList" range-key="label"
@confirm ="onApiUrlConfirm" @cancel ="showApiUrlPicker = false" > < / u -picker >
<!-- 版本信息显示 -- >
< view class = "version-info" >
< text class = "version-text" > 版本 : { { appVersion } } < / text >
< text class = "env-text" v-if = "envName" > ( {{ envName }} ) < / text >
< / view >
< / view >
< / template >
< script >
/**
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
import config from '@/common/config.js' ;
import base64 from '@/common/base64.js' ;
import util from '@/common/util.js' ;
import md5 from '@/common/md5.js' ;
import manifest from '@/manifest.json' ;
import { mapState } from 'vuex'
export default {
data ( ) {
return {
isDevelopment : config . isDevelopment ,
showClearIcon : false ,
login : {
loading : false ,
username : "" ,
password : ""
} ,
showApiUrlPicker : false ,
// 根据环境设置默认URL和选项
selectedApiUrl : config . isDevelopment ? config . devApiUrlOptions [ 0 ] . value : config . productionApiUrl ,
customApiUrl : 'http://192.168.1.66:50002/hcscm/pda/v1' ,
apiUrlList : config . isDevelopment ? config . devApiUrlOptions : [ ] ,
phoneNo : '' ,
//username: '',
//password: '',
loginType : 'currentPhone' ,
showPassword : false ,
remember : true ,
isValidCodeLogin : false ,
validCode : '' ,
imgValidCodeSrc : null ,
list : [ {
name : '用户名'
} , {
name : '手机号'
} ] ,
current : 0 ,
activeColor : '#007aff' ,
} ;
} ,
computed : {
appVersion ( ) {
return manifest . versionName ;
}
/**
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
import config from '@/common/config.js' ;
import base64 from '@/common/base64.js' ;
import util from '@/common/util.js' ;
import md5 from '@/common/md5.js' ;
import manifest from '@/manifest.json' ;
import { mapState } from 'vuex'
export default {
data ( ) {
return {
isDevelopment : config . isDevelopment ,
showClearIcon : false ,
login : {
loading : false ,
username : "" ,
password : ""
} ,
showApiUrlPicker : false ,
// 根据环境设置默认URL和选项
selectedApiUrl : config . isDevelopment ? config . devApiUrlOptions [ 0 ] . value : config . productionApiUrl ,
customApiUrl : 'http://192.168.1.66:50002/hcscm/pda/v1' ,
apiUrlList : config . isDevelopment ? config . devApiUrlOptions : [ ] ,
phoneNo : '' ,
//username: '',
//password: '',
loginType : 'currentPhone' ,
showPassword : false ,
remember : true ,
isValidCodeLogin : false ,
validCode : '' ,
imgValidCodeSrc : null ,
list : [ {
name : '用户名'
} , {
name : '手机号'
} ] ,
current : 0 ,
activeColor : '#007aff' ,
} ;
} ,
computed : {
appVersion ( ) {
return manifest . versionName ;
} ,
envName ( ) {
return process . env . VUE _APP _ENV _NAME || '' ;
}
} ,
onShow ( ) {
// 只在开发环境读取存储的URL
if ( config . isDevelopment ) {
uni . getStorage ( {
key : 'ApiUrl' ,
success : ( e ) => {
util . updateApiUrl ( e . data ) ;
this . selectedApiUrl = e . data ;
}
} ) ;
}
onShow ( ) {
// 只在开发环境读取存储的URL
if ( config . isDevelopment ) {
uni . getStorage ( {
key : 'UserInfo ' ,
key : 'ApiUrl ' ,
success : ( e ) => {
console . log ( "---->>>" + e . data . username + '--->>' + e . data . password ) ;
this . login . username = e . data . username ;
this . login . password = e . data . password ;
}
} )
} ,
onLoad ( ) {
/*
this.$u.api.index({loginCheck: true}).then(res => {
if (res.code == '200'){
uni.reLaunch({
url: '/pages/sys/msg/index'
});
util . updateApiUrl ( e . data ) ;
this . selectedApiUrl = e . data ;
}
} ) ;
*/
} ,
methods : {
clearInput : function ( event ) {
if ( event . detail . value . length > 0 ) {
this . showClearIcon = true ;
} else {
this . showClearIcon = false ;
}
} ,
clearIcon : function ( ) {
this . login . username = ''
}
uni . getStorage ( {
key : 'UserInfo' ,
success : ( e ) => {
console . log ( "---->>>" + e . data . username + '--->>' + e . data . password ) ;
this . login . username = e . data . username ;
this . login . password = e . data . password ;
}
} )
} ,
onLoad ( ) {
/*
this.$u.api.index({loginCheck: true}).then(res => {
if (res.code == '200'){
uni.reLaunch({
url: '/pages/sys/msg/index'
});
}
});
*/
} ,
methods : {
clearInput : function ( event ) {
if ( event . detail . value . length > 0 ) {
this . showClearIcon = true ;
} else {
this . showClearIcon = false ;
} ,
showServerPicker ( ) {
this . showApiUrlPicker = true ;
} ,
getApiUrlLabel ( ) {
if ( this . selectedApiUrl === 'custom' ) {
return '自定义服务器' ;
}
const option = this . apiUrlList . find ( item => item . value === this . selectedApiUrl ) ;
return option ? option . label : '选择服务器' ;
} ,
}
} ,
clearIcon : function ( ) {
this . login . username = ''
this . showClearIcon = false ;
} ,
showServerPicker ( ) {
this . showApiUrlPicker = true ;
} ,
getApiUrlLabel ( ) {
if ( this . selectedApiUrl === 'custom' ) {
return '自定义服务器' ;
}
const option = this . apiUrlList . find ( item => item . value === this . selectedApiUrl ) ;
return option ? option . label : '选择服务器' ;
} ,
onApiUrlConfirm ( e ) {
console . log ( 'e' , JSON . stringify ( e ) ) ;
const selectedValue = this . apiUrlList [ e [ 0 ] ] . value ;
console . log ( 'selectedValue' , selectedValue )
this . selectedApiUrl = selectedValue ;
this . showApiUrlPicker = false ;
onApiUrlConfirm ( e ) {
console . log ( 'e' , JSON . stringify ( e ) ) ;
const selectedValue = this . apiUrlList [ e [ 0 ] ] . value ;
console . log ( 'selectedValue' , selectedValue )
this . selectedApiUrl = selectedValue ;
this . showApiUrlPicker = false ;
// 如果不是自定义,直接更新 store
if ( selectedValue !== 'custom' ) {
this . $store . dispatch ( 'updateApiUrl' , selectedValue ) ;
}
// 如果是自定义且已有自定义值,更新store
else if ( this . customApiUrl ) {
this . $store . dispatch ( 'updateApiUrl' , this . customApiUrl ) ;
}
} ,
showPass ( ) {
this . showPassword = ! this . showPassword ;
} ,
qiehuanLogin ( ) {
this . loginType = 'other'
} ,
// 如果不是自定义,直接更新 store
if ( selectedValue !== 'custom' ) {
this . $store . dispatch ( 'updateApiUrl' , selectedValue ) ;
}
// 如果是自定义且已有自定义值,更新store
else if ( this . customApiUrl ) {
this . $store . dispatch ( 'updateApiUrl' , this . customApiUrl ) ;
}
} ,
showPass ( ) {
this . showPassword = ! this . showPassword ;
} ,
qiehuanLogin ( ) {
this . loginType = 'other'
} ,
clickchecked ( ) {
var that = this
this . remember = ! this . remember
if ( that . remember == true ) {
if ( ( this . login . username . length > 0 ) && ( this . login . password . length > 0 ) ) {
uni . setStorage ( {
key : 'UserInfo' ,
data : that . login
} )
}
}
} ,
onClickItem ( index ) {
this . current = index ;
} ,
refreshImgValidCode ( e ) {
if ( this . vuex _token == '' ) {
this . $u . api . index ( ) . then ( res => {
this . imgValidCodeSrc = this . vuex _config . baseUrl + '/validCode?__sid=' +
res . sessionid + '&t=' + new Date ( ) . getTime ( ) ;
} ) ;
} else {
this . imgValidCodeSrc = this . vuex _config . baseUrl + '/validCode?__sid=' +
this . vuex _token + '&t=' + new Date ( ) . getTime ( ) ;
}
this . validCode = '' ;
} ,
nextStep ( ) {
//验证码登录下一步
uni . showLoading ( {
title : '正在获取验证码' ,
mask : true
} )
this . $u . api . sendCode ( {
phoneNo : this . phoneNo ,
validCodeType : '2'
} )
. then ( res => {
if ( res . code == '200' ) {
setTimeout ( ( ) => {
uni . navigateTo ( {
url : '/pages/sys/login/code?phoneNo=' + this . phoneNo
} ) ;
} , 500 ) ;
} else {
this . $u . toast ( res . msg ) ;
setTimeout ( ( ) => {
uni . navigateTo ( {
url : '/pages/sys/login/code?phoneNo=' + this . phoneNo
} ) ;
} , 500 ) ;
}
} ) ;
} ,
submit ( loginType = '1' ) {
uni . showLoading ( {
title : '登录中...'
} ) ;
let currentApiUrl ;
if ( config . isDevelopment ) {
// 开发环境:使用选择的URL
currentApiUrl = this . selectedApiUrl === 'custom' ? this . customApiUrl : this . selectedApiUrl ;
if ( ! currentApiUrl || currentApiUrl . length === 0 ) {
this . $u . toast ( '请输入服务器地址' ) ;
return ;
}
// 更新store中的URL
this . $store . dispatch ( 'updateApiUrl' , currentApiUrl ) ;
} else {
// 生产环境:使用固定的生产URL
currentApiUrl = config . productionApiUrl ;
}
if ( this . login . username . length == 0 ) {
this . $u . toast ( '请输入账号' ) ;
return ;
}
if ( this . login . password . length == 0 ) {
this . $u . toast ( '请输入密码' ) ;
return ;
}
console . log ( '开始请求' , currentApiUrl )
this . login . loading = true
// 临时设置baseUrl为当前选择的API URL
const originalBaseUrl = this . $u . http . config . baseUrl ;
this . $u . http . setConfig ( { baseUrl : currentApiUrl } ) ;
this . $u . api . pdaLogin ( {
'phone' : this . login . username ,
'password' : this . login . password ,
} ) . then ( ( res ) => {
console . log ( 'login res' , res )
var aLoginUserData = res ;
//console.log('--aLoginUserData->>' + JSON.stringify(aLoginUserData));
// 只在开发环境保存 apiurl 到本地存储
if ( config . isDevelopment ) {
uni . setStorage ( {
key : 'ApiUrl' ,
data : currentApiUrl
} ) ;
util . updateApiUrl ( currentApiUrl ) ;
}
// 保存 token 到本地存储
uni . setStorageSync ( 'RemoteTokenData' , aLoginUserData ) ;
uni . setStorage ( {
key : 'userToken' ,
data : {
Token : aLoginUserData . token ,
}
} ) ;
getApp ( ) . globalData . Token = aLoginUserData . token ;
getApp ( ) . globalData . EmployeeID = aLoginUserData . user _id ;
getApp ( ) . globalData . IsSaleUserStatus = 0 ;
getApp ( ) . globalData . LoginID = aLoginUserData . user _id ;
getApp ( ) . globalData . LoginName = aLoginUserData . user _name ;
getApp ( ) . globalData . PlanDepartmentID = aLoginUserData . default _sale _system _id ;
getApp ( ) . globalData . PlanDepartmentName = aLoginUserData . default _sale _system _name ;
getApp ( ) . globalData . UserGroup = '' ;
getApp ( ) . globalData . StoreNameID = aLoginUserData . default _physical _warehouse _id ;
getApp ( ) . globalData . StoreName = aLoginUserData . default _physical _warehouse _name ;
getApp ( ) . globalData . StoreTypeNo = '' ;
setTimeout ( ( ) => {
uni . reLaunch ( {
url : '/pages/sys/workbench/index'
} ) ;
} , 500 ) ;
clickchecked ( ) {
var that = this
this . remember = ! this . remember
if ( that . remember == true ) {
if ( ( this . login . username . length > 0 ) && ( this . login . password . length > 0 ) ) {
uni . setStorage ( {
@@ -260,283 +385,157 @@
data : that . login
} )
}
}
} ,
onClickItem ( index ) {
this . current = index ;
} ,
refreshImgValidCode ( e ) {
if ( this . vuex _token == '' ) {
this . $u . api . index ( ) . then ( res => {
this . imgValidCodeSrc = this . vuex _config . baseUrl + '/validCode?__sid=' +
res . sessionid + '&t=' + new Date ( ) . getTime ( ) ;
} ) ;
} else {
this . imgValidCodeSrc = this . vuex _config . baseUrl + '/validCode?__sid=' +
this . vuex _token + '&t=' + new Date ( ) . getTime ( ) ;
}
this . validCode = '' ;
} ,
nextStep ( ) {
//验证码登录下一步
uni . showLoading ( {
title : '正在获取验证码' ,
mask : true
} )
this . $u . api . sendCode ( {
phoneNo : this . phoneNo ,
validCodeType : '2'
} )
. then ( res => {
if ( res . code == '200' ) {
setTimeout ( ( ) => {
uni . navigateTo ( {
url : '/pages/sys/login/code?phoneNo=' + this . phoneNo
} ) ;
} , 500 ) ;
} else {
this . $u . toast ( res . msg ) ;
setTimeout ( ( ) => {
uni . navigateTo ( {
url : '/pages/sys/login/code?phoneNo=' + this . phoneNo
} ) ;
} , 500 ) ;
}
} ) ;
} ,
submit ( loginType = '1' ) {
uni . showLoading ( {
title : '登录中...'
uni . showToast ( {
icon : 'none' ,
title : '登录成功!'
} ) ;
let currentApiUrl ;
if ( config . isDevelopment ) {
// 开发环境:使用选择的URL
currentApiUrl = this . selectedApiUrl === 'custom' ? this . customApiUrl : this . selectedApiUrl ;
if ( ! currentApiUrl || currentApiUrl . length === 0 ) {
this . $u . toast ( '请输入服务器地址' ) ;
return ;
}
// 更新store中的URL
this . $store . dispatch ( 'updateApiUrl' , currentApiUrl ) ;
} else {
// 生产环境:使用固定的生产URL
currentApiUrl = config . productionApiUrl ;
}
if ( this . login . username . length == 0 ) {
this . $u . toast ( '请输入账号' ) ;
return ;
}
if ( this . login . password . length == 0 ) {
this . $u . toast ( '请输入密码' ) ;
return ;
}
console . log ( '开始请求' , currentApiUrl )
this . login . loading = true
// 临时设置baseUrl为当前选择的API URL
const originalBaseUrl = this . $u . http . config . baseUrl ;
this . $u . http . setConfig ( { baseUrl : currentApiUrl } ) ;
this . $u . api . pdaLogin ( {
'phone' : this . login . username ,
'password' : this . login . password ,
} ) . then ( ( res ) => {
console . log ( 'login res' , res )
var aLoginUserData = res ;
//console.log('--aLoginUserData->>' + JSON.stringify(aLoginUserData));
// 只在开发环境保存 apiurl 到本地存储
if ( config . isDevelopment ) {
uni . setStorage ( {
key : 'ApiUrl' ,
data : currentApiUrl
} ) ;
util . updateApiUrl ( currentApiUrl ) ;
}
// 保存 token 到本地存储
uni . setStorageSync ( 'RemoteTokenData' , aLoginUserData ) ;
this . $store . dispatch ( 'initNotification' ) ;
setTimeout ( function ( ) {
uni . hideLoading ( ) ;
} , 1000 ) ;
} ) . catch ( ( error ) => {
console . log ( 'login error' , error )
uni . showToast ( {
icon : 'none' ,
title : '' + ( error . msg || error . message || '' )
} ) ;
setTimeout ( function ( ) {
uni . hideLoading ( ) ;
} , 5000 ) ;
// 恢复原始baseUrl
this . $u . http . setConfig ( { baseUrl : originalBaseUrl } ) ;
} ) . finally ( ( ) => {
this . login . loading = false ;
} )
} ,
wxLogin ( res ) {
this . $u . toast ( '微信登录' ) ;
} ,
qqLogin ( ) {
this . $u . toast ( 'QQ 登录' ) ;
} ,
handleBlurInputUrl ( e ) {
// 只在开发环境处理自定义URL
if ( config . isDevelopment ) {
const url = e . detail . value . trim ( ) ;
if ( url ) {
this . customApiUrl = url ;
// 保存到本地存储
uni . setStorage ( {
key : 'userToken ' ,
data : {
Token : aLoginUserData . token ,
}
key : 'ApiUrl ' ,
data : url
} ) ;
getApp ( ) . globalData . Token = aLoginUserData . token ;
getApp ( ) . globalData . EmployeeID = aLoginUserData . user _id ;
getApp ( ) . globalData . IsSaleUserStatus = 0 ;
getApp ( ) . globalData . LoginID = aLoginUserData . user _id ;
getApp ( ) . globalData . LoginName = aLoginUserData . user _name ;
getApp ( ) . globalData . PlanDepartmentID = aLoginUserData . default _sale _system _id ;
getApp ( ) . globalData . PlanDepartmentName = aLoginUserData . default _sale _system _name ;
getApp ( ) . globalData . UserGroup = '' ;
getApp ( ) . globalData . StoreNameID = aLoginUserData . default _physical _warehouse _id ;
getApp ( ) . globalData . StoreName = aLoginUserData . default _physical _warehouse _name ;
getApp ( ) . globalData . StoreTypeNo = '' ;
setTimeout ( ( ) => {
uni . reLaunch ( {
url : '/pages/sys/workbench/index'
} ) ;
} , 500 ) ;
var that = this
if ( that . remember == true ) {
if ( ( this . login . username . length > 0 ) && ( this . login . password . length > 0 ) ) {
uni . setStorage ( {
key : 'UserInfo' ,
data : that . login
} )
}
}
uni . showToast ( {
icon : 'none' ,
title : '登录成功!'
} ) ;
this . $store . dispatch ( 'initNotification' ) ;
setTimeout ( function ( ) {
uni . hideLoading ( ) ;
} , 1000 ) ;
} ) . catch ( ( error ) => {
console . log ( 'login error' , error )
uni . showToast ( {
icon : 'none' ,
title : '' + ( error . msg || error . message || '' )
} ) ;
setTimeout ( function ( ) {
uni . hideLoading ( ) ;
} , 5000 ) ;
// 恢复原始baseUrl
this . $u . http . setConfig ( { baseUrl : originalBaseUrl } ) ;
} ) . finally ( ( ) => {
this . login . loading = false ;
} )
} ,
wxLogin ( res ) {
this . $u . toast ( '微信登录' ) ;
} ,
qqLogin ( ) {
this . $u . toast ( 'QQ 登录' ) ;
} ,
handleBlurInputUrl ( e ) {
// 只在开发环境处理自定义URL
if ( config . isDevelopment ) {
const url = e . detail . value . trim ( ) ;
if ( url ) {
this . customApiUrl = url ;
// 保存到本地存储
uni . setStorage ( {
key : 'ApiUrl' ,
data : url
} ) ;
util . updateApiUrl ( url ) ;
}
util . updateApiUrl ( url ) ;
}
} ,
}
} ;
}
} ,
}
} ;
< / script >
< style lang = "scss" >
@ import 'index.scss' ;
. server - selector {
display : flex ;
justify - content : space - between ;
align - items : center ;
padding : 10 rpx 0 ;
border - bottom : 1 px solid # eee ;
}
. list - call {
. u - select {
margin - bottom : 10 rpx ;
}
. u - input {
margin - top : 10 rpx ;
}
@ import 'index.scss' ;
. server - selector {
display : flex ;
justify - content : space - between ;
align - items : center ;
padding : 10 rpx 0 ;
border - bottom : 1 px solid # eee ;
}
. haotoplogo {
width : 300 rpx ;
height : 150 rpx ;
// max-width: 5%;
// max-height: 5%;
margin : 10 rpx auto 10 rpx auto ;
}
. logoimg {
width : 100 % ;
height : 100 % ;
. list - call {
. u - select {
margin - bottom : 10 rpx ;
}
. logo {
width : 80 % ;
font - size : 64 rpx ;
color : # 5473 e8 ;
margin : 80 rpx auto 80 rpx auto ;
. u - input {
margin - top : 10 rpx ;
}
}
. haotoplogo {
width : 300 rpx ;
height : 150 rpx ;
// max-width: 5%;
// max-height: 5%;
margin : 10 rpx auto 10 rpx auto ;
}
. logoimg {
width : 100 % ;
height : 100 % ;
}
. logo {
width : 80 % ;
font - size : 64 rpx ;
color : # 5473 e8 ;
margin : 80 rpx auto 80 rpx auto ;
}
. list - call - icon {
color : # ff0000 ;
}
. currentPhone - box {
text - align : center ;
padding : 40 rpx 80 rpx ;
. number - text {
color : # 000000 ;
font - size : 60 rpx ;
}
. list - call - icon {
color : # ff0000 ;
. other - text {
color : # 999999 ;
font - size : 26 rpx ;
padding : 20 rpx 0 ;
}
. currentPhone - box {
text - align : center ;
padding : 40 rpx 80 rpx ;
. number - text {
color : # 000000 ;
font - size : 60 rpx ;
}
. other - text {
color : # 999999 ;
font - size : 26 rpx ;
padding : 20 rpx 0 ;
}
. u - btn {
margin : 30 rpx auto ;
}
. u - hairline - border {
border : 1 px solid # fff ;
}
. u - btn {
margin : 30 rpx auto ;
}
. register {
display : inline - block ;
color : # 5473 e8 ;
height : 40 rpx ;
line - height : 40 rpx ;
font - size : 28 rpx ;
float : right ;
margin - top : 6 rpx ;
. u - hairline - border {
border : 1 px solid # fff ;
}
}
. register - link {
float : right ;
padding : 0 16 rpx ;
. register {
display : inline - block ;
color : # 5473 e8 ;
height : 40 rpx ;
line - height : 40 rpx ;
font - size : 28 rpx ;
float : right ;
margin - top : 6 rpx ;
}
. register - link {
float : right ;
padding : 0 16 rpx ;
}
. reg - link {
display : inline - block ;
color : # 5473 e8 ;
}
. oauth2 {
display : flex ;
flex - direction : row ;
justify - content : space - around ;
margin : 0 rpx 100 rpx 30 rpx ;
image {
height : 80 rpx ;
width : 80 rpx ;
}
}
. reg - link {
display : inline - block ;
color : # 5473 e8 ;
}
. oauth2 {
display : flex ;
flex - direction : row ;
justify - content : space - around ;
margin : 0 rpx 100 rpx 30 rpx ;
image {
height : 80 rpx ;
width : 80 rpx ;
}
}
. u - tabs {
padding : 0 70 rpx ;
}
@@ -544,11 +543,20 @@
. version - info {
text - align : center ;
margin - top : 30 rpx ;
display : flex ;
justify - content : center ;
align - items : center ;
flex - wrap : wrap ;
}
. version - text {
font - size : 24 rpx ;
color : # 999999 ;
}
< / style >
. env - text {
font - size : 24 rpx ;
color : # 5473 e8 ;
margin - left : 10 rpx ;
}
< / style >