Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
a684d255d2 | 5 days ago |
![]() |
70fe0f0c42 | 5 days ago |
![]() |
62896b197d | 5 days ago |
![]() |
9b677ade15 | 6 days ago |
![]() |
4bd08bde70 | 6 days ago |
![]() |
e889c92d35 | 2 weeks ago |
![]() |
7442289a87 | 2 weeks ago |
![]() |
d70a0141cc | 3 months ago |
![]() |
459baca3f8 | 3 months ago |
@ -1,238 +1,157 @@ |
|||||||
import { |
import { defineStore } from 'pinia'; |
||||||
defineStore |
|
||||||
} from 'pinia'; |
|
||||||
import http from '@/jtools/request/index'; |
import http from '@/jtools/request/index'; |
||||||
import { |
import { queryQuestion, getVersion, querySysConfig } from '@/jtools/api/question'; |
||||||
queryQuestion, |
|
||||||
getVersion, |
|
||||||
querySysConfig |
|
||||||
} from '@/jtools/api/question'; |
|
||||||
import storage from '@/jtools/storage'; |
import storage from '@/jtools/storage'; |
||||||
|
let JSON_SPLIT_LENGTH = 10; |
||||||
|
|
||||||
const question = defineStore({ |
const question = defineStore({ |
||||||
id: 'question', |
id: 'question', |
||||||
state: () => ({ |
state: () => ({ |
||||||
currentCartype: storage.get('carType') || '1001', |
currentCartype: storage.get('carType') || '1001', |
||||||
currentCarName: storage.get('carName') || '小车C1/C2/C3', |
currentCarName: storage.get('carName') || '小车C1/C2/C3', |
||||||
orderQuestion_subject1: storage.get('question_subject1') || [], //科目一顺序做题
|
orderQuestion_subject1: [], //科目一顺序做题
|
||||||
orderQuestion_subject4: storage.get('question_subject4') || [], //科目四顺序做题
|
orderQuestion_subject4: [], //科目四顺序做题
|
||||||
currentIndex_subject1: 0, //科目一索引 顺序做题
|
currentIndex_subject1: 0, //科目一索引 顺序做题
|
||||||
currentIndex_subject4: 0, //科目四索引 顺序做题
|
currentIndex_subject4: 0, //科目四索引 顺序做题
|
||||||
curSubject: storage.get('curSubject') || '1', |
curSubject: storage.get('curSubject') || '1', |
||||||
loading_subject1: false, |
loading_subject1: false, |
||||||
loading_subject4: false, |
loading_subject4: false, |
||||||
version: storage.get('version') || '' |
version: storage.get('version') || '' |
||||||
}), |
}), |
||||||
|
|
||||||
actions: { |
actions: { |
||||||
resetStorage(){ |
resetStorage() { |
||||||
this.currentIndex_subject1=0 |
this.currentIndex_subject1 = 0; |
||||||
this.currentIndex_subject4=0 |
this.currentIndex_subject4 = 0; |
||||||
this.curSubject=0 |
this.curSubject = 0; |
||||||
storage.remove('curSubject') |
storage.remove('curSubject'); |
||||||
storage.remove('wrongList_subject1') |
storage.remove('wrongList_subject1'); |
||||||
storage.remove('wrongList_subject4') |
storage.remove('wrongList_subject4'); |
||||||
storage.remove('rightList_subject1') |
storage.remove('rightList_subject1'); |
||||||
storage.remove('rightList_subject4') |
storage.remove('rightList_subject4'); |
||||||
this.getAllQuestion() |
// this.getAllQuestion()
|
||||||
}, |
}, |
||||||
getAllQuestion() { |
getAllQuestion() { |
||||||
this.currentCartype = storage.get('carType') || '1001' |
this.currentCartype = storage.get('carType') || '1001'; |
||||||
getVersion(this.currentCartype).then(resp => { |
getVersion(this.currentCartype).then(resp => { |
||||||
if (resp.code === '0000') { |
if (resp.code === '0000') { |
||||||
querySysConfig(this.currentCartype, 'QuestionBank').then(res => { |
querySysConfig(this.currentCartype, 'QuestionBank').then(res => { |
||||||
const urlList = JSON.parse(res.data.configJson) |
const urlList = JSON.parse(res.data.configJson); |
||||||
const urlOne = urlList.find(item => item.subject == '1').url |
const urlOne = urlList.find(item => item.subject == '1').url; |
||||||
const urlFour = urlList.find(item => item.subject == '4').url |
const urlFour = urlList.find(item => item.subject == '4').url; |
||||||
if (this.version != resp.data) { |
if (this.version != resp.data) { |
||||||
this.version = resp.data |
this.version = resp.data; |
||||||
storage.set('version', resp.data) |
storage.set('version', resp.data); |
||||||
this.getOrderQuestion_sub1(true, urlOne) |
this.getOrderQuestion_sub1(true, urlOne); |
||||||
this.getOrderQuestion_sub4(true, urlFour) |
this.getOrderQuestion_sub4(true, urlFour); |
||||||
} else { |
} else { |
||||||
this.getOrderQuestion_sub1(false, urlOne) |
this.getOrderQuestion_sub1(false, urlOne); |
||||||
this.getOrderQuestion_sub4(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; |
||||||
|
}, |
||||||
|
|
||||||
} |
//改变当前科目
|
||||||
}) |
changeSubject(val) { |
||||||
}, |
this.curSubject = val; |
||||||
divideArray(array, numChunks) { |
storage.set('curSubject', val); |
||||||
var chunkSize = Math.ceil(array.length / numChunks); |
}, |
||||||
var dividedArray = []; |
// 获取顺序做题科目1
|
||||||
for (var i = 0; i < array.length; i += chunkSize) { |
getOrderQuestion_sub1(isUpdate, url) { |
||||||
dividedArray.push(array.slice(i, i + chunkSize)); |
if (isUpdate) { |
||||||
} |
this.loading_subject1 = true; |
||||||
return dividedArray; |
this.loadAllQuestion(url, 1); |
||||||
}, |
} else { |
||||||
|
this.orderQuestion_subject1 = []; |
||||||
//改变当前科目
|
for (let i = 0; i < JSON_SPLIT_LENGTH; i++) { |
||||||
changeSubject(val) { |
const arr = uni.getStorageSync(`question1Sub${i + 1}`) || []; |
||||||
this.curSubject = val |
this.orderQuestion_subject1 = [...this.orderQuestion_subject1, ...arr]; |
||||||
storage.set('curSubject', val) |
} |
||||||
}, |
if (this.orderQuestion_subject1.length == 0) { |
||||||
// 获取顺序做题科目1
|
this.loading_subject1 = true; |
||||||
getOrderQuestion_sub1(isUpdate, url) { |
this.loadAllQuestion(url, 1); |
||||||
if (isUpdate) { |
} |
||||||
this.loading_subject1 = true |
} |
||||||
const that = this |
}, |
||||||
uni.request({ |
// 获取顺序做题科目4
|
||||||
url: url, |
getOrderQuestion_sub4(isUpdate, url) { |
||||||
success(resp) { |
if (isUpdate) { |
||||||
if (resp.data) { |
this.loading_subject4 = true; |
||||||
that.orderQuestion_subject1 = resp.data.data |
this.loadAllQuestion(url, 4); |
||||||
const diveList = that.divideArray(that.orderQuestion_subject1, 5) |
} else { |
||||||
that.loading_subject1 = false |
this.orderQuestion_subject4 = []; |
||||||
uni.setStorageSync('questionOneSub1', diveList[0]) |
for (let i = 0; i < JSON_SPLIT_LENGTH; i++) { |
||||||
uni.setStorageSync('questionOneSub2', diveList[1]) |
const arr = uni.getStorageSync(`question4Sub${i + 1}`) || []; |
||||||
uni.setStorageSync('questionOneSub3', diveList[2]) |
this.orderQuestion_subject4 = [...this.orderQuestion_subject4, ...arr]; |
||||||
uni.setStorageSync('questionOneSub4', diveList[3]) |
} |
||||||
uni.setStorageSync('questionOneSub5', diveList[4]) |
if (this.orderQuestion_subject4.length == 0) { |
||||||
const falseList = storage.get('wrongList_subject1') || [] |
this.loading_subject4 = true; |
||||||
const trueList = storage.get('rightList_subject1') || [] |
this.loadAllQuestion(url, 4); |
||||||
const falseArr = [] |
} |
||||||
const rightArr = [] |
} |
||||||
that.orderQuestion_subject1.forEach(item => { |
}, |
||||||
if (falseList.includes(item.questionId)) { |
// 加载线上题目
|
||||||
falseArr.push(item.questionId) |
loadAllQuestion(url, course) { |
||||||
} |
const that = this; |
||||||
if (trueList.includes(item.questionId)) { |
uni.request({ |
||||||
rightArr.push(item.questionId) |
url: url, |
||||||
} |
success(resp) { |
||||||
}) |
if (resp?.data) { |
||||||
storage.set('wrongList_subject1', falseArr) |
try { |
||||||
storage.set('rightList_subject1', rightArr) |
for (let i = 0; i < JSON_SPLIT_LENGTH; i++) { |
||||||
} |
storage.remove(`question${course}Sub${i + 1}`); |
||||||
} |
} |
||||||
}) |
that[`orderQuestion_subject${course}`] = resp.data?.data || []; |
||||||
} else { |
const diveList = that.divideArray(that[`orderQuestion_subject${course}`], JSON_SPLIT_LENGTH); |
||||||
const list1 = uni.getStorageSync('questionOneSub1') || [] |
that[`loading_subject${course}`] = false; |
||||||
const list2 = uni.getStorageSync('questionOneSub2') || [] |
for (let i = 0; i < JSON_SPLIT_LENGTH; i++) { |
||||||
const list3 = uni.getStorageSync('questionOneSub3') || [] |
uni.setStorageSync(`question${course}Sub${i + 1}`, diveList[i]); |
||||||
const list4 = uni.getStorageSync('questionOneSub4') || [] |
} |
||||||
const list5 = uni.getStorageSync('questionOneSub5') || [] |
const falseList = storage.get(`wrongList_subject${course}`) || []; |
||||||
this.orderQuestion_subject1 = [...list1, ...list2, ...list3, ...list4, ...list5] |
const trueList = storage.get(`rightList_subject${course}`) || []; |
||||||
if (this.orderQuestion_subject1 && this.orderQuestion_subject1.length) { |
const falseArr = []; |
||||||
|
const rightArr = []; |
||||||
} else { |
that[`orderQuestion_subject${course}`].forEach(item => { |
||||||
this.loading_subject1 = true |
if (falseList.includes(item.questionId)) { |
||||||
const that = this |
falseArr.push(item.questionId); |
||||||
uni.request({ |
} |
||||||
url: url, |
if (trueList.includes(item.questionId)) { |
||||||
success(resp) { |
rightArr.push(item.questionId); |
||||||
if (resp.data) { |
} |
||||||
that.orderQuestion_subject1 = resp.data.data |
}); |
||||||
const diveList = that.divideArray(that.orderQuestion_subject1, 5) |
storage.set(`wrongList_subject${course}`, falseArr); |
||||||
that.loading_subject1 = false |
storage.set(`rightList_subject${course}`, rightArr); |
||||||
uni.setStorageSync('questionOneSub1', diveList[0]) |
} catch (err) { |
||||||
uni.setStorageSync('questionOneSub2', diveList[1]) |
console.log(err); |
||||||
uni.setStorageSync('questionOneSub3', diveList[2]) |
uni.showToast({ |
||||||
uni.setStorageSync('questionOneSub4', diveList[3]) |
title: '题库下载异常,请稍后再试', |
||||||
uni.setStorageSync('questionOneSub5', diveList[4]) |
icon: 'none' |
||||||
const falseList = storage.get('wrongList_subject1') || [] |
}); |
||||||
const trueList = storage.get('rightList_subject1') || [] |
} |
||||||
const falseArr = [] |
} else { |
||||||
const rightArr = [] |
uni.showToast({ |
||||||
that.orderQuestion_subject1.forEach(item => { |
title: '加载题目失败,请稍后再试', |
||||||
if (falseList.includes(item.questionId)) { |
icon: 'none' |
||||||
falseArr.push(item.questionId) |
}); |
||||||
} |
} |
||||||
if (trueList.includes(item.questionId)) { |
} |
||||||
rightArr.push(item.questionId) |
}); |
||||||
} |
}, |
||||||
}) |
//获取索引
|
||||||
storage.set('wrongList_subject1', falseArr) |
getCurrentIndex(index, val) { |
||||||
storage.set('rightList_subject1', rightArr) |
this[`currentIndex_subject${val}`] = index; |
||||||
} |
} |
||||||
} |
} |
||||||
}) |
|
||||||
} |
|
||||||
} |
|
||||||
}, |
|
||||||
// 获取顺序做题科目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 |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
}); |
||||||
|
|
||||||
export default question; |
export default question; |
||||||
|
@ -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: '身份证号码不正确', |
|
||||||
// 触发器可以同时用blur和change |
|
||||||
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> |
|
Loading…
Reference in new issue