Compare commits

...

9 Commits

Author SHA1 Message Date
qsh a684d255d2 sc 4 days ago
qsh 70fe0f0c42 sc 4 days ago
qsh 62896b197d sc 5 days ago
qsh 9b677ade15 sc 5 days ago
qsh 4bd08bde70 sc 5 days ago
qsh e889c92d35 sc 2 weeks ago
qsh 7442289a87 sc 2 weeks ago
qsh d70a0141cc sc 3 months ago
qsh 459baca3f8 sc 3 months ago
  1. 1
      .env.development
  2. 379
      src/jtools/store/question.js
  3. 121
      src/pages.json
  4. 3
      src/pages/index/components/Subject1.vue
  5. 8
      src/pages/index/index.vue
  6. 12
      src/pages/index/trueTest.vue
  7. 6
      src/pages/login/login.vue
  8. 20
      src/pages/me/index.vue
  9. 14
      src/pages/me/info.vue
  10. 214
      src/pages/me/tijian.vue
  11. 2
      src/pages/questionBank/components/Question.vue
  12. 21
      src/pages/questionBank/examResult.vue

@ -6,6 +6,7 @@ VITE_APP_ENV = 'development'
# 金武联驾校/开发环境
VITE_APP_BASE_API = 'https://jwl.ahduima.com/'
# VITE_APP_BASE_API = 'http://tk-api.ahfkbg.com/'
#
VITE_WEB_BASE_URL = 'https://jwl.ahduima.com'
# 资源地址

@ -1,238 +1,157 @@
import {
defineStore
} from 'pinia';
import { defineStore } from 'pinia';
import http from '@/jtools/request/index';
import {
queryQuestion,
getVersion,
querySysConfig
} from '@/jtools/api/question';
import { queryQuestion, getVersion, querySysConfig } from '@/jtools/api/question';
import storage from '@/jtools/storage';
let JSON_SPLIT_LENGTH = 10;
const question = defineStore({
id: 'question',
state: () => ({
currentCartype: storage.get('carType') || '1001',
currentCarName: storage.get('carName') || '小车C1/C2/C3',
orderQuestion_subject1: storage.get('question_subject1') || [], //科目一顺序做题
orderQuestion_subject4: storage.get('question_subject4') || [], //科目四顺序做题
currentIndex_subject1: 0, //科目一索引 顺序做题
currentIndex_subject4: 0, //科目四索引 顺序做题
curSubject: storage.get('curSubject') || '1',
loading_subject1: false,
loading_subject4: false,
version: storage.get('version') || ''
}),
id: 'question',
state: () => ({
currentCartype: storage.get('carType') || '1001',
currentCarName: storage.get('carName') || '小车C1/C2/C3',
orderQuestion_subject1: [], //科目一顺序做题
orderQuestion_subject4: [], //科目四顺序做题
currentIndex_subject1: 0, //科目一索引 顺序做题
currentIndex_subject4: 0, //科目四索引 顺序做题
curSubject: storage.get('curSubject') || '1',
loading_subject1: false,
loading_subject4: false,
version: storage.get('version') || ''
}),
actions: {
resetStorage(){
this.currentIndex_subject1=0
this.currentIndex_subject4=0
this.curSubject=0
storage.remove('curSubject')
storage.remove('wrongList_subject1')
storage.remove('wrongList_subject4')
storage.remove('rightList_subject1')
storage.remove('rightList_subject4')
this.getAllQuestion()
},
getAllQuestion() {
this.currentCartype = storage.get('carType') || '1001'
getVersion(this.currentCartype).then(resp => {
if (resp.code === '0000') {
querySysConfig(this.currentCartype, 'QuestionBank').then(res => {
const urlList = JSON.parse(res.data.configJson)
const urlOne = urlList.find(item => item.subject == '1').url
const urlFour = urlList.find(item => item.subject == '4').url
if (this.version != resp.data) {
this.version = resp.data
storage.set('version', resp.data)
this.getOrderQuestion_sub1(true, urlOne)
this.getOrderQuestion_sub4(true, urlFour)
} else {
this.getOrderQuestion_sub1(false, urlOne)
this.getOrderQuestion_sub4(false, urlOne)
}
})
actions: {
resetStorage() {
this.currentIndex_subject1 = 0;
this.currentIndex_subject4 = 0;
this.curSubject = 0;
storage.remove('curSubject');
storage.remove('wrongList_subject1');
storage.remove('wrongList_subject4');
storage.remove('rightList_subject1');
storage.remove('rightList_subject4');
// this.getAllQuestion()
},
getAllQuestion() {
this.currentCartype = storage.get('carType') || '1001';
getVersion(this.currentCartype).then(resp => {
if (resp.code === '0000') {
querySysConfig(this.currentCartype, 'QuestionBank').then(res => {
const urlList = JSON.parse(res.data.configJson);
const urlOne = urlList.find(item => item.subject == '1').url;
const urlFour = urlList.find(item => item.subject == '4').url;
if (this.version != resp.data) {
this.version = resp.data;
storage.set('version', resp.data);
this.getOrderQuestion_sub1(true, urlOne);
this.getOrderQuestion_sub4(true, urlFour);
} else {
this.getOrderQuestion_sub1(false, urlOne);
this.getOrderQuestion_sub4(false, urlFour);
}
});
}
});
},
divideArray(array, numChunks) {
var chunkSize = Math.ceil(array.length / numChunks);
var dividedArray = [];
for (var i = 0; i < array.length; i += chunkSize) {
dividedArray.push(array.slice(i, i + chunkSize));
}
return dividedArray;
},
}
})
},
divideArray(array, numChunks) {
var chunkSize = Math.ceil(array.length / numChunks);
var dividedArray = [];
for (var i = 0; i < array.length; i += chunkSize) {
dividedArray.push(array.slice(i, i + chunkSize));
}
return dividedArray;
},
//改变当前科目
changeSubject(val) {
this.curSubject = val
storage.set('curSubject', val)
},
// 获取顺序做题科目1
getOrderQuestion_sub1(isUpdate, url) {
if (isUpdate) {
this.loading_subject1 = true
const that = this
uni.request({
url: url,
success(resp) {
if (resp.data) {
that.orderQuestion_subject1 = resp.data.data
const diveList = that.divideArray(that.orderQuestion_subject1, 5)
that.loading_subject1 = false
uni.setStorageSync('questionOneSub1', diveList[0])
uni.setStorageSync('questionOneSub2', diveList[1])
uni.setStorageSync('questionOneSub3', diveList[2])
uni.setStorageSync('questionOneSub4', diveList[3])
uni.setStorageSync('questionOneSub5', diveList[4])
const falseList = storage.get('wrongList_subject1') || []
const trueList = storage.get('rightList_subject1') || []
const falseArr = []
const rightArr = []
that.orderQuestion_subject1.forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId)
}
if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId)
}
})
storage.set('wrongList_subject1', falseArr)
storage.set('rightList_subject1', rightArr)
}
}
})
} else {
const list1 = uni.getStorageSync('questionOneSub1') || []
const list2 = uni.getStorageSync('questionOneSub2') || []
const list3 = uni.getStorageSync('questionOneSub3') || []
const list4 = uni.getStorageSync('questionOneSub4') || []
const list5 = uni.getStorageSync('questionOneSub5') || []
this.orderQuestion_subject1 = [...list1, ...list2, ...list3, ...list4, ...list5]
if (this.orderQuestion_subject1 && this.orderQuestion_subject1.length) {
} else {
this.loading_subject1 = true
const that = this
uni.request({
url: url,
success(resp) {
if (resp.data) {
that.orderQuestion_subject1 = resp.data.data
const diveList = that.divideArray(that.orderQuestion_subject1, 5)
that.loading_subject1 = false
uni.setStorageSync('questionOneSub1', diveList[0])
uni.setStorageSync('questionOneSub2', diveList[1])
uni.setStorageSync('questionOneSub3', diveList[2])
uni.setStorageSync('questionOneSub4', diveList[3])
uni.setStorageSync('questionOneSub5', diveList[4])
const falseList = storage.get('wrongList_subject1') || []
const trueList = storage.get('rightList_subject1') || []
const falseArr = []
const rightArr = []
that.orderQuestion_subject1.forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId)
}
if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId)
}
})
storage.set('wrongList_subject1', falseArr)
storage.set('rightList_subject1', rightArr)
}
}
})
}
}
},
// 获取顺序做题科目4
getOrderQuestion_sub4(isUpdate, url) {
if (isUpdate) {
this.loading_subject4 = true
const that = this
uni.request({
url: url,
success(resp) {
if (resp.data) {
that.orderQuestion_subject4 = resp.data.data
const diveList = that.divideArray(that.orderQuestion_subject4, 5)
that.loading_subject4 = false
uni.setStorageSync('questionFourSub1', diveList[0])
uni.setStorageSync('questionFourSub2', diveList[1])
uni.setStorageSync('questionFourSub3', diveList[2])
uni.setStorageSync('questionFourSub4', diveList[3])
uni.setStorageSync('questionFourSub5', diveList[4])
const falseList = storage.get('wrongList_subject4') || []
const trueList = storage.get('rightList_subject4') || []
const falseArr = []
const rightArr = []
that.orderQuestion_subject4.forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId)
}
if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId)
}
})
storage.set('wrongList_subject4', falseArr)
storage.set('rightList_subject4', rightArr)
}
}
})
} else {
const list1 = uni.getStorageSync('questionFourSub1') || []
const list2 = uni.getStorageSync('questionFourSub2') || []
const list3 = uni.getStorageSync('questionFourSub3') || []
const list4 = uni.getStorageSync('questionFourSub4') || []
const list5 = uni.getStorageSync('questionFourSub5') || []
this.orderQuestion_subject4 = [...list1, ...list2, ...list3, ...list4, ...list5]
if (this.orderQuestion_subject4 && this.orderQuestion_subject4.length) {
} else {
this.loading_subject4 = true
const that = this
uni.request({
url: url,
success(resp) {
if (resp.data) {
that.orderQuestion_subject4 = resp.data.data
const diveList = that.divideArray(that.orderQuestion_subject4, 5)
that.loading_subject4 = false
uni.setStorageSync('questionFourSub1', diveList[0])
uni.setStorageSync('questionFourSub2', diveList[1])
uni.setStorageSync('questionFourSub3', diveList[2])
uni.setStorageSync('questionFourSub4', diveList[3])
uni.setStorageSync('questionFourSub5', diveList[4])
const falseList = storage.get('wrongList_subject4') || []
const trueList = storage.get('rightList_subject4') || []
const falseArr = []
const rightArr = []
that.orderQuestion_subject4.forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId)
}
if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId)
}
})
storage.set('wrongList_subject4', falseArr)
storage.set('rightList_subject4', rightArr)
}
}
})
}
}
},
//获取索引
getCurrentIndex(index, val) {
this[`currentIndex_subject${val}`] = index
}
}
//改变当前科目
changeSubject(val) {
this.curSubject = val;
storage.set('curSubject', val);
},
// 获取顺序做题科目1
getOrderQuestion_sub1(isUpdate, url) {
if (isUpdate) {
this.loading_subject1 = true;
this.loadAllQuestion(url, 1);
} else {
this.orderQuestion_subject1 = [];
for (let i = 0; i < JSON_SPLIT_LENGTH; i++) {
const arr = uni.getStorageSync(`question1Sub${i + 1}`) || [];
this.orderQuestion_subject1 = [...this.orderQuestion_subject1, ...arr];
}
if (this.orderQuestion_subject1.length == 0) {
this.loading_subject1 = true;
this.loadAllQuestion(url, 1);
}
}
},
// 获取顺序做题科目4
getOrderQuestion_sub4(isUpdate, url) {
if (isUpdate) {
this.loading_subject4 = true;
this.loadAllQuestion(url, 4);
} else {
this.orderQuestion_subject4 = [];
for (let i = 0; i < JSON_SPLIT_LENGTH; i++) {
const arr = uni.getStorageSync(`question4Sub${i + 1}`) || [];
this.orderQuestion_subject4 = [...this.orderQuestion_subject4, ...arr];
}
if (this.orderQuestion_subject4.length == 0) {
this.loading_subject4 = true;
this.loadAllQuestion(url, 4);
}
}
},
// 加载线上题目
loadAllQuestion(url, course) {
const that = this;
uni.request({
url: url,
success(resp) {
if (resp?.data) {
try {
for (let i = 0; i < JSON_SPLIT_LENGTH; i++) {
storage.remove(`question${course}Sub${i + 1}`);
}
that[`orderQuestion_subject${course}`] = resp.data?.data || [];
const diveList = that.divideArray(that[`orderQuestion_subject${course}`], JSON_SPLIT_LENGTH);
that[`loading_subject${course}`] = false;
for (let i = 0; i < JSON_SPLIT_LENGTH; i++) {
uni.setStorageSync(`question${course}Sub${i + 1}`, diveList[i]);
}
const falseList = storage.get(`wrongList_subject${course}`) || [];
const trueList = storage.get(`rightList_subject${course}`) || [];
const falseArr = [];
const rightArr = [];
that[`orderQuestion_subject${course}`].forEach(item => {
if (falseList.includes(item.questionId)) {
falseArr.push(item.questionId);
}
if (trueList.includes(item.questionId)) {
rightArr.push(item.questionId);
}
});
storage.set(`wrongList_subject${course}`, falseArr);
storage.set(`rightList_subject${course}`, rightArr);
} catch (err) {
console.log(err);
uni.showToast({
title: '题库下载异常,请稍后再试',
icon: 'none'
});
}
} else {
uni.showToast({
title: '加载题目失败,请稍后再试',
icon: 'none'
});
}
}
});
},
//获取索引
getCurrentIndex(index, val) {
this[`currentIndex_subject${val}`] = index;
}
}
});
export default question;
export default question;

@ -85,33 +85,26 @@
}
},
{
"path": "pages/me/tijian",
"path": "pages/me/school",
"style": {
"navigationBarTitleText": "上传证件照",
"navigationBarTitleText": "绑定驾校",
"enablePullDownRefresh": false
}
},
{
"path": "pages/me/school",
"path": "pages/index/videoVip",
"style": {
"navigationBarTitleText": "绑定驾校",
"navigationBarTitleText": "开通会员",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/videoVip",
"path": "pages/index/testTip",
"style": {
"navigationBarTitleText": "开通会员",
"navigationBarTitleText": "模拟考试",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/testTip",
"style": {
"navigationBarTitleText": "模拟考试",
"enablePullDownRefresh": false
}
},
{
"path": "pages/login/login",
"style": {
@ -146,65 +139,56 @@
"navigationBarTitleText": "支付结果",
"enablePullDownRefresh": false
}
}, {
},
{
"path": "pages/index/trueTest",
"style": {
"navigationBarTitleText": "真实考场模拟",
"enablePullDownRefresh": false
}
},
{
"path": "pages/me/uploadPic",
"style": {
"navigationBarTitleText": "上传证件照",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/secretPapers",
"style": {
"navigationBarTitleText": "考前密卷",
"enablePullDownRefresh": false
}
},
{
"path": "pages/me/changeCarType",
"style": {
"navigationBarTitleText": "切换车型",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/index/activity",
"style" :
{
"navigationBarTitleText" : "活动",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/me/myGift",
"style" :
{
"navigationBarTitleText" : "我的奖品",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/me/qrCode",
"style" :
{
"navigationBarTitleText" : "核销二维码",
"enablePullDownRefresh" : false
}
},
{
"path": "pages/me/help",
"style": {
"navigationBarTitleText": "好友助力",
"enablePullDownRefresh": true
}
}
{
"path": "pages/index/secretPapers",
"style": {
"navigationBarTitleText": "考前密卷",
"enablePullDownRefresh": false
}
},
{
"path": "pages/me/changeCarType",
"style": {
"navigationBarTitleText": "切换车型",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/activity",
"style": {
"navigationBarTitleText": "活动",
"enablePullDownRefresh": false
}
},
{
"path": "pages/me/myGift",
"style": {
"navigationBarTitleText": "我的奖品",
"enablePullDownRefresh": false
}
},
{
"path": "pages/me/qrCode",
"style": {
"navigationBarTitleText": "核销二维码",
"enablePullDownRefresh": false
}
},
{
"path": "pages/me/help",
"style": {
"navigationBarTitleText": "好友助力",
"enablePullDownRefresh": true
}
}
],
"globalStyle": {
@ -218,7 +202,8 @@
"selectedColor": "#05C341",
"backgroundColor": "#FFFFFF",
"color": "#999999",
"list": [{
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/image/tabbar/tab-home.png",
"selectedIconPath": "static/image/tabbar/tab-home-selected.png",
@ -233,4 +218,4 @@
}
]
}
}
}

@ -134,6 +134,9 @@
mounted() {
this.getTitle()
},
onShow() {
this.getTitle()
},
computed: {
...mapState(useUserStore, ["vipOnList", "token"]),
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //tagslist

@ -42,9 +42,9 @@
} from '@/jtools/api/question';
import Subject1 from "./components/Subject1";
import Subject2 from "./components/Subject2";
import {
queryActivityList
} from '@/jtools/api/activity';
// import {
// queryActivityList
// } from '@/jtools/api/activity';
export default {
components: {
Subject1,
@ -77,7 +77,7 @@
if (this.subject == '2' || this.subject == '3') {
this.$refs.subjectRef.getDiverType()
}
this.queryActivityList()
// this.queryActivityList()
},
onHide() {
this.show = false

@ -216,14 +216,12 @@
},
toSubmit() {
const restTime = this.time.hours * 60 * 60 + this.time.minutes * 60 + this.time.seconds
const score = this.list.reduce((pre, cur) => {
const isTrue = cur.trueAnswer == cur.yourAnswer.replace(/,-g/, '')
let s = 0
if (isTrue) {
s = this.subject == 1 ? 1 : 2
}
return pre + s
const trueCount = this.list.reduce((pre, cur) => {
const ya = cur.trueAnswer.replace('A', '1').replace('B', '2').replace('C', '3').replace('D', '4').replace('E', '5').replace('F', '6').replace('G', '7')
const isTrue = ya == cur.yourAnswer.replace(/,/g, '')
return pre + 1 * (isTrue ? 1 : 0)
}, 0)
const score = (trueCount / this.list.length * 100).toFixed(0)
submitTest({
"carTypeId": storage.get('carType') || '1001',
"score": score,

@ -10,13 +10,13 @@
<u-input class="sl-input" border="none" v-model="loginForm.phone" type="number" maxlength="11"
placeholder="输入手机号" />
</view>
<view class="list-call">
<!-- <view class="list-call">
<u-input class="sl-input" v-model="loginForm.code" type="text" maxlength="6" border="none" placeholder="输入验证码">
<template #suffix>
<text class="fs14 mr10" style="color: #05C341;" @tap="getCode">{{ countDown == 0 ? '获取验证码' : countDown }}</text>
</template>
</u-input>
</view>
</view> -->
</view>
<view class="button-login" @tap="bindLogin()">
@ -41,7 +41,7 @@ export default {
return {
loginForm: {
phone: '',
code: ''
code: '000000'
},
countDown: 0,
js: undefined

@ -42,7 +42,7 @@
<view class="absolute flex ai-c jc-c" style="left: 0;top: 40px;right: 0;bottom: 0;">
<view v-if="!isLogin || !vipOn.length" class="text-center">
<view class="fs18 fwb" style="color: #7E4012FF;">开通VIP尊享以下权益</view>
<view class="fs15" style="color: #7E4012FF;">精选500题 / 模考 / 考前密卷</view>
<view class="fs15" style="color: #7E4012FF;">精选500题 / 模考 / 考前密卷</view>
<view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;">{{ isIOS ? 'iOS暂不可用' : '立即开通' }}</view>
</view>
<view v-else-if="vipOn.length" class="text-center">
@ -83,11 +83,6 @@
<template #icon>
<u-icon size="24" name="gift"></u-icon>
</template>
</u-cell>
<u-cell size="large" title="我的体检" isLink @tap="handleTJ">
<template #icon>
<img src="/static/image/mine/wdtj.png" style="width: 24px;height: 24px;">
</template>
</u-cell>
<u-cell size="large" title="我的题库" :value="carName" @tap="toChangeCarType">
<template #icon>
@ -222,19 +217,6 @@ export default {
this.toLogin()
}
},
handleTJ() {
if (this.isLogin) {
// uni.navigateTo({
// url: '/pages/me/tijian'
// })
uni.showToast({
title: '敬请期待',
icon: 'none'
})
} else {
this.toLogin()
}
},
toLogin() {
uni.navigateTo({
url: '/pages/login/login'

@ -15,15 +15,6 @@
<u-icon name="arrow-right" color="#999" />
</view>
</view>
<!-- <view class="flex jc-sb ai-c bb1" style="height: 110rpx;">
<view class="title">身份证号</view>
<view class="m30lr fs14 cor-333">{{sfzNum}}</view>
</view>
<view class="flex ai-c" style="height: 110rpx;" @tap="toUploadPic">
<view class="title">证件照</view>
<view class="m30lr fs14 cor-333 fl1"></view>
<u-icon name="arrow-right" color="#999" />
</view> -->
</view>
</view>
</template>
@ -40,11 +31,6 @@
this.sfzNum=storage.get('sfzNum') || ''
},
methods: {
toUploadPic(){
uni.navigateTo({
url: '/pages/me/uploadPic'
})
}
}
}
</script>

@ -1,214 +0,0 @@
<template>
<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="idCardName" borderBottom ref="item1">
<u--input v-model="form.idCardName" border="none"></u--input>
</u-form-item>
<u-form-item label="身份证号" :required="true" prop="sfzmhm" borderBottom ref="item2">
<u--input v-model="form.sfzmhm" 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>
import storage from '@/jtools/storage';
import {
addInfo,
} from '@/jtools/api/index';
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: {
idCardName: '',
sfzmhm: ''
},
driverLicenseImg:'',
fileList:[],
fileList1: [],
uploadList: [],
saving: false,
rules: {
idCardName: [{
required: true,
message: '请输入姓名',
trigger: ['blur', 'change']
}],
sfzmhm: [{
required: true,
message: '请输入身份证号',
trigger: ['blur', 'change']
},{
//
validator: shenfenzhen,
message: '身份证号码不正确',
// blurchange
trigger: ['change', 'blur'],
}]
}
};
},
onReady() {
this.$refs.form1.setRules(this.rules);
},
methods: {
//
deletePic(event) {
this.fileList1.splice(event.index, 1);
this.uploadList.splice(event.index, 1);
},
//
async afterRead(event) {
let imageInfoObj = await uni.getImageInfo({src: event.file[0].url})
console.log(imageInfoObj);
if(imageInfoObj.width!=720&&imageInfoObj.height!=720){
uni.showToast({
icon:'error',
title:'证件照尺寸有误'
})
this.fileList=[]
return false
}
this.driverLicenseImg = this.urlTobase64(event.file[0].url)
// 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={
driverLicenseImg:this.driverLicenseImg,
...this.form,
schoolOrgCode:'340103000700',
operater:'1d08daf852cf4ee28f67cb583f538cbf'
}
addInfo(param).then(resp=>{
uni.showToast({
title:"提交成功!",
duration:2000,
})
setTimeout(()=>{
uni.navigateBack()
},1000)
})
} else {
console.log('验证失败');
}
});
},
urlTobase64(url){
let base64=''
console.log(url);
return new Promise((resolve, reject) => {
uni.getFileSystemManager().readFile({
filePath: url, //
encoding: 'base64', //
success: res => { //
console.log(res);
base64 = 'data:image/jpeg;base64,' + res.data //
resolve(base64);
},fail: (e) => {
console.log("图片转换失败");
reject(e)
}
})
});
}
}
};
</script>
<style lang="scss" scoped>
.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>

@ -9,7 +9,7 @@
</view>
<swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false" @change="onChange"
@animationfinish="onAnimationfinish" @touchend="touchEnd">
<swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesIndex.questionId">
<swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesItem.questionId">
<scroll-view scroll-y="true" class="swiper-scroll">
<view>
<view class="m14lr">

@ -56,7 +56,7 @@
import GradesChart from "./components/GradesChart.vue"
import storage from '@/jtools/storage';
import {
testTotal
testTotal,getTestQuestionId
} from '@/jtools/api/question';
export default {
components: {
@ -182,15 +182,28 @@
}else{
const list =JSON.stringify(this.wrongList)
uni.navigateTo({
url:"/pages/questionBank/questionBank?navTitle=错题&subject="+this.subject+"&questionList="+list
url:"/pages/questionBank/questionBank?navTitle=错题&subject="+this.subject+"&questionIdList="+list
})
}
},
//
toExams(){
uni.navigateTo({
url:"/pages/questionBank/practiceExams?subject="+this.subject
getTestQuestionId({
versionId: this.version,
carTypeId: storage.get('carType') || '1001',
subject: this.subject,
}).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
})
}
})
// uni.navigateTo({
// url:"/pages/questionBank/practiceExams?subject="+this.subject
// })
},
},
}

Loading…
Cancel
Save