@ -0,0 +1,139 @@ |
||||
<template> |
||||
<view> |
||||
<u-loading-page :loading="getLoading" loading-text="题库更新中..."></u-loading-page> |
||||
<view class="relative" v-if="!getLoading" |
||||
style="width: 100%;background-image: url(https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E8%80%83%E5%89%8D%E5%AF%86%E5%8D%B7_20230904212623.png);background-size: 100% 100%;height: 100vh;"> |
||||
<view style="position: absolute;top: 320px;" class="wp100 p35lr flex jc-sb ai-c"> |
||||
<view class="paper_item" @tap="toExam({isExam1:'1'})"> |
||||
<view class="topTitle"> |
||||
秘卷一 |
||||
</view> |
||||
<view class="bottom"> |
||||
<text class="wenzi">新规考点提炼</text> |
||||
<view class="wp100 p5 mt15"> |
||||
<view class="btn"> |
||||
去考试 |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="paper_item" @tap="toExam({isExam2:'1'})"> |
||||
<view class="topTitle"> |
||||
秘卷二 |
||||
</view> |
||||
<view class="bottom"> |
||||
<text class="wenzi">精选高频考试</text> |
||||
<view class="wp100 p5 mt15"> |
||||
<view class="btn"> |
||||
去考试 |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
mapState, |
||||
mapActions |
||||
} from 'pinia' //引入映射函数 |
||||
import useQuestionStore from '@/jtools/store/question' //引入store |
||||
import storage from '@/jtools/storage'; |
||||
import { |
||||
queryQuestionId, |
||||
getTestQuestionId |
||||
} from '@/jtools/api/question'; |
||||
export default { |
||||
data() { |
||||
return { |
||||
subject:'1' |
||||
} |
||||
}, |
||||
onLoad(op){ |
||||
if(op.subject){ |
||||
this.subject=op.subject |
||||
} |
||||
}, |
||||
computed: { |
||||
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1", "curSubject","version"]), //映射函数,取出tagslist |
||||
getLoading() { |
||||
return this.loading_subject4 && this.loading_subject1 |
||||
} |
||||
}, |
||||
methods: { |
||||
...mapActions(useQuestionStore, ['getOrderQuestion_sub4', 'getOrderQuestion_sub1', 'changeSubject']), |
||||
toExam(param) { |
||||
queryQuestionId({ |
||||
versionId: this.version, |
||||
carTypeId: storage.get('carType') || '1001', |
||||
subject: this.subject, |
||||
...param |
||||
}).then(async (resp) => { |
||||
if (resp.code === '0000') { |
||||
const arr = resp.data |
||||
const listJson = JSON.stringify(arr) |
||||
uni.navigateTo({ |
||||
url: "/pages/questionBank/practiceExams?title=考前秘卷&subject=" + this.subject + "&questionIdList=" + listJson |
||||
}) |
||||
} |
||||
}) |
||||
|
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.paper_item { |
||||
width: 287rpx; |
||||
height: 320rpx; |
||||
/* border: 4px solid #F8A42C; */ |
||||
border-radius: 16rpx; |
||||
} |
||||
|
||||
.topTitle { |
||||
width: 100%; |
||||
height: 85rpx; |
||||
line-height: 85rpx; |
||||
text-align: center; |
||||
background: linear-gradient(90deg, #E66501 0%, #F8A42C 100%); |
||||
border-radius: 16rpx 16rpx 0rpx 0rpx; |
||||
font-size: 48rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 600; |
||||
color: #FFFFFF; |
||||
} |
||||
|
||||
.bottom { |
||||
padding-top: 15px; |
||||
width: 100%; |
||||
height: 235rpx; |
||||
border-radius: 0rpx 0rpx 16rpx 16rpx; |
||||
border-bottom: 4px solid #F8A42C; |
||||
border-left: 4px solid #F8A42C; |
||||
border-right: 4px solid #F8A42C; |
||||
text-align: center; |
||||
} |
||||
|
||||
.wenzi { |
||||
font-size: 40rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 600; |
||||
color: #7D4310; |
||||
line-height: 48rpx; |
||||
} |
||||
|
||||
.btn { |
||||
width: 246rpx; |
||||
height: 76rpx; |
||||
text-align: center; |
||||
line-height: 76rpx; |
||||
color: #fff; |
||||
background: linear-gradient(0deg, #E66501 0%, #F8A42C 100%); |
||||
box-shadow: 0rpx 2rpx 21rpx 0rpx #F7A12A; |
||||
border-radius: 38rpx; |
||||
} |
||||
</style> |
@ -1,42 +1,222 @@ |
||||
<template> |
||||
<view class="p15 bc-f5"> |
||||
<view class="br8 bc-fff p15lr"> |
||||
<view class="flex ai-c bb1" style="height: 110rpx;"> |
||||
<view class="title">体检结果</view> |
||||
<view class="ml30 fs14 cor-333 fl1">通过</view> |
||||
</view> |
||||
<view class="flex ai-c" style="height: 110rpx;"> |
||||
<view class="title">体检时间</view> |
||||
<view class="ml30 fs14 cor-333 fl1">2023-08-10 14:35:23</view> |
||||
</view> |
||||
<view class="flex ai-fs" style="height: 110rpx;"> |
||||
<view class="title">体检时间</view> |
||||
<image class="ml30" src="/static/image/mine/tijian.png" style="width: 333rpx;" mode="widthFix"></image> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class=""> |
||||
<view class="wp100 bc-fff p14"> |
||||
<view class="title fontColor">第一步 上传学员图像</view> |
||||
<view class="mt15"> |
||||
<!-- <u-upload width="165" height="165" :file-list=" fileList1" multiple :max-count="1" @afterRead="afterRead" @delete="deletePic" /> --> |
||||
<!-- <u-upload ref="uUpload" class="mt25" :size-type="['compressed']" :file-list="fileList1" deletable :multiple="false" :max-count="1" width="165rpx" height="165rpx" @afterRead="afterRead" @delete="deletePic" /> --> |
||||
<view style="width: 320rpx;height:300rpx;background-color: rgb(247, 255, 255);border-radius: 20rpx;"> |
||||
<view style="width: 320rpx;height:240rpx;" class="flex jc-c ai-c"> |
||||
<image v-if="fileList&&fileList.length" style="width: 240rpx;height: 240rpx;" :src="fileList[0].url"> |
||||
</image> |
||||
<u-avatar v-else class="br-p50 overflow-h" :size="64" mp-avatar shape="circle"></u-avatar> |
||||
</view> |
||||
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" multiple :maxCount="1" width="150" |
||||
height="150"> |
||||
<view |
||||
style="width: 320rpx;height:60rpx;line-height:60rpx;background-color: #05C341;border-radius: 0 0 20rpx 20rpx;" |
||||
class="text-center cor-fff"> |
||||
点击 |
||||
</view> |
||||
</u-upload> |
||||
</view> |
||||
</view> |
||||
<view class="mt20"> |
||||
<view class="title fontColor">第二步 核实后再提交</view> |
||||
<u--form labelPosition="left" labelWidth="80" :model="form" :rules="rules" ref="form1"> |
||||
<u-form-item label="姓名" :required="true" prop="name" borderBottom ref="item1"> |
||||
<u--input v-model="form.name" border="none"></u--input> |
||||
</u-form-item> |
||||
<u-form-item label="身份证号" :required="true" prop="idNum" borderBottom ref="item2"> |
||||
<u--input v-model="form.idNum" border="none"></u--input> |
||||
</u-form-item> |
||||
</u--form> |
||||
</view> |
||||
<view style="margin-top: 20px;"> |
||||
<u-button type="primary" :style="{width: '100%',borderRadius:'40rpx',backgroundColor:'#05C341'}" :disabled="saving" text="提交" |
||||
@click="submit" /> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
data() { |
||||
return { |
||||
|
||||
} |
||||
}, |
||||
methods: { |
||||
|
||||
} |
||||
} |
||||
import storage from '@/jtools/storage'; |
||||
export default { |
||||
data() { |
||||
const shenfenzhen = (rule, value, callback) => { |
||||
/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value) ? callback() : callback( |
||||
new Error('请输入正确的身份证号')) |
||||
} |
||||
return { |
||||
form: { |
||||
name: '', |
||||
idNum: '' |
||||
}, |
||||
fileList:[], |
||||
fileList1: [], |
||||
uploadList: [], |
||||
saving: false, |
||||
rules: { |
||||
name: [{ |
||||
required: true, |
||||
message: '请输入姓名', |
||||
trigger: ['blur', 'change'] |
||||
}], |
||||
idNum: [{ |
||||
required: true, |
||||
message: '请输入身份证号', |
||||
trigger: ['blur', 'change'] |
||||
},{ |
||||
// 自定义验证函数,见上说明 |
||||
validator: shenfenzhen, |
||||
message: '身份证号码不正确', |
||||
// 触发器可以同时用blur和change |
||||
trigger: ['change', 'blur'], |
||||
}] |
||||
} |
||||
}; |
||||
}, |
||||
onReady() { |
||||
if(storage.get('photoForm')){ |
||||
this.fileList=storage.get('photoForm').file |
||||
this.form={ |
||||
name: storage.get('photoForm').name, |
||||
idNum: storage.get('photoForm').idNum |
||||
} |
||||
} |
||||
this.$refs.form1.setRules(this.rules); |
||||
}, |
||||
methods: { |
||||
// 删除图片 |
||||
deletePic(event) { |
||||
this.fileList1.splice(event.index, 1); |
||||
this.uploadList.splice(event.index, 1); |
||||
}, |
||||
// 新增图片 |
||||
async afterRead(event) { |
||||
// this.compressImage(event.file); |
||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
||||
const lists = [].concat(event.file); |
||||
this.fileList=lists |
||||
this.fileList1 = []; |
||||
uni.showToast({ |
||||
title:'上传成功!' |
||||
}) |
||||
}, |
||||
uploadFilePromise(url) { |
||||
this.saving = true; |
||||
return new Promise((resolve, reject) => { |
||||
uni.uploadFile({ |
||||
url: process.env.VUE_APP_BASE_API + 'mongodb/uploadFile', // 仅为示例,非真实的接口地址 |
||||
filePath: url, |
||||
name: 'file', |
||||
success: (res) => { |
||||
// setTimeout(() => { |
||||
resolve(JSON.parse(res.data).data); |
||||
// }, 100); |
||||
this.saving = false; |
||||
}, |
||||
fail: () => { |
||||
resolve(null); |
||||
this.saving = false; |
||||
} |
||||
}); |
||||
}); |
||||
}, |
||||
// 提交 |
||||
submit() { |
||||
this.$refs.form1.validate().then((valid) => { |
||||
if (valid) { |
||||
const param={ |
||||
file:this.fileList, |
||||
...this.form |
||||
} |
||||
storage.set('photoForm',param) |
||||
uni.showToast({ |
||||
title:"提交成功!", |
||||
duration:2000, |
||||
}) |
||||
setTimeout(()=>{ |
||||
uni.navigateBack() |
||||
},1000) |
||||
} else { |
||||
console.log('验证失败'); |
||||
} |
||||
}); |
||||
|
||||
}, |
||||
async compressImage(image) { |
||||
const img = new Image(); |
||||
img.src = image.url; |
||||
|
||||
img.onload = async () => { |
||||
const canvas = document.createElement('canvas'); // 创建Canvas对象(画布) |
||||
const context = canvas.getContext('2d'); |
||||
// 默认按比例压缩 |
||||
const cw = img.width; |
||||
const ch = img.height; |
||||
let w = img.width; |
||||
let h = img.height; |
||||
canvas.width = w; |
||||
canvas.height = h; |
||||
if (cw > 400 && cw > ch) { |
||||
w = 400; |
||||
h = (400 * ch) / cw; |
||||
canvas.width = w; |
||||
canvas.height = h; |
||||
} |
||||
if (ch > 400 && ch > cw) { |
||||
h = 400; |
||||
w = (400 * cw) / ch; |
||||
canvas.width = w; |
||||
canvas.height = h; |
||||
} |
||||
// 生成canvas |
||||
let base64; |
||||
// 创建属性节点 |
||||
context.clearRect(0, 0, 0, w, h); |
||||
context.drawImage(img, 0, 0, w, h); |
||||
if (image.size > 2000000) { |
||||
// 如果图片超过2m,则进行压缩 |
||||
base64 = canvas.toDataURL(image['type'], 0.5); |
||||
} |
||||
const result = await this.uploadFilePromise(base64 || image.url); |
||||
this.uploadList.push(result); |
||||
}; |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.title { |
||||
width: 120rpx; |
||||
font-size: 14px; |
||||
color: #666; |
||||
} |
||||
.bb1 { |
||||
border-bottom: 1px solid #eee; |
||||
} |
||||
</style> |
||||
.upload-img { |
||||
width: 165rpx; |
||||
height: 165rpx; |
||||
border: 1px dashed #c4c4c4; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
|
||||
.fontColor { |
||||
color: #383838; |
||||
font-weight: 400; |
||||
} |
||||
|
||||
::v-deep .u-textarea__count { |
||||
background-color: #f9faf9 !important; |
||||
} |
||||
|
||||
::v-deep .u-upload__button>.u-icon>.u-icon__icon { |
||||
font-size: 90rpx !important; |
||||
} |
||||
|
||||
::v-deep .u-button--square { |
||||
border-radius: 40rpx !important; |
||||
} |
||||
::v-deep .u-button--primary{ |
||||
background-color: #05C341 !important; |
||||
border-color: #05C341 !important; |
||||
} |
||||
</style> |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 4.7 KiB |