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
4ff1271e
Commit
4ff1271e
authored
Jul 09, 2021
by
hanfeng zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
321
parent
757288fc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
199 additions
and
33 deletions
+199
-33
Btn.vue
src/components/common/Btn.vue
+1
-10
Tag.vue
src/components/common/Tag.vue
+31
-2
index.ts
src/service/index.ts
+3
-1
nftService.ts
src/service/nftService.ts
+68
-7
shimes-app.d.ts
src/shimes-app.d.ts
+2
-0
Dto.ts
src/types/Dto.ts
+2
-2
form.vue
src/view/NFT/Create/form.vue
+31
-8
pick.vue
src/view/NFT/Create/pick.vue
+61
-3
No files found.
src/components/common/Btn.vue
View file @
4ff1271e
...
@@ -31,16 +31,7 @@ export default Vue.extend({
...
@@ -31,16 +31,7 @@ export default Vue.extend({
this
.
$emit
(
'btnClicked'
,
v
)
this
.
$emit
(
'btnClicked'
,
v
)
}
}
},
},
computed
:{
getSize
(){
switch
(
this
.
size
)
{
case
'full'
:
return
'w-full'
default
:
return
'w-20'
;
}
}
}
});
});
</
script
>
</
script
>
src/components/common/Tag.vue
View file @
4ff1271e
<
template
>
<
template
>
<div
class=
'tag flex text-2xs px-3 py-1 bg-app-red rounded-md'
>
<div
class=
'tag flex justify-center text-2xs px-3 py-1 rounded-md'
:class=
"tagActive?'bg-opacity-0 border':''"
@
click=
"tagOnclick"
>
{{
text
}}
{{
text
}}
</div>
</div>
</
template
>
</
template
>
...
@@ -9,14 +12,40 @@ import Vue from 'vue';
...
@@ -9,14 +12,40 @@ import Vue from 'vue';
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
name
:
'AppTag'
,
name
:
'AppTag'
,
props
:
{
props
:
{
size
:
String
,
disabled
:
{
disabled
:
{
type
:
Boolean
,
type
:
Boolean
,
default
:
false
default
:
false
},
},
id
:{
type
:
Number
,
required
:
true
},
text
:{
text
:{
type
:
String
,
type
:
String
,
required
:
true
required
:
true
},
active
:
{
type
:
Boolean
,
default
:
false
}
},
data
(){
return
{
tagActive
:
this
.
active
}
},
methods
:{
tagOnclick
(){
console
.
log
(
this
.
disabled
);
if
(
this
.
disabled
===
false
){
this
.
tagActive
=
!
this
.
tagActive
;
this
.
$emit
(
'onclick'
,
{
id
:
this
.
id
,
text
:
this
.
text
,
picked
:
!
this
.
tagActive
})
}
}
}
},
},
...
...
src/service/index.ts
View file @
4ff1271e
import
{
NFTService
}
from
'./nftService'
import
{
UserService
}
from
'./userService'
import
{
UserService
}
from
'./userService'
...
@@ -5,7 +6,8 @@ export default{
...
@@ -5,7 +6,8 @@ export default{
install
(
Vue
:
any
)
install
(
Vue
:
any
)
{
{
Vue
.
prototype
.
$service
=
{
Vue
.
prototype
.
$service
=
{
userService
:
new
UserService
()
userService
:
new
UserService
(),
nftService
:
new
NFTService
()
}
}
}
}
}
}
...
...
src/service/nftService.ts
View file @
4ff1271e
...
@@ -2,12 +2,14 @@
...
@@ -2,12 +2,14 @@
import
{
Service
}
from
'./Service'
import
{
Service
}
from
'./Service'
import
{
NFT_CREATE
}
from
'@/types/Dto'
import
{
NFT_CREATE
}
from
'@/types/Dto'
import
{
token
}
from
'@/util/userInfoUtils'
import
{
token
}
from
'@/util/userInfoUtils'
export
class
User
Service
extends
Service
{
export
class
NFT
Service
extends
Service
{
router
=
{
router
=
{
create
:{
path
:
'/nft/publish'
},
create
:{
path
:
'/nft/publish'
},
getList
:{
path
:
'/nft/generateNftId'
,
dataType
:
'application/x-www-form-urlencoded'
},
getMyList
:{
path
:
'/nft/list/current'
,
dataType
:
'application/x-www-form-urlencoded'
},
isRegisterd
:{
path
:
'/user/isRegister'
,
dataType
:
'application/x-www-form-urlencoded'
},
getList
:{
path
:
'/nft/list'
,
dataType
:
'application/x-www-form-urlencoded'
},
isPwdSet
:{
path
:
'/user/isSetPassword'
,
dataType
:
'application/x-www-form-urlencoded'
},
genId
:{
path
:
'/nft/generateNftId'
,
dataType
:
'application/x-www-form-urlencoded'
},
detail
:{
path
:
'/nft/get/{id}'
,
dataType
:
'application/x-www-form-urlencoded'
},
themes
:{
path
:
'/label/list'
,
dataType
:
'application/x-www-form-urlencoded'
}
}
}
auth
=
'Bearer '
+
token
.
getToken
()
auth
=
'Bearer '
+
token
.
getToken
()
constructor
(){
constructor
(){
...
@@ -27,18 +29,77 @@ export class UserService extends Service {
...
@@ -27,18 +29,77 @@ export class UserService extends Service {
})
})
}
}
/**
*
* @returns 获取剧目主题表
*/
async
getThemeList
(){
return
await
this
.
service
.
get
(
this
.
router
.
themes
.
path
,{
headers
:{
"Authorization"
:
this
.
auth
,
"Content-Type"
:
this
.
router
.
themes
.
dataType
}
})
}
/**
* 获取我的NFT列表
* @param categoryId
* @returns
*/
async
getMyList
(
categoryId
?:
number
){
return
await
this
.
service
.
get
(
this
.
router
.
getMyList
.
path
,{
headers
:{
"Authorization"
:
this
.
auth
,
"Content-Type"
:
this
.
router
.
getMyList
.
dataType
},
params
:{
"categoryId"
:
categoryId
?
categoryId
:
null
}
})
}
/**
/**
* 获取NFT编号
* 获取所有NFT的列表
* @param pageNum
* @param pageSize
* @param categoryId
* @param categoryId
* @returns
* @returns
*/
*/
async
getList
(
categoryId
:
number
){
async
getList
(
pageNum
?:
number
,
pageSize
?:
number
,
categoryId
?
:
number
){
return
await
this
.
service
.
get
(
this
.
router
.
getList
.
path
,{
return
await
this
.
service
.
get
(
this
.
router
.
getList
.
path
,{
headers
:{
"Content-Type"
:
this
.
router
.
getList
.
dataType
},
headers
:{
"Authorization"
:
this
.
auth
,
"Content-Type"
:
this
.
router
.
getList
.
dataType
},
params
:{
"categoryId"
:
categoryId
?
categoryId
:
null
,
"pageNum"
:
pageNum
,
'pageSize'
:
pageSize
}
})
}
/**
* 生成id
* @param categoryId
* @returns
*/
async
generateNftId
(
categoryId
:
number
){
return
await
this
.
service
.
get
(
this
.
router
.
genId
.
path
,{
headers
:{
"Authorization"
:
this
.
auth
,
"Content-Type"
:
this
.
router
.
genId
.
dataType
},
params
:{
"categoryId"
:
categoryId
}
params
:{
"categoryId"
:
categoryId
}
})
})
}
}
/**
* 按照id查找nft详情
* @param id
*/
async
detail
(
id
:
number
){
return
await
this
.
service
.
get
(
this
.
router
.
detail
.
path
,{
headers
:{
"Authorization"
:
this
.
auth
,
"Content-Type"
:
this
.
router
.
detail
.
dataType
},
params
:{
"id"
:
id
}
})
}
}
}
src/shimes-app.d.ts
View file @
4ff1271e
import
Vue
from
'vue'
import
Vue
from
'vue'
import
{
Service
}
from
'./service/index'
import
{
Service
}
from
'./service/index'
import
{
NFTService
}
from
'./service/nftService'
import
{
UserService
}
from
'./service/userService'
import
{
UserService
}
from
'./service/userService'
import
{
UTIL_INTERFACE
}
from
'@/util/util.types'
import
{
UTIL_INTERFACE
}
from
'@/util/util.types'
import
VueRouter
,
{
Route
}
from
'vue-router'
import
VueRouter
,
{
Route
}
from
'vue-router'
interface
ServiceType
{
interface
ServiceType
{
userService
:
UserService
userService
:
UserService
nftService
:
NFTService
}
}
...
...
src/types/Dto.ts
View file @
4ff1271e
...
@@ -39,4 +39,5 @@ export interface NFT_CREATE{
...
@@ -39,4 +39,5 @@ export interface NFT_CREATE{
*/
*/
theme
:
string
theme
:
string
isGrant
?:
number
isGrant
?:
number
}
}
\ No newline at end of file
src/view/NFT/Create/form.vue
View file @
4ff1271e
...
@@ -5,15 +5,15 @@
...
@@ -5,15 +5,15 @@
</div>
</div>
<div
class=
"w-11/12 mx-auto"
>
<div
class=
"w-11/12 mx-auto"
>
<div
class=
"step-one"
v-if=
"currentStep==1"
>
<div
class=
"step-one"
v-if=
"currentStep==1"
>
<app-cell
v-model=
"value_name"
type=
"input"
text=
'剧本名称'
class=
"text-font-white my-3"
@
cellOnChange=
"getValue"
></app-cell>
<app-cell
v-model=
"
createNFT.
value_name"
type=
"input"
text=
'剧本名称'
class=
"text-font-white my-3"
@
cellOnChange=
"getValue"
></app-cell>
<app-cell
v-model=
"value_publisher"
type=
"input"
text=
'发行人'
class=
"text-font-white my-3"
@
cellOnChange=
"getValue"
></app-cell>
<app-cell
v-model=
"
createNFT.
value_publisher"
type=
"input"
text=
'发行人'
class=
"text-font-white my-3"
@
cellOnChange=
"getValue"
></app-cell>
<app-cell
:pickValue=
"mySteps"
type=
"pick"
text=
'剧本题材'
class=
"text-font-white my-3"
@
onClick=
"what"
></app-cell>
<app-cell
:pickValue=
"mySteps"
type=
"pick"
text=
'剧本题材'
class=
"text-font-white my-3"
@
onClick=
"what"
></app-cell>
<div>
<div>
<div
class=
"text-font-white my-2"
>
剧本简介
</div>
<div
class=
"text-font-white my-2"
>
剧本简介
</div>
<textarea
name=
"des"
id=
"nft-des"
cols=
"30"
rows=
"10"
class=
" w-full bg-font-gray bg-opacity-20 text-font-white p-3 text-sm"
></textarea>
<textarea
v-model=
"createNFT.value_des"
name=
"des"
id=
"nft-des"
cols=
"30"
rows=
"10"
class=
" w-full bg-font-gray bg-opacity-20 text-font-white p-3 text-sm"
></textarea>
</div>
</div>
<div
class=
"fixed bottom-0 w-full left-0 z-30"
>
<div
class=
"fixed bottom-0 w-full left-0 z-30"
>
<app-btn
text=
"下一步"
class=
"w-11/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
@
btnClicked=
'currentStepChange(1)'
></app-btn>
<app-btn
text=
"下一步"
class=
"w-11/12 mx-auto text-font-white rounded-2xl bg-font-blue"
:disabled=
"validation"
border=
'none'
@
btnClicked=
'currentStepChange(1)'
></app-btn>
</div>
</div>
</div>
</div>
<div
class=
"step-two"
v-if=
"currentStep==2"
>
<div
class=
"step-two"
v-if=
"currentStep==2"
>
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<app-cell
text=
'授权阅读'
class=
"text-font-white my-3"
@
cellOnChange=
"getValue"
></app-cell>
<app-cell
text=
'授权阅读'
class=
"text-font-white my-3"
@
cellOnChange=
"getValue"
></app-cell>
<div
class=
"fixed bottom-0 w-full left-0 flex flex-row z-30"
>
<div
class=
"fixed bottom-0 w-full left-0 flex flex-row z-30"
>
<app-btn
text=
"上一步"
class=
" w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
@
btnClicked=
'currentStepChange(-1)'
></app-btn>
<app-btn
text=
"上一步"
class=
" w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
@
btnClicked=
'currentStepChange(-1)'
></app-btn>
<app-btn
text=
"下一步"
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
@
btnClicked=
'currentStepChange(1)'
></app-btn>
<app-btn
text=
"下一步"
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
:disabled=
"validation"
border=
'none'
@
btnClicked=
'currentStepChange(1)'
></app-btn>
</div>
</div>
</div>
</div>
<div
class=
"step-three"
v-if=
"currentStep==3"
>
<div
class=
"step-three"
v-if=
"currentStep==3"
>
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
<app-cell
text=
'数量'
class=
"text-font-white my-3"
@
cellOnChange=
"getValue"
></app-cell>
<app-cell
text=
'数量'
class=
"text-font-white my-3"
@
cellOnChange=
"getValue"
></app-cell>
<div
class=
"fixed bottom-0 w-full left-0 flex flex-row z-30"
>
<div
class=
"fixed bottom-0 w-full left-0 flex flex-row z-30"
>
<app-btn
text=
"上一步"
class=
" w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
@
btnClicked=
'currentStepChange(-1)'
></app-btn>
<app-btn
text=
"上一步"
class=
" w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
@
btnClicked=
'currentStepChange(-1)'
></app-btn>
<app-btn
text=
"发行NFT"
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
@
btnClicked=
'currentStepChange(1)'
></app-btn>
<app-btn
text=
"发行NFT"
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
:disabled=
"validation"
@
btnClicked=
'currentStepChange(1)'
></app-btn>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -46,8 +46,18 @@ import Vue from 'vue';
...
@@ -46,8 +46,18 @@ import Vue from 'vue';
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
data
(){
data
(){
return
{
return
{
value_name
:
''
,
createNFT
:{
value_publisher
:
''
,
value_name
:
''
,
value_publisher
:
''
,
value_picker
:[],
value_des
:
''
},
// validation:{
// step_one:true,
// step_two:true,
// step_three:true
// },
mySteps
:[
mySteps
:[
{
{
text
:
'step1'
text
:
'step1'
...
@@ -68,6 +78,19 @@ export default Vue.extend({
...
@@ -68,6 +78,19 @@ export default Vue.extend({
'app-cell'
:()
=>
import
(
'@/components/common/Cell.vue'
),
'app-cell'
:()
=>
import
(
'@/components/common/Cell.vue'
),
'app-btn'
:()
=>
import
(
'@/components/common/Btn.vue'
)
'app-btn'
:()
=>
import
(
'@/components/common/Btn.vue'
)
},
},
computed
:{
validation
:
function
(){
let
disabled
=
true
const
{
value_name
,
value_publisher
}
=
this
.
createNFT
if
(
this
.
currentStep
===
1
){
if
(
value_name
&&
value_publisher
){
disabled
=
false
}
disabled
=
true
}
return
disabled
}
},
methods
:{
methods
:{
addStep
(){
addStep
(){
this
.
currentStep
++
this
.
currentStep
++
...
...
src/view/NFT/Create/pick.vue
View file @
4ff1271e
<
template
>
<
template
>
<Layout-Child>
<Layout-Child>
dfdf
<div
class=
"pt-6"
>
<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=
"box px-5 py-3"
v-for=
"(i,index) in serviceData"
:key=
"index"
>
<app-tag
:text=
'i.name'
class=
"text-sm rounded-xl text-font-white bg-app-red"
:active=
'isTagActived(i.id)'
@
onclick=
'tagOnclick'
:id=
'i.id'
></app-tag>
</div>
</div>
<div
class=
"fixed bottom-0 w-full left-0 flex flex-row z-30"
>
<app-btn
text=
"取消"
class=
" w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
></app-btn>
<app-btn
text=
"确认"
class=
"w-5/12 mx-auto text-font-white rounded-2xl bg-font-blue"
border=
'none'
:disabled=
'pickValid'
></app-btn>
</div>
</div>
</Layout-Child>
</Layout-Child>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
{
remove
as
_remove
}
from
'lodash'
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
data
(){
return
{
picked
:[]
as
Array
<
{
id
:
number
,
text
:
string
}
>
,
serviceData
:{},
pickValid
:
true
}
},
async
mounted
(){
this
.
serviceData
=
await
this
.
$service
.
nftService
.
getThemeList
()
},
components
:{
components
:{
'Layout-Child'
:()
=>
import
(
'@/layout/Child.vue'
)
'Layout-Child'
:()
=>
import
(
'@/layout/Child.vue'
),
'app-tag'
:()
=>
import
(
'@/components/common/Tag.vue'
),
'app-btn'
:()
=>
import
(
'@/components/common/Btn.vue'
)
},
methods
:
{
tagOnclick
(
item
:
any
){
if
(
this
.
picked
.
includes
(
item
.
id
)){
_remove
(
this
.
picked
,(
i
)
=>
{
return
i
===
item
.
id
;
})
console
.
log
(
this
.
picked
,
'remove'
);
return
}
this
.
picked
.
push
(
item
.
id
)
}
},
},
computed
:{
isTagDisabled
(){
const
that
=
this
;
return
function
(
id
:
any
){
const
exist
=
that
.
picked
.
includes
(
id
)
if
(
that
.
picked
.
length
>
2
||
exist
){
return
true
}
return
false
}
},
isTagActived
(){
const
that
=
this
return
function
(
id
:
any
){
if
(
that
.
picked
.
includes
(
id
)){
return
false
}
return
true
}
}
}
});
});
</
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