This commit is contained in:
parent
69f14e5186
commit
11d9d02597
|
|
@ -1 +1,2 @@
|
||||||
VITE_API_BASE_URL = https://sh.cygrxt.com:19999/hd-realname/prod-api
|
|
||||||
|
VITE_API_BASE_URL = /hd-real-name
|
||||||
|
|
@ -151,6 +151,10 @@
|
||||||
},
|
},
|
||||||
"vueVersion" : "3",
|
"vueVersion" : "3",
|
||||||
"h5" : {
|
"h5" : {
|
||||||
"title" : ""
|
"title" : "",
|
||||||
|
"router" : {
|
||||||
|
"mode" : "history",
|
||||||
|
"base" : "/hd-real-name-h5/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
<!-- 验证码输入 -->
|
<!-- 验证码输入 -->
|
||||||
<up-form-item prop="code" class="code-form-item">
|
<up-form-item prop="code" class="code-form-item">
|
||||||
<view style="width: 70%">
|
<view style="width: 63%">
|
||||||
<up-input
|
<up-input
|
||||||
v-model="formData.code"
|
v-model="formData.code"
|
||||||
placeholder="请输入验证码"
|
placeholder="请输入验证码"
|
||||||
|
|
@ -53,7 +53,6 @@
|
||||||
:text="codeButtonText"
|
:text="codeButtonText"
|
||||||
:disabled="codeButtonDisabled"
|
:disabled="codeButtonDisabled"
|
||||||
:loading="codeLoading"
|
:loading="codeLoading"
|
||||||
size="small"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
class="code-button"
|
class="code-button"
|
||||||
color="linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)"
|
color="linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)"
|
||||||
|
|
@ -77,7 +76,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="currentStep === 1">
|
<template v-if="currentStep === 1">
|
||||||
<Upload @goBack="onGoBack" />
|
<Upload @goBack="onGoBack" :phone="formData.phone" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 加载页面 -->
|
<!-- 加载页面 -->
|
||||||
|
|
@ -95,7 +94,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onUnmounted } from 'vue'
|
import { ref, computed, onUnmounted } from 'vue'
|
||||||
import { debounce } from 'lodash-es'
|
import { debounce } from 'lodash-es'
|
||||||
|
import { useMemberStore } from '@/stores'
|
||||||
import Upload from './upload.vue'
|
import Upload from './upload.vue'
|
||||||
|
import { getSmsCodeApi, nextLoginApi } from '@/services/offline-witness'
|
||||||
|
|
||||||
|
const memberStore = useMemberStore() // 用户信息
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const formRef = ref(null)
|
const formRef = ref(null)
|
||||||
|
|
@ -189,18 +192,20 @@ const getVerificationCode = debounce(async () => {
|
||||||
codeLoading.value = true
|
codeLoading.value = true
|
||||||
|
|
||||||
// 这里应该调用获取验证码的API
|
// 这里应该调用获取验证码的API
|
||||||
// const res = await getSmsCodeAPI({ phone: formData.value.phone })
|
const res = await getSmsCodeApi({
|
||||||
|
username: formData.value.phone,
|
||||||
|
verificationCodeType: 'WORKER_LOGIN',
|
||||||
|
})
|
||||||
|
// console.log(res, '获取验证码')
|
||||||
|
|
||||||
// 模拟API调用
|
// 模拟API调用
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
||||||
|
|
||||||
uni.$u.toast('验证码已发送')
|
uni.$u.toast('验证码已发送')
|
||||||
|
|
||||||
// 开始倒计时
|
// 开始倒计时
|
||||||
startCountdown()
|
startCountdown()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取验证码失败:', error)
|
uni.$u.toast(error?.data?.msg)
|
||||||
uni.$u.toast('获取验证码失败,请重试')
|
|
||||||
} finally {
|
} finally {
|
||||||
codeLoading.value = false
|
codeLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -221,10 +226,6 @@ const startCountdown = () => {
|
||||||
|
|
||||||
// 下一步处理
|
// 下一步处理
|
||||||
const handleNext = debounce(() => {
|
const handleNext = debounce(() => {
|
||||||
currentStep.value = 1
|
|
||||||
console.log(currentStep.value)
|
|
||||||
|
|
||||||
return
|
|
||||||
if (submitDisabled.value) return
|
if (submitDisabled.value) return
|
||||||
|
|
||||||
formRef.value
|
formRef.value
|
||||||
|
|
@ -235,25 +236,22 @@ const handleNext = debounce(() => {
|
||||||
submitLoading.value = true
|
submitLoading.value = true
|
||||||
|
|
||||||
// 这里应该调用验证短信验证码的API
|
// 这里应该调用验证短信验证码的API
|
||||||
// const res = await verifySmsCodeAPI({
|
const res = await nextLoginApi({
|
||||||
// phone: formData.value.phone,
|
username: formData.value.phone,
|
||||||
// code: formData.value.code
|
loginType: 'PHONE_OTP_WORKER',
|
||||||
// })
|
verificationCode: formData.value.code,
|
||||||
|
})
|
||||||
// 模拟API调用
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1500))
|
|
||||||
|
|
||||||
|
console.log(res, '验证结果')
|
||||||
|
if (res.code === 200) {
|
||||||
|
memberStore.setToken(res.data.access_token)
|
||||||
|
}
|
||||||
uni.$u.toast('验证成功')
|
uni.$u.toast('验证成功')
|
||||||
|
|
||||||
// 跳转到见证上传页面
|
// 打开见证上传页面
|
||||||
setTimeout(() => {
|
currentStep.value = 1
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/offline-witness/upload',
|
|
||||||
})
|
|
||||||
}, 500)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('验证失败:', error)
|
uni.$u.toast(error?.data?.msg)
|
||||||
uni.$u.toast('验证失败,请检查验证码')
|
|
||||||
} finally {
|
} finally {
|
||||||
submitLoading.value = false
|
submitLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -394,7 +392,7 @@ onUnmounted(() => {
|
||||||
.code-button {
|
.code-button {
|
||||||
// min-width: 180rpx;
|
// min-width: 180rpx;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 80rpx;
|
// height: 80rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,14 @@
|
||||||
<!-- 人员出场资料上传 -->
|
<!-- 人员出场资料上传 -->
|
||||||
<view class="data-upload">
|
<view class="data-upload">
|
||||||
<!-- 人员信息 -->
|
<!-- 人员信息 -->
|
||||||
|
|
||||||
|
<up-button
|
||||||
|
size="small"
|
||||||
|
v-if="projectList.length > 0"
|
||||||
|
color="linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)"
|
||||||
|
@click="showProjectSelectPopup = true"
|
||||||
|
text="选择工程信息"
|
||||||
|
/>
|
||||||
<view class="person-info">
|
<view class="person-info">
|
||||||
<view>
|
<view>
|
||||||
<text>姓名</text>
|
<text>姓名</text>
|
||||||
|
|
@ -73,23 +81,85 @@
|
||||||
@confirm="onConfirmExit"
|
@confirm="onConfirmExit"
|
||||||
@cancel="onCancelConfirmExit"
|
@cancel="onCancelConfirmExit"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- 如果工程信息有多个,则显示工程信息选择弹框 -->
|
||||||
|
<up-popup
|
||||||
|
mode="center"
|
||||||
|
closeOnClickOverlay
|
||||||
|
:show="showProjectSelectPopup"
|
||||||
|
@close="onCloseProjectSelectPopup"
|
||||||
|
>
|
||||||
|
<view class="project-select-content">
|
||||||
|
<view class="project-select-title"> 请选择工程信息 </view>
|
||||||
|
<view
|
||||||
|
class="project-select-item"
|
||||||
|
v-for="item in projectList"
|
||||||
|
:key="item.id"
|
||||||
|
@click="onSelectProject(item)"
|
||||||
|
>
|
||||||
|
{{ item.proName }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="DataUpload">
|
<script setup name="DataUpload">
|
||||||
import { ref } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import { useCommonStore } from '@/stores'
|
import { useCommonStore } from '@/stores'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { editPersonEntryExitApi } from '@/services/person-entry.js'
|
import { editPersonEntryExitApi, editPersonEntryExitApiBack } from '@/services/person-entry.js'
|
||||||
|
import { getEngineeringInfoByPhoneApi } from '@/services/offline-witness.js'
|
||||||
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm.js'
|
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm.js'
|
||||||
|
|
||||||
const commonStore = useCommonStore()
|
const commonStore = useCommonStore()
|
||||||
const exitParams = ref({}) // 出场参数
|
const exitParams = ref({
|
||||||
|
name: '', // 姓名
|
||||||
|
idNumber: '', // 身份证号
|
||||||
|
proName: '', // 工程名称
|
||||||
|
subName: '', // 分包商名称
|
||||||
|
teamName: '', // 班组名称
|
||||||
|
}) // 出场参数
|
||||||
|
const showProjectSelectPopup = ref(false) // 显示工程信息选择弹框
|
||||||
const fileList = ref([]) // 离场工资结算确认单
|
const fileList = ref([]) // 离场工资结算确认单
|
||||||
const exitContent = ref('') // 离场工资结算确认单内容
|
const exitContent = ref('') // 离场工资结算确认单内容
|
||||||
const showModalConfirmExit = ref(false) // 确认出场提示弹框
|
const showModalConfirmExit = ref(false) // 确认出场提示弹框
|
||||||
const fileIds = ref([]) // 上传文件ID
|
const fileIds = ref([]) // 上传文件ID
|
||||||
|
const projectList = ref([]) // 工程信息
|
||||||
const emit = defineEmits(['goBack'])
|
const emit = defineEmits(['goBack'])
|
||||||
|
const props = defineProps({
|
||||||
|
phone: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取工程信息
|
||||||
|
const getProjectList = async (phone) => {
|
||||||
|
const res = await getEngineeringInfoByPhoneApi({
|
||||||
|
phone,
|
||||||
|
})
|
||||||
|
|
||||||
|
projectList.value = res.data
|
||||||
|
if (res?.data?.length == 0) {
|
||||||
|
uni.$u.toast('当前未入场任何工程')
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 1000)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
showProjectSelectPopup.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const onCloseProjectSelectPopup = () => {
|
||||||
|
showProjectSelectPopup.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const onSelectProject = (item) => {
|
||||||
|
exitParams.value = item
|
||||||
|
showProjectSelectPopup.value = false
|
||||||
|
}
|
||||||
|
|
||||||
// 删除图片
|
// 删除图片
|
||||||
const deletePic = (e) => {
|
const deletePic = (e) => {
|
||||||
|
|
@ -161,22 +231,44 @@ const onConfirmExit = async () => {
|
||||||
exitWay: 'APP',
|
exitWay: 'APP',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileIds.value.length > 0) {
|
const params2 = {
|
||||||
params.fileIds = fileIds.value.join(',')
|
id: exitParams.value.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await editPersonEntryExitApi(params)
|
if (fileIds.value.length > 0) {
|
||||||
|
params.photoIds = fileIds.value.join(',')
|
||||||
|
params2.photoIds = fileIds.value.join(',')
|
||||||
|
}
|
||||||
|
|
||||||
|
const API = exitParams.value.type == 1 ? editPersonEntryExitApi : editPersonEntryExitApiBack
|
||||||
|
const res = await API(exitParams.value.type == 1 ? params : params2)
|
||||||
|
showModalConfirmExit.value = false
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.$u.toast('出场成功')
|
uni.$u.toast('出场成功')
|
||||||
|
exitParams.value = {}
|
||||||
|
fileList.value = []
|
||||||
|
fileIds.value = []
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
getProjectList(props.phone)
|
||||||
}, 500)
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
uni.$u.toast(res.msg)
|
uni.$u.toast(res.msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取工程信息
|
||||||
|
watch(
|
||||||
|
() => props.phone,
|
||||||
|
async (newVal) => {
|
||||||
|
if (newVal) {
|
||||||
|
try {
|
||||||
|
getProjectList(newVal)
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
)
|
||||||
|
|
||||||
// 返回上一页
|
// 返回上一页
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
emit('goBack')
|
emit('goBack')
|
||||||
|
|
@ -187,9 +279,7 @@ const onCancelConfirmExit = () => {
|
||||||
showModalConfirmExit.value = false
|
showModalConfirmExit.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad(() => {})
|
||||||
exitParams.value = JSON.parse(options?.params)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
@ -260,4 +350,34 @@ onLoad((options) => {
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.project-select-content {
|
||||||
|
width: 80vw;
|
||||||
|
height: 80vh;
|
||||||
|
padding: 30rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
box-shadow: 0 0 10rpx 2rpx rgba(0, 0, 0, 0.1);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-select-title {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-select-item {
|
||||||
|
width: 100%;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
border-bottom: 1px solid #e5e5e5;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ const onConfirmExit = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileIds.value.length > 0) {
|
if (fileIds.value.length > 0) {
|
||||||
params.fileIds = fileIds.value.join(',')
|
params.photoIds = fileIds.value.join(',')
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await editPersonEntryExitApi(params)
|
const res = await editPersonEntryExitApi(params)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { http } from '@/utils/http'
|
||||||
|
|
||||||
|
// 获取短信验证码
|
||||||
|
export const getSmsCodeApi = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/auth/getPhoneCode',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 点击下一步登录接口
|
||||||
|
export const nextLoginApi = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/auth/login',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据手机号码获取工程信息
|
||||||
|
export const getEngineeringInfoByPhoneApi = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'bmw',
|
||||||
|
url: `/bmw/workerExit/getWorkerListByPhone`,
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -55,6 +55,14 @@ export const editPersonEntryExitApi = (data) => {
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 已出场未上传附件
|
||||||
|
export const editPersonEntryExitApiBack = (data) => {
|
||||||
|
return http({
|
||||||
|
url: `/bmw/app/appWorkerExitFile`,
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 获取上海工程人员信息
|
// 获取上海工程人员信息
|
||||||
export const getShanghaiProByIdNumberAPI = (data) => {
|
export const getShanghaiProByIdNumberAPI = (data) => {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ export default defineConfig({
|
||||||
'/api': {
|
'/api': {
|
||||||
// target: 'http://112.29.103.165:1616', // 测试环境
|
// target: 'http://112.29.103.165:1616', // 测试环境
|
||||||
// target: 'http://192.168.0.133:58080', // 梁超
|
// target: 'http://192.168.0.133:58080', // 梁超
|
||||||
target: 'http://192.168.0.14:1999/hd-real-name', // 测试环境
|
// target: 'http://192.168.0.14:1999/hd-real-name', // 测试环境
|
||||||
// target: 'http://192.168.0.234:38080', // 方亮
|
target: 'http://192.168.0.234:38080/hd-real-name', // 方亮
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => {
|
rewrite: (path) => {
|
||||||
return path.replace(/\/api/, '')
|
return path.replace(/\/api/, '')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue