web-component-gallery 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form.umd.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/table.umd.js +1 -1
- package/lib/style/mixins.less +6 -5
- package/package.json +2 -1
- package/plugins/lib/style/mixins.less +6 -5
- package/plugins/method/AMap.js +155 -0
- package/plugins/utils/Filter.js +57 -0
- package/plugins/utils/Validate.js +10 -0
- package/plugins/utils/Websocket.js +162 -0
- package/plugins/utils/jsencrypt.min.js +5566 -0
- package/plugins/lib/map/index.vue +0 -0
package/dist/form.umd.js
CHANGED
|
@@ -7507,7 +7507,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _css
|
|
|
7507
7507
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
7508
7508
|
|
|
7509
7509
|
"use strict";
|
|
7510
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex */\\n.WebComponentFormSearch[data-v-97ec3748] {\\n gap: 16px 0;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] {\\n display: inline-flex;\\n margin-right: unset;\\n}\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-form-item-label {\\n min-width: 70px;\\n max-width: 100px;\\n text-align: right;\\n}\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-form-item-control-wrapper {\\n flex: 1;\\n}\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-select,\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-input-number,\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-calendar-picker {\\n width: 100% !important;\\n}\\n.WebComponentFormSearch__Actions[data-v-97ec3748] {\\n flex: 1;\\n text-align: right;\\n margin-right: 16px;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/form/Search.vue?./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
7510
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.WebComponentFormSearch[data-v-97ec3748] {\\n gap: 16px 0;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] {\\n display: inline-flex;\\n margin-right: unset;\\n}\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-form-item-label {\\n min-width: 70px;\\n max-width: 100px;\\n text-align: right;\\n}\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-form-item-control-wrapper {\\n flex: 1;\\n}\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-select,\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-input-number,\\n.WebComponentFormSearch .ant-form-item[data-v-97ec3748] .ant-calendar-picker {\\n width: 100% !important;\\n}\\n.WebComponentFormSearch__Actions[data-v-97ec3748] {\\n flex: 1;\\n text-align: right;\\n margin-right: 16px;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/form/Search.vue?./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
7511
7511
|
|
|
7512
7512
|
/***/ }),
|
|
7513
7513
|
|
package/dist/index.umd.js
CHANGED
|
@@ -4633,7 +4633,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _css
|
|
|
4633
4633
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4634
4634
|
|
|
4635
4635
|
"use strict";
|
|
4636
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex */\\n.WebComponentTable[data-v-19255b3a] {\\n width: 100%;\\n height: 100%;\\n display: flex;\\n gap: 16px 0;\\n flex-direction: column;\\n}\\n.WebComponentTable__List__Empty[data-v-19255b3a] {\\n gap: 16px 0;\\n display: flex;\\n gap: 0;\\n flex-direction: column;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/table/index.vue?./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
4636
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.WebComponentTable[data-v-19255b3a] {\\n width: 100%;\\n height: 100%;\\n display: flex;\\n gap: 16px 0;\\n flex-direction: column;\\n}\\n.WebComponentTable__List__Empty[data-v-19255b3a] {\\n gap: 16px 0;\\n display: flex;\\n gap: 0;\\n flex-direction: column;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/table/index.vue?./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
4637
4637
|
|
|
4638
4638
|
/***/ }),
|
|
4639
4639
|
|
package/dist/table.umd.js
CHANGED
|
@@ -4622,7 +4622,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _css
|
|
|
4622
4622
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4623
4623
|
|
|
4624
4624
|
"use strict";
|
|
4625
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex */\\n.WebComponentTable[data-v-19255b3a] {\\n width: 100%;\\n height: 100%;\\n display: flex;\\n gap: 16px 0;\\n flex-direction: column;\\n}\\n.WebComponentTable__List__Empty[data-v-19255b3a] {\\n gap: 16px 0;\\n display: flex;\\n gap: 0;\\n flex-direction: column;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/table/index.vue?./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
4625
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.WebComponentTable[data-v-19255b3a] {\\n width: 100%;\\n height: 100%;\\n display: flex;\\n gap: 16px 0;\\n flex-direction: column;\\n}\\n.WebComponentTable__List__Empty[data-v-19255b3a] {\\n gap: 16px 0;\\n display: flex;\\n gap: 0;\\n flex-direction: column;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/table/index.vue?./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
4626
4626
|
|
|
4627
4627
|
/***/ }),
|
|
4628
4628
|
|
package/lib/style/mixins.less
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/* 布局( 纯为了不想多写一行 */
|
|
2
2
|
.layout( @w: 100%, @h: 100% ) {
|
|
3
3
|
width: @w;
|
|
4
4
|
height: @h;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/* 滚动条样式 */
|
|
8
|
-
.scrollbarStyle() {
|
|
8
|
+
.scrollbarStyle( @color1: #1890ff, @color2: rgba(41, 158, 254, 0) ) {
|
|
9
9
|
&::-webkit-scrollbar-track {
|
|
10
10
|
border-radius: 0;
|
|
11
11
|
background-color: transparent;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
border-radius: 0;
|
|
15
15
|
border-radius: 5px;
|
|
16
16
|
|
|
17
|
-
background-image: -webkit-linear-gradient(270deg,
|
|
17
|
+
background-image: -webkit-linear-gradient(270deg, @color1 0%, @color2 100%);
|
|
18
18
|
-webkit-transition: all 0.2s;
|
|
19
19
|
transition: all 0.2s;
|
|
20
20
|
}
|
|
@@ -38,13 +38,14 @@
|
|
|
38
38
|
-webkit-box-orient: vertical;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/* flex */
|
|
41
|
+
/* flex布局 */
|
|
42
42
|
.flex-layout( @flexDirection: row, @flexGap: 0 ) {
|
|
43
43
|
display: flex;
|
|
44
44
|
gap: @flexGap;
|
|
45
45
|
flex-direction: @flexDirection;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
/* flex排版方式 */
|
|
48
49
|
.flex-mixins(@direction: row, @align: center, @justify: center ) {
|
|
49
50
|
.flex-layout(@direction);
|
|
50
51
|
flex-wrap: wrap;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-component-gallery",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "vue-library-ui组件库",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"files": [
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"build:lib": "npm run build:js && npm run build:css"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
20
21
|
"ant-design-vue": "1.7.8",
|
|
21
22
|
"clean-webpack-plugin": "^4.0.0",
|
|
22
23
|
"core-js": "^3.8.3",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/* 布局( 纯为了不想多写一行 */
|
|
2
2
|
.layout( @w: 100%, @h: 100% ) {
|
|
3
3
|
width: @w;
|
|
4
4
|
height: @h;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/* 滚动条样式 */
|
|
8
|
-
.scrollbarStyle() {
|
|
8
|
+
.scrollbarStyle( @color1: #1890ff, @color2: rgba(41, 158, 254, 0) ) {
|
|
9
9
|
&::-webkit-scrollbar-track {
|
|
10
10
|
border-radius: 0;
|
|
11
11
|
background-color: transparent;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
border-radius: 0;
|
|
15
15
|
border-radius: 5px;
|
|
16
16
|
|
|
17
|
-
background-image: -webkit-linear-gradient(270deg,
|
|
17
|
+
background-image: -webkit-linear-gradient(270deg, @color1 0%, @color2 100%);
|
|
18
18
|
-webkit-transition: all 0.2s;
|
|
19
19
|
transition: all 0.2s;
|
|
20
20
|
}
|
|
@@ -38,13 +38,14 @@
|
|
|
38
38
|
-webkit-box-orient: vertical;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/* flex */
|
|
41
|
+
/* flex布局 */
|
|
42
42
|
.flex-layout( @flexDirection: row, @flexGap: 0 ) {
|
|
43
43
|
display: flex;
|
|
44
44
|
gap: @flexGap;
|
|
45
45
|
flex-direction: @flexDirection;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
/* flex排版方式 */
|
|
48
49
|
.flex-mixins(@direction: row, @align: center, @justify: center ) {
|
|
49
50
|
.flex-layout(@direction);
|
|
50
51
|
flex-wrap: wrap;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// amap-plugin.js
|
|
2
|
+
import AMapLoader from '@amap/amap-jsapi-loader'
|
|
3
|
+
|
|
4
|
+
// 在 Vue 插件中封装高德地图的初始化和常用方法
|
|
5
|
+
function AmapPlugin(Vue, options) {
|
|
6
|
+
|
|
7
|
+
/** 设置高德地图密钥 */
|
|
8
|
+
window.forceWebGL = true
|
|
9
|
+
window._AMapSecurityConfig = {
|
|
10
|
+
securityJsCode: options.securityJsCode
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** 加载地图sdk */
|
|
14
|
+
const AMap = AMapLoader.load({
|
|
15
|
+
key: options.key, // 高德地图的API Key
|
|
16
|
+
version: '2.0', // 指定API版本
|
|
17
|
+
plugins: ['AMap.Geocoder', 'AMap.PlaceSearch', 'AMap.ControlBar'] // 需要使用的插件
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
if (!AMap) {
|
|
21
|
+
throw new Error('高德地图脚本还未加载,请确保在使用此插件前已经加载高德地图SDK。')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 初始化高德地图
|
|
25
|
+
Vue.prototype.$initAMap = function(el, callback) {
|
|
26
|
+
this.$nextTick(() => {
|
|
27
|
+
const map = new AMap.Map(el, {
|
|
28
|
+
zoom: 11, // 初始化时地图的缩放级别
|
|
29
|
+
...options.config // 其他高德地图初始化参数
|
|
30
|
+
})
|
|
31
|
+
callback && callback(map)
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 抛出地图常用方法 */
|
|
36
|
+
Vue.prototype.$amapMethods = {
|
|
37
|
+
getMapAddress,
|
|
38
|
+
setMapDriving,
|
|
39
|
+
drawMapAnimation
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 其他可能需要封装的高德地图常用方法...
|
|
43
|
+
|
|
44
|
+
/** 后续考虑加入一些map方法 */
|
|
45
|
+
/** 地图逆地理编码 */
|
|
46
|
+
function getMapAddress({longitude, latitude}, callback) {
|
|
47
|
+
const geocoder = new AMap.Geocoder({
|
|
48
|
+
city: '全国',
|
|
49
|
+
// 获取道路poi等详细信息
|
|
50
|
+
extensions: 'all'
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
geocoder.getAddress(new Array(longitude, latitude), (status, result) => {
|
|
54
|
+
if (status === 'complete' && result.info === 'OK') {
|
|
55
|
+
const { formattedAddress, pois } = result.regeocode
|
|
56
|
+
const { district, township } = result.regeocode.addressComponent
|
|
57
|
+
let address
|
|
58
|
+
|
|
59
|
+
const division =
|
|
60
|
+
township && formattedAddress.includes(township)
|
|
61
|
+
? formattedAddress.indexOf(township) + township.length
|
|
62
|
+
: formattedAddress.indexOf(district) + district.length
|
|
63
|
+
|
|
64
|
+
address = formattedAddress.slice(0, division) + pois[0]?.address
|
|
65
|
+
|
|
66
|
+
callback && callback({
|
|
67
|
+
address,
|
|
68
|
+
addressInfo: result.regeocode.addressComponent
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 道路规划 */
|
|
75
|
+
function setMapDriving(AMapInit, paths, callback) {
|
|
76
|
+
AMapInit.plugin("AMap.Driving", () => {
|
|
77
|
+
let planRoutes = new AMap.Driving({ map: AMapInit })
|
|
78
|
+
planRoutes.search(
|
|
79
|
+
setLngLat( paths[ 0 ] ),
|
|
80
|
+
setLngLat( paths[ paths.length - 1 ] ),
|
|
81
|
+
{ waypoints: paths.slice( 1, paths.length - 1 ).map( path => setLngLat( path ) ) },
|
|
82
|
+
function (status, result) {
|
|
83
|
+
if(status == 'complete') return
|
|
84
|
+
callback && callback( parseRouteToPath( e.routes[0] ), roadDriving )
|
|
85
|
+
//status:complete 表示查询成功,no_data 为查询无结果,error 代表查询错误
|
|
86
|
+
//查询成功时,result 即为对应的驾车导航信息
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** 轨迹动画 */
|
|
93
|
+
function drawMapAnimation(AMapInit, options, pathOptions, callback) {
|
|
94
|
+
AMapInit.plugin('AMap.MoveAnimation', () => {
|
|
95
|
+
let animationMarker = new AMap.Marker({
|
|
96
|
+
map: AMapInit,
|
|
97
|
+
icon: options.icon,
|
|
98
|
+
position: options.paths[0],
|
|
99
|
+
...options
|
|
100
|
+
})
|
|
101
|
+
let passedPolyline = new AMap.Polyline({
|
|
102
|
+
map: AMapInit,
|
|
103
|
+
...pathOptions
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
animationMarker.on('moving', e => {
|
|
107
|
+
passedPolyline.setPath( e.passedPath )
|
|
108
|
+
AMapInit.setCenter( e.target.getPosition(), true )
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
animationMarker.moveAlong(paths, {
|
|
112
|
+
// circlable 是否循环
|
|
113
|
+
// 每段间隔时间
|
|
114
|
+
// aniInterval: 5,
|
|
115
|
+
// 每一段的时长
|
|
116
|
+
duration: 500, // 可根据实际采集时间间隔设置
|
|
117
|
+
// JSAPI2.0 是否延道路自动设置角度在 moveAlong 里设置
|
|
118
|
+
autoRotation: true
|
|
119
|
+
})
|
|
120
|
+
callback && callback( animationMarker, passedPolyline )
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// 解析DrivingRoute对象,构造成AMap.Polyline的path参数需要的格式
|
|
125
|
+
function parseRouteToPath(route) {
|
|
126
|
+
let path = []
|
|
127
|
+
let ApproachPoint = []
|
|
128
|
+
let pointI = 0
|
|
129
|
+
for (let i = 0, l = route.steps.length; i < l; i++) {
|
|
130
|
+
let step = route.steps[i]
|
|
131
|
+
for (let j = 0, n = step.path.length; j < n; j++) {
|
|
132
|
+
path.push(step.path[j])
|
|
133
|
+
if( step.assistant_action == "到达途经地" && (j == n - 1) ) ApproachPoint.push( pointI )
|
|
134
|
+
pointI++
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return { path, ApproachPoint }
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 为了能够在 Vue 中全局使用插件,可以添加一个 install 方法
|
|
143
|
+
AmapPlugin.install = function(Vue, options) {
|
|
144
|
+
Vue.mixin({
|
|
145
|
+
created() {
|
|
146
|
+
if (this.$options.amap) {
|
|
147
|
+
this.$initAMap(this.$options.amap.el, this.$options.amap.callback)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
Vue.prototype.$amap = AmapPlugin
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default AmapPlugin
|
package/plugins/utils/Filter.js
CHANGED
|
@@ -92,4 +92,61 @@ export function formatDate(time, cFormat) {
|
|
|
92
92
|
return timeStr;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
|
|
97
|
+
* sHex为传入的十六进制的色值
|
|
98
|
+
* alpha为rgba的透明度
|
|
99
|
+
*/
|
|
100
|
+
export function colorRgba(sHex, alpha) {
|
|
101
|
+
// 十六进制颜色值的正则表达式
|
|
102
|
+
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
103
|
+
/* 16进制颜色转为RGB格式 */
|
|
104
|
+
let sColor = sHex.toLowerCase();
|
|
105
|
+
if (sColor && reg.test(sColor)) {
|
|
106
|
+
if (sColor.length === 4) {
|
|
107
|
+
var sColorNew = "#";
|
|
108
|
+
for (let i = 1; i < 4; i += 1) {
|
|
109
|
+
sColorNew += sColor.slice(i, i + 1)
|
|
110
|
+
.concat(sColor.slice(i, i + 1));
|
|
111
|
+
}
|
|
112
|
+
sColor = sColorNew;
|
|
113
|
+
}
|
|
114
|
+
// 处理六位的颜色值
|
|
115
|
+
const sColorChange = [];
|
|
116
|
+
for (let i = 1; i < 7; i += 2) {
|
|
117
|
+
sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`));
|
|
118
|
+
}
|
|
119
|
+
// return sColorChange.join(',')
|
|
120
|
+
return `rgba(${sColorChange.join(",")},${alpha})`;
|
|
121
|
+
}
|
|
122
|
+
return sColor;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/*
|
|
126
|
+
segment: 分段 7段
|
|
127
|
+
tatalpercent: 百分比 100
|
|
128
|
+
basevalue: 基础值 200
|
|
129
|
+
*/
|
|
130
|
+
export function produceDataSeriesEx(segment, tatal, basevalue) {
|
|
131
|
+
//需要产生segment个随机数,且segment个随机数之和等于tatal
|
|
132
|
+
let arrpercent = new Array(segment).fill(0);
|
|
133
|
+
for (let i = 0; i < tatal; i++) {
|
|
134
|
+
//parseInt接收string,所以需要转一趟
|
|
135
|
+
/**
|
|
136
|
+
* 换成生活中的场景,就是一百个苹果分给十个人,我们可以一个一个的取出,随机分给某个人,直到分完
|
|
137
|
+
* 在js里面,十个人即是一个长度为十的数组,每次数组随机一个位置加一,执行一百次
|
|
138
|
+
*/
|
|
139
|
+
var num = parseInt((Math.random() * segment).toString());
|
|
140
|
+
arrpercent[num]++;
|
|
141
|
+
}
|
|
142
|
+
//console.log(arr.length)
|
|
143
|
+
|
|
144
|
+
let arrvalue = new Array(segment).fill(0);
|
|
145
|
+
for (let i = 0; i < segment; i++) {
|
|
146
|
+
arrvalue[i] = parseInt(arrpercent[i] / 100 * basevalue);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return [arrpercent, arrvalue];
|
|
150
|
+
}
|
|
151
|
+
|
|
95
152
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const verifyInteger = /^([1-9][0-9]*)$/; // 整数,不包含0开头
|
|
2
|
+
export const verifyFloat = /^[1-9]+(.[0-9]{2})?$/ // 保留两位小数的正数
|
|
3
|
+
export const verifyChinese = /^([\u4e00-\u9fa5]){1,10}$/; // 校验中文,长度1到10
|
|
4
|
+
export const verifyBlank = /^\s*$/; // 校验空格
|
|
5
|
+
export const verifyEnglishName = /^[a-zA-Z][a-zA-Z0-9_]*$/; // 检验英文字母开头,且限制输入 英文 + 数字
|
|
6
|
+
export const verifyChineseAndEng = /^[a-zA-Z0-9_\u4e00-\u9fa5]+$/; // 检验汉字、数字、字母、下划线,下划线位置不限
|
|
7
|
+
export const phoneReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/; //手机号
|
|
8
|
+
export const telephone = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/; //固定电话与手机号
|
|
9
|
+
export const verifyEmail = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; //检验邮箱
|
|
10
|
+
export const verifyIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/ //身份证号码 15位或18位
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import { Message } from 'ant-design-vue'
|
|
3
|
+
|
|
4
|
+
let globalWebSocket = null
|
|
5
|
+
let isConnect = false //连接状态
|
|
6
|
+
let globalCallback = function(e){ console.log(e) } //定义外部接收数据的回调函数
|
|
7
|
+
let reConnectNum = 0 //重连次数
|
|
8
|
+
let wsPrefix = window.origin.includes('https') ? 'wss' : 'ws'
|
|
9
|
+
|
|
10
|
+
//心跳设置
|
|
11
|
+
let heartCheck = {
|
|
12
|
+
heart: "heart", //心跳包
|
|
13
|
+
timeout: 45 * 1000, //每段时间发送一次心跳包 这里设置为60s
|
|
14
|
+
heartbeat: null, //延时发送消息对象(启动心跳新建这个对象,收到消息后重置对象)
|
|
15
|
+
start: function () {
|
|
16
|
+
this.heartbeat = setInterval(()=>{
|
|
17
|
+
if (isConnect){
|
|
18
|
+
webSocketSend(this.heart)
|
|
19
|
+
}else{
|
|
20
|
+
this.clear()
|
|
21
|
+
}
|
|
22
|
+
}, this.timeout)
|
|
23
|
+
},
|
|
24
|
+
reset: function () {
|
|
25
|
+
clearInterval(this.heartbeat)
|
|
26
|
+
this.start()
|
|
27
|
+
},
|
|
28
|
+
clear: function() {
|
|
29
|
+
clearInterval(this.heartbeat)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//初始化websocket
|
|
34
|
+
function initWebSocket(webSocket, webSocketUrl, callback = () => {}) {
|
|
35
|
+
if ("WebSocket" in window) {
|
|
36
|
+
webSocket = new WebSocket(`${wsPrefix}://${webSocketUrl}`) //创建socket对象
|
|
37
|
+
} else {
|
|
38
|
+
Message({
|
|
39
|
+
message: '该浏览器不支持websocket!',
|
|
40
|
+
type: 'warning'
|
|
41
|
+
})
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
//此callback为在其他地方调用时定义的接收socket数据的函数
|
|
45
|
+
globalCallback = callback
|
|
46
|
+
globalWebSocket = webSocket
|
|
47
|
+
//打开
|
|
48
|
+
webSocket.onopen = function() {
|
|
49
|
+
webSocketOpen()
|
|
50
|
+
}
|
|
51
|
+
//收信
|
|
52
|
+
webSocket.onmessage = function(e) {
|
|
53
|
+
webSocketOnMessage(e)
|
|
54
|
+
}
|
|
55
|
+
//关闭
|
|
56
|
+
webSocket.onclose = function(e) {
|
|
57
|
+
webSocketOnClose(e)
|
|
58
|
+
}
|
|
59
|
+
//连接发生错误的回调方法
|
|
60
|
+
webSocket.onerror = function(e) {
|
|
61
|
+
webSocketonError(e)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//连接socket建立时触发
|
|
65
|
+
function webSocketOpen() {
|
|
66
|
+
console.log("WebSocket连接成功")
|
|
67
|
+
//首次握手
|
|
68
|
+
webSocketSend(heartCheck.heart)
|
|
69
|
+
isConnect = true
|
|
70
|
+
heartCheck.start()
|
|
71
|
+
reConnectNum = 0
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//接受服务端数据
|
|
75
|
+
function webSocketOnMessage(e) {
|
|
76
|
+
console.log("websocket信息:")
|
|
77
|
+
console.log(e.data)
|
|
78
|
+
// 该websocket请求已被停止
|
|
79
|
+
if(e.data == "stopUser") return
|
|
80
|
+
globalCallback(JSON.parse(e.data)) //将data传给在外定义的接收数据的函数,至关重要。
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//socket关闭时触发
|
|
84
|
+
function webSocketOnClose(e){
|
|
85
|
+
heartCheck.clear()
|
|
86
|
+
isConnect = false //断开后修改标识
|
|
87
|
+
console.log(e)
|
|
88
|
+
console.log('webSocket已经关闭 (code:' + e.code + ')')
|
|
89
|
+
//被动断开,重新连接
|
|
90
|
+
if(e.code == 1006){
|
|
91
|
+
if(reConnectNum < 3){
|
|
92
|
+
initWebSocket()
|
|
93
|
+
++reConnectNum
|
|
94
|
+
}else{
|
|
95
|
+
Message({
|
|
96
|
+
message: 'websocket连接不上,请刷新页面或联系开发人员!',
|
|
97
|
+
type: 'warning'
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//连接发生错误的回调方法
|
|
104
|
+
function webSocketonError(e){
|
|
105
|
+
heartCheck.clear()
|
|
106
|
+
isConnect = false //断开后修改标识
|
|
107
|
+
console.log("WebSocket连接发生错误:")
|
|
108
|
+
console.log(e)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
//发送数据
|
|
113
|
+
function webSocketSend(data) {
|
|
114
|
+
webSocket.send(JSON.stringify(data)) //在这里根据自己的需要转换数据格式
|
|
115
|
+
}
|
|
116
|
+
//在其他需要socket地方主动关闭socket
|
|
117
|
+
function closeWebSocket(webSocket) {
|
|
118
|
+
webSocket.close()
|
|
119
|
+
heartCheck.clear()
|
|
120
|
+
isConnect = false
|
|
121
|
+
reConnectNum = 0
|
|
122
|
+
}
|
|
123
|
+
//在其他需要socket地方接受数据
|
|
124
|
+
function getSock(callback) {
|
|
125
|
+
globalCallback = callback
|
|
126
|
+
}
|
|
127
|
+
//在其他需要socket地方调用的函数,用来发送数据及接受数据
|
|
128
|
+
function sendSock(webSocket, agentData) {
|
|
129
|
+
//下面的判断主要是考虑到socket连接可能中断或者其他的因素,可以重新发送此条消息。
|
|
130
|
+
switch (webSocket.readyState) {
|
|
131
|
+
//CONNECTING:值为0,表示正在连接。
|
|
132
|
+
case webSocket.CONNECTING:
|
|
133
|
+
setTimeout(function() {
|
|
134
|
+
sendSock(agentData, callback)
|
|
135
|
+
}, 1000)
|
|
136
|
+
break;
|
|
137
|
+
//OPEN:值为1,表示连接成功,可以通信了。
|
|
138
|
+
case webSocket.OPEN:
|
|
139
|
+
webSocketSend(agentData)
|
|
140
|
+
break;
|
|
141
|
+
//CLOSING:值为2,表示连接正在关闭。
|
|
142
|
+
case webSocket.CLOSING:
|
|
143
|
+
setTimeout(function() {
|
|
144
|
+
sendSock(agentData, callback)
|
|
145
|
+
}, 1000)
|
|
146
|
+
break;
|
|
147
|
+
//CLOSED:值为3,表示连接已经关闭,或者打开连接失败。
|
|
148
|
+
case webSocket.CLOSED:
|
|
149
|
+
// do something
|
|
150
|
+
break;
|
|
151
|
+
default:
|
|
152
|
+
// this never happens
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export default {
|
|
158
|
+
initWebSocket,
|
|
159
|
+
closeWebSocket,
|
|
160
|
+
sendSock,
|
|
161
|
+
getSock
|
|
162
|
+
}
|