jufubao-admin-library 1.0.0 → 1.1.2

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.
Files changed (30) hide show
  1. package/library/pageComponents/JfbPage.js +95 -0
  2. package/library/pageComponents/Loading.js +17 -0
  3. package/library/pageComponents/index.js +20 -0
  4. package/library/pageComponents/modules/JfbChannelSearch.vue +135 -0
  5. package/library/pageComponents/modules/JfbProductDialog.vue +640 -0
  6. package/library/pageComponents/modules/JfbProductSearch.vue +508 -0
  7. package/library/pageComponents/modules/JfbProductSku.vue +102 -0
  8. package/library/pageComponents/modules/JfbProductWholesale.vue +221 -0
  9. package/library/pageComponents/modules/JfbRuleCreate.vue +423 -0
  10. package/library/pageComponents/modules/TestA.vue +21 -0
  11. package/library/pageComponents/modules/TestB.vue +13 -0
  12. package/library/pageComponents/modules/lib/JfbRuleCreate.js +1003 -0
  13. package/library/viewModules/viewStat/viewsStat/index/components/table-product.vue +3 -2
  14. package/library/viewModules/viewStat/viewsStat/index/index.vue +3 -3
  15. package/package.json +5 -9
  16. package/.idea/encodings.xml +0 -6
  17. package/.idea/misc.xml +0 -14
  18. package/.idea/modules.xml +0 -8
  19. package/.idea/vcs.xml +0 -6
  20. package/.idea/xd-admin-buss-library.iml +0 -12
  21. package/library/gulpfile.js/const.js +0 -51
  22. package/library/gulpfile.js/index.js +0 -237
  23. package/library/gulpfile.js/util.js +0 -114
  24. package/tests/unit/components/Breadcrumb.spec.js +0 -98
  25. package/tests/unit/components/Hamburger.spec.js +0 -18
  26. package/tests/unit/components/SvgIcon.spec.js +0 -22
  27. package/tests/unit/utils/formatTime.spec.js +0 -30
  28. package/tests/unit/utils/param2Obj.spec.js +0 -14
  29. package/tests/unit/utils/parseTime.spec.js +0 -35
  30. package/tests/unit/utils/validate.spec.js +0 -17
@@ -0,0 +1,95 @@
1
+ 'use strict';
2
+ import Loading from "./Loading";
3
+
4
+ /**
5
+ * @description 获取权限值
6
+ * @param $vm
7
+ * @returns {{}}
8
+ */
9
+ function getCurrentRouteRoles($vm){
10
+ let temp = {};
11
+ let parent = $vm.$route.matched.filter(item=>{
12
+ return item.parent === undefined
13
+ });
14
+
15
+ if(parent.length > 0) {
16
+ try {
17
+ temp = parent[0]['meta']['rolesList'];
18
+ if (temp === undefined) {
19
+ throw new Error('未找到')
20
+ }
21
+ }catch (e) {
22
+ console.warn(`未找到权限对象值:${JSON.stringify(parent[0]['meta'])}`)
23
+ return {}
24
+ }
25
+ }
26
+ return temp
27
+ }
28
+
29
+ export default ($vm, ele, options, $vue)=>{
30
+ return new Promise((resolve, reject)=>{
31
+ let vueOptions = {
32
+ el: document.createElement('div'),
33
+ };
34
+ ['mixins', 'watch', 'computed', 'methods', 'filters', 'store', 'router'].map(key=>{
35
+ if(options[key] !== undefined) {
36
+ vueOptions[key] = options[key];
37
+ delete options[key]
38
+ }
39
+ });
40
+
41
+ let JfbRoles = getCurrentRouteRoles($vm);
42
+ vueOptions.data = ()=>{
43
+ return {
44
+ ...options,
45
+ JfbParent : $vm,
46
+ JfbRoles,
47
+ $loading: Loading.service
48
+ }
49
+ };
50
+
51
+
52
+ //获取被使用插件库
53
+ let App = null;
54
+ let keys = [];
55
+ Object.keys(Loading).map(key=>{
56
+ if(options.name === key) App = Loading[key];
57
+ keys.push(key)
58
+ });
59
+
60
+ //未找到插件库
61
+ if(App === null){
62
+ let message = `当前组件名字:${options.name}, 所有组件键值:${JSON.stringify(keys)}`;
63
+ console.warn(message);
64
+ throw new Error(message)
65
+ }
66
+
67
+ vueOptions['destroyed'] = ()=>{
68
+ if($node) $node= null;
69
+ };
70
+
71
+ //初始化插件
72
+ const app = $vue.extend(App);
73
+ let $node = new app(vueOptions);
74
+
75
+ //挂在节点
76
+ $vm.$nextTick(()=>{
77
+ if(ele === 'body') {
78
+ document.body.appendChild($node.$el);
79
+ }
80
+ else{
81
+ let elx = document.getElementById(ele);
82
+ if(elx.hasChildNodes()) {
83
+ while (elx.firstChild) {
84
+ elx.removeChild(elx.firstChild)
85
+ }
86
+ }
87
+ elx.appendChild($node.$el);
88
+ }
89
+ $node.$nextTick(()=>{
90
+ resolve($node)
91
+ })
92
+ });
93
+ });
94
+ }
95
+
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ // https://webpack.js.org/guides/dependency-management/#requirecontext
4
+ const modulesFiles = require['context']('./modules', false, /\.vue$/);
5
+
6
+ // you do not need `import app from './modules/app'`
7
+ // it will auto require all vuex module from modules file
8
+ const modules = modulesFiles.keys().reduce((modules, modulePath) => {
9
+ // set './app.js' => 'app'
10
+ const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
11
+ const value = modulesFiles(modulePath)
12
+ modules[moduleName] = value.default
13
+ return modules
14
+ }, {});
15
+
16
+ export default {...modules}
17
+
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+ import JfbPage from "./JfbPage";
3
+
4
+ // 定义 install 方法
5
+ const install = function (Vue, opt) {
6
+ if (install.installed) return;
7
+ install.installed = true;
8
+
9
+ Vue.prototype.JfbPage = ($vm , ele, options) => {
10
+ return JfbPage($vm, ele, Object.assign({}, opt, options), Vue);
11
+ };
12
+ };
13
+
14
+ if (typeof window !== 'undefined' && window['Vue']) {
15
+ install(window['Vue'])
16
+ }
17
+
18
+ export default {
19
+ install
20
+ }
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <div v-if="showOpen">
3
+ <div class="main-tab">
4
+ <el-tabs
5
+ type="card"
6
+ v-model="channelActiveName"
7
+ v-if="channelTabList.length > 0"
8
+ @tab-click="handleTabClick"
9
+ >
10
+ <el-tab-pane
11
+ v-for="item in channelTabList"
12
+ :label="item.label"
13
+ :name="item.value"
14
+ :key="item.value"
15
+ ></el-tab-pane>
16
+ </el-tabs>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import {getOptions} from "@/utils/options";
23
+ import XdSearch from "@/components/XdSearch";
24
+ import {mapActions, mapState} from "vuex";
25
+
26
+ export default {
27
+ name: "JfbChannelSearch",
28
+ components:{
29
+ XdSearch
30
+ },
31
+ data(){
32
+ return{
33
+ //tab
34
+ channelActiveName: '',
35
+ channelStatus: false,
36
+ channelTabList: [],
37
+ channelFirstInit:true, //是否为第一次加载渠道
38
+
39
+ showOpen : false,
40
+ }
41
+ },
42
+ computed:{
43
+ ...mapState(['commonParams']),
44
+ },
45
+ async created(){
46
+ this.cookieKey = `${this.commonParams.xsiteid}.${this.commonParams.xnamespace}.${this.pagesType}.channel`;
47
+ this.showOpen = this.isOpen;
48
+
49
+ if(this.showOpen) {
50
+ //supplier-partner/v1/supplier-channel/options
51
+ let channelTabList = await getOptions({
52
+ server: this.channelServer || 'supplier-partner',
53
+ fn: 'supplier-channel',
54
+ path: 'p1',
55
+ params: this.channelParams
56
+ });
57
+ let all = [{label: '全部', value: 'all'}];
58
+ this.channelTabList = all.concat(channelTabList.data.list);
59
+ this.channelActiveName = xdCookie.get(this.cookieKey) || this.channelTabList[0].value;
60
+ if (typeof this.JfbParent.getList === 'function') {
61
+ this.JfbParent.getList({
62
+ channel_code: this.channelActiveName
63
+ })
64
+ }
65
+ }
66
+ else {
67
+ this.JfbParent.getList({})
68
+ }
69
+
70
+ },
71
+ methods:{
72
+ getParams(){
73
+ if(this.showOpen === false) return {}
74
+ return { channel_code: this.channelActiveName }
75
+ },
76
+ handleTabClick() {
77
+ xdCookie.set(this.cookieKey, this.channelActiveName, {expires: 30 * 24});
78
+ if (typeof this.JfbParent.getList === 'function') {
79
+ this.JfbParent.getList(this.getParams())
80
+ }
81
+ },
82
+
83
+ getChannelCode(){
84
+ if (typeof this.JfbParent.getList === 'function') {
85
+ this.JfbParent.getList(this.getParams())
86
+ }
87
+ },
88
+
89
+ getChannelName(channel_code){
90
+ if(!channel_code) return '';
91
+ let item = this.channelTabList.filter(item=>{
92
+ return channel_code === item.value;
93
+ });
94
+ if(item.length > 0) return item[0].label;
95
+ else return channel_code
96
+ },
97
+
98
+ }
99
+ }
100
+ </script>
101
+
102
+ <style scoped lang="scss">
103
+ ::v-deep {
104
+ .el-tabs--card > .el-tabs__header .el-tabs__item {
105
+ background: #f8f8f8;
106
+ border-bottom: 1px solid #dfe4ed!important;
107
+ &.is-top.is-active {
108
+ &:first-child {
109
+ border-radius: 2px 0 0 0;
110
+ }
111
+
112
+ &:last-child {
113
+ border-radius: 0 2px 0 0;
114
+ }
115
+ background: $blue;
116
+ border-bottom: 1px solid $blue !important;
117
+ color: #fff!important;
118
+ }
119
+ }
120
+ }
121
+
122
+ @media screen and (max-width: 768px) {
123
+ ::v-deep {
124
+ & .el-tabs__item {
125
+ height: 30px;
126
+ line-height: 30px;
127
+ }
128
+
129
+ & .el-tabs__nav-next, .el-tabs__nav-prev {
130
+ line-height: 30px;
131
+ }
132
+ }
133
+ }
134
+
135
+ </style>