Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue_django_test
Overview
Overview
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
周田
vue_django_test
Commits
3312e0c3
Commit
3312e0c3
authored
Aug 10, 2023
by
周田
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: 测试 protobufjs
parent
70bbaa6c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
6 deletions
+39
-6
package.json
frontend/package.json
+1
-0
Device_datastruct.proto
frontend/public/proto/Device_datastruct.proto
+1
-1
OAM_datastruct.proto
frontend/public/proto/OAM_datastruct.proto
+0
-1
TDSCmd.proto
frontend/public/proto/TDSCmd.proto
+0
-0
Chat.vue
frontend/src/views/Chat.vue
+25
-4
yarn.lock
frontend/yarn.lock
+12
-0
No files found.
frontend/package.json
View file @
3312e0c3
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
"process"
:
"^0.11.10"
,
"process"
:
"^0.11.10"
,
"protobufjs"
:
"^7.2.4"
,
"protobufjs"
:
"^7.2.4"
,
"terser"
:
"^5.19.2"
,
"terser"
:
"^5.19.2"
,
"ts-protoc-gen"
:
"^0.15.0"
,
"vue"
:
"^3.3.4"
,
"vue"
:
"^3.3.4"
,
"vue-router"
:
"^4.2.4"
"vue-router"
:
"^4.2.4"
},
},
...
...
frontend/
stat
ic/proto/Device_datastruct.proto
→
frontend/
publ
ic/proto/Device_datastruct.proto
View file @
3312e0c3
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
syntax
=
"proto3"
;
syntax
=
"proto3"
;
import
"google/protobuf/any.proto"
;
import
"google/protobuf/any.proto"
;
import
"google/protobuf/timestamp.proto"
;
import
"google/protobuf/timestamp.proto"
;
import
"TDSCmd.proto"
;
option
go_package
=
"../protogo"
;
option
go_package
=
"../protogo"
;
...
...
frontend/
stat
ic/proto/OAM_datastruct.proto
→
frontend/
publ
ic/proto/OAM_datastruct.proto
View file @
3312e0c3
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
syntax
=
"proto3"
;
syntax
=
"proto3"
;
import
"google/protobuf/any.proto"
;
import
"google/protobuf/any.proto"
;
import
"google/protobuf/timestamp.proto"
;
import
"google/protobuf/timestamp.proto"
;
import
"TDSCmd.proto"
;
//alrm level
//alrm level
enum
Level
{
enum
Level
{
...
...
frontend/
stat
ic/proto/TDSCmd.proto
→
frontend/
publ
ic/proto/TDSCmd.proto
View file @
3312e0c3
File moved
frontend/src/views/Chat.vue
View file @
3312e0c3
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
watch
,
onMounted
}
from
'vue'
;
import
{
ref
,
watch
,
onMounted
}
from
'vue'
;
import
{
ElScrollbar
,
ElInput
,
ElButton
}
from
'element-plus'
;
import
{
ElScrollbar
,
ElInput
,
ElButton
}
from
'element-plus'
;
import
{
load
}
from
'protobufjs'
;
const
innerRef
=
ref
<
HTMLDivElement
>
();
const
innerRef
=
ref
<
HTMLDivElement
>
();
const
scrollbarRef
=
ref
<
InstanceType
<
typeof
ElScrollbar
>>
();
const
scrollbarRef
=
ref
<
InstanceType
<
typeof
ElScrollbar
>>
();
...
@@ -29,6 +30,24 @@ const send = () => {
...
@@ -29,6 +30,24 @@ const send = () => {
input
.
value
=
''
;
input
.
value
=
''
;
}
}
const
test
=
()
=>
{
load
([
"../proto/TDSCmd.proto"
,
"../proto/OAM_datastruct.proto"
,
"../proto/Device_datastruct.proto"
,
],
(
error
:
any
,
root
:
any
)
=>
{
if
(
error
)
{
throw
error
}
console
.
log
(
root
)
let
cmd
=
root
.
lookupType
(
'TDSCmd'
);
console
.
log
(
cmd
);
});
}
watch
(
flag
,
()
=>
{
watch
(
flag
,
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
scrollbarRef
.
value
!
.
setScrollTop
(
innerRef
.
value
!
.
offsetHeight
);
scrollbarRef
.
value
!
.
setScrollTop
(
innerRef
.
value
!
.
offsetHeight
);
...
@@ -49,7 +68,8 @@ onMounted(() => {
...
@@ -49,7 +68,8 @@ onMounted(() => {
// const byteArray = new Uint8Array(e.data);
// const byteArray = new Uint8Array(e.data);
// // 将字节流转换为字符串或其他格式进行处理
// // 将字节流转换为字符串或其他格式进行处理
// const message = byteArray.toString();
// const message = byteArray.toString();
items
.
value
.
push
(
JSON
.
stringify
(
e
.
data
));
// items.value.push(JSON.stringify(e.data));
items
.
value
.
push
(
e
.
data
);
flag
.
value
=
!
flag
.
value
flag
.
value
=
!
flag
.
value
};
};
...
@@ -59,12 +79,11 @@ onMounted(() => {
...
@@ -59,12 +79,11 @@ onMounted(() => {
})
})
</
script
>
</
script
>
<
template
>
<
template
>
<el-scrollbar
ref=
"scrollbarRef"
mb-10
h
-100
always
>
<el-scrollbar
ref=
"scrollbarRef"
mb-10
h
eight=
"400px"
always
>
<div
ref=
"innerRef"
>
<div
ref=
"innerRef"
>
<p
v-for=
"item in items"
:key=
"item"
class=
"scrollbar-demo-item"
>
<p
v-for=
"item in items"
:key=
"item"
class=
"scrollbar-demo-item"
>
<div>
{{
JSON
.
parse
(
item
)
!
.
ts
}}
</div>
<div>
{{
JSON
.
parse
(
item
)
?
.
ts
}}
</div>
{{
item
}}
{{
item
}}
</p>
</p>
</div>
</div>
...
@@ -72,6 +91,8 @@ onMounted(() => {
...
@@ -72,6 +91,8 @@ onMounted(() => {
<el-input
v-model=
"input"
placeholder=
"Please input"
@
keyup
.
enter=
"send"
></el-input>
<el-input
v-model=
"input"
placeholder=
"Please input"
@
keyup
.
enter=
"send"
></el-input>
<el-button
mt-10
@
click=
"send"
>
Send
</el-button>
<el-button
mt-10
@
click=
"send"
>
Send
</el-button>
<br/>
<el-button
mt-10
@
click=
"test"
>
test
</el-button>
</
template
>
</
template
>
<
style
scoped
>
<
style
scoped
>
...
...
frontend/yarn.lock
View file @
3312e0c3
...
@@ -2069,6 +2069,11 @@ globals@^11.1.0:
...
@@ -2069,6 +2069,11 @@ globals@^11.1.0:
resolved "https://registry.npmmirror.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
resolved "https://registry.npmmirror.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
google-protobuf@^3.15.5:
version "3.21.2"
resolved "https://registry.npmmirror.com/google-protobuf/-/google-protobuf-3.21.2.tgz#4580a2bea8bbb291ee579d1fefb14d6fa3070ea4"
integrity sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==
gzip-size@^6.0.0:
gzip-size@^6.0.0:
version "6.0.0"
version "6.0.0"
resolved "https://registry.npmmirror.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462"
resolved "https://registry.npmmirror.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462"
...
@@ -2653,6 +2658,13 @@ totalist@^3.0.0:
...
@@ -2653,6 +2658,13 @@ totalist@^3.0.0:
resolved "https://registry.npmmirror.com/totalist/-/totalist-3.0.1.tgz#ba3a3d600c915b1a97872348f79c127475f6acf8"
resolved "https://registry.npmmirror.com/totalist/-/totalist-3.0.1.tgz#ba3a3d600c915b1a97872348f79c127475f6acf8"
integrity sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==
integrity sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==
ts-protoc-gen@^0.15.0:
version "0.15.0"
resolved "https://registry.npmmirror.com/ts-protoc-gen/-/ts-protoc-gen-0.15.0.tgz#2fec5930b46def7dcc9fa73c060d770b7b076b7b"
integrity sha512-TycnzEyrdVDlATJ3bWFTtra3SCiEP0W0vySXReAuEygXCUr1j2uaVyL0DhzjwuUdQoW5oXPwk6oZWeA0955V+g==
dependencies:
google-protobuf "^3.15.5"
typescript@^5.0.2:
typescript@^5.0.2:
version "5.1.6"
version "5.1.6"
resolved "https://registry.npmmirror.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
resolved "https://registry.npmmirror.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
...
...
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