You've already forked SmartisanNote.Remake
所有页面的语法改写为setup形式;
修改了Header组件的样式、布局; 更新了IFLOW上下文; 添加了全局样式; 添加了pinia状态管理;
This commit is contained in:
@@ -57,80 +57,72 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { folder, star, trash, document } from 'ionicons/icons';
|
||||
|
||||
export default {
|
||||
name: 'FolderItem',
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
noteCount: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
onPress: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
isSelected: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
const props = defineProps({
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
folder,
|
||||
star,
|
||||
trash,
|
||||
document,
|
||||
isPressed: false
|
||||
}
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
computed: {
|
||||
folderIcon() {
|
||||
switch (this.id) {
|
||||
case 'all':
|
||||
return this.folder;
|
||||
case 'starred':
|
||||
return this.star;
|
||||
case 'trash':
|
||||
return this.trash;
|
||||
default:
|
||||
return this.document;
|
||||
}
|
||||
},
|
||||
folderIconSrc() {
|
||||
switch (this.id) {
|
||||
case 'all':
|
||||
return '/assets/icons/drawable-xxhdpi/sidebar_folder_icon_all.png';
|
||||
case 'starred':
|
||||
return '/assets/icons/drawable-xxhdpi/sidebar_folder_icon_favorite.png';
|
||||
case 'trash':
|
||||
return '/assets/icons/drawable-xxhdpi/sidebar_folder_icon_trash.png';
|
||||
default:
|
||||
return '/assets/icons/drawable-xxhdpi/sidebar_folder_icon_document.png';
|
||||
}
|
||||
}
|
||||
noteCount: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
methods: {
|
||||
handleMouseDown() {
|
||||
this.isPressed = true;
|
||||
},
|
||||
handleMouseUp() {
|
||||
this.isPressed = false;
|
||||
},
|
||||
handleMouseLeave() {
|
||||
this.isPressed = false;
|
||||
}
|
||||
onPress: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
isSelected: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const isPressed = ref(false);
|
||||
|
||||
const folderIcon = computed(() => {
|
||||
switch (props.id) {
|
||||
case 'all':
|
||||
return folder;
|
||||
case 'starred':
|
||||
return star;
|
||||
case 'trash':
|
||||
return trash;
|
||||
default:
|
||||
return document;
|
||||
}
|
||||
});
|
||||
|
||||
const folderIconSrc = computed(() => {
|
||||
switch (props.id) {
|
||||
case 'all':
|
||||
return '/assets/icons/drawable-xxhdpi/sidebar_folder_icon_all.png';
|
||||
case 'starred':
|
||||
return '/assets/icons/drawable-xxhdpi/sidebar_folder_icon_favorite.png';
|
||||
case 'trash':
|
||||
return '/assets/icons/drawable-xxhdpi/sidebar_folder_icon_trash.png';
|
||||
default:
|
||||
return '/assets/icons/drawable-xxhdpi/sidebar_folder_icon_document.png';
|
||||
}
|
||||
});
|
||||
|
||||
const handleMouseDown = () => {
|
||||
isPressed.value = true;
|
||||
};
|
||||
|
||||
const handleMouseUp = () => {
|
||||
isPressed.value = false;
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
isPressed.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,313 +1,186 @@
|
||||
<template>
|
||||
<div class="header-container">
|
||||
<!-- 左侧区域 -->
|
||||
<div class="header-left-area">
|
||||
<!-- 左侧图标 -->
|
||||
<div
|
||||
v-if="onBack"
|
||||
@click="onBack"
|
||||
class="header-icon-button"
|
||||
>
|
||||
<img
|
||||
src="/assets/icons/drawable-xxhdpi/btn_back.png"
|
||||
class="header-icon"
|
||||
alt="back"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="leftIcon === 'back' && leftIconSource && onLeftAction"
|
||||
@click="onLeftAction"
|
||||
class="header-icon-button"
|
||||
>
|
||||
<img
|
||||
:src="leftIconSource"
|
||||
class="header-icon"
|
||||
alt="left icon"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="leftIcon === 'settings'"
|
||||
@click="onLeftAction"
|
||||
class="header-icon-button"
|
||||
>
|
||||
<img
|
||||
:src="leftIconSource"
|
||||
class="header-icon"
|
||||
alt="settings"
|
||||
/>
|
||||
</div>
|
||||
<div class="code-fun-flex-row code-fun-items-center component">
|
||||
<!-- 左侧图标 -->
|
||||
<img v-if="leftType == 'settings'" class="left-icon" src="/assets/icons/drawable-xxhdpi/btn_settings.png" @click="handleLeftAction" />
|
||||
<img v-else class="left-icon" src="/assets/icons/drawable-xxhdpi/btn_back.png" @click="handleLeftAction" />
|
||||
|
||||
<!-- 标题区域 -->
|
||||
<div class="title-container" @click="handleTitlePress" v-if="leftType == 'settings'">
|
||||
<span class="text">{{ title }}</span>
|
||||
<!-- 文件夹展开图标 -->
|
||||
<img class="folder-icon" :src="folderExpanded ? '/assets/icons/drawable-xxhdpi/folder_title_arrow_pressed.png' : '/assets/icons/drawable-xxhdpi/folder_title_arrow_normal.png'" @click.stop="handleFolderToggle" />
|
||||
</div>
|
||||
|
||||
<!-- 中间标题区域 -->
|
||||
<div
|
||||
@click="onTitlePress"
|
||||
class="header-title-container"
|
||||
>
|
||||
<span class="header-title">
|
||||
{{ title }}
|
||||
</span>
|
||||
<!-- 文件夹切换按钮 (在标题区域内) -->
|
||||
<div
|
||||
v-if="leftIcon === 'settings'"
|
||||
@click.stop="handleFolderToggle"
|
||||
class="folder-toggle-button"
|
||||
>
|
||||
<img
|
||||
:src="folderExpanded ? '/assets/icons/drawable-xxhdpi/folder_title_arrow_pressed.png' : '/assets/icons/drawable-xxhdpi/folder_title_arrow_normal.png'"
|
||||
class="folder-toggle-icon"
|
||||
alt="folder toggle"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 右侧区域 -->
|
||||
<div class="header-right-area">
|
||||
<div
|
||||
v-if="onAction"
|
||||
@click="onAction"
|
||||
class="header-icon-button"
|
||||
>
|
||||
<img
|
||||
v-if="actionIconSource"
|
||||
:src="actionIconSource"
|
||||
class="header-icon"
|
||||
alt="action"
|
||||
/>
|
||||
<span
|
||||
v-else
|
||||
class="header-action-text"
|
||||
>
|
||||
{{ actionText }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="title-container" v-else>
|
||||
<span class="text">{{ title }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 右侧操作按钮 -->
|
||||
<img v-if="actionIcon === 'create'" class="image_4" src="/assets/icons/drawable-xxhdpi/btn_create.png" @click="handleAction" />
|
||||
<i class="image_4" v-else></i>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Header',
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
onBack: {
|
||||
type: Function,
|
||||
default: null
|
||||
},
|
||||
onAction: {
|
||||
type: Function,
|
||||
default: null
|
||||
},
|
||||
actionText: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
actionIcon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
leftIcon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
onLeftAction: {
|
||||
type: Function,
|
||||
default: null
|
||||
},
|
||||
onFolderToggle: {
|
||||
type: Function,
|
||||
default: null
|
||||
},
|
||||
isFolderExpanded: {
|
||||
type: Boolean,
|
||||
default: undefined
|
||||
},
|
||||
onTitlePress: {
|
||||
type: Function,
|
||||
default: null
|
||||
}
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localFolderExpanded: false
|
||||
}
|
||||
onBack: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
computed: {
|
||||
folderExpanded() {
|
||||
// 优先使用父组件传递的isFolderExpanded状态,否则使用本地状态
|
||||
return this.isFolderExpanded !== undefined ? this.isFolderExpanded : this.localFolderExpanded;
|
||||
},
|
||||
actionIconSource() {
|
||||
// 根据actionIcon属性返回对应的图标路径
|
||||
switch (this.actionIcon) {
|
||||
case 'settings':
|
||||
return '/assets/icons/drawable-xxhdpi/btn_settings.png';
|
||||
case 'create':
|
||||
return '/assets/icons/drawable-xxhdpi/btn_create.png';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
},
|
||||
leftIconSource() {
|
||||
// 根据leftIcon属性返回对应的图标路径
|
||||
switch (this.leftIcon) {
|
||||
case 'folder':
|
||||
// 文件夹图标根据展开状态切换
|
||||
return this.folderExpanded
|
||||
? '/assets/icons/drawable-xxhdpi/folder_title_arrow_pressed.png'
|
||||
: '/assets/icons/drawable-xxhdpi/folder_title_arrow_normal.png';
|
||||
case 'back':
|
||||
// 返回图标
|
||||
return '/assets/icons/drawable-xxhdpi/btn_back.png';
|
||||
case 'settings':
|
||||
// 设置图标
|
||||
return '/assets/icons/drawable-xxhdpi/btn_settings.png';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
onAction: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
methods: {
|
||||
handleFolderToggle() {
|
||||
// 切换文件夹展开状态
|
||||
if (this.isFolderExpanded === undefined) {
|
||||
// 如果父组件没有传递isFolderExpanded,则使用本地状态
|
||||
this.localFolderExpanded = !this.localFolderExpanded;
|
||||
}
|
||||
|
||||
// 调用父组件传递的回调函数
|
||||
if (this.onFolderToggle) {
|
||||
this.onFolderToggle();
|
||||
}
|
||||
}
|
||||
actionText: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
actionIcon: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
leftIcon: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
leftType: {
|
||||
type: String,
|
||||
default: 'back',
|
||||
},
|
||||
onLeftAction: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
onFolderToggle: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
isFolderExpanded: {
|
||||
type: Boolean,
|
||||
default: undefined,
|
||||
},
|
||||
onTitlePress: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
})
|
||||
|
||||
const localFolderExpanded = ref(false)
|
||||
|
||||
const folderExpanded = computed(() => {
|
||||
// 优先使用父组件传递的isFolderExpanded状态,否则使用本地状态
|
||||
return props.isFolderExpanded !== undefined ? props.isFolderExpanded : localFolderExpanded.value
|
||||
})
|
||||
|
||||
const actionIconSource = computed(() => {
|
||||
// 根据actionIcon属性返回对应的图标路径
|
||||
switch (props.actionIcon) {
|
||||
case 'settings':
|
||||
return '/assets/icons/drawable-xxhdpi/btn_settings.png'
|
||||
case 'create':
|
||||
return '/assets/icons/drawable-xxhdpi/btn_create.png'
|
||||
default:
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
const leftIconSource = computed(() => {
|
||||
// 根据leftIcon属性返回对应的图标路径
|
||||
switch (props.leftIcon) {
|
||||
case 'folder':
|
||||
// 文件夹图标根据展开状态切换
|
||||
return folderExpanded.value ? '/assets/icons/drawable-xxhdpi/folder_title_arrow_pressed.png' : '/assets/icons/drawable-xxhdpi/folder_title_arrow_normal.png'
|
||||
case 'back':
|
||||
// 返回图标
|
||||
return '/assets/icons/drawable-xxhdpi/btn_back.png'
|
||||
case 'settings':
|
||||
// 设置图标
|
||||
return '/assets/icons/drawable-xxhdpi/btn_settings.png'
|
||||
default:
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
const handleFolderToggle = () => {
|
||||
// 切换文件夹展开状态
|
||||
if (props.isFolderExpanded === undefined) {
|
||||
// 如果父组件没有传递isFolderExpanded,则使用本地状态
|
||||
localFolderExpanded.value = !localFolderExpanded.value
|
||||
}
|
||||
|
||||
// 调用父组件传递的回调函数
|
||||
if (props.onFolderToggle) {
|
||||
props.onFolderToggle()
|
||||
}
|
||||
}
|
||||
|
||||
const handleLeftAction = () => {
|
||||
// 处理左侧图标点击事件
|
||||
if (props.onLeftAction) {
|
||||
props.onLeftAction()
|
||||
} else if (props.leftType !== 'settings' && props.onBack) {
|
||||
// 兼容旧版本的onBack属性
|
||||
props.onBack()
|
||||
}
|
||||
}
|
||||
|
||||
const handleAction = () => {
|
||||
// 处理右侧操作按钮点击事件
|
||||
if (props.onAction) {
|
||||
props.onAction()
|
||||
}
|
||||
}
|
||||
|
||||
const handleTitlePress = () => {
|
||||
// 处理标题点击事件
|
||||
if (props.onTitlePress) {
|
||||
props.onTitlePress()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.header-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
background-color: var(--background-card);
|
||||
box-shadow: 0 1px 0 0 var(--border);
|
||||
<style scoped lang="less">
|
||||
.component {
|
||||
padding: 2rem 0.72rem 0.5rem 0.72rem;
|
||||
background-color: #00000000;
|
||||
background-image: url(https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/686f20ecd54496f19f54e801/68e862ab9520a30011f388ff/17600644443142372133.png);
|
||||
background-size: cover;
|
||||
background-position: 0% 0%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.header-left-area {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.left-icon,
|
||||
.image_4 {
|
||||
width: 1.7rem;
|
||||
height: 1.7rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.header-right-area {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.title-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
|
||||
.header-icon-button {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
transition: background-color 0.2s ease;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.folder-icon {
|
||||
width: 0.8rem;
|
||||
height: 0.8rem;
|
||||
margin-left: 0.2rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.header-icon-button:hover {
|
||||
background-color: var(--black-05);
|
||||
.text {
|
||||
color: #e3dbd4;
|
||||
font-size: 1.01rem;
|
||||
line-height: 1.01rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header-icon-button:active {
|
||||
background-color: var(--black-10);
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.header-title-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s ease;
|
||||
border-radius: 4px;
|
||||
padding: 4px 8px;
|
||||
flex: 1;
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.header-title-container:hover {
|
||||
background-color: var(--black-05);
|
||||
}
|
||||
|
||||
.header-title-container:active {
|
||||
background-color: var(--black-10);
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
text-align: center;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 1;
|
||||
}
|
||||
|
||||
.folder-toggle-button {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s ease;
|
||||
border-radius: 4px;
|
||||
flex-shrink: 0;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.folder-toggle-button:hover {
|
||||
background-color: var(--black-05);
|
||||
}
|
||||
|
||||
.folder-toggle-button:active {
|
||||
background-color: var(--black-10);
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.folder-toggle-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.header-action-text {
|
||||
font-size: 16px;
|
||||
color: var(--primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
206
src/components/Modal.vue
Normal file
206
src/components/Modal.vue
Normal file
@@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<div class="code-fun-flex-col code-fun-justify-start">
|
||||
<div class="code-fun-flex-col code-fun-justify-start group_1">
|
||||
<div class="code-fun-flex-col code-fun-justify-start code-fun-items-end group">
|
||||
<div class="code-fun-flex-col code-fun-justify-start code-fun-items-start code-fun-relative group_2">
|
||||
<div class="code-fun-flex-col section_7">
|
||||
<div class="code-fun-flex-col code-fun-justify-start section_1">
|
||||
<div class="code-fun-flex-row section_11">
|
||||
<div class="code-fun-flex-col code-fun-justify-start section_12" @click="handleCancel">
|
||||
<div class="code-fun-flex-col code-fun-justify-start code-fun-items-center text-wrapper_2">
|
||||
<span class="text_4">{{ cancelText }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="code-fun-flex-col code-fun-justify-start section_13 code-fun-ml-8" @click="handleConfirm">
|
||||
<div class="code-fun-flex-col code-fun-justify-start code-fun-items-center text-wrapper_3">
|
||||
<span class="text_5">{{ confirmText }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="code-fun-flex-col code-fun-justify-start code-fun-relative section_9">
|
||||
<div class="code-fun-flex-col code-fun-justify-start section_10">
|
||||
<div class="code-fun-flex-col code-fun-justify-start code-fun-items-start text-wrapper">
|
||||
<input
|
||||
v-model="inputValue"
|
||||
class="text_3"
|
||||
:placeholder="placeholder"
|
||||
@keyup.enter="handleConfirm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="code-fun-flex-col section_8 pos">
|
||||
<div class="code-fun-flex-col code-fun-justify-start code-fun-items-start code-fun-self-stretch group_3">
|
||||
<span class="text_2">{{ title }}</span>
|
||||
</div>
|
||||
<div class="code-fun-self-start divider"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '新建文件夹'
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '新建文件夹'
|
||||
},
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: '确定'
|
||||
},
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: '取消'
|
||||
}
|
||||
});
|
||||
|
||||
const emit = defineEmits(['confirm', 'cancel']);
|
||||
|
||||
const inputValue = ref('');
|
||||
|
||||
const handleConfirm = () => {
|
||||
emit('confirm', inputValue.value);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
emit('cancel');
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.group_1 {
|
||||
padding-bottom: 1rem;
|
||||
.group {
|
||||
padding: 0.5rem 0 0.25rem;
|
||||
.group_2 {
|
||||
margin-right: 0.75rem;
|
||||
width: 32.31rem;
|
||||
.section_7 {
|
||||
padding-top: 5.75rem;
|
||||
background-color: #00000000;
|
||||
width: 29.06rem;
|
||||
height: 18.16rem;
|
||||
background-image: url(https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/686f20ecd54496f19f54e801/68e862ab9520a30011f388ff/17600601480475170758.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% auto;
|
||||
background-position: 0% 0%;
|
||||
.section_1 {
|
||||
margin-top: 7.88rem;
|
||||
background-color: #00000000;
|
||||
.section_11 {
|
||||
padding: 0.5rem 0.5rem 0.75rem;
|
||||
background-color: #f4f4f7;
|
||||
border-radius: 0rem 0rem 0.75rem 0.75rem;
|
||||
border: solid 0.032rem #edeee8;
|
||||
.section_12 {
|
||||
padding: 0.25rem 0;
|
||||
background-color: #00000000;
|
||||
width: 13.63rem;
|
||||
height: 3.13rem;
|
||||
.text-wrapper_2 {
|
||||
margin: 0 0.25rem;
|
||||
padding: 0.75rem 0;
|
||||
background-color: #f2f2f2;
|
||||
border-radius: 0.25rem;
|
||||
width: 13.34rem;
|
||||
border: solid 0.032rem #d7d7d7;
|
||||
.text_4 {
|
||||
color: #757575;
|
||||
font-size: 1.23rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.23rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
.section_13 {
|
||||
margin-right: 0.25rem;
|
||||
padding-top: 0.25rem;
|
||||
background-color: #00000000;
|
||||
width: 13.59rem;
|
||||
height: 3.06rem;
|
||||
.text-wrapper_3 {
|
||||
margin-left: 0.25rem;
|
||||
padding: 0.75rem 0;
|
||||
border-radius: 0.25rem;
|
||||
background-image: url('assets/53062683132af1946e1a4953530af228.png');
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
width: 13.34rem;
|
||||
.text_5 {
|
||||
color: #cddff2;
|
||||
font-size: 1.19rem;
|
||||
line-height: 1.19rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.section_9 {
|
||||
margin-top: -12.5rem;
|
||||
padding: 1.75rem 0 0.25rem;
|
||||
background-color: #00000000;
|
||||
.section_10 {
|
||||
margin: 0 1.5rem;
|
||||
padding-top: 0.25rem;
|
||||
background-color: #00000000;
|
||||
width: 25.88rem;
|
||||
.text-wrapper {
|
||||
margin: 0 0.25rem;
|
||||
padding: 0.75rem 0;
|
||||
background-color: #fefefe;
|
||||
border-radius: 0.25rem;
|
||||
width: 25.53rem;
|
||||
border: solid 0.063rem #e1e1e1;
|
||||
.text_3 {
|
||||
margin-left: 1rem;
|
||||
color: #d0d0d0;
|
||||
font-size: 1.38rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.38rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.section_8 {
|
||||
padding: 0 0.13rem;
|
||||
background-color: #00000000;
|
||||
width: 32.31rem;
|
||||
.group_3 {
|
||||
padding: 1.5rem 0;
|
||||
width: 32.06rem;
|
||||
.text_2 {
|
||||
margin-left: 10.5rem;
|
||||
color: #7a7a7a;
|
||||
font-size: 1.54rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.54rem;
|
||||
}
|
||||
}
|
||||
.divider {
|
||||
background-color: #f0f0f0;
|
||||
width: 29rem;
|
||||
height: 0.094rem;
|
||||
}
|
||||
}
|
||||
.pos {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,20 +1,16 @@
|
||||
<template>
|
||||
<div class="note-item-container">
|
||||
<!-- 左滑删除操作区域 -->
|
||||
<div
|
||||
v-if="onDelete"
|
||||
class="delete-area"
|
||||
:class="{ 'delete-area-visible': isSwiped }"
|
||||
>
|
||||
<div v-if="onDelete" class="delete-area" :class="{ 'delete-area-visible': isSwiped }">
|
||||
<span class="delete-text">删除</span>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 便签内容区域 -->
|
||||
<div
|
||||
<div
|
||||
class="note-content"
|
||||
:class="{
|
||||
:class="{
|
||||
'note-content-swiped': isSwiped,
|
||||
'note-content-pressed': isPressed
|
||||
'note-content-pressed': isPressed,
|
||||
}"
|
||||
@click="onPress"
|
||||
@touchstart="handleTouchStart"
|
||||
@@ -22,17 +18,12 @@
|
||||
@touchend="handleTouchEnd"
|
||||
@mousedown="handleMouseDown"
|
||||
@mouseup="handleMouseUp"
|
||||
@mouseleave="handleMouseLeave"
|
||||
>
|
||||
@mouseleave="handleMouseLeave">
|
||||
<div class="note-header">
|
||||
<span class="note-date">
|
||||
{{ date }}
|
||||
</span>
|
||||
<ion-icon
|
||||
v-if="isStarred"
|
||||
:icon="star"
|
||||
class="star-icon"
|
||||
></ion-icon>
|
||||
<ion-icon v-if="isStarred" :icon="star" class="star-icon"></ion-icon>
|
||||
</div>
|
||||
<div class="note-title-container">
|
||||
<span class="note-title">
|
||||
@@ -43,89 +34,86 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { star } from 'ionicons/icons';
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { star } from 'ionicons/icons'
|
||||
|
||||
export default {
|
||||
name: 'NoteItem',
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
date: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
isStarred: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
onPress: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
onDelete: {
|
||||
type: Function,
|
||||
default: null
|
||||
}
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
star,
|
||||
isSwiped: false,
|
||||
isPressed: false,
|
||||
touchStartX: 0,
|
||||
touchEndX: 0
|
||||
}
|
||||
content: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
computed: {
|
||||
firstLine() {
|
||||
if (!this.content) return '';
|
||||
return this.content.split('\n')[0];
|
||||
}
|
||||
date: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
methods: {
|
||||
handleTouchStart(event) {
|
||||
this.touchStartX = event.touches[0].clientX;
|
||||
this.isPressed = true;
|
||||
},
|
||||
handleTouchMove(event) {
|
||||
this.touchEndX = event.touches[0].clientX;
|
||||
// 如果有滑动,取消按下状态
|
||||
if (Math.abs(this.touchStartX - this.touchEndX) > 5) {
|
||||
this.isPressed = false;
|
||||
}
|
||||
},
|
||||
handleTouchEnd() {
|
||||
// 重置按下状态
|
||||
this.isPressed = false;
|
||||
|
||||
// 计算滑动距离
|
||||
const swipeDistance = this.touchStartX - this.touchEndX;
|
||||
|
||||
// 如果滑动距离超过阈值,则显示删除按钮
|
||||
if (swipeDistance > 50) {
|
||||
this.isSwiped = true;
|
||||
} else if (swipeDistance < -50) {
|
||||
this.isSwiped = false;
|
||||
}
|
||||
},
|
||||
handleMouseDown() {
|
||||
this.isPressed = true;
|
||||
},
|
||||
handleMouseUp() {
|
||||
this.isPressed = false;
|
||||
},
|
||||
handleMouseLeave() {
|
||||
this.isPressed = false;
|
||||
}
|
||||
isStarred: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
onPress: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
onDelete: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
})
|
||||
|
||||
const isSwiped = ref(false)
|
||||
const isPressed = ref(false)
|
||||
const touchStartX = ref(0)
|
||||
const touchEndX = ref(0)
|
||||
|
||||
const firstLine = computed(() => {
|
||||
if (!props.content) return ''
|
||||
return props.content.split('\n')[0]
|
||||
})
|
||||
|
||||
const handleTouchStart = (event) => {
|
||||
touchStartX.value = event.touches[0].clientX
|
||||
isPressed.value = true
|
||||
}
|
||||
|
||||
const handleTouchMove = (event) => {
|
||||
touchEndX.value = event.touches[0].clientX
|
||||
// 如果有滑动,取消按下状态
|
||||
if (Math.abs(touchStartX.value - touchEndX.value) > 5) {
|
||||
isPressed.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleTouchEnd = () => {
|
||||
// 重置按下状态
|
||||
isPressed.value = false
|
||||
|
||||
// 计算滑动距离
|
||||
const swipeDistance = touchStartX.value - touchEndX.value
|
||||
|
||||
// 如果滑动距离超过阈值,则显示删除按钮
|
||||
if (swipeDistance > 50) {
|
||||
isSwiped.value = true
|
||||
} else if (swipeDistance < -50) {
|
||||
isSwiped.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleMouseDown = () => {
|
||||
isPressed.value = true
|
||||
}
|
||||
|
||||
const handleMouseUp = () => {
|
||||
isPressed.value = false
|
||||
}
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
isPressed.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -220,4 +208,4 @@ export default {
|
||||
white-space: nowrap;
|
||||
line-height: 30px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user