This commit is contained in:
2025-04-29 13:26:19 +08:00
parent 6e1ae24845
commit bf88fcb395
73 changed files with 12939 additions and 4637 deletions

View File

@@ -1,39 +1,44 @@
<template>
<view class="app loginBox">
<view class="header-tabs">
<view class="header-tabs-title u-m-r-48" :class="{active:state.tabCurrent === 0}"> Maxcess inspection App
</view>
<view class="header-tabs-title" :class="{active:state.tabCurrent === 0}"> Maxcess inspection App </view>
</view>
<view class="form-body">
<view class="form-item form-item1">
<up-input :placeholder="t('login.qsrzh')" border="bottom" v-model="state.ruleForm.userPhone">
<up-input @tap="languageShowFun" :placeholder="t('login.Language')" border="bottom"
v-model="state.languageText" disabled disabledColor="rgba(0, 0, 0, 0)">
<template #prefix>
<up-icon name="map" color="#ffffff" size="23" style="margin-right: 4rpx;"></up-icon>
</template>
</up-input>
</view>
<view class="form-item form-item2 u-m-t-32">
<up-input :placeholder="t('login.usedName')" border="bottom" v-model="state.ruleForm.userName">
<template #prefix>
<up-icon name="account" color="#ffffff" size="24" style="margin-right: 4rpx;"></up-icon>
</template>
</up-input>
</view>
<template v-if="state.tabCurrent === 0">
<view class="form-item form-item1 u-m-t-32">
<up-input :placeholder="t('login.qsrmm')" password border="bottom"
v-model="state.ruleForm.password">
<template #prefix>
<up-icon name="lock" color="#ffffff" size="24" style="margin-right: 4rpx;"></up-icon>
</template>
</up-input>
</view>
</template>
<view class="form-button" @tap="loginFun">{{t('login.loginbtn')}}</view>
</view>
<view class="language">
<view class="languageText" @click="languageFun('en')">
<text>EN</text>
<u-icon v-if="state.language === 'en'" name="checkbox-mark"></u-icon>
</view>
<view class="languageText" @click="languageFun('cn')">
<text>中文</text>
<u-icon v-if="state.language === 'cn'" name="checkbox-mark"></u-icon>
<view class="form-item form-item3 u-m-t-32">
<up-input :placeholder="t('login.password')" password border="bottom" v-model="state.ruleForm.password">
<template #prefix>
<up-icon name="lock" color="#ffffff" size="24" style="margin-right: 4rpx;"></up-icon>
</template>
</up-input>
</view>
<uni-swipe-action>
<uni-swipe-action-item>
<template #right>
<view class="itemRight" @click="toLoginConfigFun">
<up-icon name="setting-fill" color="#ffffff" size="20"></up-icon>
</view>
</template>
<view class="form-button" @tap="loginFun">{{t('login.loginbtn')}}</view>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
<up-picker :show="state.languageShow" :columns="state.languageList" @close="() => {state.languageShow = false}"
@cancel="() => {state.languageShow = false}" @confirm="languageFun"></up-picker>
</view>
</template>
@@ -49,46 +54,74 @@
const state = reactive({
tabCurrent: 0,
language: getI18n.locale.value,
country: '',
languageShow: false,
languageText: '',
languageList: [['中文', 'English']],
ruleForm: {
userPhone: '',
userName: '',
password: '',
lcId: 2052
},
isCheck: false,
appLoginInfoObj:{}
})
onShow(() => {
// locale.value = 'en'
console.log(i18n.global.locale.value);
console.log(t('login.loginbtn'));
if (uni.getStorageSync('locale') === 'en') {
locale.value = 'en'
} else {
locale.value = 'cn'
}
state.language = locale.value
state.languageText = state.language === 'en' ? 'English' : '中文'
state.ruleForm.lcId = state.language === 'cn' ? 2052 : 1033
state.appLoginInfoObj = uni.getStorageSync('appLoginInfo')
if(!Object.keys(state.appLoginInfoObj).length){
uni.$u.toast('配置文件丢失!')
}
})
const loginFun = () => {
if (state.ruleForm.userPhone === '') {
uni.$u.toast('请输入您的手机号')
if (state.ruleForm.userName === '') {
uni.$u.toast(t('login.qsrzh'))
return
}
if (state.ruleForm.password === '') {
uni.$u.toast('请输入您的密码')
uni.$u.toast(t('login.qsrmm'))
return;
}
if (state.appLoginInfoObj.organizationText === '') {
uni.$u.toast('请配置数据中心!')
return;
}
if (state.appLoginInfoObj.centerObj.Id === '') {
uni.$u.toast('DBID丢失')
return;
}
if (state.appLoginInfoObj.organizationObj['FOrgOrgId.FNumber'] === '') {
uni.$u.toast('请配置账套组织!')
return;
}
console.log(state.appLoginInfoObj);
loginApp({
userName: state.ruleForm.userPhone,
userName: state.ruleForm.userName,
password: state.ruleForm.password,
lcId: state.ruleForm.lcId,
ServerUrl:state.appLoginInfoObj.organizationText,
DBID:state.appLoginInfoObj.centerObj.Id,
orgNum: state.appLoginInfoObj.organizationObj['FOrgOrgId.FNumber']
}).then((res : any) => {
if (res.code === 200) {
uni.setStorageSync('TOKEN', res.token)
getDetails({
userName: state.ruleForm.userPhone,
userName: state.ruleForm.userName,
password: state.ruleForm.password,
lcId: state.ruleForm.lcId,
ServerUrl:state.appLoginInfoObj.organizationText,
DBID:state.appLoginInfoObj.centerObj.Id,
orgNum: state.appLoginInfoObj.organizationObj['FOrgOrgId.FNumber']
}).then((content : any) => {
if(content.code === 200){
if (content.code === 200) {
uni.setStorageSync('userInfo', JSON.parse(content.data))
uni.switchTab(
{
@@ -96,19 +129,64 @@
}
)
}
})
}
})
}
const languageFun = (val : string) => {
state.language = val
locale.value = val
let languageVal = val.value[0] === 'English' ? 'en' : 'cn'
state.language = languageVal
locale.value = languageVal
uni.setStorageSync('locale', locale.value)
state.languageText = val.value[0]
state.ruleForm.lcId = state.language === 'cn' ? 2052 : 1033
state.languageShow = false
}
const languageShowFun = () => {
state.languageShow = true
}
const toLoginConfigFun = () => {
if (state.ruleForm.userName !== '') {
uni.$u.route({
url: '/pages/client/account/loginConfig',
params: { userName: state.ruleForm.userName }
})
} else {
uni.$u.toast('请输入账号')
}
}
</script>
<style lang="scss" scoped>
:deep(.button-group--right) {
right: 2px;
}
.itemRight {
display: flex;
align-items: center;
// padding: 0rpx 32rpx;
background-color: #ff5a5d;
border-radius: 96rpx;
height: 96rpx;
width: 96rpx;
margin-top: 128rpx;
margin-left: 32rpx;
display: flex;
align-items: center;
justify-content: center;
// border-bottom-right-radius: 96rpx;
}
:deep(.u-popup__content) {
border-top-left-radius: 18rpx;
border-top-right-radius: 18rpx;
}
:deep(.uni-text) {
line-height: normal !important;
}
@@ -131,7 +209,7 @@
.language {
position: absolute;
right: 40rpx;
top: 140rpx;
top: 360rpx;
min-width: 100rpx;
.languageText {
@@ -148,12 +226,18 @@
height: 24vmax;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
margin-top: 100rpx;
margin-bottom: 100rpx;
.header-tabs-title {
font-size: 36rpx;
font-family: Bold;
font-weight: 500;
color: #666;
text-align: center;
flex: 1;
&.active {
color: #ffffff;
@@ -199,7 +283,7 @@
background-color: #0129D3;
color: #fff;
margin-top: 128rpx;
margin-bottom: 48rpx;
// margin-bottom: 48rpx;
}
}