mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-23 07:00:09 +00:00
commit
8674e5f973
BIN
demos/1.jpg
BIN
demos/1.jpg
Binary file not shown.
Before Width: | Height: | Size: 258 KiB |
BIN
demos/2.jpg
BIN
demos/2.jpg
Binary file not shown.
Before Width: | Height: | Size: 127 KiB |
BIN
demos/3.jpg
BIN
demos/3.jpg
Binary file not shown.
Before Width: | Height: | Size: 131 KiB |
BIN
demos/4.jpg
BIN
demos/4.jpg
Binary file not shown.
Before Width: | Height: | Size: 127 KiB |
BIN
demos/5.jpg
BIN
demos/5.jpg
Binary file not shown.
Before Width: | Height: | Size: 140 KiB |
BIN
demos/6.jpg
BIN
demos/6.jpg
Binary file not shown.
Before Width: | Height: | Size: 135 KiB |
@ -19,35 +19,14 @@
|
||||
|
||||
import prompt from '@system.prompt';
|
||||
|
||||
// 新建相册命名随机数
|
||||
const GET_RANDOM_NAME = 5;
|
||||
// input输入框长度
|
||||
const NAME_LENGTH = 51;
|
||||
|
||||
export default {
|
||||
data: {
|
||||
inputName: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* 新建相册名
|
||||
*/
|
||||
onReady() {
|
||||
let str = 'abcdefghijklmnopqrstuvwxyz';
|
||||
for (let i = 0; i < GET_RANDOM_NAME; i++) {
|
||||
this.inputName += str[this.getRandomInt(0, GET_RANDOM_NAME)];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 随机获取新建相册名
|
||||
*
|
||||
* @param {number} min - 随机最小数
|
||||
* @param {number} max - 随机最大数
|
||||
* @return {number} - 随机数
|
||||
*/
|
||||
getRandomInt(min, max) {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
},
|
||||
|
||||
/**
|
||||
* 弹框显示
|
||||
*/
|
||||
@ -68,7 +47,11 @@ export default {
|
||||
* @param {string} value - 相册名
|
||||
*/
|
||||
valueChange(value) {
|
||||
this.inputName = value.value;
|
||||
if (value.value.length < NAME_LENGTH) {
|
||||
this.inputName = value.value;
|
||||
} else {
|
||||
this.inputName = value.value.substring(0, NAME_LENGTH);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -102,6 +85,9 @@ export default {
|
||||
return false;
|
||||
}
|
||||
this.$emit('createDialogAlbum', this.inputName);
|
||||
setTimeout(() => {
|
||||
this.inputName = '';
|
||||
}, NAME_LENGTH);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -109,5 +95,8 @@ export default {
|
||||
*/
|
||||
cancel() {
|
||||
this.close();
|
||||
setTimeout(() => {
|
||||
this.inputName = '';
|
||||
}, NAME_LENGTH);
|
||||
}
|
||||
};
|
||||
|
@ -18,7 +18,8 @@
|
||||
<dialog id="renameDialog" class="rename-dialog-main" oncancel="cancelDialog">
|
||||
<div class="dialog-div">
|
||||
<text class="title">{{ $t('strings.rename') }}</text>
|
||||
<input class="input" type="text" value="{{ inputName }}" placeholder="{{ $t('strings.inputPlaceholder') }}">
|
||||
<input class="input" type="text" value="{{ inputName }}" maxlength="50"
|
||||
placeholder="{{ $t('strings.inputPlaceholder') }}" @change="valueChange">
|
||||
</input>
|
||||
<div class="bottom-div">
|
||||
<text onclick="cancel" class="btn-txt">{{ $t('strings.cancel') }}</text>
|
||||
|
@ -54,6 +54,15 @@ export default {
|
||||
return this.inputName;
|
||||
},
|
||||
|
||||
/**
|
||||
* 输入框改变事件
|
||||
*
|
||||
* @param {Object} e - 事件对象
|
||||
*/
|
||||
valueChange(e) {
|
||||
this.inputName = e.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* 重命名确定
|
||||
*/
|
||||
|
@ -67,7 +67,7 @@
|
||||
</stack>
|
||||
</div>
|
||||
</swiper>
|
||||
<div class="scale-div" show="{{ showScale }}">
|
||||
<div class="scale-div" if="{{ showScale }}">
|
||||
<div class="scale-top" on:click="leftScale">
|
||||
<image class="scale-image" if="{{ ! isScaleAddDisable }}" src="/common/image/svg/scaleadd.svg"></image>
|
||||
<image class="scale-image" else style="opacity : 0.5;" src="/common/image/svg/scaleadd.svg"></image>
|
||||
|
@ -588,13 +588,15 @@ export default {
|
||||
if (item.detail.id === MOVE_ID) {
|
||||
let arrData = self.currentItem.name.split('.');
|
||||
let firstName = arrData[0];
|
||||
let lastName = arrData[1];
|
||||
self.lastName = arrData[1];
|
||||
if (self.currentItem.mediaType === PHOTO_TYPE) {
|
||||
self.inputName = firstName + Math.round(Math.random() * RANDOM_NAME) + '.' + lastName;
|
||||
self.inputName = firstName;
|
||||
} else if (self.currentItem.mediaType === VIDEO_TYPE) {
|
||||
self.inputName = lastName + Math.round(Math.random() * RANDOM_NAME) + '.' + lastName;
|
||||
self.inputName = firstName;
|
||||
}
|
||||
self.$element('rename_dialog').show();
|
||||
setTimeout(() => {
|
||||
self.$element('rename_dialog').show();
|
||||
}, POP_TIME);
|
||||
} else if (item.detail.id === COPY_ID) {
|
||||
self.currentItem.scale = 1;
|
||||
self.isScaleAddDisable = false;
|
||||
|
Loading…
Reference in New Issue
Block a user