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
|
# 是否启用读取配置文件 min
|
||||||
#VITE_WEBAPP = 'D://opt//AppUpdateTest'
|
#VITE_WEBAPP = 'D://opt//AppUpdateTest'
|
||||||
VITE_WEBAPP = ''
|
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://36.112.48.190/jeecg-boot'
|
||||||
#VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot'
|
#VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot'
|
||||||
|
@ -17,8 +17,8 @@ export default defineManifestConfig({
|
|||||||
name: VITE_APP_TITLE,
|
name: VITE_APP_TITLE,
|
||||||
appid: VITE_UNI_APPID,
|
appid: VITE_UNI_APPID,
|
||||||
description: '',
|
description: '',
|
||||||
versionName: '2.1.0',
|
versionName: '2.2.0',
|
||||||
versionCode: '20250808',
|
versionCode: '20250903',
|
||||||
transformPx: false,
|
transformPx: false,
|
||||||
locale: VITE_FALLBACK_LOCALE, // 'zh-Hans'
|
locale: VITE_FALLBACK_LOCALE, // 'zh-Hans'
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
|
@ -13,6 +13,7 @@ interface LoginParams {
|
|||||||
*/
|
*/
|
||||||
export function loginApi(config : LoginParams) {
|
export function loginApi(config : LoginParams) {
|
||||||
// 如果传了 captcha,走本地登录(/sys/login),否则走单点登录(/sys/sinopecLogin)
|
// 如果传了 captcha,走本地登录(/sys/login),否则走单点登录(/sys/sinopecLogin)
|
||||||
|
console.log('----',config)
|
||||||
const url = config.captcha ? '/sys/login' : '/sys/sinopecLogin';
|
const url = config.captcha ? '/sys/login' : '/sys/sinopecLogin';
|
||||||
return http({
|
return http({
|
||||||
url,
|
url,
|
||||||
|
@ -9,9 +9,7 @@ export function queryPostByUserIdApi(userid : string) {
|
|||||||
return http({
|
return http({
|
||||||
url: '/sys/user/queryPostByUserId',
|
url: '/sys/user/queryPostByUserId',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: {
|
data: { userid }
|
||||||
userid
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,3 +34,12 @@ export function queryUserByOrgRoleApi(config : object) {
|
|||||||
data: config
|
data: config
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*根据劳动合同号查询用户信息*/
|
||||||
|
export function queryUsernameByLdhth(ldhth : string) {
|
||||||
|
return http({
|
||||||
|
url: '/sys/user/queryUsernameByLdhth',
|
||||||
|
method: 'GET',
|
||||||
|
data: { ldhth }
|
||||||
|
})
|
||||||
|
}
|
@ -2,8 +2,8 @@
|
|||||||
"name": "数智产销",
|
"name": "数智产销",
|
||||||
"appid": "__UNI__9F097F0",
|
"appid": "__UNI__9F097F0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"versionName": "2.1.0",
|
"versionName": "2.2.0",
|
||||||
"versionCode": "20250808",
|
"versionCode": "20250903",
|
||||||
"transformPx": false,
|
"transformPx": false,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
"usingComponents": true,
|
"usingComponents": true,
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
<view class="account-login-area">
|
<view class="account-login-area">
|
||||||
<view class="box account">
|
<view class="box account">
|
||||||
<wd-icon name="user" size="15px"></wd-icon>
|
<wd-icon name="user" size="15px"></wd-icon>
|
||||||
<wd-text text="账号:"></wd-text>
|
<wd-text text=""></wd-text>
|
||||||
<wd-input class="uni-input" placeholder="请输入统一身份认证" v-model.trim="userName"></wd-input>
|
<wd-input class="uni-input" placeholder="统一身份/劳动合同号" v-model.trim="userName"></wd-input>
|
||||||
</view>
|
</view>
|
||||||
<view class="box password">
|
<view class="box password">
|
||||||
<wd-icon name="lock-on" size="15px"></wd-icon>
|
<wd-icon name="lock-on" size="15px"></wd-icon>
|
||||||
<wd-text text="密码:"></wd-text>
|
<wd-text text=""></wd-text>
|
||||||
<input class="uni-input" placeholder="请输入密码" :password="showPassword"
|
<input class="uni-input" placeholder="密码" :password="showPassword"
|
||||||
v-model.trim="password" />
|
v-model.trim="password" />
|
||||||
<wd-icon v-if="showPassword" name="eye-close" size="18px"
|
<wd-icon v-if="showPassword" name="eye-close" size="18px"
|
||||||
@click="handleChangePassword"></wd-icon>
|
@click="handleChangePassword"></wd-icon>
|
||||||
@ -52,15 +52,32 @@
|
|||||||
</PageLayout>
|
</PageLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script setup>
|
||||||
import { useToast } from 'wot-design-uni'
|
import {
|
||||||
import { ref } from 'vue'
|
useToast
|
||||||
import { useUserStore } from '@/store/user'
|
} from 'wot-design-uni'
|
||||||
import { http } from '@/utils/http'
|
import {
|
||||||
import { HOME_PAGE } from '@/common/constants'
|
ref
|
||||||
import { useRouter } from '@/plugin/uni-mini-router'
|
} 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 Base64 from 'base-64';
|
||||||
import { loginApi } from '@/api/system';
|
import {
|
||||||
|
loginApi
|
||||||
|
} from '@/api/system';
|
||||||
|
import {
|
||||||
|
queryUsernameByLdhth
|
||||||
|
} from '@/api/system/user';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'login',
|
name: 'login',
|
||||||
@ -75,7 +92,8 @@
|
|||||||
const showPassword = ref(true) //是否显示明文
|
const showPassword = ref(true) //是否显示明文
|
||||||
const remPW = ref(false) //是否记住密码
|
const remPW = ref(false) //是否记住密码
|
||||||
/**h5系统信息中没有appWgtVersion值*/
|
/**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 toast = useToast()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const handleChangePassword = () => {
|
const handleChangePassword = () => {
|
||||||
@ -92,25 +110,52 @@
|
|||||||
uni.setStorageSync('accountpassword', JSON.stringify(localObj))
|
uni.setStorageSync('accountpassword', JSON.stringify(localObj))
|
||||||
uni.setStorageSync('savePwd', remPW.value)
|
uni.setStorageSync('savePwd', remPW.value)
|
||||||
}
|
}
|
||||||
const handleLogin = () => {
|
const handleLogin = async () => {
|
||||||
if (userName.value.length === 0) {
|
if (userName.value.length === 0) {
|
||||||
toast.warning('请输入统一身份认证')
|
toast.warning('请输入统一身份/劳动合同号')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (password.value.length === 0) {
|
if (password.value.length === 0) {
|
||||||
toast.warning('请输入密码')
|
toast.warning('请输入密码')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let un = Base64.encode(encodeURIComponent(userName.value))
|
const params = {
|
||||||
let pw = Base64.encode(encodeURIComponent(password.value))
|
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 {
|
||||||
|
params.captcha = 'app';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} 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
|
loading.value = true
|
||||||
/*生产环境 begin */
|
try {
|
||||||
// loginApi({ username: un, password: pw })
|
// 调用API
|
||||||
/*开发环境 begin */
|
const res = await loginApi(params);
|
||||||
loginApi({ username: userName.value, password: password.value, captcha: 'app' })
|
|
||||||
.then((res : any) => {
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
const { result } = res
|
const {
|
||||||
|
result
|
||||||
|
} = res
|
||||||
const userInfo = result.userInfo
|
const userInfo = result.userInfo
|
||||||
userStore.setUserInfo({
|
userStore.setUserInfo({
|
||||||
...userInfo,
|
...userInfo,
|
||||||
@ -125,7 +170,9 @@
|
|||||||
})
|
})
|
||||||
savePwd() //记住账号密码
|
savePwd() //记住账号密码
|
||||||
uni.setStorageSync('logintime', Date.now()) //缓存登录时间
|
uni.setStorageSync('logintime', Date.now()) //缓存登录时间
|
||||||
router.pushTab({ path: HOME_PAGE })
|
router.pushTab({
|
||||||
|
path: HOME_PAGE
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
res.message == '数据库中已存在该记录' ? res.message = '请使用统一身份账号登录' : res.message
|
res.message == '数据库中已存在该记录' ? res.message = '请使用统一身份账号登录' : res.message
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
@ -135,15 +182,13 @@
|
|||||||
if (response.error_description === '用户名或密码错误') {
|
if (response.error_description === '用户名或密码错误') {
|
||||||
res.message = '用户名或密码错误';
|
res.message = '用户名或密码错误';
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
toast.warning(res.message)
|
toast.warning(res.message)
|
||||||
}
|
}
|
||||||
})
|
} finally {
|
||||||
.finally(() => {
|
loading.value = false;
|
||||||
loading.value = false
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
@ -235,9 +235,7 @@ export const useUpdateApp = defineStore('updateApp', () => {
|
|||||||
if (webApp) {//如果是测试环境 ,upDateAppApi 传递参数 by min
|
if (webApp) {//如果是测试环境 ,upDateAppApi 传递参数 by min
|
||||||
path = webApp
|
path = webApp
|
||||||
}
|
}
|
||||||
console.log(22222222222222222)
|
|
||||||
upDateAppApi(path).then(async (res : any) => {
|
upDateAppApi(path).then(async (res : any) => {
|
||||||
console.log(3333333333)
|
|
||||||
let {
|
let {
|
||||||
result
|
result
|
||||||
} = res
|
} = res
|
||||||
|
Loading…
Reference in New Issue
Block a user