feat: 添加车牌的搭建
This commit is contained in:
BIN
components/AddCarCrad/images/add_car_crad.png
Normal file
BIN
components/AddCarCrad/images/add_car_crad.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
43
components/AddCarCrad/index.vue
Normal file
43
components/AddCarCrad/index.vue
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<template>
|
||||||
|
<view class="add-car-card" @click="handleConfirm">
|
||||||
|
<view class="header-image">
|
||||||
|
<image
|
||||||
|
class="header-img"
|
||||||
|
src="./images/add_car_crad.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="content">
|
||||||
|
<view class="title">请输入车牌号</view>
|
||||||
|
<view class="description">
|
||||||
|
请绑定真实有效的车牌号,否则将无法正常使用车牌付费等功能
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="confirm-btn">
|
||||||
|
<text class="confirm-text">进入绑定</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { defineProps } from "vue";
|
||||||
|
import { navigateTo } from "@/router/index";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
toolCall: {
|
||||||
|
type: Object,
|
||||||
|
default: {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 确认绑定事件
|
||||||
|
const handleConfirm = () => {
|
||||||
|
navigateTo(props.toolCall.url);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "./styles/index.scss";
|
||||||
|
</style>
|
||||||
51
components/AddCarCrad/styles/index.scss
Normal file
51
components/AddCarCrad/styles/index.scss
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
.add-car-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.header-image {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin: -24rpx -24rpx 0 -24rpx;
|
||||||
|
|
||||||
|
.header-img {
|
||||||
|
width: 100%;
|
||||||
|
height: 150px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
align-items: start;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 24rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm-btn {
|
||||||
|
height: 88rpx;
|
||||||
|
background: linear-gradient(135deg, #1898ff 0%, #77e5f9 100%);
|
||||||
|
border-radius: 44rpx;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.confirm-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,4 +16,5 @@ export const CompName = {
|
|||||||
createWorkOrderCard: "createWorkOrderCard",
|
createWorkOrderCard: "createWorkOrderCard",
|
||||||
feedbackCard: "feedbackCard",
|
feedbackCard: "feedbackCard",
|
||||||
discoveryCard: "discoveryCard",
|
discoveryCard: "discoveryCard",
|
||||||
|
addLicensePlate: "addLicensePlate",
|
||||||
};
|
};
|
||||||
17
pages.json
17
pages.json
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
|
||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -47,13 +46,21 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/webview/index",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarBackgroundColor": "#F8F8F8",
|
||||||
|
"navigationBarTitleColor": "#000000"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
// "navigationBarTextStyle": "black",
|
"navigationBarTextstyle": "black",
|
||||||
// // "navigationBarTitleText": "小沐",
|
"navigationBarTitleText": "",
|
||||||
// "navigationBarBackgroundColor": "#F8F8F8",
|
"navigationBarBackgroundcolor": "#F8F8F8",
|
||||||
// "backgroundColor": "#F8F8F8"
|
"backgroundColor": "#F8F8F8"
|
||||||
},
|
},
|
||||||
"uniIdRouter": {}
|
"uniIdRouter": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ watch(
|
|||||||
border-radius: 4px 20px 20px 20px;
|
border-radius: 4px 20px 20px 20px;
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
border-color: #ffffff;
|
border-color: #ffffff;
|
||||||
|
overflow: hidden; // ✅ 超出内容被切掉
|
||||||
|
word-wrap: break-word; // ✅ 长单词自动换行
|
||||||
|
word-break: break-all; // ✅ 强制换行
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { ref, onMounted, onUnmounted } from "vue";
|
|||||||
import ChatMainList from "../chat/ChatMainList.vue";
|
import ChatMainList from "../chat/ChatMainList.vue";
|
||||||
import Calender from "@/components/Calender/index.vue";
|
import Calender from "@/components/Calender/index.vue";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import { GetWxMiniProgramUrlParam } from "@/utils/UrlParams";
|
import { getUrlParams } from "@/utils/UrlParams";
|
||||||
|
|
||||||
import { useAppStore } from "@/store";
|
import { useAppStore } from "@/store";
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ const getWeixinMiniProgramParams = (e) => {
|
|||||||
console.log("Params:", e);
|
console.log("Params:", e);
|
||||||
if (e.q && e.q != "undefined") {
|
if (e.q && e.q != "undefined") {
|
||||||
const qrUrl = decodeURIComponent(e.q); // 获取到二维码原始链接内容
|
const qrUrl = decodeURIComponent(e.q); // 获取到二维码原始链接内容
|
||||||
const params = GetWxMiniProgramUrlParam(qrUrl);
|
const params = getUrlParams(qrUrl);
|
||||||
appStore.setSceneId(params.sceneId);
|
appStore.setSceneId(params.sceneId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
56
pages/webview/index.vue
Normal file
56
pages/webview/index.vue
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<template>
|
||||||
|
<view class="webview">
|
||||||
|
<!-- 使用 NavBar 组件 -->
|
||||||
|
<TopNavBar title="网页浏览" @back="goBack" />
|
||||||
|
|
||||||
|
<!-- WebView 内容区域 -->
|
||||||
|
<view class="webview-content">
|
||||||
|
<web-view :src="webviewUrl"></web-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||||
|
|
||||||
|
const webviewUrl = ref("");
|
||||||
|
|
||||||
|
// 返回上一页
|
||||||
|
const goBack = () => {
|
||||||
|
uni.navigateBack();
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 获取页面参数
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
const currentPage = pages[pages.length - 1];
|
||||||
|
const options = currentPage.options;
|
||||||
|
|
||||||
|
// 从页面参数中获取url
|
||||||
|
if (options.url) {
|
||||||
|
// 对URL进行解码,因为传递时可能被编码了
|
||||||
|
webviewUrl.value = decodeURIComponent(options.url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.webview {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.webview-content {
|
||||||
|
flex: 1;
|
||||||
|
margin-top: calc(44px + var(--status-bar-height));
|
||||||
|
}
|
||||||
|
|
||||||
|
.webview-content {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
20
router/index.js
Normal file
20
router/index.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { objectToUrlParams } from "../utils/UrlParams.js";
|
||||||
|
|
||||||
|
export function navigateTo(url, args) {
|
||||||
|
let targetUrl = url;
|
||||||
|
if (args && typeof args === "object") {
|
||||||
|
// 如果有额外参数,拼接到URL后面
|
||||||
|
const paramString = objectToUrlParams(args);
|
||||||
|
if (paramString) {
|
||||||
|
if (targetUrl.contains("?")) {
|
||||||
|
targetUrl += "&";
|
||||||
|
} else {
|
||||||
|
targetUrl += "?";
|
||||||
|
}
|
||||||
|
targetUrl += paramString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/webview/index?url=" + encodeURIComponent(targetUrl),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export function GetWxMiniProgramUrlParam(url) {
|
export function getUrlParams(url) {
|
||||||
let theRequest = {};
|
let theRequest = {};
|
||||||
if(url.indexOf("#") != -1){
|
if(url.indexOf("#") != -1){
|
||||||
const str=url.split("#")[1];
|
const str=url.split("#")[1];
|
||||||
@@ -15,3 +15,23 @@ export function GetWxMiniProgramUrlParam(url) {
|
|||||||
}
|
}
|
||||||
return theRequest;
|
return theRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将对象参数转换为URL查询字符串格式
|
||||||
|
* @param {Object} args - 参数对象
|
||||||
|
* @returns {String} 返回key=value&格式的查询字符串
|
||||||
|
*/
|
||||||
|
export function objectToUrlParams(args) {
|
||||||
|
if (!args || typeof args !== 'object') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const params = [];
|
||||||
|
for (const key in args) {
|
||||||
|
if (args.hasOwnProperty(key) && args[key] !== undefined && args[key] !== null) {
|
||||||
|
params.push(`${key}=${args[key]}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return params.length > 0 ? params.join('&') : '';
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user