This commit is contained in:
weipengfei 2024-01-11 19:12:26 +08:00
parent 842f857253
commit 9f9a8ec903
56 changed files with 4590 additions and 668 deletions

11
api/api.js Normal file
View File

@ -0,0 +1,11 @@
import http from "@/utils/http.js";
//登录
export const login = (data) => http.post('/project/login', data, {noAuth:true})
// 上报定位
export const positioning = (data) => http.post('/project/project/positioning', data, {noAuth:true})

31
config/app.js Normal file
View File

@ -0,0 +1,31 @@
let BASE_URL
// 环境
let env = "dev"
// let env = "prod"
let HTTP_REQUEST_URL
let HEADER
if (env == 'dev') {
BASE_URL = 'https://work.lihaink.cn'
} else if (env = 'prod') {
BASE_URL = 'https://work.lihaink.cn'
}
let config = {
HTTP_REQUEST_URL: BASE_URL,
HEADER: {
'content-type': 'application/json',
//#ifdef MP
'Form-type': 'routine',
//#endif
//#ifdef APP-PLUS
'Form-type': 'app',
//#endif
'TOKEN': ''
}
}
export {
config
};

View File

@ -5,8 +5,10 @@ import Vue from 'vue'
import './uni.promisify.adaptor' import './uni.promisify.adaptor'
Vue.config.productionTip = false Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
import store from './store'
const app = new Vue({ const app = new Vue({
...App ...App,
store
}) })
app.$mount() app.$mount()
// #endif // #endif

View File

@ -41,7 +41,8 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>", "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>", "<uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>" "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"
] ],
"minSdkVersion" : 23
}, },
/* ios */ /* ios */
"ios" : { "ios" : {

27
node_modules/charenc/LICENSE.mkd generated vendored Normal file
View File

@ -0,0 +1,27 @@
Copyright © 2011, Paul Vorbach. All rights reserved.
Copyright © 2009, Jeff Mott. All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name Crypto-JS nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

1
node_modules/charenc/README.js generated vendored Normal file
View File

@ -0,0 +1 @@
**enc** provides crypto character encoding utilities.

33
node_modules/charenc/charenc.js generated vendored Normal file
View File

@ -0,0 +1,33 @@
var charenc = {
// UTF-8 encoding
utf8: {
// Convert a string to a byte array
stringToBytes: function(str) {
return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
},
// Convert a byte array to a string
bytesToString: function(bytes) {
return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
}
},
// Binary encoding
bin: {
// Convert a string to a byte array
stringToBytes: function(str) {
for (var bytes = [], i = 0; i < str.length; i++)
bytes.push(str.charCodeAt(i) & 0xFF);
return bytes;
},
// Convert a byte array to a string
bytesToString: function(bytes) {
for (var str = [], i = 0; i < bytes.length; i++)
str.push(String.fromCharCode(bytes[i]));
return str.join('');
}
}
};
module.exports = charenc;

54
node_modules/charenc/package.json generated vendored Normal file
View File

@ -0,0 +1,54 @@
{
"_from": "charenc@~0.0.1",
"_id": "charenc@0.0.2",
"_inBundle": false,
"_integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==",
"_location": "/charenc",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "charenc@~0.0.1",
"name": "charenc",
"escapedName": "charenc",
"rawSpec": "~0.0.1",
"saveSpec": null,
"fetchSpec": "~0.0.1"
},
"_requiredBy": [
"/md5"
],
"_resolved": "https://registry.npmmirror.com/charenc/-/charenc-0.0.2.tgz",
"_shasum": "c0a1d2f3a7092e03774bfa83f14c0fc5790a8667",
"_spec": "charenc@~0.0.1",
"_where": "D:\\里海数字乡村\\work_order\\node_modules\\md5",
"author": {
"name": "Paul Vorbach",
"email": "paul@vorb.de",
"url": "http://vorb.de"
},
"bugs": {
"url": "https://github.com/pvorb/node-charenc/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "character encoding utilities",
"engines": {
"node": "*"
},
"homepage": "https://github.com/pvorb/node-charenc#readme",
"license": "BSD-3-Clause",
"main": "charenc.js",
"name": "charenc",
"repository": {
"type": "git",
"url": "git://github.com/pvorb/node-charenc.git"
},
"tags": [
"utf8",
"binary",
"byte",
"string"
],
"version": "0.0.2"
}

27
node_modules/crypt/LICENSE.mkd generated vendored Normal file
View File

@ -0,0 +1,27 @@
Copyright © 2011, Paul Vorbach. All rights reserved.
Copyright © 2009, Jeff Mott. All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name Crypto-JS nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

1
node_modules/crypt/README.mkd generated vendored Normal file
View File

@ -0,0 +1 @@
**crypt** provides utilities for encryption and hashing

96
node_modules/crypt/crypt.js generated vendored Normal file
View File

@ -0,0 +1,96 @@
(function() {
var base64map
= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
crypt = {
// Bit-wise rotation left
rotl: function(n, b) {
return (n << b) | (n >>> (32 - b));
},
// Bit-wise rotation right
rotr: function(n, b) {
return (n << (32 - b)) | (n >>> b);
},
// Swap big-endian to little-endian and vice versa
endian: function(n) {
// If number given, swap endian
if (n.constructor == Number) {
return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
}
// Else, assume array and swap all items
for (var i = 0; i < n.length; i++)
n[i] = crypt.endian(n[i]);
return n;
},
// Generate an array of any length of random bytes
randomBytes: function(n) {
for (var bytes = []; n > 0; n--)
bytes.push(Math.floor(Math.random() * 256));
return bytes;
},
// Convert a byte array to big-endian 32-bit words
bytesToWords: function(bytes) {
for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
words[b >>> 5] |= bytes[i] << (24 - b % 32);
return words;
},
// Convert big-endian 32-bit words to a byte array
wordsToBytes: function(words) {
for (var bytes = [], b = 0; b < words.length * 32; b += 8)
bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
return bytes;
},
// Convert a byte array to a hex string
bytesToHex: function(bytes) {
for (var hex = [], i = 0; i < bytes.length; i++) {
hex.push((bytes[i] >>> 4).toString(16));
hex.push((bytes[i] & 0xF).toString(16));
}
return hex.join('');
},
// Convert a hex string to a byte array
hexToBytes: function(hex) {
for (var bytes = [], c = 0; c < hex.length; c += 2)
bytes.push(parseInt(hex.substr(c, 2), 16));
return bytes;
},
// Convert a byte array to a base-64 string
bytesToBase64: function(bytes) {
for (var base64 = [], i = 0; i < bytes.length; i += 3) {
var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
for (var j = 0; j < 4; j++)
if (i * 8 + j * 6 <= bytes.length * 8)
base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
else
base64.push('=');
}
return base64.join('');
},
// Convert a base-64 string to a byte array
base64ToBytes: function(base64) {
// Remove non-base-64 characters
base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
imod4 = ++i % 4) {
if (imod4 == 0) continue;
bytes.push(((base64map.indexOf(base64.charAt(i - 1))
& (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
| (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
}
return bytes;
}
};
module.exports = crypt;
})();

52
node_modules/crypt/package.json generated vendored Normal file
View File

@ -0,0 +1,52 @@
{
"_from": "crypt@~0.0.1",
"_id": "crypt@0.0.2",
"_inBundle": false,
"_integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==",
"_location": "/crypt",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "crypt@~0.0.1",
"name": "crypt",
"escapedName": "crypt",
"rawSpec": "~0.0.1",
"saveSpec": null,
"fetchSpec": "~0.0.1"
},
"_requiredBy": [
"/md5"
],
"_resolved": "https://registry.npmmirror.com/crypt/-/crypt-0.0.2.tgz",
"_shasum": "88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b",
"_spec": "crypt@~0.0.1",
"_where": "D:\\里海数字乡村\\work_order\\node_modules\\md5",
"author": {
"name": "Paul Vorbach",
"email": "paul@vorb.de",
"url": "http://vorb.de"
},
"bugs": {
"url": "https://github.com/pvorb/node-crypt/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "utilities for encryption and hashing",
"engines": {
"node": "*"
},
"homepage": "https://github.com/pvorb/node-crypt#readme",
"license": "BSD-3-Clause",
"main": "crypt.js",
"name": "crypt",
"repository": {
"type": "git",
"url": "git://github.com/pvorb/node-crypt.git"
},
"tags": [
"hash",
"security"
],
"version": "0.0.2"
}

21
node_modules/is-buffer/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Feross Aboukhadijeh
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.

53
node_modules/is-buffer/README.md generated vendored Normal file
View File

@ -0,0 +1,53 @@
# is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg
[travis-url]: https://travis-ci.org/feross/is-buffer
[npm-image]: https://img.shields.io/npm/v/is-buffer.svg
[npm-url]: https://npmjs.org/package/is-buffer
[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg
[downloads-url]: https://npmjs.org/package/is-buffer
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer))
[![saucelabs][saucelabs-image]][saucelabs-url]
[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg
[saucelabs-url]: https://saucelabs.com/u/is-buffer
## Why not use `Buffer.isBuffer`?
This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)).
It's future-proof and works in node too!
## install
```bash
npm install is-buffer
```
## usage
```js
var isBuffer = require('is-buffer')
isBuffer(new Buffer(4)) // true
isBuffer(undefined) // false
isBuffer(null) // false
isBuffer('') // false
isBuffer(true) // false
isBuffer(false) // false
isBuffer(0) // false
isBuffer(1) // false
isBuffer(1.0) // false
isBuffer('string') // false
isBuffer({}) // false
isBuffer(function foo () {}) // false
```
## license
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org).

21
node_modules/is-buffer/index.js generated vendored Normal file
View File

@ -0,0 +1,21 @@
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
// The _isBuffer check is for Safari 5-7 support, because it's missing
// Object.prototype.constructor. Remove this eventually
module.exports = function (obj) {
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
}
function isBuffer (obj) {
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}
// For Node v0.10 support. Remove this eventually.
function isSlowBuffer (obj) {
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
}

77
node_modules/is-buffer/package.json generated vendored Normal file
View File

@ -0,0 +1,77 @@
{
"_from": "is-buffer@~1.1.1",
"_id": "is-buffer@1.1.6",
"_inBundle": false,
"_integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"_location": "/is-buffer",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is-buffer@~1.1.1",
"name": "is-buffer",
"escapedName": "is-buffer",
"rawSpec": "~1.1.1",
"saveSpec": null,
"fetchSpec": "~1.1.1"
},
"_requiredBy": [
"/md5"
],
"_resolved": "https://registry.npmmirror.com/is-buffer/-/is-buffer-1.1.6.tgz",
"_shasum": "efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be",
"_spec": "is-buffer@~1.1.1",
"_where": "D:\\里海数字乡村\\work_order\\node_modules\\md5",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
"url": "http://feross.org/"
},
"bugs": {
"url": "https://github.com/feross/is-buffer/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Determine if an object is a Buffer",
"devDependencies": {
"standard": "*",
"tape": "^4.0.0",
"zuul": "^3.0.0"
},
"homepage": "https://github.com/feross/is-buffer#readme",
"keywords": [
"buffer",
"buffers",
"type",
"core buffer",
"browser buffer",
"browserify",
"typed array",
"uint32array",
"int16array",
"int32array",
"float32array",
"float64array",
"browser",
"arraybuffer",
"dataview"
],
"license": "MIT",
"main": "index.js",
"name": "is-buffer",
"repository": {
"type": "git",
"url": "git://github.com/feross/is-buffer.git"
},
"scripts": {
"test": "standard && npm run test-node && npm run test-browser",
"test-browser": "zuul -- test/*.js",
"test-browser-local": "zuul --local -- test/*.js",
"test-node": "tape test/*.js"
},
"testling": {
"files": "test/*.js"
},
"version": "1.1.6"
}

24
node_modules/is-buffer/test/basic.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
var isBuffer = require('../')
var test = require('tape')
test('is-buffer', function (t) {
t.equal(isBuffer(Buffer.alloc(4)), true, 'new Buffer(4)')
t.equal(isBuffer(Buffer.allocUnsafeSlow(100)), true, 'SlowBuffer(100)')
t.equal(isBuffer(undefined), false, 'undefined')
t.equal(isBuffer(null), false, 'null')
t.equal(isBuffer(''), false, 'empty string')
t.equal(isBuffer(true), false, 'true')
t.equal(isBuffer(false), false, 'false')
t.equal(isBuffer(0), false, '0')
t.equal(isBuffer(1), false, '1')
t.equal(isBuffer(1.0), false, '1.0')
t.equal(isBuffer('string'), false, 'string')
t.equal(isBuffer({}), false, '{}')
t.equal(isBuffer([]), false, '[]')
t.equal(isBuffer(function foo () {}), false, 'function foo () {}')
t.equal(isBuffer({ isBuffer: null }), false, '{ isBuffer: null }')
t.equal(isBuffer({ isBuffer: function () { throw new Error() } }), false, '{ isBuffer: function () { throw new Error() } }')
t.end()
})

1
node_modules/md5/.npmignore generated vendored Normal file
View File

@ -0,0 +1 @@
node_modules/mocha

4
node_modules/md5/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,4 @@
language: node_js
node_js:
- 0.6
- 0.8

27
node_modules/md5/LICENSE generated vendored Normal file
View File

@ -0,0 +1,27 @@
Copyright © 2011-2012, Paul Vorbach.
Copyright © 2009, Jeff Mott.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name Crypto-JS nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

108
node_modules/md5/README.md generated vendored Normal file
View File

@ -0,0 +1,108 @@
# MD5
[![build status](https://secure.travis-ci.org/pvorb/node-md5.png)](http://travis-ci.org/pvorb/node-md5)
a JavaScript function for hashing messages with MD5.
## Installation
You can use this package on the server side as well as the client side.
### [Node.js](http://nodejs.org/):
~~~
npm install md5
~~~
## API
~~~ javascript
md5(message)
~~~
* `message` -- `String` or `Buffer`
* returns `String`
## Usage
~~~ javascript
var md5 = require('md5');
console.log(md5('message'));
~~~
This will print the following
~~~
78e731027d8fd50ed642340b7c9a63b3
~~~
It supports buffers, too
~~~ javascript
var fs = require('fs');
var md5 = require('md5');
fs.readFile('example.txt', function(err, buf) {
console.log(md5(buf));
});
~~~
## Versions
Before version 2.0.0 there were two packages called md5 on npm, one lowercase,
one uppercase (the one you're looking at). As of version 2.0.0, all new versions
of this module will go to lowercase [md5](https://www.npmjs.com/package/md5) on
npm. To use the correct version, users of this module will have to change their
code from `require('MD5')` to `require('md5')` if they want to use versions >=
2.0.0.
## Bugs and Issues
If you encounter any bugs or issues, feel free to open an issue at
[github](https://github.com/pvorb/node-md5/issues).
## Credits
This package is based on the work of Jeff Mott, who did a pure JS implementation
of the MD5 algorithm that was published by Ronald L. Rivest in 1991. I needed a
npm package of the algorithm, so I used Jeffs implementation for this package.
The original implementation can be found in the
[CryptoJS](http://code.google.com/p/crypto-js/) project.
## License
~~~
Copyright © 2011-2015, Paul Vorbach.
Copyright © 2009, Jeff Mott.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name Crypto-JS nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~~

160
node_modules/md5/md5.js generated vendored Normal file
View File

@ -0,0 +1,160 @@
(function(){
var crypt = require('crypt'),
utf8 = require('charenc').utf8,
isBuffer = require('is-buffer'),
bin = require('charenc').bin,
// The core
md5 = function (message, options) {
// Convert to byte array
if (message.constructor == String)
if (options && options.encoding === 'binary')
message = bin.stringToBytes(message);
else
message = utf8.stringToBytes(message);
else if (isBuffer(message))
message = Array.prototype.slice.call(message, 0);
else if (!Array.isArray(message))
message = message.toString();
// else, assume byte array already
var m = crypt.bytesToWords(message),
l = message.length * 8,
a = 1732584193,
b = -271733879,
c = -1732584194,
d = 271733878;
// Swap endian
for (var i = 0; i < m.length; i++) {
m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
}
// Padding
m[l >>> 5] |= 0x80 << (l % 32);
m[(((l + 64) >>> 9) << 4) + 14] = l;
// Method shortcuts
var FF = md5._ff,
GG = md5._gg,
HH = md5._hh,
II = md5._ii;
for (var i = 0; i < m.length; i += 16) {
var aa = a,
bb = b,
cc = c,
dd = d;
a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
c = FF(c, d, a, b, m[i+10], 17, -42063);
b = FF(b, c, d, a, m[i+11], 22, -1990404162);
a = FF(a, b, c, d, m[i+12], 7, 1804603682);
d = FF(d, a, b, c, m[i+13], 12, -40341101);
c = FF(c, d, a, b, m[i+14], 17, -1502002290);
b = FF(b, c, d, a, m[i+15], 22, 1236535329);
a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
c = GG(c, d, a, b, m[i+11], 14, 643717713);
b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
d = GG(d, a, b, c, m[i+10], 9, 38016083);
c = GG(c, d, a, b, m[i+15], 14, -660478335);
b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
d = GG(d, a, b, c, m[i+14], 9, -1019803690);
c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
a = GG(a, b, c, d, m[i+13], 5, -1444681467);
d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
b = GG(b, c, d, a, m[i+12], 20, -1926607734);
a = HH(a, b, c, d, m[i+ 5], 4, -378558);
d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
c = HH(c, d, a, b, m[i+11], 16, 1839030562);
b = HH(b, c, d, a, m[i+14], 23, -35309556);
a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
b = HH(b, c, d, a, m[i+10], 23, -1094730640);
a = HH(a, b, c, d, m[i+13], 4, 681279174);
d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
d = HH(d, a, b, c, m[i+12], 11, -421815835);
c = HH(c, d, a, b, m[i+15], 16, 530742520);
b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
a = II(a, b, c, d, m[i+ 0], 6, -198630844);
d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
c = II(c, d, a, b, m[i+14], 15, -1416354905);
b = II(b, c, d, a, m[i+ 5], 21, -57434055);
a = II(a, b, c, d, m[i+12], 6, 1700485571);
d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
c = II(c, d, a, b, m[i+10], 15, -1051523);
b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
d = II(d, a, b, c, m[i+15], 10, -30611744);
c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
b = II(b, c, d, a, m[i+13], 21, 1309151649);
a = II(a, b, c, d, m[i+ 4], 6, -145523070);
d = II(d, a, b, c, m[i+11], 10, -1120210379);
c = II(c, d, a, b, m[i+ 2], 15, 718787259);
b = II(b, c, d, a, m[i+ 9], 21, -343485551);
a = (a + aa) >>> 0;
b = (b + bb) >>> 0;
c = (c + cc) >>> 0;
d = (d + dd) >>> 0;
}
return crypt.endian([a, b, c, d]);
};
// Auxiliary functions
md5._ff = function (a, b, c, d, x, s, t) {
var n = a + (b & c | ~b & d) + (x >>> 0) + t;
return ((n << s) | (n >>> (32 - s))) + b;
};
md5._gg = function (a, b, c, d, x, s, t) {
var n = a + (b & d | c & ~d) + (x >>> 0) + t;
return ((n << s) | (n >>> (32 - s))) + b;
};
md5._hh = function (a, b, c, d, x, s, t) {
var n = a + (b ^ c ^ d) + (x >>> 0) + t;
return ((n << s) | (n >>> (32 - s))) + b;
};
md5._ii = function (a, b, c, d, x, s, t) {
var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
return ((n << s) | (n >>> (32 - s))) + b;
};
// Package private blocksize
md5._blocksize = 16;
md5._digestsize = 16;
module.exports = function (message, options) {
if (message === undefined || message === null)
throw new Error('Illegal argument ' + message);
var digestbytes = crypt.wordsToBytes(md5(message, options));
return options && options.asBytes ? digestbytes :
options && options.asString ? bin.bytesToString(digestbytes) :
crypt.bytesToHex(digestbytes);
};
})();

69
node_modules/md5/package.json generated vendored Normal file
View File

@ -0,0 +1,69 @@
{
"_from": "md5@2.2.1",
"_id": "md5@2.2.1",
"_inBundle": false,
"_integrity": "sha512-PlGG4z5mBANDGCKsYQe0CaUYHdZYZt8ZPZLmEt+Urf0W4GlpTX4HescwHU+dc9+Z/G/vZKYZYFrwgm9VxK6QOQ==",
"_location": "/md5",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "md5@2.2.1",
"name": "md5",
"escapedName": "md5",
"rawSpec": "2.2.1",
"saveSpec": null,
"fetchSpec": "2.2.1"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmmirror.com/md5/-/md5-2.2.1.tgz",
"_shasum": "53ab38d5fe3c8891ba465329ea23fac0540126f9",
"_spec": "md5@2.2.1",
"_where": "D:\\里海数字乡村\\work_order",
"author": {
"name": "Paul Vorbach",
"email": "paul@vorba.ch",
"url": "http://paul.vorba.ch"
},
"bugs": {
"url": "https://github.com/pvorb/node-md5/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "salba"
}
],
"dependencies": {
"charenc": "~0.0.1",
"crypt": "~0.0.1",
"is-buffer": "~1.1.1"
},
"deprecated": false,
"description": "js function for hashing messages with MD5",
"devDependencies": {
"mocha": "~2.3.4"
},
"homepage": "https://github.com/pvorb/node-md5#readme",
"license": "BSD-3-Clause",
"main": "md5.js",
"name": "md5",
"optionalDependencies": {},
"repository": {
"type": "git",
"url": "git://github.com/pvorb/node-md5.git"
},
"scripts": {
"test": "mocha"
},
"tags": [
"md5",
"hash",
"encryption",
"message digest"
],
"version": "2.2.1"
}

45
node_modules/md5/test.js generated vendored Normal file
View File

@ -0,0 +1,45 @@
var md5 = require('./md5.js');
var assert = require('assert');
describe('md5', function () {
it('should throw an error for `undefined`', function() {
assert.throws(function() {
md5(undefined);
});
});
it('should throw an error for `null`', function() {
assert.throws(function() {
md5(null);
});
});
it('should return the expected MD5 hash for "message"', function() {
assert.equal('78e731027d8fd50ed642340b7c9a63b3', md5('message'));
});
it('should not return the same hash for random numbers twice', function() {
var msg1 = Math.floor((Math.random() * 100000) + 1) + (new Date).getTime();
var msg2 = Math.floor((Math.random() * 100000) + 1) + (new Date).getTime();
if (msg1 !== msg2) {
assert.notEqual(md5(msg1), md5(msg2));
} else {
assert.equal(md5(msg1), md5(msg1));
}
});
it('should support Node.js Buffers', function() {
var buffer = new Buffer('message áßäöü', 'utf8');
assert.equal(md5(buffer), md5('message áßäöü'));
})
it('should be able to use a binary encoded string', function() {
var hash1 = md5('abc', { asString: true });
var hash2 = md5(hash1 + 'a', { asString: true, encoding : 'binary' });
var hash3 = md5(hash1 + 'a', { encoding : 'binary' });
assert.equal(hash3, '131f0ac52813044f5110e4aec638c169');
});
});

31
package-lock.json generated Normal file
View File

@ -0,0 +1,31 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmmirror.com/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA=="
},
"crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmmirror.com/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow=="
},
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmmirror.com/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
},
"md5": {
"version": "2.2.1",
"resolved": "https://registry.npmmirror.com/md5/-/md5-2.2.1.tgz",
"integrity": "sha512-PlGG4z5mBANDGCKsYQe0CaUYHdZYZt8ZPZLmEt+Urf0W4GlpTX4HescwHU+dc9+Z/G/vZKYZYFrwgm9VxK6QOQ==",
"requires": {
"charenc": "~0.0.1",
"crypt": "~0.0.1",
"is-buffer": "~1.1.1"
}
}
}
}

View File

@ -3,14 +3,14 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "定位测试" "navigationBarTitleText": "定位"
} }
}, },
{ {
"path" : "pages/test/test", "path" : "pages/test/test",
"style" : "style" :
{ {
"navigationBarTitleText" : "", "navigationBarTitleText" : "我的",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
}, },
@ -18,8 +18,9 @@
"path" : "pages/login/login", "path" : "pages/login/login",
"style" : "style" :
{ {
"navigationBarTitleText" : "", "navigationBarTitleText" : "登录",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false,
"transparentTitle": "always"
} }
} }
], ],
@ -31,11 +32,11 @@
"list": [ "list": [
{ {
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
"text": "高德" "text": "首页"
}, },
{ {
"pagePath": "pages/test/test", "pagePath": "pages/test/test",
"text": "本机" "text": "我的"
} }
] ]
}, },

View File

@ -6,7 +6,7 @@
<!-- <button type="primary" @click="calcDistance">坐标距离计算</button> --> <!-- <button type="primary" @click="calcDistance">坐标距离计算</button> -->
<!-- <button type="primary" @click="onGeoQuery">坐标反查</button> --> <!-- <button type="primary" @click="onGeoQuery">坐标反查</button> -->
<!-- <button type="primary" @click="onRoutePlan">路径规划(唤起外部地图导航)</button> --> <!-- <button type="primary" @click="onRoutePlan">路径规划(唤起外部地图导航)</button> -->
<button type="primary" @click="switchCoordType">切换坐标系,当前:{{coordType}}</button> <!-- <button type="primary" @click="switchCoordType">切换坐标系,当前:{{coordType}}</button> -->
<view class=""> <view class="">
<text :selectable="true">{{result}}</text> <text :selectable="true">{{result}}</text>
</view> </view>
@ -16,6 +16,11 @@
<script> <script>
//引入插件 //引入插件
const aMapHelper = uni.requireNativePlugin("SLY-AMapHelper"); const aMapHelper = uni.requireNativePlugin("SLY-AMapHelper");
// #ifdef APP-PLUS
import addKeepalive from '../../uni_modules/fdm-keepalive';
// #endif
import { positioning } from "@/api/api.js"
import { wgsToGcj } from "@/utils/wgs.js"
export default { export default {
data() { data() {
return { return {
@ -25,7 +30,10 @@
coordIndex: 0, coordIndex: 0,
myLng: 0, myLng: 0,
myLat: 0, myLat: 0,
isGetLocation: false isGetLocation: false,
errCount: 0, //定位失败次数
timer: null,
count: 0
} }
}, },
//退出页面后停止定位 //退出页面后停止定位
@ -35,23 +43,13 @@
computed: { computed: {
coordType() { coordType() {
return this.coordTyps[this.coordIndex] return this.coordTyps[this.coordIndex]
},
userInfo(){
return this.$store.state.app.userInfo;
} }
}, },
onLoad() { onLoad() {
uni.request({ console.log({...this.userInfo});
url:'http://192.168.1.3:3000/upload',
method:'POST',
data: {
time: 111,
location: 192.366
},
success: (res) => {
console.log(res);
},
fail: (err) => {
console.log(err);
}
})
}, },
methods: { methods: {
//单次定位 //单次定位
@ -94,59 +92,113 @@
}, },
//连续定位 //连续定位
trackLocation() { trackLocation() {
try{
// #ifdef APP-PLUS
addKeepalive();
// #endif
this.result = ''; this.result = '';
let count = 0; let count = 0;
this.isGetLocation = true; this.isGetLocation = true;
this.phoneLocation();
aMapHelper.trackLocation({ aMapHelper.trackLocation({
intervalTime: 10*1000, intervalTime: 6*1000,
notificationTitle: '工单系统', notificationTitle: '工单系统',
notificationContent: '正在定位, 请勿关闭', notificationContent: '正在定位, 请勿关闭',
enableTrackExplain: '需要持续获取位置进行上报', enableTrackExplain: '需要持续获取位置进行上报',
coordType: this.coordType coordType: this.coordType
}, (res) => { }, (res) => {
//调试时请以控制台日志是否持续打印为准息屏后view页面可能不会更新result结果 //调试时请以控制台日志是否持续打印为准息屏后view页面可能不会更新result结果
console.log("【持续定位结果】", `时间:${res.formatTime},坐标:${res.longitude},${res.latitude}, 信息:`, res); // console.log("【持续定位结果】", `时间:${res.formatTime},坐标:${res.longitude},${res.latitude}, 信息:`, res);
uni.request({ // if(res.errorCode == 0){
url:'http://192.168.1.3:3000/upload', // if(this.errCount>3) this.phoneLocation();
method:'POST', // else this.errCount++;
data: { // }
time: res.formatTime, // if (res.errorCode == 0) {
location: `${res.longitude},${res.latitude}` // this.result =
// `
// 定位次数:${++count}
// 定位时间:${res.formatTime}
// 坐标:${res.longitude},${res.latitude}
// 坐标系:${res.coordType}
// 设备方向:${res.direction}
// 海拔:${res.altitude}米`
// positioning({
// member_code: this.userInfo.code,
// positioning: `${res.longitude},${res.latitude}`
// }).then(ok=>{
// console.log('上传成功', ok);
// }).catch(err=>{
// console.log('上传失败', err);
// })
// } else if (res.errorCode == 12) {
// let deniedPermissionAndNoAsk = res.deniedPermissionAndNoAsk;
// uni.showModal({
// title: '提示',
// content: res.errorInfo,
// success: (res) => {
// if (res.confirm && deniedPermissionAndNoAsk) {
// aMapHelper.openSettingPage();
// }
// }
// })
// }
})
}catch(e){
//TODO handle the exception
}
}, },
//本机连续定位
phoneLocation(){
if (this.timer) {
clearInterval(this.timer);
} else {
this.count++;
this.getAddress();
this.timer = setInterval(() => {
this.count++;
this.getAddress();
}, 6 * 1000);
}
},
getAddress() {
uni.getLocation({
geocode: true,
success: (res) => { success: (res) => {
console.log('success', res); console.log('本机获取定位成功', res);
res = wgsToGcj(res);
this.result = `
定位次数:${this.count}
定位时间:${this.formatDate(new Date())}
坐标:${res.longitude},${res.latitude}`
positioning({
member_code: this.userInfo.code,
positioning: `${res.longitude},${res.latitude}`
}).then(ok=>{
console.log('上传成功', ok);
}).catch(err=>{
console.log('上传失败', err);
})
}, },
fail: (err) => { fail: (err) => {
console.log('error', err); console.log('本机获取定位失败', err);
} }
}) })
if (res.errorCode == 0) { },
this.result = formatDate(date) {
` const year = date.getFullYear();
定位次数:${++count} const month = String(date.getMonth() + 1).padStart(2, '0');
定位时间:${res.formatTime} const day = String(date.getDate()).padStart(2, '0');
坐标:${res.longitude},${res.latitude} const hours = String(date.getHours()).padStart(2, '0');
坐标系:${res.coordType} const minutes = String(date.getMinutes()).padStart(2, '0');
设备方向:${res.direction} const seconds = String(date.getSeconds()).padStart(2, '0');
海拔:${res.altitude}米`
} else if (res.errorCode == 12) { return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
let deniedPermissionAndNoAsk = res.deniedPermissionAndNoAsk;
uni.showModal({
title: '提示',
content: res.errorInfo,
success: (res) => {
if (res.confirm && deniedPermissionAndNoAsk) {
aMapHelper.openSettingPage();
}
}
})
}
})
}, },
//停止定位 //停止定位
stopLocation() { stopLocation() {
aMapHelper.stopLocation(); aMapHelper.stopLocation();
clearInterval(this.timer);
this.isGetLocation = false; this.isGetLocation = false;
}, },
//计算坐标距离 //计算坐标距离

View File

@ -5,19 +5,19 @@
<view class="t-b"> <view class="t-b">
您好 您好
<br /> <br />
欢迎使用工单系统 欢迎使用工单系统!
</view> </view>
</view> </view>
<view class="login-view" style=""> <view class="login-view" style="">
<view class="t-login"> <view class="t-login">
<form class="cl"> <form class="cl">
<view class="t-a"> <view class="t-a">
<text class="txt">手机</text> <text class="txt"></text>
<input type="number" name="phone" placeholder="请输入您的手机号" maxlength="11" v-model="phone" /> <input name="account" placeholder="请输入您的账号" v-model="account" />
</view> </view>
<view class="t-a"> <view class="t-a">
<text class="txt">密码</text> <text class="txt">密码</text>
<input type="password" name="code" maxlength="18" placeholder="请输入您的密码" v-model="pwd" /> <input type="password" name="code" maxlength="18" placeholder="请输入您的密码" v-model="password" />
</view> </view>
<button @tap="login()"> </button> <button @tap="login()"> </button>
</form> </form>
@ -26,31 +26,63 @@
</view> </view>
</template> </template>
<script> <script>
import md5 from 'md5'
import {login} from '@/api/api.js'
export default { export default {
data() { data() {
return { return {
phone: '', // account: '123456', //
pwd: '' // password: '123456' //
}; };
}, },
onLoad() {}, onLoad() {
},
methods: { methods: {
// //
login() { login() {
var that = this; uni.showLoading({
if (!that.phone) { title:'登录中'
uni.showToast({ title: '请输入您的手机号', icon: 'none' }); })
if (!this.account) {
uni.showToast({ title: '请输入您的账号', icon: 'none' });
return; return;
} }
if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(that.phone)) { // if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.account)) {
uni.showToast({ title: '请输入正确手机号', icon: 'none' }); // uni.showToast({ title: '', icon: 'none' });
return; // return;
} // }
if (!that.pwd) { if (!this.password) {
uni.showToast({ title: '请输入您的密码', icon: 'none' }); uni.showToast({ title: '请输入您的密码', icon: 'none' });
return; return;
} }
uni.showToast({ title: '登录成功!', icon: 'none' }); let query = {
account: this.account,
password: md5(this.password),
clientid: '',
remember_me: true
}
login(query).then(res=>{
uni.setStorageSync('query', JSON.stringify(query));
this.$store.commit('SET_USERINFO', res.member);
this.$store.commit('SET_TOKEN', {
token: res.tokenList.tokenType ? res.tokenList.tokenType + ' ' + res.tokenList.accessToken : res.tokenList.accessToken,
token_time: res.tokenList.accessTokenExp
});
uni.hideLoading();
// uni.showToast({
// icon:'none',
// title:''
// })
uni.switchTab({
url:'/pages/index/index'
})
}).catch(err=>{
uni.hideLoading();
uni.showToast({
icon:'none',
title: err
})
})
}, },
} }
}; };
@ -63,8 +95,8 @@ export default {
} }
.img-a { .img-a {
width: 100%; width: 100%;
height: 450rpx; height: 550rpx;
background-image: url(https://zhoukaiwen.com/img/loginImg/head.png); background-image: url(@/static/head.png);
background-size: 100%; background-size: 100%;
} }
.reg { .reg {
@ -121,7 +153,7 @@ export default {
text-align: left; text-align: left;
font-size: 42rpx; font-size: 42rpx;
color: #ffffff; color: #ffffff;
padding: 130rpx 0 0 70rpx; padding: 160rpx 0 0 70rpx;
font-weight: bold; font-weight: bold;
line-height: 70rpx; line-height: 70rpx;
} }

View File

@ -1,86 +1,54 @@
<template> <template>
<view> <view>
<button type="primary" @click="open">开始定位(已获取{{count}})</button> <!-- <button type="primary" @click="open">开始定位(已获取{{count}})</button>
<button type="primary" @click="close">停止定位</button> <button type="primary" @click="close">停止定位</button>
<view v-for="(item, index) in list" :key="index" :class="item.type==0?'green': 'red'"> <view v-for="(item, index) in list" :key="index" :class="item.type==0?'green': 'red'">
<view>{{item.a}}</view> <view>{{item.a}}</view>
<view style="color: #333;">{{item.b}}</view> <view style="color: #333;">{{item.b}}</view>
</view> </view> -->
<button type="primary" @click="logout">退出登录</button>
</view> </view>
</template> </template>
<script> <script>
// #ifdef APP-PLUS
import addKeepalive from '../../uni_modules/fdm-keepalive'
// #endif
export default { export default {
data() { data() {
return { return {
list: [], list: [],
timer: null,
count: 0 count: 0
} }
}, },
onLoad() { onLoad() {
// #ifdef APP-PLUS console.log(this.userInfo);
addKeepalive() },
// #endif computed: {
userInfo(){
return this.$store.state.app.userInfo;
}
}, },
methods: { methods: {
open(){ open() {
if(this.timer){
clearInterval(this.timer);
}else {
this.count++;
this.getAddress();
this.timer = setInterval(()=>{
this.count++;
this.getAddress();
}, 6*1000);
}
},
close(){
clearInterval(this.timer);
},
getAddress(){
uni.getLocation({
geocode: true,
success:(res)=>{
console.log(res);
this.list.push({
type: 0,
a: '获取成功: '+this.formatDate(new Date()),
b: '位置:' + res.latitude + ',' + res.longitude
})
},
fail:(err)=> {
this.list.push({
type: 1,
a: '获取失败: '+this.formatDate(new Date()),
b: '错误:' + JSON.stringify(err)
})
}
})
},
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; },
close() {
},
logout() {
this.$store.commit('LOGOUT');
uni.redirectTo({
url: '/pages/login/login'
})
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.green{ .green {
color: green; color: green;
} }
.red{
.red {
color: red; color: red;
} }
</style> </style>

BIN
static/head.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

4
store/getters.js Normal file
View File

@ -0,0 +1,4 @@
export default {
token: state => state.app.token || '',
userInfo: state => state.app.userInfo || {},
};

11
store/index.js Normal file
View File

@ -0,0 +1,11 @@
import Vue from "vue";
import Vuex from "vuex";
import modules from "./modules";
import getters from "./getters";
Vue.use(Vuex);
export default new Vuex.Store({
modules,
getters,
});

27
store/modules/app.js Normal file
View File

@ -0,0 +1,27 @@
const state = {
userInfo: JSON.parse(uni.getStorageSync('user_info') || '{}') || {},
token: uni.getStorageSync('token') || ''
};
const mutations = {
SET_USERINFO(state, data) {
state.userInfo = data;
uni.setStorageSync('user_info', JSON.stringify(data));
},
LOGOUT(state) {
state.userInfo = {};
state.token = '';
uni.removeStorageSync('user_info');
uni.removeStorageSync('token');
},
SET_TOKEN(state, data) {
state.token = data.token;
uni.setStorageSync('token', data.token);
uni.setStorageSync('token_time', data.token_time);
},
};
export default {
state,
mutations,
};

13
store/modules/index.js Normal file
View File

@ -0,0 +1,13 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import app from "./app";
export default {
app
};

View File

@ -1,8 +1,8 @@
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/index/index","pages/test/test"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"工单系统","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"white","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"高德"},{"pagePath":"pages/test/test","text":"本机"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"work_order","compilerVersion":"3.98","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; var __uniConfig = {"pages":["pages/index/index","pages/test/test","pages/login/login"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"工单系统","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"white","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/test/test","text":"我的"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"work_order","compilerVersion":"3.98","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"定位测试"}},{"path":"/pages/test/test","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"","enablePullDownRefresh":false}}]; var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isNVue":true,"isTabBar":true},"window":{"navigationBarTitleText":"定位"}},{"path":"/pages/test/test","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的","enablePullDownRefresh":false}},{"path":"/pages/login/login","meta":{},"window":{"navigationBarTitleText":"登录","enablePullDownRefresh":false,"transparentTitle":"always"}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__BAAC5A9","name":"work_order","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"Geolocation":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"autoclose":true,"delay":0,"target":"id:1","waiting":true},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>","<uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"],"packagename":"uni.UNIBAAC5A9","custompermissions":true},"apple":{"dSYMs":false,"plistcmds":["Add :UIFileSharingEnabled bool true"],"devices":"universal"},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}},"geolocation":{"amap":{"__platform__":["android"],"appkey_android":"2ad33d95be57c3169cb881a7d2b1712f","appkey_ios":"","name":"amaptOT5SLwK"},"system":{"__platform__":["ios","android"]}}},"debug":true,"syncDebug":true,"orientation":"portrait-primary"},"nativePlugins":{"SLY-AMapHelper":{}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"safearea":{"background":"#eee","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.98","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"rgba(255,255,255,0.4)","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"高德"},{"pagePath":"pages/test/test","text":"本机"}],"height":"50px","child":["lauchwebview"],"selected":0},"launch_path":"__uniappview.html","adid":"120478170009"}} {"@platforms":["android","iPhone","iPad"],"id":"__UNI__BAAC5A9","name":"work_order","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"","developer":{"name":"","email":"","url":""},"permissions":{"Geolocation":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"autoclose":true,"delay":0,"target":"id:1","waiting":true},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview","render":"always","uniNView":{"path":"pages/index/index.js"}},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>","<uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"],"packagename":"uni.UNIBAAC5A9","custompermissions":true},"apple":{"dSYMs":false,"plistcmds":["Add :UIFileSharingEnabled bool true"],"devices":"universal"},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}},"geolocation":{"amap":{"__platform__":["android"],"appkey_android":"2ad33d95be57c3169cb881a7d2b1712f","appkey_ios":"","name":"amaptOT5SLwK"},"system":{"__platform__":["ios","android"]}}},"debug":true,"syncDebug":true,"orientation":"portrait-primary"},"nativePlugins":{"SLY-AMapHelper":{},"Sj-Keep":{}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"safearea":{"background":"#eee","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.98","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"rgba(255,255,255,0.4)","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/test/test","text":"我的"}],"height":"50px","child":["lauchwebview"]},"adid":"120478170009"}}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

View File

@ -1,8 +1,8 @@
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/index/index","pages/test/test"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"工单系统","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"white","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"高德"},{"pagePath":"pages/test/test","text":"本机"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"work_order","compilerVersion":"3.98","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; var __uniConfig = {"pages":["pages/index/index","pages/test/test","pages/login/login"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"工单系统","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"white","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/test/test","text":"我的"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"work_order","compilerVersion":"3.98","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"定位测试"}},{"path":"/pages/test/test","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"","enablePullDownRefresh":false}}]; var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isNVue":true,"isTabBar":true},"window":{"navigationBarTitleText":"定位"}},{"path":"/pages/test/test","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的","enablePullDownRefresh":false}},{"path":"/pages/login/login","meta":{},"window":{"navigationBarTitleText":"登录","enablePullDownRefresh":false,"transparentTitle":"always"}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__BAAC5A9","name":"work_order","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"Geolocation":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>","<uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"]},"apple":{"dSYMs":false},"plugins":{"geolocation":{"system":{"__platform__":["ios","android"]},"amap":{"name":"amaptOT5SLwK","__platform__":["android"],"appkey_ios":"","appkey_android":"2ad33d95be57c3169cb881a7d2b1712f"}},"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"nativePlugins":{"SLY-AMapHelper":{"__plugin_info__":{"name":"后台持续定位、轨迹追踪、可锁屏","description":"基于高德地图的后台持续定位、轨迹追踪、后台保活、锁屏定位。已处理主流系统权限申请流程,省心快速接入,提供演示程序下载[问题反馈404342398@qq.com]","platforms":"Android","url":"https://ext.dcloud.net.cn/plugin?id=6267","android_package_name":"uni.UNIBAAC5A9","ios_bundle_id":"","isCloud":true,"bought":1,"pid":"6267","parameters":{}}}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"safearea":{"background":"#eee","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.98","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"rgba(255,255,255,0.4)","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"高德"},{"pagePath":"pages/test/test","text":"本机"}],"height":"50px","child":["lauchwebview"],"selected":0},"launch_path":"__uniappview.html"}} {"@platforms":["android","iPhone","iPad"],"id":"__UNI__BAAC5A9","name":"work_order","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"","developer":{"name":"","email":"","url":""},"permissions":{"Geolocation":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview","render":"always","uniNView":{"path":"pages/index/index.js"}},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>","<uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"]},"apple":{"dSYMs":false},"plugins":{"geolocation":{"system":{"__platform__":["ios","android"]},"amap":{"name":"amaptOT5SLwK","__platform__":["android"],"appkey_ios":"","appkey_android":"2ad33d95be57c3169cb881a7d2b1712f"}},"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"nativePlugins":{"SLY-AMapHelper":{"__plugin_info__":{"name":"后台持续定位、轨迹追踪、可锁屏","description":"基于高德地图的后台持续定位、轨迹追踪、后台保活、锁屏定位。已处理主流系统权限申请流程,省心快速接入,提供演示程序下载[问题反馈404342398@qq.com]","platforms":"Android","url":"https://ext.dcloud.net.cn/plugin?id=6267","android_package_name":"uni.UNIBAAC5A9","ios_bundle_id":"","isCloud":true,"bought":1,"pid":"6267","parameters":{}}},"Sj-Keep":{"__plugin_info__":{"name":"安卓保活插件,后台持续运行,灵活控制。 - [试用版,仅用于自定义调试基座]","description":"安卓保活插件,后台持续运行,灵活控制。","platforms":"Android","url":"https://ext.dcloud.net.cn/plugin?id=16143","android_package_name":"","ios_bundle_id":"","isCloud":true,"bought":0,"pid":"16143","parameters":{}}}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"safearea":{"background":"#eee","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.98","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"rgba(255,255,255,0.4)","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/test/test","text":"我的"}],"height":"50px","child":["lauchwebview"]}}}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View File

@ -1,8 +1,8 @@
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/index/index","pages/test/test"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"工单系统","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"white","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"高德"},{"pagePath":"pages/test/test","text":"本机"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"work_order","compilerVersion":"3.98","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; var __uniConfig = {"pages":["pages/index/index","pages/test/test","pages/login/login"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"工单系统","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"white","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/test/test","text":"我的"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"work_order","compilerVersion":"3.98","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"定位测试"}},{"path":"/pages/test/test","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"","enablePullDownRefresh":false}}]; var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isNVue":true,"isTabBar":true},"window":{"navigationBarTitleText":"定位"}},{"path":"/pages/test/test","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的","enablePullDownRefresh":false}},{"path":"/pages/login/login","meta":{},"window":{"navigationBarTitleText":"登录","enablePullDownRefresh":false,"transparentTitle":"always"}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__BAAC5A9","name":"work_order","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"Geolocation":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>","<uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"]},"apple":{"dSYMs":false},"plugins":{"geolocation":{"system":{"__platform__":["ios","android"]},"amap":{"name":"amaptOT5SLwK","__platform__":["android"],"appkey_ios":"","appkey_android":"2ad33d95be57c3169cb881a7d2b1712f"}},"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"nativePlugins":{"SLY-AMapHelper":{"__plugin_info__":{"name":"后台持续定位、轨迹追踪、可锁屏","description":"基于高德地图的后台持续定位、轨迹追踪、后台保活、锁屏定位。已处理主流系统权限申请流程,省心快速接入,提供演示程序下载[问题反馈404342398@qq.com]","platforms":"Android","url":"https://ext.dcloud.net.cn/plugin?id=6267","android_package_name":"uni.UNIBAAC5A9","ios_bundle_id":"","isCloud":true,"bought":1,"pid":"6267","parameters":{}}}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"safearea":{"background":"#eee","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.98","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"rgba(255,255,255,0.4)","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"高德"},{"pagePath":"pages/test/test","text":"本机"}],"height":"50px","child":["lauchwebview"],"selected":0},"launch_path":"__uniappview.html"}} {"@platforms":["android","iPhone","iPad"],"id":"__UNI__BAAC5A9","name":"work_order","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"","developer":{"name":"","email":"","url":""},"permissions":{"Geolocation":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview","render":"always","uniNView":{"path":"pages/index/index.js"}},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>","<uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"],"minSdkVersion":23},"apple":{"dSYMs":false},"plugins":{"geolocation":{"system":{"__platform__":["ios","android"]},"amap":{"name":"amaptOT5SLwK","__platform__":["android"],"appkey_ios":"","appkey_android":"2ad33d95be57c3169cb881a7d2b1712f"}},"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"nativePlugins":{"SLY-AMapHelper":{"__plugin_info__":{"name":"后台持续定位、轨迹追踪、可锁屏","description":"基于高德地图的后台持续定位、轨迹追踪、后台保活、锁屏定位。已处理主流系统权限申请流程,省心快速接入,提供演示程序下载[问题反馈404342398@qq.com]","platforms":"Android","url":"https://ext.dcloud.net.cn/plugin?id=6267","android_package_name":"uni.UNIBAAC5A9","ios_bundle_id":"","isCloud":true,"bought":1,"pid":"6267","parameters":{}}}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"safearea":{"background":"#eee","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.98","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#333","selectedColor":"#0074e8","borderStyle":"rgba(255,255,255,0.4)","backgroundColor":"#eee","list":[{"pagePath":"pages/index/index","text":"首页"},{"pagePath":"pages/test/test","text":"我的"}],"height":"50px","child":["lauchwebview"]}}}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

147
utils/WSCoordinate.js Normal file
View File

@ -0,0 +1,147 @@
/**
* 判断经纬度是否超出中国境内
*/
function isLocationOutOfChina(latitude, longitude) {
if (longitude < 72.004 || longitude > 137.8347 || latitude < 0.8293 || latitude > 55.8271)
return true;
return false;
}
/**
* 将WGS-84(国际标准)转为GCJ-02(火星坐标):
*/
function transformFromWGSToGCJ(latitude, longitude) {
var lat = "";
var lon = "";
var ee = 0.00669342162296594323;
var a = 6378245.0;
var pi = 3.14159265358979324;
if (isLocationOutOfChina(latitude, longitude)) {
lat = latitude;
lon = longitude;
}
else {
var adjustLat = transformLatWithXY(longitude - 105.0, latitude - 35.0);
var adjustLon = transformLonWithXY(longitude - 105.0, latitude - 35.0);
var radLat = latitude / 180.0 * pi;
var magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
var sqrtMagic = Math.sqrt(magic);
adjustLat = (adjustLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
adjustLon = (adjustLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
latitude = latitude + adjustLat;
longitude = longitude + adjustLon;
}
return { latitude: latitude, longitude: longitude };
}
/**
* 将GCJ-02(火星坐标)转为百度坐标:
*/
function transformFromGCJToBaidu(latitude, longitude) {
var pi = 3.14159265358979324 * 3000.0 / 180.0;
var z = Math.sqrt(longitude * longitude + latitude * latitude) + 0.00002 * Math.sin(latitude * pi);
var theta = Math.atan2(latitude, longitude) + 0.000003 * Math.cos(longitude * pi);
var a_latitude = (z * Math.sin(theta) + 0.006);
var a_longitude = (z * Math.cos(theta) + 0.0065);
return { latitude: a_latitude, longitude: a_longitude };
}
/**
* 将百度坐标转为GCJ-02(火星坐标):
*/
function transformFromBaiduToGCJ(latitude, longitude) {
var xPi = 3.14159265358979323846264338327950288 * 3000.0 / 180.0;
var x = longitude - 0.0065;
var y = latitude - 0.006;
var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * xPi);
var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * xPi);
var a_latitude = z * Math.sin(theta);
var a_longitude = z * Math.cos(theta);
return { latitude: a_latitude, longitude: a_longitude };
}
/**
* 将GCJ-02(火星坐标)转为WGS-84:
*/
function transformFromGCJToWGS(latitude, longitude) {
var threshold = 0.00001;
// The boundary
var minLat = latitude - 0.5;
var maxLat = latitude + 0.5;
var minLng = longitude - 0.5;
var maxLng = longitude + 0.5;
var delta = 1;
var maxIteration = 30;
while (true) {
var leftBottom = transformFromWGSToGCJ(minLat, minLng);
var rightBottom = transformFromWGSToGCJ(minLat, maxLng);
var leftUp = transformFromWGSToGCJ(maxLat, minLng);
var midPoint = transformFromWGSToGCJ((minLat + maxLat) / 2, (minLng + maxLng) / 2);
delta = Math.abs(midPoint.latitude - latitude) + Math.abs(midPoint.longitude - longitude);
if (maxIteration-- <= 0 || delta <= threshold) {
return { latitude: (minLat + maxLat) / 2, longitude: (minLng + maxLng) / 2 };
}
if (isContains({ latitude: latitude, longitude: longitude }, leftBottom, midPoint)) {
maxLat = (minLat + maxLat) / 2;
maxLng = (minLng + maxLng) / 2;
}
else if (isContains({ latitude: latitude, longitude: longitude }, rightBottom, midPoint)) {
maxLat = (minLat + maxLat) / 2;
minLng = (minLng + maxLng) / 2;
}
else if (isContains({ latitude: latitude, longitude: longitude }, leftUp, midPoint)) {
minLat = (minLat + maxLat) / 2;
maxLng = (minLng + maxLng) / 2;
}
else {
minLat = (minLat + maxLat) / 2;
minLng = (minLng + maxLng) / 2;
}
}
}
function isContains(point, p1, p2) {
return (point.latitude >= Math.min(p1.latitude, p2.latitude) && point.latitude <= Math.max(p1.latitude, p2.latitude)) && (point.longitude >= Math.min(p1.longitude, p2.longitude) && point.longitude <= Math.max(p1.longitude, p2.longitude));
}
function transformLatWithXY(x, y) {
var pi = 3.14159265358979324;
var lat = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
lat += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
lat += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
lat += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
return lat;
}
function transformLonWithXY(x, y) {
var pi = 3.14159265358979324;
var lon = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
lon += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
lon += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
lon += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0;
return lon;
}
module.exports = {
isLocationOutOfChina: isLocationOutOfChina,
transformFromWGSToGCJ: transformFromWGSToGCJ,
transformFromGCJToBaidu: transformFromGCJToBaidu,
transformFromBaiduToGCJ: transformFromBaiduToGCJ,
transformFromGCJToWGS: transformFromGCJToWGS
}

94
utils/http.js Normal file
View File

@ -0,0 +1,94 @@
import {
config
} from '@/config/app';
function baseRequest(url, method, data, {
noAuth = false,
noVerify = false,
onReLogin = false
}) {
let Url = config.HTTP_REQUEST_URL,
header = config.HEADER;
if (!noAuth) {
let token = uni.getStorageSync('token');
header.TOKEN = token;
}
return new Promise((reslove, reject) => {
uni.request({
url: Url + url,
method: method || 'GET',
header: {
...header
},
data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {},
success: (res) => {
// console.log(res.data.show, "全局")
if (res.data.show) {
uni.showToast({
title: res.data.msg || '操作成功',
icon: 'success',
})
}
if (noVerify)
reslove(res.data);
else if (res.data.code == -1) {
if (res.data.msg == "登录超时,请重新登录") {
// store.commit('LOGOUT');
uni.showToast({
title: res.data.msg ,
icon: 'none',
})
uni.reLaunch({
url:'/pages/login/login'
})
}
} else if (res.data.code == 0) {
if (res.data.msg != '用户信息不存在') {
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none',
})
}
reslove(res.data);
} else if (res.data.code == 1) {
// store.commit("SET_REQUEST");
reslove(res.data);
} else if (res.data.code == 200) {
// store.commit("SET_REQUEST");
reslove(res.data.data);
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
reject(res.data);
} else if (res.data.code == 501) {
reject(res.data);
} else {
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none'
})
reject(res.data.msg || '请检查网络');
}
},
fail: (message) => {
console.log(message, '错误')
// uni.hideLoading()
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject('请求失败');
}
})
});
}
const syhttp = {};
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
syhttp[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
});
export default syhttp;

14
utils/wgs.js Normal file
View File

@ -0,0 +1,14 @@
const util = require('./WSCoordinate.js')
export const wgsToGcj = (data)=>{
try{
let d = data;
//将WGS-84(国际标准)转为GCJ-02(火星坐标)
let e = util.transformFromWGSToGCJ(data.latitude, data.longitude);
d.latitude = e.latitude;
d.longitude = e.longitude;
return d;
}catch(e){
return data;
}
}