Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
source-trace-manage-go
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tracing
source-trace-manage-go
Commits
9fbad1c8
Commit
9fbad1c8
authored
Oct 14, 2020
by
zL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增语音上传
parent
171d8fdc
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
248 additions
and
24 deletions
+248
-24
index.html
public/sy/index.html
+1
-1
PropertyItem.vue
src/components/editTemplate/PropertyItem.vue
+6
-0
SetBar.vue
src/components/editTemplate/SetBar.vue
+10
-9
AudioForm.vue
src/components/editTemplate/form/AudioForm.vue
+196
-3
PDFForms.vue
src/components/editTemplate/form/PDFForms.vue
+3
-6
copyGoods.vue
src/components/newProductList/copyGoods.vue
+1
-1
App.vue
src/entry/sy/App.vue
+4
-1
Template.ts
src/plugins/Template.ts
+22
-0
types.ts
src/plugins/types.ts
+4
-3
editTemplate.vue
src/views/template/editTemplate.vue
+1
-0
No files found.
public/sy/index.html
View file @
9fbad1c8
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<link
rel=
"icon"
href=
"./sy/favicon.ico"
>
<link
rel=
"icon"
href=
"./sy/favicon.ico"
>
<title>
商品溯源
</title>
<title>
商品溯源
</title>
<link
rel=
"stylesheet"
href=
"//at.alicdn.com/t/font_1321935_
fwj9csfa5yd
.css"
>
<link
rel=
"stylesheet"
href=
"//at.alicdn.com/t/font_1321935_
944xvawjvfw
.css"
>
<script
src=
"https://cdn.bootcss.com/tinymce/4.7.4/tinymce.min.js"
></script>
<script
src=
"https://cdn.bootcss.com/tinymce/4.7.4/tinymce.min.js"
></script>
</head>
</head>
...
...
src/components/editTemplate/PropertyItem.vue
View file @
9fbad1c8
...
@@ -40,6 +40,10 @@
...
@@ -40,6 +40,10 @@
v-else-if=
"property.type === PropertyType.Video"
v-else-if=
"property.type === PropertyType.Video"
:property=
"property"
:property=
"property"
/>
/>
<audio-Form
v-else-if=
"property.type === PropertyType.Audio"
:property=
"property"
/>
</div>
</div>
</
template
>
</
template
>
...
@@ -54,6 +58,7 @@ import VideoForms from "@/components/editTemplate/form/VideoForm.vue";
...
@@ -54,6 +58,7 @@ import VideoForms from "@/components/editTemplate/form/VideoForm.vue";
import
BaseForm
from
"@/components/editTemplate/form/BaseForm.vue"
;
import
BaseForm
from
"@/components/editTemplate/form/BaseForm.vue"
;
import
DateForm
from
"@/components/editTemplate/form/DateForm.vue"
;
import
DateForm
from
"@/components/editTemplate/form/DateForm.vue"
;
import
EditorForm
from
"@/components/editTemplate/form/EditorForm.vue"
;
import
EditorForm
from
"@/components/editTemplate/form/EditorForm.vue"
;
import
AudioForm
from
"@/components/editTemplate/form/AudioForm.vue"
;
@
Component
({
@
Component
({
components
:
{
components
:
{
BaseForm
,
BaseForm
,
...
@@ -63,6 +68,7 @@ import EditorForm from "@/components/editTemplate/form/EditorForm.vue";
...
@@ -63,6 +68,7 @@ import EditorForm from "@/components/editTemplate/form/EditorForm.vue";
EditorForm
,
EditorForm
,
PDFForms
,
PDFForms
,
VideoForms
,
VideoForms
,
AudioForm
,
},
},
})
})
export
default
class
PropertyItem
extends
Vue
{
export
default
class
PropertyItem
extends
Vue
{
...
...
src/components/editTemplate/SetBar.vue
View file @
9fbad1c8
...
@@ -71,6 +71,16 @@
...
@@ -71,6 +71,16 @@
</div>
</div>
</set-select-item>
</set-select-item>
<set-select-item
<set-select-item
label=
"上传语音"
:selected=
"type === PropertyType.Audio"
:disabled=
"selectedDisabled"
@
click
.
native=
"handleSelect(PropertyType.Audio)"
>
<div
class=
"menu-item-example menu-item-example_up"
>
<i
class=
"iconfont iconshangchuanwenjianbeifen"
></i>
</div>
</set-select-item>
<set-select-item
label=
"编辑器"
label=
"编辑器"
:selected=
"type === PropertyType.Editor"
:selected=
"type === PropertyType.Editor"
:disabled=
"selectedDisabled"
:disabled=
"selectedDisabled"
...
@@ -186,15 +196,6 @@ export default class SetBar extends Vue {
...
@@ -186,15 +196,6 @@ export default class SetBar extends Vue {
}
}
}
}
</
script
>
</
script
>
<
style
type=
"text/css"
>
.icon
{
width
:
1em
;
height
:
1em
;
vertical-align
:
-0.15em
;
fill
:
currentColor
;
overflow
:
hidden
;
}
</
style
>
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
.set_bar {
.set_bar {
position: relative;
position: relative;
...
...
src/components/editTemplate/form/AudioForm.vue
View file @
9fbad1c8
<
template
>
<
template
>
<div
class=
""
></div>
<div
class=
"base_form"
>
<div
class=
"label"
>
<img
class=
"pre-tag"
src=
"../../../assets/images/template/pre-tag.png"
/>
<div
class=
"label-text"
>
{{
property
.
label
}}
</div>
</div>
<div>
<div
class=
"up"
@
click=
"upFile"
>
<i
class=
"iconfont iconyinpin2"
></i>
上传音频
</div>
<div
class=
"show"
v-for=
"(item, index) in localObjects"
:key=
"index"
>
<i
class=
"iconfont iconyinpin-copy"
></i>
<p>
{{
item
.
name
}}
</p>
<div
class=
"show-rigth"
>
<i
class=
"iconfont iconxingzhuang2"
></i>
上传成功
<i
class=
"iconfont iconshanchu1"
@
click=
"deleteAudios(index)"
></i>
</div>
</div>
</div>
<input
type=
"file"
hidden
ref=
"inputDom"
accept=
"audio/*"
@
change=
"fileChange"
/>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{};
import
{
GO_URLS
}
from
"@/config/URLS"
;
export
default
{
props
:
[
"property"
],
data
()
{
return
{
localObjects
:
[],
localHash
:
[],
// 本地hash
};
},
mounted
()
{
if
(
this
.
property
.
value
.
length
>
0
)
{
let
hashes
=
[];
for
(
let
index
=
0
;
index
<
this
.
property
.
value
.
length
;
index
++
)
{
const
element
=
this
.
property
.
value
[
index
];
hashes
.
push
(
element
.
value
);
}
if
(
hashes
.
length
===
this
.
property
.
value
.
length
)
{
this
.
getAudios
(
hashes
);
}
}
},
watch
:
{
localHash
:
{
handler
(
newV
,
oldV
)
{
this
.
property
.
value
=
newV
;
},
deep
:
true
,
},
},
methods
:
{
deleteAudios
(
index
)
{
this
.
localHash
.
splice
(
index
,
1
);
this
.
localObjects
.
splice
(
index
,
1
);
this
.
$message
({
type
:
"success"
,
message
:
"删除成功!"
,
});
},
// 上传文件
upFile
()
{
this
.
$refs
.
inputDom
.
click
();
},
// 获取旧文件
async
getAudios
(
hashes
)
{
const
data
=
await
this
.
$ajax
({
type
:
"post"
,
params
:
{
hashes
},
url
:
GO_URLS
.
getFiles
,
});
if
(
data
)
{
this
.
localObjects
=
data
.
data
.
files
;
for
(
let
index
=
0
;
index
<
data
.
data
.
files
.
length
;
index
++
)
{
const
element
=
data
.
data
.
files
[
index
];
this
.
localHash
.
push
(
element
.
hash
);
}
}
},
async
fileChange
(
e
)
{
const
file
=
e
.
target
.
files
[
0
];
if
(
!
file
)
return
;
if
(
file
.
size
>
10485760
)
{
this
.
$message
({
message
:
"上传文件超过最大限制"
,
type
:
"warning"
,
});
return
;
}
const
formData
=
new
FormData
();
formData
.
append
(
"file_data"
,
file
);
const
res
=
await
this
.
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
upload
+
`?file_type=mp3`
,
params
:
formData
,
});
if
(
res
)
{
// 上传成功
this
.
$message
({
message
:
"上传成功"
,
type
:
"success"
,
});
this
.
localHash
.
push
(
res
.
data
.
hash
);
this
.
localObjects
.
push
(
res
.
data
);
}
},
},
};
</
script
>
</
script
>
<
style
>
<
style
lang=
"less"
scoped
>
.base_form {
flex-shrink: 0;
padding-left: 18px;
font-size: 0;
padding-top: 10px;
padding-bottom: 10px;
display: flex;
justify-content: flex-start;
}
.label {
display: inline-block;
width: 150px;
flex-shrink: 0;
cursor: pointer;
color: #797d84;
line-height: 44px;
font-size: 14px;
font-weight: 300;
position: relative;
}
.pre-tag {
position: absolute;
left: -30px;
top: 14px;
display: none;
}
.label-text {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.up {
width: 151px;
height: 36px;
cursor: pointer;
border-radius: 4px;
font-size: 12px;
font-weight: 400;
text-align: center;
line-height: 36px;
color: rgba(121, 125, 132, 1);
background: #f6f6f7;
border: 1px solid #f0f1f5;
.iconyinpin2 {
font-size: 24px;
vertical-align: sub;
}
}
.show {
line-height: 1;
padding-top: 20px;
padding-bottom: 4px;
width: 800px;
p {
font-size: 14px;
margin: 0;
display: inline-block;
padding: 0;
font-weight: 400;
color: #353535;
}
.iconyinpin-copy {
color: #33c8ff;
font-size: 16px;
margin-right: 6px;
}
.show-rigth {
float: right;
font-size: 14px;
.iconshanchu1 {
color: #b6b5ba;
font-size: 12px;
margin-left: 10px;
cursor: pointer;
}
.iconxingzhuang2 {
margin-right: 2px;
color: #33c724;
}
}
}
</
style
>
</
style
>
\ No newline at end of file
src/components/editTemplate/form/PDFForms.vue
View file @
9fbad1c8
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<div
class=
"label-text"
:title=
"label"
>
{{
label
}}
</div>
<div
class=
"label-text"
:title=
"label"
>
{{
label
}}
</div>
</div>
</div>
<!-- 显示区域 -->
<!-- 显示区域 -->
<div
v-if=
"pdfSHOW"
>
<div>
<div
class=
"up"
@
click=
"upFile"
>
<div
class=
"up"
@
click=
"upFile"
>
<i
class=
"iconfont iconpdf1"
></i>
<i
class=
"iconfont iconpdf1"
></i>
上传PDF
上传PDF
...
@@ -21,11 +21,11 @@
...
@@ -21,11 +21,11 @@
</div>
</div>
</div>
</div>
<!-- 上传区域 -->
<!-- 上传区域 -->
<div
class=
"upload-area"
@
click=
"upFile"
v-else
>
<
!--
<
div
class=
"upload-area"
@
click=
"upFile"
v-else
>
<i
class=
"iconfont iconpdf icon"
></i>
<i
class=
"iconfont iconpdf icon"
></i>
<p>
上传PDF
</p>
<p>
上传PDF
</p>
<p>
大小不大于10M
</p>
<p>
大小不大于10M
</p>
</div>
</div>
-->
<input
<input
type=
"file"
type=
"file"
hidden
hidden
...
@@ -54,7 +54,6 @@ export default {
...
@@ -54,7 +54,6 @@ export default {
// 数据回显
// 数据回显
if
(
this
.
property
.
value
.
length
>
0
)
{
if
(
this
.
property
.
value
.
length
>
0
)
{
this
.
pdfSHOW
=
true
;
this
.
pdfSHOW
=
true
;
let
hashes
=
[];
let
hashes
=
[];
for
(
let
index
=
0
;
index
<
this
.
property
.
value
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
this
.
property
.
value
.
length
;
index
++
)
{
const
element
=
this
.
property
.
value
[
index
];
const
element
=
this
.
property
.
value
[
index
];
...
@@ -112,7 +111,6 @@ export default {
...
@@ -112,7 +111,6 @@ export default {
type
:
"success"
,
type
:
"success"
,
});
});
this
.
localHash
.
push
(
res
.
data
.
hash
);
this
.
localHash
.
push
(
res
.
data
.
hash
);
this
.
pdfSHOW
=
true
;
this
.
pdfSHOW
=
true
;
this
.
localObjects
.
push
(
res
.
data
);
this
.
localObjects
.
push
(
res
.
data
);
}
}
...
@@ -126,7 +124,6 @@ export default {
...
@@ -126,7 +124,6 @@ export default {
});
});
if
(
data
)
{
if
(
data
)
{
this
.
localObjects
=
data
.
data
.
files
;
this
.
localObjects
=
data
.
data
.
files
;
for
(
let
index
=
0
;
index
<
data
.
data
.
files
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
data
.
data
.
files
.
length
;
index
++
)
{
const
element
=
data
.
data
.
files
[
index
];
const
element
=
data
.
data
.
files
[
index
];
this
.
localHash
.
push
(
element
.
hash
);
this
.
localHash
.
push
(
element
.
hash
);
...
...
src/components/newProductList/copyGoods.vue
View file @
9fbad1c8
...
@@ -49,7 +49,7 @@ export default {
...
@@ -49,7 +49,7 @@ export default {
newNote
.
evidenceName
=
this
.
name
;
newNote
.
evidenceName
=
this
.
name
;
for
(
let
index
=
0
;
index
<
newDetail
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
newDetail
.
length
;
index
++
)
{
const
element
=
newDetail
[
index
];
const
element
=
newDetail
[
index
];
console
.
log
(
element
);
if
(
element
.
data
&&
element
.
data
.
length
===
0
)
{
if
(
element
.
data
&&
element
.
data
.
length
===
0
)
{
newDetail
.
splice
(
index
,
1
);
newDetail
.
splice
(
index
,
1
);
}
}
...
...
src/entry/sy/App.vue
View file @
9fbad1c8
...
@@ -23,7 +23,10 @@ button {
...
@@ -23,7 +23,10 @@ button {
font-family
:
"Helvetica Neue"
,
Helvetica
,
"PingFang SC"
,
"Hiragino Sans GB"
,
font-family
:
"Helvetica Neue"
,
Helvetica
,
"PingFang SC"
,
"Hiragino Sans GB"
,
"Microsoft YaHei"
,
"微软雅黑"
,
Arial
,
sans-serif
;
"Microsoft YaHei"
,
"微软雅黑"
,
Arial
,
sans-serif
;
}
}
*
{
margin
:
0
;
padding
:
0
;
}
a
:hover
,
a
:hover
,
a
:visited
,
a
:visited
,
a
:active
,
a
:active
,
...
...
src/plugins/Template.ts
View file @
9fbad1c8
...
@@ -137,6 +137,26 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -137,6 +137,26 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
label
:
property
.
label
label
:
property
.
label
};
};
}
}
else
if
(
property
.
type
===
PropertyType
.
Audio
)
{
let
data
=
{}
if
(
property
.
value
)
{
let
dd
=
Array
.
from
(
property
.
value
);
data
=
(
dd
as
any
).
map
((
value
:
any
)
=>
({
format
:
"hash(hash)"
,
type
:
"media"
,
value
:
value
}))
}
else
{
data
=
{}
}
return
{
key
:
property
.
key
,
type
:
(
property
.
type
as
PropertyType
.
Audio
),
data
:
data
,
label
:
property
.
label
};
}
//Video
//Video
else
{
else
{
return
{
return
{
...
@@ -175,6 +195,8 @@ function formatApiProperty2Local(property: any, parent: Unit): Property {
...
@@ -175,6 +195,8 @@ function formatApiProperty2Local(property: any, parent: Unit): Property {
local
.
value
=
property
.
data
local
.
value
=
property
.
data
}
else
if
(
property
.
type
===
PropertyType
.
Video
)
{
}
else
if
(
property
.
type
===
PropertyType
.
Video
)
{
local
.
value
=
property
.
data
local
.
value
=
property
.
data
}
else
if
(
property
.
type
===
PropertyType
.
Audio
)
{
local
.
value
=
property
.
data
}
}
return
local
;
return
local
;
}
}
src/plugins/types.ts
View file @
9fbad1c8
...
@@ -2,7 +2,7 @@ export interface RootUnit { // 一级单元
...
@@ -2,7 +2,7 @@ export interface RootUnit { // 一级单元
key
:
string
;
key
:
string
;
data
:
Array
<
TemplateProperty
|
TmplSelectProperty
|
UnitProperty
>
;
data
:
Array
<
TemplateProperty
|
TmplSelectProperty
|
UnitProperty
>
;
type
?:
number
;
type
?:
number
;
label
:
string
label
:
string
}
}
export
enum
PropertyType
{
export
enum
PropertyType
{
...
@@ -14,7 +14,8 @@ export enum PropertyType {
...
@@ -14,7 +14,8 @@ export enum PropertyType {
Select
=
5
,
//选择
Select
=
5
,
//选择
Date
=
6
,
//时间戳
Date
=
6
,
//时间戳
Editor
=
7
,
//编辑器
Editor
=
7
,
//编辑器
Video
=
8
Video
=
8
,
//视频
Audio
=
9
// 音频
}
}
//to showstatus
//to showstatus
...
@@ -32,7 +33,7 @@ export interface TemplateProperty extends Property {
...
@@ -32,7 +33,7 @@ export interface TemplateProperty extends Property {
}
}
export
interface
TemInputProperty
extends
Property
{
export
interface
TemInputProperty
extends
Property
{
type
:
PropertyType
.
Input
|
PropertyType
.
Date
;
type
:
PropertyType
.
Input
|
PropertyType
.
Date
;
value
:
string
;
value
:
string
;
data
:
object
data
:
object
}
}
...
...
src/views/template/editTemplate.vue
View file @
9fbad1c8
...
@@ -572,6 +572,7 @@ export default class editTemplate extends Vue {
...
@@ -572,6 +572,7 @@ export default class editTemplate extends Vue {
await
this
.
fileHandler
();
await
this
.
fileHandler
();
var
newDetail
=
new
Array
();
var
newDetail
=
new
Array
();
newDetail
=
formatApiJson
(
this
.
rootUnitList
);
newDetail
=
formatApiJson
(
this
.
rootUnitList
);
// return
// 更新ext数据
// 更新ext数据
for
(
let
index
=
0
;
index
<
newDetail
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
newDetail
.
length
;
index
++
)
{
const
element
=
newDetail
[
index
];
const
element
=
newDetail
[
index
];
...
...
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