@steedos/service-plugin-amis 2.5.15 → 2.5.16-beta.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.
@@ -228,8 +228,9 @@
228
228
  // },
229
229
  // 如果这里不配置env.notify,那么会走amis 默认的env.notify,它会造成随机把toast组件dom插入到不同的scope容器内(应该是插入到最后一个加载的scope),这在苹果手机上可能会造成弹出的通知z-index不生效的情况,出现通知被档住的问题
230
230
  notify: (type, msg)=>{
231
- if(msg.props && msg.props.schema.tpl){
232
- SteedosUI.message[type](msg.props?.schema.tpl)
231
+ var tpl = msg.props && msg.props.schema.tpl;
232
+ if(tpl){
233
+ SteedosUI.message[type](tpl)
233
234
  }else if(typeof msg == 'string'){
234
235
  SteedosUI.message[type](msg)
235
236
  }else{
@@ -267,6 +268,34 @@
267
268
  },
268
269
  theme: 'antd',
269
270
  isCurrentUrl: isCurrentUrl,
271
+ requestAdaptor: (config)=>{
272
+ // url是相对路径
273
+ if(config.url && (!/^http[s]?:\/\//i.test(config.url))){
274
+ if(Meteor.isCordova){
275
+ config.url = Meteor.absoluteUrl(config.url)
276
+ }
277
+
278
+ if(!config.headers){
279
+ config.headers = {}
280
+ }
281
+
282
+ if(!config.headers.Authorization && Builder.settings.context && Builder.settings.context.tenantId && Builder.settings.context.authToken){
283
+ config.headers.Authorization = `Bearer ${Builder.settings.context.tenantId},${Builder.settings.context.authToken}`;
284
+ }
285
+ }else if(config.url && Meteor.isCordova && Builder.settings.context && Builder.settings.context.rootUrl && config.url.startsWith(Builder.settings.context.rootUrl)){
286
+ // 是绝对路径,且是cordova环境, 且以root url开头, 则自动处理认证
287
+ if(Meteor.isCordova){
288
+ if(!config.headers){
289
+ config.headers = {}
290
+ }
291
+
292
+ if(!config.headers.Authorization && Builder.settings.context && Builder.settings.context.tenantId && Builder.settings.context.authToken){
293
+ config.headers.Authorization = `Bearer ${Builder.settings.context.tenantId},${Builder.settings.context.authToken}`;
294
+ }
295
+ }
296
+ }
297
+ return config;
298
+ }
270
299
  };
271
300
  // 已弃用
272
301
  const AmisRender = function (props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.5.15",
3
+ "version": "2.5.16-beta.2",
4
4
  "main": "package.service.js",
5
5
  "scripts": {
6
6
  "build": "yarn build:tailwind-base && yarn build:tailwind",
@@ -13,7 +13,7 @@
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
16
- "gitHead": "dd588460d9a446d76c1d065c342594e9bec1f14d",
16
+ "gitHead": "f8b3f647c00f580f9a10547a4a8afec0398bcbe2",
17
17
  "devDependencies": {
18
18
  "tailwindcss": "3.2.4"
19
19
  }