jufubao-admin-library 1.0.0-beta1 → 1.0.0-beta3

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "isOpenDir": true,
3
+ "watch": false,
4
+ "type": "test",
5
+ "cover": true,
6
+ "service": "serve",
7
+ "permissionsCover": true,
8
+ "permissionsTagsViewCover": true
9
+ }
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 第三方库
5
+ * @param threePackagePath {String} 第三方库所在项目路径存放路径路
6
+ * @returns {string|*}
7
+ */
8
+ const getPackagePath = (threePackagePath)=>{
9
+ return `/Users/shiyonggao/home/root/Base-Version/Panel/xd-vue-package/${threePackagePath}`;
10
+ };
11
+
12
+ module.exports = {
13
+ getPackagePath
14
+ }
package/gulp.config.js ADDED
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ //开发模式设置插件库路径
5
+ src: `${__dirname}/library/`,
6
+ schemas:[
7
+ // {
8
+ // NAME: "buyLimit", //模块名称:限购
9
+ // STATUS: true, //是否启用
10
+ // PACK_MODULE_DIR: 'viewModules/viewsLimit',//插件库中模块目录
11
+ // //smsbuylimit-partner,smsbuylimit-admin(客服,超管,限购项目)
12
+ // API_APP: "smsbuylimit-partner", // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
13
+ // DEST_PAGE_PATH: "viewsLimit", // 项目页面目录
14
+ // DEST_ROOT_PATH: "src", // 项目根目录
15
+ // replaceOptionServer: { // 替换选项卡 fn: server
16
+ // "supplier": "supplier-partner",
17
+ // "categories": "product-partner",
18
+ // "business-line":"partner", //partner,partner-admin
19
+ // }
20
+ // },
21
+ // {
22
+ // NAME: "enterprise", //模块名称: 集采模块
23
+ // STATUS: true, //是否启用
24
+ // PACK_MODULE_DIR: 'viewModules/viewsEnterpriseBuy',//插件库中模块目录
25
+ // //wholesale-partner,wholesale-admin(设计到超管,加盟商-集采,加盟商-财务)
26
+ // API_APP: "wholesale-partner", // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
27
+ // DEST_PAGE_PATH: "viewsEnterpriseBuy", // 项目页面目录
28
+ // DEST_ROOT_PATH: "src", // 项目根目录
29
+ // replaceOptionServer: { // 替换选项卡 fn: server
30
+ //
31
+ // }
32
+ // },
33
+ // {
34
+ // NAME: "finance", //模块名称:财务
35
+ // STATUS: true, //是否启用
36
+ // PACK_MODULE_DIR: 'viewModules/viewsFinance',//插件库中模块目录
37
+ // //finance-partner(加盟商-财务)
38
+ // API_APP: "finance-partner", // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
39
+ // DEST_PAGE_PATH: "viewsFinance", // 项目页面目录
40
+ // DEST_ROOT_PATH: "src", // 项目根目录
41
+ // replaceOptionServer: { // 替换选项卡 fn: server
42
+ // "supplier": "supplier-partner",
43
+ // "categories": "product-partner",
44
+ // }
45
+ // },
46
+ // {
47
+ // NAME: "stat", //模块名称: 统计
48
+ // STATUS: true,
49
+ // PACK_MODULE_DIR: 'viewModules/viewStat',//插件库中模块目录
50
+ // //stat-partner(加盟商-统计)
51
+ // API_APP: "stat-partner", // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
52
+ // DEST_PAGE_PATH: "viewsStat", // 项目页面目录
53
+ // DEST_ROOT_PATH: "src", // 项目根目录
54
+ // replaceOptionServer: { // 替换选项卡 fn: server
55
+ // "supplier": "supplier-admin",
56
+ // "categories": "product-admin",
57
+ // }
58
+ // },
59
+ // {
60
+ // NAME: "TASK", //模块名称: 任务管理
61
+ // STATUS: true,
62
+ // //export-partner, export-supplier, export-admin
63
+ // // (加盟商-统计,加盟商-财务 , 加盟商,商城,电影,礼包,供货商,超管(未启用))
64
+ // PACK_MODULE_DIR: 'viewModules/viewTask',
65
+ // ROUTE_TO_CHILDREN:true, //路由是否启用子路由模块
66
+ // API_APP: "export-partner",
67
+ // DEST_PAGE_PATH: "viewTask",
68
+ // DEST_ROOT_PATH: "src",
69
+ // replaceOptionServer: {
70
+ //
71
+ // }
72
+ // }
73
+ ]
74
+ }
@@ -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>