个人信息、车辆信息

This commit is contained in:
Vinjor 2024-10-11 20:50:05 +08:00
parent 532e0e6700
commit c39ae9419e
14 changed files with 477 additions and 313 deletions

View File

@ -1,7 +1,7 @@
// 应用全局配置
module.exports = {
baseUrl: 'https://www.nuoyunr.com',
// baseUrl: 'http://192.168.1.4:48080',
// baseUrl: 'https://www.nuoyunr.com',
baseUrl: 'http://192.168.1.17:48080',
// baseUrl: "http://localhost:48080",
imagesUrl: 'http://shequ.0315e.com/static/images/pages/',
baseImageUrl: 'https://www.nuoyunr.com/minio/',

View File

@ -26,7 +26,7 @@
</view>
<view class="orderInfo">
<image class="orderInfoIcon" src="@/static/icons/Frame27.png" mode="aspectFit"></image>
<text class="orderInfoText">{{ item.tenantName | 蓝安-中鑫之宝 }}</text>
<text class="orderInfoText">{{ item.tenantName || "蓝安-中鑫之宝" }}</text>
</view>
<view class="line2">
<view>

View File

@ -34,6 +34,12 @@
"navigationBarTitleText": ""
}
},
{
"path": "pages/myCar/scan-frame",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/my/myInfo",
"style": {

View File

@ -28,7 +28,7 @@
<script>
import request from '../../utils/request';
import {setToken} from '@/utils/auth.js'
import {setToken,setUserInfo} from '@/utils/auth.js'
export default{
data(){
return{
@ -66,36 +66,9 @@
},
},
methods:{
async getsxshenfen(){
let data = {
roleCode : this.shenfen
}
let res = await request({
url:'/appInspection/userOwn/updateRole',
method:'post',
params: data
})
if(res.code == 200){
uni.redirectTo({
url: '/pages/detection/my'
})
}
},
getshenfen(text){
this.shenfen = text
},
open() {
// console.log('open');
},
close() {
// this.show = false
// uni.reLaunch({
// url: '/pages/detection/my'
// })
// // console.log('close');
},
/**
* 用户协议隐私政策
*/
goPolicy() {
uni.navigateTo({
url: "/pages/login/PrivacyPolicy"
@ -114,21 +87,6 @@
}
})
},
async getAppinfo(){
let res = await request({
url:'/getAppInfo',
method:'get',
})
console.log('getappinfo',res);
},
//
authorize() {
uni.showToast({
icon: "none",
title: "请阅读并勾选用户协议",
duration: 2000
})
},
shibai(){
uni.showToast({
icon: "none",
@ -161,15 +119,10 @@
if (rex.data.code == 0) {
//token
setToken(rex.data.data.token)
if (rex.data.data.ifNeedFill) {
uni.reLaunch({
url: '/pages/my/register'
})
} else {
setUserInfo(JSON.stringify(rex.data.data.userinfo))
uni.reLaunch({
url: '/pages-home/home/home'
})
}
} else {
uni.showToast({
icon: 'none',
@ -195,104 +148,6 @@
});
}
})
},
userinfo(){
console.log('执行了');
request({
url: '/getAppInfo',
method: 'get',
}).then((res)=>{
let userJson = {}
userJson.userId = res.user.userId
console.log('身份信息',res,res.role.length);
uni.setStorageSync('role',res.role)
uni.setStorageSync('userinfo',res.user)
if(!res.role||res.role.length==0){
this.show = true
}else{
uni.reLaunch({
url: '/pages/detection/my'
})
}
})
},
getxz(index){
this.activeid = index
},
goregister(){
uni.redirectTo({
url:'/pages/login/register'
})
},
goforgot(){
uni.redirectTo({
url:'/pages/login/forgot'
})
},
goselect(){
console.log('执行');
uni.redirectTo({
url:'/pages/index/index'
})
},
//
sendVerificationCode() {
let reg = /^((13[0-9])|(14[0-9])|(15[0-9])|(17[0-9])|(18[0-9]))\d{8}$/;
if (!reg.test(this.tel)) {
uni.showToast({
icon: 'none',
title: '请输入正确的11位手机号'
})
this.tel = '';
return false;
}
if (this.isButtonDisabled) {
return; //
}
const data = {
phone:this.tel,
}
request({
url: '/loginSmsCode',
method: 'post',
params: data
}).then((res)=>{
console.log('验证码',res);
if(res.code == 200){
uni.showToast({
title:'验证码已发送 请注意查收',
icon:'none'
})
}else{
uni.showToast({
title:'网络不佳请稍后再试',
icon:'none'
})
}
})
this.disableButton(); //
this.startCountdown(); //
},
disableButton() {
this.isButtonDisabled = true;
},
enableButton() {
this.isButtonDisabled = false;
},
startCountdown() {
let countdown = setInterval(() => {
this.countdownTime--;
if (this.countdownTime === 0) {
clearInterval(countdown);
this.enableButton(); //
}
}, 1000);
},
}
}

View File

@ -6,22 +6,23 @@
<view class="body-top">
<image class="userBmg" src="../../static/images/image1.png" mode="widthFix"></image>
<view class="userInfo">
<image class="avatar" src="../../static/images/avatar.png" mode="aspectFit"></image>
<text class="customInfo">{{customInfo.cusName}}</text>
<image v-if="''==customInfo.avatar || null == customInfo.avatar" class="avatar" src="../../static/images/avatar.png" mode="aspectFit"></image>
<image v-else class="avatar" :src="imgUrlPrex+customInfo.avatar" mode="scaleToFill"></image>
<text class="customInfo">{{customInfo.nickname}}</text>
</view>
</view>
<view class="level">
<image class="levelIcon" src="" mode="aspectFit"></image>
<view class="levelInfo">
<text class="levelNum">{{customInfo.levelName}}</text>
<!-- <text class="levelQy">当前可享受4项权益</text> -->
</view>
<view class="showQyBtn" @click="showEquity">
查看权益
<image class="showQyBtnIcon" src="../../static/icons/icon1.png" mode="aspectFit"></image>
</view>
</view>
<!-- <view class="level">-->
<!-- <image class="levelIcon" src="" mode="aspectFit"></image>-->
<!-- <view class="levelInfo">-->
<!-- <text class="levelNum">{{customInfo.levelName}}</text>-->
<!-- &lt;!&ndash; <text class="levelQy">当前可享受4项权益</text> &ndash;&gt;-->
<!-- </view>-->
<!-- <view class="showQyBtn" @click="showEquity">-->
<!-- 查看权益-->
<!-- <image class="showQyBtnIcon" src="../../static/icons/icon1.png" mode="aspectFit"></image>-->
<!-- </view>-->
<!-- </view>-->
<view class="menu1">
<view @click="goToPage('/pages/myCar/myCar')" style="background: linear-gradient( 90deg, #DEE5FC 0%, #CAD6FA 100%);"
class="menu1-item menu-myCar">
@ -65,8 +66,9 @@
import VNavigationBar from '@/components/VNavigationBar.vue'
import tabBarVue from '@/components/tabBar/tabBar.vue'
import request from "@/utils/request";
import config from '@/config'
import {getUserInfoRequest} from "@/utils/common.js";
import {getToken,setUserInfo,getUserInfo} from '@/utils/auth.js'
import {getToken,setUserInfo,getUserInfo} from '@/utils/auth'
export default {
components: {
tabBarVue,
@ -79,17 +81,15 @@
})
}else{
console.log("已登录")
if(!getUserInfo()){
this.getServer()
}else{
//
this.customInfo = JSON.parse(getUserInfo())
}
}
},
data() {
return {
//
customInfo:{},
imgUrlPrex:config.baseImageUrl,
menuCard1: [
{ title: '我的资料', icon: require('@/static/icons/my-menu-icon1.png'), path: '/pages/my/myInfo' },
{ title: '我的卡券', icon: require('@/static/icons/my-menu-icon5.png'), path: "/pages/my/cardRoll" },
@ -171,6 +171,7 @@
.avatar {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
margin-bottom: 30rpx;
}

View File

@ -2,45 +2,116 @@
<view class="container">
<VNavigationBarVue titleColor="#333" backgroundColor="#fff" title="我的资料"></VNavigationBarVue>
<view class="body">
<!-- <view class="formItem">-->
<!-- <text class="formLabel">头像</text>-->
<!-- <image class="avatar" src="../../static/images/avatar.png" mode="aspectFit"></image>-->
<!-- </view>-->
<view class="formItem">
<text class="formLabel">姓名</text>
<text class="formValue">{{ customInfo.cusName }}</text>
<!-- <image class="formBtn" src="../../static/icons/homeInfoMore.png" mode="aspectFit"></image>-->
<input type="text" style="text-align: right" placeholder="请输入姓名" v-model="customInfo.nickname"/>
</view>
<view class="formItem">
<text class="formLabel">手机号</text>
<text class="formValue">{{ customInfo.phoneNumber }}</text>
<!-- <image class="formBtn" src="../../static/icons/homeInfoMore.png" mode="aspectFit"></image>-->
<text class="formValue">{{ customInfo.mobile }}</text>
</view>
<view class="formItem">
<text class="formLabel">联系地址</text>
<text class="formValue">{{ customInfo.address }}</text>
<!-- <image class="formBtn" src="../../static/icons/homeInfoMore.png" mode="aspectFit"></image>-->
<text class="formLabel">头像</text>
<view class="dl-avatar-box">
<u-upload
:action="uploadUrl"
:headers="headers"
:file-list="fileList"
:max-count="1"
:show-upload-btn="true"
@after-read="afterRead"
@delete="deleteFile"
></u-upload>
</view>
</view>
<button type="primary" @click="submit">保存</button>
</view>
</view>
</template>
<script>
import VNavigationBarVue from '../../components/VNavigationBar.vue';
import config from '@/config'
import request from "@/utils/request";
import upload from '@/utils/upload'
import {getUserInfo,setUserInfo} from '@/utils/auth'
export default {
components: {
VNavigationBarVue
},
data() {
return {
customInfo:{}
uploadUrl: config.baseUrl+"/app-api/infra/file/upload",
headers: {},
fileList: [],
customInfo:{
id:"",
nickname:"",
mobile:"",
avatar:""
}
};
},
onShow(data) {
onLoad(data) {
//
this.customInfo = JSON.parse(uni.getStorageSync('customerInfo'))
this.customInfo = JSON.parse(getUserInfo())
console.log(this.customInfo)
if(this.customInfo && ""!=this.customInfo.avatar && null!=this.customInfo.avatar){
this.fileList = [
{
url:config.baseImageUrl+this.customInfo.avatar
}
]
}
},
methods:{
afterRead(file) {
//
// uploadFileApi count1 使 await
upload({
url:'/app-api/infra/file/upload',
filePath: file.file.url
}).then((res)=>{
this.fileList=[{
url: config.baseImageUrl+res.data
}]
console.log(this.fileList)
})
},
deleteFile(file, index) {
console.log('删除文件');
this.fileList.splice(index, 1);
},
async submit(){
if(this.fileList.length>0){
this.customInfo.avatar = this.fileList[0].url.replace(config.baseImageUrl,"")
}
let res = await request({
url: '/app-api/system/user/update',
method: 'PUT',
data: this.customInfo,
tenantIdFlag: false
})
console.log(res)
if (res.code == 200) {
uni.showToast({
title: '修改成功',
icon: 'none'
})
//
setUserInfo(JSON.stringify(this.customInfo))
setTimeout(()=>{
//
uni.navigateBack();
},500)
}else {
uni.showToast({
title: '修改失败',
icon: 'none'
})
}
}
}
}
</script>
@ -85,9 +156,8 @@
height: 24rpx;
}
.avatar {
width: 108rpx;
height: 108rpx;
.dl-avatar-box {
text-align: right;
}
}
</style>

View File

@ -3,9 +3,27 @@
<VNavigationBar title="车辆详情" background-color="#fff" title-color="#333"></VNavigationBar>
<view class="body">
<view class="card">
<button type="primary" @click="openCameraScan">识别行驶证</button>
<view class="formItem">
<text class="formLabel">车牌号</text>
<input type="text" style="text-align: right" placeholder="请输入文本" v-model="car.licenseNumber"/>
<text class="formLabel require">是否车主</text>
<view>
<radio-group v-model="car.isOwner" @change="radioChange">
<radio value="1" :checked="car.isOwner=='1'"></radio>
<radio value="0" :checked="car.isOwner=='0'"></radio>
</radio-group>
</view>
</view>
<view class="formItem">
<text class="formLabel require">车牌号</text>
<input type="text" style="text-align: right" placeholder="请输入车牌号" v-model="car.licenseNumber"/>
</view>
<view class="formItem">
<text class="formLabel">车架号</text>
<input type="text" style="text-align: right" placeholder="请输入车架号" v-model="car.vin"/>
</view>
<view class="formItem">
<text class="formLabel">发动机号码</text>
<input type="text" style="text-align: right" placeholder="请输入发动机号码" v-model="car.engineNumber"/>
</view>
<view class="formItem">
<text class="formLabel">品牌</text>
@ -15,13 +33,7 @@
</view>
<view class="formItem">
<text class="formLabel">型号</text>
<input type="text" style="text-align: right" placeholder="请输入文本" v-model="car.carModelInput"/>
</view>
<view class="formItem">
<text class="formLabel">车辆类别</text>
<picker @change="categoryChange" :value="categoryIndex" :range="categoryNamesComputed">
<view class="uni-input">{{ categoryNamesComputed[categoryIndex] }}</view>
</picker>
<input type="text" style="text-align: right" placeholder="请输入型号" v-model="car.carModelInput"/>
</view>
<view class="formItem">
<text class="formLabel">车辆性质</text>
@ -29,6 +41,12 @@
<view class="uni-input">{{ natureNamesComputed[natureIndex] }}</view>
</picker>
</view>
<view class="formItem">
<text class="formLabel">车辆类别</text>
<picker @change="categoryChange" :value="categoryIndex" :range="categoryNamesComputed">
<view class="uni-input">{{ categoryNamesComputed[categoryIndex] }}</view>
</picker>
</view>
<view class="formItem">
<text class="formLabel">注册日期</text>
<picker
@ -42,22 +60,21 @@
</view>
</picker>
</view>
<!-- <view class="formItem">-->
<!-- <text class="formLabel">车辆图片</text>-->
<view class="formItem">
<text class="formLabel">行驶证</text>
<u-upload
:action="uploadUrl"
:headers="headers"
:file-list="fileList"
:max-count="1"
:show-upload-btn="true"
@after-read="afterRead"
@delete="deleteFile"
@success="uploadSuccess"
@fail="uploadFail"
></u-upload>
<!-- <u-upload-->
<!-- :action="uploadUrl"-->
<!-- :headers="headers"-->
<!-- :file-list="fileList"-->
<!-- :max-count="3"-->
<!-- :show-upload-btn="true"-->
<!-- @after-read="afterRead"-->
<!-- @delete="deleteFile"-->
<!-- @success="uploadSuccess"-->
<!-- @fail="uploadFail"-->
<!-- ></u-upload>-->
<!-- </view>-->
</view>
</view>
</view>
<view class="footer">
@ -70,7 +87,7 @@
删除
</view>
<view class="line" v-if="bo1"></view>
<view class="btnItem edit" v-if="bo1" @click="update">
<view class="btnItem edit" v-if="bo1" @click="submit">
<uni-icons type="compose" color="#0174F6"></uni-icons>
保存
</view>
@ -80,7 +97,10 @@
<script>
import VNavigationBar from '@/components/VNavigationBar.vue';
import request from "../../utils/request";
import request from "@/utils/request";
import config from '@/config'
import upload from '@/utils/upload'
import {getJSONData} from '@/utils/auth'
export default {
components: {
@ -88,36 +108,41 @@ export default {
},
data() {
return {
// uploadUrl: 'https://your-server.com/upload',
// headers: {},
// fileList: [],
uploadUrl: config.baseUrl+"/app-api/infra/file/upload",
headers: {},
fileList: [],
car: {
id:"",
//
isOwner:"1",
//
licenseNumber: '',
//
carModelInput: '',
//
vin: '',
//
engineNumber: '',
// id
carBrand:'',
//
carCategory:'',
//
carModelInput: '',
//
carNature:'',
//
carCategory:'',
//
carRegisterDate:'2024-09-24',
carRegisterDate:'',
},
bo1: false,
bo2: true,
categoryIndex: 0,
natureIndex: 0,
brandIndex: 0,
//
categoryList: [],
//
natureList: [],
//
brandList: []
};
},
//
@ -133,13 +158,25 @@ export default {
return this.categoryList.map(item => item.label);
}
},
onShow(){
this.getCameraPhoto()
},
onLoad(options) {
//
if (options.car) {
if (options.id) {
//
this.car = JSON.parse(decodeURIComponent(options.car));
this.car = getJSONData("carInfo");
console.log('初始化页面数据', this.car)
if(this.car.carRegisterDate){
this.car.carRegisterDate = this.timestampToDate(this.car.carRegisterDate)
}
this.fileList = [
{
url:config.baseImageUrl+this.car.carLicenseImg
}
]
this.$forceUpdate()
console.log('初始化页面数据', this.fileList)
this.bo1 = true;
this.bo2 = false;
} else {
@ -147,28 +184,91 @@ export default {
this.bo1 = false;
this.bo2 = true;
}
//
this.getCategoryList();
this.getNatureList();
this.getBrandList();
},
methods: {
// afterRead(file) {
// console.log('');
// },
// deleteFile(file, index) {
// console.log('');
// this.fileList.splice(index, 1);
// },
// uploadSuccess(res, file) {
// console.log('', res);
// },
// uploadFail(error, file) {
// console.log('', error);
// },
radioChange(event){
this.car.isOwner = event.detail.value
},
/**
* 时间戳转文字
* */
timestampToDate(timestamp) {
const date = new Date(timestamp); // timestampDate
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
},
/**
* ocr识别内容自动赋值
* */
getCameraPhoto(){
let pages = getCurrentPages();
let currPage = pages[pages.length-1];
if(typeof(currPage.data.driveLicense) != undefined && currPage.data.driveLicense != null){
let driveLicense = currPage.data.driveLicense;
this.fileList=[{
url: driveLicense.imgUrl
}]
this.car.licenseNumber = driveLicense.plateNo
this.car.vin = driveLicense.vin
this.car.engineNumber = driveLicense.engineNo
this.car.carRegisterDate = driveLicense.registerDate
//
this.brandList.forEach((item, index) => {
if (item.brandName == driveLicense.brand) {
this.brandIndex = index;
this.car.carBrand = this.brandList[index].id;
}
})
//
this.natureList.forEach((item, index) => {
if (item.label == driveLicense.useCharacter) {
this.natureIndex = index;
this.car.carNature = this.natureList[index].value;
}
})
}
},
/**
* 打开摄像头
*/
openCameraScan(){
uni.navigateTo({
url: '/pages/myCar/scan-frame'
});
},
// OCR
recognizeText(imagePath) {
},
afterRead(file) {
//
// uploadFileApi count1 使 await
upload({
url:'/app-api/infra/file/upload',
filePath: file.file.url
}).then((res)=>{
this.fileList.push({
url: config.baseImageUrl+res.data
})
console.log(this.fileList)
})
},
deleteFile(file, index) {
console.log('删除文件');
this.fileList.splice(index, 1);
},
uploadSuccess(res, file) {
console.log('上传成功', res);
},
uploadFail(error, file) {
console.log('上传失败', error);
},
//
brandChange(event) {
//
@ -191,19 +291,17 @@ export default {
//
this.car.carNature = this.natureList[newIndex].value;
},
//
bindDateChange1(e) {
this.car.carRegisterDate = e.target.value; // datadate
},
//
async getCategoryList() {
let res = await request({
url: '/admin-api/system/dict-data/type?type=car_category',
url: '/app-api/system/dict-data/type?type=car_category',
method: 'get',
noTenantId: false
tenantIdFlag: false
})
if (res.code == 200) {
console.log('车辆类别', res.data)
@ -225,9 +323,9 @@ export default {
//
async getNatureList() {
let res = await request({
url: '/admin-api/system/dict-data/type?type=car_nature',
url: '/app-api/system/dict-data/type?type=car_nature',
method: 'get',
noTenantId: false
tenantIdFlag: false
})
if (res.code == 200) {
console.log('车辆性质', res.data)
@ -266,45 +364,56 @@ export default {
}
}
},
//
//
async submit() {
if(this.fileList.length>0){
this.car.carLicenseImg = this.fileList[0].url.replace(config.baseImageUrl,"")
}
let res = await request({
url: '/userClient/base/myCar/create',
url: '/app-api/base/user-car/createOrUpdate',
method: 'POST',
data: this.car,
tenantIdFlag: false
})
if (res.code == 200) {
//
uni.showToast({
title: '保存成功',
icon: 'none'
})
setTimeout(()=>{
//
uni.navigateBack();
},500)
}else {
uni.showToast({
title: '保存失败',
icon: 'none'
})
}
},
//
async del() {
let res = await request({
url: `/userClient/base/myCar/delete?id=${this.car.id}`,
method: 'Delete',
url: `/app-api/base/user-car/delById?id=${this.car.id}`,
method: 'delete',
tenantIdFlag: false
})
if (res.code == 200) {
//
uni.showToast({
title: '删除成功',
icon: 'none'
})
setTimeout(()=>{
//
uni.navigateBack();
},500)
}else {
uni.showToast({
title: '删除失败',
icon: 'none'
})
}
},
//
async update() {
let res = await request({
url: `/userClient/base/myCar/update`,
data: this.car,
method: 'Put',
})
if (res.code == 200) {
}
}
}
}
</script>
@ -345,6 +454,11 @@ export default {
&:last-child {
border: none;
}
.require {
content: "*";
color: red;
}
}
.labelVal {

View File

@ -9,9 +9,12 @@
<view class="carInfo">
<view class="carNum">{{ item.licenseNumber}}</view>
<view class="name">品牌{{ item.brandName }}</view>
<view class="phone">型号{{ item.carModelInput }}</view>
<view class="phone">型号{{ item.carModel || "" }}</view>
</view>
</view>
<view class="no-data" v-if="carList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
</view>
</scroll-view>
</view>
@ -27,7 +30,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue';
import request from "../../utils/request";
import config from "config";
import {getUserInfoRequest} from "@/utils/common.js";
import {getToken,setUserInfo} from '@/utils/auth.js'
import {getToken,setJSONData} from '@/utils/auth.js'
export default {
computed: {
@ -41,12 +44,12 @@ export default {
data() {
return {
carList: [
{
carNum: '鲁A 781NB',
name: '魏书豪',
phone: '15726786903',
image: ''
}
// {
// carNum: 'A 781NB',
// name: '',
// phone: '15726786903',
// image: ''
// }
]
};
},
@ -60,34 +63,27 @@ export default {
uni.reLaunch({
url: '/pages/login/login'
})
}else{
console.log("已登录")
this.getUserInfos()
}
//
this.getList();
},
methods: {
//
async getUserInfos() {
console.log("获取用户信息")
getUserInfoRequest()
},
getList(){
request({
url: '/userClient/base/myCar/get',
url: '/app-api/base/user-car/getMyCar',
method: 'GET',
tenantIdFlag: false
}).then(res => {
console.log(res);
this.carList = res.data;
console.log('图片路径', config.baseImageUrl+this.carList[0].logoImg)
})
},
gotoDetail(item) {
if (item){
setJSONData("carInfo",item)
uni.navigateTo({
url: `/pages/myCar/carDetail?car=${encodeURIComponent(JSON.stringify(item))}`
url: `/pages/myCar/carDetail?id=`+item.id
});
}
else {
@ -120,6 +116,9 @@ export default {
flex-direction: column;
}
.no-data{
text-align: center;
}
.carItem {
box-sizing: border-box;
width: 686rpx;

106
pages/myCar/scan-frame.vue Normal file
View File

@ -0,0 +1,106 @@
<template>
<view class="container">
<VNavigationBar title="车辆详情" background-color="#fff" title-color="#333"></VNavigationBar>
<view class="body">
<camera device-position="back" flash="auto" @error="error" style="width: 100%; height: 500upx;">
<cover-image src="@/static/images/scan-img.png" class="scan-img"></cover-image>
</camera>
<view class="scan-text">请将行驶证放置白色框内</view>
<button type="primary" @click="takePhoto">识别</button>
<view class="scan-img-box"><image mode="widthFix" class="photos-box" :src="src"></image></view>
</view>
</view>
</template>
<script>
import VNavigationBar from '@/components/VNavigationBar.vue';
import request from "@/utils/request";
import config from '@/config'
import upload from '@/utils/upload'
export default {
components: {
VNavigationBar
},
data() {
return {
src: "",
imgUrl:"",
}
},
methods: {
takePhoto() {
const ctx = uni.createCameraContext();
ctx.takePhoto({
quality: 'high',
success: (res) => {
this.src = res.tempImagePath
uni.showLoading({
title: 'OCR自动识别中...'
});
//
upload({
url:'/app-api/infra/file/upload',
filePath: res.tempImagePath
}).then((res)=>{
this.imgUrl = config.baseImageUrl+res.data
//
request({
url: '/app-api/base/user-car/vehicleLicenseOCR',
method: 'POST',
data: this.imgUrl,
tenantIdFlag: false
}).then((res)=>{
res.data['imgUrl'] = this.imgUrl
uni.hideLoading();
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
prevPage.setData({
"driveLicense": res.data,
})
uni.navigateBack();
console.log(res)
})
})
}
});
},
error(e) {
console.log(e.detail);
}
}
}
</script>
<style lang="less" scoped>
.container {
box-sizing: border-box;
height: 100%;
background-color: #f3f5f7;
display: flex;
flex-direction: column;
.body {
flex: 1;
height: 0;
overflow: auto;
.scan-img {
opacity: 0.4;
width: 100%;
height: 500 upx;
}
.scan-text {
font-size: 20px;
text-align: center;
line-height: 60 upx;
}
.scan-img-box{
text-align: center;
}
}
}
</style>

BIN
static/images/nothing.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
static/images/scan-img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -38,3 +38,15 @@ export function getUserInfo() {
export function setUserInfo(userInfo) {
return uni.setStorageSync(UserInfo, userInfo)
}
export function getJSONData(keyStr) {
if(uni.getStorageSync(keyStr)){
return JSON.parse(uni.getStorageSync(keyStr))
}else{
return "";
}
}
export function setJSONData(keyStr,dataObj) {
return uni.setStorageSync(keyStr, JSON.stringify(dataObj))
}

View File

@ -23,7 +23,7 @@ const request = config => {
// 设置租户
const isTanantId = (config.headers || {}).isTanantId === false
config.header = config.header || {}
if(!config.hasOwnProperty("noTenantId")){
if(!config.hasOwnProperty("tenantIdFlag")){
//请求设置了不需要租户,不拼接,,走进这里的是没设置不需要租户的
if(getTenantId() && !isTanantId){
config.header['tenant-id'] = getTenantId()

View File

@ -20,6 +20,7 @@ const upload = config => {
url = url.slice(0, -1)
config.url = url
}
console.log("参数",config)
return new Promise((resolve, reject) => {
uni.uploadFile({
timeout: config.timeout || timeout,