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