提交 0da2ba73 作者: Hao

add

父级 5d5d76fa
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 \ No newline at end of file
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
let fontSize = Math.floor((currentWidth / targetWidth) * 16); let fontSize = Math.floor((currentWidth / targetWidth) * 16);
// 4.开始缩放网页 // 4.开始缩放网页
console.log(scaleRatio, fontSize, 'scaleRatio') 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') console.log(document.body, ' document.body')
} }
</script> </script>
......
...@@ -101,10 +101,9 @@ const fileImgChange = async () => { ...@@ -101,10 +101,9 @@ const fileImgChange = async () => {
} }
const setfileEvent = async (file: any) => { const setfileEvent = async (file: any) => {
var html = '' var html = ''
const { success, result }: any = await upLoadFilesHander(file) const { result }: any = await upLoadFilesHander(file)
const uploadRes = result const uploadRes = result
if (!uploadRes) return if (!uploadRes) return
console.log(file.type)
if (file.type.includes('image')) { if (file.type.includes('image')) {
html = await getImageObject( html = await getImageObject(
uploadRes, uploadRes,
...@@ -114,7 +113,6 @@ const setfileEvent = async (file: any) => { ...@@ -114,7 +113,6 @@ const setfileEvent = async (file: any) => {
} else { } else {
html = await getFileObject(uploadRes, file) html = await getFileObject(uploadRes, file)
} }
elAutocomplete.value.innerHTML += html.outerHTML elAutocomplete.value.innerHTML += html.outerHTML
inputVal.value += html.outerHTML inputVal.value += html.outerHTML
elAutocomplete.value.focus() elAutocomplete.value.focus()
...@@ -190,9 +188,8 @@ const getFileObject = (url: any, oFile: any) => { ...@@ -190,9 +188,8 @@ const getFileObject = (url: any, oFile: any) => {
var aTag = document.createElement('a') var aTag = document.createElement('a')
aTag.href = url aTag.href = url
aTag.download = oFile.name aTag.download = oFile.name
// aTag.setAttribute('href', url) aTag.target = 'view_window'
aTag.textContent = oFile.name aTag.textContent = oFile.name
// aTag.setAttribute('download', oFile.name)
console.log(aTag, 'aTag') console.log(aTag, 'aTag')
return aTag return aTag
} }
...@@ -274,7 +271,8 @@ defineExpose({ ...@@ -274,7 +271,8 @@ defineExpose({
} }
.el-autocomplete { .el-autocomplete {
width: 100%; width: 100%;
height: calc(100vh - 732px); height: calc(100vh - 60vh - 130px);
font-size: 14px;
max-width: 100%; max-width: 100%;
overflow: auto; overflow: auto;
} }
......
...@@ -4,13 +4,13 @@ const routes: Array<RouteRecordRaw> = [ ...@@ -4,13 +4,13 @@ const routes: Array<RouteRecordRaw> = [
path: "/", path: "/",
name: "home", name: "home",
component: () => component: () =>
import(/* webpackChunkName: "about" */ "../views/HomeView.vue"), import(/* webpackChunkName: "home" */ "../views/homeView.vue"),
}, },
{ {
path: "/login", path: "/login",
name: "login", name: "login",
component: () => component: () =>
import(/* webpackChunkName: "about" */ "../views/loginView.vue"), import(/* webpackChunkName: "login" */ "../views/loginView.vue"),
}, },
{ {
path: "/loging", 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 @@ ...@@ -79,6 +79,7 @@
v-if="message.msgType == 3" v-if="message.msgType == 3"
:class="getMessageClass(message)" :class="getMessageClass(message)"
@click.prevent="handleMessageClick($event)" @click.prevent="handleMessageClick($event)"
@contextmenu="showContextMenu($event, message, callbackFn)"
> >
<div class="classSendLink"> <div class="classSendLink">
<div class="classSendDiv"> <div class="classSendDiv">
...@@ -103,6 +104,7 @@ ...@@ -103,6 +104,7 @@
<div <div
class="message-container message-container-left" class="message-container message-container-left"
v-else-if="message.msgType == 4" v-else-if="message.msgType == 4"
@contextmenu="showContextMenu($event, message, callbackFn)"
> >
<div class="inquiry-list"> <div class="inquiry-list">
<div class="inquiry-top"> <div class="inquiry-top">
...@@ -128,7 +130,8 @@ ...@@ -128,7 +130,8 @@
</div> </div>
<div class="design-requirements"> <div class="design-requirements">
<div>{{ message.content.flieName }}</div> <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')" /> <img :src="require('../assets/icon_download.png')" />
</div> </div>
</div> </div>
...@@ -207,11 +210,10 @@ ...@@ -207,11 +210,10 @@
> >
<div style="width: 400px;"> <div style="width: 400px;">
<div class="shrink-text" @click="changeiShrink"> <div class="shrink-text" @click="changeiShrink">
<el-icon size="30"> <el-icon size="15">
<DArrowLeft v-if="isShrink" /> <DArrowLeft v-if="isShrink" />
<DArrowRight v-if="!isShrink" /> <DArrowRight v-if="!isShrink" />
</el-icon> </el-icon>
</div> </div>
<div> <div>
<el-header class="el-header-right"> <el-header class="el-header-right">
...@@ -417,18 +419,16 @@ const defaultStyle: { ...@@ -417,18 +419,16 @@ const defaultStyle: {
} }
let queryParams = ref({}) let queryParams = ref({})
const connectMsg = () => { const connectMsg = () => {
// const useUser = useUserStore() const toUrl = `ws://${
const toIp = `ws://${
import.meta.env.VITE_USER_APP_API_URL import.meta.env.VITE_USER_APP_API_URL
}:8081?type=kf&code=${getUseUserStore.userInfo?.username}` }:8081?type=kf&code=${getUseUserStore.userInfo?.username}`
getUseUserStore.connect() getUseUserStore.connect()
initWebSocket(toIp) initWebSocket(toUrl)
getUserList() getUserList()
} }
onMounted(() => { onMounted(() => {
connectMsg() connectMsg()
}) })
const getUserList = (queryParams: any) => { const getUserList = (queryParams: any) => {
getUseUserStore.setUserListMessages(queryParams).then((res: any) => { getUseUserStore.setUserListMessages(queryParams).then((res: any) => {
list.value = getUseUserStore.userList list.value = getUseUserStore.userList
...@@ -608,7 +608,6 @@ const getMenuItem = (item: any) => { ...@@ -608,7 +608,6 @@ const getMenuItem = (item: any) => {
//收缩 //收缩
const vShrink: Directive<HTMLElement, boolean | Props> = { const vShrink: Directive<HTMLElement, boolean | Props> = {
mounted(el, binding) { mounted(el, binding) {
console.log(el, binding, '打印')
let { option } = formatCOlorOption(binding.value) let { option } = formatCOlorOption(binding.value)
option.isUpdate && renderStyle(el, option) option.isUpdate && renderStyle(el, option)
}, },
...@@ -648,17 +647,16 @@ function formatCOlorOption(val: string | Props) { ...@@ -648,17 +647,16 @@ function formatCOlorOption(val: string | Props) {
option, option,
} }
} }
const openWindow = (event: any) => {
urlDownload(event)
// window.open(event)
}
//点击消息框中的文字或者图片 //点击消息框中的文字或者图片
const handleMessageClick = (event: any) => { const handleMessageClick = (event: any) => {
const target = event.target const target = event.target
if (target.tagName === 'A') { console.log(target.href, 'tagName')
if (target.innerHTML === '解决') { if (target.tagName == 'A') {
alert('感谢您的使用') openWindow(target.href)
} else if (target.innerHTML === '未解决') {
alert('很抱歉未能解决你的问题')
} else {
handleLinkClick(target.innerHTML)
}
} else if (target.tagName === 'IMG') { } else if (target.tagName === 'IMG') {
// 点击的图片进行放大操作 // 点击的图片进行放大操作
ImageViewer({ ImageViewer({
...@@ -673,6 +671,23 @@ const handleMessageClick = (event: any) => { ...@@ -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) => { const handleLinkClick = (msg: string) => {
messages.value.push({ content: msg, isSent: true }) messages.value.push({ content: msg, isSent: true })
} }
...@@ -683,6 +698,9 @@ const selectionChange = (arr: any) => { ...@@ -683,6 +698,9 @@ const selectionChange = (arr: any) => {
return item return item
}) })
} }
const downLoad = (message: any) => {
urlDownload(message.content.flieUrl)
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.shirnk-aside { .shirnk-aside {
...@@ -693,9 +711,14 @@ const selectionChange = (arr: any) => { ...@@ -693,9 +711,14 @@ const selectionChange = (arr: any) => {
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translate(-50%); transform: translate(-50%);
width: 20px; line-height: 15px;
height: 20px; height: 15px;
left: -20px; text-align: center;
display: flex;
justify-content: center;
align-items: center;
width: 15px;
left: -12px;
font-size: 10px; font-size: 10px;
} }
} }
......
...@@ -23,6 +23,7 @@ export default defineConfig({ ...@@ -23,6 +23,7 @@ export default defineConfig({
], ],
server: { server: {
host: "0.0.0.0", host: "0.0.0.0",
overlay:true,
port: 8082, port: 8082,
open: false, open: false,
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论