File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export class LodopService implements OnDestroy {
21
21
22
22
constructor ( configSrv : AlainConfigService ) {
23
23
this . defaultConfig = configSrv . merge ( 'lodop' , {
24
- url : '//localhost:8443/CLodopfuncs.js' ,
24
+ url : 'http: //localhost:8443/CLodopfuncs.js' ,
25
25
name : 'CLODOP' ,
26
26
companyName : '' ,
27
27
checkMaxCount : 100
@@ -88,8 +88,10 @@ export class LodopService implements OnDestroy {
88
88
89
89
private request ( ) : void {
90
90
this . pending = true ;
91
+ const urlObj = new URL ( this . cog . url ! ) ;
92
+ urlObj . searchParams . set ( 'name' , this . cog . name ! ) ;
93
+ const url = urlObj . toString ( ) ;
91
94
92
- const url = `${ this . cog . url } ?name=${ this . cog . name } ` ;
93
95
let checkMaxCount = this . cog . checkMaxCount as number ;
94
96
const onResolve = ( status : NzSafeAny , error ?: NzSafeAny ) : void => {
95
97
this . _init . next ( {
Original file line number Diff line number Diff line change @@ -163,6 +163,16 @@ describe('abc: lodop', () => {
163
163
} ) ;
164
164
srv . reset ( ) ;
165
165
} ) ;
166
+ it ( 'should be custom url' , ( ) => {
167
+ const url = 'http://a.com/lodop.js?aa=1' ;
168
+ cog . lodop ! . url = url ;
169
+ genModule ( ) ;
170
+ const scriptSrv = ( srv as NzSafeAny ) . scriptSrv ;
171
+ spyOn ( scriptSrv , 'loadScript' ) . and . callFake ( ( ) => Promise . resolve ( { status : 'ok' } ) ) ;
172
+ srv . reset ( ) ;
173
+ expect ( scriptSrv . loadScript ) . toHaveBeenCalled ( ) ;
174
+ expect ( scriptSrv . loadScript . calls . first ( ) . args [ 0 ] ) . toBe ( `${ url } &name=LODOP` ) ;
175
+ } ) ;
166
176
} ) ;
167
177
168
178
describe ( '#attachCode' , ( ) => {
Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ export interface AlainLodopConfig {
18
18
/**
19
19
* Lodop 远程脚本URL地址,**注意**务必使用 `name` 属性指定变量值
20
20
*
21
- * - http://localhost:18000/CLodopfuncs.js
22
- * - https://localhost:8443/CLodopfuncs.js [默认]
21
+ * - http://localhost:18000/CLodopfuncs.js [默认]
22
+ * - https://localhost:8443/CLodopfuncs.js
23
23
*/
24
24
url ?: string ;
25
25
/**
You can’t perform that action at this time.
0 commit comments