378 lines
8.2 KiB
Vue
378 lines
8.2 KiB
Vue
<template>
|
|
<view class="container">
|
|
<view style="background-color: #242A38; box-sizing: border-box; padding-bottom: 40px;">
|
|
<view class="cont-top">
|
|
<view class="top-left">行驶证上传:</view>
|
|
</view>
|
|
<view class="zhans-img">
|
|
<image src="https://5b0988e595225.cdn.sohucs.com/images/20190201/c3cd3abe856d486b8d218df3be6cf797.jpeg" mode=""></image>
|
|
</view>
|
|
<view class="img-box">
|
|
<u-upload
|
|
:fileList="fileList3"
|
|
@afterRead="afterRead"
|
|
@delete="deletePic"
|
|
name="3"
|
|
multiple
|
|
:maxCount="1"
|
|
:previewFullImage="true"
|
|
>
|
|
|
|
</u-upload>
|
|
</view>
|
|
<u-popup :show="show" :round="10" mode="center" @close="close" @open="open">
|
|
<view class="z-xin">
|
|
<view class="one">恭喜您 成为尊贵的白银会员</view>
|
|
<view class="one"> 享受各项优惠</view>
|
|
<view class="one">将赠送您如下优惠卷 </view>
|
|
|
|
<view class="o-box" >
|
|
<view class="youshang">
|
|
<text class="xbiao">¥</text>
|
|
<text>汽修</text>
|
|
</view>
|
|
<view class="heng">
|
|
<view class="zuo">50元优惠券</view>
|
|
<view class="you">¥50元</view>
|
|
</view>
|
|
</view>
|
|
<view class="anniux" @click="getgo()">
|
|
<view class="">我知道了</view>
|
|
</view>
|
|
</view>
|
|
</u-popup>
|
|
<view class="anniu" @click="getimg()" >
|
|
<text>点击上传</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getToken
|
|
} from "@/utils/auth.js"
|
|
export default {
|
|
data(){
|
|
return{
|
|
show: false,
|
|
doing:'',
|
|
baseUrl: getApp().globalData.config.baseUrl,
|
|
fileList3: [],
|
|
postData: {
|
|
carPics: '',
|
|
},
|
|
}
|
|
},
|
|
methods:{
|
|
getgo(){
|
|
uni.navigateBack()
|
|
},
|
|
// 删除图片
|
|
deletePic(event) {
|
|
this[`fileList${event.name}`].splice(event.index, 1)
|
|
},
|
|
// 新增图片
|
|
async afterRead(event) {
|
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
|
let lists = [].concat(event.file)
|
|
let fileListLen = this[`fileList${event.name}`].length
|
|
lists.map((item) => {
|
|
this[`fileList${event.name}`].push({
|
|
...item,
|
|
// status: 'uploading',
|
|
// message: '上传中'
|
|
})
|
|
})
|
|
for (let i = 0; i < lists.length; i++) {
|
|
const result = await this.uploadFilePromise(lists[i].url)
|
|
let item = this[`fileList${event.name}`][fileListLen]
|
|
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
|
status: 'success',
|
|
message: '',
|
|
url: result
|
|
}))
|
|
fileListLen++
|
|
}
|
|
console.log(this.fileList3);
|
|
},
|
|
// 上传图片
|
|
uploadFilePromise(url) {
|
|
console.log('执行');
|
|
return new Promise((resolve, reject) => {
|
|
let a = uni.uploadFile({
|
|
// url: this.baseUrl + '/common/uploadImg',
|
|
url: 'https://www.nuoyunr.com/lanan/common/uploadImg',
|
|
headers: {
|
|
Authorization: "Bearer " + getToken(),
|
|
},
|
|
filePath: url,
|
|
name: 'file',
|
|
formData: {
|
|
user: 'test'
|
|
},
|
|
success: (res) => {
|
|
try {
|
|
let img = JSON.parse(res.data);
|
|
this.doing = this.baseUrl + img.fileName
|
|
console.log('url',this.doing);
|
|
} catch (e) {
|
|
//TODO handle the exception
|
|
}
|
|
setTimeout(() => {
|
|
resolve(res.data.data)
|
|
}, 1000)
|
|
}
|
|
});
|
|
})
|
|
},
|
|
async getimg(){
|
|
console.log(this.doing);
|
|
let data = {
|
|
imagePath :this.doing
|
|
}
|
|
const res = await this.$request({
|
|
url: '/system/userCar/vehicleLicenseOCR',
|
|
method: 'post',
|
|
params: data
|
|
})
|
|
if (res.msg == '恭喜您,成功升级白银级别会员') {
|
|
this.show = true
|
|
}
|
|
if(res.code == 200){
|
|
this.$modal.msgSuccess('提交成功')
|
|
}
|
|
if(res.code != 200){
|
|
this.$modal.msgSuccess('提交失败')
|
|
}
|
|
|
|
// setTimeout(() => {
|
|
// this.$tab.navigateBack()
|
|
// }, 2500)
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.container{
|
|
width: 100%;
|
|
height:calc(100vh);
|
|
box-sizing: border-box;
|
|
background-color: #242A38;
|
|
padding-top: 40px;
|
|
}
|
|
.zhans-img{
|
|
width: 95%;
|
|
height: 200px;
|
|
border-radius: 6px;
|
|
border: 2px solid #FFE3AD;
|
|
box-sizing: border-box;
|
|
padding: 5px;
|
|
margin: 20px auto;
|
|
image{
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
.cont-top{
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
box-sizing: border-box;
|
|
overflow: hidden;
|
|
padding-bottom: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
// border-bottom: 1px solid #FFE3AD;
|
|
|
|
}
|
|
.top-right{
|
|
width: 70%;
|
|
input{
|
|
width: 100%;
|
|
color: white;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
}
|
|
}
|
|
.top-left{
|
|
color: #FFE3AD;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
margin-right: 5px;
|
|
}
|
|
.cont-box{
|
|
margin: 0 auto;
|
|
margin-top: 20px;
|
|
width: 95%;
|
|
|
|
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
}
|
|
.box{
|
|
width: 30%;
|
|
height: 40px;
|
|
border-radius: 8px;
|
|
border: 1px solid #FFE3AD;
|
|
margin-top: 10px;
|
|
margin-right: 11px;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
font-size: 18px;
|
|
color: white;
|
|
font-weight: bold;
|
|
|
|
}
|
|
.anniu{
|
|
width: 95%;
|
|
height: 40px;
|
|
border-radius: 6px;
|
|
border: 1px solid #FFE3AD;
|
|
background-color: #FFE3AD ;
|
|
margin: 0 auto;
|
|
margin-top: 40px;
|
|
color: white;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
font-size: 18px;
|
|
font-weight: bold;
|
|
|
|
}
|
|
.indexbox{
|
|
background: #FFE3AD;
|
|
}
|
|
.img-box{
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
}
|
|
.z-xin{
|
|
width: 100%;
|
|
background-color: white;
|
|
height: 300px;
|
|
box-sizing: border-box;
|
|
overflow: hidden;
|
|
padding: 15px;
|
|
border-radius: 10px;
|
|
}
|
|
.one{
|
|
width: 100%;
|
|
text-align: center;
|
|
font-size: 18px;
|
|
font-weight: bold;
|
|
color: #FF861B;
|
|
}
|
|
.o-box{
|
|
width: 100%;
|
|
height: 50px;
|
|
margin-top: 10px;
|
|
background: url('http://www.nuoyunr.com/lananRsc/quanbg.png') no-repeat;
|
|
background-position: center;
|
|
background-size:cover;
|
|
background-repeat: no-repeat;
|
|
overflow: hidden;
|
|
border-radius: 6px;
|
|
|
|
}
|
|
.heng{
|
|
width: 85%;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
}
|
|
.zuo{
|
|
font-size: 14px;
|
|
font-family: Microsoft YaHei;
|
|
font-weight: bold;
|
|
color: #333333;
|
|
}
|
|
.you{
|
|
font-size: 14px;
|
|
font-family: Microsoft YaHei;
|
|
font-weight: bold;
|
|
color: #FF861B;
|
|
}
|
|
.xbiao{
|
|
width: 20px;
|
|
height: 10px;
|
|
background: linear-gradient(86deg, #FFB034 0%, #FF6714 100%);
|
|
background: #FFB351;
|
|
border-radius: 0px 0px 10px 0px;
|
|
font-size: 10px;
|
|
line-height: 15px;
|
|
text-align: center;
|
|
color: white;
|
|
font-weight: bold;
|
|
}
|
|
.youshang{
|
|
width: 40px;
|
|
height: 20px;
|
|
background: #FFB351;
|
|
border-radius: 0px 0px 10px 0px;
|
|
font-size: 10px;
|
|
line-height: 10px;
|
|
text-align: center;
|
|
|
|
}
|
|
.anniux{
|
|
width: 80px;
|
|
height: 30px;
|
|
margin: 20px auto;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
color: white;font-weight: bold;
|
|
background: linear-gradient(139deg, #FFB931 0%, #FF491F 100%);
|
|
border-radius: 44px
|
|
}
|
|
/deep/.u-upload__wrap__preview__image.data-v-69e2a36e {
|
|
width: 100% !important;
|
|
height: 200px !important;
|
|
}
|
|
/deep/.u-upload__button.data-v-69e2a36e {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 100% !important;
|
|
height: 200PX !important;
|
|
background-color: #f4f5f7;
|
|
border-radius: 2px;
|
|
|
|
box-sizing: border-box;
|
|
margin: 0 auto;
|
|
}
|
|
/deep/.u-upload__deletable.data-v-69e2a36e {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
background-color: #373737;
|
|
height: 26px !important;
|
|
width: 26px !important;
|
|
display: flex;
|
|
flex-direction: row;
|
|
border-bottom-left-radius: 100px;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 3;
|
|
}
|
|
/deep/.u-icon__icon.data-v-2ee87dc9{
|
|
font-size: 17px !important;
|
|
line-height: 17px !important;
|
|
}
|
|
/deep/.u-upload__wrap__preview.data-v-69e2a36e {
|
|
border-radius: 2px;
|
|
width: 100% !important;
|
|
margin: 0 8px 8px 0;
|
|
position: relative;
|
|
overflow: hidden;
|
|
display: flex;
|
|
flex-direction: row;
|
|
}
|
|
</style> |