This commit is contained in:
许允枞 2025-03-07 17:57:49 +08:00
parent e3832354d2
commit c125ef96b9
7 changed files with 1751 additions and 1438 deletions

View File

@ -3,9 +3,9 @@
<bt-cropper class="cropper" ref="cropper" :imageSrc="imageSrc"></bt-cropper>
<u-button style="z-index: 999;height: 50px;line-height:50px;position: absolute;bottom: 10px;" text="识别" @click="crop"></u-button>
</view>
</template>
<script>
import request from '../../utils/request'
@ -37,9 +37,9 @@
uni.$emit('updateOcrText',res.data[0])
uni.navigateBack()
}
})
})
}
@ -56,4 +56,4 @@
height:90vh;
}
</style>
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
<map id="map" :show-compass="true" :include-points="points" :polyline="polyline" lang="en" :longitude="center.longitude" :latitude="center.latitude"
:markers="markers" bindmarkertap="handleMarkerTap" show-location
:style="'width:' + windowWidth + 'px;' + 'height:'+ '540rpx;' ">
</map>
<image src="/static/chatImg/fy.png" @click="changeLan" mode="" class="fy_icon" ></image>
<view class="contenr_" v-if="lang=='en'" >
@ -20,22 +20,22 @@
</view>
<!-- -->
<view class="c_c_box">
<view class="ds_" style="flex-wrap: wrap;">
<image src="/static/imgs/icon2.png" style="height: 48rpx;width: 48rpx;"></image>
<view v-for="(item,index) in allData.segments">
<view class="c_c_title" :style="'background-color:' + colorList[index] " v-for="(it,idx) in item.bus" :key="idx" >
<text class="text_line">{{it.enName.split('(')[0]||''}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 下方注释 -->
<view class="ds_">
<text class="text_4">all cost</text>
<text class="text_4">¥{{allData.cost=='[]'?0:allData.cost}}</text>
</view>
</view>
<scroll-view scroll-y :show-scrollbar="false" @scrolltoupper="upper" @scrolltolower="lower"
@ -56,7 +56,7 @@
<view class="b_walk">
<text class="text_3" @click="walkLine(item.walking)">Walk</text>
</view>
</view>
<view class="contenr_bottom_d" v-if="item.bus&&item.bus.length>0" v-for="(it) in item.bus">
<view class="bz_left">
@ -72,18 +72,18 @@
<view class="bz_icon" :style="'background-color:' + colorList[index] ">
<text class="text_3">{{it.enName}}</text>
</view>
</view>
<view class="botton_size">
<text class="text_4">{{it.viaStops.length}} station ({{Number.parseInt(it.duration/60)}} min)</text>
</view>
<text class="text_1" style="margin-top: 39rpx;">{{it.arrivalStop.enName}} station</text>
</view>
</view>
</view>
<view class="contenr_bottom">
<view class="c_b_title">
<image src="/static/imgs/end.png" style="height: 50rpx;width: 45rpx;margin-right: 20rpx;"></image>
@ -107,22 +107,22 @@
</view>
<!-- -->
<view class="c_c_box">
<view class="ds_" style="flex-wrap: wrap;">
<image src="/static/imgs/icon2.png" style="height: 48rpx;width: 48rpx;"></image>
<view v-for="(item,index) in allData.segments">
<view class="c_c_title" :style="'background-color:' + colorList[index] " v-for="(it,idx) in item.bus" :key="idx" >
<text class="text_line">{{it.name.split('(')[0]||''}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 下方注释 -->
<view class="ds_">
<text class="text_4">总花费</text>
<text class="text_4">¥{{allData.cost}}</text>
</view>
</view>
<scroll-view scroll-y :show-scrollbar="false" @scrolltoupper="upper" @scrolltolower="lower"
@ -143,7 +143,7 @@
<view class="b_walk">
<text class="text_3" @click="walkLine(item.walking)">导航</text>
</view>
</view>
<view class="contenr_bottom_d" v-if="item.bus&&item.bus.length>0" v-for="(it) in item.bus">
<view class="bz_left">
@ -159,18 +159,18 @@
<view class="bz_icon" :style="'background-color:' + colorList[index] ">
<text class="text_3">{{it.name}}</text>
</view>
</view>
<view class="botton_size">
<text class="text_4">{{it.viaStops.length}} 站 ({{Number.parseInt(it.duration/60)}} 分钟)</text>
</view>
<text class="text_1" style="margin-top: 39rpx;">{{it.arrivalStop.name}} 站点</text>
</view>
</view>
</view>
<view class="contenr_bottom">
<view class="c_b_title">
<image src="/static/imgs/end.png" style="height: 50rpx;width: 45rpx;margin-right: 20rpx;"></image>
@ -179,7 +179,7 @@
</view>
</scroll-view>
</view>
</view>
</template>
@ -207,7 +207,7 @@
longitude: null
},
mapContext: null,
controls: [],
markers: [],
startPoint: [],
@ -227,7 +227,8 @@
this.startPoint = option.startPoint.split(',')
this.endPoint = option.endPoint.split(',')
this.startExecution()
this.getLatLon()
},
mounted() {
@ -251,6 +252,22 @@
this.lang = 'en'
}
},
getLatLon() {
let _this = this;
uni.getLocation({
// 谷歌使用wgs84 其他使用gcj02
type: 'gcj02', // 使用国测局坐标系
geocode: true,
success: function(res) {
_this.center.longitude = res.longitude
_this.center.latitude = res.latitude
},
fail: function(err) {
console.log('获取位置信息失败: ' + err.errMsg);
uni.setStorageSync("isGetAddress", false)
}
});
},
walkLine(data){
let endInfo = {}
endInfo.location = [data.endLocationLng, data.endLocationLat]
@ -334,7 +351,7 @@
that.polyline.push(item)
//that.points=that.points.concat(item.points)
}
}
}
//进行标记点处理
@ -353,7 +370,7 @@
width: 20,
height: 20,
})
that.markers.push({
id:2,
label:{
@ -402,8 +419,8 @@
latitude: busIt.departureStop.locationLat,
longitude: that.offsetLongitude2(busIt.departureStop.locationLng,30000)
})
that.points.push({
latitude: that.offsetLatitude1(busIt.arrivalStop.locationLat,30000),
longitude: busIt.arrivalStop.locationLng
@ -421,7 +438,7 @@
longitude: that.offsetLongitude2(busIt.arrivalStop.locationLng,30000)
})
}
}
}
console.log(that.points);
@ -481,13 +498,13 @@
.container {
width: 750rpx;
flex: 1;
}
.ds_{
flex-direction: row;
align-items: center;
}
.bottom_pr {
min-height: 160rpx;
@ -495,7 +512,7 @@
bottom: 0rpx;
width: 750rpx;
background: #fff;
box-shadow: 0rpx -2rpx 3rpx 0rpx rgba(50,113,79,0.3);
overflow: hidden;
box-sizing: border-box;
@ -517,8 +534,8 @@
.bz_icon{
box-sizing: border-box;
padding: 18rpx 18rpx;
border-radius: 8rpx ;
display: flex;
justify-content: center;
@ -533,7 +550,7 @@
display: flex;
justify-content: center;
align-items: center;
}
.button_{
width: 686rpx;
@ -544,8 +561,8 @@
justify-content: center;
align-items: center;
z-index: 99999;
}
.qiu_{
width: 16rpx;
@ -563,7 +580,7 @@
.c_b_title{
flex-direction: row;
align-items: center;
}
.button_text{
color: #FFFFFF;
@ -575,11 +592,11 @@
bottom: 0rpx;
width: 750rpx;
background: #fff;
}
.contenr_top{
width: 686rpx;
background: #FFFFFF;
box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0,0,0,0.1);
border-radius: 32rpx 32rpx 32rpx 32rpx;
@ -602,7 +619,7 @@
.c_box{
box-sizing: border-box;
padding: 0px 32rpx;
}
.text_1{
font-size: 32rpx;
@ -634,11 +651,11 @@
.text_5{
font-size: 24rpx;
color: #333333;
margin-right: 10rpx;
}
.c_c_title{
width: 260rpx;
height: 48rpx;
border-radius: 8rpx 8rpx 8rpx 8rpx;
@ -653,21 +670,21 @@
box-sizing: border-box;
padding: 32rpx;
padding-bottom: 0px;
}
.contenr_bottom_d{
box-sizing: border-box;
padding: 11rpx;
padding-top: 0px;
flex-direction: row;
}
.bz_left{
position: relative;
margin-right: 20rpx;
}
.bz_right{
}
.l_t_i{
width: 40rpx;
@ -676,19 +693,19 @@
flex-direction: row;
align-items: center;
justify-content: center;
border: 1rpx solid #fff;
}
.l_t_z{
width: 24rpx;
height: 240rpx;
margin: 4rpx 0rpx;
margin-left: 8rpx;
border-radius: 16rpx ;
}
.po_box{
height: 360rpx;
@ -718,5 +735,5 @@
}
</style>
</style>

View File

@ -196,7 +196,7 @@
</view>
<view class="po_but">
<view class="b_an" @click="goMap()" :class="{'avc_':bindex == 0}">
<text :class="{'avc_':bindex == 0}">Walk</text>
</view>
@ -1113,7 +1113,7 @@
})
}
});
} else {
let that = this
uni.navigateTo({
@ -1121,7 +1121,7 @@
.location +
'&endPoint=' + that.endInfo.location
})
}

View File

@ -1,314 +1,327 @@
<template>
<view class="content">
<view class="top_s">
<view class="search_">
<u-icon name="arrow-left" size="24" @click="goback()"></u-icon>
<view class="newsearch">
<view @click="toQf()" style="margin-left: 10px;" ><u-icon name="camera" color="#32714F" size="28"></u-icon></view>
<view class="newsearch_g">|</view>
<input type="text" v-model="keyword" placeholder="Please enter" />
<view class="anniu" @click="getSound">search</view>
</view>
</view>
<view class="content">
<view class="top_s">
<view class="search_">
<u-icon name="arrow-left" size="24" @click="goback()"></u-icon>
<view class="newsearch">
<view @click="toQf()" style="margin-left: 10px;">
<u-icon name="camera" color="#32714F" size="28"></u-icon>
</view>
<view class="newsearch_g">|</view>
<input type="text" v-model="keyword" placeholder="Please enter"/>
<view class="anniu" @click="getSound">search</view>
</view>
</view>
</view>
<view class="box_" v-if="cityList.length>1">
<view class="h_top">
<view class="icon_">
<image src="../../static/imgs/huohuo.png" style="width: 16px; height: 16px; "></image>
</view>
<view class="sm_">City</view>
<view class="size_"></view>
</view>
<view class="h_" v-for="(item,index) in cityList" :key="index" @click="goclick(item)">
<view class="icon_"><u-icon name="map" size="14"></u-icon></view>
<view class="title_">{{item.cnName}}-{{item.name}}</view>
<view class="size_"></view>
</view>
</view>
<view class="box_" v-if="cityList.length>1">
<view class="h_top">
<view class="icon_">
<image src="../../static/imgs/huohuo.png" style="width: 16px; height: 16px; "></image>
</view>
<view class="sm_">City</view>
<view class="size_"></view>
</view>
<view class="h_" v-for="(item,index) in cityList" :key="index" @click="goclick(item)">
<view class="icon_">
<u-icon name="map" size="14"></u-icon>
</view>
<view class="title_">{{ item.cnName }}-{{ item.name }}</view>
<view class="size_"></view>
</view>
</view>
<view class="box_" >
<view class="h_top">
<view class="icon_"><u-icon name="clock" size="14"></u-icon></view>
<view class="sm_">History</view>
<view class="size_" @click="removeRecord()" >Clear</view>
</view>
<view class="h_" v-for="(item,index) in hisList" :key="index" @click="newclick(item)">
<view class="icon_"><u-icon name="map" size="14"></u-icon></view>
<view class="title_">{{item.cnName}}-{{item.searchName}}</view>
<view class="size_"></view>
</view>
<view class="h_" v-if="hisList.length<1" >
<view style="font-size: 14px;color: #939393;">You have no search history yet~</view>
</view>
</view>
</view>
<view class="box_">
<view class="h_top">
<view class="icon_">
<u-icon name="clock" size="14"></u-icon>
</view>
<view class="sm_">History</view>
<view class="size_" @click="removeRecord()">Clear</view>
</view>
<view class="h_" v-for="(item,index) in hisList" :key="index" @click="newclick(item)">
<view class="icon_">
<u-icon name="map" size="14"></u-icon>
</view>
<view class="title_">{{ item.cnName }}-{{ item.searchName }}</view>
<view class="size_"></view>
</view>
<view class="h_" v-if="hisList.length<1">
<view style="font-size: 14px;color: #939393;">You have no search history yet~</view>
</view>
</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request'
import request from '../../utils/request'
export default {
data() {
return {
keyword: '',
type:'',
hisList: [],
cityList: [],
startPoint: [],
endPoint: [],
city:"",
lon: '116.897442',
lat: '36.67937',
actionStyle:{
width: '50px'
}
export default {
data() {
return {
keyword: '',
type: '',
hisList: [],
cityList: [],
startPoint: [],
endPoint: [],
city: "",
lon: '116.897442',
lat: '36.67937',
actionStyle: {
width: '50px'
}
}
},
onLoad(option) {
if (option.type) {
this.type = option.type
console.log(this.type);
}
this.watchData()
},
onShow() {
this.getmyhis();
},
methods: {
watchData() {
let that = this
uni.$once('updateOcrText', function (res) {
that.keyword = res
that.getSound()
})
},
toQf() {
uni.chooseImage({
count: 1, //9
sizeType: ['original', 'compressed'], //
success: function (res) {
uni.navigateTo({
url: '/components/bt-cropper/index?image=' + res.tempFilePaths[0]
})
}
});
},
removeRecord() {
request({
url: 'system/records/removeRecord',
method: 'delete',
}).then(res => {
console.log(res);
uni.showToast({
title: "cleared!",
icon: 'none'
})
this.getmyhis()
})
},
goback() {
uni.navigateBack()
},
newclick(item) {
let tempData = {
lal: item.location,
location: item.location,
searchName: item.name,
name: item.name,
cnName: item.cnName
}
request({
url: 'system/records/addRecordsInfo',
method: 'post',
data: tempData
})
let res = {type: this.type, data: item}
uni.$emit('updatePosition', res)
uni.navigateBack()
},
goclick(item) {
let tempData = {
lal: item.location,
location: item.location,
searchName: item.name,
name: item.name,
cnName: item.cnName
}
let res = {type: this.type, data: tempData}
request({
url: 'system/records/addRecordsInfo',
method: 'post',
data: tempData
})
uni.$emit('updatePosition', res)
uni.navigateBack()
}
},
onLoad(option) {
if(option.type){
this.type = option.type
console.log(this.type);
}
this.watchData()
},
onShow() {
this.getmyhis();
},
methods: {
watchData() {
let that = this
uni.$once('updateOcrText', function(res) {
that.keyword = res
that.getSound()
})
},
toQf(){
uni.chooseImage({
count: 1, //9
sizeType: ['original', 'compressed'], //
success: function (res) {
uni.navigateTo({
url: '/components/bt-cropper/index?image='+res.tempFilePaths[0]
})
}
});
},
removeRecord(){
request({
url: 'system/records/removeRecord',
method: 'delete',
}).then(res=>{
console.log(res);
uni.showToast({
title:"cleared!",
icon:'none'
})
this.getmyhis()
})
},
goback() {
uni.navigateBack()
},
newclick(item){
let tempData = {
lal:item.location,
location:item.location,
searchName:item.name,
name:item.name,
cnName:item.cnName
}
request({
url: 'system/records/addRecordsInfo',
method: 'post',
data:tempData
})
let res ={type:this.type,data:item}
uni.$emit('updatePosition',res)
uni.navigateBack()
},
goclick(item) {
let tempData = {
lal:item.location,
location:item.location,
searchName:item.name,
name:item.name,
cnName:item.cnName
}
let res ={type:this.type,data:tempData}
request({
url: 'system/records/addRecordsInfo',
method: 'post',
data:tempData
})
uni.$emit('updatePosition',res)
uni.navigateBack()
},
getSound() {
},
getSound() {
let that = this
uni.getLocation({
// 使wgs84 使gcj02
type: 'gcj02', // 使
geocode: true,
success: function (res) {
uni.showLoading({
title: 'Loading...'
});
request({
url: 'system/records/roundSearch?searchName=' + that.keyword +
"&longitude=" + res.longitude + "&latitude=" + res.latitude,
method: 'get',
}).then(res => {
console.log('1119', res);
const data = res.data
if (data && data.length > 1) {
that.cityList = data
let that = this
uni.getLocation({
// 使wgs84 使gcj02
type: 'gcj02', // 使
geocode: true,
success: function(res) {
uni.showLoading({
title: 'Loading...'
});
request({
url: 'system/records/roundSearch?searchName=' + that.keyword +
"&longitude=" + res.longitude + "&latitude=" + res.latitude,
method: 'get',
}).then(res => {
console.log('1119', res);
const data = res.data
if (data&&data.length > 1) {
that.cityList = data
} else {
uni.showToast({
title: "Sorry, we couldn't find anything related to it in the search!",
icon: 'none'
})
}
} else {
uni.showToast({
title: "Sorry, we couldn't find anything related to it in the search!",
icon: 'none'
})
}
}).finally(() => {
uni.hideLoading();
})
},
fail: function (err) {
uni.showToast({
title: 'Failed to get location',
icon: 'none'
})
}
});
},
}).finally(()=>{
uni.hideLoading();
})
},
fail: function(err) {
uni.showToast({
title: 'Failed to get location',
icon: 'none'
})
}
});
},
async getmyhis() {
this.hisList = []
let res = await request({
url: 'system/records/listByOne?orderBy=desc?pageNum=1?pagesize=10',
method: 'get',
})
if (res.code == 200) {
console.log("res", res)
for (var i = 0; i < res.rows.length; i++) {
this.hisList.push(res.rows[i])
}
async getmyhis() {
this.hisList = []
let res = await request({
url: 'system/records/listByOne?orderBy=desc?pageNum=1?pagesize=10',
method: 'get',
})
if (res.code == 200) {
console.log("res", res)
for (var i = 0; i < res.rows.length; i++) {
this.hisList.push(res.rows[i])
}
}
}
}
}
}
}
}
}
</script>
<style scoped lang="scss">
.search_ {
box-sizing: border-box;
width: 100%;
padding: 0px 10px;
display: flex;
align-items: center;
}
.newsearch_g{
color: #939393; line-height: 22px; margin-bottom: 4px;margin-right: 5px;
margin-left: 5px;
}
.newsearch{
width: 100%;
border: 2px solid #32714F;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 2px;
input{
width: 100%;
}
}
.anniu{
background: #32714F;
color: #fff;
box-sizing: border-box;
padding: 8rpx 10rpx;
border-radius: 4px;
}
.search_ {
box-sizing: border-box;
width: 100%;
padding: 0px 10px;
display: flex;
align-items: center;
}
.content {
background: #F8F8F8;
height: 100vh;
}
.newsearch_g {
color: #939393;
line-height: 22px;
margin-bottom: 4px;
margin-right: 5px;
margin-left: 5px;
}
.h_top {
background: #F7F8FA;
border-radius: 6px 6px 0px 0px;
box-sizing: border-box;
padding: 15px;
display: flex;
align-items: center;
}
.newsearch {
width: 100%;
border: 2px solid #32714F;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 2px;
.sm_ {
font-weight: 500;
font-size: 10px;
color: #333333;
width: 80%;
}
input {
width: 100%;
}
}
.top_s {
width: 100%;
height: 114px;
background: #FFFFFF;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
border-radius: 0px 0px 0px 0px;
box-sizing: border-box;
padding-top: 44px;
}
.anniu {
background: #32714F;
color: #fff;
box-sizing: border-box;
padding: 8rpx 10rpx;
border-radius: 4px;
}
.box_ {
width: 95%;
overflow: hidden;
background: #fff;
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.05);
margin: 15px auto;
border-radius: 6px 6px 6px 6px;
.content {
background: #F8F8F8;
height: 100vh;
}
}
.h_top {
background: #F7F8FA;
border-radius: 6px 6px 0px 0px;
box-sizing: border-box;
padding: 15px;
display: flex;
align-items: center;
}
.h_ {
width: 100%;
border-bottom: 1px solid #F2F2F2;
box-sizing: border-box;
padding: 15px;
display: flex;
align-items: center;
}
.sm_ {
font-weight: 500;
font-size: 10px;
color: #333333;
width: 80%;
}
.icon_ {
width: 8%;
display: flex;
align-items: center;
justify-content: center;
}
.top_s {
width: 100%;
height: 114px;
background: #FFFFFF;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
border-radius: 0px 0px 0px 0px;
box-sizing: border-box;
padding-top: 44px;
}
.title_ {
width: 80%;
font-weight: bold;
font-size: 12px;
color: #333333;
}
.box_ {
width: 95%;
overflow: hidden;
background: #fff;
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.05);
margin: 15px auto;
border-radius: 6px 6px 6px 6px;
.size_ {
width: 10%;
font-weight: 400;
font-size: 10px;
color: #999999;
text-align: right;
}
}
.h_ {
width: 100%;
border-bottom: 1px solid #F2F2F2;
box-sizing: border-box;
padding: 15px;
display: flex;
align-items: center;
}
.icon_ {
width: 8%;
display: flex;
align-items: center;
justify-content: center;
}
.title_ {
width: 80%;
font-weight: bold;
font-size: 12px;
color: #333333;
}
.size_ {
width: 10%;
font-weight: 400;
font-size: 10px;
color: #999999;
text-align: right;
}
</style>

View File

@ -230,6 +230,14 @@ export default {
this.getContainer().then(rect => {
this.containerRect = rect;
this.init();
// ** 1.1 **
this.$nextTick(() => {
if (this.imageRect) {
this.imageRect.width *= 1.1; // 10%
this.imageRect.height *= 1.1; // 10%
}
});
});
});
},
@ -561,7 +569,7 @@ export default {
} else {
params.canvasId = this.canvasId;
}
uni.canvasToTempFilePath({
...params,
destWidth: this.target.width,
@ -573,11 +581,11 @@ export default {
const fileReader = new plus.io.FileReader()
fileReader.readAsDataURL(path)
fileReader.onloadend = (res) => { //
resolve(res.target.result);
}
},
fail(err) {
console.log('保存失败,错误信息:',err);