搭建扫码挪车功能及源码分享

实现效果如图:

首先要到这里去申请一个微信通知应用,有了这个应用才能接收到微信的通知:

https://wxpusher.zjiecode.com/admin

 

扫码注册后新建一个应用,你会获得一个appToken

再扫码就能获得你的UID(https://wxpusher.zjiecode.com/admin/main/wxuser/list 这个用户列表里面的UID就是)

保存好appToken和UID,这两个后面需要用到(在源码中填入自己的)

 

源代码如下:(源码中的appToken和UID修改为自己的)

<!DOCTYPE html>
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>通知车主挪车</title><style>* {margin: 0;padding: 0;box-sizing: border-box;}body {font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;line-height: 1.6;background-color: #f8f9fa;color: #333;}.container {max-width: 600px;margin: 20px auto;padding: 20px;background: white;border-radius: 10px;box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);}h1 {text-align: center;color: #2c3e50;margin-bottom: 20px;font-size: 24px;}h3 { font-size: 20px; color: #28A745; line-height: 50px;}.message-area {margin-bottom: 20px;}textarea {width: 100%;height: 120px;padding: 10px;border: 1px solid #ddd;border-radius: 5px;resize: none;font-size: 16px;margin-bottom: 5px;}.char-count {text-align: right;color: #666;font-size: 14px;margin-bottom: 10px;}.templates {margin-bottom: 20px;}.template-btn {background: #f8f9fa;border: 1px solid #ddd;border-radius: 5px;padding: 8px 15px;margin: 0 5px 5px 0;cursor: pointer;font-size: 14px;transition: all 0.3s ease;}.template-btn:hover {background: #e9ecef;}.action-buttons {display: flex;gap: 10px;}button {width: 100%;padding: 15px;margin: 10px 0;font-size: 18px;font-weight: bold;color: #fff;border: none;border-radius: 6px;cursor: pointer;transition: background 0.3s;}.notify-btn {background: #28a745;}.notify-btn:hover {background: #218838;}.call-btn {background: #17a2b8;}.call-btn:hover {background: #138496;}/* 模态框样式 */.modal {display: none;position: fixed;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, 0.5);z-index: 1000;}.modal-content {position: relative;background-color: white;margin: 20% auto;padding: 20px;width: 90%;max-width: 400px;border-radius: 10px;text-align: center;}.modal-title {margin-bottom: 15px;font-size: 18px;color: #2c3e50;}.modal-phone {font-size: 24px;color: #007bff;margin-bottom: 20px;}.modal-buttons {display: flex;gap: 10px;justify-content: center;}.modal-btn {padding: 8px 20px;border: none;border-radius: 5px;cursor: pointer;font-size: 16px;transition: all 0.3s ease;}.confirm-btn {background: #28a745;color: white;}.confirm-btn:hover {background: #218838;}.cancel-btn {background: #dc3545;color: white;}.cancel-btn:hover {background: #c82333;}.car_title{display: flex;align-items: center;justify-content: center;flex-wrap: nowrap;line-height: 30px;}.car_title img{width: 130px;padding:10px;}.car_title div{font-size: 25px;}.template-buttons {display: grid;grid-template-columns: repeat(3, 1fr);gap: 16px;margin: 24px 0;}.template-button {padding: 12px;border: 1px solid var(--border-color);border-radius: 8px;background: #32C9DE;cursor: pointer;font-size: 14px;transition: background-color 0.2s ease;}.template-button:hover{background: #28A555;   }</style></head><body><div class="container"><div class="car_title"><div>通知</div><img src="https://zgh.com/wp-content/uploads/2021/11/logo-geely-no-margin.png"><div>车主挪车</div></div><h3 align="center">临时停靠 请多关照</h3><div class="message-area"><textarea id="messageInput" placeholder="请输入微信通知内容"oninput="updateCharCount()">您好,有人需要您挪车,请及时处理。</textarea><div id="tips" style="color: #666666; font-size: 1rem;">可自行编辑微信通知消息,带来不便,请您见谅</div><div id="charCount" class="char-count">0/200</div></div><div class="template-buttons"><button class="template-button" onclick="useTemplate('default')">默认通知</button><button class="template-button" onclick="useTemplate('polite')">礼貌通知</button><button class="template-button" onclick="useTemplate('urgent')">紧急通知</button></div><p>通知车主,请点击以下按钮</p><button class="notify-btn" id="notifyButton" onclick="notifyOwner()">微信通知车主</button><button class="call-btn" onclick="callOwner()">拨打车主电话</button></div><script>updateCharCount();const charCountEl = document.getElementById('charCount');const templates = {default: "您好,有人需要您挪车,请及时处理。",polite: "您好,很抱歉打扰您。您的爱车可能影响到他人通行,请问方便移动一下吗?",urgent: "紧急情况!您的车辆阻碍消防通道,请立即挪车!"};function useTemplate(type) {messageInput.value = templates[type] || "";charCountEl.textContent = messageInput.value.length;}function startCooldown(duration) {const button = document.getElementById('notifyButton');button.disabled = true;button.classList.add('disabled');// 使用后端提供的冷却时间let cooldown = duration; button.textContent = `冷却中 (${cooldown}s)`;const interval = setInterval(() => {cooldown -= 1;if (cooldown > 0) {button.textContent = `冷却中 (${cooldown}s)`;} else {clearInterval(interval);button.disabled = false;button.classList.remove('disabled');button.textContent = "通知车主挪车";}}, 1000);}function notifyOwner() {const messageInput = document.getElementById('messageInput');fetch("https://wxpusher.zjiecode.com/api/send/message", {method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({//TokenappToken: "AT_你的ATID",content: messageInput.value.trim(),contentType: 1,//通知对象的UIDuids: ["UID_你的UID","UID_你的UID2"]})}).then(response => response.json()).then(data => {if (data.code === 1000) {alert("通知已发送!");// 这里启动30秒的冷却startCooldown(30);} else {alert("发送失败,请稍后重试。");}}).catch(error => {console.error("Error sending notification:", error);alert("发送失败,请检查网络连接。");});}function callOwner() {//这里是手机号码window.location.href = "tel:153xxx你的手机号";}function updateCharCount() {const messageInput = document.getElementById('messageInput');const charCount = document.getElementById('charCount');const notifyBtn = document.getElementsByClassName('notify-btn');const currentLength = messageInput.value.length;charCount.textContent = currentLength + '/200';if (currentLength > 200) {charCount.style.color = '#dc3545';} else {charCount.style.color = '#666';}}</script></body>
</html>

 

最后一步,将该链接生成一个二维码 草料网址二维码生成器 ,然后将二唯码打印后粘贴到车上即可

这样你就拥有了一个完全属于自己的专属挪车功能.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/898059.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

氛围灯系统(VALS)

随着汽车智能化、个性化、舒适性的需求逐年提高,汽车已不再只是简单的交通工具,而是一个能够为人们带来舒适与惬意的场所。高品质的汽车内饰照明在其中扮演了重要的角色,已成为汽车内饰领域中不可忽视的设计元素。氛围灯是一种应用在汽车内部,用于烘托车内环境氛围的内饰灯…

嘎嘎好用!推荐三款开源的 Redis 桌面客户端!

三款开源的 Redis 桌面客户端工具,开箱即用!大家好,我是 Java陈序员。 在日常开发中,经常会使用到 Redis, 为了更好的查看和操作 Redis 中的数据,通常会借助可视化操作客户端工具。 今天,给大家介绍三款开源的 Redis 桌面客户端工具,开箱即用!关注微信公众号:【Java陈…

​政务信创实施宝典:从项目治理到交付的7种必备工具链

政务信创实施是推动政府数字化转型、提升政务服务效能的重要举措。在实施过程中,从项目治理到交付需要运用一系列的工具链,以确保项目的顺利进行和目标的实现。本文将详细介绍七种必备的工具链,帮助政务信创项目实现高效、高质量的实施。 需求管理工具链 需求管理是政务信创…

84. 柱状图中最大的矩形(难)

目录题目单调题解:递增栈 题目给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。求在该柱状图中,能够勾勒出来的矩形的最大面积。单调题解:递增栈左边补0:让heights 数组的索引 0 入栈;右边补0:栈中的 bar 都比它高,能一一出栈。con…

[Welcome to my blog]

欢迎! \(\Large\text{My Blog}\)中学:济南天山高级实验中学 关于我的学校滚滚长江东逝水,浪花淘尽英雄 是非成败转头空 青山依旧在,几度夕阳红 白发渔樵江渚上,观看秋月春风 一壶浊酒喜相逢 古今多少事,都付笑谈中街喧闹,人过往 且记曾相识,莫为少年留 一落红,一枯叶,…

银河麒麟系统配置静态IP

查看网卡名称 ifconfig或 ip addr记住网卡名,下面要用 修改配置文件 vim /etc/network/interfaces 修改内容如下 source /etc/network/interfaces.d/auto enp4s3 iface enp4s3 inet static address 192.168.0.20 netmask 255.255.255.0 gateway 192.168.0.1修改DNS(可选) vi…

MinGW

上次安装,这次又忘了,还是记一下吧 MinGW(Minimalist GNU for Windows)是一个面向Windows操作系统的开发环境,包含了GNU编译器套装(GCC)和其他一些自由软件开发及应用工具。 使用MinGW,开发者可以在Windows平台上编译、构建和运行用C、C++等多种语言编写的应用程序。 下…

Markdown使用html实现折叠

一、文字 <details> <summary>效果</summary> 文本内容 </details>效果 文本内容二、代码块 <details> <summary>效果</summary> ``` 代码 ``` </details>效果 代码三、图片 <details> <summary>效果</summary…

算法心得(3)**差分**

**思路** 差分可以简单的看成**序列中每个元素与其前一个元素的差**一般认为它相当于前缀和的 逆运算 一般在情况满足两个条件时就使用它:(1)影响可以累加(2)有多个影响差分序列的作用:快速一个序列中某个区间内的所有值同时加上或减去一个常数 拿给一维数组A来说:…

NocoBase v1.6.0 正式版发布

集群模式部署、安全策略优化 和 迁移管理,性能、安全性和用户体验的全面提升原文链接:https://www.nocobase.com/cn/blog/nocobase-1-6-0 新特性 集群模式 企业版可通过相关插件支持集群模式部署,应用以集群模式运行时,可以通过多个实例和使用多核模式来提高应用的对并发访…

TypeScript 为什么使用 Go 而不是 Rust 重写 ?官方回应来了

TypeScript官推最近宣布他们正在移植到 Go,速度已经提高了 10 倍之多。 作为以性能为代表的另一语言Rust,人们自然会疑惑为什么没有选Rust语言重构呢?为方便大家快速理解,我用DeepSeek用小红书的语气重新总结了下:(原文放在下方,大家可以继续往下阅读)✨【技术选型大实…

什么情况,今年面试都不问八股文了??准备了几个月,结果一个都不问。。

大家好,我是R哥。 你还在死背八股文? 有好几个兄弟和我说,说背了几个月的八股文,结果面试官一个都不问,全问项目,结果面试被暴击了。 比如这位准备报名我的面试辅导的兄弟:还有这位报了我面试辅导的兄弟也是,全程项目拷打,都没问八股文:什么情况,现在面试都不问八股…