数通智联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
691 B

2 years ago
'use strict';
const RequestClient = require("./RequestClient.js");
const getName = id => {
return id.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
};
class SearchProvider extends RequestClient {
constructor(uppy, opts) {
super(uppy, opts);
this.provider = opts.provider;
this.id = this.provider;
this.name = this.opts.name || getName(this.id);
this.pluginId = this.opts.pluginId;
}
fileUrl(id) {
return `${this.hostname}/search/${this.id}/get/${id}`;
}
search(text, queries) {
return this.get(`search/${this.id}/list?q=${encodeURIComponent(text)}${queries ? `&${queries}` : ''}`);
}
}
module.exports = SearchProvider;