提交 9bb0a4ee authored 作者: 刘旭's avatar 刘旭

更新地图完成按钮位置

上级 4b27f50d
<template>
<u-navbar back-text="" :title="title" :is-back="isBack" :back-icon-name="backIconName" title-color="#000000"
:background="{ background }" title-width="400" height="48" back-icon-color="#000000"
@click-left="handleLeftIconClick">
<template #default>
<u-icon :name="backIconName" :size="22" color="#000000" style="padding: 14rpx 14rpx 14rpx 24rpx;"
@tap="handleLeftIconClick" />
</template>
<template #right>
<u-icon :name="iconName" :size="22" color="#000000" style="padding: 14rpx 14rpx 14rpx 24rpx;"
@tap="handleRight" />
</template>
</u-navbar>
<u-action-sheet :list="sheetState.list" v-model="sheetState.show" @click="onConfirm" />
<u-navbar
back-text=""
:title="title"
:is-back="isBack"
:back-icon-name="backIconName"
title-color="#000000"
:background="{ background }"
title-width="400"
height="48"
back-icon-color="#000000"
@click-left="handleLeftIconClick"
>
<template #default>
<u-icon
:name="backIconName"
:size="22"
color="#000000"
style="padding: 14rpx 14rpx 14rpx 24rpx"
@tap="handleLeftIconClick"
/>
</template>
<template #right>
<u-icon
v-if="isButton"
:name="iconName"
:size="22"
color="#000000"
style="padding: 14rpx 14rpx 14rpx 24rpx"
@tap="handleRight"
/>
<u-button
v-else
type="primary"
size="mini"
@tap="submit"
style="margin-right: 30rpx"
>完成</u-button
>
</template>
</u-navbar>
<u-action-sheet
:list="sheetState.list"
v-model="sheetState.show"
@click="onConfirm"
/>
</template>
<script setup lang='ts'>
<script setup lang="ts">
defineProps({
title: {
type: String,
default: "",
},
backIconName: {
type: String,
default: "arrow-left",
},
iconName: {
type: String,
default: "more-dot-fill",
},
background: {
type: String,
default: "#eeeeee",
},
sheetList: {
type: Object,
default: [],
},
isBack: {
type: Boolean,
default: false,
},
isButton: {
type: Boolean,
default: true,
},
})
const props = defineProps({
title: {
type: String,
default: ''
},
backIconName: {
type: String,
default: 'arrow-left'
},
iconName: {
type: String,
default: 'more-dot-fill'
const emits = defineEmits(["handleRight", "goback", "submit"])
const sheetState = reactive({
list: [
{
text: "点赞",
color: "blue",
fontSize: 28,
subText: "感谢您的点赞",
},
background: {
type: String,
default: '#eeeeee'
{
text: "分享",
},
sheetList: {
type: Object,
default: []
{
text: "评论",
},
isBack: {
type: Boolean,
default: false
}
],
show: false,
})
const emits = defineEmits(['handleRight', 'goback'])
const handleRight = () => {
sheetState.show = true
// emits('handleRight')
sheetState.show = true
// emits('handleRight')
}
// 点击左侧返回图标
const handleLeftIconClick = () => {
uni.navigateBack()
uni.navigateBack()
}
const sheetState = reactive({
list: [{
text: '点赞',
color: 'blue',
fontSize: 28,
subText: '感谢您的点赞'
}, {
text: '分享'
}, {
text: '评论'
}],
show: false
})
const onConfirm = (index: number) => {
const item = sheetState.list[index]
console.log(item);
const item = sheetState.list[index]
console.log(item)
// switch (item.options.operate) {
// case 'save':
// switch (item.options.operate) {
// case 'save':
// break;
// }
}
// break;
// }
const submit = () => {
emits("submit")
}
</script>
<style lang = "scss" scoped>
:deep(.u-line-1) {
font-weight: bold !important;
font-size: 16px !important;
}
<style lang="scss" scoped>
:deep(.u-icon__icon) {
font-size: 20px !important;
font-weight: bold !important;
font-size: 20px !important;
font-weight: bold !important;
}
</style>
\ No newline at end of file
</style>
......@@ -39,27 +39,6 @@ const props = defineProps({
})
const openMap = () => {
// uni.getLocation({
// type: 'gcj02',
// success(res: any) {
// console.log(res, 'kkk');
// state.coord = res.latitude + ',' + res.longitude
// // alert(state.coord)
// var geolocation = new window.qq.maps.Geolocation(
// "3M5BZ-SFCRJ-AHSF7-XRA5Q-Y6NIJ-DXBH4",
// "myapp"
// )
// geolocation.getLocation(showPosition, showErr)
// function showPosition(position: any) {
// console.log(position, '打印位置信息');
// let backurl = '/pages/setPositioning/map'
// let url = `https://apis.map.qq.com/tools/locpicker?search=1&type=0&backurl=${backurl}&key=3M5BZ-SFCRJ-AHSF7-XRA5Q-Y6NIJ-DXBH4&referer=myapp`
// window.open(url)
// }
// function showErr() { }
// }
// })
uni.navigateTo({
url: '/pages/setPositioning/map'
})
......
<template>
<headers title='考勤地点设置' />
<view v-if="flag" style="width: 100%; height: 100vh">
<iframe id="mapPage" width="100%" height="100%" frameborder=0 :src="src">
</iframe>
</view>
<headers title="考勤地点设置" :is-button="false" @submit="submit" />
<view v-if="flag" class="map">
<iframe id="mapPage" width="100%" height="100%" frameborder="0" :src="src">
</iframe>
</view>
</template>
<script setup lang='ts'>
import headers from '@/components/header/index.vue'
import { zalert } from '@/utils/util'
<script setup lang="ts">
import headers from "@/components/header/index.vue"
import { zalert, toast } from "@/utils/util"
const state = reactive({
key: '3M5BZ-SFCRJ-AHSF7-XRA5Q-Y6NIJ-DXBH4',
coord: ''
key: "3M5BZ-SFCRJ-AHSF7-XRA5Q-Y6NIJ-DXBH4",
coord: "",
})
const src = ref()
const flag = ref(false)
const addrDetail = ref()
window.addEventListener('message', function (event) {
window.addEventListener(
"message",
function (event) {
// 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息
var loc = event.data;
if (loc && loc.module == 'locationPicker') {//防止其他应用也会向该页面post信息,需判断module是否为'locationPicker'
console.log('location', loc);
// uni.navigateBack()
zalert('确定设置为该地址?', () => {
uni.navigateBack()
})
var loc = event.data
if (loc && loc.module == "locationPicker") {
//防止其他应用也会向该页面post信息,需判断module是否为'locationPicker'
addrDetail.value = loc
}
}, false)
},
false
)
const submit = () => {
if (!addrDetail.value) return toast("请选择地址")
console.log("location", addrDetail.value)
zalert("确定设置为该地址?", () => {
uni.navigateBack()
})
}
onMounted(() => {
uni.getLocation({
type: 'gcj02',
success(res: any) {
state.coord = res.latitude + ',' + res.longitude
src.value = `https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=${state.key}&referer=XBRLPX&coord=${state.coord}&zoom=18`
setTimeout(() => {
flag.value = true
}, 100)
}
})
uni.getLocation({
type: "gcj02",
success(res: any) {
state.coord = res.latitude + "," + res.longitude
src.value = `https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=${state.key}&referer=XBRLPX&coord=${state.coord}&zoom=18`
setTimeout(() => {
flag.value = true
}, 100)
},
})
})
</script>
<style lang="scss" scoped>
.map {
width: 100%;
transition: height .3s;
map {
width: 100%;
height: 100%;
}
.cotrons {
text-align: end;
padding: 20rpx;
}
}
position: relative;
width: 100%;
height: 100vh;
.addr {
position: fixed;
bottom: 0;
width: 100%;
background-color: #ffffff;
// height: 500px;
padding: 10rpx;
transition: height .3s;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
.complete {
position: absolute;
top: 5%;
right: 10rpx;
}
}
</style>
\ No newline at end of file
</style>
......@@ -10,7 +10,7 @@ function request(
data?: object | any,
responseType?: string
) {
return new Promise<any>(function(resolve, reject) {
return new Promise<any>(function (resolve, reject) {
let header: any;
const globalStore = useGlobalStore();
uni.showLoading({
......@@ -22,6 +22,9 @@ function request(
Authorization: globalStore.token,
};
}
header = {
'content-type': 'application/json'
};
// #ifdef APP-PLUS
url = baseUrl + url; // 在app上不需要跨域
// #endif
......@@ -36,10 +39,10 @@ function request(
uni.hideLoading();
// 判断是否存在token
if (res.data.code == 200) {
const pages = getCurrentPages();
let currentRoute = pages[pages.length - 1].route;
if (!globalStore.token && currentRoute !== 'pages/login/index')
return uni.reLaunch({ url: '/pages/login/index' });
// const pages = getCurrentPages();
// let currentRoute = pages[pages.length - 1].route;
// if (!globalStore.token && currentRoute !== 'pages/login/index')
// return uni.reLaunch({ url: '/pages/login/index' });
resolve(res);
} else if (res.data.code == 500 || res.data.code === 401) {
uni.showToast({
......
......@@ -61,17 +61,14 @@ export default defineConfig({
},
server: {
host: '0.0.0.0',
port: 7896,
port: 7897,
open: true,
strictPort: false, // 端口被占用直接退出
https: true, // 默认用http方式
proxy: {
'/lowcodeplatform-system': {
target: 'http://192.168.1.156',
},
'/wms-system': {
target: 'http://192.168.1.156',
},
'/XiBU': {
target: 'http://192.168.1.12',
}
},
},
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论