Commit bbc10509 by 张立顺

Merge branch 'SAAS+V5.5.0' into SAAS+V5.5.1

2 parents bd1da4e1 9b792156
Showing 186 changed files with 4218 additions and 140 deletions
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# 账号登录可以使用以下(验证码 开发和测试环境任意输入即可): # 账号登录可以使用以下(验证码 开发和测试环境任意输入即可):
超级管理员:13022223223(测试环境) 13476670746(开发环境) 超级管理员:13022223223(测试环境) 13476670746(开发环境)
供应商账号:13978573226 (选testfws1) 15023656699 13978573226 供应商账号:13978573226 (选testfws1) 15023656699 13978573226
园区店管理员: 15589265685(测试环境) 15626599736(开发环境) 园区店管理员: 15589265685 13600160561(测试环境) 15626599736(开发环境)
员工账号 :15626599735 (选明明塘朗园区店) 15626599738(开发环境) 员工账号 :15626599735 (选明明塘朗园区店) 15626599738(开发环境)
员工账号 :18775035205 (选测试园店) 18775035205(选最下面的) 15814019200 15626599737(预发布) 员工账号 :18775035205 (选测试园店) 18775035205(选最下面的) 15814019200 15626599737(预发布)
员工账号 :13632791593 (选fennun03能下单 园区测试门店有多条数据) 13132112126(导师) 13132112120(学员) 员工账号 :13632791593 (选fennun03能下单 园区测试门店有多条数据) 13132112126(导师) 13132112120(学员)
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
商户管理员:15814019200 商户管理员:15814019200
区域督导:187750352053 区域督导:187750352053
销售: 15626599743(开发) 销售: 15626599743(开发)
技师: 18925261040(开发) 技师: 18925261040 19982726211(开发)
# 生产环境跟手机号和验证码绑定 需要自己到账号中心绑定手机号成为员工或超管 # 生产环境跟手机号和验证码绑定 需要自己到账号中心绑定手机号成为员工或超管
......
...@@ -158,7 +158,9 @@ module.exports = { ...@@ -158,7 +158,9 @@ module.exports = {
/** 获取商户订单设置 */ /** 获取商户订单设置 */
getMerchantRecordingSettings(data) { getMerchantRecordingSettings(data) {
return api.post( return api.post(
'dj.api.smartcarlife.recordingSettings.getMerchantRecordingSettings', // 'dj.api.smartcarlife.recordingSettings.getMerchantRecordingSettings',
'dj.api.smartcarlife.order.field.lightChange.setting.list',
// 查询门店轻改录单设置
data data
) )
}, },
...@@ -166,7 +168,8 @@ module.exports = { ...@@ -166,7 +168,8 @@ module.exports = {
/** 设置商户订单设置 */ /** 设置商户订单设置 */
setMerchantRecordingSettings(data) { setMerchantRecordingSettings(data) {
return api.post( return api.post(
'dj.api.smartcarlife.recordingSettings.insertOrUpdateSettings', // 'dj.api.smartcarlife.recordingSettings.insertOrUpdateSettings',
'dj.api.smartcarlife.order.field.setting.update',
data data
) )
}, },
...@@ -399,15 +402,15 @@ module.exports = { ...@@ -399,15 +402,15 @@ module.exports = {
data data
) )
}, },
/** 待处理招聘统计 */ /** 待处理招聘统计 */
waitstaffstateAPI(data) { waitstaffstateAPI(data) {
return api.post( return api.post(
'dj.api.staff.miniprogram.recruitment.demand.stat', 'dj.api.staff.miniprogram.recruitment.demand.stat',
data, data,
[], [],
'/rop-dj-staff-miniprogram/router' '/rop-dj-staff-miniprogram/router'
) )
}, },
/** 获取园区店配置技师数据 */ /** 获取园区店配置技师数据 */
getQYTechnicianList(data) { getQYTechnicianList(data) {
return api.post('dj.api.smartcarlife.roleTechnician.list', data) return api.post('dj.api.smartcarlife.roleTechnician.list', data)
...@@ -419,5 +422,37 @@ module.exports = { ...@@ -419,5 +422,37 @@ module.exports = {
// 查询订单是否支持状态变更 // 查询订单是否支持状态变更
getOrderRefundStep(data) { getOrderRefundStep(data) {
return api.post('dj.api.smartcarlife.refundApplyRecord.isExist', data) return api.post('dj.api.smartcarlife.refundApplyRecord.isExist', data)
},
// 车架号校验
checkVinValidate(data) {
return api.post('dj.pad.api.vin.validate', data, [], '/rop-dj-pad/router')
},
// 获取门店品牌标识
getMerchantBrand(data = {}) {
return api.post('dj.api.smartcarlife.recepiton.findMerchantBrand', data)
},
// 获取北森token
findBeiSenSSOToken(data) {
return api.post('dj.pad.api.beisen.findBeiSenSSOToken', data, [], '/rop-dj-pad/router')
},
// 获取学习中心权限
getStudyCenterPermission(data) {
return api.post('dj.pad.api.staff.study.center.access.auth.verify', data, [], '/rop-dj-pad/router')
},
// 学习中心开单限制
checkStudyTaskAPI(data) {
return api.post('dj.api.pad.learning.center.study.permission', data, [], '/rop-dj-pad/router')
},
// 学习中心开始测评弹窗
learninglevelExam(data) {
return api.post('dj.api.pad.learning.center.level.exam', data, [], '/rop-dj-pad/router')
},
// 查询北森考试结果
getBeisenExamResult(data) {
return api.post('dj.api.pad.learning.center.beisen.exam.result', data, [], '/rop-dj-pad/router')
},
// 学习中心-短课程详情
getShortCourseDetail(data) {
return api.post('dj.pad.api.staff.study.short.course.detail', data, [], '/rop-dj-pad/router')
} }
} }
...@@ -249,6 +249,19 @@ ...@@ -249,6 +249,19 @@
"pages/indexPage/dailyReport/dailyReport", "pages/indexPage/dailyReport/dailyReport",
"pages/deliveryNote/deliveryDetail/deliveryDetail" "pages/deliveryNote/deliveryDetail/deliveryDetail"
] ]
},
{
"root": "packageStudyCenter",
"name": "packageStudyCenter",
"pages": [
"pages/studyCenter/studyCenter",
"pages/myTask/myTask",
"pages/taskDetail/longCourse/longCourse",
"pages/taskDetail/shortCourse/shortCourse",
"pages/myCourse/myCourse",
"pages/myExam/myExam",
"pages/staffRank/staffRank"
]
} }
], ],
"usingComponents": { "usingComponents": {
...@@ -281,15 +294,11 @@ ...@@ -281,15 +294,11 @@
"preloadRule": { "preloadRule": {
"pages/tabWorkOrder/pages/index/index": { "pages/tabWorkOrder/pages/index/index": {
"network": "all", "network": "all",
"packages": [ "packages": ["tabWorkOrder"]
"tabWorkOrder"
]
}, },
"tabIndex/pages/index/index": { "tabIndex/pages/index/index": {
"network": "all", "network": "all",
"packages": [ "packages": ["tabWorkOrder"]
"tabWorkOrder"
]
} }
}, },
"resolveAlias": { "resolveAlias": {
...@@ -303,4 +312,4 @@ ...@@ -303,4 +312,4 @@
}, },
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"resizable": true "resizable": true
}
\ No newline at end of file \ No newline at end of file
}
...@@ -10,23 +10,33 @@ Component({ ...@@ -10,23 +10,33 @@ Component({
type: Boolean, type: Boolean,
observer: function (n) { observer: function (n) {
if (n) { if (n) {
let { copyArtificerList, artificerSelectObj, disabledSelectObj, deputyFlag } = let {
this.data copyArtificerList,
artificerSelectObj,
disabledSelectObj,
deputyFlag
} = this.data
const selectArr = Array.isArray(artificerSelectObj) const selectArr = Array.isArray(artificerSelectObj)
? artificerSelectObj?.map(val => { ? artificerSelectObj?.map(val => {
return val.technicianId || val.id return val.technicianId || val.id
}) })
: [artificerSelectObj?.technicianId] : [artificerSelectObj?.technicianId]
copyArtificerList.map(i => { const selectedList = Array.isArray(artificerSelectObj)
i.active = false ? artificerSelectObj
if (selectArr?.includes(i.id)) { : artificerSelectObj
i.active = true ? [artificerSelectObj]
} : []
i.disabled = false const ratioMap = selectedList.reduce((m, v) => {
if (disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1) { const k = v.technicianId || v.id
i.disabled = true m[k] = v.shareRatio
} return m
return i }, {})
copyArtificerList = copyArtificerList.map(i => {
const active = selectArr?.includes(i.id)
const disabled =
disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1
const shareRatio = active ? ratioMap[i.id] ?? '' : ''
return { ...i, active, disabled, shareRatio }
}) })
// 是副手技师选中两个后其余置灰 // 是副手技师选中两个后其余置灰
if (selectArr.length == 2 && deputyFlag) { if (selectArr.length == 2 && deputyFlag) {
...@@ -34,10 +44,20 @@ Component({ ...@@ -34,10 +44,20 @@ Component({
if (!selectArr.includes(i.id)) i.disabled = true if (!selectArr.includes(i.id)) i.disabled = true
}) })
} }
const sum = (copyArtificerList || [])
.filter(i => i.active)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
console.log(copyArtificerList, 'copyArtificerList')
this.setData({ this.setData({
artificerList: wx.$util.deepClone(copyArtificerList), artificerList: wx.$util.deepClone(copyArtificerList),
copyArtificerList,
selectedTechnicianId: selectArr, selectedTechnicianId: selectArr,
searchValue: '' searchValue: '',
showMainShareRatio
}) })
} }
} }
...@@ -60,13 +80,44 @@ Component({ ...@@ -60,13 +80,44 @@ Component({
orderObj: {}, orderObj: {},
IMG_URL, IMG_URL,
artificerList: [], artificerList: [],
searchValue: '' searchValue: '',
showMainShareRatio: 100
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
noop() {},
changeShareRatio(e) {
let { value } = e.detail
let { index } = e.currentTarget.dataset
let { artificerList, copyArtificerList } = this.data
let v = parseInt(value, 10)
if (isNaN(v)) v = 0
if (v > 100) v = 100
const sumOthers = (artificerList || [])
.filter((i, idx) => i.active && idx !== index)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
const allowed = Math.max(0, 100 - sumOthers)
v = Math.min(v, allowed)
artificerList[index].shareRatio = v
const targetId = artificerList[index]?.id
if (Array.isArray(copyArtificerList)) {
const ci = copyArtificerList.findIndex(i => i.id === targetId)
if (ci >= 0) copyArtificerList[ci].shareRatio = v
}
const sum = sumOthers + v
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
this.setData({
artificerList,
copyArtificerList,
showMainShareRatio
})
},
search(e) { search(e) {
let { copyArtificerList } = wx.$util.deepClone(this.data) let { copyArtificerList } = wx.$util.deepClone(this.data)
let { selectedTechnicianId } = this.data let { selectedTechnicianId } = this.data
...@@ -99,44 +150,54 @@ Component({ ...@@ -99,44 +150,54 @@ Component({
let { target } = e.currentTarget.dataset let { target } = e.currentTarget.dataset
let { artificerList, multiple, deputyFlag, disabledSelectObj } = this.data let { artificerList, multiple, deputyFlag, disabledSelectObj } = this.data
let { copyArtificerList } = wx.$util.deepClone(this.data) let { copyArtificerList } = wx.$util.deepClone(this.data)
// 禁用项不允许点击切换
if (target.disabled) return if (target.disabled) return
artificerList.forEach(i => { const targetId = target?.id
if (i.id != target?.id && !multiple) i.active = false // 同步切换 active 状态;在单选模式下,其他项自动取消激活
if (i.id == target?.id) i.active = !i.active // 对未激活项清空 shareRatio,保持分成比例与选中状态一致
}) const updateList = list =>
copyArtificerList.forEach(i => { list.map(i => {
if (i.id != target?.id && !multiple) i.active = false const active =
if (i.id == target?.id) i.active = !i.active i.id === targetId ? !i.active : multiple ? i.active : false
}) return { ...i, active, shareRatio: active ? i.shareRatio : '' }
let arr = []
copyArtificerList?.map(val => {
if (val.active) arr.push(val.id)
})
if (arr.length == 2 && deputyFlag) {
artificerList.forEach(i => {
if (!arr.includes(i.id)) i.disabled = true
})
copyArtificerList.forEach(i => {
if (!arr.includes(i.id)) i.disabled = true
})
} else if (arr.length < 2 && deputyFlag) {
artificerList.forEach(i => {
i.disabled = false
if (disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1) {
i.disabled = true
}
})
copyArtificerList.forEach(i => {
i.disabled = false
if (disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1) {
i.disabled = true
}
}) })
artificerList = updateList(artificerList)
copyArtificerList = updateList(copyArtificerList)
// 当前选中的技师 id 集合
const arr = copyArtificerList.filter(v => v.active).map(v => v.id)
// 副手模式:选满两个后将其他置灰;未满两个时根据预设禁用恢复
if (deputyFlag) {
if (arr.length === 2) {
const disableIfNotSelected = i => ({
...i,
disabled: !arr.includes(i.id)
})
artificerList = artificerList.map(disableIfNotSelected)
copyArtificerList = copyArtificerList.map(disableIfNotSelected)
} else {
const isPresetDisabled = i =>
disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1
const enableWithPreset = i => ({
...i,
disabled: isPresetDisabled(i)
})
artificerList = artificerList.map(enableWithPreset)
copyArtificerList = copyArtificerList.map(enableWithPreset)
}
} }
// 更新视图与选中集合(单选返回当前 id,多选返回所有选中)
const sum = (artificerList || [])
.filter(i => i.active)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
this.setData({ this.setData({
artificerList, artificerList,
copyArtificerList, copyArtificerList,
selectedTechnicianId: multiple ? arr : [target.id] selectedTechnicianId: multiple ? arr : [targetId],
showMainShareRatio
}) })
}, },
cancel() { cancel() {
...@@ -157,15 +218,28 @@ Component({ ...@@ -157,15 +218,28 @@ Component({
copyArtificerList, copyArtificerList,
orderInfo, orderInfo,
artificerSelectObj, artificerSelectObj,
selectedTechnicianId selectedTechnicianId,
deputyFlag
} = this.data } = this.data
let arr = copyArtificerList?.filter(v => v.active) || [] let arr = copyArtificerList?.filter(v => v.active) || []
console.log(arr, 'arr')
if (!arr.length) { if (!arr.length) {
// return wx.$util.showToast('请选择技师')
// 未选技师 将selectedTechnicianId清除 // 未选技师 将selectedTechnicianId清除
this.setData({ this.setData({
selectedTechnicianId: [] selectedTechnicianId: []
}) })
return wx.$util.showToast('请选择技师')
}
if (deputyFlag) {
const invalid = arr.some(
v =>
v.shareRatio === '' ||
v.shareRatio === undefined ||
v.shareRatio === null
)
if (invalid) {
return wx.$util.showToast('请填写副手技师分成比例')
}
} }
let obj = { let obj = {
...artificerSelectObj, ...artificerSelectObj,
......
...@@ -44,12 +44,13 @@ ...@@ -44,12 +44,13 @@
line-height: var(--fontSize88); line-height: var(--fontSize88);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; /* justify-content: space-between; */
} }
.box-title .tips { .box-title .tips {
color: #333333; font-size: 24rpx;
font-size: var(--fontSize24); margin-left: 8rpx;
color: #888888;
} }
.box-title .tips text { .box-title .tips text {
...@@ -66,6 +67,25 @@ ...@@ -66,6 +67,25 @@
color: #292D33; color: #292D33;
padding: 0 var(--fontSize25); padding: 0 var(--fontSize25);
transition: all .5s; transition: all .5s;
.shareRatioBox {
display: flex;
font-size: 24rpx;
color: #5A5E66;
align-items: center;
font-weight: 400;
.shareRatioInput {
box-sizing: border-box;
width: 88rpx;
height: 68rpx;
margin: 0 8rpx;
background: #FFFFFF;
padding: 0 16rpx;
border: 2rpx solid #EFF0F2;
border-radius: 12rpx;
}
}
} }
.checked_img { .checked_img {
...@@ -90,4 +110,15 @@ ...@@ -90,4 +110,15 @@
color: #347BFF; color: #347BFF;
font-weight: 700; font-weight: 700;
position: relative; position: relative;
}
.bottomTips {
text-align: center;
color: #5a5e66;
font-size: 24rpx;
margin-top: 10rpx;
.text {
color: #347bff;
}
} }
\ No newline at end of file \ No newline at end of file
<popup show="{{show}}" bindconfirm="confirm" bindcancel="cancel" height="85%" slotStyle="height: calc(100% - var(--fontSize150));"> <popup
<view class="artificer-select-popup-box" > show="{{ show }}"
<view class="box"> bindconfirm="confirm"
<view class="sub-title text-center">{{title}}</view> bindcancel="cancel"
<view class="artificer-box"> height="85%"
<search-input bindsearch="search" value="{{searchValue}}" /> slotStyle="height: calc(100% - var(--fontSize150));"
<view class="box-title"> >
<view>技师</view> <view class="artificer-select-popup-box">
<!-- <view class="tips">使用<text bind:tap="goMiniprogram">生意助手小程序</text>登录创建技师</view> --> <view class="box">
</view> <view class="sub-title text-center">{{title}}</view>
<block wx:if="{{artificerList.length}}"> <view class="artificer-box">
<scroll-view scroll-y style="height: calc(100% - var(--fontSize194));" enhanced="{{true}}" show-scrollbar="{{false}}"> <search-input bindsearch="search" value="{{ searchValue }}" />
<block wx:for="{{artificerList}}" wx:key="index"> <view class="box-title">
<view class="artificerList {{item.active?'active':''}}" bindtap="changeItem" data-target="{{item}}" data-index="{{index}}"> <view>技师</view>
<view class="checked_img"> <!-- <view class="tips">使用<text bind:tap="goMiniprogram">生意助手小程序</text>登录创建技师</view> -->
<block wx:if="{{multiple}}"> <view class="tips" wx:if="{{ multiple && deputyFlag }}">产生副手技师,请主技师为副手技师分配整单提成比例</view>
<image src="{{item.active ? '../images/radio.png' : '../images/radio_icon.png'}}" /> </view>
</block> <block wx:if="{{ artificerList.length }}">
<block wx:else> <scroll-view
<image wx:if="{{item.active}}" src="{{IMG_URL}}checked.png"></image> scroll-y
</block> style="{{ multiple? 'height: calc(100% - var(--fontSize236))':'height: calc(100% - var(--fontSize194))' }}"
</view> enhanced="{{ true }}"
<view class="text_box"><view class="text-hide {{item.disabled ? 'disabled' : ''}}">{{item.staffName}}</view></view> show-scrollbar="{{ false }}"
</view> >
</block> <block wx:for="{{ artificerList }}" wx:key="index">
</scroll-view> <view
</block> class="artificerList {{ item.active?'active':'' }}"
<block wx:else> bindtap="changeItem"
<empty-data style="width: 100%;" /> data-target="{{ item }}"
</block> data-index="{{ index }}"
</view> >
</view> <view class="checked_img">
</view> <block wx:if="{{ multiple }}">
</popup> <image src="{{ item.active ? '../images/radio.png' : '../images/radio_icon.png' }}" />
</block>
<block wx:else>
<image wx:if="{{ item.active }}" src="{{ IMG_URL }}checked.png"></image>
</block>
</view>
<view class="text_box">
<view class="text-hide {{ item.disabled ? 'disabled' : '' }}">{{item.staffName}}</view>
</view>
<view class="shareRatioBox" wx:if="{{ multiple && item.active && deputyFlag }}">
整单分成比例
<input
placeholder="整数"
class="shareRatioInput"
type="number"
maxlength="3"
value="{{ item.shareRatio }}"
placeholder-style="color:#BEC1C7"
catchinput="changeShareRatio"
catchtap="noop"
data-index="{{ index }}"
/>
%
</view>
</view>
</block>
</scroll-view>
</block>
<block wx:else>
<empty-data style="width: 100%;" />
</block>
<view class="tips bottomTips" wx:if="{{ multiple && deputyFlag }}">
主技师整单分成比例
<text class="text">{{ showMainShareRatio }}%</text>
</view>
</view>
</view>
</view>
</popup>
\ No newline at end of file \ No newline at end of file
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
// components/subShopMerchant/subShopMerchant.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer: function (n) {
if (n) {
let {
copyArtificerList,
artificerSelectObj,
disabledSelectObj,
deputyFlag
} = this.data
const selectArr = Array.isArray(artificerSelectObj)
? artificerSelectObj?.map(val => {
return val.uuid
})
: [artificerSelectObj?.uuid]
const selectedList = Array.isArray(artificerSelectObj)
? artificerSelectObj
: artificerSelectObj
? [artificerSelectObj]
: []
const ratioMap = selectedList.reduce((m, v) => {
const k = v.uuid
m[k] = v.shareRatio
return m
}, {})
copyArtificerList = copyArtificerList.map(i => {
const id = artificerSelectObj.find(v => v.uuid == i.uuid)?.id || undefined // 技师列表id没实际用途,将id替换成已选技师的主键id
const active = selectArr?.includes(i.uuid)
const disabled =
disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1
const shareRatio = active ? ratioMap[i.uuid] ?? '' : ''
return { ...i, id, active, disabled, shareRatio }
})
// 是副手技师选中两个后其余置灰
if (selectArr.length == 2 && deputyFlag) {
copyArtificerList.forEach(i => {
if (!selectArr.includes(i.uuid)) i.disabled = true
})
}
const sum = (copyArtificerList || [])
.filter(i => i.active)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
console.log(copyArtificerList, 'copyArtificerList')
this.setData({
artificerList: wx.$util.deepClone(copyArtificerList),
copyArtificerList,
selectedTechnicianId: selectArr,
searchValue: '',
showMainShareRatio
})
}
}
},
title: String,
orderInfo: Object,
artificerSelectObj: Object,
copyArtificerList: Array,
multiple: Boolean,
disabledSelectObj: {
type: Array
},
deputyFlag: Boolean // 是否选择副手技师
},
/**
* 组件的初始数据
*/
data: {
orderObj: {},
IMG_URL,
artificerList: [],
searchValue: '',
showMainShareRatio: 100
},
/**
* 组件的方法列表
*/
methods: {
noop() {},
changeShareRatio(e) {
let { value } = e.detail
let { index } = e.currentTarget.dataset
let { artificerList, copyArtificerList } = this.data
let v = parseInt(value, 10)
if (isNaN(v)) v = 0
if (v > 100) v = 100
const sumOthers = (artificerList || [])
.filter((i, idx) => i.active && idx !== index)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
const allowed = Math.max(0, 100 - sumOthers)
v = Math.min(v, allowed)
artificerList[index].shareRatio = v
const targetId = artificerList[index]?.uuid
if (Array.isArray(copyArtificerList)) {
const ci = copyArtificerList.findIndex(i => i.uuid === targetId)
if (ci >= 0) copyArtificerList[ci].shareRatio = v
}
const sum = sumOthers + v
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
this.setData({
artificerList,
copyArtificerList,
showMainShareRatio
})
},
search(e) {
let { copyArtificerList } = wx.$util.deepClone(this.data)
let { selectedTechnicianId } = this.data
console.log(selectedTechnicianId)
let { value } = e.detail
if (!value) {
copyArtificerList.map(i => {
i.active = false
if (selectedTechnicianId.includes(i.uuid)) i.active = true
return i
})
this.setData({
artificerList: copyArtificerList
})
} else {
let arr = []
copyArtificerList.map(i => {
i.active = false
if (selectedTechnicianId.includes(i.uuid)) i.active = true
if (i.staffName.indexOf(value) != -1) {
arr.push(i)
}
})
this.setData({
artificerList: arr
})
}
},
changeItem(e) {
let { target } = e.currentTarget.dataset
let { artificerList, multiple, deputyFlag, disabledSelectObj } = this.data
let { copyArtificerList } = wx.$util.deepClone(this.data)
// 禁用项不允许点击切换
if (target.disabled) return
const targetId = target?.uuid
// 同步切换 active 状态;在单选模式下,其他项自动取消激活
// 对未激活项清空 shareRatio,保持分成比例与选中状态一致
const updateList = list =>
list.map(i => {
const active =
i.uuid === targetId ? !i.active : multiple ? i.active : false
return { ...i, active, shareRatio: active ? i.shareRatio : '' }
})
artificerList = updateList(artificerList)
copyArtificerList = updateList(copyArtificerList)
// 当前选中的技师 uuid 集合
const arr = copyArtificerList.filter(v => v.active).map(v => v.uuid)
// 副手模式:选满两个后将其他置灰;未满两个时根据预设禁用恢复
if (deputyFlag) {
if (arr.length === 2) {
const disableIfNotSelected = i => ({
...i,
disabled: !arr.includes(i.uuid)
})
artificerList = artificerList.map(disableIfNotSelected)
copyArtificerList = copyArtificerList.map(disableIfNotSelected)
} else {
const isPresetDisabled = i =>
disabledSelectObj?.findIndex(val => val.uuid == i.uuid) > -1
const enableWithPreset = i => ({
...i,
disabled: isPresetDisabled(i)
})
artificerList = artificerList.map(enableWithPreset)
copyArtificerList = copyArtificerList.map(enableWithPreset)
}
}
// 更新视图与选中集合(单选返回当前 uuid,多选返回所有选中)
const sum = (artificerList || [])
.filter(i => i.active)
.map(i => parseInt(i.shareRatio || 0))
.reduce((a, b) => a + (isNaN(b) ? 0 : b), 0)
let showMainShareRatio = 100 - sum
if (showMainShareRatio < 0) showMainShareRatio = 0
if (showMainShareRatio > 100) showMainShareRatio = 100
this.setData({
artificerList,
copyArtificerList,
selectedTechnicianId: multiple ? arr : [targetId],
showMainShareRatio
})
},
cancel() {
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
artificerSelectPopup: false
})
this.triggerEvent('cancel')
},
// 打开生意助手小程序
goMiniprogram() {
wx.navigateToMiniProgram({
appId: 'wx2c28337db96364d2'
})
},
async confirm() {
let {
copyArtificerList,
orderInfo,
artificerSelectObj,
selectedTechnicianId,
deputyFlag
} = this.data
let arr = copyArtificerList?.filter(v => v.active) || []
console.log(arr, 'arr')
if (!arr.length) {
// 未选技师 将selectedTechnicianId清除
this.setData({
selectedTechnicianId: []
})
return wx.$util.showToast('请选择技师')
}
if (deputyFlag) {
const invalid = arr.some(
v =>
v.shareRatio === '' ||
v.shareRatio === undefined ||
v.shareRatio === null
)
if (invalid) {
return wx.$util.showToast('请填写副手技师分成比例')
}
}
let obj = {
...artificerSelectObj,
technicianUuid: arr[0]?.uuid || '',
technicianName: arr[0]?.staffName || '',
selectedTechnicians: arr
}
// orderInfo.technicianUuid = arr[0]?.uuid || ''
// orderInfo.technicianId = arr[0]?.id || ''
// orderInfo.technicianName = arr[0]?.staffName || ''
this.triggerEvent('confirm', obj)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/subShopMerchant/subShopMerchant.wxss */
.artificer-select-popup-box {
height: 100%;
width: calc(100% + var(--fontSize64));
transform: translateX(calc(-1 * var(--fontSize32)));
}
.sub-title {
height: var(--fontSize100);
font-size: var(--fontSize32);
color: #333333;
background-color: #fff;
z-index: 2;
border-bottom: var(--fontSize2) solid #F9F9F9;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.box {
height: 100%;
padding: 0 var(--fontSize32);
}
.artificer-box {
height: calc(100% - var(--fontSize102));
overflow: hidden;
transition: all .25s;
}
.box-title {
color: #333333;
font-size: var(--fontSize32);
height: var(--fontSize88);
line-height: var(--fontSize88);
display: flex;
align-items: center;
/* justify-content: space-between; */
}
.box-title .tips {
font-size: 24rpx;
margin-left: 8rpx;
color: #888888;
}
.box-title .tips text {
color: #347BFF;
}
.artificerList {
width: calc(100% - var(--fontSize50));
height: var(--fontSize98);
display: flex;
align-items: center;
font-size: var(--fontSize28);
font-size: 28rpx;
color: #292D33;
padding: 0 var(--fontSize25);
transition: all .5s;
.shareRatioBox {
display: flex;
font-size: 24rpx;
color: #5A5E66;
align-items: center;
font-weight: 400;
.shareRatioInput {
box-sizing: border-box;
width: 88rpx;
height: 68rpx;
margin: 0 8rpx;
background: #FFFFFF;
padding: 0 16rpx;
border: 2rpx solid #EFF0F2;
border-radius: 12rpx;
}
}
}
.checked_img {
width: var(--fontSize32);
height: var(--fontSize32);
flex-shrink: 0;
margin-right: var(--fontSize20);
}
.artificerList .text_box {
flex: 1;
border-bottom: var(--fontSize2) solid #F9F9F9;
height: 100%;
line-height: var(--fontSize98);
}
.artificerList .text_box .disabled {
opacity: .5;
}
.artificerList.active {
color: #347BFF;
font-weight: 700;
position: relative;
}
.bottomTips {
text-align: center;
color: #5a5e66;
font-size: 24rpx;
margin-top: 10rpx;
.text {
color: #347bff;
}
}
\ No newline at end of file \ No newline at end of file
<popup
show="{{ show }}"
bindconfirm="confirm"
bindcancel="cancel"
height="85%"
slotStyle="height: calc(100% - var(--fontSize150));"
>
<view class="artificer-select-popup-box">
<view class="box">
<view class="sub-title text-center">{{title}}</view>
<view class="artificer-box">
<search-input bindsearch="search" value="{{ searchValue }}" />
<view class="box-title">
<view>技师</view>
<!-- <view class="tips">使用<text bind:tap="goMiniprogram">生意助手小程序</text>登录创建技师</view> -->
<view class="tips" wx:if="{{ multiple }}">产生副手技师,请主技师为副手技师分配整单提成比例</view>
</view>
<block wx:if="{{ artificerList.length }}">
<scroll-view
scroll-y
style="{{ multiple? 'height: calc(100% - var(--fontSize236))':'height: calc(100% - var(--fontSize194))' }}"
enhanced="{{ true }}"
show-scrollbar="{{ false }}"
>
<block wx:for="{{ artificerList }}" wx:key="index">
<view
class="artificerList {{ item.active?'active':'' }}"
bindtap="changeItem"
data-target="{{ item }}"
data-index="{{ index }}"
>
<view class="checked_img">
<block wx:if="{{ multiple }}">
<image src="{{ item.active ? '../images/radio.png' : '../images/radio_icon.png' }}" />
</block>
<block wx:else>
<image wx:if="{{ item.active }}" src="{{ IMG_URL }}checked.png"></image>
</block>
</view>
<view class="text_box">
<view class="text-hide {{ item.disabled ? 'disabled' : '' }}">{{item.staffName}}</view>
</view>
<view class="shareRatioBox" wx:if="{{ multiple && item.active }}">
整单分成比例
<input
placeholder="整数"
class="shareRatioInput"
type="number"
maxlength="3"
value="{{ item.shareRatio }}"
placeholder-style="color:#BEC1C7"
catchinput="changeShareRatio"
catchtap="noop"
data-index="{{ index }}"
/>
%
</view>
</view>
</block>
</scroll-view>
</block>
<block wx:else>
<empty-data style="width: 100%;" />
</block>
<view class="tips bottomTips" wx:if="{{ multiple }}">
主技师整单分成比例
<text class="text">{{ showMainShareRatio }}%</text>
</view>
</view>
</view>
</view>
</popup>
\ No newline at end of file \ No newline at end of file
...@@ -59,7 +59,7 @@ Component({ ...@@ -59,7 +59,7 @@ Component({
safeArea, safeArea,
platform platform
} = res } = res
console.log(safeArea, 'safeArea') // console.log(safeArea, 'safeArea')
const { height, right, width, top } = const { height, right, width, top } =
wx.getMenuButtonBoundingClientRect() wx.getMenuButtonBoundingClientRect()
// 判断是否是华为平板设备 // 判断是否是华为平板设备
...@@ -69,18 +69,16 @@ Component({ ...@@ -69,18 +69,16 @@ Component({
if (isLandscape) statusBarHeight = 0 if (isLandscape) statusBarHeight = 0
// console.log(isPad, screenWidth, 'screenWidth'); // console.log(isPad, screenWidth, 'screenWidth');
// let navigationBarHeight = height + (top - statusBarHeight) * 2 + 5 // let navigationBarHeight = height + (top - statusBarHeight) * 2 + 5
let navigationBarHeight = `var(--fontSize${ let navigationBarHeight = `var(--fontSize${(height + (top - statusBarHeight) * 2) * (isPad ? 1 : 2)
(height + (top - statusBarHeight) * 2) * (isPad ? 1 : 2) })`
})`
let navigationBarPadding = screenWidth - right let navigationBarPadding = screenWidth - right
let navigationBarWidth = let navigationBarWidth =
screenWidth - (navigationBarPadding * 2 + width) - width screenWidth - (navigationBarPadding * 2 + width) - width
// if(deviceOrientation == 'landscape') statusBarHeight = 0 // if(deviceOrientation == 'landscape') statusBarHeight = 0
_this.setData({ _this.setData({
statusBarHeight: `var(--fontSize${ statusBarHeight: `var(--fontSize${statusBarHeight * (isPad ? 1 : 2)
statusBarHeight * (isPad ? 1 : 2) })`,
})`,
navigationBarHeight, navigationBarHeight,
// navigationBarStyle: `font-size:${fontSizeSetting}px;`, // navigationBarStyle: `font-size:${fontSizeSetting}px;`,
navigationBarStyle: 'font-size: var(--fontSize34)', navigationBarStyle: 'font-size: var(--fontSize34)',
......
// components/studyPermissionModal/studyPermissionModal.js
import api from '~/api/api'
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
title: '',
type: '',
btnText: '',
customContent: ''
},
/**
* 组件的方法列表
*/
methods: {
open(options = {}) {
return new Promise((resolve, reject) => {
this.setData({
show: true,
...options
})
})
},
goPage(e) {
let { cancel } = e.currentTarget.dataset
let userInfo = wx.$util.getUserInfo()
// 暂不测评 返回首页
if (cancel) {
let url = userInfo?.sceneType == 1 ? '/tabIndex/pages/index/index' : '/packageEquity/pages/TabBar/equityPage'
return wx.reLaunch({
url: url
})
}
let { type, examId } = this.data
this.setData({
show: false
})
if (type == 'permission') {
wx.navigateTo({
url: '/packageStudyCenter/pages/studyCenter/studyCenter',
})
} else { // 北森考试
api.findBeiSenSSOToken({}).then(res => {
const beisenToken = res.data;
const COURSE_ID = examId;
if (beisenToken) {
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: COURSE_ID
};
this.jumpUrl = ''
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
const tokenUrl = beisenToken
wx.$router.jumpH5(`${tokenUrl}&return_url=${url}`)
} else {
wx.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
})
}
},
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/studyPermissionModal/studyPermissionModal.wxss */
/* 蒙层 */
.modal-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
padding: 40rpx;
}
/* 弹窗容器 */
.modal-container {
width: 100%;
max-width: 640rpx;
background: #fff;
border-radius: 32rpx;
overflow: hidden;
position: relative;
animation: modalShow 0.3s ease;
}
@keyframes modalShow {
from {
opacity: 0;
transform: translateY(100rpx) scale(0.9);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
/* 头部 */
.modal-header {
display: flex;
justify-content: center;
margin: var(--fontSize48) 0 var(--fontSize32);
.modal-main-title {
color: #292D33;
font-size: var(--fontSize34);
font-weight: 500;
}
}
.modal-content {
margin: 0 var(--fontSize48) var(--fontSize48) var(--fontSize48);
text-align: center;
font-size: var(--fontSize28);
.content-title {
color: #5A5E66;
}
.content-text {
background: #FEF5EA;
border-radius: var(--fontSize8);
padding: var(--fontSize8) var(--fontSize32);
color: #FF9D0A;
margin-top: var(--fontSize32);
}
.content-footer {
color: #6C6F75;
margin-top: var(--fontSize32);
}
}
.custom-content {
text-align: left;
background: #F7F8FA;
border-radius: var(--fontSize20);
font-size: var(--fontSize28);
color: #6C6F75;
padding: var(--fontSize24);
.content-title {
color: #292D33;
font-weight: 500;
margin-bottom: var(--fontSize8);
}
.features {
margin-top: var(--fontSize8);
.feature-item {
display: flex;
align-items: center;
.dot {
width: var(--fontSize12);
height: var(--fontSize12);
border-radius: 50%;
background: #6C6F75;
margin: 0 var(--fontSize16);
flex-shrink: 0;
}
}
}
}
.custom-content-footer {
color: #6C6F75;
font-size: var(--fontSize28);
margin: var(--fontSize32) calc(-1 * var(--fontSize19)) 0 calc(-1 * var(--fontSize19));
text{
color: #347BFF;
}
}
.modal-footer {
border-top: var(--fontSize1) solid #EBEDF0;
height: var(--fontSize96);
display: flex;
align-items: center;
justify-content: center;
color: #347BFF;
font-size: var(--fontSize32);
font-weight: 600;
.buttons {
width: 100%;
height: 100%;
display: flex;
align-items: center;
.btn {
flex: 1;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.cancel {
color: #292D33;
border-right: var(--fontSize1) solid #EBEDF0;
}
}
}
<!--components/studyPermissionModal/studyPermissionModal.wxml-->
<view class="modal-mask" wx:if="{{show}}" bindtap="onMaskTap" catchtouchmove="preventTouchMove">
<view class="modal-container" catchtap="stopPropagation">
<view class="modal-header">
<view class="modal-title-wrapper">
<view class="modal-main-title">{{title}}</view>
</view>
</view>
<!-- 内容区域 -->
<view class="modal-content">
<block wx:if="{{type == 'permission'}}">
<view class="content-title">优秀的技能是您接单的通行证,磨刀不误砍柴工,您的专业能力是赢得客户信任的关键。</view>
<view class="content-text">到学习中心-{{customContent}},完成课程学习后,即可解锁开单权限。</view>
<view class="content-footer">只差一步即可开启您的接单之旅!</view>
</block>
<block wx:else>
<view class="custom-content">
<view class="content-title">个性化学习路径</view>
<view class="contetn-text">根据您当前的学习情况,我们将为您定制专属的学习计划,帮助您高效提升技能,实现职业突破。</view>
<view class="features">
<view class="feature-item">
<view class="dot"></view>
<text class="feature-text">基于当前能力水平评估</text>
</view>
<view class="feature-item">
<view class="dot"></view>
<text class="feature-text">结合岗位发展目标制定</text>
</view>
<view class="feature-item">
<view class="dot"></view>
<text class="feature-text">定期跟踪学习进度和效果</text>
</view>
</view>
</view>
<view class="custom-content-footer">
请先完成<text>【{{customObj.title}}】</text>考试测评后会推荐适合您的课程
</view>
</block>
</view>
<!-- 底部按钮 -->
<view class="modal-footer">
<block wx:if="{{cancelBtnText}}">
<view class="buttons">
<view class="btn cancel" bindtap="goPage" data-cancel="{{true}}">{{cancelBtnText}}</view>
<view class="btn confirm" bindtap="goPage">{{btnText}}</view>
</view>
</block>
<block wx:else>
<view class="footer-buttons" bindtap="goPage">{{btnText}}</view>
</block>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
"@vant/weapp": "^1.10.24", "@vant/weapp": "^1.10.24",
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"glsk-applet-component": "^1.0.0", "glsk-applet-component": "^1.0.0",
"glsk-toolkit": "^1.0.5",
"glsx-applet-component": "^1.1.29", "glsx-applet-component": "^1.1.29",
"glsx-common-sdk": "^0.2.8", "glsx-common-sdk": "^0.2.8",
"number-precision": "^1.6.0", "number-precision": "^1.6.0",
"rfdc": "^1.3.0", "rfdc": "^1.3.0"
"glsk-toolkit": "^1.0.5"
} }
} }
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
"makert-material":"../trainingMaterials/components/Materials/materials", "makert-material":"../trainingMaterials/components/Materials/materials",
"reception-screen": "../index/components/receptionScreen/receptionScreen", "reception-screen": "../index/components/receptionScreen/receptionScreen",
"order-screen": "../carQuotation/components/OrderScreen/OrderScreen", "order-screen": "../carQuotation/components/OrderScreen/OrderScreen",
"side-select-by-page-popup": "/components/SideSelectByPagePopup/SideSelectByPagePopup" "side-select-by-page-popup": "/components/SideSelectByPagePopup/SideSelectByPagePopup",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
} }
...@@ -63,4 +63,5 @@ ...@@ -63,4 +63,5 @@
<view wx:if="{{ showOrderRendering }}"> <view wx:if="{{ showOrderRendering }}">
<order-screen show="{{ show_order_confirm }}" userInfo="{{ userInfo }}" navBarHeight="{{ navBarHeight }}" status="{{ orderStatus }}" zyStatus="{{ zyPayStatus }}" bindconfirm="searchScreen" /> <order-screen show="{{ show_order_confirm }}" userInfo="{{ userInfo }}" navBarHeight="{{ navBarHeight }}" status="{{ orderStatus }}" zyStatus="{{ zyPayStatus }}" bindconfirm="searchScreen" />
</view> </view>
</page-container>
\ No newline at end of file \ No newline at end of file
</page-container>
<study-permission-modal id="customModal" />
\ No newline at end of file \ No newline at end of file
// packageEquity/pages/carEquity/components/EquityList/EquityList.js // packageEquity/pages/carEquity/components/EquityList/EquityList.js
import { checkDailyReport } from "~/store/ModalToQueueControl"; import { checkDailyReport, checkStudyTask } from "~/store/ModalToQueueControl";
import carLifeApi from '../../../../carEquityApi' import carLifeApi from '../../../../carEquityApi'
import constantData from '../constant/data' import constantData from '../constant/data'
const TABLIST = ['全部', '待补单', '提单失败', '已完成'] const TABLIST = ['全部', '待补单', '提单失败', '已完成']
...@@ -239,7 +239,10 @@ Component({ ...@@ -239,7 +239,10 @@ Component({
async handleRecordOrder(e) { async handleRecordOrder(e) {
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
let { let {
target target
} = e.currentTarget.dataset } = e.currentTarget.dataset
...@@ -300,6 +303,9 @@ Component({ ...@@ -300,6 +303,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false; if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
let { target } = e.currentTarget.dataset let { target } = e.currentTarget.dataset
wx.$router.go("signature", { wx.$router.go("signature", {
orderId: target.orderId, orderId: target.orderId,
......
...@@ -4,6 +4,7 @@ const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-w ...@@ -4,6 +4,7 @@ const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-w
import fn from '../constant/ruleFn' import fn from '../constant/ruleFn'
const defaultLabelWidth = 'var(--fontSize140)' const defaultLabelWidth = 'var(--fontSize140)'
import api from '~/api/api' import api from '~/api/api'
import { validateVin, formatVinInput } from '~/utils/vinVaildate'
Component({ Component({
options: { options: {
styleIsolation: 'shared', // 自定义覆盖vant样式 styleIsolation: 'shared', // 自定义覆盖vant样式
...@@ -56,6 +57,7 @@ Component({ ...@@ -56,6 +57,7 @@ Component({
energyFormRule: constantData.energyFormRule, energyFormRule: constantData.energyFormRule,
oilFormRule: constantData.oilFormRule, oilFormRule: constantData.oilFormRule,
extendServiceFormRule: constantData.extendServiceFormRule, extendServiceFormRule: constantData.extendServiceFormRule,
vinValid: null, // VIN 车架号校验结果
isShowObj: { isShowObj: {
car: true, car: true,
customer: true, customer: true,
...@@ -130,6 +132,46 @@ Component({ ...@@ -130,6 +132,46 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
// 表单输入事件处理
inputEvent(e) {
console.log(e, 'inputEvent')
let { attr } = e.detail
// 车架号输入处理:实时转大写 + 实时校验
if (attr == 'vin') {
const thisPage = wx.$router.getPageInstance()
const { dataAttrName } = this.data
// 从页面数据中获取刚刚更新的车架号值
const value = thisPage.data[dataAttrName]?.vin || ''
const upperVin = formatVinInput(value)
// 更新为大写
thisPage.setData({
[dataAttrName + '.vin']: upperVin
})
// 当输入满17位时,进行实时校验(防抖500ms)
if (upperVin.length === 17) {
validateVin(upperVin).then(res => {
let { valid } = res.data.data
console.log("upperVinRes", valid)
// 保存 valid 值到组件 data 中
this.setData({
vinValid: valid
})
}).catch(() => {
console.log("upperVinErr", upperVin)
// 校验失败时,设置为 false
this.setData({
vinValid: false
})
})
} else {
// 长度不足17位时,重置校验状态
this.setData({
vinValid: null
})
}
}
},
changeInclueType(e){ changeInclueType(e){
const {types} = e.target.dataset const {types} = e.target.dataset
let formData = this.getPageData() let formData = this.getPageData()
...@@ -260,8 +302,13 @@ Component({ ...@@ -260,8 +302,13 @@ Component({
}) })
}, },
handleConfirm(e) { handleConfirm(e) {
var { formRule, serviceInfo, imgObj, imgToInfo, energyFormRule, oilFormRule,retrofitInfo, extendServiceFormRule } = this.data var { formRule, serviceInfo, imgObj, imgToInfo, energyFormRule, oilFormRule, retrofitInfo, extendServiceFormRule, vinValid } = this.data
let formData = this.getPageData() let formData = this.getPageData()
// VIN 车架号校验检查
if (formData.vin && vinValid === false) {
wx.$util.showToast('车架号校验未通过,请重新输入')
return
}
let validObj = fn.checkRequired(formData, formRule) let validObj = fn.checkRequired(formData, formRule)
if (validObj) { if (validObj) {
wx.$util.showToast(validObj.message) wx.$util.showToast(validObj.message)
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
formData="{{ serviceInfo }}" formData="{{ serviceInfo }}"
dataAttrName="{{ dataAttrName }}" dataAttrName="{{ dataAttrName }}"
formDataList="{{ secondObj.carFormList }}" formDataList="{{ secondObj.carFormList }}"
bind:inputEvent="inputEvent"
></gl-form> ></gl-form>
</view> </view>
<view class="box"> <view class="box">
......
...@@ -57,7 +57,10 @@ const formRule = { ...@@ -57,7 +57,10 @@ const formRule = {
{ required: true, message: '车架号不能为空' }, { required: true, message: '车架号不能为空' },
{ {
validator: (rule, value) => { validator: (rule, value) => {
return /^[a-zA-Z0-9]{17}$/.test(value) ? null : { message: '车架号请输入17位数字和字母' } console.log("validatorVlue", value)
// VIN 车架号格式校验:17位字符,支持大写 A-H/J-N/P-Z、0-9(排除 I、O、Q)
const VALID_VIN_REG = /^[A-HJ-NPR-Z0-9]{17}$/i
return VALID_VIN_REG.test(value) ? null : { message: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)' }
} }
} }
], ],
......
...@@ -5,6 +5,7 @@ import carLifeApi from '~/packageEquity/carEquityApi' ...@@ -5,6 +5,7 @@ import carLifeApi from '~/packageEquity/carEquityApi'
import commonApi from '~/api/api' import commonApi from '~/api/api'
const defaultLabelWidth = 'var(--fontSize140)' const defaultLabelWidth = 'var(--fontSize140)'
import Util from '~/utils/util' import Util from '~/utils/util'
import { validateVin, formatVinInput } from '~/utils/vinVaildate'
// import api from '~/api/api' // import api from '~/api/api'
Component({ Component({
options: { options: {
...@@ -134,6 +135,33 @@ Component({ ...@@ -134,6 +135,33 @@ Component({
let { let {
attr attr
} = e.detail } = e.detail
// 车架号输入处理:实时转大写 + 实时校验
if (attr == 'carVin') {
const thisPage = wx.$router.getPageInstance()
const { dataAttrName } = this.data
// 从页面数据中获取刚刚更新的车架号值
const value = thisPage.data[dataAttrName]?.carVin || ''
const upperVin = formatVinInput(value)
// 更新为大写
thisPage.setData({
[dataAttrName + '.carVin']: upperVin
})
// 当输入满17位时,进行实时校验(防抖500ms)
if (upperVin.length === 17) {
validateVin(upperVin).then(res => {
let { valid } = res.data.data;
console.log("upperVinRes",valid);
// 保存 valid 值到组件 data 中
this.setData({
vinValid: valid
});
}).catch(() => {
console.log("upperVinErr",upperVin);
})
}
}
// 是车价就重新筛选商品列表 // 是车价就重新筛选商品列表
if (attr == 'price') { if (attr == 'price') {
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
...@@ -229,8 +257,10 @@ Component({ ...@@ -229,8 +257,10 @@ Component({
var { var {
dataAttrName, dataAttrName,
formRule, formRule,
pointsMultiRole pointsMultiRole,
vinValid
} = this.data } = this.data
// let thisPage = this.$router.getCurrentPage() // let thisPage = this.$router.getCurrentPage()
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
// console.log(thisPage.data['orderInfo']['actualSalesPersonId']) // console.log(thisPage.data['orderInfo']['actualSalesPersonId'])
...@@ -248,12 +278,27 @@ Component({ ...@@ -248,12 +278,27 @@ Component({
return false return false
} }
} }
// 车架号校验
const carVin = thisPage.data[dataAttrName]?.carVin
if (carVin) {
const isCarVinRequired = formRule?.carVin?.some(rule => rule.required === true) // 再次判断一下车架号是否必填项
// 前置判断
if (carVin.length !== 17 && isCarVinRequired) {
wx.$util.showToast('请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)')
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !vinValid) {
wx.$util.showToast('车架号校验不匹配,请核对后重新输入')
return false
}
}
let validObj = fn.checkRequired(thisPage.data[dataAttrName], formRule) let validObj = fn.checkRequired(thisPage.data[dataAttrName], formRule)
if (validObj) { if (validObj) {
wx.$util.showToast(validObj.message) wx.$util.showToast(validObj.message)
return false return false
} }
// debugger // debugger
this.triggerEvent('confirm') this.triggerEvent('confirm')
return true return true
......
...@@ -45,7 +45,7 @@ const formRule = { ...@@ -45,7 +45,7 @@ const formRule = {
validator: (rule, value) => { validator: (rule, value) => {
return value.length != 17 return value.length != 17
? { ? {
message: "请输入正确的17位车架号", message: "请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)",
} }
: null; : null;
}, },
...@@ -115,7 +115,7 @@ const formRuleSimple = { ...@@ -115,7 +115,7 @@ const formRuleSimple = {
return value return value
? value.length != 17 ? value.length != 17
? { ? {
message: "请输入正确的17位车架号", message: "请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)",
} }
: null : null
: null; : null;
......
...@@ -21,6 +21,9 @@ let time = null; ...@@ -21,6 +21,9 @@ let time = null;
import { import {
quotedImgUrl quotedImgUrl
} from '~/config' } from '~/config'
import {
checkStudyTask
} from "~/store/ModalToQueueControl";
import dataForm from '../components/constant/stepData' import dataForm from '../components/constant/stepData'
import NP from 'number-precision' import NP from 'number-precision'
Page({ Page({
...@@ -510,6 +513,9 @@ Page({ ...@@ -510,6 +513,9 @@ Page({
} = this.data } = this.data
let staffCheck = await this.staffDailyReportMerchantValid(userInfo) let staffCheck = await this.staffDailyReportMerchantValid(userInfo)
if (staffCheck) return false if (staffCheck) return false
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
orderInfo.paymentDocList = orderInfo.paymentDocList || [] orderInfo.paymentDocList = orderInfo.paymentDocList || []
// 先校验 // 先校验
let status = this.selectComponent(`#FirstStep`).handleConfirm() let status = this.selectComponent(`#FirstStep`).handleConfirm()
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"order-popup": "../components/OrderPopup/OrderPopup", "order-popup": "../components/OrderPopup/OrderPopup",
"vin-sec-dialog": "../components/VinSecDialog/VinSecDialog", "vin-sec-dialog": "../components/VinSecDialog/VinSecDialog",
"zy-pay-popup": "../components/zyPayPopup/zyPayPopup", "zy-pay-popup": "../components/zyPayPopup/zyPayPopup",
"order-no-popup": "../../../components/OrderNoPopup/OrderNoPopup" "order-no-popup": "../../../components/OrderNoPopup/OrderNoPopup",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
...@@ -41,4 +41,5 @@ ...@@ -41,4 +41,5 @@
<!-- vin二次复核 --> <!-- vin二次复核 -->
<vin-sec-dialog wx:if="{{showVinDialog}}" showVinDialog="{{showVinDialog}}" secFormData="{{secFormData}}" bindonClose="handleSecClose" bindonConfirm="handleSecConfirm"></vin-sec-dialog> <vin-sec-dialog wx:if="{{showVinDialog}}" showVinDialog="{{showVinDialog}}" secFormData="{{secFormData}}" bindonClose="handleSecClose" bindonConfirm="handleSecConfirm"></vin-sec-dialog>
<!-- 上传合同协议 --> <!-- 上传合同协议 -->
<zy-pay-popup show="{{showZyPopup}}" wx:if="{{showZyPopup}}" supplementaryFlag="{{supplementaryFlag}}" bindconfirm="zyPayConfirm"></zy-pay-popup>
\ No newline at end of file \ No newline at end of file
<zy-pay-popup show="{{showZyPopup}}" wx:if="{{showZyPopup}}" supplementaryFlag="{{supplementaryFlag}}" bindconfirm="zyPayConfirm"></zy-pay-popup>
<study-permission-modal id="customModal" />
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,8 @@ import { ...@@ -13,7 +13,8 @@ import {
getMoreBtnAPI getMoreBtnAPI
} from "../../../api"; } from "../../../api";
import { import {
checkDailyReport checkDailyReport,
checkStudyTask
} from "~/store/ModalToQueueControl"; } from "~/store/ModalToQueueControl";
import data from "../constant/data"; import data from "../constant/data";
import constantData from "../constant/data"; import constantData from "../constant/data";
...@@ -315,6 +316,9 @@ Component({ ...@@ -315,6 +316,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
/**禁止提单 */ /**禁止提单 */
if (await wx.$globalDataFunction.inspectionOfProhibitionBill()) return if (await wx.$globalDataFunction.inspectionOfProhibitionBill()) return
// console.log(e) // console.log(e)
...@@ -611,6 +615,9 @@ Component({ ...@@ -611,6 +615,9 @@ Component({
if (target?.zyPayStatus == '1' && type == 'handle') { if (target?.zyPayStatus == '1' && type == 'handle') {
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false; if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
return wx.$router.go("serviceInfo", { return wx.$router.go("serviceInfo", {
orderId: target.orderId, orderId: target.orderId,
apiName: "handler", apiName: "handler",
...@@ -621,6 +628,9 @@ Component({ ...@@ -621,6 +628,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false; if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
return this.setData({ return this.setData({
showZyPayPopup: true, showZyPayPopup: true,
showZyTarget: target, showZyTarget: target,
...@@ -632,6 +642,9 @@ Component({ ...@@ -632,6 +642,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false; if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
return this.setData({ return this.setData({
showZyPayPopup: true, showZyPayPopup: true,
showZyTarget: target, showZyTarget: target,
...@@ -648,6 +661,9 @@ Component({ ...@@ -648,6 +661,9 @@ Component({
case "0": case "0":
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
if (await wx.$globalDataFunction.inspectionOfProhibitionBill()) return /**禁止提单 */ if (await wx.$globalDataFunction.inspectionOfProhibitionBill()) return /**禁止提单 */
wx.$router.go( wx.$router.go(
target.mode != 0 ? target.mode != 0 ?
...@@ -665,6 +681,9 @@ Component({ ...@@ -665,6 +681,9 @@ Component({
case "2": case "2":
staffCheck = await checkDailyReport(true); staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
if (type == "pay") { if (type == "pay") {
// 去支付 // 去支付
wx.$router.go("CarQuotationPay", { wx.$router.go("CarQuotationPay", {
...@@ -687,6 +706,9 @@ Component({ ...@@ -687,6 +706,9 @@ Component({
// }) // })
staffCheck = await checkDailyReport(true); staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
if (type == "handle") { if (type == "handle") {
// 去处理 // 去处理
wx.$router.go("serviceInfo", { wx.$router.go("serviceInfo", {
...@@ -707,6 +729,9 @@ Component({ ...@@ -707,6 +729,9 @@ Component({
// }) // })
staffCheck = await checkDailyReport(true); staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
if (await wx.$globalDataFunction.inspectionOfProhibitionBill()) return /**禁止提单 */ if (await wx.$globalDataFunction.inspectionOfProhibitionBill()) return /**禁止提单 */
wx.$router.go( wx.$router.go(
target.mode != 0 ? target.mode != 0 ?
...@@ -719,6 +744,9 @@ Component({ ...@@ -719,6 +744,9 @@ Component({
case "5": case "5":
staffCheck = await checkDailyReport(true); staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
wx.$router.go("serviceInfo", { wx.$router.go("serviceInfo", {
orderId: target.orderId, orderId: target.orderId,
apiName: "handler", apiName: "handler",
...@@ -1081,6 +1109,9 @@ Component({ ...@@ -1081,6 +1109,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
console.log(e.currentTarget.dataset, 'e.currentTarget.dataset') console.log(e.currentTarget.dataset, 'e.currentTarget.dataset')
const { const {
id, id,
...@@ -1096,8 +1127,10 @@ Component({ ...@@ -1096,8 +1127,10 @@ Component({
}) })
} else { } else {
// 校验订单是否可撤销(在退款流程中无法撤销) // 校验订单是否可撤销(在退款流程中无法撤销)
let refundStep = await commonApi.getOrderRefundStep({ orderCode: payid }) if (payid) { // 待报价支持撤销 没有orderCode 不做订单撤销校验
if (refundStep?.data == 'Y') return _this.showRefundAlert() let refundStep = await commonApi.getOrderRefundStep({ orderCode: payid })
if (refundStep?.data == 'Y') return _this.showRefundAlert()
}
wx.showModal({ wx.showModal({
title: "", title: "",
content: "是否取撤销该工单?", content: "是否取撤销该工单?",
...@@ -1108,8 +1141,10 @@ Component({ ...@@ -1108,8 +1141,10 @@ Component({
if (r.confirm) { if (r.confirm) {
// _this.showLoading('取消中...') // _this.showLoading('取消中...')
// 再次校验订单是否可撤销(退款流程中无法撤销)防止弹出二次确认时长时间未操作,未拦截导致订单状态变更了 // 再次校验订单是否可撤销(退款流程中无法撤销)防止弹出二次确认时长时间未操作,未拦截导致订单状态变更了
let canRefundStep = await commonApi.getOrderRefundStep({ orderCode: payid }) if (payid) { // 待报价支持撤销 没有orderCode 不做订单撤销校验
if (canRefundStep?.data == 'Y') return _this.showRefundAlert() let canRefundStep = await commonApi.getOrderRefundStep({ orderCode: payid })
if (canRefundStep?.data == 'Y') return _this.showRefundAlert()
}
_this.repeal(id); _this.repeal(id);
} }
}, },
...@@ -1180,6 +1215,9 @@ Component({ ...@@ -1180,6 +1215,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false; if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
let _this = this let _this = this
const { const {
item item
...@@ -1394,9 +1432,12 @@ Component({ ...@@ -1394,9 +1432,12 @@ Component({
} }
this.handleBtnCancel() this.handleBtnCancel()
}, },
toRefund(flag) { async toRefund(flag) {
let userInfo = wx.$util.getUserInfo() let userInfo = wx.$util.getUserInfo()
let { btnOrderInfo } = this.data let { btnOrderInfo } = this.data
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
// 退款申请时区域运营查询 // 退款申请时区域运营查询
api.areaSupervisionExistsAPI({ merchantId: userInfo.shopMerchantId, sceneType: userInfo.sceneType }).then(res => { api.areaSupervisionExistsAPI({ merchantId: userInfo.shopMerchantId, sceneType: userInfo.sceneType }).then(res => {
let { code, data } = res let { code, data } = res
......
{ {
"usingComponents": { "usingComponents": {
"equity-item":"./components/EquityItem/EquityItem", "equity-item":"./components/EquityItem/EquityItem",
"upgrade-item":"./components/UpgradeItem/UpgradeItem" "upgrade-item":"./components/UpgradeItem/UpgradeItem",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal"
}, },
"navigationBarTitleText": "线索管理" "navigationBarTitleText": "线索管理"
} }
\ No newline at end of file \ No newline at end of file
...@@ -36,4 +36,5 @@ ...@@ -36,4 +36,5 @@
</block> </block>
</block> </block>
</view> </view>
</view>
\ No newline at end of file \ No newline at end of file
</view>
<study-permission-modal id="customModal" />
\ No newline at end of file \ No newline at end of file
// packageEquity/pages/clueList/components/EquityItem/EquityItem.js // packageEquity/pages/clueList/components/EquityItem/EquityItem.js
import itemMixin from "../itemMixins"; import itemMixin from "../itemMixins";
import { checkDailyReport } from "~/store/ModalToQueueControl"; import { checkDailyReport, checkStudyTask } from "~/store/ModalToQueueControl";
Component({ Component({
behaviors: [itemMixin], behaviors: [itemMixin],
...@@ -97,6 +97,9 @@ Component({ ...@@ -97,6 +97,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(); let staffCheck = await checkDailyReport();
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
const { data } = this.data; const { data } = this.data;
let params = {}; let params = {};
if (data.boutiqueOrders && data.boutiqueOrders.length) if (data.boutiqueOrders && data.boutiqueOrders.length)
......
// packageEquity/pages/clueList/components/UpgradeItem/UpgradeItem.js // packageEquity/pages/clueList/components/UpgradeItem/UpgradeItem.js
import itemMixin from '../itemMixins' import itemMixin from '../itemMixins'
import { checkDailyReport } from "~/store/ModalToQueueControl"; import { checkDailyReport, checkStudyTask } from "~/store/ModalToQueueControl";
Component({ Component({
behaviors: [itemMixin], behaviors: [itemMixin],
/** /**
...@@ -54,6 +54,9 @@ Component({ ...@@ -54,6 +54,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false;; if (staffCheck) return false;;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
const { const {
data data
} = this.data } = this.data
......
...@@ -5,6 +5,9 @@ import { ...@@ -5,6 +5,9 @@ import {
} from '~/config'; } from '~/config';
import { quotationGoodsList, defeatOrderCreate } from '../../api' import { quotationGoodsList, defeatOrderCreate } from '../../api'
import NP from 'number-precision' import NP from 'number-precision'
import {
checkStudyTask
} from "~/store/ModalToQueueControl";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -400,8 +403,11 @@ Page({ ...@@ -400,8 +403,11 @@ Page({
}) })
}, },
// 接口请求 // 接口请求
toPostData(params, type) { async toPostData(params, type) {
console.log(params); console.log(params);
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
// 添加收款方 0:嘀加收款 // 添加收款方 0:嘀加收款
params.payee = 0 params.payee = 0
wx.showLoading({ title: "提交中..." }) wx.showLoading({ title: "提交中..." })
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"merchant-seles": "/components/Merchant-Seles/Merchant-Seles", "merchant-seles": "/components/Merchant-Seles/Merchant-Seles",
"customerInfo": "/components/CustomerInfo/CustomerInfo", "customerInfo": "/components/CustomerInfo/CustomerInfo",
"van-popup": "@vant/weapp/popup/index", "van-popup": "@vant/weapp/popup/index",
"van-picker": "@vant/weapp/picker/index" "van-picker": "@vant/weapp/picker/index",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal"
}, },
"navigationBarTitleText":"战败下单" "navigationBarTitleText":"战败下单"
} }
\ No newline at end of file \ No newline at end of file
...@@ -51,4 +51,5 @@ ...@@ -51,4 +51,5 @@
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" /> <customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
<van-popup show="{{ salesTypeShow }}" position="bottom" bind:close="onCloseSaleType"> <van-popup show="{{ salesTypeShow }}" position="bottom" bind:close="onCloseSaleType">
<van-picker show-toolbar columns="{{ saleTypesList }}" value-key="name" bind:cancel="onCloseSaleType" bind:confirm="onChangeSaleType" /> <van-picker show-toolbar columns="{{ saleTypesList }}" value-key="name" bind:cancel="onCloseSaleType" bind:confirm="onChangeSaleType" />
</van-popup>
\ No newline at end of file \ No newline at end of file
</van-popup>
<study-permission-modal id="customModal" />
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,8 @@ import { ...@@ -3,7 +3,8 @@ import {
setConfigInfo setConfigInfo
} from "~/store/index"; } from "~/store/index";
import { import {
checkDailyReport checkDailyReport,
checkStudyTask
} from "~/store/ModalToQueueControl"; } from "~/store/ModalToQueueControl";
import { import {
getReceptionRecordList, getReceptionRecordList,
...@@ -668,6 +669,14 @@ Component({ ...@@ -668,6 +669,14 @@ Component({
}) })
} }
} }
// 非冀联园区店的员工展示学习中心入口
if (userInfo?.subLoginUser?.channelType != 9 && isStaff && menuList.every((item) => item.menuText != "学习中心")) {
menuList.push({
menuText: '学习中心',
path: 'packageStudyCenter.studyCenter',
icon: 'study-center'
})
}
this.checkIsPadOrNot(); this.checkIsPadOrNot();
this.getData(); this.getData();
// 隐藏待办事项模块 // 隐藏待办事项模块
...@@ -1282,6 +1291,9 @@ Component({ ...@@ -1282,6 +1291,9 @@ Component({
// 校验是否填写昨日日报 // 校验是否填写昨日日报
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
if (staffCheck) return false; if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
} }
if (item.path == 'packageEquity.start') { if (item.path == 'packageEquity.start') {
wx.$track.setTrackData(0, 'aiCheck_page', {}, '', 0) wx.$track.setTrackData(0, 'aiCheck_page', {}, '', 0)
...@@ -1320,6 +1332,9 @@ Component({ ...@@ -1320,6 +1332,9 @@ Component({
let staffCheck = await checkDailyReport(true); let staffCheck = await checkDailyReport(true);
console.log(staffCheck, 'staffCheck'); console.log(staffCheck, 'staffCheck');
if (staffCheck) return false; if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
/**禁止提单 */ /**禁止提单 */
if (item.beforeClick && await wx.$globalDataFunction[item.beforeClick]()) return if (item.beforeClick && await wx.$globalDataFunction[item.beforeClick]()) return
if ( if (
......
import api from '~/utils/request/request.js'
module.exports = {
// 获取我的任务看板
getStudyBoard(data) {
return api.post('dj.pad.api.staff.study.bulletin.board', data, [], '/rop-dj-pad/router')
},
// 学习中心-课程任务分页
getCourseTaskPage(data) {
return api.post('dj.pad.api.staff.study.course.task.page', data, [], '/rop-dj-pad/router')
},
// 学习中心-长课程详情
getLongCourseDetail(data) {
return api.post('dj.pad.api.staff.study.long.course.detail', data, [], '/rop-dj-pad/router')
},
// 学习中心-短课程详情
getShortCourseDetail(data) {
return api.post('dj.pad.api.staff.study.short.course.detail', data, [], '/rop-dj-pad/router')
},
// 获取智能体
getAiAgentList(data) {
return api.post('dj.pad.api.aiagent.get.special.agent', data, [], '/rop-dj-pad/router')
},
// 获取门店品牌标识
getMerchantBrand(data = {}) {
return api.post('dj.api.smartcarlife.recepiton.findMerchantBrand', data)
},
// 获取我的课程列表数据
getMyCourseList(data) {
return api.post('dj.api.pad.learning.center.myself.course', data, [], '/rop-dj-pad/router')
},
// 获取我的课程tab状态数量
getMyCourseCount(data) {
return api.post('dj.api.pad.learning.center.myself.course.count', data, [], '/rop-dj-pad/router')
},
// 我的课程-剩余开单时间
getResidueTimeApi(data) {
return api.post('dj.api.pad.learning.center.residue.time', data, [], '/rop-dj-pad/router')
},
// 学习中心-获取学习统计数据
getStudyStatistics(data) {
return api.post('dj.pad.api.course.staff.statistics', data, [], '/rop-dj-pad/router')
},
// 获取全部课程列表数据
getRecommendedCourseList(data) {
return api.post('dj.pad.api.recommended.course.page', data, [], '/rop-dj-pad/router')
},
// 查询课程分类
getCourseCategoryData(data) {
return api.post('dj.pad.api.course.category.list.tree', data, [], '/rop-dj-pad/router')
},
// 获取我的考试列表数据
getStaffExaminationList(data) {
return api.post('dj.pad.api.recommended.staff.examination.page', data, [], '/rop-dj-pad/router')
},
// 获取我的考试统计数据
getStaffExaminationCount(data) {
return api.post('dj.pad.api.recommended.staff.examination.count', data, [], '/rop-dj-pad/router')
},
// 获取员工学习排行榜
getStaffStudyRank(data) {
return api.post('dj.pad.api.recommended.staff.study.duration.rank', data, [], '/rop-dj-pad/router')
},
}
// packageStudyCenter/pages/myTask/components/CardItem/CardItem.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
/**
* 组件的属性列表
*/
properties: {
infoData: {
type: Object
},
formItems: {
type: Array
},
customTop: {
type: Boolean,
value: false
},
completeKey: {
type: String
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL
},
/**
* 组件的方法列表
*/
methods: {
goPage(e) {
let { target } = e.currentTarget.dataset
if (!target?._showBtn) return
this.triggerEvent('goPage', target)
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"van-rate": "@vant/weapp/rate/index"
}
}
\ No newline at end of file \ No newline at end of file
/* packageStudyCenter/pages/myTask/components/CardItem/CardItem.wxss */
.item-container {
position: relative;
width: 100%;
background-color: #fff;
border-radius: var(--fontSize24);
overflow: hidden;
font-size: 0;
box-shadow: 0 var(--fontSize4) var(--fontSize16) 0 #2a61eb1a;
}
.image-box {
height: var(--fontSize180);
.item-img {
width: 100%;
height: 100%;
}
.image-tag {
position: absolute;
left: 0;
top: 0;
width: var(--fontSize94);
height: var(--fontSize48);
}
.tag {
position: absolute;
top: var(--fontSize16);
right: var(--fontSize24);
width: var(--fontSize72);
height: var(--fontSize40);
border-radius: var(--fontSize4);
color: #FFFFFF;
font-size: var(--fontSize24);
text-align: center;
line-height: var(--fontSize40);
background: #00000059;
}
}
.item-content {
padding: var(--fontSize14);
.item-title {
font-size: 30rpx;
color: #292D33;
font-weight: 500;
margin-bottom: var(--fontSize8);
width: var(--fontSize307);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item {
position: relative;
display: flex;
align-items: center;
font-size: var(--fontSize24);
margin-bottom: var(--fontSize4);
&.transparent {
opacity: 0;
}
.label {
flex-shrink: 0;
width: var(--fontSize96);
color: #999EA8;
margin-right: var(--fontSize20);
&.custom {
width: var(--fontSize144);
}
}
.value {
color: #666666;
display: inline-flex;
align-items: center;
justify-content: center;
.split {
margin: 0 var(--fontSize8);
}
.green {
color: #2CCA74;
}
.red {
color: #EB4E4E;
}
}
}
}
.dot-value {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background: #2CCA74;
margin-right: 8rpx;
}
.green {
color: #2CCA74;
}
.progress-box {
width: var(--fontSize129);
height: var(--fontSize12);
background: linear-gradient(128.8deg, rgba(117, 188, 255, .35) 0%, rgba(44, 102, 247, .35) 100%);
border-radius: var(--fontSize8);
}
.progress-text {
color: #3B73FF;
font-size: 24rpx;
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
}
.progress-bar {
height: 100%;
background: linear-gradient(128.8deg, #75bcff 0%, #2c66f7 100%);
border-radius: 8rpx;
}
.score-box {
display: flex;
align-items: center;
.score-text {
flex-shrink: 0;
width: var(--fontSize40);
font-size: var(--fontSize28);
color: #666666;
margin-left: var(--fontSize12);
}
}
.item-btn {
margin-top: var(--fontSize8);
width: var(--fontSize307);
height: var(--fontSize56);
border-radius: var(--fontSize24);
background: #F1F7FE;
font-size: var(--fontSize26);
color: #2C66F7;
text-align: center;
line-height: var(--fontSize56);
&.transparent {
opacity: 0;
}
}
.completed-bg {
width: var(--fontSize112);
height: var(--fontSize112);
position: absolute;
bottom: var(--fontSize16);
right: var(--fontSize16);
}
.studied-box {
display: flex;
align-items: center;
font-size: var(--fontSize24);
color: #999EA8;
margin-top: var(--fontSize4);
.icon {
flex-shrink: 0;
width: var(--fontSize32);
height: var(--fontSize32);
margin-right: var(--fontSize8);
}
}
.transparent {
opacity: 0;
}
\ No newline at end of file \ No newline at end of file
<!--packageStudyCenter/pages/myTask/components/CardItem/CardItem.wxml-->
<view class="item-container">
<slot></slot>
<view class="image-box" wx:if="{{!customTop}}">
<view class="image-tag" wx:if="{{infoData._tagImage}}">
<image src="{{infoData._tagImage}}" mode=""/>
</view>
<block wx:if="{{infoData._tagText}}">
<view class="tag">{{infoData._tagText}}</view>
</block>
<image class="item-img" src="{{infoData._imageUrl}}"/>
</view>
<view class="item-content">
<block wx:for="{{formItems}}" wx:key="index">
<view class="item-title" wx:if="{{item.type == 'title'}}">{{infoData[item.key]}}</view>
<block wx:elif="{{item.type == 'score'}}">
<view class="score-box">
<van-rate value="{{infoData[item.key]}}" size="20" gutter="1.5" count="{{item.allCount || 5}}" custom-class="score-view" color="{{item.color || '#FFB642'}}" void-icon="star" void-color="{{item.voidColor || '#E0E0E0'}}" readonly/>
<view class="score-text">{{infoData[item.textKey]}}</view>
</view>
</block>
<block wx:elif="{{item.type == 'btn'}}">
<view class="item-btn {{infoData[item.showEventKey] ? '' : 'transparent'}}" catch:tap="goPage" data-target="{{infoData}}">{{item.btnText}}</view>
</block>
<block wx:elif="{{item.type == 'completeIcon' && infoData[item.showEventKey] == item.showEventValue}}">
<image class="completed-bg" src="{{IMG_URL}}usedCar/completed-bg.png" />
</block>
<block wx:elif="{{item.type == 'studied'}}">
<view class="studied-box">
<image class="icon" src="{{IMG_URL}}studyCenter/all-amount.png"/>
<view class="text">{{infoData[item.key]}}人已学习</view>
</view>
</block>
<view class="item {{infoData._showCompleteIcon || item.type == 'empty' ? 'transparent' : ''}}" wx:else>
<view class="label {{item.customerLabel ? 'custom' : ''}}">{{item.label}}</view>
<view class="value">
<block wx:if="{{item.type == 'progress'}}">
<block wx:if="{{infoData[item.statusKey] == item.statusEvent}}">
<view class="progress-box">
<view class="progress-bar" style="width: {{infoData[item.key]}};"></view>
<view class="progress-text">{{infoData[item.key]}}</view>
</view>
</block>
<block wx:else>
<view class="dot-value"></view>
<view class="green">已完成</view>
</block>
</block>
<block wx:elif="{{item.arr}}">
<block wx:for="{{item.arr}}" wx:key="idx" wx:for-index="idx" wx:for-item="subItem">
<view class="{{item.colorEventKey ? (infoData[item.colorEventKey] == item.colorEventValue ? 'green' : 'red') : ''}}">
<block wx:if="{{idx == 1}}">
<text class="split">|</text>
</block>
{{infoData[subItem] != null ? infoData[subItem] : '-'}}{{item.unitArr[idx]}}
</view>
</block>
</block>
<block wx:else>
{{infoData[item.key] != null ? infoData[item.key] : '-'}}<text wx:if="{{item.unit}}">{{item.unit}}</text>
</block>
</view>
</view>
</block>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// components/ExamSubmitPopup/ExamSubmitPopup.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
/**
* 组件的属性列表
*/
properties: {
examSubmitText: {
type: String
},
showClose: Boolean
},
/**
* 组件的初始数据
*/
data: {
IMG_URL
},
/**
* 组件的方法列表
*/
methods: {
open(options = {}) {
return new Promise((resolve, reject) => {
this.setData({
show: true,
...options
})
})
},
close() {
this.setData({
show: false
})
},
cancel() {
this.triggerEvent('cancel')
},
confirm() {
this.triggerEvent('confirm')
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/ExamSubmitPopup/ExamSubmitPopup.wxss */
/* 蒙层 */
.modal-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
padding: 40rpx;
}
/* 弹窗容器 */
.modal-container {
width: 100%;
max-width: 640rpx;
background: #fff;
border-radius: 32rpx;
overflow: hidden;
position: relative;
animation: modalShow 0.3s ease;
}
@keyframes modalShow {
from {
opacity: 0;
transform: translateY(100rpx) scale(0.9);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
/* 头部 */
.modal-header {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
margin: var(--fontSize48) 0 var(--fontSize32);
.icon {
width: var(--fontSize176);
height: var(--fontSize176);
margin-bottom: var(--fontSize32);
}
.modal-main-title {
color: #292D33;
font-size: var(--fontSize34);
font-weight: 500;
}
}
.close {
position: absolute;
top: var(--fontSize24);
right: var(--fontSize24);
.close-icon {
width: var(--fontSize40);
height: var(--fontSize40);
}
}
.modal-content {
margin: 0 var(--fontSize48) var(--fontSize48) var(--fontSize48);
text-align: center;
font-size: var(--fontSize32);
color: #6C6F75;
}
.modal-footer {
border-top: var(--fontSize1) solid #EBEDF0;
height: var(--fontSize96);
display: flex;
align-items: center;
justify-content: center;
color: #347BFF;
font-size: var(--fontSize32);
.btn {
height: 100%;
line-height: var(--fontSize96);
flex: 1;
text-align: center;
}
.cancel {
color: #292D33;
}
}
\ No newline at end of file \ No newline at end of file
<!--components/ExamSubmitPopup/ExamSubmitPopup.wxml-->
<view class="modal-mask" wx:if="{{show}}" bindtap="onMaskTap" catchtouchmove="preventTouchMove">
<view class="modal-container" catchtap="stopPropagation">
<view class="modal-header">
<image class="icon" src="{{IMG_URL}}studyCenter/exam-submit-icon.png" mode=""/>
<view class="modal-main-title">是否已提交考试</view>
</view>
<view class="close" wx:if="{{showClose}}" bindtap="close">
<image class="close-icon" src="{{IMG_URL}}studyCenter/close.png" mode=""/>
</view>
<!-- 内容区域 -->
<view class="modal-content" wx:if="{{examSubmitText}}">{{examSubmitText}}</view>
<!-- 底部按钮 -->
<view class="modal-footer">
<view class="cancel btn" bindtap="cancel">未提交</view>
<view class="confirm btn" bindtap="confirm">确认已提交</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
let IMGTAG = { // 1必修 2选修
1: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/mandatory.png',
2: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/elective.png'
}
let TAGTEXT = {
10: '视频',
30: '文档',
20: '混合',
80: '音频',
40: 'H5',
70: 'URL',
120: '图文'
}
// 非视频 默认图片都用文档类型图片
let TYPEIMG = {
10: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/video-icon.png',
30: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/document-icon.png',
20: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/document-icon.png',
80: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/document-icon.png',
40: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/document-icon.png',
70: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/document-icon.png',
120: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/document-icon.png'
}
export default {
IMGTAG,
TYPEIMG,
TAGTEXT
}
\ No newline at end of file \ No newline at end of file
// packageStudyCenter/pages/myCourse/myCourse.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import api from "~/packageStudyCenter/api"
import commonApi from "~/api/api"
import constantData from "../../constantData"
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL,
tabList: [{
label: '待学习',
num: 0
}, {
label: '正在学习',
num: 0
}, {
label: '已学完',
num: 0
}],
tabIndex: 0,
pageNum: 1,
pageSize: 10,
residueObj: {}, // 剩余开单时间
courseList: [],
formItems: [],
tipsBoxHeight: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (options?.tabIndex) {
this.setData({
tabIndex: Number(options.tabIndex)
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getStaticData()
this.getResidueTime()
this.getList()
},
// 获取我的课程剩余开单时间
getResidueTime() {
api.getResidueTimeApi({}).then(res => {
let { code, data, message } = res
if (code == 0) {
this.setData({
residueObj: data || {}
}, () => {
if (data?.remindType > 0) {
const query = wx.createSelectorQuery()
query.select('.tips-box').boundingClientRect((res) => {
const height = res && res?.height
this.setData({
tipsBoxHeight: height || 0
})
}).exec()
}
})
} else {
wx.$util.showToast(message)
}
this.setData({
})
})
},
getStaticData() {
api.getMyCourseCount({}).then(res => {
let { code, data, message } = res
if (code == 0) {
this.setData({
['tabList[0].num']: data.unLearnCount,
['tabList[1].num']: data.learningCount,
['tabList[2].num']: data.completedCount
})
} else {
wx.$util.showToast(message)
}
})
},
changeTab(e) {
let { index } = e.currentTarget.dataset
this.setData({
tabIndex: index,
pageNum: 1,
dataList: []
}, () => {
this.getList(true)
this.getStaticData()
})
},
scrollonReachBottom() {
const { pageNum, total, pageSize } = this.data
if (Math.ceil(total / pageSize) > pageNum) {
this.setData({ pageNum: pageNum + 1 }, () => {
this.getList()
})
} else {
this.setData({ nothing: true })
}
},
async getList(scrollTopFlag = false) {
try {
wx.showLoading({
title: '加载中',
mask: true
})
let { pageNum, pageSize, tabIndex, formItems } = this.data
const params = {
learnStatus: tabIndex,
pageNum,
pageSize
}
this.setData({
loading: true
})
if (pageNum > 1) {
this.setData({
loadingList: true
})
}
const res = await api.getMyCourseList(params)
switch (tabIndex) {
case 0:
formItems = [{
key: 'title',
type: 'title'
}, {
label: '课程时长',
key: 'totalDuration',
unit: 'min'
}, {
type: 'score',
key: '_totalStar',
textKey: 'totalStar'
}, {
type: 'studied',
key: 'learnTotal'
}]
break
case 1:
formItems = [{
key: 'title',
type: 'title'
}, {
label: '课程时长',
key: 'totalDuration',
unit: 'min'
}, {
label: '学习进度',
type: 'progress',
statusKey: 'completeStatus',
statusEvent: '0',
key: '_process'
}]
break
case 2:
formItems = [{
key: 'title',
type: 'title'
}, {
label: '课程时长',
key: 'totalDuration',
unit: 'min'
}, {
label: '学习进度',
type: 'progress',
statusKey: 'completeStatus',
statusEvent: '0',
key: '_process'
}, {
type: 'completeIcon',
showEventKey: 'completeStatus',
showEventValue: 1
}]
break
}
this.setData({
loadingList: false,
formItems
})
if (res.code != 0) {
wx.$util.showToast(res.message)
}
let newList = res?.data?.list || [];
newList?.forEach(val => {
val._totalStar = val.totalStar / 2
val._imageUrl = constantData.TYPEIMG[val.courseFileType]
val._tagImage = constantData.IMGTAG[val.planCourseType]
val._tagText = constantData.TAGTEXT[val.courseFileType]
val.completeStatus = val.process >= 100 ? 1 : 0 // 学习进度是否已完成
val._process = `${Math.floor(val.process)}%`
val._showCompleteIcon = val.process >= 100
})
this.setData({
loading: false
})
if (pageNum == 1) {
this.setData({ courseList: newList })
} else {
this.setData({
courseList: this.data.courseList.concat(newList)
});
}
wx.hideLoading()
this.setData({
total: res.data?.total,
nothing: newList.length > 0
})
if (scrollTopFlag) {
this.setData({scrollTop: 0})
}
} catch (error) {
wx.showToast({
title: error.message || '请求失败',
icon: "none",
})
}
},
// 跳转北森课程详情
goBeisenDetail(e) {
let { target } = e.currentTarget.dataset
wx.showLoading()
commonApi.findBeiSenSSOToken({}).then(res => {
wx.hideLoading()
const beisenToken = res.data;
if (beisenToken) {
const COURSE_ID = target?.courseId;
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningCourseTraineeDetailPage',
appCode: 'Learning',
id: COURSE_ID
};
this.jumpUrl = ''
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
const tokenUrl = beisenToken
wx.$router.jumpH5(`${tokenUrl}&return_url=${url}`)
} else {
wx.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"card-item": "/packageStudyCenter/components/CardItem/CardItem"
},
"navigationBarTitleText": "我的课程"
}
\ No newline at end of file \ No newline at end of file
/* packageStudyCenter/pages/myCourse/myCourse.wxss */
page {
background: #F7F8FA;
}
.container {
height: 100vh;
.top-box {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--fontSize24) var(--fontSize28);
.tab-box {
display: flex;
align-items: center;
gap: var(--fontSize16);
.tab-item {
text-align: center;
padding: 0 var(--fontSize32);
height: var(--fontSize72);
line-height: var(--fontSize72);
border-radius: var(--fontSize16);
opacity: 1;
background: #ffffff;
backdrop-filter: blur(var(--fontSize12));
color: #666666;
font-size: var(--fontSize28);
&.active {
color: #FFFFFF;
background: #2c66f7;
font-weight: 500;
box-shadow: var(--fontSize4) var(--fontSize8) var(--fontSize16) 0 #81a3d659;
}
}
}
.count-box {
color: #999EA8;
font-size: var(--fontSize26);
}
}
.tips-box {
border-radius: var(--fontSize8);
background: #fef5ea;
position: relative;
margin-bottom: var(--fontSize28);
.icon {
position: absolute;
top: var(--fontSize18);
left: var(--fontSize16);
width: var(--fontSize28);
height: var(--fontSize28);
}
.tips {
padding: var(--fontSize16) var(--fontSize16) var(--fontSize16) var(--fontSize52);
color: #FF9D0A;
font-size: var(--fontSize24);
font-weight: 500;
}
}
.list-scroll {
.list-container {
max-height: none; /* 确保不被限制 */
height: auto;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: var(--fontSize16);
padding: 0 var(--fontSize28) var(--fontSize32);
box-sizing: border-box;
}
}
.nothing {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
flex-direction: column;
margin-top: 270rpx;
font-size: var(--fontSize24);
color: #999999;
.icon {
width: var(--fontSize128);
height: var(--fontSize80);
margin-bottom: var(--fontSize8);
}
}
.end-text {
width: 100%;
text-align: center;
padding-bottom: var(--fontSize36);
color: #999999;
font-size: var(--fontSize24);
}
}
\ No newline at end of file \ No newline at end of file
<!--packageStudyCenter/pages/myCourse/myCourse.wxml-->
<view class="container">
<view class="top-box">
<view class="tab-box">
<view class="tab-item {{tabIndex == index ? 'active' : ''}}" wx:for="{{tabList}}" wx:key="index" bindtap="changeTab" data-index="{{index}}">{{item.label}}<text>{{item.num != null ? item.num : '-'}}</text></view>
</view>
</view>
<view class="tips-box" wx:if="{{residueObj.remindType == 1 || residueObj.remindType == 2}}">
<image class="icon" src="{{IMG_URL}}studyCenter/warning.png" mode=""/>
<view class="tips" wx:if="{{residueObj.remindType == 1}}">剩余{{residueObj.residueDays}}天完成必修课学习及通过课后考试,过期将锁定开单权限</view>
<view class="tips" wx:elif="{{residueObj.remindType == 2}}">完成必修课学习及通过课后考试后,即可解锁开单权限</view>
</view>
<scroll-view scroll-y enhanced="{{true}}" class="list-scroll" style="height: calc(100vh - var(--fontSize120) - {{tipsBoxHeight}}px - var(--fontSize28));" show-scrollbar="{{false}}" scroll-top="{{scrollTop}}" bindscrolltolower="scrollonReachBottom">
<block wx:if="{{courseList.length}}">
<view class="list-container">
<view class="exam-item" wx:for="{{courseList}}" bindtap="goBeisenDetail" data-target="{{item}}" wx:key="index">
<card-item infoData="{{item}}" formItems="{{formItems}}"/>
</view>
</view>
</block>
<block wx:else>
<view class="nothing flex">
<image class="icon" src="{{IMG_URL}}studyCenter/empty_data.png" />
暂无数据
</view>
</block>
<view class="end-text" wx:if="{{loadingList}}">更多课程加载中...</view>
<view class="end-text" wx:if="{{nothing && courseList.length && !loadingList}}">更多课程即将上架,敬请期待</view>
</scroll-view>
</view>
\ No newline at end of file \ No newline at end of file
// packageStudyCenter/pages/myExam/myExam.js
import api from "~/packageStudyCenter/api"
import commonApi from '~/api/api'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL,
tabList: [{
label: '已通过',
num: 0
}, {
label: '未通过',
num: 0
}],
tabIndex: 0,
pageNum: 1,
pageSize: 10,
examList: [],
formItems: [{
key: 'title',
type: 'title'
}, {
label: '考试时间',
arr: ['duration', 'questionCount'],
unitArr: ['分钟', '题']
}, {
label: '剩余考试次数',
customerLabel: true,
key: '_remainingTimes'
}, {
label: '最高得分',
arr: ['maxTotalScore', '_status'],
unitArr: ['分', ''],
colorEventKey: 'examResult',
colorEventValue: 1
}, {
btnText: '重新考试',
type: 'btn',
showEventKey: '_showBtn'
}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getStatics()
this.getList()
if (wx.getStorageSync('FROM_BEISENWEBVIEW')) {
wx.removeStorageSync('FROM_BEISENWEBVIEW') // 记得清除
// 查询北森考试结果
this.doAfterWebViewReturn()
}
},
doAfterWebViewReturn() {
this.setData({
examSubmitText: ''
}, () => {
let modal = this.selectComponent('#examPopup')
modal.open()
})
},
// 北森考试结果查询
examHandleConfirm() {
let { examObj, confirmFlag } = this.data
this.setData({
examSubmitText: '正在查询考试结果,请稍后...'
})
if (confirmFlag) return
this.setData({confirmFlag: true})
commonApi.getBeisenExamResult({...examObj, invokeType: 1}).then(res => {
this.setData({confirmFlag: false})
let { code, data, message } = res
if (code == 0) {
if (data) {
this.examHandleCancel()
this.getList(true)
} else {
this.setData({
examSubmitText: '未查询到结果,请稍后再试'
})
}
} else {
this.setData({
examSubmitText: '未查询到结果,请稍后再试'
})
wx.$util.showToast(message)
}
})
},
examHandleCancel() {
let modal = this.selectComponent('#examPopup')
if (modal) {
modal.close()
this.getList(true)
}
},
async getStatics() {
const userInfo = wx.$util.getUserInfo()
let res = await api.getStaffExaminationCount({staffPhone: userInfo?.phone})
this.setData({
['tabList[0].num']: res.data?.passCount,
['tabList[1].num']: res.data?.failCount
})
},
changeTab(e) {
let { index } = e.currentTarget.dataset
this.setData({
tabIndex: index,
pageNum: 1
}, () => {
this.getList(true)
this.getStatics()
})
},
scrollonReachBottom() {
const { pageNum, total, pageSize } = this.data
if (Math.ceil(total / pageSize) > pageNum) {
this.setData({ pageNum: pageNum + 1 }, () => {
this.getList()
})
} else {
this.setData({ nothing: true })
}
},
async getList(scrollTopFlag = false) {
try {
wx.showLoading()
wx.showLoading({
title: '加载中',
mask: true
})
const { pageNum, pageSize, tabIndex } = this.data
const userInfo = wx.$util.getUserInfo()
const params = {
staffPhone: userInfo?.phone,
examResult: tabIndex == 0 ? 1 : 2,
pageNum,
pageSize
}
this.setData({
loading: true
})
if (pageNum > 1) {
this.setData({
loadingList: true
})
}
const res = await api.getStaffExaminationList(params)
this.setData({
loadingList: false
})
if (res.code != 0) {
wx.$util.showToast(res.message)
}
let newList = res?.data?.list || [];
newList?.forEach(val => {
val._imageUrl = `${IMG_URL}studyCenter/document-icon.png`
val._remainingTimes = val.examTimes == null ? '不限制' : `${val.remainingTimes != null ? val.remainingTimes : '-'}/${val.examTimes != null ? val.examTimes : '-'}`
val._status = val.examResult == 1 ? '已通过' : '未通过'
val._showBtn = val.remainingTimes > 0 || val.examTimes == null
})
this.setData({
loading: false
})
if (pageNum == 1) {
this.setData({ examList: newList })
} else {
this.setData({
examList: this.data.examList.concat(newList)
});
}
wx.hideLoading()
this.setData({
total: res.data?.total,
nothing: newList.length > 0
})
if (scrollTopFlag) {
this.setData({scrollTop: 0})
}
} catch (error) {
wx.showToast({
title: error.message || '请求失败',
icon: "none",
})
}
},
goPage(e) {
commonApi.findBeiSenSSOToken({}).then(res => {
const beisenToken = res.data;
const COURSE_ID = e.detail?.examination
if (beisenToken) {
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: COURSE_ID
}
this.jumpUrl = ''
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
const tokenUrl = beisenToken
wx.$router.jumpH5(`${tokenUrl}&return_url=${url}`)
this.setData({
examObj: {
examId: COURSE_ID
}
})
} else {
wx.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"card-item": "/packageStudyCenter/components/CardItem/CardItem",
"exam-submit-popup": "/packageStudyCenter/components/ExamSubmitPopup/ExamSubmitPopup"
},
"navigationBarTitleText": "我的考试"
}
\ No newline at end of file \ No newline at end of file
/* packageStudyCenter/pages/myExam/myExam.wxss */
page {
background: #F7F8FA;
}
.container {
height: 100vh;
.tab-box {
display: flex;
align-items: center;
gap: var(--fontSize16);
margin: var(--fontSize24) var(--fontSize28);
.tab-item {
text-align: center;
padding: 0 var(--fontSize32);
height: var(--fontSize72);
line-height: var(--fontSize72);
border-radius: var(--fontSize16);
opacity: 1;
background: #ffffff;
backdrop-filter: blur(var(--fontSize12));
color: #666666;
font-size: var(--fontSize28);
&.active {
color: #FFFFFF;
background: #2c66f7;
font-weight: 500;
box-shadow: var(--fontSize4) var(--fontSize8) var(--fontSize16) 0 #81a3d659;
}
}
}
.list-scroll {
height: calc(100vh - var(--fontSize120));
.list-container {
max-height: none; /* 确保不被限制 */
height: auto;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: var(--fontSize16);
padding: 0 var(--fontSize28) var(--fontSize32);
box-sizing: border-box;
}
.end-text {
text-align: center;
padding-bottom: var(--fontSize36);
color: #999999;
font-size: var(--fontSize24);
}
}
.nothing {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
flex-direction: column;
margin-top: 270rpx;
font-size: var(--fontSize24);
color: #999999;
.icon {
width: var(--fontSize128);
height: var(--fontSize80);
margin-bottom: var(--fontSize8);
}
}
}
\ No newline at end of file \ No newline at end of file
<!--packageStudyCenter/pages/myExam/myExam.wxml-->
<view class="container">
<view class="tab-box">
<view class="tab-item {{tabIndex == index ? 'active' : ''}}" wx:for="{{tabList}}" wx:key="index" bindtap="changeTab" data-index="{{index}}">{{item.label}}<text>{{item.num != null ? item.num : '-'}}</text></view>
</view>
<scroll-view scroll-y enhanced="{{true}}" class="list-scroll" show-scrollbar="{{false}}" scroll-top="{{scrollTop}}" bindscrolltolower="scrollonReachBottom">
<block wx:if="{{examList.length}}">
<view class="list-container">
<view class="exam-item" wx:for="{{examList}}" wx:key="index" data-target="{{item}}">
<card-item infoData="{{item}}" bindgoPage="goPage" formItems="{{formItems}}"/>
</view>
</view>
</block>
<block wx:else>
<view class="nothing flex">
<image class="icon" src="{{IMG_URL}}studyCenter/empty_data.png" />
暂无数据
</view>
</block>
<view class="end-text" wx:if="{{loadingList}}">更多考试加载中...</view>
<view class="end-text" wx:if="{{nothing && examList.length && !loadingList}}">已展示所有考试</view>
</scroll-view>
</view>
<exam-submit-popup id="examPopup" bindcancel="examHandleCancel" bindconfirm="examHandleConfirm" showClose="{{true}}" examSubmitText="{{examSubmitText}}" />
\ No newline at end of file \ No newline at end of file
// packageStudyCenter/pages/myTask/components/LearnStatistics/LearnStatistics.js
Component({
properties: {
isBeisen: {
type: Boolean,
value: false
},
dataInfo: {
type: Object,
value: {}
},
isHmzx: {
type: Boolean,
value: false
},
isYb: {
type: Boolean,
value: false
}
},
data: {
progressList: [
{
type: 3,
title: '短课程进度',
unit: '%',
key: 'shortCourseProgress',
ratio: 'shortCourseCompletedLearnRatio',
hidden: false
},
{
type: 4,
title: '长课程进度',
unit: '%',
key: 'longCourseProgress',
ratio: 'longCourseCompletedLearnRatio',
hidden: false
}
],
progressListFiltered: []
},
observers: {
'isHmzx, isYb, isBeisen': function(isHmzx, isYb, isBeisen) {
this.updateProgressList();
},
'dataInfo': function(dataInfo) {
this.updateProgressList();
}
},
lifetimes: {
attached() {
this.updateProgressList();
}
},
methods: {
updateProgressList() {
const { isHmzx, isYb, isBeisen, progressList } = this.data;
const updatedList = progressList.map(item => {
let hidden = item.hidden;
if (item.type === 3) {
// 短课程:非慧营销或非延保时隐藏
hidden = !isHmzx || !isYb;
} else if (item.type === 4) {
// 长课程:非北森时隐藏
hidden = !isBeisen;
}
return { ...item, hidden };
});
// 过滤出需要显示的项
const filteredList = updatedList.filter(item => !item.hidden);
this.setData({
progressList: updatedList,
progressListFiltered: filteredList
});
},
getDisplayValue(value) {
if (value === 0 || value === '0') {
return '0';
}
return value || '-';
}
}
});
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageStudyCenter/pages/myTask/components/LearnStatistics/LearnStatistics.wxss */
.learn-statistics {
width: calc(100% - var(--fontSize56));
height: var(--fontSize452);
box-sizing: border-box;
border-radius: var(--fontSize24);
background: #ffffff;
padding: var(--fontSize24);
margin: 0 var(--fontSize28) 20rpx;
.learn-statistics-title {
font-size: var(--fontSize30);
font-weight: 500;
color: #292D33;
}
.statistics-content {
display: grid;
grid-template-columns: repeat(2, 1fr);
align-items: center;
margin-top: var(--fontSize16);
margin-bottom: var(--fontSize20);
.statistics-item {
display: flex;
align-items: baseline;
.statistics-number {
color: #3B73FF;
font-size: var(--fontSize40);
font-weight: 700;
}
.blue-number {
color: #3B73FF;
}
.statistics-unit {
font-size: var(--fontSize20);
margin-left: var(--fontSize4);
}
.text {
color: #808080;
font-size: var(--fontSize24);
margin-right: var(--fontSize8);
}
.statistics-rank {
color: #000000;
font-size: var(--fontSize32);
font-weight: 500;
}
}
}
.progress-box {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: var(--fontSize24);
.progress-item {
display: flex;
flex-direction: column;
border-radius: var(--fontSize12);
.progress-item-title {
color: #808080;
font-size: var(--fontSize24);
}
.title {
color: #1A1A1A;
font-size: var(--fontSize28);
}
.progress-item-value {
display: flex;
align-items: baseline;
margin-top: var(--fontSize16);
.number {
color: #000;
font-size: var(--fontSize32);
font-weight: 500;
}
.blue-number {
font-size: var(--fontSize40);
font-weight: 700;
color: #3B73FF;
}
.unit {
font-size: var(--fontSize20);
color: #000;
margin-left: var(--fontSize4);
}
.blue-unit {
font-size: var(--fontSize22);
font-weight: 500;
color: #3B73FF;
}
}
.progress-bar-box {
position: relative;
width: calc(100% - var(--fontSize68));
margin: var(--fontSize32) 0;
.progress-bar {
width: 100%;
height: var(--fontSize12);
border-radius: var(--fontSize8);
opacity: 0.35;
background: linear-gradient(128.8deg, #75bcff 0%, #2c66f7 100%);
&.big-margin {
margin-top: var(--fontSize112);
}
}
.progress-bar-value {
position: absolute;
left: 0;
top: 0;
height: var(--fontSize12);
border-radius: var(--fontSize8);
opacity: 1;
background: linear-gradient(128.8deg, #75bcff 0%, #2c66f7 100%);
}
}
.progress-bar-box2 {
width: calc(100% - var(--fontSize68));
height: var(--fontSize12);
margin: var(--fontSize32) 0;
&.big-height {
margin-top: var(--fontSize164);
}
}
.progress-item-finish {
height: var(--fontSize72);
font-size: var(--fontSize22);
color: #808080;
line-height: var(--fontSize36);
.progress-text {
display: flex;
.number {
color: #3B73FF;
}
}
.no-finish-text {
margin-top: 30rpx;
}
}
}
.bg {
background-color: #F5F9FF;
padding: var(--fontSize24) var(--fontSize20);
}
}
.only-one {
grid-template-columns: repeat(1, 1fr);
}
}
.progress-text {
display: flex;
}
\ No newline at end of file \ No newline at end of file
<!--packageStudyCenter/pages/myTask/components/LearnStatistics/LearnStatistics.wxml-->
<view class="learn-statistics {{isBeisen ? 'big-height' : 'small-height'}}">
<!-- 北森帐号显示累计时长 -->
<view class="learn-statistics-title" wx:if="{{isBeisen}}">累计学习</view>
<view class="statistics-content" wx:if="{{isBeisen}}">
<view class="statistics-item">
<view class="statistics-number blue-number">{{dataInfo.learnDurationTotal || 0}}</view>
<view class="statistics-unit blue-number">小时</view>
</view>
<view class="statistics-item">
<view class="text">排名</view>
<view class="statistics-rank">{{dataInfo.learnDurationRank || '-'}}</view>
<view class="statistics-unit">名</view>
</view>
</view>
<view class="progress-box {{progressListFiltered.length === 1 ? 'only-one' : ''}}">
<view
class="progress-item {{isBeisen ? 'bg' : ''}}"
wx:for="{{progressListFiltered}}"
wx:key="index"
>
<view class="progress-item-title {{isBeisen ? '' : 'title'}}">{{item.title}}</view>
<view class="progress-item-value">
<view class="number {{isBeisen ? '' : 'blue-number'}}">
{{dataInfo[item.key] === 0 ? 0 : (dataInfo[item.key] || '-')}}
</view>
<view class="unit {{isBeisen ? '' : 'blue-unit'}}">{{item.unit}}</view>
</view>
<view class="progress-bar-box" wx:if="{{dataInfo[item.key] || dataInfo[item.key] == 0}}">
<view class="progress-bar {{isBeisen ? '' : 'big-margin'}}"></view>
<view
class="progress-bar-value {{isBeisen ? '' : 'big-top'}}"
style="width: {{dataInfo[item.key] ? dataInfo[item.key] + '%' : '0'}}"
></view>
</view>
<view
class="progress-bar-box2 {{isBeisen ? '' : 'big-height'}}"
wx:else
></view>
<view class="progress-item-finish {{isBeisen ? '' : 'big-margin'}}">
<block wx:if="{{dataInfo[item.key] || dataInfo[item.key] == 0}}">
<view>本周已有</view>
<view class="progress-text">
<view class="number">{{dataInfo[item.ratio] === 0 ? 0 : (dataInfo[item.ratio] || '-')}}%</view>学员完成学习
</view>
</block>
<block wx:else>
<block wx:if="{{item.type == 3}}">
<view>你的表现很好</view>
<view class="progress-text">暂无需短课程学习</view>
</block>
<block wx:elif="{{item.type == 4}}">
<view class="no-finish-text">暂无长课程学习安排</view>
</block>
</block>
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageStudyCenter/pages/myTask/components/RadarChart/RadarChart.js
import uCharts from '~/packageStudyCenter/ucharts/index.js'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
properties: {
chartData: {
type: Object,
value: {},
observer: function(newVal) {
this.checkData(newVal);
if (this.data.hasData) {
this.scheduleDraw();
}
}
},
heightClass: {
type: String,
value: ''
},
labelColors: {
type: Array,
value: ['#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666'],
observer: function(newVal) {
if (this.data.hasData && this.chartDrawn) {
this.scheduleDraw();
}
}
}
},
data: {
IMG_URL,
hasData: false,
chartHeight: 272
},
lifetimes: {
ready() {
this.initHeight();
this.checkData(this.properties.chartData);
},
moved() {
if (this.data.hasData && !this.chartDrawn) {
this.scheduleDraw();
}
},
detached() {
if (this.drawTimer) {
clearTimeout(this.drawTimer);
}
}
},
pageLifetimes: {
show() {
if (this.data.hasData && !this.chartDrawn) {
this.scheduleDraw();
}
}
},
methods: {
initHeight() {
const chartHeight = this.properties.heightClass === 'big-height' ? 300 : 272;
this.setData({ chartHeight });
},
checkData(chartData) {
const hasData = chartData &&
chartData.categories &&
chartData.categories.length > 0 &&
chartData.series &&
chartData.series.length > 0 &&
chartData.series[0].data &&
chartData.series[0].data.length > 0;
this.setData({ hasData });
},
scheduleDraw() {
if (this.drawTimer) {
clearTimeout(this.drawTimer);
}
this.drawTimer = setTimeout(() => {
this.drawCharts();
}, 100);
},
drawCharts() {
return new Promise((resolve, reject) => {
const query = wx.createSelectorQuery().in(this);
query.select('#radarChart').fields({ node: true, size: true }).exec((res) => {
if (!res[0]) {
reject(new Error('未找到canvas元素'));
return;
}
const canvas = res[0].node;
if (!canvas) {
reject(new Error('canvas节点为空'));
return;
}
try {
const ctx = canvas.getContext('2d');
const systemInfo = wx.getSystemInfoSync();
const pixelRatio = systemInfo.pixelRatio;
const actualWidth = res[0].width * pixelRatio;
const actualHeight = res[0].height * pixelRatio;
canvas.width = actualWidth;
canvas.height = actualHeight;
const config = {
type: "radar",
animation: false,
background: "#FFFFFF",
fontSize: 12,
canvas2d: true,
categories: this.properties.chartData.categories,
color: ["#3B73FF"],
context: ctx,
dataLabel: false,
extra: {
radar: {
gridType: "radar",
gridColor: "#dae8fd",
gridCount: 3,
opacity: 0.2,
max: 3,
labelShow: true,
labelColor: this.properties.labelColors,
labelFontSize: 12,
dataPointShape: false,
axisLabelTofix: 1,
labelFormatter: (val) => typeof val === 'number' ? val.toFixed(1) : val,
border: false,
borderColor: "#3B73FF",
borderWidth: 1,
fillOpacity: 0.2
}
},
height: actualHeight,
legend: { show: false },
padding: [5, 5, 5, 5],
pixelRatio: pixelRatio,
series: this.properties.chartData.series,
width: actualWidth,
xAxis: { disableGrid: false },
yAxis: { data: [{ min: 0 }] }
};
new uCharts(config);
this.chartDrawn = true;
resolve();
} catch (error) {
console.error('绘制雷达图失败:', error);
reject(error);
}
});
});
},
// 外部调用方法:强制重绘
redraw() {
this.chartDrawn = false;
this.scheduleDraw();
}
}
});
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageStudyCenter/pages/myTask/components/RadarChart/RadarChart.wxss */
.radar-chart-container {
width: 100%;
}
.nothing {
width: 100%;
height: 228rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 76rpx;
font-size: var(--fontSize24);
color: #999999;
box-sizing: border-box;
}
.nothing.big-height {
height: 234rpx;
}
.nothing .icon {
width: var(--fontSize128);
height: var(--fontSize80);
margin-bottom: var(--fontSize8);
}
.flex {
display: flex;
}
\ No newline at end of file \ No newline at end of file
<!--packageStudyCenter/pages/myTask/components/RadarChart/RadarChart.wxml-->
<view class="radar-chart-container">
<block wx:if="{{hasData}}">
<canvas
class="charts-box {{heightClass}}"
type="2d"
id="radarChart"
canvas-id="radarChart"
disable-scroll="true"
style="width: 100%; height: {{chartHeight}}rpx;"
></canvas>
</block>
<block wx:else>
<view class="nothing flex {{heightClass === 'big-height' ? 'big-height' : ''}}">
<image class="icon" src="{{IMG_URL}}studyCenter/empty_data.png" />
暂无数据
</view>
</block>
</view>
\ No newline at end of file \ No newline at end of file
// packageStudyCenter/pages/myTask/components/RecommendCourse/RecommendCourse.js
import api from "~/packageStudyCenter/api"
import commonApi from '~/api/api'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
properties: {
// 可以添加需要的属性
},
data: {
IMG_URL,
recommendCourseList: [],
nothing: false,
total: 0,
pageNum: 1,
pageSize: 10,
scrollTop: 0,
},
lifetimes: {
attached() {
this.getCourseTaskPage()
}
},
methods: {
async getCourseTaskPage() {
try {
const { pageNum, pageSize } = this.data;
const params = {
recommendStatus: 1, // 推荐状态 0=无推荐 1=推荐课程
pageNum,
pageSize
};
const res = await api.getCourseTaskPage(params);
if (pageNum == 1) {
this.setData({
recommendCourseList: res.data?.list || []
});
} else {
this.setData({
recommendCourseList: this.data.recommendCourseList.concat(res.data?.list || [])
});
}
this.setData({
total: res.data?.total || 0,
nothing: (res.data?.list || []).length > 0 ? false : true
});
} catch (error) {
wx.showToast({
title: error.message || '请求失败',
icon: "none",
});
}
},
pageonReachBottom() {
const { pageNum, total, pageSize } = this.data;
if (Math.ceil(total / pageSize) > pageNum) {
this.setData({
pageNum: pageNum + 1
});
this.getCourseTaskPage();
} else {
this.setData({ nothing: true });
}
},
startStudy(e) {
const item = e.currentTarget.dataset.item
let userInfo = wx.$util.getUserInfo()
// 埋点 推荐课程
wx.$track.setTrackData(0, 'recommend_course', {}, '', userInfo?.sceneType)
commonApi.findBeiSenSSOToken({}).then(res => {
const beisenToken = res.data;
if (beisenToken) {
const COURSE_ID = item?.courseId;
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningCourseTraineeDetailPage',
appCode: 'Learning',
id: COURSE_ID
};
this.jumpUrl = ''
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
const tokenUrl = beisenToken
wx.$router.jumpH5(`${tokenUrl}&return_url=${url}`)
} else {
wx.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
})
}
}
});
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageStudyCenter/pages/myTask/components/RecommendCourse/RecommendCourse.wxss */
.recommend-course {
height: calc(100% - 100rpx);
}
.recommend-course-list {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: var(--fontSize32);
padding: var(--fontSize24) var(--fontSize28);
.recommend-course-item {
width: 100%;
height: var(--fontSize338);
box-shadow: 0 var(--fontSize8) var(--fontSize24) 0 #2a61eb1a;
border-radius: var(--fontSize24);
.recommend-course-item-img {
width: 100%;
height: var(--fontSize180);
border-radius: var(--fontSize24) var(--fontSize24) 0 0;
}
.recommend-course-content {
padding: var(--fontSize24) var(--fontSize16);
.recommend-course-item-title {
font-size: var(--fontSize28);
color: #292D33;
font-weight: 500;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
margin-bottom: 16rpx;
height: calc(2 * 1.2em);
line-height: 1.2;
}
.recommend-course-item-text {
font-size: 24rpx;
color: #999EA8;
}
}
}
}
.nothing {
width: 100%;
flex-direction: column;
margin-top: 380rpx;
font-size: var(--fontSize24);
color: #999999;
}
.nothing .icon {
width: var(--fontSize128);
height: var(--fontSize80);
margin-bottom: var(--fontSize8);
}
.end-text {
color: #999;
text-align: center;
padding: 30rpx 0;
font-size: 24rpx;
}
.flex {
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file \ No newline at end of file
<!--packageStudyCenter/pages/myTask/components/RecommendCourse/RecommendCourse.wxml-->
<view class="recommend-course">
<block wx:if="{{recommendCourseList.length}}">
<view class="recommend-course-list">
<view
class="recommend-course-item"
wx:for="{{recommendCourseList}}"
wx:key="index"
bindtap="startStudy"
data-item="{{item}}"
data-index="{{index}}"
>
<image
class="recommend-course-item-img"
src="{{IMG_URL}}studyCenter/recommend-course-default.png"
/>
<view class="recommend-course-content">
<view class="recommend-course-item-title">
{{item.courseName}}
</view>
<view class="recommend-course-item-text">
{{(item.totalDuration || item.totalDuration === 0) ? item.totalDuration + 'min' : '-'}}
</view>
</view>
</view>
</view>
</block>
<block wx:else>
<view class="nothing flex">
<image class="icon" src="{{IMG_URL}}studyCenter/empty_data.png" />
暂无数据
</view>
</block>
<view class="end-text" wx:if="{{nothing && recommendCourseList.length}}">到底了!</view>
</view>
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"card-item": "/packageStudyCenter/components/CardItem/CardItem"
}
}
\ No newline at end of file \ No newline at end of file
/* packageStudyCenter/pages/myTask/components/Task/Task.wxss */
.task-box {
min-height: calc(100vh - var(--fontSize72));
background: #FFFFFF;
}
.tab-list {
display: flex;
width: var(--fontSize276);
height: var(--fontSize68);
background-color: #F5F6F7;
border-radius: var(--fontSize16);
color: #666666;
font-size: var(--fontSize26);
}
.tab-item {
box-sizing: border-box;
display: flex;
flex: 1;
align-items: center;
justify-content: center;
margin: var(--fontSize6);
}
.tab-item.active {
background-color: #fff;
color: #1A1A1A;
border-radius: var(--fontSize10);
font-weight: 500;
}
.tips {
display: flex;
// align-items: center;
padding: var(--fontSize8) var(--fontSize16);
background-color: #FEF5EA;
border-radius: var(--fontSize8);
font-size: 24rpx;
color: #FF9D0A;
box-sizing: border-box;
height: var(--fontSize80);
margin: 0 var(--fontSize28) var(--fontSize24);
.icon-study-tips {
flex-shrink: 0;
width: var(--fontSize28);
height: var(--fontSize28);
margin: var(--fontSize2) var(--fontSize8) 0 0;
}
}
.icon-study-tips {
margin-right: 8rpx;
}
.tab-box {
padding-top: var(--fontSize24);
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--fontSize24) var(--fontSize40);
position: sticky;
top: var(--fontSize72);
z-index: 50;
}
.finish-tab {
display: flex;
}
.finish-tab-item {
width: 148rpx;
height: 64rpx;
border-radius: 48rpx;
background: #f2f2f2;
color: #666666;
font-size: 28rpx;
line-height: 68rpx;
text-align: center;
margin-right: 16rpx;
}
.finish-tab-item:last-child {
margin-right: 0;
}
.finish-tab-item.finish-active {
background: #2d66f71a;
font-weight: 500;
color: #2D66F7;
}
.task-finish-box {
margin-top: 24rpx;
}
.task-list {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: var(--fontSize16);
padding: 0 var(--fontSize28) var(--fontSize32);
box-sizing: border-box;
}
.time-limit-tag {
position: absolute;
top: 0;
left: 0;
width: 122rpx;
height: 48rpx;
background-image: url('https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/studyCenter/limit-page.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
z-index: 1;
color: #fff;
}
.time-limit-countdown {
position: absolute;
top: var(--fontSize128);
left: var(--fontSize20);
display: flex;
align-items: center;
justify-content: center;
font-size: var(--fontSize24);
z-index: 1;
}
.countdown-num {
display: flex;
align-items: center;
justify-content: center;
color: #fff;
width: 40rpx;
height: 40rpx;
border-radius: 4rpx;
background: #00000059;
margin: 0 4rpx;
}
.countdown-separator {
color: #fff;
}
.countdown-label,
.countdown-unit {
color: #00000066;
margin: 0 4rpx;
}
.timeout-label {
height: var(--fontSize40);
line-height: var(--fontSize40);
border-radius: var(--fontSize4);
background: #00000059;
color: #fff;
padding: 0 var(--fontSize12);
font-size: var(--fontSize24);
}
.task-item-img {
width: 100%;
height: 180rpx;
border-radius: 16rpx 16rpx 0 0;
}
.task-item-content {
padding: var(--fontSize14);
.task-item-title {
font-size: 30rpx;
color: #292D33;
font-weight: 500;
margin-bottom: var(--fontSize8);
width: var(--fontSize307);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.task-item-text {
position: relative;
display: flex;
align-items: center;
font-size: var(--fontSize24);
margin-bottom: var(--fontSize4);
.task-item-label {
flex-shrink: 0;
width: var(--fontSize96);
color: #999EA8;
margin-right: var(--fontSize20);
}
.task-item-value {
color: #666666;
display: inline-flex;
align-items: center;
justify-content: center;
}
}
}
.dot-value {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background: #2CCA74;
margin-right: 8rpx;
}
.green {
color: #2CCA74;
}
.task-item-progress {
width: var(--fontSize129);
height: var(--fontSize12);
background: linear-gradient(128.8deg, rgba(117, 188, 255, .35) 0%, rgba(44, 102, 247, .35) 100%);
border-radius: var(--fontSize8);
}
.task-item-progress-text {
color: #3B73FF;
font-size: 24rpx;
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
}
.task-item-progress-bar {
height: 100%;
background: linear-gradient(128.8deg, #75bcff 0%, #2c66f7 100%);
border-radius: 8rpx;
}
.nothing {
width: 100%;
flex-direction: column;
margin-top: 270rpx;
font-size: var(--fontSize24);
color: #999999;
}
.nothing .icon {
width: var(--fontSize128);
height: var(--fontSize80);
margin-bottom: var(--fontSize8);
}
.end-text {
color: #999;
text-align: center;
padding-bottom: var(--fontSize30);
font-size: var(--fontSize24);
}
.flex {
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file \ No newline at end of file
<!--packageStudyCenter/pages/myTask/components/Task/Task.wxml-->
<view class="task-box">
<view class="tab-box">
<view class="tab-list">
<view
wx:for="{{tabList}}"
wx:key="index"
class="tab-item {{tabIndex === index ? 'active' : ''}}"
bindtap="handleTabClick"
data-index="{{index}}"
>
<view class="tab-item-title">{{item}}</view>
</view>
</view>
<view class="finish-tab" wx:if="{{tabIndex === 1}}">
<view
class="finish-tab-item {{finishIndex === 2 ? 'finish-active' : ''}}"
bindtap="handleFinishTabClick"
data-index="2"
>
长课程
</view>
<view
class="finish-tab-item {{finishIndex === 1 ? 'finish-active' : ''}}"
bindtap="handleFinishTabClick"
data-index="1"
>
短课程
</view>
</view>
</view>
<view class="tips" wx:if="{{tabIndex === 0}}">
<image class="icon-study-tips" src="{{IMG_URL}}studyCenter/warning.png" mode=""/>
<view class="tips-text">带有"限时学"标签的课程:规定时间内未完成任务,禁止提单!请按时学习。</view>
</view>
<block wx:if="{{taskList.length}}">
<view class="task-list">
<view
class="task-item"
wx:for="{{taskList}}"
wx:key="index"
bindtap="handleTaskItemClick"
data-item="{{item}}"
>
<card-item infoData="{{item}}" formItems="{{ item.courseType == 2 ? formItems : slitFormItems}}" customTop="{{true}}">
<view class="time-limit-tag" wx:if="{{tabIndex === 0 && item.punishType == 1}}"></view>
<view class="time-limit-countdown" wx:if="{{tabIndex === 0 && item.punishType == 1}}">
<block wx:if="{{item._timeout}}">
<view class="countdown-label timeout-label">已超时</view>
</block>
<block wx:elif="{{item._showCountdown}}">
<view class="countdown-label">剩</view>
<view class="countdown-num">{{item._countdownHour}}</view>
<view class="countdown-separator">:</view>
<view class="countdown-num">{{item._countdownMinute}}</view>
<view class="countdown-separator">:</view>
<view class="countdown-num">{{item._countdownSecond}}</view>
</block>
<block wx:elif="{{item._showDays}}">
<view class="countdown-label">剩</view>
<view class="countdown-num">{{item._leftDays < 10 ? '0' + item._leftDays : item._leftDays}}</view>
<view class="countdown-label">天</view>
</block>
<block wx:else>
<view class="countdown-label">剩</view>
<view class="countdown-num">--</view>
<view class="countdown-separator">:</view>
<view class="countdown-num">--</view>
<view class="countdown-separator">:</view>
<view class="countdown-num">--</view>
</block>
</view>
<image
class="task-item-img"
src="{{item.courseType === 1 ? IMG_URL + 'studyCenter/short-course-default.png' : IMG_URL + 'studyCenter/course-default-bg.png'}}"
mode="aspectFill"
/>
</card-item>
</view>
</view>
</block>
<block wx:else>
<view class="nothing flex">
<image class="icon" src="{{IMG_URL}}studyCenter/empty_data.png" />
暂无数据
</view>
</block>
<view class="end-text" wx:if="{{nothing && taskList.length}}">到底了!</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageStudyCenter/pages/myTask/components/WeeklyConversionRate/WeeklyConversionRate.js
Component({
properties: {
isFlag: {
type: Boolean,
value: false
},
dataInfo: {
type: Object,
value: {},
observer: function(newVal) {
this.updateAllData(true)
}
},
isHmzx: {
type: Boolean,
value: false
},
isYb: {
type: Boolean,
value: false
},
isBeisen: {
type: Boolean,
value: false
}
},
data: {
barList: [
{
label: '我的',
value: '74.3',
key: 'myConversionRatio',
class: 'my'
},
{
label: 'Top1',
value: '94.5',
key: 'topOneConversionRatio',
class: 'top1'
}
],
tabIndex: 0,
tabList: [],
currentConversionData: {},
barStyles: []
},
observers: {
'tabIndex': function(tabIndex) {
this.updateAllData();
}
},
lifetimes: {
attached() {
// 初始化时更新
this.updateAllData(true);
}
},
methods: {
updateAllData(updateTabFlag = false) {
const { dataInfo, tabIndex, barList } = this.data;
const weekConversionRatio = dataInfo && dataInfo.weekConversionRatio
// 更新tabList
if (updateTabFlag) this.updateTabList()
// 计算当前数据
let currentConversionData = {};
if (weekConversionRatio && this.data.tabList.length > 0 && this.data.tabList[tabIndex]) {
const key = this.data.tabList[tabIndex].value;
currentConversionData = weekConversionRatio[key] || {};
}
// 计算进度条样式
const barStyles = barList.map(item => {
const value = this.getNumberValue(currentConversionData[item.key]);
const width = Math.min(100, Math.max(2, value));
const left = value > 100 ? 100 : value;
const displayValue = value.toFixed(1);
return {
width: `${width}%`,
left: `calc(${left}%)`,
text: `${displayValue}%`
};
});
this.setData({
currentConversionData,
barStyles
});
},
updateTabList() {
const weekConversionRatio = this.properties.dataInfo && this.properties.dataInfo.weekConversionRatio
if (!weekConversionRatio) {
this.setData({ tabList: [] });
return;
}
const order = [0, 1, 2];
const tabArr = order
.filter(key => weekConversionRatio.hasOwnProperty(key))
.map(key => {
let title = '';
if (key == 0) title = '轻改';
else if (key == 1) title = '权益';
else if (key == 2) title = '延保';
else title = `类型${key}`;
return {
title,
value: key
};
});
this.setData({ tabList: tabArr }, () => {
// tabList更新后,检查是否需要调整tabIndex
if (tabArr.length > 0) {
const yanbaoIndex = tabArr.findIndex(item => item.value == 2);
let newTabIndex = 0;
if (yanbaoIndex !== -1) {
newTabIndex = yanbaoIndex;
}
if (this.data.tabIndex !== newTabIndex) {
this.setData({ tabIndex: newTabIndex });
}
}
});
},
getNumberValue(value) {
return Number(value) || 0
},
handleTabClick(e) {
const index = e.currentTarget.dataset.index
this.setData({ tabIndex: index })
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageStudyCenter/pages/myTask/components/WeeklyConversionRate/WeeklyConversionRate.wxss */
.study-box2 {
width: calc(100% - var(--fontSize56));
box-sizing: border-box;
border-radius: var(--fontSize24);
background: #ffffff;
padding: var(--fontSize24);
margin: 0 var(--fontSize28) var(--fontSize20);
}
.tab-list {
display: flex;
width: 100%;
height: var(--fontSize64);
background-color: #F5F6F7;
border-radius: var(--fontSize12);
color: #666666;
font-size: var(--fontSize24);
}
.tab-item {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
margin: var(--fontSize4);
}
.tab-item.active {
background-color: #fff;
color: #1A1A1A;
border-radius: 10rpx;
}
.rank-title {
font-size: var(--fontSize28);
color: #1A1A1A;
margin-left: var(--fontSize8);
display: flex;
align-items: flex-end;
}
.rank-value {
display: flex;
align-items: baseline;
margin-left: var(--fontSize12);
color: #3B73FF;
font-size: var(--fontSize22);
font-weight: 500;
margin-top: var(--fontSize16);
margin-left: var(--fontSize8);
.rank-number {
font-size: var(--fontSize40);
font-weight: 700;
margin-right: var(--fontSize4);
}
}
.bar-box {
margin-top: var(--fontSize32);
position: relative;
.line {
width: var(--fontSize2);
height: var(--fontSize88);
background: #CFD4E3;
position: absolute;
top: 0;
left: var(--fontSize68);
}
}
.bar-item {
display: flex;
align-items: center;
margin-bottom: 20rpx;
padding-right: 120rpx;
}
.bar-item:last-child {
margin-bottom: 22rpx;
}
.bar-label {
display: inline-block;
width: 60rpx;
text-align: right;
margin-right: 10rpx;
font-size: 22rpx;
}
.bar-container {
position: relative;
flex: 1;
height: 12rpx;
}
.bar {
height: 100%;
border-radius: 0 var(--fontSize8) var(--fontSize8) 0;
}
.bar.top1 {
background: linear-gradient(90deg, #708dff 0%, #6858f5 100%);
}
.bar.my {
background: linear-gradient(90deg, #389fff 0%, #2c66f7 100%);
}
.bar-text {
margin-left: 20rpx;
position: absolute;
top: 50%;
transform: translateY(-50%);
white-space: nowrap;
font-size: 22rpx;
}
\ No newline at end of file \ No newline at end of file
<!--packageStudyCenter/pages/myTask/components/WeeklyConversionRate/WeeklyConversionRate.wxml-->
<view class="study-box2 {{!isBeisen && (!isHmzx || !isYb) ? 'all-height' : ''}} {{isBeisen && (!isHmzx || !isYb) ? 'big-height' : ''}}">
<view class="tab-list">
<view
wx:for="{{tabList}}"
wx:key="index"
class="tab-item {{tabIndex === index ? 'active' : ''}}"
bindtap="handleTabClick"
data-index="{{index}}"
>
<view class="tab-item-title">{{item.title}}</view>
</view>
</view>
<view class="rank-title">
<view>周转化率排名</view>
<view class="rank-value">
<view class="rank-number">{{currentConversionData.top || '-'}}</view>名
</view>
</view>
<view class="bar-box">
<view class="line"></view>
<view class="bar-item" wx:for="{{barList}}" wx:key="index" wx:for-index="idx">
<view class="bar-label">{{item.label}}</view>
<view class="bar-container">
<view
class="bar {{item.class}}"
style="width: {{barStyles[idx] ? barStyles[idx].width : '0%'}}"
></view>
<view
class="bar-text"
style="left: {{barStyles[idx] ? barStyles[idx].left : '0%'}}"
>{{barStyles[idx] ? barStyles[idx].text : '0.0%'}}</view>
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageStudyCenter/pages/myTask/myTask.js
import api from '../../api'
import commonApi from '~/api/api'
Page({
/**
* 页面的初始数据
*/
data: {
labelColors: [],
dataInfo: {},
isBeisen: false,
isHmzx: false,
isYb: false,
tabList: ['我的任务', '更多课程'],
tabIndex: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getBeisenToken(true)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getStudyBoard()
},
async getBeisenToken(getHeightFlag) {
try {
wx.showLoading({
title: '加载中',
mask: true
})
const [accountRes, ssoRes] = await Promise.all([
commonApi.getListSelectAccount().catch(error => null),
commonApi.findBeiSenSSOToken({}).catch(error => null)
])
wx.hideLoading()
let isBeisen = !!ssoRes?.data
let isHmzx = false
let isYb = false
if (!isBeisen) { // 没有北森权限不展示更多课程
this.setData({
tabList: ['我的任务', ''] // 兼容tabBar组件,将不展示tab置为空,不然样式异常 空值是不能点击的不影响功能
})
}
// 如果获取账户信息成功,继续请求权限
if (accountRes?.code == 0) {
const yqMerchantIdList = accountRes.data?.loginUserInfoList.map(item => item.merchantId) || []
const permissionRes = await commonApi.getStudyCenterPermission({yqMerchantIdList}).catch(error => null)
isHmzx = permissionRes?.data?.hmzxAuth || false;
isYb = permissionRes?.data?.authorizedBusinessList?.includes(1) || false
}
this.setData({
isBeisen,
isHmzx,
isYb
}, () => {
this.getStudyBoard(getHeightFlag)
});
} catch (error) {
this.getStudyBoard(getHeightFlag)
}
},
async getStudyBoard(getHeightFlag) {
const res = await api.getStudyBoard({})
this.setData({dataInfo: res.data || {}})
// 虚增已完成学习学员比例
const boostRatio = (val) => {
const numVal = Number(val)
if (isNaN(numVal)) return val
if (numVal < 60) {
return String(numVal + 30)
} else if (numVal >= 60 && numVal < 90) {
return '90'
} else {
return String(numVal)
}
}
let { dataInfo } = this.data
if (dataInfo) {
if (dataInfo.shortCourseCompletedLearnRatio !== undefined && dataInfo.shortCourseCompletedLearnRatio !== null) {
this.setData({
'dataInfo.shortCourseCompletedLearnRatio': boostRatio(dataInfo?.shortCourseCompletedLearnRatio)
})
}
if (dataInfo.longCourseCompletedLearnRatio !== undefined && dataInfo.longCourseCompletedLearnRatio !== null) {
this.setData({
'dataInfo.longCourseCompletedLearnRatio': boostRatio(dataInfo?.longCourseCompletedLearnRatio)
})
}
}
const _chartData = {
categories: res.data?.abilityAnalysisTag,
series: [
{
data: res.data?.abilityAnalysisScore
}
]
}
this.setData({
chartData: _chartData
})
// 设置雷达图标签颜色,1为红色,否则为灰色
if (_chartData.series && _chartData.series[0] && Array.isArray(_chartData.series[0].data)) {
const dataArr = _chartData.series[0].data;
let _labelColors = [];
if (dataArr.every(val => val === 0)) {
_labelColors = [];
} else {
_labelColors = dataArr.map(val => val === 1 ? '#EB4E4E' : '#666666');
}
this.setData({
chartData: _chartData,
labelColors: _labelColors
}, () => {
if (getHeightFlag) {
setTimeout(() => {
// 获取tab位置
const query = wx.createSelectorQuery()
// 获取tab栏距离页面顶部的初始位置
query.select('.tab-bar-box').boundingClientRect((tabRect) => {
this.setData({
tabScrollTop: tabRect.top
})
}).exec()
this.setData({allowScroll: true})
}, 150)
}
})
}
},
tabClick(e) {
this.setData({
tabIndex: e.detail
}, () => {
this.setScrollTopEvent()
})
},
setScrollTopEvent() {
let { scrollTop, tabScrollTop } = this.data
if (scrollTop >= tabScrollTop) {
setTimeout(() => {
this.setData({
setScrollTop: tabScrollTop
})
}, 200)
}
},
onPageScroll(e) {
const scrollTop = e.detail.scrollTop
this.setData({ scrollTop })
},
scrollonReachBottom() {
let { tabIndex } = this.data
if (tabIndex == 0) {
this.selectComponent(`#task-page`)?.pageonReachBottom && this.selectComponent(`#task-page`).pageonReachBottom()
} else {
this.selectComponent('#recommend-page')?.pageonReachBottom && this.selectComponent(`#recommend-page`).pageonReachBottom()
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!