Commit 48efd78e by cen

Merge branch 'SAAS+V5.5.0' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V5.5.0

2 parents 4d387ce5 61107157
......@@ -537,5 +537,30 @@ module.exports = {
projectName: 'pad',
...data
})
}
},
// 新学习中心 - 考试结果
getExamResult(data={}) {
return http.post({
method: 'dj.api.pad.learning.center.beisen.exam.result',
projectName: 'pad',
...data
})
},
// 限制录单
getLimitRecord(data={}) {
return http.post({
method: 'dj.api.pad.learning.center.study.permission',
projectName: 'pad',
...data
})
},
// VIN车架号校验
checkVinValidate(data={}) {
console.log("调用接口checkVinValidate",data);
return http.post({
method: 'dj.pad.api.vin.validate',
projectName: 'pad',
...data,
})
},
}
......@@ -13,6 +13,7 @@ module.exports = {
return;
}
if (!uni.$signHttp) uni.$signHttp = new Request(uni.signHttpConfig)
data.source = 1
resolve(uni.$signHttp.post(url, data, _config))
}
})
......
......@@ -2,24 +2,24 @@
<view class="exam-submit-popup-wrapper">
<!-- 标题 -->
<view :class="['exam-title', { 'title-loading': isLoading }]">是否已提交考试</view>
<!-- 加载状态 -->
<template v-if="isLoading">
<view class="loading-text">正在查询考试结果,请稍后...</view>
<image
class="loading-gif"
:src="require('@/assets/images/common/loadding.gif')"
mode="aspectFit"
/>
</template>
<template v-if="showError">
<view class="error-text">未查询到考试结果,请重新确认</view>
</template>
<!-- 按钮组(始终显示) -->
<view class="button-group">
<view class="cancel-button" @click="handleCancel">
未提交
</view>
<view class="confirm-button" @click="handleConfirm">
确认已提交
{{ confirmText }}
</view>
</view>
......@@ -34,6 +34,14 @@ export default {
isLoading: {
type: Boolean,
default: false
},
showError: {
type: Boolean,
default: false
},
confirmText: {
type: String,
default: '确认'
}
},
watch: {
......@@ -48,17 +56,20 @@ export default {
handleConfirm() {
console.log('handleConfirm clicked')
this.$emit('confirm')
}
},
}
}
</script>
<style lang="scss" scoped>
.exam-submit-popup-wrapper {
position: relative;
width: 100%;
min-height: toRpx(400);
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: toRpx(48);
}
.exam-title {
......@@ -69,8 +80,7 @@ export default {
font-weight: 500;
font-family: "HarmonyOSSansSC";
text-align: center;
margin-top: toRpx(96);
margin-bottom: toRpx(136);
margin-top: toRpx(48);
}
.exam-title.title-loading {
......@@ -92,15 +102,21 @@ export default {
.loading-gif {
width: toRpx(64);
height: toRpx(64);
margin-bottom: toRpx(48);
margin-bottom: toRpx(76);
}
.error-text {
color: #6c6f75;
font-size: toRpx(32);
font-weight: 400;
line-height: toRpx(48);
margin-top: toRpx(48);
}
.button-group {
display: flex;
align-items: center;
justify-content: center;
gap: toRpx(16);
margin-bottom: toRpx(48);
margin-top: auto;
}
.cancel-button {
......
......@@ -7,21 +7,23 @@
<view class="recommend-course-list" :class="{ 'fixed-width': cardWidth > 0 }">
<view class="recommend-course-item" v-for="(item, index) in recommendCourseList" :key="index"
@click="startStudy(item, index)" :style="cardWidth > 0 ? `width: ${cardWidth}rpx` : ''">
<!-- 左上角:必修/选修标签 -->
<image v-if="!simplified && item.required !== undefined" class="course-tag-left"
:src="item.required ? require('@/assets/images/studyCenter/Required.png') : require('@/assets/images/studyCenter/Elective.png')"
<!-- 左上角:必修/选修标签 -->
<template v-if="item.planCourseType">
<image class="course-tag-left"
:src="item.planCourseType == 1 ? require('@/assets/images/studyCenter/Required.png') : require('@/assets/images/studyCenter/Elective.png')"
mode="aspectFit" />
</template>
<!-- 右上角:文档/视频标签 -->
<view v-if="!simplified && item.courseType" class="course-tag-right">
<text class="tag-text">{{ item.courseType === 'video' ? '视频' : '文档' }}</text>
<view class="course-tag-right" v-if="item.courseFileType">
<text class="tag-text">{{ COURSE_TYPE[item.courseFileType].name}}</text>
</view>
<image class="recommend-course-item-img"
src="../../../../assets/images/common/recommend-course-default.webp" mode="scaleToFill" />
<view class="recommend-course-content">
<view class="recommend-course-item-title">
{{ item.courseName }}
{{ item.title }}
</view>
<view class="recommend-course-item-text">
<text class="duration-value">课程时长</text>
......@@ -30,12 +32,12 @@
</view>
<!-- 评分星星 -->
<view v-if="!simplified && item.rating !== undefined" class="course-rating">
<view v-if="item.totalStar !== undefined" class="course-rating">
<view class="star-list">
<image v-for="star in 5" :key="star" class="star-icon" :src="getStarIcon(item.rating, star)"
<image v-for="star in 5" :key="star" class="star-icon" :src="getStarIcon(item.totalStar, star)"
mode="aspectFit" />
</view>
<text class="rating-text">{{ item.rating }}</text>
<text class="rating-text">{{ item.totalStar / 2 }}</text>
</view>
<!-- 学习人数 -->
......@@ -60,6 +62,7 @@
</view>
</template>
<script>
import { COURSE_TYPE } from '../../../../pages/common/studyCenter/contant'
export default {
name: 'RecommendCourse',
props: {
......@@ -72,6 +75,10 @@ export default {
simplified: {
type: Boolean,
default: false
},
searchParams: {
type: Object,
default: () => ({})
}
},
data() {
......@@ -80,8 +87,9 @@ export default {
nothing: false,
total: 0,
pageNum: 1,
pageSize: 12,
pageSize: 9,
scrollTop: 0,
COURSE_TYPE
}
},
computed: {
......@@ -100,7 +108,7 @@ export default {
methods: {
// 获取星星图标
getStarIcon(rating, position) {
const roundedRating = Math.round(rating * 2) / 2 // 四舍五入到0.5
const roundedRating = Math.round(rating) / 2 // 四舍五入到0.5
const diff = roundedRating - (position - 1)
if (diff >= 1) {
......@@ -120,11 +128,13 @@ export default {
uni.showLoading({
mask: true
})
const { pageNum, pageSize } = this
const { pageNum, pageSize, searchParams } = this
console.log(searchParams, 'searchParams')
const params = {
staffPhone: uni.$storage.get('userInfo').phone, // 推荐状态 0=无推荐 1=推荐课程
pageNum,
pageSize
pageSize,
...searchParams
}
const res = await uni.$api.commonApi.getALlCourse(params)
console.log(res, '全部课程')
......@@ -164,10 +174,18 @@ export default {
}
},
startStudy(item, index) {
const beisenToken = uni.$storage.get('beisenToken')
if (!beisenToken) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this;
uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
// uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({
url: `/pages/common/studyDetail/detail?type=recommendation&index=${index}&recommendCourseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}`
url: `/pages/common/studyCenter/courseDetail?apiType=getALlCourse&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}`
})
},
async asyncfindBeiSenSSOToken() {
......
......@@ -27,11 +27,11 @@
<!-- 最高得分 -->
<view class="exam-score">
<text class="score-label">最高得分</text>
<text class="score-value failed">{{ filterValue(item.highestScore, '分') }}|未通过</text>
<text class="score-value failed">{{ filterValue(item.maxTotalScore, '分') }}|未通过</text>
</view>
<!-- 重新考试按钮 -->
<view v-if="item.remainingTimes > 0" class="retake-btn" @click.stop="retakeExam(item)">
<view v-if="item.remainingTimes > 0" class="retake-btn">
<text class="retake-text">重新考试</text>
</view>
</view>
......@@ -48,11 +48,32 @@
<view class="end-text">到底了!</view>
</template>
</scroll-view>
<!-- 考试提交确认弹窗 -->
<StudyPopup
:show.sync="showExamPopup"
title=""
:width="848"
:closeButton="true"
:height="examPopInfo.isExamLoading ? 740 : 656"
:topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848"
:topImageHeight="248"
>
<ExamSubmitPopup
:isLoading="examPopInfo.isExamLoading"
:showError="examPopInfo.showError"
:confirmText="examPopInfo.confirmText"
@cancel="handleExamCancel"
@confirm="handleExamConfirm"
/>
</StudyPopup>
</view>
</template>
<script>
import utils from '@/utils/utils'
import StudyPopup from '../../../StudyPopup.vue'
import ExamSubmitPopup from '../../../ExamSubmitPopup.vue'
export default {
name: 'FailedExam',
props: {
......@@ -61,6 +82,10 @@ export default {
default: 0
}
},
components: {
StudyPopup,
ExamSubmitPopup
},
data() {
return {
examList: [],
......@@ -69,6 +94,13 @@ export default {
pageNum: 1,
pageSize: 12,
scrollTop: 0,
showExamPopup: false,
examPopInfo: {
isExamLoading: false,
showError: false,
confirmText: '确认提交'
},
currentExam: {}
}
},
computed: {
......@@ -96,7 +128,7 @@ export default {
})
const { pageNum, pageSize } = this
const params = {
examResult: 2, // 不通过
examResult: 2, // 2不通过
pageNum,
pageSize,
staffPhone: uni.$storage.get('userInfo').phone
......@@ -105,7 +137,7 @@ export default {
const res = await uni.$api.commonApi.getExamPage(params)
console.log(res)
if (pageNum == 1) {
this.examList = res.list.concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list)
this.examList = res.list
} else {
this.examList = this.examList.concat(res.list)
}
......@@ -126,13 +158,95 @@ export default {
this.pageNum++
this.getExamList()
},
viewExam(item) {
// 跳转北森考试详情页
async viewExam(item) {
console.log('查看考试', item)
if (item.remainingTimes <= 0) return
// TODO: 跳转到考试详情页
this.showStudyPopup = false
this.currentExam = item
try {
// 获取北森 token
uni.showLoading({ title: '加载中...' })
const token = await this.findBeiSenSSOToken()
// const token = uni.$storage.get('beisenToken')
console.log('🔑 获取到的 token:', token)
uni.hideLoading()
if (token) {
// const COURSE_ID = 'c6d20419-fae9-4d35-a1d1-bd2b35c0c619';
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: item.examination
};
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const tokenUrl = this.tokenUrl || uni.$storage.get('beisenToken')
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
})
} else {
throw new Error('获取 token 失败')
}
} catch (error) {
uni.hideLoading()
console.error('❌ 获取 token 失败:', error)
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
},
// 获取北森 SSO Token(参考 detail.vue 的方法)
findBeiSenSSOToken() {
return new Promise((resolve, reject) => {
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
uni.$storage.set('beisenToken', res.data)
resolve(res.data || '')
}).catch(err => {
reject(err)
})
})
},
// 处理考试确认(用户选择已提交)
async handleExamConfirm() {
console.log('确认提交考试:', this.currentExam)
this.examPopInfo.isExamLoading = true
this.examPopInfo.showError = false
const { examination } = this.currentExam
try {
const params = {
examId: examination,
invokeType: 1 // 0:等级考试 1:课后考试
}
// TODO: 这里后续调用后端查询接口
const result = await uni.$api.commonApi.getExamResult(params)
console.log('查询到的考试结果:', result)
// 查询完成后关闭弹窗
this.examPopInfo.isExamLoading = false
console.log('查询完成,关闭弹窗')
this.showExamPopup = false
if (result) {
// 查询成功刷新考试列表
this.pageNum = 1
this.getExamList()
}
} catch (error) {
uni.showToast({
title: '未查询到考试结果',
icon: 'none'
})
}
},
retakeExam(item) {
console.log('重新考试', item)
// TODO: 跳转到考试页面
handleExamCancel() {
this.showExamPopup = false
}
}
}
......
......@@ -26,11 +26,11 @@
<!-- 最高得分 -->
<view class="exam-score">
<text class="score-label">最高得分</text>
<text class="score-value passed">{{ filterValue(item.highestScore, '分') }}|已通过</text>
<text class="score-value passed">{{ filterValue(item.maxTotalScore, '分') }}|已通过</text>
</view>
<!-- 重新考试按钮 -->
<view class="retake-btn" @click.stop="retakeExam(item)">
<view v-if="item.remainingTimes > 0" class="retake-btn">
<text class="retake-text">重新考试</text>
</view>
</view>
......@@ -47,11 +47,33 @@
<view class="end-text">到底了!</view>
</template>
</scroll-view>
<!-- 考试提交确认弹窗 -->
<StudyPopup
:show.sync="showExamPopup"
title=""
:width="848"
:closeButton="true"
:height="examPopInfo.isExamLoading ? 740 : 656"
:topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848"
:topImageHeight="248"
>
<ExamSubmitPopup
:isLoading="examPopInfo.isExamLoading"
:showError="examPopInfo.showError"
:confirmText="examPopInfo.confirmText"
@cancel="handleExamCancel"
@confirm="handleExamConfirm"
/>
</StudyPopup>
</view>
</template>
<script>
import utils from '@/utils/utils'
import StudyPopup from '../../../StudyPopup.vue'
import ExamSubmitPopup from '../../../ExamSubmitPopup.vue'
export default {
name: 'PassedExam',
props: {
......@@ -60,6 +82,10 @@ export default {
default: 0
}
},
components: {
StudyPopup,
ExamSubmitPopup
},
data() {
return {
examList: [],
......@@ -68,6 +94,13 @@ export default {
pageNum: 1,
pageSize: 12,
scrollTop: 0,
showExamPopup: false,
examPopInfo: {
isExamLoading: false,
showError: false,
confirmText: '确认提交'
},
currentExam: {}
}
},
computed: {
......@@ -87,6 +120,7 @@ export default {
filterValue(val, unit) {
return utils.filterValue(val, unit)
},
// 获取考试列表
async getExamList() {
console.log(11)
try {
......@@ -95,7 +129,7 @@ export default {
})
const { pageNum, pageSize } = this
const params = {
examResult: 1, // 已通过
examResult: 1, // 1已通过
pageNum,
pageSize,
staffPhone: uni.$storage.get('userInfo').phone
......@@ -104,7 +138,7 @@ export default {
const res = await uni.$api.commonApi.getExamPage(params)
console.log(res)
if (pageNum == 1) {
this.examList = res.list.concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list)
this.examList = res.list
} else {
this.examList = this.examList.concat(res.list)
}
......@@ -116,6 +150,7 @@ export default {
uni.hideLoading()
}
},
// 到底了
pageonReachBottom() {
if (this.nothing) return
if (this.examList.length >= this.total && this.pageNum > 1) {
......@@ -125,13 +160,95 @@ export default {
this.pageNum++
this.getExamList()
},
viewExam(item) {
// 跳转北森考试详情页
async viewExam(item) {
console.log('查看考试', item)
if (item.remainingTimes <= 0) return
// TODO: 跳转到考试详情页
this.showStudyPopup = false
this.currentExam = item
try {
// 获取北森 token
uni.showLoading({ title: '加载中...' })
const token = await this.findBeiSenSSOToken()
// const token = uni.$storage.get('beisenToken')
console.log('🔑 获取到的 token:', token)
uni.hideLoading()
if (token) {
// const COURSE_ID = 'c6d20419-fae9-4d35-a1d1-bd2b35c0c619';
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: item.examination
};
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const tokenUrl = this.tokenUrl || uni.$storage.get('beisenToken')
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
})
} else {
throw new Error('获取 token 失败')
}
} catch (error) {
uni.hideLoading()
console.error('❌ 获取 token 失败:', error)
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
},
// 获取北森 SSO Token(参考 detail.vue 的方法)
findBeiSenSSOToken() {
return new Promise((resolve, reject) => {
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
uni.$storage.set('beisenToken', res.data)
resolve(res.data || '')
}).catch(err => {
reject(err)
})
})
},
// 处理考试确认(用户选择已提交)
async handleExamConfirm() {
console.log('确认提交考试:', this.currentExam)
this.examPopInfo.isExamLoading = true
this.examPopInfo.showError = false
const { examination } = this.currentExam
try {
const params = {
examId: examination,
invokeType: 1 // 0:等级考试 1:课后考试
}
// TODO: 这里后续调用后端查询接口
const result = await uni.$api.commonApi.getExamResult(params)
console.log('查询到的考试结果:', result)
// 查询完成后关闭弹窗
this.examPopInfo.isExamLoading = false
console.log('查询完成,关闭弹窗')
this.showExamPopup = false
if (result) {
// 查询成功刷新考试列表
this.pageNum = 1
this.getExamList()
}
} catch (error) {
uni.showToast({
title: '未查询到考试结果',
icon: 'none'
})
}
},
retakeExam(item) {
console.log('重新考试', item)
// TODO: 跳转到考试页面
handleExamCancel() {
this.showExamPopup = false
}
}
}
......
......@@ -5,7 +5,7 @@
class="task-list-box">
<template v-if="taskList.length">
<view class="task-list">
<view class="task-item" v-for="(item, index) in taskList" :key="index" @click="handleTaskItemClick(item)">
<view class="task-item" v-for="(item, index) in taskList" :key="index" @click="handleTaskItemClick(item, index)">
<!-- <view class="time-limit-tag"></view> -->
<!-- 左上角:必修/选修标签 -->
<template v-if="item.planCourseType">
......@@ -52,36 +52,8 @@
</view>
</template>
<script>
const COURSE_TYPE = {
10: {
name: '视频',
image: 'short-course-default'
},
80: {
name: '音频',
image: 'course-default-bg'
},
20: {
name: '混合',
image: 'short-course-default'
},
30: {
name: '文档',
image: 'course-default-bg'
},
40: {
name: 'H5',
image: 'course-default-bg'
},
70: {
name: 'URL',
image: 'course-default-bg'
},
120: {
name: '图文',
image: 'course-default-bg'
}
}
import { COURSE_TYPE } from '../../../../pages/common/studyCenter/contant'
import dayjs from 'dayjs'
export default {
name: 'MyTask',
......@@ -99,6 +71,7 @@ export default {
},
mounted() {
this.getCourseTaskPage(this.tabIndex)
this.asyncfindBeiSenSSOToken()
},
beforeDestroy() {
// 移除事件监听,防止内存泄漏
......@@ -154,19 +127,36 @@ export default {
this.nothing = true;
}
},
handleTaskItemClick(item) {
handleTaskItemClick(item, index) {
console.log(item)
},
findBeiSenSSOToken() {
return new Promise(resolve => {
const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2'
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
uni.$storage.set('beisenToken', res.data)
const studyUrl = res.data ? `${res.data}&return_url=${url}` : ''
resolve(studyUrl)
const beisenToken = uni.$storage.get('beisenToken')
if (!beisenToken) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this;
// uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({
url: `/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.taskList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}&learnStatus=1`
})
},
async asyncfindBeiSenSSOToken() {
const res = await uni.$api.commonApi.findBeiSenSSOToken({})
uni.$storage.set('beisenToken', res.data)
},
// findBeiSenSSOToken() {
// return new Promise(resolve => {
// const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2'
// uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
// uni.$storage.set('beisenToken', res.data)
// const studyUrl = res.data ? `${res.data}&return_url=${url}` : ''
// resolve(studyUrl)
// })
// })
// },
}
}
</script>
......
......@@ -26,7 +26,7 @@
red: dataInfo.monHourRatio > 0,
green: dataInfo.monHourRatio < 0,
normal: dataInfo.monHourRatio === 0
}">{{ dataInfo.monHourRatio == null ? '-' : dataInfo.monHourRatio + '%' }}</text>
}">{{ dataInfo.monHourRatio == null ? '-' : Math.abs(dataInfo.monHourRatio) + '%' }}</text>
<template v-if="dataInfo.monHourRatio != null">
<view v-if="dataInfo.monHourRatio > 0" class="sprite-icon icon-up-arrow"></view>
<view v-else-if="dataInfo.monHourRatio < 0" class="sprite-icon icon-green-arrow"></view>
......@@ -81,13 +81,13 @@
<!-- 搜索框 -->
<view class="search-container">
<view class="search-box" @click="focusSearch">
<view v-if="!searchKeyword" class="search-placeholder-wrapper">
<uni-icons type="search" size="20" color="#999ea8" class="search-icon"></uni-icons>
<view v-show="!searchKeyword" class="search-placeholder-wrapper">
<text class="placeholder-text">搜索课程</text>
<uni-icons type="search" size="20" color="#999ea8" class="search-icon"></uni-icons>
</view>
<input ref="searchInput" class="search-input" v-model="searchKeyword" placeholder="" confirm-type="search"
@confirm="handleSearch" />
<view class="clear-btn" @click.stop="clearSearch" v-if="searchKeyword">
<view class="clear-btn" @click.stop="clearSearch" v-show="searchKeyword">
<uni-icons type="closeempty" size="16" color="#999ea8"></uni-icons>
</view>
</view>
......@@ -124,7 +124,7 @@
<view class="sprite-icon icon-study-tips"></view>
<view class="tips-text">本周学习时长X小时,超过X%的人</view>
</view> -->
<Course ref="recommendCourse" />
<Course ref="allCourse" :searchParams="searchParams" />
</template>
</view>
</view>
......@@ -194,10 +194,10 @@ export default {
},
courseConfig: courseConfig, // 课程筛选配置
sortOptions: [
{ label: '综合排序', value: 'default' },
{ label: '最多人学', value: 'popular' },
{ label: '最高评分', value: 'rating' },
{ label: '最新发布', value: 'latest' }
// { label: '综合排序', value: 'default' },
{ label: '最多人学', value: 0 },
{ label: '最高评分', value: 1 },
{ label: '最新发布', value: 2 }
],
categoryOptions: [
{
......@@ -223,7 +223,10 @@ export default {
]
}
],
currentSortValue: 'default',
currentSortValue: 0,
searchParams: {
sortType: 0
}
}
},
created() {
......@@ -264,7 +267,7 @@ export default {
const res = await uni.$api.commonApi.getStudyCenterTimeStatistics({
staffPhone: uni.$storage.get('userInfo').phone
})
console.log(res, 'res')
console.log(res, 'getMyStudyTime')
if (res) {
this.dataInfo = res || {}
}
......@@ -284,7 +287,10 @@ export default {
...((item.children && Array.isArray(item.children)) ? item.children : [])
]
}))
this.categoryOptions = filtered
this.categoryOptions = [
{ categoryName: '全部分类', children: [{ categoryName: '全部' }] },
...filtered
]
}
},
// 聚焦搜索框
......@@ -294,31 +300,55 @@ export default {
// 处理搜索
handleSearch() {
console.log('搜索关键词:', this.searchKeyword)
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入搜索关键词
},
// 清空搜索
clearSearch() {
this.searchKeyword = ''
delete this.searchParams.title
this.handleSearch()
},
// 打开筛选弹窗
openFilter() {
this.$refs.orderScreen.open()
},
// 处理排序变化
// 处理排序变化 综合排序、最多人学、最高评分、最新发布
handleSortChange({ item, index }) {
console.log('排序变化:', item, index)
this.currentSortValue = item.value
// TODO: 调用课程列表接口,传入排序参数
// if (item.value == 'default') {
// // 综合排序不用传参数
// delete this.searchParams.sortType
// } else {
this.searchParams.sortType = item.value
// }
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.getALlCourse()
},
// 处理分类变化
handleCategoryChange({ item, level, parent }) {
console.log('分类变化:', item, level, parent)
this.searchParams.courseCategoryId = item.id
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入分类参数
},
// 处理筛选确认
handleFilterConfirm(filterData) {
console.log('筛选条件:', filterData)
const {planCourseType, courseFileType, totalStar} = this.searchParams
if (Object.keys(filterData).length === 0) {
planCourseType && delete this.searchParams.planCourseType
courseFileType && delete this.searchParams.courseFileType
totalStar && delete this.searchParams.totalStar
} else {
this.searchParams = Object.assign(this.searchParams, filterData)
}
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入筛选条件
},
// 跳转到我的课程
......
......@@ -162,23 +162,25 @@
v-if="showBeisen"
></web-view> -->
<!-- 学习中心弹窗 -->
<!-- 学习中心 等级考试弹窗 -->
<StudyPopup
:show.sync="showStudyPopup"
title="开始学习学之旅"
title="开始您的学习之旅"
:topImage="require('@/assets/images/common/study-center-bg.webp')"
:topImageWidth="848"
:topImageHeight="248"
>
<StudyPopupContent
cardTitle="个性化学习路径"
description="根据你的岗位和考卷,我们打造针对性的学习课程内容,帮助你循序渐进,实现快速通关"
description="根据您当前的学习情况,我们将为您定制专属的学习计划,帮助您高效提升技能,实现职业突破。"
:listItems="[
'基于当前岗位定制课程',
'根据你的发展规划匹配你的学习',
'定期推送学习提醒与激励'
'基于当前能力水平评估',
'结合岗位发展目标制定',
'定期跟踪学习进度和效果'
]"
tipText="true"
courseName="XXX"
buttonText="开始学习"
:courseName="courseInfo.title"
buttonText="开始测评"
@button-click="handleStartAssessment"
/>
</StudyPopup>
......@@ -188,13 +190,15 @@
:show.sync="showExamPopup"
title=""
:width="848"
:height="isExamLoading ? 740 : 656"
:height="examPopInfo.isExamLoading ? 740 : 656"
:topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848"
:topImageHeight="248"
>
<ExamSubmitPopup
:isLoading="isExamLoading"
:isLoading="examPopInfo.isExamLoading"
:showError="examPopInfo.showError"
:confirmText="examPopInfo.confirmText"
@cancel="handleExamCancel"
@confirm="handleExamConfirm"
/>
......@@ -212,6 +216,7 @@
style="overflow: hidden;"
>
<StudyCenterPermissionPopup
:lockReason="lockReason"
@confirm="handleStudyPermissionConfirm"
/>
</StudyPopup>
......@@ -289,8 +294,16 @@ export default {
previewOff: false,
showStudyPopup: false,
showExamPopup: false,
isExamLoading: false,
showStudyPermissionPopup: false
examPopInfo: {
isExamLoading: false,
showError: false,
confirmText: '确认已提交'
},
showStudyPermissionPopup: false,
courseInfo: {
title: ''
},
lockReason: 0
}
},
created() {
......@@ -335,29 +348,31 @@ export default {
// 处理开始测评(参考 detail.vue 的实现)
async handleStartAssessment() {
this.showStudyPopup = false
try {
// 获取北森 token
uni.showLoading({ title: '加载中...' })
const token = await this.findBeiSenSSOToken()
console.log('🔑 获取到的 token:', token)
uni.hideLoading()
if (token) {
// 将目标 URL 编码
const targetUrl = 'https://cloud.italent.cn/PageHome/Index?product=Learning&keyName=Nusion&pageCode=LearningExamList&appCode=Learning#/viewDynamic'
console.log('🎯 目标 URL:', targetUrl)
const encodedUrl = encodeURIComponent(targetUrl)
console.log('📝 编码后的 URL:', encodedUrl)
// 拼接完整 URL:token&return_url=编码后的目标URL
const fullUrl = `${token}&return_url=${encodedUrl}`
console.log('✅ 完整拼接的 URL (直接传递给 webview):', fullUrl)
// const COURSE_ID = 'c6d20419-fae9-4d35-a1d1-bd2b35c0c619';
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: this.courseInfo.examId
};
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const tokenUrl = this.tokenUrl || uni.$storage.get('beisenToken')
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(fullUrl)}&pageTitle=学习测评`
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
})
} else {
throw new Error('获取 token 失败')
......@@ -365,10 +380,10 @@ export default {
} catch (error) {
uni.hideLoading()
console.error('❌ 获取 token 失败:', error)
uni.showToast({
title: '获取授权失败,请重试',
icon: 'none'
})
// uni.showToast({
// title: '获取授权失败,请重试',
// icon: 'none'
// })
}
},
// 获取北森 SSO Token(参考 detail.vue 的方法)
......@@ -385,6 +400,12 @@ export default {
// 处理考试取消(用户选择未提交)
handleExamCancel() {
this.showExamPopup = false
this.examPopInfo = {
isExamLoading: false,
showError: false,
confirmText: '确认已提交'
}
this.getLevelExamInfo()
},
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
......@@ -434,25 +455,39 @@ export default {
},
// 处理考试确认(用户选择已提交)
async handleExamConfirm() {
console.log('handleExamConfirm 执行开始')
this.isExamLoading = true
console.log('isExamLoading 设置为 true:', this.isExamLoading)
this.examPopInfo.isExamLoading = true
this.examPopInfo.showError = false
const { examId, levelExamId } = this.courseInfo
try {
const params = {
examId,
invokeType: 0,
levelExamId
}
// TODO: 这里后续调用后端查询接口
// const result = await uni.$api.commonApi.checkExamResult({...})
const result = await uni.$api.commonApi.getExamResult(params)
console.log('查询到的考试结果:', result)
// 模拟延迟
await new Promise(resolve => setTimeout(resolve, 2000))
// 查询完成后关闭弹窗
this.isExamLoading = false
console.log('查询完成,关闭弹窗')
this.showExamPopup = false
// await new Promise(resolve => setTimeout(resolve, 2000))
if (result) {
// 查询完成后关闭弹窗
this.examPopInfo.isExamLoading = false
console.log('查询完成,关闭弹窗')
this.showExamPopup = false
this.getLevelExamInfo()
// 关闭后刷新学习中心的学习时长
if (this.$refs.pointRef && typeof this.$refs.pointRef.getMyStudyTime === 'function') {
this.$refs.pointRef.getMyStudyTime()
}
} else {
this.examPopInfo.isExamLoading = false
this.examPopInfo.showError = true
this.examPopInfo.confirmText = '重新确认'
}
} catch (error) {
console.error('查询考试结果失败:', error)
this.isExamLoading = false
uni.showToast({
title: '查询失败,请重试',
title: '未查询到考试结果,请重新确认',
icon: 'none'
})
}
......@@ -464,10 +499,15 @@ export default {
// 切换到学习中心时显示弹窗
if (item.name === 'StudyCenter') {
const res = await uni.$api.commonApi.startExam()
if (res) {
this.showStudyPopup = true
}
this.getLevelExamInfo()
}
},
// 查询等级弹窗信息
async getLevelExamInfo() {
const res = await uni.$api.commonApi.startExam()
if (res) {
this.showStudyPopup = true
this.courseInfo = res
}
},
handleFooter (val) {
......@@ -607,6 +647,10 @@ export default {
if (!noInterceptPage.includes(item.name)) {
if (sceneType != 7) {
if (await this.inspectionOfProhibitionBill()) return
if (await this.getLimitRecord()) {
this.showStudyPermissionPopup = true
return
}
}
if (await this.checkDailyReport(sceneType != 7)) return
}
......
......@@ -419,11 +419,17 @@ export default {
let goodsArr = goodsList[index].multipleSpecificationsGoods.specificationGoodsMap[str]
//当多规格商品只有一个时,直接选中
if (goodsArr.length == 1) {
let { chooseList } = this,
addIndex = -1
chooseList.map((item, ind) => {
if (item.goodsFlag == 2 && item.multipleSpecificationsGoods.id == goodsList[index].multipleSpecificationsGoods.id) addIndex = ind
})
goodsList[index].active = true
goodsList[index].multipleSpecificationsGoods.goods = goodsArr[0]
goodsList[index].multipleSpecificationsGoods.goods.goodsId = goodsList[index].multipleSpecificationsGoods.goods.merchantGoodsId
goodsList[index].multipleSpecificationsGoods.goods.specificationStr = goodsList[index].multipleSpecificationsGoods.goods.specificationData.replace(/;~;/g, '/')
this.chooseList.push(goodsList[index])
if (addIndex == -1) this.chooseList.push(goodsList[index])
else this.chooseList[addIndex] = goodsList[index]
this.$emit('choose', this.chooseList)
} else {
//多个多规格商品时出现弹窗
......@@ -450,12 +456,16 @@ export default {
})
let { chooseList } = this
chooseList.forEach((item, ind) => {
if (item.multipleSpecificationsGoods.id === goodsList[index].multipleSpecificationsGoods.id) {
if (item.goodsFlag == 2 && item.multipleSpecificationsGoods.id == goodsList[index].multipleSpecificationsGoods.id) {
chooseList.splice(ind, 1)
console.log(chooseList)
}
})
// this.chooseList = chooseList
console.log(this.chooseList)
this.$emit('choose', this.chooseList)
}
// console.log(this.list, index, goodsList[index])
this.$set(this.list, index, goodsList[index])
} else {
if (goodsList[index].active) {
......@@ -466,7 +476,7 @@ export default {
})
let { chooseList } = this
chooseList.forEach((item, ind) => {
if (item.multipleSpecificationsGoods.id === goodsList[index].multipleSpecificationsGoods.id) {
if (item.goodsFlag == 2 && item.multipleSpecificationsGoods.id === goodsList[index].multipleSpecificationsGoods.id) {
chooseList.splice(ind, 1)
}
})
......
......@@ -221,7 +221,7 @@ const componentConfig = {
loadComplete: false,
placeholder: '查找',
nullTips: '请选择客户',
idKey: 'phone',
idKey: 'customerId',
cacheData: [],
loadComplete: false,
searchValue: '',
......
......@@ -3,10 +3,10 @@ const screenList = [
title: '选必修',
componentName: 'CourseOptionList',
params: {
idKey: 'required',
idKey: 'planCourseType',
options: [
{ label: '必修', value: 'required' },
{ label: '选修', value: 'optional' }
{ label: '必修', value: 1 },
{ label: '选修', value: 2 }
]
}
},
......@@ -14,10 +14,15 @@ const screenList = [
title: '课程类型',
componentName: 'CourseOptionList',
params: {
idKey: 'courseType',
idKey: 'courseFileType',
options: [
{ label: '视频', value: 'video' },
{ label: '文档', value: 'document' }
{ label: '视频', value: 10 },
{ label: '音频', value: 80 },
{ label: '混合', value: 20 },
{ label: '文档', value: 30 },
{ label: 'H5', value: 40 },
{ label: 'URL', value: 70 },
{ label: '图文', value: 120 }
]
}
},
......@@ -25,10 +30,10 @@ const screenList = [
title: '评分',
componentName: 'CourseOptionList',
params: {
idKey: 'rating',
idKey: 'totalStar',
options: [
{ label: '4星以上', value: '4' },
{ label: '3星以上', value: '3' }
{ label: '4星以上', value: 8 },
{ label: '3星以上', value: 6 }
]
}
}
......
......@@ -10,7 +10,12 @@
<!-- 第二段描述(橙色) -->
<view class="highlight-text">
到学习中心-我的课程-待学习,完成课程学习后,即可解锁开单权限。
<template v-if="lockReason === 0">
到学习中心-我的课程-待学习,完成课程学习后,即可解锁开单权限。
</template>
<template v-if="lockReason === 1">
到学习中心-我的任务,完成长课程学习任务后,即可解锁开单权限。
</template>
</view>
<!-- 第三段描述 -->
......@@ -27,6 +32,12 @@
<script>
export default {
props: {
lockReason: {
type: Number,
default: 0
}
},
name: 'StudyCenterPermissionPopup',
methods: {
handleGoToStudy() {
......@@ -42,6 +53,7 @@ export default {
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: toRpx(48);
}
.popup-title {
......@@ -63,16 +75,18 @@ export default {
font-family: "HarmonyOSSansSC";
text-align: center;
line-height: toRpx(48);
margin-bottom: toRpx(48);
margin-bottom: toRpx(40);
}
.highlight-text {
width: toRpx(656);
background-color: #FEF5EA;
padding: toRpx(8) toRpx(32);
border-radius: toRpx(8);
width: toRpx(720);
min-height: toRpx(104);
color: #ff9d0a;
font-size: toRpx(32);
font-weight: 400;
font-family: "HarmonyOSSansSC";
text-align: center;
line-height: toRpx(52);
margin-bottom: toRpx(64);
......@@ -100,7 +114,8 @@ export default {
font-family: "HarmonyOSSansSC";
text-align: center;
line-height: toRpx(80);
margin-bottom: toRpx(48);
// margin-bottom: toRpx(48);
margin-top: auto;
&:active {
opacity: 0.8;
......
<!-- 开始学习之旅 -->
<template>
<view v-if="show" class="study-popup-mask" @click="handleMaskClick">
<view
......@@ -11,8 +12,11 @@
class="top-image"
:src="topImage"
:style="topImageStyle"
mode="aspectFill"
/>
<view v-if="closeButton" @click.stop="closePopup">
<view class="sprite-icon icon-evaluationClose"></view>
</view>
<!-- 标题 -->
<view v-if="title" class="popup-title">{{ title }}</view>
......@@ -63,6 +67,10 @@ export default {
maskClosable: {
type: Boolean,
default: false
},
closeButton: {
type: Boolean,
default: false
}
},
computed: {
......@@ -91,6 +99,9 @@ export default {
close() {
this.$emit('update:show', false)
this.$emit('close')
},
closePopup() {
this.close()
}
}
}
......@@ -120,7 +131,11 @@ export default {
max-height: toRpx(740);
overflow-y: auto;
}
.sprite-icon {
top: toRpx(48);
right: toRpx(48);
position: absolute;
}
.top-image {
width: 100%;
display: block;
......
......@@ -82,47 +82,45 @@ export default {
}
.content-card {
width: 720rpx;
width: toRpx(720);
opacity: 1;
border-radius: 20rpx;
border-radius: toRpx(20);
background: rgba(247, 248, 250, 1);
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
padding: 32rpx 40rpx;
padding: toRpx(32) toRpx(40);
box-sizing: border-box;
}
.card-title {
font-size: 36rpx;
font-size: toRpx(36);
font-weight: 500;
letter-spacing: 0;
line-height: 40rpx;
line-height: toRpx(40);
color: rgba(41, 45, 51, 1);
text-align: left;
margin-bottom: 16rpx;
margin-bottom: toRpx(16);
}
.description-text {
width: 640rpx;
font-size: 32rpx;
width: toRpx(640);
font-size: toRpx(32);
font-weight: 400;
letter-spacing: 0;
line-height: 48rpx;
line-height: toRpx(48);
color: rgba(108, 111, 117, 1);
margin-bottom: 16rpx;
}
.list-wrapper {
width: 100%;
margin-top: 16rpx;
margin-top: toRpx(16);
}
.list-item {
display: flex;
align-items: flex-start;
margin-bottom: 8rpx;
&:last-child {
margin-bottom: 0;
......@@ -130,32 +128,32 @@ export default {
}
.dot {
width: 8rpx;
height: 8rpx;
width: toRpx(8);
height: toRpx(8);
border-radius: 50%;
background: rgba(108, 111, 117, 1);
margin-top: 18rpx;
margin-right: 12rpx;
margin-top: toRpx(18);
margin-right: toRpx(12);
flex-shrink: 0;
}
.list-text {
flex: 1;
font-size: 32rpx;
font-size: toRpx(32);
font-weight: 400;
letter-spacing: 0;
line-height: 52rpx;
line-height: toRpx(52);
color: rgba(108, 111, 117, 1);
}
.tip-text {
width: 720rpx;
font-size: 28rpx;
width: toRpx(720);
font-size: toRpx(28);
font-weight: 500;
letter-spacing: 0;
line-height: 32.82rpx;
line-height: toRpx(32.82);
color: rgba(108, 111, 117, 1);
margin-top: 56rpx;
margin-top: toRpx(56);
text-align: center;
.highlight {
......@@ -164,19 +162,19 @@ export default {
}
.action-button {
width: 720rpx;
height: 80rpx;
border-radius: 48rpx;
width: toRpx(720);
height: toRpx(80);
border-radius: toRpx(48);
background: linear-gradient(180deg, rgba(44, 102, 247, 1) 0%, rgba(72, 166, 255, 1) 100%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 16rpx;
font-size: 28rpx;
margin-top: toRpx(16);
font-size: toRpx(28);
font-weight: 500;
letter-spacing: 0;
line-height: 40rpx;
line-height: toRpx(40);
color: rgba(255, 255, 255, 1);
text-align: center;
cursor: pointer;
......
<template>
<view class="two-level-select-box">
<view
class="select"
@click.stop="isSelect = !isSelect"
>
<view class="select" @click.stop="toggleSelect">
{{ currentLabel }}
<view class="sprite-icon icon-arrow-bottom"></view>
</view>
<view
class="pop-box"
v-if="isSelect"
>
<view class="first-level-box">
<view
v-for="(item, index) in selectList"
:key="index"
class="type-item flex"
:class="getItemClass(index, item)"
@click="chooseFirstLevel(index, item)"
>
<view class="pop-box" v-if="isSelect">
<view class="first-level-box ">
<view v-for="(item, index) in selectList" :key="index" class="type-item flex" :class="getItemClass(index, item)"
@click="chooseFirstLevel(index, item)">
<view class="item-label">{{ item[labelKey] }}</view>
</view>
</view>
<view
class="second-level-box"
>
<view
v-for="(child, childIndex) in currentFirstLevel.children"
:key="childIndex"
class="type-item flex"
:class="childIndex === selectSecondIndex ? 'active' : ''"
@click.stop="chooseSecondLevel(childIndex, child)"
>
<view class="second-level-box" v-if="showSecondLevel && currentFirstLevel && currentFirstLevel.children && currentFirstLevel.children.length">
<view v-for="(child, childIndex) in currentFirstLevel.children" :key="childIndex" class="type-item flex"
:class="childIndex === selectSecondIndex ? 'active' : ''" @click.stop="chooseSecondLevel(childIndex, child)">
{{ child[labelKey] }}
</view>
</view>
......@@ -54,23 +36,43 @@ export default {
selectFirstIndex: 0,
selectSecondIndex: -1,
isSelect: false,
currentFirstLevel: [{
categoryName: '全部分类',
id: 'all',
children: [{ categoryName: '全部', id: 'all_all' }]
}]
showSecondLevel: false,
currentFirstLevel: null
}
},
watch: {
selectList: {
immediate: true,
handler (n) {
if (Array.isArray(n) && n.length) {
this.selectFirstIndex = 0
this.currentFirstLevel = n[0]
if (this.currentFirstLevel.children && this.currentFirstLevel.children.length) {
this.showSecondLevel = true
const idx = this.currentFirstLevel.children.findIndex(c => c[this.labelKey] === '全部')
this.selectSecondIndex = idx !== -1 ? idx : 0
} else {
this.showSecondLevel = false
this.selectSecondIndex = -1
}
}
}
}
},
computed: {
currentLabel() {
const firstItem = this.selectList[this.selectFirstIndex]
if (!firstItem) return ''
// 如果有选中的二级分类
if (this.selectSecondIndex >= 0 && firstItem.children && firstItem.children[this.selectSecondIndex]) {
return firstItem.children[this.selectSecondIndex][this.labelKey]
console.log(111111)
const child = firstItem.children[this.selectSecondIndex]
const childLabel = child[this.labelKey]
if (childLabel === '全部') return firstItem[this.labelKey]
return childLabel
}
// 否则显示一级分类
return firstItem[this.labelKey]
}
......@@ -78,7 +80,7 @@ export default {
methods: {
getItemClass(index, item) {
const classes = []
if (index === this.selectFirstIndex && this.selectSecondIndex === -1) {
if (index === this.selectFirstIndex) {
classes.push('active')
}
if (item.children && item.children.length) {
......@@ -89,12 +91,24 @@ export default {
hideSelect() {
this.isSelect = false
},
toggleSelect() {
this.isSelect = !this.isSelect
if (this.isSelect && this.currentFirstLevel && this.currentFirstLevel.children && this.currentFirstLevel.children.length) {
this.showSecondLevel = true
}
},
chooseFirstLevel(index, item) {
// 如果有二级菜单,显示二级菜单
if (item.children && item.children.length) {
this.currentFirstLevel = item
this.selectFirstIndex = index
// this.selectSecondIndex = -1
this.showSecondLevel = true
const idx = item.children.findIndex(c => c[this.labelKey] === '全部')
this.selectSecondIndex = idx !== -1 ? idx : 0
if(item.children.length === 1 && item.children[0][this.labelKey] === '全部') {
this.isSelect = false
this.$emit('chooseType', { item, index, level: 1 })
}
} else {
// 没有二级菜单,直接选中
this.selectFirstIndex = index
......@@ -106,13 +120,22 @@ export default {
chooseSecondLevel(childIndex, child) {
this.selectSecondIndex = childIndex
this.isSelect = false
this.$emit('chooseType', {
item: child,
index: childIndex,
parentIndex: this.selectFirstIndex,
parent: this.currentFirstLevel,
level: 2
})
const isAll = child && child[this.labelKey] === '全部'
if (isAll) {
this.$emit('chooseType', {
item: this.currentFirstLevel,
index: this.selectFirstIndex,
level: 1
})
} else {
this.$emit('chooseType', {
item: child,
index: childIndex,
parentIndex: this.selectFirstIndex,
parent: this.currentFirstLevel,
level: 2
})
}
}
}
}
......@@ -122,7 +145,7 @@ export default {
.two-level-select-box {
position: relative;
z-index: 5;
.select {
display: flex;
align-items: center;
......@@ -133,41 +156,42 @@ export default {
background: #f2f2f2;
padding: 0 toRpx(24) 0 toRpx(40);
}
.pop-box {
position: absolute;
top: toRpx(100);
left: 0;
// width: 100%;
// width: toRpx(592);
background: #ffffff;
box-shadow: 0 0 toRpx(16) 0 #99999933;
border-radius: toRpx(16);
padding: toRpx(16) 0;
animation: show-view-opacity 0.15s forwards;
display: flex;
.first-level-box {
min-width: toRpx(176);
text-align: left;
.item-label {
display: inline-block;
white-space: nowrap;
}
}
.second-level-box {
width: toRpx(400);
// border-left: 1px solid #f0f0f0;
max-height: toRpx(400);
overflow-y: auto
}
.type-item {
padding: 0 toRpx(28);
margin-bottom: toRpx(8);
height: toRpx(84);
justify-content: center;
// justify-content: center;
align-items: center;
&:last-child {
margin-bottom: 0;
}
&.active {
} &.active {
background-color: #ecf1ff;
}
}
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 2
const index = 1
/**
*
0本地
......
......@@ -68,11 +68,11 @@ uni.signHttpConfig = {
},
error: (error, config) => {
console.log('error事件触发', error, config)
if(error && error.errMsg == 'request:fail') {
if (error && error.errMsg == 'request:fail') {
return uni.showToast({
title: '网络异常',
icon: 'none',
})
title: '网络异常',
icon: 'none',
})
}
uni.showToast({
title: error.msg || '业务异常',
......
......@@ -248,6 +248,21 @@ export default {
confirmColor: '#347BFF'
})
return Promise.resolve(data)
}
},
// 限制录单
async getLimitRecord () {
const data = await uni.$api.commonApi.getLimitRecord()
if (data)
console.log(data, '限制录单')
// uni.showModal({
// title: '温馨提示',
// content: '您已到学习次数上限,禁止录单!\n请在平板电脑上展业助手-学习中心完成学习。',
// showCancel: false,
// cancelColor: '#292D33',
// confirmText: '确定',
// confirmColor: '#347BFF'
// })
return Promise.resolve(data)
},
}
}
......@@ -139,6 +139,12 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/common/studyCenter/courseDetail",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/common/msgwebview"
},
......
......@@ -52,6 +52,7 @@ import Package from './Package.vue'
import SkuGoods from './SkuGoods.vue'
import { FORM_LIST, popupTypeEnum, payTypeList } from '../contant'
import { interceptionMixin } from '@/mixin/index'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default {
name: 'CreateOrder',
mixins: [interceptionMixin],
......@@ -216,6 +217,7 @@ export default {
positionTypeList: [],
valueKey: '',
totalPrice: 0,
validateState:null,
// 产品槽位配置,用于循环渲染产品组件
productSlots: {
frontGear: true,
......@@ -382,6 +384,21 @@ export default {
inputBlur(e, val) {
console.log(e, val)
this.orderObj.customer[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
let standNoVal = this.orderObj.standNo;
if (val.value === 'standNo' && standNoVal) {
this.orderObj.standNo = formatVinInput(standNoVal)
validateVin(this.orderObj.standNo).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
}
},
// 校验必填等规则
checkRequired() {
......@@ -430,9 +447,9 @@ export default {
}
}
if (this.orderObj.standNo) {
if (!utils.validateVIN(this.orderObj.standNo)) throw '车架号校验不匹配,请核对后重新输入'
}
// if (this.orderObj.standNo) {
// if (!utils.validateVIN(this.orderObj.standNo)) throw '车架号校验不匹配,请核对后重新输入'
// }
// 处理onlyLabel为true的特殊校验
if (onlyLabelItem.length > 0) {
......@@ -458,8 +475,22 @@ export default {
// 提交
async submit() {
console.log(this.orderObj)
if (!this.checkRequired()) return
// VIN车架号-动态校验
const carVin = this.orderObj.standNo
console.log("validateState",this.validateState);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'})
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'})
return false
}
}
if (!(await this.checkDailyReport())) {
const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj)
......
......@@ -127,7 +127,7 @@
:placeholder="i.inputPlaceholder || '请输入'"
placeholder-class="placeholder"
@blur="handleCarInputBlur($event, i , item , index)"
:maxlength="3"
:maxlength="i.maxlength || 3"
:key="dateKey[`${i.key}_${index}`]"
auto-blur
>
......@@ -353,6 +353,7 @@ export default {
required: true,
min: 0,
max: 3000,
maxlength: 4,
inputPlaceholder: ''
},
{
......@@ -362,6 +363,7 @@ export default {
required: true,
min: 0,
max: 3000,
maxlength: 4,
inputPlaceholder: ''
},
]),
......@@ -635,11 +637,11 @@ export default {
handleCarInputBlur (e, i, item, index) {
let { value } = e.detail
if (value) {
let { key } = i,
let { key, max } = i,
numbers = value.match(/\d+/g)
numbers = numbers ? numbers.join('') : ''
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
item[key] = Math.min(Math.max(Number(numbers), 0), 100).toString()
item[key] = Math.min(Math.max(Number(numbers), 0), max).toString()
this.dateKey[`${key}_${index}`] = Date.now()
}
},
......
......@@ -62,6 +62,7 @@ import SkuGoods from './SkuGoods.vue'
import { checkDailyReport, showNextModal } from '@/utils/modalUtils'
import { DEFEAT_FORM_LIST, popupTypeEnum, payTypeList } from '../contant'
import { debounce } from 'lodash'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default {
name: 'DefeatOrder',
components: {
......@@ -182,6 +183,7 @@ export default {
positionTypeList: [],
valueKey: '',
totalPrice: 0,
validateState:null,
// 产品槽位配置,用于循环渲染产品组件
productSlots: {
frontGear: true,
......@@ -333,13 +335,27 @@ export default {
console.log(e, val)
console.log(this.orderObj)
this.orderObj.customer[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
let standNoVal = this.orderObj.standNo;
if (val.value === 'standNo' && standNoVal) {
this.orderObj.standNo = formatVinInput(standNoVal)
validateVin(this.orderObj.standNo).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
}
},
checkRequired() {
const phoneRex = /^[1]([3-9])[0-9]{9}$/
// 把formList中所有required为true的对象放到一个数组中
const requiredArr = []
const onlyLabelItem = []
this.formList.forEach(group => {
group.forEach(item => {
if (item.required === true && item.hidden !== true) {
......@@ -351,7 +367,22 @@ export default {
}
})
})
// VIN车架号-动态校验
const carVin = this.orderObj.standNo
console.log("validateState",this.validateState);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'})
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'})
return false
}
}
// 遍历requiredArr,检查orderObj中是否有对应的值
for (let i = 0; i < requiredArr.length; i++) {
const item = requiredArr[i]
......@@ -380,18 +411,17 @@ export default {
}
}
if (this.orderObj.standNo) {
const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/
console.log(this.orderObj.standNo, vinRex.test(this.orderObj.standNo))
if (!vinRex.test(this.orderObj.standNo)) {
uni.showToast({
title: `请输入正确的VIN码`,
icon: 'none'
})
return false
}
}
// if (this.orderObj.standNo) {
// const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/
// console.log(this.orderObj.standNo, vinRex.test(this.orderObj.standNo))
// if (!vinRex.test(this.orderObj.standNo)) {
// uni.showToast({
// title: `请输入正确的VIN码`,
// icon: 'none'
// })
// return false
// }
// }
// 处理onlyLabel为true的特殊校验
if (onlyLabelItem.length > 0) {
// 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空
......@@ -419,6 +449,7 @@ export default {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return false
console.log("this.checkRequired()",this.checkRequired());
if (!this.checkRequired()) return
const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj)
......
......@@ -33,7 +33,7 @@
</template>
<template v-else>
<view class="nothing flex">
<image class="icon" src="../../../../assets/images/boutique/nothing.png" />
<image class="icon" src="../../../../assets/images/common/noData.png" />
暂无数据
</view>
</template>
......@@ -118,12 +118,20 @@ export default {
}
},
startStudy(item, index) {
const beisenToken = uni.$storage.get('beisenToken')
if (!beisenToken) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this;
uni.$track.add({ eventCode: 'app_completed_course', businessId: item.id, pagePath: '/pages/common/studyCenter/myCourse' })
// uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({
url: `/pages/common/studyDetail/detail?type=completed&index=${index}&completedCourseList=${encodeURIComponent(JSON.stringify(this.completedCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}`
url: `/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.completedCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}&learnStatus=2`
})
}
},
}
}
</script>
......@@ -237,19 +245,20 @@ export default {
}
}
.nothing {
width: 100%;
flex-direction: column;
margin-top: toRpx(380);
font-size: toRpx(28);
color: #999999;
.nothing {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: toRpx(1000);
color: #999999;
font-size: toRpx(24);
.icon {
width: toRpx(678);
height: toRpx(284);
margin-bottom: toRpx(24);
.icon {
width: toRpx(344);
height: toRpx(208);
}
}
}
.end-text {
color: #999;
......
......@@ -5,7 +5,7 @@
class="task-list-box">
<template v-if="taskList.length">
<view class="task-list">
<view class="task-item" v-for="(item, index) in taskList" :key="index" @click="handleTaskItemClick(item)">
<view class="task-item" v-for="(item, index) in taskList" :key="index" @click="handleTaskItemClick(item, index)">
<!-- 左上角:必修/选修标签 -->
<template v-if="item.planCourseType">
<image class="course-tag-left"
......@@ -40,7 +40,7 @@
</template>
<template v-else>
<view class="nothing flex">
<image class="icon" src="../../../../assets/images/boutique/nothing.png" />
<image class="icon" src="../../../../assets/images/common/noData.png" />
暂无数据
</view>
</template>
......@@ -153,17 +153,20 @@ export default {
this.nothing = true;
}
},
handleTaskItemClick(item) {
handleTaskItemClick(item, index) {
console.log(item)
},
findBeiSenSSOToken() {
return new Promise(resolve => {
const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2'
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
uni.$storage.set('beisenToken', res.data)
const studyUrl = res.data ? `${res.data}&return_url=${url}` : ''
resolve(studyUrl)
const beisenToken = uni.$storage.get('beisenToken')
if (!beisenToken) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this;
// uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({
url: `/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.taskList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}&learnStatus=1`
})
},
}
......@@ -254,7 +257,7 @@ export default {
}
.task-list-box {
// margin-top: toRpx(24);
margin-top: toRpx(40);
height: 100%;
}
......@@ -397,16 +400,17 @@ export default {
}
.nothing {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-top: toRpx(270);
font-size: toRpx(28);
height: toRpx(1000);
color: #999999;
font-size: toRpx(24);
.icon {
width: toRpx(678);
height: toRpx(284);
margin-bottom: toRpx(24);
width: toRpx(344);
height: toRpx(208);
}
}
......
......@@ -33,12 +33,12 @@
</view>
<!-- 评分星星 -->
<view v-if="!simplified && item.rating !== undefined" class="course-rating">
<view v-if="item.totalStar !== undefined" class="course-rating">
<view class="star-list">
<image v-for="star in 5" :key="star" class="star-icon" :src="getStarIcon(item.rating, star)"
<image v-for="star in 5" :key="star" class="star-icon" :src="getStarIcon(item.totalStar, star)"
mode="aspectFit" />
</view>
<text class="rating-text">{{ item.rating }}</text>
<text class="rating-text">{{ item.totalStar / 2 }}</text>
</view>
<!-- 学习人数 -->
......@@ -52,7 +52,7 @@
</template>
<template v-else>
<view class="nothing flex">
<image class="icon" src="../../../../assets/images/boutique/nothing.png" />
<image class="icon" src="../../../../assets/images/common/noData.png" />
暂无数据
</view>
</template>
......@@ -100,12 +100,11 @@ export default {
},
mounted() {
this.getALlCourse()
this.asyncfindBeiSenSSOToken()
},
methods: {
// 获取星星图标
getStarIcon(rating, position) {
const roundedRating = Math.round(rating * 2) / 2 // 四舍五入到0.5
const roundedRating = Math.round(rating) / 2 // 四舍五入到0.5
const diff = roundedRating - (position - 1)
if (diff >= 1) {
......@@ -127,11 +126,11 @@ export default {
})
const { pageNum, pageSize } = this
const params = {
staffPhone: uni.$storage.get('userInfo').phone, // 推荐状态 0=无推荐 1=推荐课程
learnStatus: 0, // 学习状态 0:待学习 1: 正在学习 2:已学完
pageNum,
pageSize
}
const res = await uni.$api.commonApi.getALlCourse(params)
const res = await uni.$api.commonApi.getMyCourseList(params)
console.log(res, '全部课程')
// 临时添加测试数据字段
const listWithTestData = res.list.map((item, index) => ({
......@@ -169,16 +168,21 @@ export default {
}
},
startStudy(item, index) {
console.log(item)
const beisenToken = uni.$storage.get('beisenToken')
if (!beisenToken) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this;
uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
// uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({
url: `/pages/common/studyDetail/detail?type=recommendation&index=${index}&recommendCourseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}`
url: `/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}&learnStatus=0`
})
},
async asyncfindBeiSenSSOToken() {
const res = await uni.$api.commonApi.findBeiSenSSOToken({})
uni.$storage.set('beisenToken', res.data)
},
}
}
</script>
......@@ -357,19 +361,20 @@ export default {
}
}
.nothing {
width: 100%;
flex-direction: column;
margin-top: toRpx(280);
font-size: toRpx(28);
color: #999999;
.nothing {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: toRpx(1000);
color: #999999;
font-size: toRpx(24);
.icon {
width: toRpx(678);
height: toRpx(284);
margin-bottom: toRpx(24);
.icon {
width: toRpx(344);
height: toRpx(208);
}
}
}
.end-text {
color: #999;
......
......@@ -6,7 +6,7 @@
<view class="back" @click="back">
<uni-icons type="left" :size="20" color="#000000"></uni-icons>
</view>
<view class="title">我的课程1</view>
<view class="title">我的课程</view>
</view>
</view>
......@@ -22,7 +22,7 @@
</view>
</view>
<!-- 提示信息 -->
<!-- 提示信息-->
<view class="tips" v-if="residueInfo.remindType != 0">
<view class="sprite-icon icon-study-tips"></view>
<view class="tips-text" v-if="residueInfo.remindType == '1'">剩余{{ residueInfo.residueDays }}天完成必修课学习及通过课后考试,过期将锁定开单权限</view>
......@@ -68,6 +68,7 @@ export default {
console.log('MyCoursePage mounted')
this.getMyCourseTabCount()
this.getStudyCenterResidueTime()
this.asyncfindBeiSenSSOToken() // 获取北森权限
},
methods: {
back() {
......@@ -87,7 +88,11 @@ export default {
async getStudyCenterResidueTime() {
const res = await uni.$api.commonApi.getStudyCenterResidueTime()
this.residueInfo = res
}
},
async asyncfindBeiSenSSOToken() {
const res = await uni.$api.commonApi.findBeiSenSSOToken({})
uni.$storage.set('beisenToken', res.data)
},
}
}
</script>
......
......@@ -44,11 +44,26 @@ export default {
return {
currentTab: 0,
tabList: [
{ label: '已通过', count: '3' },
{ label: '未通过', count: '2' }
{ label: '已通过', count: '0' },
{ label: '未通过', count: '0' }
]
}
},
created() {
// 在组件创建时就开始监听,确保事件能被捕获
uni.$on('showExamSubmitPopup', () => {
console.log('接收到考试提交弹窗事件')
if (this.currentTab === 1) {
this.$refs.failedExam.showExamPopup = true
} else if (this.currentTab === 0) {
this.$refs.passedExam.showExamPopup = true
}
})
},
beforeDestroy() {
// 组件销毁前移除监听
uni.$off('showExamSubmitPopup')
},
mounted() {
this.getExamStatistics()
},
......
......@@ -120,10 +120,10 @@ export default {
this.wv = wv
// 设置 webview 从导航栏下方开始显示
wv.setStyle({
top: '56', // 状态栏(48) + 导航栏(88) = 136rpx 转换为 68px
top: '26', // 状态栏(48) + 导航栏(88) = 136rpx 转换为 68px
left: '0',
width: '100%',
height: 'calc(100% - 136rpx)' // 减去顶部导航栏高度
height: '724' // 减去顶部导航栏高度
})
console.log('✅ webview 样式设置成功')
......
......@@ -91,6 +91,7 @@
<!-- 支付弹框 -->
<OrderPay
ref="OrderPay"
@closePopup="closePopup"
@jumpSuccess="jumpSuccess"
/>
</view>
......@@ -109,7 +110,7 @@ import UploadProofOfPayment from './UploadProofOfPayment.vue'
import dayjs from 'dayjs'
import OrderPay from './OrderPay.vue'
import NP from 'number-precision'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default {
name: 'CreateOrder',
mixins: [interceptionMixin],
......@@ -201,7 +202,8 @@ export default {
valueKey: '',
popupTitle: '',
pointsMultiRole: 'Y',
formKey: Date.now()
formKey: Date.now(),
validateState:null
}
......@@ -354,7 +356,7 @@ export default {
customerKeyList.map(key => {
if (owner[key] != null) orderObj[key] = owner[key]
})
if (owner.id) orderObj.customerId = owner.id
if (owner.id) orderObj.ownerId = owner.id
this.orderObj = orderObj
this.getConfig()
setTimeout(() => {
......@@ -448,7 +450,7 @@ export default {
if (val.value == 'payee') this.changePayee()
},
// 弹窗确认回调
onConfirm (val) {
onConfirm (val, flag) {
console.log(val, 'onConfirm')
this.externalData = []
// // const { chooseContent } = val
......@@ -473,14 +475,13 @@ export default {
this.$set(this.orderObj, 'skuGoods', chooseContent)
} else {
// 过滤出已选的goodFlag为2的对象
const selectedGoods = this.orderObj.skuGoods.filter(item => item.goodsFlag === 2)
const singleGoods = chooseContent.filter(item => item.goodsFlag != 2)
const selectedGoods = this.orderObj[_typeValue.key].filter(item => item.goodsFlag === 2)
const singleGoods = flag ? this.orderObj[_typeValue.key].filter(item => item.goodsFlag != 2) : chooseContent.filter(item => item.goodsFlag != 2)
const moreGoods = chooseContent
.filter(item => item.goodsFlag === 2)
.filter(item => {
return !selectedGoods.some(selectedItem => selectedItem.multipleSpecificationsGoods.goods.goodsId === item.multipleSpecificationsGoods.goods.goodsId)
})
console.log(singleGoods, '===')
// 合并已选的goodFlag为2的对象
this.orderObj.skuGoods = [...singleGoods, ...moreGoods, ...selectedGoods]
......@@ -507,12 +508,27 @@ export default {
},
// 输入框失去焦点事件
inputBlur (e, val) {
console.log("SSSSSS");
console.log(e, val)
if (val.value == 'price') {
this.orderObj[val.value] = parseFloat(this.orderObj[val.value]) > 2000000 ? 2000000 : this.orderObj[val.value]
return
}
this.orderObj[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
let carVinVal = this.orderObj.carVin;
if (val.value === 'carVin' && carVinVal) {
this.orderObj.carVin = formatVinInput(carVinVal)
validateVin(this.orderObj.carVin).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
}
},
// 校验必填等规则
checkRequired () {
......@@ -530,6 +546,21 @@ export default {
}
})
})
// VIN车架号-动态校验
const carVin = this.orderObj.carVin
console.log("validateState",this.validateState);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'})
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'})
return false
}
}
// 遍历requiredArr,检查orderObj中是否有对应的值
for (let i = 0; i < requiredArr.length; i++) {
const item = requiredArr[i]
......@@ -539,9 +570,9 @@ export default {
// 如果是customerPhone,添加phoneRex校验
if (item.value === 'phone' && !phoneRex.test(value)) throw `请输入正确的${item.label}`
}
if (orderObj.carVin) {
if (!utils.validateVIN(orderObj.carVin)) throw '车架号校验不匹配,请核对后重新输入'
}
// if (orderObj.carVin) {
// if (!utils.validateVIN(orderObj.carVin)) throw '车架号校验不匹配,请核对后重新输入'
// }
if (onlyLabelItem.length) {
const labelFields = ['skuGoods']
......@@ -712,7 +743,7 @@ export default {
customerKeyList.map(key => {
if (orderInfo[key] != null) params.owner[key] = orderInfo[key]
})
if (orderInfo.customerId) params.owner.id = orderInfo.customerId
if (orderInfo.ownerId) params.owner.id = orderInfo.ownerId
return params
},
// 乘以100保留两位小数点
......@@ -874,6 +905,7 @@ export default {
salesType = customerInfo.salesType || '0',
city = customerInfo.customerCity
Object.assign(orderObj, {
customerId: customerInfo.id,
owner: customerInfo.customerName,
phone: customerInfo.customerPhone,
ownerGender,
......@@ -948,6 +980,9 @@ export default {
}
return parseFloat(strVal)
},
closePopup(){
this.$emit('jump', 'OrderManagement')
}
}
}
</script>
......
......@@ -388,7 +388,7 @@ export default {
},
infoObject () {
let { tabIndex, carBandList, orderObj: { templateType, totalOrderMoney } } = this,
{ brandType, firstBrandId } = carBandList[tabIndex],
{ brandType, firstBrandId } = carBandList[tabIndex],
/**模版为广联权益 */
TemplateType3 = templateType == 3,//
NotAitoAndTemplateType3 = brandType != 0 || TemplateType3, //非问界 或者 广联权益 时隐藏
......@@ -637,6 +637,8 @@ export default {
...carBand,
firstBrandId,
firstBrandName,
deliveryCountRecord: carBand.deliveryCount,
notDeliveryCountRecord: carBand.notDeliveryCount,
brandId,
brandName,
brandType,
......@@ -687,9 +689,9 @@ export default {
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
this.orderObj[key] = Math.min(Math.max(Number(numbers), 0), 100).toString()
this.dateKey[key] = Date.now()
console.log(key)
if (
this.isNotEmpty(orderObj.recordStaffCount) &&
this.isNotEmpty(value) &&
orderObj.recordStaffCount != value &&
orderObj.lastStaffUuid &&
userInfo.uuid != orderObj.lastStaffUuid
......@@ -718,6 +720,11 @@ export default {
)
},
handleCarInputBlur (e, i, item, index) {
const { orderObj,
userInfo,
carBandList
} = this
console.log(carBandList,'===')
let { value } = e.detail
if (value) {
let { key, max } = i,
......@@ -726,6 +733,31 @@ export default {
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
item[key] = Math.min(Math.max(Number(numbers), 0), max).toString()
this.dateKey[`${key}_${index}`] = Date.now()
if (['deliveryCount', 'notDeliveryCount'].includes(key) && orderObj.onBreak == 'N') {
let checkName = `${key}Record`,
checkValue = carBandList[index][checkName]
if (
this.isNotEmpty(item[key]) &&
this.isNotEmpty(carBandList[index][checkName]) &&
checkValue != value &&
orderObj.lastStaffUuid &&
userInfo.uuid != orderObj.lastStaffUuid) {
let context = i.label
this.noticeObj = {
title: '重要提示',
text: `${context}与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,${context}将被清空。`,
type: 'warning',
buttons: [
{
text: '确定',
type: 'primary',
}
]
}
this.$nextTick(() => this.$refs.reportNotice.open())
}
}
console.log(key)
}
},
async submit () {
......@@ -842,7 +874,7 @@ export default {
showModal = true
carBandList.forEach(el => {
if (el.brandType == item.brandType) {
context += `【${item.brandName}】 店端总未触客数+门店售前触客数与当月实际交车数不符,差异值${item.differenceValue
context += `【${item.tabName}】 店端总未触客数+门店售前触客数与当月实际交车数不符,差异值${item.differenceValue
},请相关驻店销售对齐核销再次提交\t\n`
}
})
......
......@@ -143,6 +143,7 @@ export default {
closePopup () {
this.show = false
this.$refs.payPopup.closePopup()
this.$emit('closePopup')
}
}
......
......@@ -151,6 +151,7 @@ import dayjs from 'dayjs'
import permision from '@/js_sdk/wa-permission/permission.js'
import { sign, md532, md516 } from 'utils/common'
import { signSecretKey } from '@/env.js'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default {
name: 'AddEvaluationFrom',
components: {
......@@ -548,7 +549,8 @@ export default {
],
uploadOtherFields: [{ key: 41, label: '其他图片', required: false, accept: 'image', maxCount: 30, fullwidth: true }],
currentField: null,
query: {}
query: {},
validateVinState:null
}
},
onLoad(options) {
......@@ -872,23 +874,39 @@ export default {
}
// 车架号验证 - 长度17且只能包含数字和大写字母
const vin = this.formData.carBaseReqDTO.vin
const vinRegex = /^[A-Z0-9]+$/
if (!vinRegex.test(vin)) {
uni.showToast({
title: '车架号只能包含数字和大写字母',
icon: 'none'
})
return
}
if (vin.length != 17) {
uni.showToast({
title: '车架号必须为17位',
icon: 'none'
})
return
}
// const vin = this.formData.carBaseReqDTO.vin
// const vinRegex = /^[A-Z0-9]+$/
// if (!vinRegex.test(vin)) {
// uni.showToast({
// title: '车架号只能包含数字和大写字母',
// icon: 'none'
// })
// return
// }
// if (vin.length != 17) {
// uni.showToast({
// title: '车架号必须为17位',
// icon: 'none'
// })
// return
// }
// VIN车架号-动态校验
const carVin = this.formData.carBaseReqDTO.vin
console.log("validateState",this.validateState);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'})
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'})
return false
}
}
const engineNumber = this.formData.carBaseReqDTO.engineNumber
const engineNumberRegex = /^[A-Za-z0-9]+$/
if (!engineNumberRegex.test(engineNumber)) {
......@@ -990,7 +1008,7 @@ export default {
},
handleCell(field) {
const that = this
console.log("handleCellAAAAA");
if (field.isCar) {
this.openSelectCar()
} else if (field.isCity) {
......@@ -1110,6 +1128,17 @@ export default {
if (upperValue !== value) {
this.$set(this.formData.carBaseReqDTO, 'vin', upperValue)
}
// VIN车架号动态校验:车架号字段,动态转换为大写
validateVin(upperValue).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
}
if (field.key === 'mileage') {
let numValue = Number(value)
......@@ -1285,6 +1314,15 @@ export default {
if (res.data.code == 0) {
if (res.data.data.status == 1) {
this.formData.carBaseReqDTO.vin = res.data.data.vin
validateVin(this.formData.carBaseReqDTO.vin).then(result => {
console.log("validateVin",result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr",result);
})
uni.showToast({ title: '车架号识别完成并已自动填写到表单中', icon: 'none' })
uni.hideLoading()
} else {
......
import api from '@/api/index.js'
// 有效字符:大写 A-H/J-N/P-Z、0-9(排除 I、O、Q)
const VALID_VIN_REG = /^[A-HJ-NPR-Z0-9]{17}$/
const ERROR_MSG = '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)'
// 防抖相关变量
let debounceTimer = null
let pendingResolve = null
let pendingReject = null
let pendingVin = null
const DEBOUNCE_DELAY = 500 // 防抖延迟时间(毫秒)
/**
* 车架号校验(统一处理版本)
* @param {string} vin - 车架号
* @returns {Promise<Object>} 返回校验结果 { success: boolean, message: string, data?: any, vin?: string }
*/
export function validateVin(vin) {
console.log("工具调用",vin);
return new Promise((resolve, reject) => {
const upperVin = vin ? vin.toUpperCase() : ''
// 格式校验失败
if (!upperVin || upperVin.length !== 17 || !VALID_VIN_REG.test(upperVin)) {
uni.showToast({
title: ERROR_MSG,
icon: 'none'
})
reject({
success: false,
message: ERROR_MSG
})
return
}
// 保存当前调用的 resolve 和 reject
pendingResolve = resolve
pendingReject = reject
pendingVin = upperVin
// 清除之前的定时器
if (debounceTimer) {
clearTimeout(debounceTimer)
}
// 设置防抖定时器
debounceTimer = setTimeout(() => {
// 执行接口调用
const currentVin = pendingVin
const currentResolve = pendingResolve
const currentReject = pendingReject
// 清空待处理变量
pendingVin = null
pendingResolve = null
pendingReject = null
debounceTimer = null
// 调用后端接口校验
api.commonApi.checkVinValidate({ vin: currentVin })
.then(res => {
console.log("checkVinValidate接口校验",res);
let { valid,message } = res
if (valid) {
// 校验成功但有提示信息
if (message) {
uni.showToast({
title: message,
icon: 'none'
})
}
currentResolve({
success: true,
message: message || '校验成功',
data: res,
vin: currentVin
})
} else {
// 接口返回失败
const errorMsg = message || '车架号校验失败'
uni.showToast({
title: errorMsg,
icon: 'none'
})
currentResolve({
success: false,
message: errorMsg,
data: res
})
}
})
.catch(err => {
const errorMsg = err.message || '车架号校验异常'
uni.showToast({
title: errorMsg,
icon: 'none'
})
currentReject({
success: false,
message: errorMsg
})
})
}, DEBOUNCE_DELAY)
})
}
/**
* 实时输入处理:自动转大写
*/
export function formatVinInput(value) {
return value ? value.toUpperCase() : ''
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!