上传头像裁剪

This commit is contained in:
X1627315083@163.com
2026-03-27 09:36:21 +08:00
parent 41820a2f9d
commit 98d92cbf30
12 changed files with 801 additions and 10 deletions

View File

@@ -1,7 +1,12 @@
<template>
<div class="my-select">
<el-select :model-value="modelValue" @change="onChange" v-bind="attrs">
<el-option v-for="v in list" :key="v.value" :label="v.label" :value="v.value" />
<el-option v-for="v in list" :key="v.value" :label="v.label" :value="v.value" >
<slot name="option" :item="v">
<!-- 默认内容 -->
<span>{{ v.label }}</span>
</slot>
</el-option>
</el-select>
</div>
</template>

View File

@@ -3,7 +3,11 @@
<input class="color" type="color" ref="colorInput" @change="changeColor" />
<div class="interval"></div>
<div class="fontFamily">
<my-select v-model="textStyle['--font-family']" @change="changeFontFamily" :list="fontFamilyList[locale]" />
<my-select v-model="textStyle['--font-family']" @change="changeFontFamily" :list="fontFamilyList[locale]" >
<template #option="{ item }">
<span :style="{'font-family': item.value,}">{{ item.label }}</span>
</template>
</my-select>
</div>
<div class="interval"></div>
<div class="size">

View File

@@ -62,6 +62,7 @@
<threeModel :currentData="currentData" />
</template>
</baseModal>
<Assistant />
</template>
<script setup lang="ts">
@@ -69,6 +70,7 @@
import { computed, ref, watch, onMounted, nextTick, provide, onBeforeUnmount } from 'vue'
import { useLayout } from '@/utils/treeDiagram'
import { NODE_TYPE, NODE_COMPONENT } from './tools/index.d'
import Assistant from '@/components/Assistant/assistant.vue'
// 组件
import headerTools from './components/header-tools.vue'
import zoom from '../components/zoom.vue'

View File

@@ -78,6 +78,24 @@ export const base64Tofile = (base64: string,name: string) => {
const file = new File([blob], name, { type: mime })
return file
}
/** 二进制转base64 */
/**
* File 对象转 Base64
* @param {File} file - 文件对象
* @returns {Promise<string>} Base64 字符串
*/
export const fileToBase64 = (file: File) => {
return new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onload = () => {
resolve(reader.result) // Base64 字符串
}
reader.onerror = (error) => {
reject(error)
}
reader.readAsDataURL(file)
})
}
//获取当前时间2026-03-20 11:38:29
export const getCurrentTime = () => {
const now = new Date()