提交 7c587846 作者: Hao

add

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