Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-purchase
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张冬
web-purchase
Commits
b2fb0d15
Commit
b2fb0d15
authored
Sep 23, 2020
by
张冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
联调
parent
a42528a9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
160 additions
and
132 deletions
+160
-132
bidOpenhal.vue
src/pages/purchaser/bid/bidOpen/bidOpenhal.vue
+160
-132
No files found.
src/pages/purchaser/bid/bidOpen/bidOpenhal.vue
View file @
b2fb0d15
...
@@ -41,28 +41,25 @@
...
@@ -41,28 +41,25 @@
<el-button
@
click=
isdialogue
>
在线对话
<i
class=
"el-icon-chat-dot-round"
></i></el-button>
<el-button
@
click=
isdialogue
>
在线对话
<i
class=
"el-icon-chat-dot-round"
></i></el-button>
<div
class=
"button-pos"
>
<div
class=
"button-pos"
>
<el-button
v-if=
"openbidButton"
type=
"primary"
@
click=
"confirm"
style=
"margin-left: 10px;"
>
立即开标
</el-button>
<el-button
v-if=
"openbidButton"
type=
"primary"
@
click=
"confirm"
style=
"margin-left: 10px;"
>
立即开标
</el-button>
<el-button
v-else
type=
"info"
style=
"margin-left: 10px;"
>
{{
buttonWords
}}
</el-button
>
<!--
<el-button
v-else
type=
"info"
style=
"margin-left: 10px;"
>
{{
buttonWords
}}
</el-button>
--
>
<el-button
v-if=
"endbidButton"
type=
"primary"
@
click=
"end"
style=
"margin-top: 10px;"
>
结束开标
</el-button>
<el-button
v-if=
"endbidButton"
type=
"primary"
@
click=
"end"
style=
"margin-top: 10px;"
>
结束开标
</el-button>
</div>
</div>
</div>
</div>
<!-- 在线对话 -->
<!-- 在线对话 -->
<div
class=
"dialogue"
style=
"margin-top: 30px;"
v-show=
"dialogue"
>
<div
class=
"dialogue"
style=
"margin-top: 30px;"
v-show=
"dialogue"
>
<ul
class=
"dialogueList"
>
<ul
class=
"dialogueList"
>
<li
v-for=
"(item,index) in dialogueList"
:key=
"index"
>
<li
v-for=
"(item,index) in dialogueList"
:key=
"index"
:class=
"myId==item.userId?'flex-left':'flex-right'"
>
<div>
<div
class=
"flex-item"
>
<div
class=
"flex-item"
>
<div
v-if=
"myId==item.userId"
>
我
</div>
<div
v-if=
"myId==item.userId"
>
我
</div>
<div
v-else
>
{{
item
.
name
}}
</div>
<div
v-else
>
{{
item
.
name
}}
</div>
<div>
(
{{
item
.
time
}}
)
</div>
<div>
(
{{
item
.
time
}}
)
</div>
</div>
</div>
<div>
{{
item
.
chatContent
}}
</div>
<div>
{{
item
.
chatContent
}}
</div>
</div>
</li>
</li>
</ul>
</ul>
<el-input
<el-input
placeholder=
"请输入内容"
v-model=
"content"
clearable
@
keyup
.
enter
.
native=
"send"
>
placeholder=
"请输入内容"
v-model=
"content"
clearable
@
keyup
.
enter
.
native=
"send"
>
</el-input>
</el-input>
</div>
</div>
</div>
</div>
...
@@ -95,31 +92,31 @@
...
@@ -95,31 +92,31 @@
<!-- 详细信息 -->
<!-- 详细信息 -->
<el-dialog
:visible
.
sync=
"isMessge"
title=
"详细信息"
width=
"60%"
>
<el-dialog
:visible
.
sync=
"isMessge"
title=
"详细信息"
width=
"60%"
>
<dataTable
:columns=
"columns"
:page-obj=
"pageObj"
:margin-top=
"0"
:margin-bottom=
"0"
url=
"/open-bid/sign/detail"
>
<dataTable
:columns=
"columns"
:page-obj=
"pageObj"
:margin-top=
"0"
:margin-bottom=
"0"
url=
"/open-bid/sign/detail"
>
<el-table-column
slot=
"operate"
label=
"是否买断账期"
align=
"center"
fixed=
"right"
>
<el-table-column
slot=
"operate"
label=
"是否买断账期"
align=
"center"
fixed=
"right"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.isPayment"
>
是
</div>
<div
v-if=
"scope.row.isPayment"
>
是
</div>
<div
v-else
>
否
</div>
<div
v-else
>
否
</div>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
slot=
"operate"
label=
"是否递交投标文件"
align=
"center"
fixed=
"right"
>
<el-table-column
slot=
"operate"
label=
"是否递交投标文件"
align=
"center"
fixed=
"right"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.bidFileId"
>
是
</div>
<div
v-if=
"scope.row.bidFileId"
>
是
</div>
<div
v-else
>
否
</div>
<div
v-else
>
否
</div>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
slot=
"operate"
label=
"签到"
align=
"center"
fixed=
"right"
>
<el-table-column
slot=
"operate"
label=
"签到"
align=
"center"
fixed=
"right"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.signIn"
>
是
</div>
<div
v-if=
"scope.row.signIn"
>
是
</div>
<div
v-else
>
否
</div>
<div
v-else
>
否
</div>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
slot=
"operate"
label=
"解密"
align=
"center"
fixed=
"right"
>
<el-table-column
slot=
"operate"
label=
"解密"
align=
"center"
fixed=
"right"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.decode"
>
是
</div>
<div
v-if=
"scope.row.decode"
>
是
</div>
<div
v-else
>
否
</div>
<div
v-else
>
否
</div>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
slot=
"operate"
label=
"签名"
align=
"center"
fixed=
"right"
>
<el-table-column
slot=
"operate"
label=
"签名"
align=
"center"
fixed=
"right"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.signature"
>
是
</div>
<div
v-if=
"scope.row.signature"
>
是
</div>
<div
v-else
>
否
</div>
<div
v-else
>
否
</div>
...
@@ -132,7 +129,7 @@
...
@@ -132,7 +129,7 @@
</el-dialog>
</el-dialog>
<!-- 开标一览表 -->
<!-- 开标一览表 -->
<el-dialog
:visible
.
sync=
"isopenInfo"
title=
"开标一览表"
>
<el-dialog
:visible
.
sync=
"isopenInfo"
title=
"开标一览表"
>
<nopageTable
:tableData=
"tableData"
:columns=
"nopagecolumns"
:margin-top=
"0"
:margin-bottom=
"0"
>
<nopageTable
:tableData=
"tableData"
:columns=
"nopagecolumns"
:margin-top=
"0"
:margin-bottom=
"0"
>
</nopageTable>
</nopageTable>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"isopenInfo=false"
>
关闭
</el-button>
<el-button
@
click=
"isopenInfo=false"
>
关闭
</el-button>
...
@@ -145,9 +142,9 @@
...
@@ -145,9 +142,9 @@
<div>
{{userName}}
</div>
<div>
{{userName}}
</div>
</el-form-item>
</el-form-item>
<el-form-item
label=
"流标原因"
prop=
"reason"
>
<el-form-item
label=
"流标原因"
prop=
"reason"
>
<el-input
v-model=
"form.reason"
></el-input>
<el-input
v-model=
"form.reason"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"上传附件"
>
<el-form-item
label=
"上传附件"
>
<singleUpload
:limit=
"1"
:max=
"10"
tip=
"支持上传1份附件,不差过10M."
@
input=
"getfile"
></singleUpload>
<singleUpload
:limit=
"1"
:max=
"10"
tip=
"支持上传1份附件,不差过10M."
@
input=
"getfile"
></singleUpload>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
...
@@ -166,7 +163,7 @@
...
@@ -166,7 +163,7 @@
<div>
{{faildetail.reason}}
</div>
<div>
{{faildetail.reason}}
</div>
</el-form-item>
</el-form-item>
<el-form-item
label=
"上传附件"
v-if=
"faildetail.fileName"
>
<el-form-item
label=
"上传附件"
v-if=
"faildetail.fileName"
>
<div
@
click=
"down(faildetail.fileUrl)"
>
{{faildetail.fileName}}
</div>
<div
@
click=
"down(faildetail.fileUrl)"
>
{{faildetail.fileName}}
</div>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
@@ -178,16 +175,24 @@
...
@@ -178,16 +175,24 @@
</template>
</template>
<
script
>
<
script
>
import
{
import
{
getTime
getTime
}
from
'@utils/time'
}
from
'@utils/time'
import
{
timeInfo
,
startInfo
,
openInfo
,
signdetail
,
startbid
,
openbidFailed
,
bidFaileddetail
}
from
'@api/purchaser/bid'
import
{
import
dataBreadcrumb
from
'@components/dataBreadcrumb.vue'
timeInfo
,
import
timeDown
from
'@components/timeDown.vue'
startInfo
,
import
dataTable
from
'@components/dataTable.vue'
openInfo
,
import
nopageTable
from
'@components/nopageTable.vue'
signdetail
,
import
singleUpload
from
'@components/Upload/Upload.vue'
startbid
,
export
default
{
openbidFailed
,
bidFaileddetail
}
from
'@api/purchaser/bid'
import
dataBreadcrumb
from
'@components/dataBreadcrumb.vue'
import
timeDown
from
'@components/timeDown.vue'
import
dataTable
from
'@components/dataTable.vue'
import
nopageTable
from
'@components/nopageTable.vue'
import
singleUpload
from
'@components/Upload/Upload.vue'
export
default
{
components
:
{
components
:
{
dataBreadcrumb
,
dataBreadcrumb
,
timeDown
,
timeDown
,
...
@@ -197,12 +202,12 @@ export default {
...
@@ -197,12 +202,12 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
faildetail
:
""
,
faildetail
:
""
,
isfailDetail
:
false
,
isfailDetail
:
false
,
projectCode
:
""
,
projectCode
:
""
,
projectName
:
""
,
projectName
:
""
,
userName
:
""
,
userName
:
""
,
isfail
:
true
,
isfail
:
true
,
rules
:
{
rules
:
{
reason
:
[{
reason
:
[{
required
:
true
,
required
:
true
,
...
@@ -210,21 +215,21 @@ export default {
...
@@ -210,21 +215,21 @@ export default {
trigger
:
'blur'
trigger
:
'blur'
}]
}]
},
},
form
:
{
form
:
{
reason
:
''
,
reason
:
''
,
filePOList
:
[]
filePOList
:
[]
},
},
isfailInfo
:
false
,
isfailInfo
:
false
,
endbidButton
:
false
,
endbidButton
:
false
,
tableData
:
[],
tableData
:
[],
isopenInfo
:
false
,
isopenInfo
:
false
,
startDetail
:
""
,
startDetail
:
""
,
dialogue
:
false
,
dialogue
:
false
,
remaintime
:
""
,
remaintime
:
""
,
storagedecodeTime
:
""
,
storagedecodeTime
:
""
,
storagesignatureTime
:
""
,
storagesignatureTime
:
""
,
decodeTime
:
""
,
decodeTime
:
""
,
signatureTime
:
""
,
signatureTime
:
""
,
isMessge
:
false
,
isMessge
:
false
,
pageObj
:
{
pageObj
:
{
size
:
10
,
size
:
10
,
...
@@ -271,98 +276,105 @@ export default {
...
@@ -271,98 +276,105 @@ export default {
currentTime
:
''
,
currentTime
:
''
,
breads
:
[
'招标管理'
,
'招标项目管理'
,
'工作台'
],
breads
:
[
'招标管理'
,
'招标项目管理'
,
'工作台'
],
websock
:
null
,
websock
:
null
,
content
:
""
,
content
:
""
,
dialogueList
:[],
dialogueList
:
[],
myId
:
""
,
myId
:
""
,
leftmessage
:
""
leftmessage
:
""
,
timer
:
""
}
}
},
},
created
()
{
created
()
{
this
.
projectCode
=
localStorage
.
getItem
(
"projectCode"
)
this
.
projectCode
=
localStorage
.
getItem
(
"projectCode"
)
this
.
projectName
=
localStorage
.
getItem
(
"projectName"
)
this
.
projectName
=
localStorage
.
getItem
(
"projectName"
)
this
.
userName
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)).
name
this
.
userName
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)).
name
this
.
gettimeInfo
();
this
.
gettimeInfo
();
this
.
getstartInfo
();
this
.
getstartInfo
();
this
.
getopenInfo
();
this
.
getopenInfo
();
this
.
getsigndetail
();
this
.
getsigndetail
();
this
.
myId
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)).
userId
this
.
myId
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)).
userId
this
.
pageObj
.
companyId
=
localStorage
.
getItem
(
"companyId"
)
this
.
pageObj
.
companyId
=
localStorage
.
getItem
(
"companyId"
)
this
.
pageObj
.
projectId
=
localStorage
.
getItem
(
"projectId"
)
this
.
pageObj
.
projectId
=
localStorage
.
getItem
(
"projectId"
)
// 中国标准时间
// 中国标准时间
let
currentTime
=
getTime
()
let
currentTime
=
getTime
()
this
.
currentTime
=
currentTime
this
.
currentTime
=
currentTime
setInterval
(()
=>
{
this
.
timer1
=
setInterval
(()
=>
{
let
currentTime
=
getTime
()
let
currentTime
=
getTime
()
this
.
currentTime
=
currentTime
this
.
currentTime
=
currentTime
},
1000
)
},
1000
)
// websocket
// websocket
this
.
createWebSocket
()
this
.
createWebSocket
()
// 长轮训获取
this
.
timer
=
setInterval
(()
=>
{
this
.
getstartInfo
()
},
5000
);
},
},
methods
:
{
methods
:
{
end
()
{
end
()
{
},
},
down
(
url
)
{
down
(
url
)
{
window
.
open
(
url
)
window
.
open
(
url
)
},
},
// 流标详情
// 流标详情
async
failDetail
()
{
async
failDetail
()
{
this
.
isfailDetail
=
true
this
.
isfailDetail
=
true
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
const
{
const
{
data
,
data
,
code
code
}
=
await
bidFaileddetail
(
projectId
)
}
=
await
bidFaileddetail
(
projectId
)
if
(
code
==
200
)
{
if
(
code
==
200
)
{
this
.
faildetail
=
data
this
.
faildetail
=
data
}
}
},
},
// 确定流标
// 确定流标
async
failbid
()
{
async
failbid
()
{
try
{
try
{
let
valid
=
await
this
.
$refs
[
'form'
].
validate
()
let
valid
=
await
this
.
$refs
[
'form'
].
validate
()
if
(
valid
)
{
if
(
valid
)
{
let
form
=
this
.
form
;
let
form
=
this
.
form
;
form
.
projectId
=
localStorage
.
getItem
(
"projectId"
)
form
.
projectId
=
localStorage
.
getItem
(
"projectId"
)
const
{
code
,
msg
}
=
await
openbidFailed
(
form
)
const
{
code
,
msg
}
=
await
openbidFailed
(
form
)
if
(
code
===
200
)
{
if
(
code
===
200
)
{
this
.
$message
.
success
(
msg
)
this
.
$message
.
success
(
msg
)
this
.
isfailInfo
=
false
this
.
isfailInfo
=
false
this
.
isfail
=
false
this
.
isfail
=
false
}
else
if
(
code
===
500
)
{
}
else
if
(
code
===
500
)
{
this
.
$message
.
error
(
msg
)
this
.
$message
.
error
(
msg
)
this
.
isfailInfo
=
false
this
.
isfailInfo
=
false
this
.
isfail
=
false
this
.
isfail
=
false
}
}
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
}
}
},
},
isdialogue
()
{
isdialogue
()
{
this
.
dialogue
=
!
this
.
dialogue
this
.
dialogue
=
!
this
.
dialogue
},
},
getfile
(
val
)
{
getfile
(
val
)
{
this
.
form
.
filePOList
=
val
this
.
form
.
filePOList
=
val
},
},
// 时间信息
// 时间信息
async
gettimeInfo
()
{
async
gettimeInfo
()
{
try
{
try
{
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
const
{
const
{
data
,
data
,
code
code
}
=
await
timeInfo
(
projectId
)
}
=
await
timeInfo
(
projectId
)
let
remaintime
=
Number
(
data
.
remainTime
);
let
remaintime
=
Number
(
data
.
remainTime
);
if
(
remaintime
<
0
)
{
if
(
remaintime
<
0
)
{
this
.
openbidButton
=
true
this
.
openbidButton
=
true
}
else
{
}
else
{
this
.
remaintime
=
remaintime
this
.
remaintime
=
remaintime
}
}
this
.
storagedecodeTime
=
Number
(
data
.
decodeTime
)
this
.
storagedecodeTime
=
Number
(
data
.
decodeTime
)
this
.
storagesignatureTime
=
Number
(
data
.
signatureTime
)
this
.
storagesignatureTime
=
Number
(
data
.
signatureTime
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
}
}
...
@@ -370,13 +382,13 @@ export default {
...
@@ -370,13 +382,13 @@ export default {
// 开标按钮上三个信息(投标人数,缴纳保证金人数,签到人数)
// 开标按钮上三个信息(投标人数,缴纳保证金人数,签到人数)
async
getstartInfo
()
{
async
getstartInfo
()
{
try
{
try
{
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
const
{
const
{
data
,
data
,
code
code
}
=
await
startInfo
(
projectId
)
}
=
await
startInfo
(
projectId
)
if
(
code
==
200
)
{
if
(
code
==
200
)
{
this
.
startDetail
=
data
this
.
startDetail
=
data
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
...
@@ -385,13 +397,13 @@ export default {
...
@@ -385,13 +397,13 @@ export default {
//签到解密略简
//签到解密略简
async
getsigndetail
()
{
async
getsigndetail
()
{
try
{
try
{
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
const
{
const
{
data
,
data
,
code
code
}
=
await
signdetail
(
projectId
)
}
=
await
signdetail
(
projectId
)
if
(
code
==
200
)
{
if
(
code
==
200
)
{
this
.
leftmessage
=
data
this
.
leftmessage
=
data
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
...
@@ -400,26 +412,26 @@ export default {
...
@@ -400,26 +412,26 @@ export default {
// 开标一栏表
// 开标一栏表
async
getopenInfo
()
{
async
getopenInfo
()
{
try
{
try
{
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
const
{
const
{
data
,
data
,
code
code
}
=
await
openInfo
(
projectId
)
}
=
await
openInfo
(
projectId
)
if
(
code
==
200
)
{
if
(
code
==
200
)
{
for
(
let
item
of
data
)
{
for
(
let
item
of
data
)
{
if
(
item
.
isSign
)
{
if
(
item
.
isSign
)
{
item
.
isSign
=
"是"
item
.
isSign
=
"是"
}
else
{
}
else
{
item
.
isSign
=
"否"
item
.
isSign
=
"否"
}
}
}
}
this
.
tableData
=
data
this
.
tableData
=
data
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
}
}
},
},
back
()
{
back
()
{
this
.
$router
.
go
(
-
1
)
this
.
$router
.
go
(
-
1
)
},
},
// 计算分秒倒计时
// 计算分秒倒计时
...
@@ -452,16 +464,16 @@ export default {
...
@@ -452,16 +464,16 @@ export default {
// 开标
// 开标
async
openbid
()
{
async
openbid
()
{
try
{
try
{
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
const
{
const
{
code
code
}
=
await
startbid
(
projectId
)
}
=
await
startbid
(
projectId
)
if
(
code
==
200
)
{
if
(
code
==
200
)
{
this
.
isOpenbid
=
false
this
.
isOpenbid
=
false
this
.
openbidButton
=
false
this
.
openbidButton
=
false
this
.
buttonWords
=
'停止开标'
this
.
buttonWords
=
'停止开标'
this
.
decodeTime
=
this
.
storagedecodeTime
this
.
decodeTime
=
this
.
storagedecodeTime
this
.
signatureTime
=
this
.
storagesignatureTime
this
.
signatureTime
=
this
.
storagesignatureTime
this
.
$message
({
this
.
$message
({
message
:
'开标成功'
,
message
:
'开标成功'
,
type
:
'success'
type
:
'success'
...
@@ -487,58 +499,72 @@ export default {
...
@@ -487,58 +499,72 @@ export default {
},
},
// websocket
// websocket
createWebSocket
()
{
createWebSocket
()
{
let
token
=
localStorage
.
getItem
(
"token"
)
let
token
=
localStorage
.
getItem
(
"token"
)
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
let
projectId
=
localStorage
.
getItem
(
"projectId"
)
this
.
websocket
=
new
WebSocket
(
'ws://192.168.3.35:8085/webSocket/'
+
projectId
+
"/"
+
token
)
this
.
websocket
=
new
WebSocket
(
'ws://192.168.3.35:8085/webSocket/'
+
projectId
+
"/"
+
token
)
// 连接成功时
// 连接成功时
this
.
websocket
.
onopen
=
()
=>
{
this
.
websocket
.
onopen
=
()
=>
{}
}
this
.
websocket
.
onmessage
=
event
=>
{
this
.
websocket
.
onmessage
=
event
=>
{
// 后端发送的消息在event.data中
// 后端发送的消息在event.data中
let
data
=
JSON
.
parse
(
event
.
data
);
let
data
=
JSON
.
parse
(
event
.
data
);
if
(
data
.
type
==
1
)
{
if
(
data
.
type
==
1
)
{
this
.
content
=
""
this
.
content
=
""
this
.
dialogueList
.
push
(
data
)
this
.
dialogueList
.
push
(
data
)
}
else
{
}
else
{
this
.
halList
.
push
(
data
)
this
.
halList
.
push
(
data
)
}
}
}
}
this
.
websocket
.
onclose
=
function
()
{
this
.
websocket
.
onclose
=
function
()
{
console
.
log
(
'关闭了'
)
console
.
log
(
'关闭了'
)
}
}
// 路由跳转时结束websocket链接
// 路由跳转时结束websocket链接
this
.
$router
.
afterEach
(
function
()
{
this
.
$router
.
afterEach
(
function
()
{
this
.
websocket
.
close
()
this
.
websocket
.
close
()
})
})
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常
window
.
onbeforeunload
=
function
()
{
window
.
onbeforeunload
=
function
()
{
this
.
websocket
.
close
()
this
.
websocket
.
close
()
}
}
},
},
send
()
{
send
()
{
let
content
=
this
.
content
;
let
content
=
this
.
content
;
this
.
websocket
.
send
(
content
)
this
.
websocket
.
send
(
content
)
}
}
},
},
destroyed
()
{
}
//清除定时器
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer1
);
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.dialogue
{
.flex-left
{
display
:
flex
;
justify-content
:
flex-start
;
}
.flex-right
{
display
:
flex
;
justify-content
:
flex-end
;
}
.dialogue
{
position
:
absolute
;
position
:
absolute
;
top
:
10%
;
top
:
10%
;
right
:
10%
;
right
:
10%
;
}
}
.dialogue
>
.dialogueList
{
.dialogue
>
.dialogueList
{
border
:
1px
solid
#DCDFE6
;
border
:
1px
solid
#DCDFE6
;
width
:
400px
;
width
:
400px
;
height
:
300px
;
height
:
300px
;
overflow
:
auto
;
overflow
:
auto
;
}
}
.hal
{
.hal
{
position
:
relative
;
position
:
relative
;
}
}
.buttons
{
.buttons
{
margin
:
100px
0
;
margin
:
100px
0
;
}
}
...
@@ -578,7 +604,7 @@ export default {
...
@@ -578,7 +604,7 @@ export default {
margin
:
0
50px
;
margin
:
0
50px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
padding
:
30px
;
padding
:
30px
;
overflow
:
auto
overflow
:
auto
}
}
.hal-center
>
ul
>
li
{
.hal-center
>
ul
>
li
{
...
@@ -615,12 +641,14 @@ export default {
...
@@ -615,12 +641,14 @@ export default {
margin-right
:
50px
;
margin-right
:
50px
;
margin-bottom
:
30px
;
margin-bottom
:
30px
;
}
}
.dialogue
>
.dialogueList
{
.dialogue
>
.dialogueList
{
box-sizing
:
border-box
;
box-sizing
:
border-box
;
padding
:
20px
;
padding
:
20px
;
overflow
:
auto
overflow
:
auto
}
}
.dialogueList
>
li
{
.dialogueList
>
li
{
margin-bottom
:
20px
;
margin-bottom
:
20px
;
}
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment