app登录方式修改 增加劳动合同号
This commit is contained in:
parent
8acb78320c
commit
c97b130da9
2
env/.env.development
vendored
2
env/.env.development
vendored
@ -7,7 +7,7 @@ VITE_SHOW_SOURCEMAP = true
|
||||
# 是否启用读取配置文件 min
|
||||
#VITE_WEBAPP = 'D://opt//AppUpdateTest'
|
||||
VITE_WEBAPP = ''
|
||||
VITE_SERVER_BASEURL = 'http://10.75.15.247:8080/jeecg-boot'
|
||||
VITE_SERVER_BASEURL = 'http://10.96.108.144:8080/jeecg-boot'
|
||||
|
||||
#VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot'
|
||||
#VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot'
|
||||
|
@ -17,8 +17,8 @@ export default defineManifestConfig({
|
||||
name: VITE_APP_TITLE,
|
||||
appid: VITE_UNI_APPID,
|
||||
description: '',
|
||||
versionName: '2.1.0',
|
||||
versionCode: '20250808',
|
||||
versionName: '2.2.0',
|
||||
versionCode: '20250903',
|
||||
transformPx: false,
|
||||
locale: VITE_FALLBACK_LOCALE, // 'zh-Hans'
|
||||
/* 5+App特有相关 */
|
||||
|
@ -13,6 +13,7 @@ interface LoginParams {
|
||||
*/
|
||||
export function loginApi(config : LoginParams) {
|
||||
// 如果传了 captcha,走本地登录(/sys/login),否则走单点登录(/sys/sinopecLogin)
|
||||
console.log('----',config)
|
||||
const url = config.captcha ? '/sys/login' : '/sys/sinopecLogin';
|
||||
return http({
|
||||
url,
|
||||
|
@ -9,9 +9,7 @@ export function queryPostByUserIdApi(userid : string) {
|
||||
return http({
|
||||
url: '/sys/user/queryPostByUserId',
|
||||
method: 'GET',
|
||||
data: {
|
||||
userid
|
||||
}
|
||||
data: { userid }
|
||||
});
|
||||
}
|
||||
|
||||
@ -29,10 +27,19 @@ export function editUserApi(config : object) {
|
||||
}
|
||||
|
||||
/*根据部门Cod和角色Id查询用户信息*/
|
||||
export function queryUserByOrgRoleApi(config : object) {
|
||||
export function queryUserByOrgRoleApi(config : object) {
|
||||
return http({
|
||||
url: '/cxcChangesInPersonnel/cxcChangesInPersonnel/queryByDepCodRoleId',
|
||||
method: 'GET',
|
||||
data: config
|
||||
})
|
||||
}
|
||||
|
||||
/*根据劳动合同号查询用户信息*/
|
||||
export function queryUsernameByLdhth(ldhth : string) {
|
||||
return http({
|
||||
url: '/sys/user/queryUsernameByLdhth',
|
||||
method: 'GET',
|
||||
data: { ldhth }
|
||||
})
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
"name": "数智产销",
|
||||
"appid": "__UNI__9F097F0",
|
||||
"description": "",
|
||||
"versionName": "2.1.0",
|
||||
"versionCode": "20250808",
|
||||
"versionName": "2.2.0",
|
||||
"versionCode": "20250903",
|
||||
"transformPx": false,
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
|
@ -17,13 +17,13 @@
|
||||
<view class="account-login-area">
|
||||
<view class="box account">
|
||||
<wd-icon name="user" size="15px"></wd-icon>
|
||||
<wd-text text="账号:"></wd-text>
|
||||
<wd-input class="uni-input" placeholder="请输入统一身份认证" v-model.trim="userName"></wd-input>
|
||||
<wd-text text=""></wd-text>
|
||||
<wd-input class="uni-input" placeholder="统一身份/劳动合同号" v-model.trim="userName"></wd-input>
|
||||
</view>
|
||||
<view class="box password">
|
||||
<wd-icon name="lock-on" size="15px"></wd-icon>
|
||||
<wd-text text="密码:"></wd-text>
|
||||
<input class="uni-input" placeholder="请输入密码" :password="showPassword"
|
||||
<wd-text text=""></wd-text>
|
||||
<input class="uni-input" placeholder="密码" :password="showPassword"
|
||||
v-model.trim="password" />
|
||||
<wd-icon v-if="showPassword" name="eye-close" size="18px"
|
||||
@click="handleChangePassword"></wd-icon>
|
||||
@ -52,15 +52,32 @@
|
||||
</PageLayout>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { ref } from 'vue'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { http } from '@/utils/http'
|
||||
import { HOME_PAGE } from '@/common/constants'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
<script setup>
|
||||
import {
|
||||
useToast
|
||||
} from 'wot-design-uni'
|
||||
import {
|
||||
ref
|
||||
} from 'vue'
|
||||
import {
|
||||
useUserStore
|
||||
} from '@/store/user'
|
||||
import {
|
||||
http
|
||||
} from '@/utils/http'
|
||||
import {
|
||||
HOME_PAGE
|
||||
} from '@/common/constants'
|
||||
import {
|
||||
useRouter
|
||||
} from '@/plugin/uni-mini-router'
|
||||
import Base64 from 'base-64';
|
||||
import { loginApi } from '@/api/system';
|
||||
import {
|
||||
loginApi
|
||||
} from '@/api/system';
|
||||
import {
|
||||
queryUsernameByLdhth
|
||||
} from '@/api/system/user';
|
||||
|
||||
defineOptions({
|
||||
name: 'login',
|
||||
@ -75,7 +92,8 @@
|
||||
const showPassword = ref(true) //是否显示明文
|
||||
const remPW = ref(false) //是否记住密码
|
||||
/**h5系统信息中没有appWgtVersion值*/
|
||||
const version = uni.getSystemInfoSync().appWgtVersion ? uni.getSystemInfoSync().appWgtVersion : uni.getSystemInfoSync().appVersion
|
||||
const version = uni.getSystemInfoSync().appWgtVersion ? uni.getSystemInfoSync().appWgtVersion : uni.getSystemInfoSync()
|
||||
.appVersion
|
||||
const toast = useToast()
|
||||
const userStore = useUserStore()
|
||||
const handleChangePassword = () => {
|
||||
@ -92,58 +110,85 @@
|
||||
uni.setStorageSync('accountpassword', JSON.stringify(localObj))
|
||||
uni.setStorageSync('savePwd', remPW.value)
|
||||
}
|
||||
const handleLogin = () => {
|
||||
const handleLogin = async () => {
|
||||
if (userName.value.length === 0) {
|
||||
toast.warning('请输入统一身份认证')
|
||||
toast.warning('请输入统一身份/劳动合同号')
|
||||
return
|
||||
}
|
||||
if (password.value.length === 0) {
|
||||
toast.warning('请输入密码')
|
||||
return
|
||||
}
|
||||
let un = Base64.encode(encodeURIComponent(userName.value))
|
||||
let pw = Base64.encode(encodeURIComponent(password.value))
|
||||
loading.value = true
|
||||
/*生产环境 begin */
|
||||
// loginApi({ username: un, password: pw })
|
||||
/*开发环境 begin */
|
||||
loginApi({ username: userName.value, password: password.value, captcha: 'app' })
|
||||
.then((res : any) => {
|
||||
if (res.success) {
|
||||
const { result } = res
|
||||
const userInfo = result.userInfo
|
||||
userStore.setUserInfo({
|
||||
...userInfo,
|
||||
token: result.token,
|
||||
userid: userInfo.id,
|
||||
username: userInfo.username,
|
||||
realname: userInfo.realname,
|
||||
avatar: userInfo.avatar,
|
||||
post: userInfo.post,
|
||||
tenantId: userInfo.loginTenantId,
|
||||
localStorageTime: +new Date(),
|
||||
})
|
||||
savePwd() //记住账号密码
|
||||
uni.setStorageSync('logintime', Date.now()) //缓存登录时间
|
||||
router.pushTab({ path: HOME_PAGE })
|
||||
const params = {
|
||||
username: userName.value,
|
||||
password: password.value,
|
||||
};
|
||||
/*判断是否是六位纯数字*/
|
||||
if (userName.value.match(/^\d{6}$/)) {
|
||||
await queryUsernameByLdhth(userName.value).then(res => {
|
||||
if (res) {
|
||||
params = {
|
||||
username: Base64.encode(encodeURIComponent(userName.value)),
|
||||
password: Base64.encode(encodeURIComponent(password.value)),
|
||||
};
|
||||
} else {
|
||||
res.message == '数据库中已存在该记录' ? res.message = '请使用统一身份账号登录' : res.message
|
||||
if (!res.success) {
|
||||
try {
|
||||
// 尝试解析 JSON(仅当 message 可能是 JSON 时)
|
||||
const response = JSON.parse(res.message);
|
||||
if (response.error_description === '用户名或密码错误') {
|
||||
res.message = '用户名或密码错误';
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
toast.warning(res.message)
|
||||
params.captcha = 'app';
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
/*开发环境 */
|
||||
// params.captcha = 'app';
|
||||
/*生产环境 */
|
||||
params = {
|
||||
username: Base64.encode(encodeURIComponent(userName.value)),
|
||||
password: Base64.encode(encodeURIComponent(password.value)),
|
||||
};
|
||||
}
|
||||
login(params)
|
||||
}
|
||||
|
||||
const login = async (params) => {
|
||||
loading.value = true
|
||||
try {
|
||||
// 调用API
|
||||
const res = await loginApi(params);
|
||||
if (res.success) {
|
||||
const {
|
||||
result
|
||||
} = res
|
||||
const userInfo = result.userInfo
|
||||
userStore.setUserInfo({
|
||||
...userInfo,
|
||||
token: result.token,
|
||||
userid: userInfo.id,
|
||||
username: userInfo.username,
|
||||
realname: userInfo.realname,
|
||||
avatar: userInfo.avatar,
|
||||
post: userInfo.post,
|
||||
tenantId: userInfo.loginTenantId,
|
||||
localStorageTime: +new Date(),
|
||||
})
|
||||
savePwd() //记住账号密码
|
||||
uni.setStorageSync('logintime', Date.now()) //缓存登录时间
|
||||
router.pushTab({
|
||||
path: HOME_PAGE
|
||||
})
|
||||
} else {
|
||||
res.message == '数据库中已存在该记录' ? res.message = '请使用统一身份账号登录' : res.message
|
||||
if (!res.success) {
|
||||
try {
|
||||
// 尝试解析 JSON(仅当 message 可能是 JSON 时)
|
||||
const response = JSON.parse(res.message);
|
||||
if (response.error_description === '用户名或密码错误') {
|
||||
res.message = '用户名或密码错误';
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
toast.warning(res.message)
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
|
@ -235,9 +235,7 @@ export const useUpdateApp = defineStore('updateApp', () => {
|
||||
if (webApp) {//如果是测试环境 ,upDateAppApi 传递参数 by min
|
||||
path = webApp
|
||||
}
|
||||
console.log(22222222222222222)
|
||||
upDateAppApi(path).then(async (res : any) => {
|
||||
console.log(3333333333)
|
||||
let {
|
||||
result
|
||||
} = res
|
||||
|
Loading…
Reference in New Issue
Block a user