提交 7c587846 作者: Hao

add

父级 3ed4e7f7
NODE_ENV=development
VITE_USER_APP_API_URL=192.168.31.112
\ No newline at end of file
VITE_USER_APP_API_URL=192.168.31.120
......@@ -5,5 +5,6 @@
// Generated by unplugin-auto-import
export {}
declare global {
const ElLoading: typeof import('element-plus/es')['ElLoading']
const ElMessage: typeof import('element-plus/es')['ElMessage']
}
......@@ -31,7 +31,7 @@
console.log(scaleRatio,fontSize, 'scaleRatio')
// 4.开始缩放网页
console.log(scaleRatio,'scaleRatio')
document.body.style = `zoom:${scaleRatio}`;
// document.body.style = `zoom:${scaleRatio}`;
console.log(document.body, ' document.body')
}
</script>
......
......@@ -6,7 +6,6 @@ const instance = axios.create({
// baseURL:'/api',
timeout: 1000, // 设置请求超时时间
});
console.log(import.meta.env, "import.meta.env");
instance.interceptors.request.use(
(config: any) => {
// 在发送请求之前做些什么,例如添加 token
......
......@@ -37,7 +37,7 @@
ref="elAutocomplete"
placeholder="输入信息"
contenteditable="true"
style="outline: none; "
style="outline: none;"
@paste.prevent="handlePaste"
@focus="removeDefaultContent"
@input="handleSelect"
......@@ -71,6 +71,7 @@ const imgShowWidth = ref<number>(50)
const imgShowHeight = ref<number>(50)
const showEmotion = ref<boolean>(false)
const handleEmotion = (i: any) => {
console.log(i, '打印')
elAutocomplete.value.innerHTML += i
inputVal.value = elAutocomplete.value.innerHTML
showEmotion.value = false
......@@ -83,15 +84,7 @@ const upfile = () => {
const fileImgChange = async () => {
var e: any = window.event || event
var oFile = e.target.files[0]
console.log(oFile.type)
if (oFile.type == 'image/png') {
await setfileEvent(e.target)
} else {
upLoadFilesHander(oFile).then((ress) => {
const { success, result }: any = ress;
console.log(result,)
})
}
await setfileEvent(oFile)
const loading: any = ElLoading?.service({
lock: true,
text: '上传中...',
......@@ -99,29 +92,37 @@ const fileImgChange = async () => {
})
loading.close()
}
const setfileEvent = async (clipboardData: any) => {
const img = getPasteImageFile(clipboardData.files)
if (!img) {
return
}
const uploadRes = await fileToBase64(img)
if (!uploadRes) {
return
const setfileEvent = async (file: any) => {
var html = ''
const { result }: any = await upLoadFilesHander(file)
const uploadRes = result
if (!uploadRes) return
if (file.type.includes('image')) {
html = await getImageObject(
uploadRes,
imgShowWidth.value,
imgShowHeight.value,
)
} else {
html = await getFileObject(uploadRes, file)
}
const oImage = await getImageObject(
uploadRes,
imgShowWidth.value,
imgShowHeight.value,
)
console.log(oImage, 'oImage')
elAutocomplete.value.innerHTML += oImage.outerHTML
inputVal.value = oImage.outerHTML
console.log(html, 'html打印')
elAutocomplete.value.innerHTML += html.outerHTML
inputVal.value += html.outerHTML
elAutocomplete.value.focus()
}
const handleSelect = (value: any) => {
inputVal.value = value.target.innerHTML
}
const getFileObject = (url: any, oFile: any) => {
var aTag = document.createElement('a')
aTag.href = url
aTag.download = oFile.name
aTag.target = 'view_window'
aTag.textContent = oFile.name
return aTag
}
const emit = defineEmits(['updateState'])
watch(inputVal, async (newValue) => {
if (!newValue) elAutocomplete.value.innerHTML = ''
......@@ -172,13 +173,11 @@ const handlePasteImageFile = async (clipboardData: any) => {
)
cursorInsert(oImage)
inputVal.value = elAutocomplete.value.innerHTML
// elAutocomplete.value.innerHTML = inputVal.value;
}
// 获取一个 image object
const getImageObject = (uploadRes: any, showWidth: any, showHeight: any) => {
const oImage = new Image(showWidth, showHeight)
const datasetFields = ['width', 'height']
const datasetSizes: any = {
width: '200',
......@@ -273,8 +272,9 @@ defineExpose({
.el-autocomplete {
width: 100%;
max-width: 100%;
height: calc(100vh - 732px);
height: calc(100vh - 60vh - 130px);
overflow: auto;
font-size: 14px;
}
.el-autocomplete img {
max-width: 100%; /* 设置图片最大宽度为容器宽度 */
......
......@@ -117,7 +117,6 @@ export const upLoadHander = async (obj: any) => {
if (resResult) {
const query = {};
// const res: any = await getUploadConfigInfo(query);
const result: any = uploadMixin.upLoadMixinResult;
if (uploadMixin.uploadMixinType === "txcos") {
//走对象存储
......@@ -172,18 +171,21 @@ export const upLoadHander = async (obj: any) => {
async: false,
}
);
if (uploadRes.success && uploadRes.message) {
let data = uploadRes.data;
console.log(data,'uploadRes')
if (data.success && data.message) {
//保存绝对路径,不然小程序会有问题
let url = uploadRes.message;
url = uploadRes.message.replaceAll("//", "/");
const pre = url.startsWith("/") ? "" : "/";
url = `http://${VUE_APP_API_URL}/sys/common/static` + pre + url;
console.log(url, "图片上传失败");
let url = data.message;
// console.log(url,'url')
// url = data.message.replaceAll("//", "/");
// const pre = url.startsWith("/") ? "" : "/";
// url = `http://${VUE_APP_API_URL}/sys/common/static` + pre + url;
// console.log(url, "图片上传成功");
obj.onSuccess({ success: true, message: url });
} else {
obj.onError({
success: false,
message: uploadRes.message || "图片上传失败",
message: data.message || "图片上传失败",
});
}
}
......
......@@ -3,7 +3,7 @@ const routes: Array<RouteRecordRaw> = [
{
path: "/",
name: "home",
component: () => import(/* @vite-ignore */ `@/views/HomeView.vue`),
component: () => import(/* @vite-ignore */ `@/views/homeView.vue`),
},
{
path: "/loging",
......
......@@ -24,6 +24,7 @@ export const useUserStore = defineStore("user", {
this.customerInfo = res;
},
setUserInfo(res: any) {
console.log(res,'res')
this.userInfo = res;
},
setUserListMessages(res: any) {
......
interface aaa{
name:string
}
interface aaa{
age:number;
}
\ No newline at end of file
......@@ -48,5 +48,6 @@ export default defineConfig({
host: "0.0.0.0",
port: 8082,
open: false,
overlay:true,
},
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论