持续测试优化

This commit is contained in:
axlrose2333 2023-04-04 18:21:45 +08:00
parent a3c4468ee9
commit ae7e71da1c
5 changed files with 115 additions and 25 deletions

View File

@ -13,6 +13,27 @@ const custom = {
} }
return arr return arr
}, },
get_course_category_name(data,subject_id){ // 根据id 获取名称
let name = ''
if(!data || !subject_id) {
return ''
}
for(let i = 0;i<data.length;i++) {
if(name){
return name
}
else{
if(data[i].id == subject_id ) {
name = data[i].name
break
}
else if(data[i].children){
name = custom.get_course_category_name(data[i].children,subject_id)
}
}
}
return name
},
getExercisesTypeList() { getExercisesTypeList() {
return [ return [
{ {

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
// //
// import _ from 'lodash' import _ from 'lodash'
import api from '@/api/course' import api from '@/api/course'
import com_api from '@/api/common' import com_api from '@/api/common'
import custom from '@/utils/custom' import custom from '@/utils/custom'
@ -23,9 +23,10 @@ const subjectParams = ref({
pageSize:100, pageSize:100,
}) })
const subjectList = ref([]) const subjectList = ref([])
const subjectList_inject =ref([])
const rules = ref({ const rules = ref({
name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }], name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }],
subject: [{ required: true, message: '请选择课程科目', trigger: 'change' }], course_category_id: [{ required: true, message: '请选择课程科目', trigger: 'change' }],
price: [{ required: true, message: '请输入课程价格', trigger: 'blur' }] price: [{ required: true, message: '请输入课程价格', trigger: 'blur' }]
}) })
const ruleFormRef = ref(null) const ruleFormRef = ref(null)
@ -40,7 +41,7 @@ onMounted(() => {
} }
getSubject() getSubject()
}) })
provide('subjectList', subjectList) provide('subjectList', subjectList_inject)
provide('current_subject', current_subject) provide('current_subject', current_subject)
// //
async function getCourseInfo() { // async function getCourseInfo() { //
@ -84,9 +85,10 @@ const submitForm = async (formEl) => {
}) })
} }
async function saveStep1() { async function saveStep1() {
form.value.course_category_id = subjectList.value.filter((item,i) => { // form.value.course_category_id = subjectList.value.filter((item,i) => {
return item.name === form.value.subject // return item.name === form.value.subject
})[0].id // })[0].id
form.value.subject = custom.get_course_category_name(form.value.course_category_id)
form.value.price = parseFloat(form.value.price)<0?0:form.value.price form.value.price = parseFloat(form.value.price)<0?0:form.value.price
if(!checkFreeTestFromPrice()) { if(!checkFreeTestFromPrice()) {
ElMessage({ ElMessage({
@ -99,7 +101,7 @@ async function saveStep1() {
...form.value ...form.value
} }
} }
params.step1.price = parseFloat(params.step1.price)*100 params.step1.price = parseInt(parseFloat(params.step1.price)*100)
let func_name ='' let func_name =''
if(course_id.value) { // if(course_id.value) { //
params.course_id = parseInt(course_id.value) params.course_id = parseInt(course_id.value)
@ -123,7 +125,9 @@ async function getSubject(){ // 获取课程分类
const res = await api.getSubjectList(subjectParams.value) const res = await api.getSubjectList(subjectParams.value)
if(res.code === 0) { if(res.code === 0) {
// subjectList.value = custom.getStdSubject(res.data.records) // subjectList.value = custom.getStdSubject(res.data.records)
subjectList.value = custom.addTreeFormatSubject(res.data.records,'id') // subjectList.value = custom.addTreeFormatSubject(res.data.records,'id')
subjectList_inject.value = custom.addTreeFormatSubject(_.cloneDeep(res.data.records),'name')
subjectList.value = custom.addTreeFormatSubject( _.cloneDeep(res.data.records),'id')
} }
} }
async function uploadAction(file){// oss async function uploadAction(file){// oss
@ -275,7 +279,7 @@ function goListFunc() {
<el-form-item label="课程名称" prop="name"> <el-form-item label="课程名称" prop="name">
<el-input disabled placeholder="请输入课程名称" v-model="form.name" @change="handlerChange" /> <el-input disabled placeholder="请输入课程名称" v-model="form.name" @change="handlerChange" />
</el-form-item> </el-form-item>
<el-form-item label="课程分类" prop="subject"> <el-form-item label="课程分类" prop="course_category_id">
<!-- <el-select disabled v-model="form.subject" placeholder="请选择" @change="handlerChange">--> <!-- <el-select disabled v-model="form.subject" placeholder="请选择" @change="handlerChange">-->
<!-- <el-option--> <!-- <el-option-->
<!-- v-for="item in subjectList"--> <!-- v-for="item in subjectList"-->
@ -284,7 +288,7 @@ function goListFunc() {
<!-- :value="item.name"--> <!-- :value="item.name"-->
<!-- />--> <!-- />-->
<!-- </el-select>--> <!-- </el-select>-->
<el-tree-select v-model="form.subject" :data="subjectList" :render-after-expand="false" /> <el-tree-select v-model="form.course_category_id" :data="subjectList" disabled="true" :render-after-expand="false" />
</el-form-item> </el-form-item>
<el-form-item label="封面"> <el-form-item label="封面">
<el-upload <el-upload

View File

@ -157,6 +157,7 @@ const drawFormRules = ref({
full_member:[{ required: true, message: '请输入满员人数', trigger: 'blur'}, full_member:[{ required: true, message: '请输入满员人数', trigger: 'blur'},
{ type: 'number', message: '请输入正确的格式' }], { type: 'number', message: '请输入正确的格式' }],
end_time:[{ required: true, message: '请输入截止时间', trigger: 'blur' }], end_time:[{ required: true, message: '请输入截止时间', trigger: 'blur' }],
delay_time:[{ required: true, message: '请输入砸蛋时间', trigger: 'blur' }],
begin_time:[{ required: true, message: '请输入开始时间', trigger: 'blur' }], begin_time:[{ required: true, message: '请输入开始时间', trigger: 'blur' }],
product_cover:[{ required: true, message: '请选择商品封面', trigger: 'blur' }], product_cover:[{ required: true, message: '请选择商品封面', trigger: 'blur' }],
egg_quantity:[{ required: true, message: '请输入金蛋数量', trigger: 'blur'}, egg_quantity:[{ required: true, message: '请输入金蛋数量', trigger: 'blur'},
@ -273,7 +274,7 @@ async function drawStateFunc(row,type) { //竞拍上架 下架
if(action === 'confirm') { if(action === 'confirm') {
const res = await api.drawStateFunc({id:row.id,status:type}) const res = await api.drawStateFunc({id:row.id,status:type})
if(res.code === 0) { if(res.code === 0) {
ElMessage({ ElMessage({
type: 'success', type: 'success',
message: `修改成功`, message: `修改成功`,
}) })
@ -303,6 +304,43 @@ async function viewAuctionFunc(row) { // 竞拍明细
viewInfo.value = res.data.list viewInfo.value = res.data.list
} }
} }
function memberFunc() {
drawForm.value.egg_quantity = drawForm.value.full_member
}
const egg_mask = ref(true)
function getRandomNumber() {
if(!drawForm.value.full_member) {
ElMessage({
type: 'warning',
message: `请先输入满员人数`,
})
drawForm.value.prize_number = ''
return
}
if(!drawForm.value.delay_time) {
ElMessage({
type: 'warning',
message: `请先设置砸蛋时间`,
})
drawForm.value.prize_number = ''
return
}
let rand_num = Math.random()
let rand_res = 1
if(!rand_num){
rand_num = 1
}
rand_res = Math.ceil(rand_num*drawForm.value.full_member)
// console.log(drawForm.value.end_time)
if(drawForm.value.delay_time < (Date.parse(new Date()))) { //
egg_mask.value = false
}
else{ //
egg_mask.value = true
}
drawForm.value.prize_number = rand_res
}
</script> </script>
<template> <template>
<div> <div>
@ -370,6 +408,11 @@ async function viewAuctionFunc(row) { // 竞拍明细
{{custom.timestampToDate2(scope.row.end_time)}} {{custom.timestampToDate2(scope.row.end_time)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="砸蛋日期" min-width="150" >
<template #default="scope">
{{custom.timestampToDate2(scope.row.delay_time)}}
</template>
</el-table-column>
<el-table-column align="center" label="已参与人数" min-width="150" prop="in_member" /> <el-table-column align="center" label="已参与人数" min-width="150" prop="in_member" />
<el-table-column align="center" label="金蛋数量" min-width="150" prop="egg_quantity" /> <el-table-column align="center" label="金蛋数量" min-width="150" prop="egg_quantity" />
@ -472,7 +515,7 @@ async function viewAuctionFunc(row) { // 竞拍明细
<el-input v-model.number="drawForm.in_point" placeholder="请输入参与积分" autocomplete="off" /> <el-input v-model.number="drawForm.in_point" placeholder="请输入参与积分" autocomplete="off" />
</el-form-item> </el-form-item>
<el-form-item prop="full_member" label="满员人数" > <el-form-item prop="full_member" label="满员人数" >
<el-input v-model.number="drawForm.full_member" placeholder="请输入满员人数" autocomplete="off" /> <el-input @change="memberFunc" v-model.number="drawForm.full_member" placeholder="请输入满员人数" autocomplete="off" />
</el-form-item> </el-form-item>
<el-form-item label="开始日期" prop="begin_time" > <el-form-item label="开始日期" prop="begin_time" >
<el-date-picker <el-date-picker
@ -492,11 +535,23 @@ async function viewAuctionFunc(row) { // 竞拍明细
value-format="x" value-format="x"
/> />
</el-form-item> </el-form-item>
<el-form-item label="金蛋数量" prop="egg_quantity"> <el-form-item label="砸蛋日期" prop="delay_time" >
<el-input v-model.number="drawForm.egg_quantity" placeholder="请输入金蛋数量" autocomplete="off" /> <el-date-picker
v-model="drawForm.delay_time"
type="datetime"
placeholder="砸蛋日期"
format="YYYY-MM-DD HH:mm:ss"
value-format="x"
/>
</el-form-item> </el-form-item>
<el-form-item label="中奖号码" prop="prize_number"> <el-form-item label="金蛋数量" prop="egg_quantity">
<el-input v-model.number="drawForm.prize_number" placeholder="请输入中奖号码" autocomplete="off" /> <el-input v-model.number="drawForm.egg_quantity" disabled="true" placeholder="请输入金蛋数量" autocomplete="off" />
</el-form-item>
<el-form-item style="position:relative" label="中奖号码" prop="prize_number">
<el-input v-model.number="drawForm.prize_number" disabled placeholder="请设置中奖号码" autocomplete="off" />
<div class="egg-mask" v-if="egg_mask && drawForm.prize_number">已生成中奖号码活动结束后方可观看</div>
<div class="egg-mask" v-else-if="egg_mask && !drawForm.prize_number">请点击下方生成中奖号码活动结束后方可观看</div>
<el-button size="small" type="plain" @click="getRandomNumber">随机生成</el-button>
</el-form-item> </el-form-item>
<!-- <el-form-item label="奖品装蛋" >--> <!-- <el-form-item label="奖品装蛋" >-->
<!-- <el-switch @change="loadingEggChange" v-model="drawForm.loading_egg" active-text="" inactive-text="" :active-value="true" inactive-value="false" />--> <!-- <el-switch @change="loadingEggChange" v-model="drawForm.loading_egg" active-text="" inactive-text="" :active-value="true" inactive-value="false" />-->
@ -556,6 +611,16 @@ async function viewAuctionFunc(row) { // 竞拍明细
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.egg-mask{
position: absolute;
left: 0px;
background: #e7e7e7;
width: 100%;
height: 50%;
top: 0px;
color: #999999;
padding: 0 10px;
}
.form-box{ .form-box{
padding: 10px; padding: 10px;
} }

View File

@ -105,12 +105,12 @@ function toDealDetail(type) {
<div class="bb-item"> <div class="bb-item">
注册时间{{custom.dateFmt(teacherInfo.CreatedAt)}} 注册时间{{custom.dateFmt(teacherInfo.CreatedAt)}}
</div> </div>
<div class="bb-item"> <!-- <div class="bb-item">-->
身份教师 <!-- 身份教师-->
</div> <!-- </div>-->
<div class="bb-item"> <!-- <div class="bb-item">-->
邀请人数105 <!-- 邀请人数105-->
</div> <!-- </div>-->
</div> </div>
</div> </div>
<!-- 章节信息--> <!-- 章节信息-->
@ -137,11 +137,11 @@ function toDealDetail(type) {
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">就职单位</div> <div class="di-left">就职单位</div>
<div class="di-right">重庆大学</div> <div class="di-right">{{teacherInfo.college}}</div>
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">任职行业</div> <div class="di-left">任职行业</div>
<div class="di-right">金融</div> <div class="di-right">{{teacherInfo.major}}</div>
</div> </div>
</div> </div>
<div class="dib-row"> <div class="dib-row">

View File

@ -109,7 +109,7 @@ function handleSizeChange(val) {
getTeacherList() getTeacherList()
} }
function viewTeacherFunc(row) { // function viewTeacherFunc(row) { //
router.push({name:'teacherDetail',params:{id:row.teacher_info_id}}) router.push({name:'teacherDetail',params:{id:row.user_id}})
} }
// //
const p_visible = ref(false) const p_visible = ref(false)