parent
1c522d1002
commit
d1671e1637
@ -0,0 +1,8 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
*.local
|
||||||
|
.history
|
||||||
|
.idea
|
||||||
|
dist/
|
||||||
|
.hbuilderx
|
||||||
|
keys
|
@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-11-21 17:23:51
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-13 14:09:42
|
||||||
|
* @Description: file content
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<script>
|
||||||
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||||
|
CSS.supports('top: constant(a)'))
|
||||||
|
document.write(
|
||||||
|
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||||
|
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
|
</script>
|
||||||
|
<title></title>
|
||||||
|
<!--preload-links-->
|
||||||
|
<!--app-context-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"><!--app-html--></div>
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": [
|
||||||
|
"@dcloudio/types",
|
||||||
|
"miniprogram-api-typings",
|
||||||
|
"mini-types"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"name": "uni-preset-vue",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"dev:app": "uni -p app",
|
||||||
|
"dev:app-android": "uni -p app-android",
|
||||||
|
"dev:app-ios": "uni -p app-ios",
|
||||||
|
"dev:custom": "uni -p",
|
||||||
|
"dev:h5": "uni",
|
||||||
|
"dev:h5:ssr": "uni --ssr",
|
||||||
|
"dev:mp-alipay": "uni -p mp-alipay",
|
||||||
|
"dev:mp-baidu": "uni -p mp-baidu",
|
||||||
|
"dev:mp-kuaishou": "uni -p mp-kuaishou",
|
||||||
|
"dev:mp-lark": "uni -p mp-lark",
|
||||||
|
"dev:mp-qq": "uni -p mp-qq",
|
||||||
|
"dev:mp-toutiao": "uni -p mp-toutiao",
|
||||||
|
"dev:mp-weixin": "uni -p mp-weixin",
|
||||||
|
"dev:quickapp-webview": "uni -p quickapp-webview",
|
||||||
|
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
|
||||||
|
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
|
||||||
|
"build:app": "uni build -p app",
|
||||||
|
"build:app-android": "uni build -p app-android",
|
||||||
|
"build:app-ios": "uni build -p app-ios",
|
||||||
|
"build:custom": "uni build -p",
|
||||||
|
"build:h5": "uni build",
|
||||||
|
"build:h5:ssr": "uni build --ssr",
|
||||||
|
"build:mp-alipay": "uni build -p mp-alipay",
|
||||||
|
"build:mp-baidu": "uni build -p mp-baidu",
|
||||||
|
"build:mp-kuaishou": "uni build -p mp-kuaishou",
|
||||||
|
"build:mp-lark": "uni build -p mp-lark",
|
||||||
|
"build:mp-qq": "uni build -p mp-qq",
|
||||||
|
"build:mp-toutiao": "uni build -p mp-toutiao",
|
||||||
|
"build:mp-weixin": "uni build -p mp-weixin",
|
||||||
|
"build:quickapp-webview": "uni build -p quickapp-webview",
|
||||||
|
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
|
||||||
|
"build:quickapp-webview-union": "uni build -p quickapp-webview-union"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||||
|
"@dcloudio/uni-app": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-app-plus": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-components": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-h5": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-mp-alipay": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-mp-baidu": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-mp-kuaishou": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-mp-lark": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-mp-qq": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-mp-toutiao": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-mp-weixin": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-quickapp-webview": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-ui": "^1.4.23",
|
||||||
|
"@gykeji/jsutil": "^2.0.2",
|
||||||
|
"vue": "^3.2.37",
|
||||||
|
"vue-i18n": "^9.1.9",
|
||||||
|
"vuex": "^4.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@dcloudio/types": "^3.0.13",
|
||||||
|
"@dcloudio/uni-automator": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-cli-shared": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/uni-stacktracey": "3.0.0-3060520221121001",
|
||||||
|
"@dcloudio/vite-plugin-uni": "3.0.0-3060520221121001",
|
||||||
|
"sass": "^1.56.2",
|
||||||
|
"vite": "^2.9.14"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onLaunch } from "@dcloudio/uni-app";
|
||||||
|
import { useStore } from "vuex";
|
||||||
|
import { ApiGetUserInfo } from "./api/user";
|
||||||
|
import { ApiGetCityList } from "./api/city";
|
||||||
|
const $store = useStore();
|
||||||
|
|
||||||
|
onLaunch(() => {
|
||||||
|
console.log('App Launch')
|
||||||
|
getLocation();
|
||||||
|
getUserInfo();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 获取用户信息
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const getUserInfo = async () => {
|
||||||
|
const { error, result } = await ApiGetUserInfo();
|
||||||
|
if (result) {
|
||||||
|
$store.commit("setUserInfo", result);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @Description: 默认定位到当前城市
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const getLocation = async () => {
|
||||||
|
const {error, result}= await ApiGetCityList();
|
||||||
|
uni.getLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
geocode: true,
|
||||||
|
success (res) {
|
||||||
|
const {address,longitude,latitude} = res;
|
||||||
|
$store.commit('setCity',{
|
||||||
|
adcode : result.find(i => i.citycode === address.cityCode).adcode,
|
||||||
|
cityCode: address.cityCode,
|
||||||
|
name: address.city,
|
||||||
|
center: `${longitude},${latitude}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/*每个页面公共css */
|
||||||
|
</style>
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-12-19 15:33:58
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-30 16:48:20
|
||||||
|
* @Description: file content
|
||||||
|
*/
|
||||||
|
import { MsbRequest } from "../plugins/requset";
|
||||||
|
|
||||||
|
const ApiGetUserProgressOrder = () => MsbRequest.get("/UserProgressOrder");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 获取价格
|
||||||
|
* @param {*}
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const ApiGetPrice = (
|
||||||
|
params = {
|
||||||
|
depLongitude, //城市编码
|
||||||
|
depLatitude, //出发地纬度
|
||||||
|
destLongitude, //目的地纬度
|
||||||
|
destLatitude, //目的地纬度
|
||||||
|
cityCode, //城市编码
|
||||||
|
vehicleType, //车辆类型
|
||||||
|
}
|
||||||
|
) => MsbRequest.post("/forecast-price", params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:乘客下单
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const ApiPostOrderAdd = (
|
||||||
|
data = {
|
||||||
|
address,
|
||||||
|
departTime,
|
||||||
|
orderTime,
|
||||||
|
departure,
|
||||||
|
depLongitude,
|
||||||
|
depLatitude,
|
||||||
|
destination,
|
||||||
|
destLongitude,
|
||||||
|
destLatitude,
|
||||||
|
encrypt,
|
||||||
|
fareType,
|
||||||
|
fareVersion,
|
||||||
|
passengerId,
|
||||||
|
passengerPhone,
|
||||||
|
vehicleType,
|
||||||
|
}
|
||||||
|
) => MsbRequest.post("/order/add", data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 乘客取消订单
|
||||||
|
* @param {*} orderId
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const ApiPostOrderCancel = ({orderId}) => MsbRequest.post('/order/cancel',{orderId},{
|
||||||
|
'content-type':'application/x-www-form-urlencoded'
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* @Description: 查询当前用户正在进行的订单
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const ApiGetCurrentOrder = () => MsbRequest.get('/order/current');
|
||||||
|
|
||||||
|
export {
|
||||||
|
ApiGetUserProgressOrder,
|
||||||
|
ApiGetPrice,
|
||||||
|
ApiPostOrderAdd,
|
||||||
|
ApiPostOrderCancel,
|
||||||
|
ApiGetCurrentOrder
|
||||||
|
};
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-12-19 11:30:32
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-30 18:19:04
|
||||||
|
* @Description: file content
|
||||||
|
*/
|
||||||
|
import { MsbRequest } from '../plugins/requset';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 获取验证码
|
||||||
|
* @param {*} passengerPhone
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const ApiGetVerifyCode = ({passengerPhone}) => MsbRequest.post('/verification-code',{
|
||||||
|
passengerPhone
|
||||||
|
},{notVerifyToken:true})
|
||||||
|
/**
|
||||||
|
* @Description: 验证验证码
|
||||||
|
* @param {*} passengerPhone
|
||||||
|
* @param {*} verificationCode
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const ApiPostVerifyCodeCheck = ({passengerPhone,verificationCode}) => MsbRequest.post('/verification-code-check',{
|
||||||
|
passengerPhone,
|
||||||
|
verificationCode,
|
||||||
|
},{notVerifyToken:true})
|
||||||
|
/**
|
||||||
|
* @Description: 根据token获取乘客信息
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
const ApiGetUserInfo = () => MsbRequest.get('/users/');
|
||||||
|
|
||||||
|
export {
|
||||||
|
ApiGetVerifyCode,
|
||||||
|
ApiPostVerifyCodeCheck,
|
||||||
|
ApiGetUserInfo
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<template>
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
|
<web-view v-if="userInfo.id" :src="url" ref="h5WebviewRef" style="width:0px; height:0px"/>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifndef H5 -->
|
||||||
|
<web-view v-if="userInfo.id" :src="url" :fullscreen="false" @message="handleMessage" :webview-styles="{width:'0px',height:'0px'}"/>
|
||||||
|
<!-- #endif -->
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {computed, onMounted, ref} from 'vue';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
const $store = useStore();
|
||||||
|
const $emits = defineEmits(['receiveMsg']);
|
||||||
|
const userInfo = computed(()=> $store.state.userInfo);
|
||||||
|
let url = ref(`/static/sseMessage.html?userId=${userInfo.value.id}&uri=${encodeURIComponent($store.state.serverConf.sse)}`);
|
||||||
|
onMounted(()=>{
|
||||||
|
if(window){
|
||||||
|
window.addEventListener("message", handleMessage, false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const handleMessage = (e)=>{
|
||||||
|
|
||||||
|
$emits('receiveMsg', e.data.data.arg)
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-12-27 14:52:17
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-30 16:33:24
|
||||||
|
* @Description: 字典表
|
||||||
|
*/
|
||||||
|
const ORDER_STATUS = {
|
||||||
|
// 乘客发起订单
|
||||||
|
orderStart : 1,
|
||||||
|
// 司机接单
|
||||||
|
driverReceive: 2,
|
||||||
|
// 司机去接乘客
|
||||||
|
driverToPickUp: 3,
|
||||||
|
// 司机到底上车点
|
||||||
|
driverArriveStartPoint: 4,
|
||||||
|
// 行程开始,乘客上车
|
||||||
|
tripStart: 5,
|
||||||
|
// 行程结束,到达目的地
|
||||||
|
tripFinish: 6,
|
||||||
|
// 发起收款,待支付
|
||||||
|
awaitPay: 7,
|
||||||
|
// 付款完成,订单完成
|
||||||
|
orderFinish: 8,
|
||||||
|
// 订单取消
|
||||||
|
orderCancel: 9,
|
||||||
|
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
ORDER_STATUS
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-12-30 14:47:25
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-30 15:42:42
|
||||||
|
* @Description: 服务端配置
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// #ifdef H5
|
||||||
|
// 支付服务
|
||||||
|
pay: '/payApi',
|
||||||
|
// sse服务
|
||||||
|
sse: '/sseApi',
|
||||||
|
// 其他接口服务
|
||||||
|
other: '/api',
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS ||MP
|
||||||
|
// 支付服务
|
||||||
|
pay: 'http://192.168.40.193:9001',
|
||||||
|
// sse服务
|
||||||
|
sse: 'http://192.168.40.193:60001',
|
||||||
|
// 其他接口服务
|
||||||
|
other: 'http://192.168.40.193:8081'
|
||||||
|
// #endif
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-12-19 10:58:26
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-30 14:51:56
|
||||||
|
* @Description: 本地存储key管理
|
||||||
|
*/
|
||||||
|
const STORAGE_KEY = {
|
||||||
|
token : 'tk',
|
||||||
|
userInfo : 'u_i',
|
||||||
|
serverConf: 's_c'
|
||||||
|
}
|
||||||
|
export default STORAGE_KEY;
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-11-21 17:23:51
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-13 17:41:14
|
||||||
|
* @Description: file content
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
createSSRApp
|
||||||
|
} from "vue";
|
||||||
|
import App from "./App.vue";
|
||||||
|
import store from './store'
|
||||||
|
export function createApp() {
|
||||||
|
const app = createSSRApp(App);
|
||||||
|
app.use(store)
|
||||||
|
return {
|
||||||
|
app,
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"name" : "飞滴出行",
|
||||||
|
"appid" : "__UNI__390779D",
|
||||||
|
"description" : "",
|
||||||
|
"versionName" : "1.0.0",
|
||||||
|
"versionCode" : "100",
|
||||||
|
"transformPx" : false,
|
||||||
|
/* 5+App特有相关 */
|
||||||
|
"app-plus" : {
|
||||||
|
"usingComponents" : true,
|
||||||
|
"nvueStyleCompiler" : "uni-app",
|
||||||
|
"compilerVersion" : 3,
|
||||||
|
"splashscreen" : {
|
||||||
|
"alwaysShowBeforeRender" : true,
|
||||||
|
"waiting" : true,
|
||||||
|
"autoclose" : true,
|
||||||
|
"delay" : 0
|
||||||
|
},
|
||||||
|
/* 模块配置 */
|
||||||
|
"modules" : {},
|
||||||
|
/* 应用发布信息 */
|
||||||
|
"distribute" : {
|
||||||
|
/* android打包配置 */
|
||||||
|
"android" : {
|
||||||
|
"permissions" : [
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
/* ios打包配置 */
|
||||||
|
"ios" : {},
|
||||||
|
/* SDK配置 */
|
||||||
|
"sdkConfigs" : {
|
||||||
|
"maps" : {},
|
||||||
|
"payment" : {
|
||||||
|
"alipay" : {
|
||||||
|
"__platform__" : [ "ios", "android" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* 快应用特有相关 */
|
||||||
|
"quickapp" : {},
|
||||||
|
/* 小程序特有相关 */
|
||||||
|
"mp-weixin" : {
|
||||||
|
"appid" : "",
|
||||||
|
"setting" : {
|
||||||
|
"urlCheck" : false
|
||||||
|
},
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-alipay" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-baidu" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-toutiao" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
},
|
||||||
|
"vueVersion" : "3"
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"path": "pages/index/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "飞滴出行",
|
||||||
|
"titleImage":"/static/logo.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/city",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "飞滴出行",
|
||||||
|
"titleImage":"/static/logo.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/createOrder",
|
||||||
|
"style": {
|
||||||
|
// "navigationBarTitleText": "飞滴出行",
|
||||||
|
"titleImage":"/static/logo.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/orderDetail",
|
||||||
|
"style": {
|
||||||
|
// "navigationBarTitleText": "飞滴出行",
|
||||||
|
"titleImage":"/static/logo.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/pay",
|
||||||
|
"style": {
|
||||||
|
// "navigationBarTitleText": "飞滴出行",
|
||||||
|
"titleImage":"/static/logo.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/login",
|
||||||
|
"style": {
|
||||||
|
// "navigationBarTitleText": "飞滴出行",
|
||||||
|
"titleImage":"/static/logo.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/account",
|
||||||
|
"style": {
|
||||||
|
// "navigationBarTitleText": "飞滴出行",
|
||||||
|
"titleImage":"/static/logo.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
"globalStyle": {
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"navigationBarTitleText": "uni-app",
|
||||||
|
"navigationBarBackgroundColor": "#F8F8F8",
|
||||||
|
"backgroundColor": "#F8F8F8"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
<template>
|
||||||
|
<view class="wrapper">
|
||||||
|
<view class="search-box">
|
||||||
|
<input class="search-input" v-model="searchStr" placeholder="请输入关键词搜索"/>
|
||||||
|
<text @click="handleCancel">取消</text>
|
||||||
|
</view>
|
||||||
|
<view class="city-item" v-for="item in filterList" :key="item.adcode" @click="handleCity(item)">
|
||||||
|
<text>{{item.name}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref, computed } from "vue";
|
||||||
|
import { useStore } from "vuex";
|
||||||
|
import gdMapConf from "../config/gdMapConf";
|
||||||
|
|
||||||
|
const $store = useStore();
|
||||||
|
|
||||||
|
let cityList = ref([]);
|
||||||
|
let searchStr = ref('');
|
||||||
|
let filterList = computed(()=>{
|
||||||
|
return cityList.value.filter(i=> i.name.includes(searchStr.value))
|
||||||
|
});
|
||||||
|
onMounted(()=>{
|
||||||
|
getCityList()
|
||||||
|
})
|
||||||
|
const getCityList = () =>{
|
||||||
|
uni.request({
|
||||||
|
method: 'GET',
|
||||||
|
url: `${gdMapConf.cityApiUrl}?subdistrict=2&key=${gdMapConf.cityKey}`,
|
||||||
|
success(res){
|
||||||
|
cityList.value = formatCity(res.data.districts[0].districts).sort((a,b)=>{
|
||||||
|
return a.name.localeCompare(b.name, 'zh-CN');
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
const formatCity = (data)=>{
|
||||||
|
let arr = [];
|
||||||
|
data.forEach(i => {
|
||||||
|
if(i.citycode.length){
|
||||||
|
arr.push(i);
|
||||||
|
}
|
||||||
|
if(i.districts.length){
|
||||||
|
arr = arr.concat(formatCity(i.districts))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
const handleCity = (item) => {
|
||||||
|
$store.commit('setCity', item);
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCancel = () =>{
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.wrapper{
|
||||||
|
padding: $uni-spacing-max;
|
||||||
|
}
|
||||||
|
.search-box{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: $uni-font-size-base;
|
||||||
|
margin-bottom: $uni-spacing-max;
|
||||||
|
}
|
||||||
|
.search-input{
|
||||||
|
background: $uni-bg-color-grey;
|
||||||
|
font-size: $uni-font-size-sm;
|
||||||
|
height: 50rpx;
|
||||||
|
padding: 0 10rpx;
|
||||||
|
border: 1px solid $uni-border-color;
|
||||||
|
border-radius: $uni-border-radius-base;
|
||||||
|
margin-right: $uni-spacing-big;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.city-item{
|
||||||
|
height: 70rpx;
|
||||||
|
line-height: 70rpx;
|
||||||
|
font-size: $uni-font-size-base;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,105 @@
|
|||||||
|
<template>
|
||||||
|
<view :class="['point-search', {'point-search_show':myVisible}]">
|
||||||
|
<view class="search-box">
|
||||||
|
<text class="search-city" @click="handleCity">{{city.name}}</text>
|
||||||
|
<input class="search-input" v-model="searchStr" @input="handleSearch" placeholder="请输入关键词搜索"/>
|
||||||
|
<text @click="myVisible = false">取消</text>
|
||||||
|
</view>
|
||||||
|
<view class="point-list">
|
||||||
|
<view class="point-item" v-for="item in searchList" :key="item.id" @click="handleChangePoint(item)">
|
||||||
|
<view class="point-item--name">{{item.name}}</view>
|
||||||
|
<view class="point-item--addres">{{item.address}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {computed, inject, ref} from 'vue';
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
const $props = defineProps({
|
||||||
|
visible: {
|
||||||
|
type : Boolean,
|
||||||
|
default : false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const $emits = defineEmits(['change','update:visible']);
|
||||||
|
const $store = useStore();
|
||||||
|
const piMapSearch = inject('mapSearch');
|
||||||
|
const city = computed(()=> $store.state.city)
|
||||||
|
let myVisible = computed({
|
||||||
|
get:()=> $props.visible,
|
||||||
|
set(val){
|
||||||
|
$emits('update:visible',val)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let searchStr = ref('');
|
||||||
|
let searchList = ref([]);
|
||||||
|
const handleSearch = () =>{
|
||||||
|
piMapSearch(searchStr.value,(result)=>{
|
||||||
|
searchList.value = result.pois;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const handleChangePoint = (item) =>{
|
||||||
|
$emits('change', item);
|
||||||
|
myVisible.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCity = () =>{
|
||||||
|
uni.navigateTo({url: '/pages/city'});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.point-search{
|
||||||
|
position: fixed;
|
||||||
|
height: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 9;
|
||||||
|
background: #fff;
|
||||||
|
overflow: auto;
|
||||||
|
transition: all 1s;
|
||||||
|
}
|
||||||
|
.point-search_show{
|
||||||
|
height: calc(100vh - var(--window-top));
|
||||||
|
padding: $uni-spacing-max;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.search-box{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: $uni-font-size-base;
|
||||||
|
margin-bottom: $uni-spacing-max;
|
||||||
|
}
|
||||||
|
.search-input{
|
||||||
|
background: $uni-bg-color-grey;
|
||||||
|
font-size: $uni-font-size-sm;
|
||||||
|
height: 50rpx;
|
||||||
|
padding: 0 10rpx;
|
||||||
|
border: 1px solid $uni-border-color;
|
||||||
|
border-radius: $uni-border-radius-base;
|
||||||
|
margin-right: $uni-spacing-big;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.search-city{
|
||||||
|
font-size: $uni-font-size-base;
|
||||||
|
margin-right: $uni-spacing-big;
|
||||||
|
max-width: 150rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.point-item{
|
||||||
|
font-size: $uni-font-size-base;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
padding: $uni-spacing-lg 0 $uni-spacing-max;
|
||||||
|
&--name{
|
||||||
|
margin: $uni-spacing-big 0;
|
||||||
|
}
|
||||||
|
&--addres{
|
||||||
|
font-size: $uni-font-size-base;
|
||||||
|
color: $uni-text-color-grey;
|
||||||
|
line-height: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<web-view :src="url" />
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { onLoad } from "@dcloudio/uni-app"
|
||||||
|
import { ref } from "@vue/reactivity";
|
||||||
|
import { useStore } from "vuex";
|
||||||
|
const $store = useStore()
|
||||||
|
|
||||||
|
let url = ref()
|
||||||
|
onLoad((option)=>{
|
||||||
|
url.value = `${$store.state.serverConf.pay}/alipay/pay?subject=${decodeURIComponent('车费')}&outTradeNo=${option.id}&totalAmount=${option.price}`;
|
||||||
|
// #ifdef H5
|
||||||
|
window.location.href = url.value;
|
||||||
|
// endif
|
||||||
|
})
|
||||||
|
</script>
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 6.4 KiB |
@ -0,0 +1,67 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-12-19 17:45:07
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-30 15:30:32
|
||||||
|
* @Description: file content
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||||
|
<title>-</title>
|
||||||
|
</head>
|
||||||
|
<script type="text/javascript" src="./uniwebview.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
const identity = 1;
|
||||||
|
let routerQuery = getQuery();
|
||||||
|
let source = null;
|
||||||
|
|
||||||
|
if(window.EventSource){
|
||||||
|
console.info("此浏览器支持SSE");
|
||||||
|
source = new EventSource(`${routerQuery.uri}/connect?userId=${routerQuery.userId}&identity=${identity}`);
|
||||||
|
|
||||||
|
// 监听服务的推送的消息
|
||||||
|
source.addEventListener("message",function (e){
|
||||||
|
content = e.data;
|
||||||
|
setMessageContent(content);
|
||||||
|
});
|
||||||
|
|
||||||
|
}else {
|
||||||
|
setMessageContent("此浏览器不支持");
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMessageContent(content){
|
||||||
|
uni.postMessage({
|
||||||
|
data: JSON.parse(content)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @Description: 获取url参数
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
function getQuery (){
|
||||||
|
let queryArr = window.location.search.substr(1).split('&');
|
||||||
|
let obj = {};
|
||||||
|
queryArr.forEach(item => {
|
||||||
|
const arr = item.split('=');
|
||||||
|
obj[arr[0]] = decodeURIComponent(arr[1]);
|
||||||
|
})
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
// 暂未调用
|
||||||
|
function sourceClose(){
|
||||||
|
console.info("close方法执行");
|
||||||
|
// 客户端source的关闭
|
||||||
|
source.close();
|
||||||
|
// 服务端map的移除
|
||||||
|
httpRequest = new XMLHttpRequest();
|
||||||
|
httpRequest.open("get","http://localhost:9000/close?userId="+userId+"&identity="+identity);
|
||||||
|
httpRequest.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</html>
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-12-13 17:29:11
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-30 16:24:03
|
||||||
|
* @Description: file content
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { createStore } from 'vuex';
|
||||||
|
import STORAGE_KEY from '../config/storageKey';
|
||||||
|
import SERVER_CONF from '../config/serverConf'
|
||||||
|
import gdMapConf from '../config/gdMapConf';
|
||||||
|
const serverConf = uni.getStorageSync(STORAGE_KEY.serverConf);
|
||||||
|
export default createStore({
|
||||||
|
state: {
|
||||||
|
city : gdMapConf.city,
|
||||||
|
token : uni.getStorageSync(STORAGE_KEY.token) || '',
|
||||||
|
userInfo : JSON.parse(uni.getStorageSync(STORAGE_KEY.userInfo) || '{}'),
|
||||||
|
serverConf : serverConf ? JSON.parse(serverConf) : SERVER_CONF
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
setCity(state, data) {
|
||||||
|
state.city = data;
|
||||||
|
},
|
||||||
|
setToken (state, token = ''){
|
||||||
|
state.token = token;
|
||||||
|
uni.setStorageSync(STORAGE_KEY.token, token);
|
||||||
|
},
|
||||||
|
setUserInfo (state, userInfo = {}){
|
||||||
|
state.userInfo = userInfo;
|
||||||
|
uni.setStorageSync(STORAGE_KEY.userInfo, JSON.stringify(userInfo));
|
||||||
|
},
|
||||||
|
setServerConf (state, config){
|
||||||
|
state.serverConf = config;
|
||||||
|
uni.setStorageSync(STORAGE_KEY.serverConf, JSON.stringify(config));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-12-19 10:44:39
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-27 15:47:26
|
||||||
|
* @Description: file content
|
||||||
|
*/
|
||||||
|
const HandleApiError = (error, name) =>{
|
||||||
|
let result = false;
|
||||||
|
if (error) {
|
||||||
|
const tip = name ? `${name}错误:` : '';
|
||||||
|
ShowToast(error.message ? `${tip}${error.message}` : `请求失败: ${error}`);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
const ShowToast = (str) =>{
|
||||||
|
uni.showToast({title:str,duration:3000, icon:'none'});
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
HandleApiError,
|
||||||
|
ShowToast
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch cwl_ch@163.com
|
||||||
|
* @Date: 2022-11-21 17:23:51
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-12-30 16:32:05
|
||||||
|
* @Description: file content
|
||||||
|
*/
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import uni from '@dcloudio/vite-plugin-uni'
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
uni(),
|
||||||
|
],
|
||||||
|
server: {
|
||||||
|
// 浏览器本地开发代理配置
|
||||||
|
proxy: {
|
||||||
|
"/api": {
|
||||||
|
target: "http://192.168.40.193:8081",
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (path) => path.replace(/^\/api/, "/")
|
||||||
|
},
|
||||||
|
"/sseApi": {
|
||||||
|
target: "http://192.168.40.193:60001",
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (path) => path.replace(/^\/sseApi/, "/")
|
||||||
|
},
|
||||||
|
|
||||||
|
"/payApi": {
|
||||||
|
target: "http://192.168.40.193:9001",
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (path) => path.replace(/^\/payApi/, "/")
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
Loading…
Reference in new issue