wip
This commit is contained in:
parent
edeeca8b5f
commit
0397a5046d
|
@ -71,8 +71,6 @@ const ok = async () => {
|
|||
});
|
||||
});
|
||||
|
||||
os.promiseDialog(promise);
|
||||
|
||||
const f = await promise;
|
||||
|
||||
emit('ok', f);
|
||||
|
|
|
@ -67,8 +67,8 @@ watch(description, () => {
|
|||
});
|
||||
});
|
||||
|
||||
function setAvatar(ev) {
|
||||
os.chooseFileFromPc({ multiple: false }).then(async (files) => {
|
||||
async function setAvatar(ev) {
|
||||
const files = await os.chooseFileFromPc({ multiple: false });
|
||||
const file = files[0];
|
||||
|
||||
let originalOrCropped = file;
|
||||
|
@ -93,7 +93,6 @@ function setAvatar(ev) {
|
|||
});
|
||||
$i.avatarId = i.avatarId;
|
||||
$i.avatarUrl = i.avatarUrl;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -257,33 +257,25 @@ function save() {
|
|||
}
|
||||
|
||||
function changeAvatar(ev) {
|
||||
selectFile(ev.currentTarget ?? ev.target, i18n.ts.avatar).then(async (file) => {
|
||||
let originalOrCropped = file;
|
||||
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'question',
|
||||
text: i18n.ts.cropImageAsk,
|
||||
okText: i18n.ts.cropYes,
|
||||
cancelText: i18n.ts.cropNo,
|
||||
});
|
||||
|
||||
if (!canceled) {
|
||||
originalOrCropped = await os.createCroppedImageDriveFileFromImageDriveFile(file, {
|
||||
aspectRatio: 1,
|
||||
});
|
||||
}
|
||||
|
||||
async function done(driveFile) {
|
||||
const i = await os.apiWithDialog('i/update', {
|
||||
avatarId: originalOrCropped.id,
|
||||
avatarId: driveFile.id,
|
||||
});
|
||||
$i.avatarId = i.avatarId;
|
||||
$i.avatarUrl = i.avatarUrl;
|
||||
claimAchievement('profileFilled');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
os.popupMenu([{
|
||||
text: i18n.ts.avatar,
|
||||
type: 'label',
|
||||
}, {
|
||||
text: i18n.ts.upload,
|
||||
icon: 'ti ti-upload',
|
||||
action: async () => {
|
||||
const files = await os.chooseFileFromPc({ multiple: false });
|
||||
const file = files[0];
|
||||
|
||||
function changeBanner(ev) {
|
||||
selectFile(ev.currentTarget ?? ev.target, i18n.ts.banner).then(async (file) => {
|
||||
let originalOrCropped = file;
|
||||
|
||||
const { canceled } = await os.confirm({
|
||||
|
@ -294,17 +286,71 @@ function changeBanner(ev) {
|
|||
});
|
||||
|
||||
if (!canceled) {
|
||||
originalOrCropped = await os.createCroppedImageDriveFileFromImageDriveFile(file, {
|
||||
originalOrCropped = await os.cropImageFile(file, {
|
||||
aspectRatio: 1,
|
||||
});
|
||||
}
|
||||
|
||||
const driveFile = (await os.launchUploader([originalOrCropped], {}))[0];
|
||||
done(driveFile);
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.fromDrive,
|
||||
icon: 'ti ti-cloud',
|
||||
action: () => {
|
||||
os.selectDriveFile(false).then(files => {
|
||||
done(files[0]);
|
||||
});
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
function changeBanner(ev) {
|
||||
async function done(driveFile) {
|
||||
const i = await os.apiWithDialog('i/update', {
|
||||
bannerId: driveFile.id,
|
||||
});
|
||||
$i.bannerId = i.bannerId;
|
||||
$i.bannerUrl = i.bannerUrl;
|
||||
}
|
||||
|
||||
os.popupMenu([{
|
||||
text: i18n.ts.banner,
|
||||
type: 'label',
|
||||
}, {
|
||||
text: i18n.ts.upload,
|
||||
icon: 'ti ti-upload',
|
||||
action: async () => {
|
||||
const files = await os.chooseFileFromPc({ multiple: false });
|
||||
const file = files[0];
|
||||
|
||||
let originalOrCropped = file;
|
||||
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'question',
|
||||
text: i18n.ts.cropImageAsk,
|
||||
okText: i18n.ts.cropYes,
|
||||
cancelText: i18n.ts.cropNo,
|
||||
});
|
||||
|
||||
if (!canceled) {
|
||||
originalOrCropped = await os.cropImageFile(file, {
|
||||
aspectRatio: 2,
|
||||
});
|
||||
}
|
||||
|
||||
const i = await os.apiWithDialog('i/update', {
|
||||
bannerId: originalOrCropped.id,
|
||||
});
|
||||
$i.bannerId = i.bannerId;
|
||||
$i.bannerUrl = i.bannerUrl;
|
||||
const driveFile = (await os.launchUploader([originalOrCropped], {}))[0];
|
||||
done(driveFile);
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.fromDrive,
|
||||
icon: 'ti ti-cloud',
|
||||
action: () => {
|
||||
os.selectDriveFile(false).then(files => {
|
||||
done(files[0]);
|
||||
});
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
const headerActions = computed(() => []);
|
||||
|
|
Loading…
Reference in New Issue