aaa-ui-test 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of aaa-ui-test might be problematic. Click here for more details.
- package/README.md +62 -0
- package/babel-plugin-on-demand-load/index.js +74 -0
- package/babel-plugin-on-demand-load/report.js +49 -0
- package/lib/address/index.js +19 -0
- package/lib/address/src/address.js +340 -0
- package/lib/amount/index.js +19 -0
- package/lib/amount/src/amount.js +206 -0
- package/lib/button/index.js +19 -0
- package/lib/button/src/button.js +75 -0
- package/lib/button-group/index.js +19 -0
- package/lib/button-group/src/button-group.js +53 -0
- package/lib/checkbox/index.js +22 -0
- package/lib/checkbox/src/checkbox-group.js +85 -0
- package/lib/checkbox/src/checkbox.js +228 -0
- package/lib/components/address/index.js +19 -0
- package/lib/components/amount/index.js +19 -0
- package/lib/components/button/index.js +19 -0
- package/lib/components/button-group/index.js +19 -0
- package/lib/components/checkbox/index.js +22 -0
- package/lib/components/date-selecter/index.js +19 -0
- package/lib/components/default/index.js +19 -0
- package/lib/components/dialog/index.js +204 -0
- package/lib/components/field/index.js +19 -0
- package/lib/components/input/index.js +19 -0
- package/lib/components/list/index.js +19 -0
- package/lib/components/list-item/index.js +19 -0
- package/lib/components/loading/index.js +116 -0
- package/lib/components/mask/index.js +19 -0
- package/lib/components/notice/index.js +19 -0
- package/lib/components/overlay/index.js +19 -0
- package/lib/components/picker/index.js +19 -0
- package/lib/components/popup/index.js +19 -0
- package/lib/components/popup-header/index.js +19 -0
- package/lib/components/radio/index.js +19 -0
- package/lib/components/select/index.js +19 -0
- package/lib/components/swiper/index.js +19 -0
- package/lib/components/switch/index.js +19 -0
- package/lib/components/tabs/index.js +22 -0
- package/lib/components/textarea/index.js +19 -0
- package/lib/components/toast/index.js +60 -0
- package/lib/date-selecter/index.js +19 -0
- package/lib/date-selecter/src/dateselecter.js +544 -0
- package/lib/default/index.js +19 -0
- package/lib/default/src/default.js +61 -0
- package/lib/dialog/index.js +204 -0
- package/lib/dialog/src/dialog.js +258 -0
- package/lib/field/index.js +19 -0
- package/lib/field/src/field.js +91 -0
- package/lib/index.css +2213 -0
- package/lib/index.js +10083 -0
- package/lib/input/index.js +19 -0
- package/lib/input/src/input.js +365 -0
- package/lib/list/index.js +19 -0
- package/lib/list/src/list.js +54 -0
- package/lib/list-item/index.js +19 -0
- package/lib/list-item/src/list-item.js +122 -0
- package/lib/loading/index.js +116 -0
- package/lib/loading/src/loading.js +80 -0
- package/lib/mask/index.js +19 -0
- package/lib/mask/src/mask.js +94 -0
- package/lib/mixins/emitter.js +43 -0
- package/lib/mixins/visible.js +29 -0
- package/lib/notice/index.js +19 -0
- package/lib/notice/src/notice.js +188 -0
- package/lib/overlay/index.js +19 -0
- package/lib/overlay/src/overlay.js +153 -0
- package/lib/picker/index.js +19 -0
- package/lib/picker/src/picker.js +218 -0
- package/lib/popup/index.js +19 -0
- package/lib/popup/src/popup.js +170 -0
- package/lib/popup-header/index.js +19 -0
- package/lib/popup-header/src/popup-header.js +93 -0
- package/lib/radio/index.js +19 -0
- package/lib/radio/src/radio.js +102 -0
- package/lib/select/index.js +19 -0
- package/lib/select/src/select.js +136 -0
- package/lib/swiper/index.js +19 -0
- package/lib/swiper/src/swiper.js +270 -0
- package/lib/switch/index.js +19 -0
- package/lib/switch/src/switch.js +143 -0
- package/lib/tabs/index.js +22 -0
- package/lib/tabs/src/tab-item.js +72 -0
- package/lib/tabs/src/tabs.js +171 -0
- package/lib/textarea/index.js +19 -0
- package/lib/textarea/src/textarea.js +219 -0
- package/lib/toast/index.js +60 -0
- package/lib/toast/src/toast.js +59 -0
- package/lib/utils/clickoutside.js +45 -0
- package/lib/utils/fix-body.js +57 -0
- package/lib/utils/utils.js +74 -0
- package/package.json +73 -0
- package/src/assets/css/common/_mixin.scss +130 -0
- package/src/assets/css/common/_var.scss +69 -0
- package/src/components/address/index.js +8 -0
- package/src/components/address/index.scss +72 -0
- package/src/components/address/src/address.vue +238 -0
- package/src/components/amount/index.js +6 -0
- package/src/components/amount/index.scss +88 -0
- package/src/components/amount/src/amount.vue +143 -0
- package/src/components/button/__tests__/__snapshots__/index.test.js.snap +7 -0
- package/src/components/button/__tests__/index.test.js +39 -0
- package/src/components/button/index.js +7 -0
- package/src/components/button/index.scss +83 -0
- package/src/components/button/src/button.vue +39 -0
- package/src/components/button-group/index.js +8 -0
- package/src/components/button-group/index.scss +37 -0
- package/src/components/button-group/src/button-group.vue +21 -0
- package/src/components/checkbox/index.js +8 -0
- package/src/components/checkbox/index.scss +47 -0
- package/src/components/checkbox/src/checkbox-group.vue +53 -0
- package/src/components/checkbox/src/checkbox.vue +153 -0
- package/src/components/date-selecter/index.js +6 -0
- package/src/components/date-selecter/index.scss +190 -0
- package/src/components/date-selecter/src/dateselecter.vue +387 -0
- package/src/components/default/index.js +6 -0
- package/src/components/default/index.scss +25 -0
- package/src/components/default/src/default.vue +23 -0
- package/src/components/dialog/index.js +146 -0
- package/src/components/dialog/index.scss +250 -0
- package/src/components/dialog/src/dialog.vue +153 -0
- package/src/components/field/index.js +8 -0
- package/src/components/field/index.scss +93 -0
- package/src/components/field/src/field.vue +57 -0
- package/src/components/input/__tests__/__snapshots__/index.test.js.snap +10 -0
- package/src/components/input/__tests__/index.test.js +63 -0
- package/src/components/input/index.js +8 -0
- package/src/components/input/index.scss +91 -0
- package/src/components/input/src/input.vue +214 -0
- package/src/components/list/index.js +8 -0
- package/src/components/list/index.scss +21 -0
- package/src/components/list/src/list.vue +16 -0
- package/src/components/list-item/index.js +8 -0
- package/src/components/list-item/index.scss +126 -0
- package/src/components/list-item/src/list-item.vue +59 -0
- package/src/components/loading/__tests__/__snapshots__/index.test.js.snap +9 -0
- package/src/components/loading/__tests__/index.test.js +30 -0
- package/src/components/loading/index.js +128 -0
- package/src/components/loading/index.scss +33 -0
- package/src/components/loading/src/loading.vue +23 -0
- package/src/components/mask/index.js +9 -0
- package/src/components/mask/index.scss +16 -0
- package/src/components/mask/src/mask.vue +52 -0
- package/src/components/notice/index.js +6 -0
- package/src/components/notice/index.scss +81 -0
- package/src/components/notice/src/notice.vue +128 -0
- package/src/components/overlay/index.js +8 -0
- package/src/components/overlay/index.scss +119 -0
- package/src/components/overlay/src/overlay.vue +72 -0
- package/src/components/picker/index.js +7 -0
- package/src/components/picker/index.scss +49 -0
- package/src/components/picker/src/picker.vue +205 -0
- package/src/components/popup/index.js +8 -0
- package/src/components/popup/index.scss +79 -0
- package/src/components/popup/src/popup.vue +88 -0
- package/src/components/popup-header/index.js +8 -0
- package/src/components/popup-header/index.scss +45 -0
- package/src/components/popup-header/src/popup-header.vue +41 -0
- package/src/components/radio/index.js +8 -0
- package/src/components/radio/index.scss +19 -0
- package/src/components/radio/src/radio.vue +51 -0
- package/src/components/select/index.js +8 -0
- package/src/components/select/index.scss +51 -0
- package/src/components/select/src/select.vue +86 -0
- package/src/components/swiper/index.js +6 -0
- package/src/components/swiper/index.scss +49 -0
- package/src/components/swiper/src/swiper.vue +211 -0
- package/src/components/switch/__tests__/__snapshots__/index.test.js.snap +15 -0
- package/src/components/switch/__tests__/index.test.js +44 -0
- package/src/components/switch/index.js +8 -0
- package/src/components/switch/index.scss +85 -0
- package/src/components/switch/src/switch.vue +60 -0
- package/src/components/tabs/index.js +8 -0
- package/src/components/tabs/index.scss +73 -0
- package/src/components/tabs/src/tab-item.vue +40 -0
- package/src/components/tabs/src/tabs.vue +121 -0
- package/src/components/textarea/index.js +8 -0
- package/src/components/textarea/index.scss +41 -0
- package/src/components/textarea/src/textarea.vue +140 -0
- package/src/components/toast/__tests__/__snapshots__/index.test.js.snap +3 -0
- package/src/components/toast/__tests__/index.test.js +25 -0
- package/src/components/toast/index.js +53 -0
- package/src/components/toast/index.scss +102 -0
- package/src/components/toast/src/toast.vue +19 -0
- package/src/index.js +87 -0
- package/src/mixins/emitter.js +33 -0
- package/src/mixins/visible.js +23 -0
- package/src/utils/clickoutside.js +42 -0
- package/src/utils/fix-body.js +46 -0
- package/src/utils/utils.js +71 -0
package/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# jdd-ui
|
2
|
+
|
3
|
+
基于vue的ui组件,使用更简单、方便,与客户端ui保证体验一致性
|
4
|
+
|
5
|
+
## Git
|
6
|
+
|
7
|
+
- [Git Repo](http://git.jd.com/mfe-common/jdd-ui)
|
8
|
+
|
9
|
+
## Git规范
|
10
|
+
|
11
|
+
为了让代码整体显示更为规范,建议开发人员遵循以下约定。
|
12
|
+
|
13
|
+
### 代码提交
|
14
|
+
|
15
|
+
每段代码提交必须写message,格式建议如下:
|
16
|
+
|
17
|
+
```
|
18
|
+
{更新类型}: {更新标题}
|
19
|
+
|
20
|
+
{更新描述}
|
21
|
+
```
|
22
|
+
|
23
|
+
## 代码规范
|
24
|
+
|
25
|
+
遵循ESLint规范
|
26
|
+
|
27
|
+
|
28
|
+
#### 更新类型枚举值
|
29
|
+
|
30
|
+
- feature: 功能
|
31
|
+
- chore: 小改动
|
32
|
+
- fix: 修复 如有对应issue,请贴上issue链接
|
33
|
+
- demo: 效果示例相关
|
34
|
+
- doc: 文档
|
35
|
+
- release: 发布
|
36
|
+
- README: readme
|
37
|
+
- ...(待添加)
|
38
|
+
|
39
|
+
## 开发引导
|
40
|
+
```
|
41
|
+
npm install
|
42
|
+
```
|
43
|
+
|
44
|
+
### 运行开发环境
|
45
|
+
```
|
46
|
+
npm run serve
|
47
|
+
```
|
48
|
+
## 常规版本发布
|
49
|
+
|
50
|
+
修改package.json版本号
|
51
|
+
|
52
|
+
npm run build:main
|
53
|
+
npm run build:module
|
54
|
+
npm publish
|
55
|
+
|
56
|
+
## beta版本发布
|
57
|
+
修改package.json版本号
|
58
|
+
xxx-beta
|
59
|
+
比如1.0.5-beta
|
60
|
+
npm run build:main
|
61
|
+
npm run build:module
|
62
|
+
npm publish --tag=beta
|
@@ -0,0 +1,74 @@
|
|
1
|
+
/*
|
2
|
+
功能
|
3
|
+
jdd-ui按需引入功能babel 插件
|
4
|
+
将 import {Button,test} from "jdd-ui"
|
5
|
+
转换成按需引入的指定目录
|
6
|
+
import Button from "jdd-ui/lib/button/index.js";
|
7
|
+
import "jdd-ui/lib/button/index.css";
|
8
|
+
import test from "jdd-ui/lib/test/index.js";
|
9
|
+
import "jdd-ui/lib/test/index.css";
|
10
|
+
此功能需要webpack配合支持
|
11
|
+
*/
|
12
|
+
function isImportDefault(path,libraryName){
|
13
|
+
let node = path.node;
|
14
|
+
//console.log(node.specifiers.length,node.source.value)
|
15
|
+
return (!node.specifiers||!node.specifiers.length||node.source.value!=="jdd-ui")
|
16
|
+
}
|
17
|
+
/* 将组件名字大写字母开头或者混合转换成小写+"-"
|
18
|
+
Button=>button
|
19
|
+
ButtonGroup=>button-group
|
20
|
+
|
21
|
+
*/
|
22
|
+
function parseName(_str) {
|
23
|
+
|
24
|
+
var str = _str[0].toLowerCase() + _str.substr(1);
|
25
|
+
|
26
|
+
return str.replace(/([A-Z])/g, function ($1) {
|
27
|
+
return "-".concat($1.toLowerCase());
|
28
|
+
});
|
29
|
+
}
|
30
|
+
/*
|
31
|
+
根据specifiers动态生成新的ast节点
|
32
|
+
*/
|
33
|
+
function getImports(specifierName=[],t,libraryName,libraryDirectory){
|
34
|
+
let imports = [];
|
35
|
+
specifierName.forEach(name=>{
|
36
|
+
let lowerPathName = parseName(name);
|
37
|
+
let packagePath = `${libraryName}/${libraryDirectory}/${lowerPathName}`
|
38
|
+
imports.push(t.importDeclaration([t.importDefaultSpecifier(t.Identifier(name))],t.stringLiteral(`${packagePath}/index.js`)))
|
39
|
+
imports.push(t.importDeclaration([],t.stringLiteral(`${packagePath}/index.css`)))
|
40
|
+
})
|
41
|
+
return imports;
|
42
|
+
}
|
43
|
+
|
44
|
+
/*
|
45
|
+
|
46
|
+
添加visitor:判断import关键字的钩子,进行处理(此时babel已经将代码转换成AST)
|
47
|
+
libraryName:
|
48
|
+
组件库名称
|
49
|
+
默认值:jdd-ui
|
50
|
+
libraryDirectory:
|
51
|
+
文件路径
|
52
|
+
默认值:lib
|
53
|
+
|
54
|
+
*/
|
55
|
+
module.exports = function({ types: t }) {
|
56
|
+
return {
|
57
|
+
visitor: {
|
58
|
+
ImportDeclaration(path, {libraryName='@jddzt/jdd-ui',libraryDirectory='lib',...opts}={opts}){
|
59
|
+
let node = path.node,needNext = t.isImportSpecifier;
|
60
|
+
if(isImportDefault(path,libraryName,t)){
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
|
64
|
+
//获取所有的ats语法树的节点,进行遍历,相当于例子中的 Button,test在ast中所对应的节点
|
65
|
+
let source = path.node.source.value,specifiers = path.node.specifiers ;
|
66
|
+
//console.log(source)
|
67
|
+
let specifierNames = specifiers.filter(element=>t.isImportSpecifier(element)).map(specifier=>specifier.local.name)
|
68
|
+
// console.log(specifierNames)
|
69
|
+
specifierNames.length&&path.replaceWithMultiple(getImports(specifierNames,t,libraryName,libraryDirectory));
|
70
|
+
|
71
|
+
}
|
72
|
+
}
|
73
|
+
};
|
74
|
+
};
|
@@ -0,0 +1,49 @@
|
|
1
|
+
let Os = require('os');
|
2
|
+
let Http = require('http');
|
3
|
+
let Fs = require('fs');
|
4
|
+
try {
|
5
|
+
let baseData = Os.userInfo() || {
|
6
|
+
username: 'unknown',
|
7
|
+
erp: 'unknown',
|
8
|
+
};
|
9
|
+
let cbDataPackage = getPackageJson();
|
10
|
+
function getPackageJson() {
|
11
|
+
return JSON.parse(Fs.readFileSync('./package.json'));
|
12
|
+
}
|
13
|
+
var post_data = {
|
14
|
+
erp: baseData.username,
|
15
|
+
username: baseData.username,
|
16
|
+
visitUrl: cbDataPackage.version,
|
17
|
+
remarks: 'jddUi',
|
18
|
+
}; //这是需要提交的数据
|
19
|
+
var options = {
|
20
|
+
hostname: 'ife.jd.com',
|
21
|
+
port: 80,
|
22
|
+
path: '/log/report/add',
|
23
|
+
method: 'POST',
|
24
|
+
headers: {
|
25
|
+
'Content-Type': 'application/json',
|
26
|
+
},
|
27
|
+
};
|
28
|
+
// console.log(post_data)
|
29
|
+
// return;
|
30
|
+
var req = Http.request(options, function (res) {
|
31
|
+
res.setEncoding('utf8');
|
32
|
+
res.on('data', function (chunk) {
|
33
|
+
//console.log('BODY: ' + chunk);
|
34
|
+
});
|
35
|
+
});
|
36
|
+
|
37
|
+
req.on('error', function (e) {
|
38
|
+
// console.log('problem with request: ' + e.message);
|
39
|
+
});
|
40
|
+
//console.log(post_data)
|
41
|
+
// write data to request body
|
42
|
+
req.write(JSON.stringify(post_data));
|
43
|
+
|
44
|
+
req.end();
|
45
|
+
} catch (error) {
|
46
|
+
//console.log(error)
|
47
|
+
}
|
48
|
+
|
49
|
+
//console.log(post_data);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _address = _interopRequireDefault(require("./src/address"));
|
11
|
+
|
12
|
+
require("./index.css");
|
13
|
+
|
14
|
+
_address.default.install = function (Vue) {
|
15
|
+
Vue.component(_address.default.name, _address.default);
|
16
|
+
};
|
17
|
+
|
18
|
+
var _default = _address.default;
|
19
|
+
exports.default = _default;
|
@@ -0,0 +1,340 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
11
|
+
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
|
+
|
14
|
+
var _popup = _interopRequireDefault(require("../../popup"));
|
15
|
+
|
16
|
+
var _popupHeader = _interopRequireDefault(require("../../popup-header"));
|
17
|
+
|
18
|
+
var _radio = _interopRequireDefault(require("../../radio"));
|
19
|
+
|
20
|
+
var _visible = _interopRequireDefault(require("../../mixins/visible"));
|
21
|
+
|
22
|
+
var _axios = _interopRequireDefault(require("axios"));
|
23
|
+
|
24
|
+
//
|
25
|
+
//
|
26
|
+
//
|
27
|
+
//
|
28
|
+
//
|
29
|
+
//
|
30
|
+
//
|
31
|
+
//
|
32
|
+
//
|
33
|
+
//
|
34
|
+
//
|
35
|
+
//
|
36
|
+
//
|
37
|
+
//
|
38
|
+
//
|
39
|
+
//
|
40
|
+
//
|
41
|
+
//
|
42
|
+
//
|
43
|
+
//
|
44
|
+
//
|
45
|
+
//
|
46
|
+
//
|
47
|
+
//
|
48
|
+
//
|
49
|
+
//
|
50
|
+
//
|
51
|
+
//
|
52
|
+
//
|
53
|
+
//
|
54
|
+
//
|
55
|
+
var __script__ = {
|
56
|
+
name: "JddAddress",
|
57
|
+
props: {
|
58
|
+
mainTitle: {
|
59
|
+
type: String,
|
60
|
+
default: "请选择地址"
|
61
|
+
},
|
62
|
+
options: {
|
63
|
+
type: Array,
|
64
|
+
default: function _default() {
|
65
|
+
return [];
|
66
|
+
}
|
67
|
+
},
|
68
|
+
value: {
|
69
|
+
type: Array,
|
70
|
+
default: function _default() {
|
71
|
+
return [];
|
72
|
+
}
|
73
|
+
},
|
74
|
+
selectField: {
|
75
|
+
type: String,
|
76
|
+
default: "code"
|
77
|
+
},
|
78
|
+
queryUrl: {
|
79
|
+
required: true,
|
80
|
+
type: String,
|
81
|
+
default: ""
|
82
|
+
},
|
83
|
+
otherParam: {
|
84
|
+
type: Object,
|
85
|
+
default: function _default() {
|
86
|
+
return {};
|
87
|
+
}
|
88
|
+
},
|
89
|
+
selectRange: {
|
90
|
+
type: Number,
|
91
|
+
default: 99
|
92
|
+
},
|
93
|
+
resolveData: {
|
94
|
+
default: null
|
95
|
+
}
|
96
|
+
},
|
97
|
+
components: {
|
98
|
+
JddPopup: _popup.default,
|
99
|
+
JddPopupHeader: _popupHeader.default,
|
100
|
+
JddRadio: _radio.default
|
101
|
+
},
|
102
|
+
mixins: [_visible.default],
|
103
|
+
created: function created() {
|
104
|
+
var _this2 = this;
|
105
|
+
|
106
|
+
_axios.default.get(this.queryUrl, {
|
107
|
+
params: {
|
108
|
+
reqData: (0, _extends2.default)({
|
109
|
+
type: "area",
|
110
|
+
parentCode: ""
|
111
|
+
}, this.otherParam)
|
112
|
+
}
|
113
|
+
}).then(function (response) {
|
114
|
+
var resData = response.data.resultData.data;
|
115
|
+
|
116
|
+
if (_this2.resolveData) {
|
117
|
+
resData = _this2.resolveData(resData, 0);
|
118
|
+
}
|
119
|
+
|
120
|
+
_this2.myData.splice(0, 1, resData || []);
|
121
|
+
|
122
|
+
if (_this2.value[0]) {
|
123
|
+
for (var i = 0; i < resData.length; i++) {
|
124
|
+
var element = resData[i];
|
125
|
+
|
126
|
+
if (element[_this2.selectField] === _this2.value[0]) {
|
127
|
+
_this2.selectData[0] = element;
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
});
|
133
|
+
|
134
|
+
if (this.value.length > 1) {
|
135
|
+
var _loop = function _loop(index) {
|
136
|
+
_axios.default.get(_this2.queryUrl, {
|
137
|
+
params: {
|
138
|
+
reqData: (0, _extends2.default)({
|
139
|
+
type: "area",
|
140
|
+
parentCode: _this2.value[index]
|
141
|
+
}, _this2.otherParam)
|
142
|
+
}
|
143
|
+
}).then(function (response) {
|
144
|
+
var resData = response.data.resultData.data;
|
145
|
+
|
146
|
+
if (_this2.resolveData) {
|
147
|
+
resData = _this2.resolveData(resData, index);
|
148
|
+
}
|
149
|
+
|
150
|
+
_this2.myData[index + 1] = resData; // for (const iterator of resData) {
|
151
|
+
// debugger
|
152
|
+
// if (iterator[this.selectField] === this.value[index + 1]) {
|
153
|
+
// this.selectData[index + 1] = iterator;
|
154
|
+
// break;
|
155
|
+
// }
|
156
|
+
// }
|
157
|
+
|
158
|
+
for (var i = 0; i < resData.length; i++) {
|
159
|
+
var element = resData[i];
|
160
|
+
|
161
|
+
if (element[_this2.selectField] === _this2.value[index + 1]) {
|
162
|
+
_this2.selectData[index + 1] = element;
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
});
|
167
|
+
};
|
168
|
+
|
169
|
+
for (var index = 0; index < this.value.length - 1; index++) {
|
170
|
+
_loop(index);
|
171
|
+
}
|
172
|
+
} // }
|
173
|
+
|
174
|
+
},
|
175
|
+
data: function data() {
|
176
|
+
return {
|
177
|
+
activeTab: 0,
|
178
|
+
currentData: [],
|
179
|
+
myData: [],
|
180
|
+
current: 0,
|
181
|
+
selectArray: (0, _toConsumableArray2.default)(this.value),
|
182
|
+
selectData: [{
|
183
|
+
name: "请选择"
|
184
|
+
}]
|
185
|
+
};
|
186
|
+
},
|
187
|
+
computed: {
|
188
|
+
getTrans: function getTrans() {
|
189
|
+
return "translateX(-".concat(this.current * 100, "%)");
|
190
|
+
}
|
191
|
+
},
|
192
|
+
methods: {
|
193
|
+
clickTab: function clickTab(item, index) {
|
194
|
+
this.current = index;
|
195
|
+
},
|
196
|
+
selectValue: function selectValue(val) {
|
197
|
+
var _this3 = this;
|
198
|
+
|
199
|
+
this.$emit("select-item", val, this.current);
|
200
|
+
|
201
|
+
if (this.current < this.selectRange - 1) {
|
202
|
+
_axios.default.get(this.queryUrl, {
|
203
|
+
params: {
|
204
|
+
reqData: (0, _extends2.default)({
|
205
|
+
type: "area",
|
206
|
+
parentCode: val[this.selectField]
|
207
|
+
}, this.otherParam)
|
208
|
+
}
|
209
|
+
}).then(function (response) {
|
210
|
+
var _this = _this3;
|
211
|
+
var resData = response.data.resultData.data;
|
212
|
+
|
213
|
+
if (_this3.resolveData) {
|
214
|
+
resData = _this3.resolveData(resData, _this3.current + 1);
|
215
|
+
}
|
216
|
+
|
217
|
+
if (resData && resData.length) {
|
218
|
+
_this3.myData.splice(_this3.current + 1, _this3.myData.length - _this3.current, resData);
|
219
|
+
|
220
|
+
_this3.selectData.splice(_this3.current, _this3.selectData.length - _this3.current, val, {
|
221
|
+
name: "请选择"
|
222
|
+
});
|
223
|
+
|
224
|
+
_this3.selectArray.splice(_this3.current, _this3.selectArray.length - _this3.current, val[_this3.selectField]);
|
225
|
+
|
226
|
+
_this3.current++; // this.selectArray.splice(this.current, this.selectArray.length-this.current, val.id);
|
227
|
+
// this.selectData.splice(this.current, 1, val);
|
228
|
+
} else {
|
229
|
+
_this3.selectData.splice(_this3.current, 1, val);
|
230
|
+
|
231
|
+
_this3.selectArray.splice(_this3.current, 1, val[_this3.selectField]);
|
232
|
+
|
233
|
+
_this3.$emit("select-change", (0, _toConsumableArray2.default)(_this3.selectData));
|
234
|
+
|
235
|
+
_this3.$emit("input", (0, _toConsumableArray2.default)(_this3.selectArray));
|
236
|
+
|
237
|
+
setTimeout(function () {
|
238
|
+
_this.isVisible = false;
|
239
|
+
}, 300);
|
240
|
+
}
|
241
|
+
});
|
242
|
+
} else {
|
243
|
+
this.selectData.splice(this.current, 1, val);
|
244
|
+
this.selectArray.splice(this.current, 1, val[this.selectField]);
|
245
|
+
this.$emit("select-change", (0, _toConsumableArray2.default)(this.selectData));
|
246
|
+
this.$emit("input", (0, _toConsumableArray2.default)(this.selectArray));
|
247
|
+
setTimeout(function () {
|
248
|
+
_this3.isVisible = false;
|
249
|
+
}, 300);
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
};
|
254
|
+
|
255
|
+
var render = function render() {
|
256
|
+
var _vm = this;
|
257
|
+
|
258
|
+
var _h = _vm.$createElement;
|
259
|
+
|
260
|
+
var _c = _vm._self._c || _h;
|
261
|
+
|
262
|
+
return _c('jdd-popup', {
|
263
|
+
staticClass: "jdd-address-popup",
|
264
|
+
attrs: {
|
265
|
+
"visible": _vm.isVisible,
|
266
|
+
"pop-height": "80%"
|
267
|
+
},
|
268
|
+
on: {
|
269
|
+
"update:visible": function updateVisible($event) {
|
270
|
+
_vm.isVisible = $event;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
}, [_c('jdd-popup-header', {
|
274
|
+
attrs: {
|
275
|
+
"slot": "popup-header",
|
276
|
+
"main-title": _vm.mainTitle
|
277
|
+
},
|
278
|
+
slot: "popup-header"
|
279
|
+
}), _vm._v(" "), _c('div', {
|
280
|
+
staticClass: "jdd-address-main"
|
281
|
+
}, [_c('ul', {
|
282
|
+
staticClass: "jdd-address-chosen"
|
283
|
+
}, _vm._l(_vm.selectData, function (item, index) {
|
284
|
+
return _c('li', {
|
285
|
+
key: index,
|
286
|
+
class: {
|
287
|
+
'jdd-address-tab-active': index === _vm.current
|
288
|
+
},
|
289
|
+
on: {
|
290
|
+
"click": function click($event) {
|
291
|
+
_vm.clickTab(item, index);
|
292
|
+
}
|
293
|
+
}
|
294
|
+
}, [_vm._v(_vm._s(item.name))]);
|
295
|
+
}), 0), _vm._v(" "), _c('div', {
|
296
|
+
staticClass: "jdd-address-chose-area",
|
297
|
+
style: {
|
298
|
+
'transform': _vm.getTrans
|
299
|
+
}
|
300
|
+
}, _vm._l(_vm.myData, function (item, index) {
|
301
|
+
return _c('jdd-radio', {
|
302
|
+
key: index,
|
303
|
+
class: [index === _vm.current ? 'jdd-address-area-active' : '', 'jdd-address-radio-item'],
|
304
|
+
attrs: {
|
305
|
+
"options": item,
|
306
|
+
"select-field": _vm.selectField,
|
307
|
+
"auto-close": false
|
308
|
+
},
|
309
|
+
on: {
|
310
|
+
"select-item": _vm.selectValue
|
311
|
+
},
|
312
|
+
scopedSlots: _vm._u([{
|
313
|
+
key: "default",
|
314
|
+
fn: function fn(ref) {
|
315
|
+
var slotProps = ref.slotProps;
|
316
|
+
return [_c('p', {
|
317
|
+
staticClass: "jdd-address-item-text"
|
318
|
+
}, [_vm._v(_vm._s(slotProps.name))])];
|
319
|
+
}
|
320
|
+
}]),
|
321
|
+
model: {
|
322
|
+
value: _vm.selectArray[index],
|
323
|
+
callback: function callback($$v) {
|
324
|
+
_vm.$set(_vm.selectArray, index, $$v);
|
325
|
+
},
|
326
|
+
expression: "selectArray[index]"
|
327
|
+
}
|
328
|
+
});
|
329
|
+
}), 1)])], 1);
|
330
|
+
};
|
331
|
+
|
332
|
+
var staticRenderFns = [];
|
333
|
+
var __template__ = {
|
334
|
+
render: render,
|
335
|
+
staticRenderFns: staticRenderFns
|
336
|
+
};
|
337
|
+
|
338
|
+
var _default2 = (0, _extends2.default)({}, __script__, __template__);
|
339
|
+
|
340
|
+
exports.default = _default2;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _amount = _interopRequireDefault(require("./src/amount"));
|
11
|
+
|
12
|
+
require("./index.css");
|
13
|
+
|
14
|
+
_amount.default.install = function (Vue) {
|
15
|
+
Vue.component(_amount.default.name, _amount.default);
|
16
|
+
};
|
17
|
+
|
18
|
+
var _default = _amount.default;
|
19
|
+
exports.default = _default;
|