Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
NFT
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
hanfeng zhang
NFT
Commits
0b9b6b47
Commit
0b9b6b47
authored
Jul 12, 2021
by
hanfeng zhang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of gitlab.33.cn:HF_web/NFT
parents
75640b15
814e6b5b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
180 additions
and
68 deletions
+180
-68
Btn.vue
src/components/common/Btn.vue
+44
-21
Cell.vue
src/components/common/Cell.vue
+10
-12
style.less
src/style.less
+25
-0
form.vue
src/view/NFT/Create/form.vue
+48
-20
pick.vue
src/view/NFT/Create/pick.vue
+1
-1
upload.vue
src/view/NFT/Create/upload.vue
+52
-14
No files found.
src/components/common/Btn.vue
View file @
0b9b6b47
<
template
>
<
template
>
<div
class=
"text-xs px-3 py-2 text-center cursor-pointer rounded my-3 flex items-center justify-center"
:class=
"disabled?'filter grayscale':'' "
@
click=
"eventEmit"
>
<div
{{
text
}}
<slot
name=
"icon-right"
></slot>
class=
"
</div>
text-xs
px-3
py-2
text-center
cursor-pointer
rounded
my-3
flex
items-center
justify-center
"
:class=
"[disabled ? 'filter grayscale' : '', loading ? ' opacity-75' : '']"
@
click=
"eventEmit"
>
{{
text
}}
<slot
name=
"icon-right"
></slot>
<Loading
type=
"spiner"
size=
"16"
class=
"ml-2"
v-if=
"loading"
/>
</div>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
from
'vue'
;
import
{
Loading
}
from
"vant"
;
import
Vue
from
"vue"
;
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
name
:
'AppIcon'
,
components
:
{
Loading
,
},
name
:
"AppIcon"
,
props
:
{
props
:
{
size
:
String
,
size
:
String
,
disabled
:
{
disabled
:
{
type
:
Boolean
,
type
:
Boolean
,
default
:
false
default
:
false
,
},
text
:
{
type
:
String
,
required
:
true
,
},
border
:
{
type
:
String
,
default
:
"border border-app-dark-4"
,
},
},
text
:
{
loading
:
{
type
:
String
,
type
:
Boolean
,
required
:
true
default
:
false
,
},
},
border
:{
type
:
String
,
default
:
'border border-app-dark-4'
}
},
},
methods
:{
methods
:
{
eventEmit
(
v
:
any
){
eventEmit
(
v
:
any
)
{
if
(
this
.
disabled
){
if
(
this
.
disabled
||
this
.
loading
)
{
return
return
;
}
this
.
$emit
(
'btnClicked'
,
v
)
}
}
this
.
$emit
(
"btnClicked"
,
v
);
},
},
},
});
});
</
script
>
</
script
>
src/components/common/Cell.vue
View file @
0b9b6b47
...
@@ -8,10 +8,16 @@
...
@@ -8,10 +8,16 @@
"
"
>
>
<div
class=
"left flex items-center"
>
<div
class=
"left flex items-center"
>
<app-icon
v-if=
"labelIcon"
:name=
"labelIcon"
size=
"18px"
></app-icon>
<div
class=
"px-2"
>
<div
class=
"px-2"
>
{{
text
}}
{{
text
}}
</div>
</div>
<app-icon
v-if=
"labelIcon"
:name=
"labelIcon"
color=
"#ED6F6F"
@
click
.
native=
"$emit('clickIcon')"
size=
"18px"
></app-icon>
</div>
</div>
<div
class=
"right flex items-center overflow-hidden"
>
<div
class=
"right flex items-center overflow-hidden"
>
<div
v-if=
"type == 'click'"
@
click=
"eventEmit(type)"
>
<div
v-if=
"type == 'click'"
@
click=
"eventEmit(type)"
>
...
@@ -51,7 +57,7 @@
...
@@ -51,7 +57,7 @@
:key=
"item.id"
:key=
"item.id"
:text=
"item.text"
:text=
"item.text"
:id=
"item.id"
:id=
"item.id"
class=
"text-sm rounded-xl text-font-white bg-app-red"
class=
"text-sm rounded-xl text-font-white bg-app-red
ml-1
"
:active=
"true"
:active=
"true"
></app-tag>
></app-tag>
<div
@
click=
"eventEmit(type)"
>
<div
@
click=
"eventEmit(type)"
>
...
@@ -82,15 +88,10 @@
...
@@ -82,15 +88,10 @@
v-if=
"name"
v-if=
"name"
class=
"overflow-hidden overflow-ellipsis"
class=
"overflow-hidden overflow-ellipsis"
id=
"copyNodeId"
id=
"copyNodeId"
:data-clipboard-text=
"name"
>
>
{{
name
}}
{{
name
}}
</div>
</div>
<div
<div
:data-clipboard-text=
"name"
ref=
"btn"
@
click=
"handleClickCopy"
>
data-clipboard-target=
"#copyNodeId"
ref=
"btn"
@
click=
"handleClickCopy"
>
<app-icon
name=
"icon-fuzhi"
size=
"18px"
></app-icon>
<app-icon
name=
"icon-fuzhi"
size=
"18px"
></app-icon>
</div>
</div>
</div>
</div>
...
@@ -165,9 +166,6 @@ export default Vue.extend({
...
@@ -165,9 +166,6 @@ export default Vue.extend({
show
:
false
,
show
:
false
,
};
};
},
},
mounted
()
{
console
.
log
(
this
.
value
,
"show value"
);
},
methods
:
{
methods
:
{
handleInput
(
e
:
any
)
{
handleInput
(
e
:
any
)
{
// const temp = this.inputValue;
// const temp = this.inputValue;
...
@@ -210,7 +208,7 @@ export default Vue.extend({
...
@@ -210,7 +208,7 @@ export default Vue.extend({
(
item
:
any
)
=>
item
.
value
===
selected
(
item
:
any
)
=>
item
.
value
===
selected
)
as
any
;
)
as
any
;
console
.
log
(
item
,
selected
);
console
.
log
(
item
,
selected
);
return
item
&&
item
.
name
return
item
&&
item
.
name
;
},
},
},
},
computed
:
{
computed
:
{
...
...
src/style.less
View file @
0b9b6b47
...
@@ -66,4 +66,28 @@ body{
...
@@ -66,4 +66,28 @@ body{
.list-scroll{
.list-scroll{
height: calc(100vh - 400px);
height: calc(100vh - 400px);
overflow-y: scroll;
overflow-y: scroll;
}
.van-dialog{
background-color: #1D2649;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #8899B3;
.van-dialog__content,.van-dialog__message, .van-dialog__message--has-title{
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #EEF1F6;
}
.van-hairline--top, .van-dialog__footer, .van-button{
background-color: #1D2649;
}
.van-button__text{
font-size: 14px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #0078FF;
}
}
}
\ No newline at end of file
src/view/NFT/Create/form.vue
View file @
0b9b6b47
...
@@ -34,14 +34,6 @@
...
@@ -34,14 +34,6 @@
class=
"text-font-white my-3"
class=
"text-font-white my-3"
@
onClick=
"what"
@
onClick=
"what"
></app-cell>
></app-cell>
<!--
<app-cell
text=
"分类"
type=
"select"
:selected=
"createNFT.categoryType"
:list=
"categoryTypes2"
class=
"text-font-white my-3"
@
cellOnChange=
"(v) => (createNFT.categoryType = v)"
></app-cell>
-->
<div>
<div>
<div
class=
"text-font-white my-2"
>
剧本简介
</div>
<div
class=
"text-font-white my-2"
>
剧本简介
</div>
<textarea
<textarea
...
@@ -89,6 +81,8 @@
...
@@ -89,6 +81,8 @@
text=
"平台存档"
text=
"平台存档"
type=
"select"
type=
"select"
:selected=
"createNFT.archives"
:selected=
"createNFT.archives"
labelIcon=
"icon-wenhao"
@
clickIcon=
"alertPlatformSave"
:list=
"archivesList"
:list=
"archivesList"
class=
"text-font-white my-3"
class=
"text-font-white my-3"
@
cellOnChange=
"(v) => (createNFT.archives = v)"
@
cellOnChange=
"(v) => (createNFT.archives = v)"
...
@@ -97,6 +91,8 @@
...
@@ -97,6 +91,8 @@
text=
"授权阅读"
text=
"授权阅读"
type=
"select"
type=
"select"
:selected=
"createNFT.grant"
:selected=
"createNFT.grant"
labelIcon=
"icon-wenhao"
@
clickIcon=
"alertAuthorizeRead"
:list=
"grantList"
:list=
"grantList"
class=
"text-font-white my-3"
class=
"text-font-white my-3"
@
cellOnChange=
"(v) => (createNFT.grant = v)"
@
cellOnChange=
"(v) => (createNFT.grant = v)"
...
@@ -112,6 +108,7 @@
...
@@ -112,6 +108,7 @@
text=
"下一步"
text=
"下一步"
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
:disabled=
"validation"
:disabled=
"validation"
:loading=
"loading2"
border=
"none"
border=
"none"
@
btnClicked=
"currentStepChange(1)"
@
btnClicked=
"currentStepChange(1)"
></app-btn>
></app-btn>
...
@@ -162,6 +159,7 @@
...
@@ -162,6 +159,7 @@
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
"none"
border=
"none"
:disabled=
"validation"
:disabled=
"validation"
:loading=
"loading3"
@
btnClicked=
"currentStepChange(1)"
@
btnClicked=
"currentStepChange(1)"
></app-btn>
></app-btn>
</div>
</div>
...
@@ -171,8 +169,9 @@
...
@@ -171,8 +169,9 @@
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Dialog
}
from
"vant"
;
import
Vue
from
"vue"
;
import
Vue
from
"vue"
;
import
{
mapState
}
from
"vuex"
;
import
{
map
Mutations
,
map
State
}
from
"vuex"
;
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
data
()
{
data
()
{
...
@@ -205,16 +204,18 @@ export default Vue.extend({
...
@@ -205,16 +204,18 @@ export default Vue.extend({
categoryTypes
:
[]
as
any
[],
categoryTypes
:
[]
as
any
[],
mySteps
:
[
mySteps
:
[
{
{
text
:
"
step1
"
,
text
:
"
基本信息
"
,
},
},
{
{
text
:
"
step2
"
,
text
:
"
加密上链
"
,
},
},
{
{
text
:
"
step3
"
,
text
:
"
NFT发行
"
,
},
},
],
],
currentStep
:
1
,
currentStep
:
1
,
loading2
:
false
,
loading3
:
false
,
};
};
},
},
components
:
{
components
:
{
...
@@ -227,6 +228,9 @@ export default Vue.extend({
...
@@ -227,6 +228,9 @@ export default Vue.extend({
const
list
=
await
this
.
$service
.
nftService
.
getCategory
();
const
list
=
await
this
.
$service
.
nftService
.
getCategory
();
this
.
categoryTypes
=
list
;
this
.
categoryTypes
=
list
;
this
.
createNFT
.
categoryType
=
(
list
.
length
!==
0
&&
list
[
0
].
id
)
||
NaN
;
this
.
createNFT
.
categoryType
=
(
list
.
length
!==
0
&&
list
[
0
].
id
)
||
NaN
;
this
.
setState
({
pickedList
:
[],
});
},
},
computed
:
{
computed
:
{
...
mapState
(
"create"
,
{
...
mapState
(
"create"
,
{
...
@@ -265,12 +269,29 @@ export default Vue.extend({
...
@@ -265,12 +269,29 @@ export default Vue.extend({
},
},
},
},
methods
:
{
methods
:
{
...
mapMutations
(
"create"
,
{
setState
:
"SET_STATE"
,
}),
setCreateNFT
(
obj
:
any
)
{
setCreateNFT
(
obj
:
any
)
{
this
.
createNFT
=
{
this
.
createNFT
=
{
...
this
.
createNFT
,
...
this
.
createNFT
,
...
obj
,
...
obj
,
};
};
},
},
alertPlatformSave
()
{
Dialog
.
alert
({
title
:
"提示"
,
message
:
`1、选择加密存档后,您的剧本将由平台审核保管,您可以授权是否给其他人查看;
2、选择不存档后,您的剧本将由自己保管,您可以通过私下发送给其他用户查看;`
,
});
},
alertAuthorizeRead
()
{
Dialog
.
alert
({
title
:
"提示"
,
message
:
`1、选择作者授权阅读,剧本需要您本人授权后方可查看;
2、选择无需授权,剧本可公开阅读。`
,
});
},
addStep
()
{
addStep
()
{
this
.
currentStep
++
;
this
.
currentStep
++
;
},
},
...
@@ -288,6 +309,7 @@ export default Vue.extend({
...
@@ -288,6 +309,7 @@ export default Vue.extend({
},
},
async
currentStepChange
(
val
:
number
)
{
async
currentStepChange
(
val
:
number
)
{
if
(
this
.
currentStep
===
2
&&
val
===
1
)
{
if
(
this
.
currentStep
===
2
&&
val
===
1
)
{
this
.
loading2
=
true
;
let
mistake
=
false
;
let
mistake
=
false
;
try
{
try
{
const
{
id
,
nftId
,
wallet
,
fileHash
}
=
const
{
id
,
nftId
,
wallet
,
fileHash
}
=
...
@@ -308,17 +330,23 @@ export default Vue.extend({
...
@@ -308,17 +330,23 @@ export default Vue.extend({
this
.
publish
.
wallet
=
wallet
;
this
.
publish
.
wallet
=
wallet
;
}
catch
(
err
)
{
}
catch
(
err
)
{
mistake
=
true
;
mistake
=
true
;
return
;
}
}
this
.
loading2
=
false
;
if
(
mistake
)
return
;
if
(
mistake
)
return
;
}
else
if
(
this
.
currentStep
===
3
&&
val
===
1
)
{
}
else
if
(
this
.
currentStep
===
3
&&
val
===
1
)
{
await
this
.
$service
.
nftService
.
publish
({
this
.
loading3
=
true
;
fileHash
:
this
.
fileHash
,
try
{
id
:
this
.
publish
.
id
,
await
this
.
$service
.
nftService
.
publish
({
wallet
:
this
.
publish
.
wallet
,
fileHash
:
this
.
fileHash
,
nftId
:
this
.
publish
.
nftId
,
id
:
this
.
publish
.
id
,
});
wallet
:
this
.
publish
.
wallet
,
this
.
$router
.
back
()
nftId
:
this
.
publish
.
nftId
,
});
this
.
$router
.
back
();
}
catch
(
err
)
{
console
.
log
(
err
);
}
this
.
loading3
=
false
;
}
}
if
(
this
.
currentStep
<
this
.
mySteps
.
length
+
1
)
{
if
(
this
.
currentStep
<
this
.
mySteps
.
length
+
1
)
{
this
.
currentStep
+=
val
;
this
.
currentStep
+=
val
;
...
...
src/view/NFT/Create/pick.vue
View file @
0b9b6b47
<
template
>
<
template
>
<Layout-Child>
<Layout-Child
class=
'page-scroll'
>
<div
class=
"pt-6"
>
<div
class=
"pt-6"
>
<div
class=
"text-font-red text-sm text-center"
>
*最多支持三个选项
</div>
<div
class=
"text-font-red text-sm text-center"
>
*最多支持三个选项
</div>
<div
class=
"grid grid-cols-3 w-11/12 mx-auto mt-6"
>
<div
class=
"grid grid-cols-3 w-11/12 mx-auto mt-6"
>
...
...
src/view/NFT/Create/upload.vue
View file @
0b9b6b47
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
ref=
"inputFile"
ref=
"inputFile"
accept=
".pdf"
accept=
".pdf"
/>
/>
<label
for=
"upload"
>
<label
for=
"upload"
class=
"inline-block"
>
<div
<div
ref=
"uploadBox"
ref=
"uploadBox"
class=
"
class=
"
...
@@ -18,26 +18,40 @@
...
@@ -18,26 +18,40 @@
flex
flex
items-center
items-center
justify-center
justify-center
mx-auto
text-font-white
text-font-white
"
"
>
>
<img
<img
v-if=
"
!fileName
"
v-if=
"
status === uploadStatus.NULL
"
src=
"@/assets/icons/upload.png"
src=
"@/assets/icons/upload.png"
alt=
""
alt=
""
class=
"mx-auto"
class=
"mx-auto"
/>
/>
<img
v-else
src=
"@/assets/icons/file.png"
alt=
""
class=
"mx-auto"
/>
<img
v-else-if=
"status === uploadStatus.success"
src=
"@/assets/icons/file.png"
alt=
""
class=
"mx-auto"
/>
<Loading
type=
"spiner"
v-else-if=
"status === uploadStatus.uploading"
/>
<div
v-else-if=
"status === uploadStatus.failed"
>
上传失败
</div>
</div>
</div>
</label>
</label>
<div
class=
"text-center text-font-white"
>
<div
class=
"text-center text-font-white"
>
<div
v-if=
"!fileName"
>
支持扩展名格式:PDF
</div>
<div
v-if=
"!fileName"
class=
"mt-2"
>
支持扩展名格式:PDF
</div>
<div
v-if=
"fileName"
>
<div
v-if=
"fileName"
class=
"mt-2"
>
{{
fileName
}}
{{
fileName
}}
</div>
</div>
<label
for=
"upload"
>
<label
for=
"upload"
class=
"mt-2"
>
<div
v-if=
"fileName"
>
重新上传
</div>
<div
v-if=
"
status === uploadStatus.failed || status === uploadStatus.success
"
style=
"color: #0076ff"
class=
"inline-block"
>
重新上传
</div>
</label>
</label>
</div>
</div>
<div
class=
"flex justify-between fixed bottom-0 left-0 right-0"
>
<div
class=
"flex justify-between fixed bottom-0 left-0 right-0"
>
...
@@ -59,17 +73,31 @@
...
@@ -59,17 +73,31 @@
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
from
"vue"
;
import
Vue
from
"vue"
;
import
{
Uploader
,
Loading
}
from
"vant"
;
import
{
mapMutations
,
mapState
}
from
"vuex"
;
import
{
mapMutations
,
mapState
}
from
"vuex"
;
enum
uploadStatus
{
NULL
,
uploading
,
failed
,
success
,
}
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
data
()
{
data
()
{
return
{};
return
{
fileList
:
[],
uploading
:
false
,
uploadStatus
,
status
:
uploadStatus
.
NULL
,
};
},
},
components
:
{
components
:
{
"Layout-Child"
:
()
=>
import
(
"@/layout/Child.vue"
),
"Layout-Child"
:
()
=>
import
(
"@/layout/Child.vue"
),
"app-btn"
:
()
=>
import
(
"@/components/common/Btn.vue"
),
"app-btn"
:
()
=>
import
(
"@/components/common/Btn.vue"
),
Uploader
,
Loading
,
},
},
computed
:
{
computed
:
{
...
mapState
(
"create"
,
[
"fileName"
]),
...
mapState
(
"create"
,
[
"fileName"
]),
...
@@ -90,17 +118,27 @@ export default Vue.extend({
...
@@ -90,17 +118,27 @@ export default Vue.extend({
}),
}),
async
afterRead
(
file
:
File
)
{
async
afterRead
(
file
:
File
)
{
try
{
try
{
this
.
status
=
uploadStatus
.
uploading
;
const
ret
=
await
this
.
$service
.
nftService
.
getMd5
(
file
);
const
ret
=
await
this
.
$service
.
nftService
.
getMd5
(
file
);
this
.
setState
({
this
.
setState
({
fileName
:
file
.
name
,
fileName
:
file
.
name
,
fileHash
:
ret
,
fileHash
:
ret
,
file
:
file
file
:
file
,
});
});
this
.
status
=
uploadStatus
.
success
;
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
err
);
this
.
status
=
uploadStatus
.
failed
;
}
}
},
},
afterRead2
(
file
:
any
)
{
file
.
status
=
"uploading"
;
file
.
message
=
"上传中..."
;
setTimeout
(()
=>
{
file
.
status
=
"failed"
;
file
.
message
=
"上传失败"
;
},
1000
);
},
},
},
});
});
</
script
>
</
script
>
...
...
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