2018-02-22 12:15:24 +00:00
|
|
|
import { url } from '../../config';
|
2018-02-18 03:35:18 +00:00
|
|
|
import MkChooseFileFromDriveWindow from '../views/components/choose-file-from-drive-window.vue';
|
|
|
|
|
|
|
|
export default function(opts) {
|
|
|
|
return new Promise((res, rej) => {
|
|
|
|
const o = opts || {};
|
2018-02-22 12:15:24 +00:00
|
|
|
|
|
|
|
if (document.body.clientWidth > 800) {
|
|
|
|
const w = new MkChooseFileFromDriveWindow({
|
|
|
|
propsData: {
|
|
|
|
title: o.title,
|
|
|
|
multiple: o.multiple,
|
|
|
|
initFolder: o.currentFolder
|
|
|
|
}
|
|
|
|
}).$mount();
|
|
|
|
w.$once('selected', file => {
|
|
|
|
res(file);
|
|
|
|
});
|
|
|
|
document.body.appendChild(w.$el);
|
|
|
|
} else {
|
|
|
|
window['cb'] = file => {
|
|
|
|
res(file);
|
|
|
|
};
|
|
|
|
|
|
|
|
window.open(url + '/selectdrive',
|
2018-03-03 07:39:53 +00:00
|
|
|
'choose_drive_window',
|
2018-02-22 12:15:24 +00:00
|
|
|
'height=500, width=800');
|
|
|
|
}
|
2018-02-18 03:35:18 +00:00
|
|
|
});
|
|
|
|
}
|