提交 0da2ba73 作者: Hao

add

父级 5d5d76fa
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
\ No newline at end of file
......@@ -29,7 +29,7 @@
let fontSize = Math.floor((currentWidth / targetWidth) * 16);
// 4.开始缩放网页
console.log(scaleRatio, fontSize, 'scaleRatio')
document.body.style = `font-size:${fontSize}px`;
// document.body.style = `font-size:${fontSize}px`;
console.log(document.body, ' document.body')
}
</script>
......
......@@ -101,10 +101,9 @@ const fileImgChange = async () => {
}
const setfileEvent = async (file: any) => {
var html = ''
const { success, result }: any = await upLoadFilesHander(file)
const { result }: any = await upLoadFilesHander(file)
const uploadRes = result
if (!uploadRes) return
console.log(file.type)
if (file.type.includes('image')) {
html = await getImageObject(
uploadRes,
......@@ -114,7 +113,6 @@ const setfileEvent = async (file: any) => {
} else {
html = await getFileObject(uploadRes, file)
}
elAutocomplete.value.innerHTML += html.outerHTML
inputVal.value += html.outerHTML
elAutocomplete.value.focus()
......@@ -190,9 +188,8 @@ const getFileObject = (url: any, oFile: any) => {
var aTag = document.createElement('a')
aTag.href = url
aTag.download = oFile.name
// aTag.setAttribute('href', url)
aTag.target = 'view_window'
aTag.textContent = oFile.name
// aTag.setAttribute('download', oFile.name)
console.log(aTag, 'aTag')
return aTag
}
......@@ -274,7 +271,8 @@ defineExpose({
}
.el-autocomplete {
width: 100%;
height: calc(100vh - 732px);
height: calc(100vh - 60vh - 130px);
font-size: 14px;
max-width: 100%;
overflow: auto;
}
......
......@@ -4,13 +4,13 @@ const routes: Array<RouteRecordRaw> = [
path: "/",
name: "home",
component: () =>
import(/* webpackChunkName: "about" */ "../views/HomeView.vue"),
import(/* webpackChunkName: "home" */ "../views/homeView.vue"),
},
{
path: "/login",
name: "login",
component: () =>
import(/* webpackChunkName: "about" */ "../views/loginView.vue"),
import(/* webpackChunkName: "login" */ "../views/loginView.vue"),
},
{
path: "/loging",
......
//匿名类型var
declare var MyPoint: { x: number; y: number };
//接口类型var
interface SomePoint {
x: number;
y: number;
}
declare var MyPoint1: SomePoint;
interface SomePoint {
z: number;
}
MyPoint1.z = 4; //ok
//类的分解
// TypeScript的类会创建出两个类型:实例类型,定义了类型的实例具有哪些成员;构造函数类型,定义了类构造函数具有哪些类型。构造函数类型也被称做类的静态部分类型,因为它包含了类的静态成员,你可以使用typeof关键词来拿到类静态部分类型,在写声明文件时,想要把类明确的分解成实例类型和静态类型时有用且必要的。
// 下面是一个例子,从使用者的角度来看,这是两个声明是等同的:
//标准版
class A{
static st:string;
inst:number;
constructor(m:any){
}
}
//分解版
interface A_Static{
new(m:any):A_Instance;
st:string;
}
interface
\ No newline at end of file
......@@ -79,6 +79,7 @@
v-if="message.msgType == 3"
:class="getMessageClass(message)"
@click.prevent="handleMessageClick($event)"
@contextmenu="showContextMenu($event, message, callbackFn)"
>
<div class="classSendLink">
<div class="classSendDiv">
......@@ -103,6 +104,7 @@
<div
class="message-container message-container-left"
v-else-if="message.msgType == 4"
@contextmenu="showContextMenu($event, message, callbackFn)"
>
<div class="inquiry-list">
<div class="inquiry-top">
......@@ -128,7 +130,8 @@
</div>
<div class="design-requirements">
<div>{{ message.content.flieName }}</div>
<div class="img">
<div class="img" @click="downLoad(message)">
<!-- <a :href="message.content.flie">Tech design requirements.pdf</a> -->
<img :src="require('../assets/icon_download.png')" />
</div>
</div>
......@@ -207,11 +210,10 @@
>
<div style="width: 400px;">
<div class="shrink-text" @click="changeiShrink">
<el-icon size="30">
<el-icon size="15">
<DArrowLeft v-if="isShrink" />
<DArrowRight v-if="!isShrink" />
</el-icon>
</div>
<div>
<el-header class="el-header-right">
......@@ -417,18 +419,16 @@ const defaultStyle: {
}
let queryParams = ref({})
const connectMsg = () => {
// const useUser = useUserStore()
const toIp = `ws://${
const toUrl = `ws://${
import.meta.env.VITE_USER_APP_API_URL
}:8081?type=kf&code=${getUseUserStore.userInfo?.username}`
getUseUserStore.connect()
initWebSocket(toIp)
initWebSocket(toUrl)
getUserList()
}
onMounted(() => {
connectMsg()
})
const getUserList = (queryParams: any) => {
getUseUserStore.setUserListMessages(queryParams).then((res: any) => {
list.value = getUseUserStore.userList
......@@ -608,7 +608,6 @@ const getMenuItem = (item: any) => {
//收缩
const vShrink: Directive<HTMLElement, boolean | Props> = {
mounted(el, binding) {
console.log(el, binding, '打印')
let { option } = formatCOlorOption(binding.value)
option.isUpdate && renderStyle(el, option)
},
......@@ -648,17 +647,16 @@ function formatCOlorOption(val: string | Props) {
option,
}
}
const openWindow = (event: any) => {
urlDownload(event)
// window.open(event)
}
//点击消息框中的文字或者图片
const handleMessageClick = (event: any) => {
const target = event.target
if (target.tagName === 'A') {
if (target.innerHTML === '解决') {
alert('感谢您的使用')
} else if (target.innerHTML === '未解决') {
alert('很抱歉未能解决你的问题')
} else {
handleLinkClick(target.innerHTML)
}
console.log(target.href, 'tagName')
if (target.tagName == 'A') {
openWindow(target.href)
} else if (target.tagName === 'IMG') {
// 点击的图片进行放大操作
ImageViewer({
......@@ -673,6 +671,23 @@ const handleMessageClick = (event: any) => {
})
}
}
// 地址下载,fileName暂无作用
const urlDownload = (url, fileName = '下载文件') => {
console.log(url, 'url')
// 创建隐藏的可下载链接
let eleLink = document.createElement('a')
eleLink.download = fileName
eleLink.style.display = 'none'
eleLink.href = url
// 触发点击
document.body.appendChild(eleLink)
eleLink.click()
// 然后移除
console.log(url, '下载url')
document.body.removeChild(eleLink)
}
const handleLinkClick = (msg: string) => {
messages.value.push({ content: msg, isSent: true })
}
......@@ -683,6 +698,9 @@ const selectionChange = (arr: any) => {
return item
})
}
const downLoad = (message: any) => {
urlDownload(message.content.flieUrl)
}
</script>
<style lang="scss" scoped>
.shirnk-aside {
......@@ -693,9 +711,14 @@ const selectionChange = (arr: any) => {
position: absolute;
top: 50%;
transform: translate(-50%);
width: 20px;
height: 20px;
left: -20px;
line-height: 15px;
height: 15px;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
width: 15px;
left: -12px;
font-size: 10px;
}
}
......
......@@ -23,6 +23,7 @@ export default defineConfig({
],
server: {
host: "0.0.0.0",
overlay:true,
port: 8082,
open: false,
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论