空白格 3 lat temu
rodzic
commit
c0d810be90

+ 6 - 0
.gitignore

@@ -0,0 +1,6 @@
+.hbuilderx
+unpackage
+.idea
+.vscode
+.project
+.DS_Store

+ 3 - 0
main.js

@@ -2,6 +2,9 @@ import App from './App'
 import uView from 'uview-ui'
 Vue.use(uView)
 
+import { VueJsonp } from 'vue-jsonp'
+Vue.use(VueJsonp)
+
 // #ifndef VUE3
 import Vue from 'vue'
 Vue.config.productionTip = false

+ 10 - 1
manifest.json

@@ -68,5 +68,14 @@
     "uniStatistics" : {
         "enable" : false
     },
-    "vueVersion" : "2"
+    "vueVersion" : "2",
+    "h5" : {
+        "sdkConfigs" : {
+            "maps" : {
+                "qqmap" : {
+                    "key" : "CWWBZ-F2T36-ZQ6SU-EDL5X-Y3EUT-3HBIF"
+                }
+            }
+        }
+    }
 }

+ 21 - 0
node_modules/vue-jsonp/LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020 LancerComet
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 153 - 0
node_modules/vue-jsonp/README.md

@@ -0,0 +1,153 @@
+# Vue-jsonp
+
+[![VueJsonp](https://github.com/LancerComet/vue-jsonp/workflows/Test/badge.svg)](https://github.com/LancerComet/vue-jsonp/actions)
+
+A tiny library for handling JSONP request.
+
+## Quick Start
+
+As Vue plugin:
+
+```ts
+import { VueJsonp } from 'vue-jsonp'
+
+// Vue Plugin.
+Vue.use(VueJsonp)
+
+// Now you can use this.$jsonp in Vue components.
+const vm = new Vue()
+vm.$jsonp('/some-jsonp-url', {
+  myCustomUrlParam: 'veryNice'
+})
+```
+
+Use function directly:
+
+```ts
+import { jsonp } from 'vue-jsonp'
+
+jsonp('/some-jsonp-url', {
+  myCustomUrlParam: 'veryNice'
+})
+```
+
+## Send data and set query & function name
+
+### Send data
+
+```ts
+// The request url will be "/some-jsonp-url?name=LancerComet&age=100&callback=jsonp_{RANDOM_STR}".
+jsonp('/some-jsonp-url', {
+  name: 'LancerComet',
+  age: 100
+})
+```
+
+### Custom query & function name
+
+The url uniform is `/url?{callbackQuery}={callbackName}&...`, the default is `/url?callback=jsonp_{RANDOM_STRING}&...`.
+
+And you can change it like this:
+
+```ts
+// The request url will be "/some-jsonp-url?name=LancerComet&age=100&cb=jsonp_func".
+jsonp('/some-jsonp-url', {
+  callbackQuery: 'cb',
+  callbackName: 'jsonp_func',
+  name: 'LancerComet',
+  age: 100
+})
+```
+
+## Module exports
+
+ - `VueJsonp: PluginObject<never>`
+ 
+ - `jsonp<T>: (url: string, param?: IJsonpParam, timeout?: number) => Promise<T>`
+ 
+## API
+
+### IJsonpParam
+
+IJsonpParam is the type of param for jsonp function.
+
+```ts
+/**
+ * JSONP parameter declaration.
+ */
+interface IJsonpParam {
+  /**
+   * Callback query name.
+   * This param is used to define the query name of the callback function.
+   *
+   * @example
+   * // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice"
+   * jsonp('/some-url', {
+   *   callbackQuery: 'myCallback',
+   *   callbackName: 'jsonp_func',
+   *   myCustomUrlParam: 'veryNice'
+   * })
+   *
+   * @default callback
+   */
+  callbackQuery?: string
+
+  /**
+   * Callback function name.
+   * This param is used to define the jsonp function name.
+   *
+   * @example
+   * // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice"
+   * jsonp('/some-url', {
+   *   callbackQuery: 'myCallback',
+   *   callbackName: 'jsonp_func',
+   *   myCustomUrlParam: 'veryNice'
+   * })
+   *
+   * @default jsonp_ + randomStr()
+   */
+  callbackName?: string
+
+  /**
+   * Custom data.
+   */
+  [key: string]: any
+}
+```
+
+## Example
+
+```ts
+import Vue from 'vue'
+import { VueJsonp } from 'vue-jsonp'
+
+Vue.use(VueJsonp)
+
+const vm = new Vue()
+const { code, data, message } = await vm.$jsonp<{
+  code: number,
+  message: string,
+  data: {
+    id: number,
+    nickname: string
+  }
+}>('/my-awesome-url', {
+  name: 'MyName', age: 20
+})
+
+assert(code === 0)
+assert(message === 'ok')
+assert(data.id === 1)
+assert(data.nickname === 'John Smith')
+```
+
+```ts
+import { jsonp } from 'vue-jsonp'
+
+const result = await jsonp<string>('/my-awesome-url')
+assert(result === 'such a jsonp')
+```
+
+## License
+
+MIT

+ 73 - 0
node_modules/vue-jsonp/dist/index.d.ts

@@ -0,0 +1,73 @@
+/**
+ * Vue Jsonp.
+ * # Carry Your World #
+ *
+ * @author: LancerComet
+ * @license: MIT
+ */
+import { PluginObject } from 'vue/types/plugin';
+declare module 'vue/types/vue' {
+    interface Vue {
+        $jsonp: typeof jsonp;
+    }
+}
+/**
+ * Vue JSONP.
+ */
+declare const VueJsonp: PluginObject<never>;
+/**
+ * JSONP function.
+ *
+ * @param { string } url Target URL address.
+ * @param { IJsonpParam } param Querying params object.
+ * @param { number } timeout Timeout setting (ms).
+ *
+ * @example
+ * jsonp('/url', {
+ *   callbackQuery: ''
+ *   callbackName: '',
+ *   name: 'LancerComet',
+ *   age: 26
+ * }, 1000)
+ */
+declare function jsonp<T = any>(url: string, param?: IJsonpParam, timeout?: number): Promise<T>;
+export { VueJsonp, jsonp };
+/**
+ * JSONP parameter declaration.
+ */
+interface IJsonpParam {
+    /**
+     * Callback query name.
+     * This param is used to define the query name of the callback function.
+     *
+     * @example
+     * // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice"
+     * jsonp('/some-url', {
+     *   callbackQuery: 'myCallback',
+     *   callbackName: 'jsonp_func',
+     *   myCustomUrlParam: 'veryNice'
+     * })
+     *
+     * @default callback
+     */
+    callbackQuery?: string;
+    /**
+     * Callback function name.
+     * This param is used to define the jsonp function name.
+     *
+     * @example
+     * // The request url will be "/some-url?myCallback=jsonp_func&myCustomUrlParam=veryNice"
+     * jsonp('/some-url', {
+     *   callbackQuery: 'myCallback',
+     *   callbackName: 'jsonp_func',
+     *   myCustomUrlParam: 'veryNice'
+     * })
+     *
+     * @default jsonp_ + randomStr()
+     */
+    callbackName?: string;
+    /**
+     * Custom data.
+     */
+    [key: string]: any;
+}

Plik diff jest za duży
+ 8 - 0
node_modules/vue-jsonp/dist/index.esm.js


Plik diff jest za duży
+ 8 - 0
node_modules/vue-jsonp/dist/index.js


+ 20 - 0
node_modules/vue-jsonp/dist/utils/index.d.ts

@@ -0,0 +1,20 @@
+/**
+ * Generate random string.
+ *
+ * @return { string }
+ */
+declare function randomStr(): string;
+/**
+ * Format params into querying string.
+ *
+ * @return {string[]}
+ */
+declare function formatParams(queryKey: string, value: any): string[];
+/**
+ * Flat querys.
+ *
+ * @param {string[] | (string[])[]} array
+ * @returns
+ */
+declare function flatten(array: string[] | (string[])[]): string[];
+export { formatParams, flatten, randomStr };

+ 80 - 0
node_modules/vue-jsonp/package.json

@@ -0,0 +1,80 @@
+{
+  "_from": "vue-jsonp",
+  "_id": "vue-jsonp@2.0.0",
+  "_inBundle": false,
+  "_integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA==",
+  "_location": "/vue-jsonp",
+  "_phantomChildren": {},
+  "_requested": {
+    "type": "tag",
+    "registry": true,
+    "raw": "vue-jsonp",
+    "name": "vue-jsonp",
+    "escapedName": "vue-jsonp",
+    "rawSpec": "",
+    "saveSpec": null,
+    "fetchSpec": "latest"
+  },
+  "_requiredBy": [
+    "#USER",
+    "/"
+  ],
+  "_resolved": "https://repo.huaweicloud.com/repository/npm/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
+  "_shasum": "3bfac56bb72941a2511c11e1a123b876f03427f7",
+  "_spec": "vue-jsonp",
+  "_where": "H:\\company-project\\parking_patrol_end",
+  "author": {
+    "name": "LancerComet",
+    "email": "chw644@hotmail.com"
+  },
+  "bugs": {
+    "url": "https://github.com/LancerComet/vue-jsonp/issues"
+  },
+  "bundleDependencies": false,
+  "deprecated": false,
+  "description": "A tiny library for handling JSONP request.",
+  "devDependencies": {
+    "@types/expect-puppeteer": "^4.4.3",
+    "@types/jest": "^26.0.14",
+    "@types/jest-environment-puppeteer": "^4.4.0",
+    "@types/puppeteer": "^3.0.2",
+    "jest": "^26.4.2",
+    "jest-puppeteer": "^4.4.0",
+    "puppeteer": "^5.3.1",
+    "rollup": "^2.28.2",
+    "rollup-plugin-cleanup": "^3.2.1",
+    "rollup-plugin-delete": "^2.0.0",
+    "rollup-plugin-terser": "^7.0.2",
+    "rollup-plugin-typescript2": "^0.27.3",
+    "ts-jest": "^26.4.1",
+    "tslint": "^6.1.3",
+    "typescript": "^4.0.3",
+    "vue": "^2.6.12"
+  },
+  "files": [
+    "dist/",
+    "index.d.ts",
+    "README.md"
+  ],
+  "homepage": "https://github.com/LancerComet/vue-jsonp#readme",
+  "keywords": [
+    "Vue",
+    "JSONP"
+  ],
+  "license": "MIT",
+  "main": "./dist/index.js",
+  "module": "./dist/index.esm.js",
+  "name": "vue-jsonp",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/LancerComet/vue-jsonp.git"
+  },
+  "scripts": {
+    "build": "rollup -c",
+    "prepublish": "npm run test",
+    "pretest": "npm run build",
+    "preversion": "npm run test",
+    "test": "jest"
+  },
+  "version": "2.0.0"
+}

+ 11 - 0
package-lock.json

@@ -0,0 +1,11 @@
+{
+  "requires": true,
+  "lockfileVersion": 1,
+  "dependencies": {
+    "vue-jsonp": {
+      "version": "2.0.0",
+      "resolved": "https://repo.huaweicloud.com/repository/npm/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
+      "integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA=="
+    }
+  }
+}

+ 55 - 2
pages/index/clockIn/clockIn.vue

@@ -13,21 +13,25 @@
 		<view class="clock-tips">
 			<view class="clock-tips-content">
 				<u-icon name="checkmark-circle-fill" color="#0E9CFF" size="15"></u-icon>
-				<view>已经进入考勤范围,潍坊软件园...<text>重新定位?</text></view>
+				<view>已经进入考勤范围,<view class="address">{{ address }}</view><text @click="positionLocation()">重新定位?</text></view>
 			</view>
 		</view>
 	</view>
 </template>
 
 <script>
+	import QQMapWX from '@/static/js/qqmap-wx-jssdk.min.js'
 	export default {
 		data() {
 			return {
-				currentTime: ''
+				currentTime: '',
+				qqMap: new QQMapWX({ key: 'CWWBZ-F2T36-ZQ6SU-EDL5X-Y3EUT-3HBIF', vm: this }),
+				address: ''
 			}
 		},
 		onShow() {
 			this.currentDate();
+			this.positionLocation()
 		},
 		onUnload() {
 			if (this.formatDate) {
@@ -35,6 +39,47 @@
 			}
 		},
 		methods: {
+			positionLocation() {
+				uni.showLoading({
+					title: '定位中...'
+				})
+				wx.getLocation({
+					type: 'gcj02',
+					success: (res) => {
+						this.qqMap.reverseGeocoder({
+							location: {
+								longitude: res.longitude,
+								latitude: res.latitude
+							},
+							success: (res) => {
+								if (res?.result?.formatted_addresses) {
+									this.address = res.result.formatted_addresses.recommend;
+								} else {
+									uni.showToast({
+										title: '获取位置失败!',
+										duration: 3000
+									})
+								}
+								uni.hideLoading()
+							},
+							fail: () => {
+								uni.showToast({
+									title: '获取位置失败!',
+									duration: 3000
+								})
+								uni.hideLoading()
+							}
+						})
+					},
+					fail: () => {
+						uni.showToast({
+							title: '获取位置失败!',
+							duration: 3000
+						})
+						uni.hideLoading()
+					}
+				});
+			},
 			currentDate() {
 				setInterval(this.formatDate, 500);
 			},
@@ -132,4 +177,12 @@
 			}
 		}
 	}
+	.address {
+		display: inline-block;
+		width: 200rpx;
+		line-height: 24rpx;
+		overflow: hidden;
+		white-space: nowrap;
+		text-overflow: ellipsis;
+	}
 </style>

+ 1 - 0
pages/index/gateDetails/gateDetails.vue

@@ -132,6 +132,7 @@
 				background-color: #fff;
 				border-radius: 16rpx;
 				padding: 20rpx;
+				margin-bottom: 20rpx;
 				&-header {
 					display: flex;
 					justify-content: space-between;

+ 1 - 0
pages/index/geomagDetails/geomagDetails.vue

@@ -134,6 +134,7 @@
 				background-color: #fff;
 				border-radius: 16rpx;
 				padding: 20rpx;
+				margin-bottom: 20rpx;
 				&-header {
 					display: flex;
 					justify-content: space-between;

+ 22 - 4
pages/index/index.vue

@@ -4,7 +4,7 @@
 		<view class="index-header">
 			<view class="index-header-left">
 				<view>欢迎登录!</view>
-				<view>张三</view>
+				<view>张三</view>
 			</view>
 			<view class="index-header-right" @click="jumpPage('pages/index/messageCenter/messageCenter')">
 				<u-icon
@@ -93,11 +93,29 @@
 	export default {
 		data() {
 			return {
-				infoVal: 33
+				infoVal: 3
 			}
 		},
-		onLoad() {
-
+		onShow() {
+			uni.getStorage({
+				key: 'Token',
+				success: function(res) {
+					console.log(res.data);
+				},
+				error: function(err) {
+					console.log(err)
+				},
+				complete: (e) => {
+					console.log(e)
+					if (e.data) {
+						
+					} else {
+						uni.$u.route({
+							url: 'pages/login/login'
+						})
+					}
+				}
+			});
 		},
 		methods: {
 			/**

+ 1 - 0
pages/index/lockDetails/lockDetails.vue

@@ -134,6 +134,7 @@
 				background-color: #fff;
 				border-radius: 16rpx;
 				padding: 20rpx;
+				margin-bottom: 20rpx;
 				&-header {
 					display: flex;
 					justify-content: space-between;

+ 4 - 4
pages/index/messageCenter/messageCenter.vue

@@ -32,17 +32,17 @@
 		methods: {
 			queryList(pageNo, pageSize) {
 				this.$refs.paging.complete([{
-						date: '2021年04月22日 21:02:03',
+						date: '2021年12月20日 08:02:03',
 						type: '故障消息',
-						content: '欠费车贵AR366T于11月29日 12:00:03驶入可处路,欠费金额:¥500.00,请前往!'
+						content: '欠费车贵AR366T于12月20日 08:02:03驶入可处路,欠费金额:¥500.00,请前往!'
 					},
 					{
-						date: '2021年04月21日 12:20:03',
+						date: '2021年12月20日 08:20:03',
 						type: '预警消息',
 						content: '可处路-KC002的信号过低,请及时处理!\n设备号:2022112542'
 					},
 					{
-						date: '2021年04月20日 14:05:49',
+						date: '2021年12月20日 09:05:49',
 						type: '应急求助',
 						content: '可处路-KC003有一个车主求紧急求助:求助内容:车车位锁卡住车子了'
 					}

+ 22 - 30
pages/login/login.vue

@@ -5,41 +5,22 @@
 		<view class="login-form">
 			<view class="login-form-title">账号密码登录</view>
 			<view class="login-form-box">
-				<u--form
-					:model="loginForm"
-					:rules="loginRules"
-					ref="loginForm">
+				<u--form :model="loginForm" :rules="loginRules" ref="loginForm">
 					<u-form-item prop="phoneNumber">
-						<u--input
-							v-model="loginForm.phoneNumber"
-							border="surround"
-							placeholder="请输入手机号码"
-							shape="square"
-							fontSize="30rpx"
-							maxlength="11"
-							type="number"
-							color="#B7B7B7"></u--input>
+						<u--input v-model="loginForm.phoneNumber" border="surround" placeholder="请输入手机号码" shape="square"
+							fontSize="30rpx" maxlength="11" type="number" color="#B7B7B7"></u--input>
 					</u-form-item>
 					<u-form-item prop="password">
-						<u--input
-							v-model="loginForm.password"
-							border="surround"
-							:password="true"
-							placeholder="请输入密码"
-							shape="square"
-							fontSize="30rpx"
-							color="#B7B7B7">
+						<u--input v-model="loginForm.password" border="surround" :password="true" placeholder="请输入密码"
+							shape="square" fontSize="30rpx" color="#B7B7B7">
 						</u--input>
 					</u-form-item>
 					<u-form-item>
-						<u-button
-							class="login-form-box-button"
-							type="primary"
-							text="登录"
-							@click="handleLogin"></u-button>
+						<u-button class="login-form-box-button" type="primary" text="登录" @click="handleLogin">
+						</u-button>
 					</u-form-item>
 					<u-form-item>
-						<view class="login-form-box-forget">忘记密码?</view>
+						<view class="login-form-box-forget" @click="jumpPage('pages/mine/changePassword/changePassword')">忘记密码?</view>
 					</u-form-item>
 				</u--form>
 			</view>
@@ -57,9 +38,8 @@
 					password: '123456'
 				},
 				loginRules: {
-					phoneNumber: [
-						{
-							required: true, 
+					phoneNumber: [{
+							required: true,
 							message: '请输入手机号码',
 							trigger: ['blur']
 						},
@@ -83,6 +63,13 @@
 		methods: {
 			handleLogin() {
 				this.$refs.loginForm.validate().then(res => {
+					uni.setStorage({
+						key: 'Token',
+						data: '456123',
+						success: function() {
+							console.log('success');
+						}
+					});
 					uni.$u.route({
 						url: 'pages/index/index',
 						type: 'switchTab'
@@ -96,6 +83,11 @@
 						fontSize: 20
 					})
 				})
+			},
+			jumpPage(url) {
+				uni.$u.route({
+					url
+				})
 			}
 		}
 	}

Plik diff jest za duży
+ 1138 - 0
static/js/qqmap-wx-jssdk.min.js