jufubao-admin-library 1.1.26 → 1.1.28

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,230 @@
1
+ 'use strict';
2
+
3
+ const settings = {
4
+
5
+ /**
6
+ * @description 阿里云前端监控配置
7
+ */
8
+ aliPid: 'aa2vphu6tr@f7f6bac23dcef56',
9
+ aliEnvironment: 'daily', //daily测试环境 //prod线上环境
10
+ aliSample: 1, //1表示100%采样,10表示10%采样,100表示1%采样
11
+ aliPvSample: 1, //1表示100%采样,10表示10%采样,100表示1%采样
12
+ aliDisableHook: true, //是否禁用api上报 true=禁用 false=开启
13
+ aliBehavior: true, //是否为了便于排查错误而记录报错的用户行为。
14
+ aliEnableSPA: false, //是否启动单页面上报pv日志
15
+ aliEnableConsole: false, //是否劫持Console
16
+ aliSendResource: true, //静态资源错误上报
17
+ aliAutoSendPerf: true, //性能和api分析日志
18
+
19
+ /**
20
+ * @type {string}
21
+ * @description routerMode值 hash,history
22
+ */
23
+ routerMode: 'history',
24
+
25
+ /**
26
+ * @type {string}
27
+ * @description 项目名称
28
+ */
29
+ title: '工会福利系统(测试)',
30
+
31
+ /**
32
+ * @type {boolean}
33
+ * @description 无返回结构体{code: 200, data: {}, message:'success'},返回格式:{}
34
+ */
35
+ isOpenNoResultKey: true,
36
+
37
+ /**
38
+ * @type {string}
39
+ * @description 项目标识
40
+ */
41
+ system: 'saas-admin',
42
+
43
+ /**
44
+ * @type {string}
45
+ * @description 图片cdn域名地址
46
+ */
47
+ cdnBaseUrl: '//sandbox-img.jufubao.cn',
48
+
49
+ /**
50
+ * @type {Array}
51
+ * @description API白名单(不需要token,上报日志)
52
+ */
53
+ apiWhiteList: [
54
+ '/api/pb/host/get-brand',
55
+ '/api/pb/host/minfo',
56
+ '/api/pb/host/malert',
57
+ ],
58
+
59
+ /**
60
+ * @type {Number}
61
+ * @description 接口返回时间超时上报日志(单位:毫秒)
62
+ */
63
+ apiDelay: 10000,
64
+
65
+ /**
66
+ * @type {string}
67
+ * @description 百度AK
68
+ */
69
+ baiduAK: 'btKt57MWjMx2P1ds2OjZIttLOOjR2Ndf',
70
+
71
+ /**
72
+ * @type Function
73
+ * @description 页面layout页面路径
74
+ */
75
+ layout: () => import('@/layout'),
76
+
77
+
78
+ /**
79
+ * @type {boolean}
80
+ * @description 是否启用本地演示路由配置
81
+ */
82
+ isOpenLocalDemoRouter: false,
83
+
84
+ /**
85
+ * @type { Array }
86
+ * @description 不验证登录状态
87
+ */
88
+ whiteList:[
89
+ '/login'
90
+ ],
91
+
92
+ /**
93
+ * @description 用户登录页面
94
+ * @type {String}
95
+ */
96
+ login: '/login',
97
+
98
+ /**
99
+ * @type {String}
100
+ * @description 入口页面
101
+ */
102
+ index: '/',
103
+
104
+ /**
105
+ * @type {String}
106
+ * @description 跳转到登录地址
107
+ */
108
+ superAdminLogin: '/login',
109
+
110
+ /**
111
+ * @type {String}
112
+ * @description 后台请求base域名
113
+ */
114
+ apiBaseUrl: '//sandbox-fuli-admin.jufubao.cn',
115
+
116
+ /**
117
+ * @type {String}
118
+ * @description 后台管理API地址
119
+ */
120
+ getBrandHostBaseUrl: 'http://sandbox-c.jufubao.cn',
121
+
122
+ /**
123
+ * @type {string}
124
+ * @description 开发环境api baseurl地址 (开发环境生效)
125
+ */
126
+ //getBrandHost: 'sandbox-gonghui-admin.jufubao.cn',
127
+ getBrandHost: 'sandbox-c.jufubao.cn',
128
+
129
+
130
+ /**
131
+ * @type {String} 聚福宝储存token名字
132
+ * @description cookie token key
133
+ */
134
+ jufubaoTokenKey: 'jufubao-company-token',
135
+
136
+
137
+ /**
138
+ * @type {String} 当前后台系统tokenKey
139
+ * @description cookie token key
140
+ */
141
+ currentToken: 'jufubao-company-token',
142
+
143
+
144
+ /**
145
+ * @type {string}
146
+ * @description 系统版本
147
+ */
148
+ version: 'v1.0.0',
149
+
150
+ /**
151
+ * @type {boolean}
152
+ * @description 是否关闭eslint语法检测
153
+ */
154
+ isCloseEslint: false,
155
+
156
+ /***
157
+ * @description 请求列表返回数据条数
158
+ * @type { number }
159
+ */
160
+ limit: 10,
161
+
162
+
163
+ /**
164
+ * @type {boolean} true | false
165
+ * @description 是否开启方法执行逻辑定位位置显示
166
+ */
167
+ isTimeLog: false,
168
+
169
+
170
+ /**
171
+ * @type {boolean} true | false
172
+ * @description 开发环境与生产环境
173
+ */
174
+ isDebug: false,
175
+
176
+ /**
177
+ * @type {boolean} true | false
178
+ * @description 是否加载模拟数据
179
+ */
180
+ isTestData: false,
181
+
182
+ /**
183
+ * @type {number}
184
+ * @description 开发环境端口号
185
+ */
186
+ port: 8099,
187
+
188
+ /**
189
+ * @type {boolean} true | false
190
+ * @description Whether show the settings right-panel
191
+ */
192
+ showSettings: false,
193
+
194
+ /**
195
+ * @type {boolean} true | false
196
+ * @description Whether need tagsView
197
+ */
198
+ tagsView: true,
199
+
200
+ /**
201
+ * @type {boolean} true | false
202
+ * @description Whether fix the header
203
+ */
204
+ fixedHeader: false,
205
+
206
+ /**
207
+ * @type {boolean} true | false
208
+ * @description Whether show the logo in sidebar
209
+ */
210
+ sidebarLogo: true,
211
+
212
+ /**
213
+ * @type {boolean} true | false
214
+ * @description 启动营销中心导航
215
+ */
216
+ showTopNavMenu: false,
217
+
218
+ /**
219
+ * @type {string | array} 'production' | ['production', 'development']
220
+ * @description Need show err logs component.
221
+ * The default is only used in the production env
222
+ * If you want to also use it in dev, you can pass ['production', 'development']
223
+ */
224
+ errorLog: 'production',
225
+
226
+ };
227
+
228
+ module.exports = settings;
229
+
230
+
@@ -19,6 +19,7 @@ const greetingCardRouter = {
19
19
  //roles: []
20
20
  },
21
21
  children: [
22
+ // #ifdef admin
22
23
  {
23
24
  path: 'list',
24
25
  name: 'GreetingCardList',
@@ -29,6 +30,7 @@ const greetingCardRouter = {
29
30
  //roles: []
30
31
  }
31
32
  },
33
+ // #endif
32
34
  {
33
35
  path: 'config/:material_id?/:group_id?',
34
36
  name: 'GreetingCardConfig',
@@ -37,8 +39,13 @@ const greetingCardRouter = {
37
39
  meta: {
38
40
  title: '贺卡配置',
39
41
  icon: 'el-icon-s-platform',
40
- // roles: [],
41
- activeMenu: "/greeting_card/list"
42
+ roles: [],
43
+ // #ifdef admin
44
+ activeMenu: "/greeting_card/list",
45
+ // #endif
46
+ // #ifdef saas-admin
47
+ activeMenu: '/cards/list'
48
+ // #endif
42
49
  }
43
50
  }
44
51
  ]
@@ -8,7 +8,6 @@ module.exports = {
8
8
  {
9
9
  title: '贺卡管理 - 组列表',
10
10
  mapFn: "getGreetingCardGroupList",
11
- isPublic: true,
12
11
  path: '/saas-admin/v1/bless_material_group/options',
13
12
  isRule: false,
14
13
  data: {},
@@ -18,7 +17,6 @@ module.exports = {
18
17
  {
19
18
  title: '贺卡管理 - 创建',
20
19
  mapFn: "AddGreetingCardGroup",
21
- isPublic: true,
22
20
  path: '/saas-admin/v1/bless_material_group',
23
21
  isRule: false,
24
22
  data: {
@@ -30,7 +28,6 @@ module.exports = {
30
28
  {
31
29
  title: '贺卡管理 - 删除',
32
30
  mapFn: "delGreetingCardGroup",
33
- isPublic: true,
34
31
  path: '/saas-admin/v1/bless_material_group/:group_id',
35
32
  isRule: false,
36
33
  data: {
@@ -43,7 +40,6 @@ module.exports = {
43
40
  {
44
41
  title: '贺卡管理 - 贺卡列表',
45
42
  mapFn: "getGreetingCardList",
46
- isPublic: true,
47
43
  path: '/saas-admin/v1/bless_material/items',
48
44
  isRule: false,
49
45
  data: {
@@ -57,7 +53,6 @@ module.exports = {
57
53
  {
58
54
  title: '贺卡管理 - 创建贺卡',
59
55
  mapFn: "addGreetingCard",
60
- isPublic: true,
61
56
  path: '/saas-admin/v1/bless_material',
62
57
  isRule: false,
63
58
  data: {
@@ -69,7 +64,6 @@ module.exports = {
69
64
  {
70
65
  title: '贺卡管理 - 编辑贺卡',
71
66
  mapFn: "updateGreetingCard",
72
- isPublic: true,
73
67
  path: '/saas-admin/v1/bless_material/:material_id',
74
68
  isRule: false,
75
69
  data: {
@@ -83,7 +77,6 @@ module.exports = {
83
77
  {
84
78
  title: '贺卡管理 - 复制贺卡',
85
79
  mapFn: "copyGreetingCard",
86
- isPublic: true,
87
80
  path: '/saas-admin/v1/bless_material/copy/:copy_material_id',
88
81
  isRule: false,
89
82
  data: {
@@ -96,7 +89,6 @@ module.exports = {
96
89
  {
97
90
  title: '贺卡管理 - 获取贺卡信息',
98
91
  mapFn: "getGreetingCardById",
99
- isPublic: true,
100
92
  path: '/saas-admin/v1/bless_material/item/:material_id',
101
93
  isRule: false,
102
94
  data: {
@@ -105,5 +97,55 @@ module.exports = {
105
97
  disabled: true,
106
98
  role: '',
107
99
  },
100
+ {
101
+ title: '贺卡管理 - 素材配置数据',
102
+ mapFn: "setGreetingCardBaseConfig",
103
+ path: '/saas-admin/v1/bless_material/:material_id',
104
+ isRule: false,
105
+ data: {
106
+ material_id:['素材ID', 'string|number', '必填'],
107
+ item: ['素材配置对象', 'string|number', '必填']
108
+ },
109
+ disabled: true,
110
+ role: '',
111
+ method: 'put'
112
+ },
113
+
114
+ //custom
115
+ {
116
+ title: '贺卡管理 - 获取自定义素材信息',
117
+ mapFn: "getCustomMaterialInfo",
118
+ path: '/saas-company/v1/bless_x_material/item/:x_material_id',
119
+ isRule: false,
120
+ params: {
121
+ x_material_id:['素材ID', 'string|number', '必填'],
122
+ },
123
+ disabled: true,
124
+ role: '',
125
+ },
126
+ {
127
+ title: '贺卡管理 - 创建自定义素材',
128
+ mapFn: "createCustomMaterial",
129
+ path: '/saas-company/v1/bless_x_material',
130
+ isRule: false,
131
+ data: {
132
+ item: ['素材配置对象', 'string|number', '必填']
133
+ },
134
+ disabled: true,
135
+ role: '',
136
+ },
137
+ {
138
+ title: '贺卡管理 - 编辑自定义素材',
139
+ mapFn: "updateCustomMaterial",
140
+ path: '/saas-company/v1/bless_x_material/:x_material_id',
141
+ isRule: false,
142
+ data: {
143
+ x_material_id:['素材ID', 'string|number', '必填'],
144
+ item: ['素材配置对象', 'string|number', '必填']
145
+ },
146
+ disabled: true,
147
+ role: '',
148
+ method: 'put'
149
+ },
108
150
  ],
109
151
  }
@@ -2,37 +2,53 @@
2
2
  <div class="xd-edit-layout-page" id="xd-edit-layout-page">
3
3
  <xd-edit-layout v-if="firstLoading" :width="isPc?300:220" is-scroll-full v-model="isFull">
4
4
  <div class="pages-top" slot="top">
5
+ <!--#ifdef admin-->
6
+ <el-button type="primary" :disabled="isPublish" @click="handlePublish">保存</el-button>
7
+ <!--#endif-->
8
+ <!--#ifdef saas-admin-->
9
+ <el-button type="primary" :disabled="!isShowPhone || isPublish" @click="handleCustomPublish">使用</el-button>
10
+ <!--#endif-->
5
11
  <el-button icon="el-icon-back" @click="$router.back()">返回</el-button>
6
- <el-button type="primary" icon="el-icon-coin" :disabled="isPublish" @click="handlePublish">保存</el-button>
7
12
  </div>
8
- <div class="pages-left" slot="left" >
13
+ <div class="pages-left" slot="left">
9
14
  <div class="pages-left__header" v-if="is_search_show">
10
- <el-dropdown type="primary">
15
+ <el-dropdown type="primary" trigger="click" @command="handleCommand">
11
16
  <div class="text"><i class="iconfont iconshaixuanbiaoji_mian"></i></div>
12
17
  <el-dropdown-menu slot="dropdown">
13
- <el-dropdown-item>黄金糕</el-dropdown-item>
14
- <el-dropdown-item>狮子头</el-dropdown-item>
15
- <el-dropdown-item>螺蛳粉</el-dropdown-item>
16
- <el-dropdown-item>双皮奶</el-dropdown-item>
17
- <el-dropdown-item>蚵仔煎</el-dropdown-item>
18
+ <el-dropdown-item
19
+ :class="{'g-active':item.value === custom_group_id,'g-no-active':item.value !== custom_group_id}"
20
+ v-for="item in search_group_list"
21
+ :icon="item.value === custom_group_id?'el-icon-check':''"
22
+ :command="item.value"
23
+ >{{item.label}}</el-dropdown-item>
18
24
  </el-dropdown-menu>
19
25
  </el-dropdown>
20
- <el-input placeholder="搜索模版" v-model="search_group_name"></el-input>
21
- <el-button type="primary" icon="el-icon-search"></el-button>
26
+ <el-input placeholder="搜索模版" v-model="search_group_name" clearable></el-input>
27
+ <el-button type="primary" icon="el-icon-search" @click="handleSearch()"></el-button>
22
28
  </div>
23
- <div class="pages-left__content">
24
- <div
25
- v-for="item in leftGroupList"
26
- :key="item.value"
27
- :class="{active: active === item.value}"
28
- @click="handleChange(item)"
29
- >
30
- <el-image fit="contain" :src="item['material_cover_url']">
31
- <div slot="error" class="image-slot"><i class="el-icon-picture-outline"></i></div>
32
- </el-image>
33
- <div>{{item.label}}</div>
34
- </div>
29
+ <div class="pages-left__content" v-if="leftGroupList !== null">
30
+ <div class="pages-left__content-title" v-if="leftGroupList && leftGroupList.length === 0">【<span>{{custom_group_name}}</span>】可用模版列表</div>
31
+ <template v-for="(item,index) in leftGroupList" >
32
+ <div class="pages-left__content-title" v-if="index ===0 && item.isSelected">当前使用模版</div>
33
+ <div class="pages-left__content-title" v-if="index ===0 && !item.isSelected">【<span>{{custom_group_name}}</span>】可用模版列表</div>
34
+ <div
35
+ class="pages-left__content-item"
36
+ :key="item.value"
37
+ :class="{active: active === item.value}"
38
+ @click="handleChange(item)"
39
+ >
40
+ <el-image fit="contain" :src="item['material_cover_url']">
41
+ <div slot="error" class="image-slot"><i class="el-icon-picture-outline"></i></div>
42
+ </el-image>
43
+ <div>{{item.label}}</div>
44
+ </div>
45
+ <div class="pages-left__content-title" v-if="index === 0 && item.isSelected">【<span>{{custom_group_name}}</span>】可用模版列表</div>
46
+ </template>
35
47
  </div>
48
+ <div
49
+ class="nodata"
50
+ v-if="leftGroupList && leftGroupList.length === (custom_active_item===null?0:1)"
51
+ >当前分组下暂无数据列表</div>
36
52
  </div>
37
53
  <div class="pages-main" id="pages-main" slot="main">
38
54
  <div class="line"></div>
@@ -48,6 +64,7 @@
48
64
  <div style="font-size: 30px">Detail:{{materialDetailConfig}}</div>
49
65
  </template>
50
66
  <div
67
+ v-if="isShowPhone"
51
68
  v-for="(item,key) in materialData"
52
69
  :key="key"
53
70
  class="iphone-box-content"
@@ -107,6 +124,11 @@ export default {
107
124
  return this.$xdHelper.isEmpty(this.materialCoverConfig) ||
108
125
  this.$xdHelper.isEmpty(this.materialDetailConfig)
109
126
  },
127
+
128
+ isShowPhone(){
129
+ return !this.$xdHelper.isEmpty(this.materialData.cover)
130
+ || !this.$xdHelper.isEmpty(this.materialData.detail)
131
+ }
110
132
  },
111
133
 
112
134
  watch:{
@@ -125,6 +147,24 @@ export default {
125
147
  },
126
148
  deep: true
127
149
  },
150
+
151
+ // #ifdef admin
152
+ materialCoverConfig(val){
153
+ this.leftGroupList = this.leftGroupList.map(item=>{
154
+ if(this.active_material_id === item.id) {
155
+ let material_cover_url = item['material_cover_url'];
156
+ if(val.material_image && val.material_image.url) {
157
+ material_cover_url = this.getImageFullPath(val.material_image.url,'size8');
158
+ }
159
+ return {
160
+ ...item,
161
+ material_cover_url
162
+ }
163
+ }
164
+ return item;
165
+ })
166
+ },
167
+ // #endif
128
168
  },
129
169
 
130
170
  data(){
@@ -135,31 +175,42 @@ export default {
135
175
  defaultCoverImage: '//img.jufubao.cn/component/dome-cover.png',
136
176
  defaultDetailImage: '//img.jufubao.cn/component/dome-detail.png',
137
177
 
138
- //参数
178
+ //地址栏中参数(超管)
139
179
  group_id: '',
140
180
  material_id: '',
141
181
 
142
- //group
143
- search_group_id: 0,
144
- search_group_name:'',
182
+
183
+ //自定义素材ID(SaaS后台)
184
+ custom_x_material_id:null,
185
+ custom_x_material_item: null,
186
+ custom_group_id: null,
187
+ custom_group_name:'',
188
+ custom_active_item: null,
189
+ custom_active_material_id: null,
190
+
191
+ //search(SaaS后台)
145
192
  is_search_show: false,
193
+ search_group_list: [],
194
+ search_group_name:'',
146
195
 
196
+ //left data
197
+ leftGroupList:null,
147
198
 
148
- //left
149
- leftGroupList:[],
150
- active:'',
151
199
 
152
200
  //main ---> material_cover_config/material_detail_config
201
+ active:'',//当前选择到素材ID
153
202
  activeItem: null, //当前操作贺卡数据
203
+ active_material_id:null, //原素材ID切换的参数
154
204
  mainActive:'',
155
205
  materialCoverKey:{
156
206
  material_cover_config:'materialCoverConfig',
157
207
  material_detail_config:'materialDetailConfig'
158
208
  },
159
209
  materialCoverDefault:{
160
- material_cover_config:{"material_image": "", "material_height": 780, "material_status": "Y", "material_nickname": "亲爱的 {{name}}!", "material_content": "", "material_end": "{{company}}", "material_color": "#333", "material_margin": { "top": 470, "right": 20, "bottom": 0, "left": 20 } },
161
- material_detail_config:{"material_image": "", "material_height": 1334, "material_status": "Y", "material_nickname": "亲爱的 {{name}}!", "material_content": "", "material_end": "{{company}}", "material_color": "#F99E15", "material_margin": { "top": 450, "right": 100, "bottom": 0, "left": 100 } }
210
+ material_cover_config:{},//{"material_image": "", "material_height": 780, "material_status": "Y", "material_nickname": "亲爱的 {{name}}!", "material_content": "", "material_end": "{{company}}", "material_color": "#333", "material_margin": { "top": 470, "right": 20, "bottom": 0, "left": 20 } },
211
+ material_detail_config:{},//{"material_image": "", "material_height": 1334, "material_status": "Y", "material_nickname": "亲爱的 {{name}}!", "material_content": "", "material_end": "{{company}}", "material_color": "#F99E15", "material_margin": { "top": 450, "right": 100, "bottom": 0, "left": 100 } }
162
212
  },
213
+ material_cover:null,//封面图
163
214
 
164
215
  //封面配置信息
165
216
  materialCoverConfig:{},
@@ -167,9 +218,6 @@ export default {
167
218
  //详情配置信息
168
219
  materialDetailConfig:{},
169
220
 
170
- //封面图
171
- material_cover:null,
172
-
173
221
  //pages data
174
222
  materialDataTimer:null,
175
223
  materialCoverMap:{
@@ -191,9 +239,16 @@ export default {
191
239
 
192
240
  created() {
193
241
  let params = this.$route.params;
242
+ let query = this.$route.query;
194
243
  if(params.group_id) this.group_id = params.group_id;
195
244
  if(params.material_id){
196
245
  this.material_id = params.material_id;
246
+ this.active_material_id = Number(params.material_id);
247
+ }
248
+
249
+ //自定义素材ID
250
+ if(query.x_material_id) {
251
+ this.custom_x_material_id = Number(query.x_material_id);
197
252
  }
198
253
  this.isPc = isPlatform().isPc;
199
254
  this.initDataCard();
@@ -203,6 +258,10 @@ export default {
203
258
  ...mapActions('greetingCard',[
204
259
  'getGreetingCardGroupList',
205
260
  'getGreetingCardList',
261
+ 'setGreetingCardBaseConfig',
262
+ 'getCustomMaterialInfo',
263
+ 'createCustomMaterial',
264
+ 'updateCustomMaterial'
206
265
  ]),
207
266
  initDataCard(){
208
267
  // #ifdef admin
@@ -212,45 +271,217 @@ export default {
212
271
  this.initDataCardSaasAdmin();
213
272
  // #endif
214
273
  },
274
+
275
+ //获取到列表之后初始化页面
276
+ handleInitLeftData(list, material_id){
277
+ let activeItem = null;
278
+ this.leftGroupList = list.map(item=>{
279
+ item['material_cover_url'] = this.getImageFullPath(item.material_cover,'size8');
280
+ item['value'] = item.id + '';
281
+ item['label'] = item.material_name;
282
+ if(item.id === material_id) activeItem = item;
283
+ return item
284
+ });
285
+
286
+ this.search_group_list.map(item=>{
287
+ debugger
288
+ if(item.value === this.custom_group_id+''){
289
+ this.custom_group_name = item.label;
290
+ }
291
+ });
292
+
293
+ //设置当前选中
294
+ if(activeItem){
295
+ this.handleChange(activeItem, true);
296
+ this.firstLoading = true;
297
+ }
298
+
299
+
300
+ else this.firstLoading = true;
301
+ },
302
+ checkIsPublish(cover,detail){
303
+ if(!cover.material_image) {
304
+ this.$message({message:'请上传贺卡封面图片',type:'error'});
305
+ return true;
306
+ }
307
+
308
+ if(!detail.material_image) {
309
+ this.$message({message:'请上传贺卡详情背景图片',type:'error'});
310
+ return true;
311
+ }
312
+ return false;
313
+ },
314
+
215
315
  // #ifdef admin
216
316
  initDataCardAdmin(){
217
317
  this.is_search_show = false;
218
318
  let params = {
219
319
  filters: {
220
320
  group_id: Number(this.group_id),
221
- material_ids:[Number(this.material_id),16]
321
+ material_ids:[Number(this.material_id)]
222
322
  },
223
323
  page_token:'1',
224
324
  page_size: 20,
225
325
  }
226
326
  this.getGreetingCardList(params)
227
327
  .then(res=>{
228
- let activeItem = null;
229
- this.leftGroupList = res.data.list.map(item=>{
230
- item['material_cover_url'] = this.getImageFullPath(item.material_cover,'size8');
231
- item['value'] = item.id + '';
232
- item['label'] = item.material_name;
233
- if(item.id === Number(this.material_id)) activeItem = item;
234
- return item
235
- });
236
-
237
- //设置当前选中
238
- if(activeItem){
239
- this.handleChange(activeItem, true);
240
- this.firstLoading = true;
241
- }
242
- else this.firstLoading = true;
328
+ this.handleInitLeftData(res.data.list, this.material_id);
243
329
  }).catch();
244
330
  },
331
+ handlePublish(){
332
+ if(this.checkIsPublish(this.materialCoverConfig,this.materialDetailConfig)) return;
333
+ let cover = this.materialCoverConfig.material_image && this.materialCoverConfig.material_image.url;
334
+ let params = {
335
+ material_id: Number(this.active_material_id),
336
+ item: {
337
+ material_cover: cover,
338
+ material_cover_config:JSON.stringify(this.materialCoverConfig),
339
+ material_detail_config:JSON.stringify(this.materialDetailConfig),
340
+ },
341
+ }
342
+ let loading = Loading.service({});
343
+ this.setGreetingCardBaseConfig(params)
344
+ .then(res=>{
345
+ this.$message({message:'操作成功!',type:"success"});
346
+ loading.close()
347
+ })
348
+ .catch(err=>{
349
+ loading.close()
350
+ })
351
+ },
245
352
  // #endif
246
353
 
247
354
  // #ifdef saas-admin
248
- initDataCardSaasAdmin(){
249
- console.log('initDataCardSaasAdmin')
355
+ async initDataCardSaasAdmin(){
356
+ if(this.custom_x_material_id) {
357
+ let item = this.custom_x_material_item = await this.getCustomMaterialList(this.custom_x_material_id);
358
+ item['material_info']['isSelected'] = true;
359
+ //设置当前选中原始模版数据
360
+ this.custom_active_item = [item['material_info']];
361
+ this.custom_group_id = (item['material_info'].group_id || item.group_id) + '';
362
+ this.custom_active_material_id = item.material_id;
363
+ }
364
+
365
+ //初始化组
366
+ let group = await this.getGreetingGroupList();
367
+ let list = await this.getGreetingMaterialList([], this.custom_group_id);
368
+ this.search_group_list = group;
369
+
370
+ //有自定义数据初始化
371
+ if(this.custom_x_material_id) {
372
+ this.handleInitLeftData(list, this.custom_active_material_id);
373
+ }
374
+ //无自定义数据初始化
375
+ else this.handleInitLeftData(list);
376
+
377
+ this.is_search_show = true;
378
+ this.firstLoading = true
379
+
380
+ },
381
+ getCustomMaterialList(x_material_id){
382
+ return new Promise((resolve, reject)=>{
383
+ this.getCustomMaterialInfo({x_material_id})
384
+ .then(res=>{
385
+ resolve(res.data)
386
+ })
387
+ .catch(err=>{
388
+ resolve({})
389
+ })
390
+ })
391
+ },
392
+ getGreetingGroupList(){
393
+ return new Promise((resolve, reject)=>{
394
+ this.getGreetingCardGroupList()
395
+ .then(res=>{
396
+ let data = res.data.list.map(item=>{
397
+ return { ...item, value: item.value + ''}
398
+ });
399
+ if(!this.custom_group_id) this.custom_group_id = data[0].value;
400
+ resolve(data);
401
+ })
402
+ .catch(err=>{
403
+ resolve([])
404
+ });
405
+ })
406
+ },
407
+ getGreetingMaterialList(ids=[],group_id){
408
+ return new Promise((resolve,reject)=>{
409
+ let params = {
410
+ filters: {
411
+ group_id:Number(group_id),
412
+ material_ids: ids || [],
413
+ material_status:'Y',
414
+ },
415
+ page_size: 50,
416
+ page_token: '1'
417
+ }
418
+ if(this.search_group_name) params.filters.material_name = this.search_group_name;
419
+ this.getGreetingCardList(params)
420
+ .then(res=>{
421
+ if(this.custom_active_item) {
422
+ res.data.list = this.custom_active_item.concat(res.data.list.filter(item=>{
423
+ return item.id !== this.custom_active_material_id
424
+ }))
425
+ }
426
+ resolve(res.data.list);
427
+ })
428
+ .catch(er=>{
429
+ resolve([])
430
+ })
431
+ })
432
+ },
433
+ handleCommand(group_id){
434
+ if(this.custom_group_id === group_id) return
435
+ this.custom_group_id = group_id;
436
+ this.handleSearch();
437
+ },
438
+ async handleSearch(){
439
+ this.active = '';
440
+ this.materialDataTimer = null;
441
+ this.materialData = { cover:{}, detail:{}}
442
+
443
+
444
+ //清除面板编辑信息
445
+ this.handleChangeClear();
446
+ let list = await this.getGreetingMaterialList([],this.custom_group_id);
447
+
448
+ //this.handleInitLeftData(list, );
449
+ //有自定义数据初始化
450
+ if(this.custom_x_material_id) {
451
+ this.handleInitLeftData(list, this.custom_active_material_id);
452
+ }
453
+ //无自定义数据初始化
454
+ else this.handleInitLeftData(list);
455
+ },
456
+ handleCustomPublish(){
457
+ if(this.checkIsPublish(this.materialCoverConfig,this.materialDetailConfig)) return;
458
+ let fn = 'createCustomMaterial';
459
+ let params = {
460
+ item: {
461
+ group_id: Number(this.custom_group_id),
462
+ material_id: this.active_material_id,
463
+ material_cover_config:JSON.stringify(this.materialCoverConfig),
464
+ material_detail_config:JSON.stringify(this.materialDetailConfig),
465
+ },
466
+ }
467
+ if(this.custom_x_material_id){
468
+ params['x_material_id'] = this.custom_x_material_id;
469
+ fn = 'updateCustomMaterial';
470
+ }
471
+ let loading = Loading.service({});
472
+ this[fn](params)
473
+ .then(res=>{
474
+ debugger
475
+ this.$message({message:'操作成功!',type:"success"});
476
+ loading.close()
477
+ })
478
+ .catch(err=>{
479
+ loading.close()
480
+ })
250
481
  },
251
482
  // #endif
252
483
 
253
- handlePublish(){},
484
+ //==切换贺卡=====
254
485
  handleChangeClear(){
255
486
  this.materialCoverConfig = {};
256
487
  this.materialDetailConfig = {};
@@ -262,17 +493,17 @@ export default {
262
493
  this.material_cover = '';
263
494
  },
264
495
 
265
- //点击左侧贺卡初始化贺卡功能方法
266
496
  handleChange(item, init = false){
267
497
  if(item.value === this.active) return;
268
- if(init) {
498
+ if(init || this.active === '') {
499
+ debugger
269
500
  this.handleChangeClear();
270
501
  this.activeItem = this.$xdHelper.cloneDeep(item);
271
502
  this.active = item.value;
272
503
  this.setConfigPage(item);
273
504
  return;
274
505
  }
275
- this.$confirm('您确定要切换贺卡模版吗?', '提示', {
506
+ this.$confirm('切换贺卡模版时,未保存数据可能会丢失,您确定要切换贺卡模版吗?', '温馨提示', {
276
507
  confirmButtonText: '确定',
277
508
  cancelButtonText: '取消',
278
509
  type: 'warning'
@@ -283,7 +514,9 @@ export default {
283
514
  this.setConfigPage(item);
284
515
  }).catch(err=>{})
285
516
  },
517
+ //==切换贺卡=====
286
518
 
519
+ //==tools====
287
520
  toJson(item,key){
288
521
  let defaultValue = this.$xdHelper.cloneDeep(this.materialCoverDefault[key]);
289
522
  if(this.material_cover){
@@ -292,7 +525,14 @@ export default {
292
525
  try{
293
526
  if(typeof item === 'string') {
294
527
  if(item === '') return defaultValue
295
- return JSON.parse(item)
528
+ else {
529
+ let data = JSON.parse(item);
530
+ if(this.material_cover && key === 'material_cover_config'){
531
+ data.material_image = {url: this.material_cover};
532
+ }
533
+ return data
534
+ }
535
+
296
536
  }else {
297
537
  return defaultValue
298
538
  }
@@ -302,20 +542,43 @@ export default {
302
542
  },
303
543
 
304
544
  setConfigPage(item){
545
+ this.active_material_id = item.id;
305
546
  this.material_cover = item['material_cover'];
547
+
548
+ // #ifdef admin
549
+ this.$set(this.materialCoverDefault,'material_cover_config',JSON.parse(item['default_material_cover_config']));
550
+ this.$set(this.materialCoverDefault,'material_detail_config',JSON.parse(item['default_material_detail_config']));
306
551
  this.materialCoverConfig = this.toJson(item['material_cover_config'],'material_cover_config');
307
552
  this.materialDetailConfig = this.toJson(item['material_detail_config'],'material_detail_config');
308
- //this.$set(this.materialCoverDefault,'material_cover_config',JSON.parse(item['default_material_cover_config']));
309
- //this.$set(this.materialCoverDefault,'material_detail_config',JSON.parse(item['default_material_detail_config']));
553
+ // #endif
554
+
555
+ // #ifdef saas-admin
556
+ //封面数据
557
+ if(this.custom_x_material_item['material_cover_config']
558
+ && item.id === this.custom_x_material_item['material_id']
559
+ ) {
560
+ this.materialCoverConfig = JSON.parse(this.custom_x_material_item['material_cover_config']);
561
+ }
562
+ else this.materialCoverConfig = this.toJson(item['material_cover_config'],'material_cover_config');
563
+
564
+ //详情
565
+ if(this.custom_x_material_item['material_detail_config']
566
+ && item.id === this.custom_x_material_item['material_id']
567
+ ) {
568
+ this.materialDetailConfig = JSON.parse(this.custom_x_material_item['material_detail_config']);
569
+ }
570
+ else this.materialDetailConfig = this.toJson(item['material_detail_config'],'material_detail_config');
571
+ // #endif
572
+
310
573
  Object.keys(this.materialCoverMap).map(key=>{
311
574
  this.setMaterialData(this[this.materialCoverKey[key]],key);
312
575
  })
313
576
  },
314
577
 
315
-
316
578
  setMaterialConfig(item){
317
579
  this[this.materialCoverKey[this.mainActive]] = item;
318
580
  },
581
+ //==tools====
319
582
 
320
583
  //== right form ===============
321
584
  clearEditCard(){
@@ -568,18 +831,19 @@ export default {
568
831
  }
569
832
 
570
833
  &__content {
571
- & > div {
834
+ width: 100%;
835
+ &-item {
572
836
  width: 280px;
573
837
  padding: 5px;
574
838
  box-sizing: border-box;
575
839
  border-radius: 5px;
576
- border: 1px solid #eee;
840
+ border: 3px solid #eee;
577
841
  margin-bottom: 10px;
578
842
  cursor: pointer;
579
843
 
580
844
  &.active {
581
- border: 1px solid rgba(88, 135, 247, 0.5);
582
- background: rgba(88, 135, 247, 0.15);
845
+ border: 3px dashed rgba(28, 88, 229, 0.6);
846
+ background: rgba(47, 100, 229, 0.15);
583
847
 
584
848
  & > *:first-child {
585
849
  background: rgba(88, 135, 247, 0.05);
@@ -610,6 +874,29 @@ export default {
610
874
  }
611
875
  }
612
876
  }
877
+ &-title {
878
+ font-size: 14px;
879
+ font-weight: 500;
880
+ background: #f8f8f8;
881
+ color: #999;
882
+ border-radius: 4px;
883
+ line-height: 40px;
884
+ margin-bottom: 10px;
885
+ padding: 0 10px;
886
+ width: 100%;
887
+
888
+ & > span {
889
+ color: red;
890
+ }
891
+ }
892
+ }
893
+
894
+ .nodata {
895
+ height: 100px;
896
+ font-size: 14px;
897
+ color: #bbb;
898
+ line-height: 100px;
899
+ text-align: center;
613
900
  }
614
901
 
615
902
  }
@@ -632,7 +919,7 @@ export default {
632
919
  position: relative;
633
920
 
634
921
  .iphone-top {
635
- background: rgba(0,0,0,.8);
922
+ background: rgba(255,0,0,.8);
636
923
  position: absolute;
637
924
  top: 62px;
638
925
  left: 14px;
@@ -751,3 +1038,13 @@ export default {
751
1038
 
752
1039
 
753
1040
  </style>
1041
+ <style lang="scss">
1042
+ .g-active {
1043
+ padding: 0 15px 0 10px!important;
1044
+ color:$blue;
1045
+ }
1046
+ .g-no-active {
1047
+ margin-left: 18px;
1048
+ padding: 0 15px 0 10px!important;;
1049
+ }
1050
+ </style>
@@ -429,8 +429,9 @@ export default {
429
429
 
430
430
  handleCardSubmit(){
431
431
  let form = this.$refs['formCard'];
432
- form.submit()
432
+ form.submitAll()
433
433
  .then(res=>{
434
+ debugger
434
435
  let loading = Loading.service({})
435
436
  let item = this.$xdHelper.cloneDeep(form.getAllFormData());
436
437
  if(item['group_name']) delete item['group_name'];
@@ -9,7 +9,7 @@ module.exports = {
9
9
  mapFn: 'getAsyncList',
10
10
  isRule: false,
11
11
  title: '获取任务列表',
12
- // #ifdef admin partner partner-stat oa-finance supplier
12
+ // #ifdef admin partner partner-stat oa-finance supplier saas-admin saas-admin partner-saas
13
13
  path: '/@@@@/v1/async/list',
14
14
  // #endif
15
15
  //#ifdef partner-gift partner-mall partner-movie partner-market
@@ -33,7 +33,7 @@ module.exports = {
33
33
  mapFn: 'asyncRetry',
34
34
  isRule: false,
35
35
  title: '任务query',
36
- // #ifdef admin partner partner-stat oa-finance supplier
36
+ // #ifdef admin partner partner-stat oa-finance supplier saas-admin partner-saas
37
37
  path: '/@@@@/v1/async/retry',
38
38
  // #endif
39
39
  // #ifdef partner-gift partner-mall partner-movie partner-market
@@ -26,46 +26,7 @@ const accountsRouter = {
26
26
  // role.account.accountList
27
27
  // ]
28
28
  }
29
- },
30
- {
31
- path: "detail/:id",
32
- name: "partnerAccountDetail",
33
- component: () => import("@/viewsAccounts/detail"),
34
- hidden: true,
35
- meta: {
36
- title: "账号信息",
37
- activeMenu: "/accounts/list",
38
- // roles: [
39
- // role.account.getUserDetail
40
- // ]
41
- }
42
- },
43
- {
44
- path: "edit/:id",
45
- name: "partnerAccountUpdate",
46
- component: () => import("@/viewsAccounts/create"),
47
- hidden: true,
48
- meta: {
49
- title: "编辑账号",
50
- activeMenu: "/accounts/list",
51
- // roles: [
52
- // role.account.updateUser
53
- // ]
54
- }
55
- },
56
- {
57
- path: "create",
58
- name: "partnerAccountCreate",
59
- component: () => import("@/viewsAccounts/create"),
60
- hidden: true,
61
- meta: {
62
- title: "新增账号",
63
- activeMenu: "/accounts/list",
64
- // roles: [
65
- // role.account.addUser
66
- // ]
67
- }
68
- },
29
+ }
69
30
  ]
70
31
  }
71
32
 
@@ -7,7 +7,6 @@ module.exports = {
7
7
  {
8
8
  title: '管理员 - 获取客户列表',
9
9
  mapFn: "getSassCompanyList",
10
- isPublic: true,
11
10
  path: '/saas-partner/v1/company/like-options',
12
11
  isRule: false,
13
12
  params: {
@@ -20,8 +19,7 @@ module.exports = {
20
19
  {
21
20
  title: '管理员 - 角色列表',
22
21
  mapFn: "getSaasRolesList",
23
- isPublic: true,
24
- path: '/idaas-partner/v1/roles/options',
22
+ path: '/saas-partner/v1/roles/options',
25
23
  isRule: false,
26
24
  params: {
27
25
  query_pool_id: ['用户池', 'String', '必填','jfb-saas'],
@@ -53,7 +51,7 @@ module.exports = {
53
51
  {
54
52
  title: '管理员 - 获取单个',
55
53
  mapFn: "getSaasUserById",
56
- path: '/saas-partner/v1/users/:user_id',
54
+ path: '/@@@@/v1/users/:user_id',
57
55
  isRule: false,
58
56
  params: {
59
57
  user_id: ['id', 'String', '必填'],
@@ -190,8 +190,10 @@ export default {
190
190
  let params ={
191
191
  user: {
192
192
  ...form,
193
+ // #ifdef partner-saas
193
194
  company_id: company[0].value,
194
195
  company_name: company[0].label,
196
+ // #endif
195
197
  }
196
198
  }
197
199
  let loading = Loading.service({});
@@ -200,7 +202,6 @@ export default {
200
202
  params['user_id'] = this.user_id
201
203
  fn = 'updateSaasUser';
202
204
  }
203
- debugger
204
205
  this[fn](params)
205
206
  .then(res=>{
206
207
  loading.close();
@@ -231,6 +232,7 @@ export default {
231
232
  { required: true, message: "站点名称不能为空", trigger:'blur'}
232
233
  ]
233
234
  },
235
+ // #ifdef partner-saas
234
236
  {
235
237
  label: "客户名称",
236
238
  ele: 'xd-remote-select',
@@ -252,6 +254,7 @@ export default {
252
254
  { required: true, message: "请选择客户名称",trigger: ['change']}
253
255
  ]
254
256
  },
257
+ // #endif
255
258
  {
256
259
  label: "管理员账号:",
257
260
  ele: "el-input",
@@ -354,7 +357,9 @@ export default {
354
357
  username: row.username,
355
358
  role_ids: row.role_ids,
356
359
  status: row.status,
360
+ // #ifdef partner-saas
357
361
  company:[{label: row.company_name, value: row.company_id}]
362
+ // #endif
358
363
  };
359
364
  this.initForm(info);
360
365
  this.dialog = true;
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "jufubao-admin-library",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "聚福宝福利后台管理系统公共模块",
5
5
  "author": "goashiyong <gaoshiyong1272@vip.163.com>",
6
6
  "scripts": {
7
7
  "serve": "cross-env type=test cover=true service=serve npm run entry bus",
8
+ "serve.saas": "cross-env type=test cover=true service=serve npm run entry bus saas",
9
+ "serve.supplier": "cross-env type=test cover=true service=serve npm run entry bus supplier",
8
10
  "serve.domain": "cross-env type=test cover=true service=serve domain=http://sandbox-editx.jufubao.cn npm run entry bus",
9
11
  "dev": "cross-env type=dev cover=true service=build npm run entry bus",
10
12
  "test": "cross-env type=test cover=true service=build npm run entry bus",
@@ -27,7 +29,7 @@
27
29
  "element-ui": "2.13.2",
28
30
  "gxd-file-preview": "1.2.1",
29
31
  "gxd-helper": "2.0.21",
30
- "gxd-vue-library": "1.1.93",
32
+ "gxd-vue-library": "1.1.96",
31
33
  "js-base64": "^3.4.5",
32
34
  "js-cookie": "2.2.0",
33
35
  "md5": "^2.3.0",