Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
traceSourceMb
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
yanyanhong
traceSourceMb
Commits
1d5275b2
Commit
1d5275b2
authored
Sep 30, 2020
by
yyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
隐私设置
parent
a046ab61
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
195 additions
and
128 deletions
+195
-128
constants.ts
src/const/constants.ts
+4
-11
proof.ts
src/mixins/proof.ts
+165
-0
Index.vue
src/views/proof/Index.vue
+26
-117
No files found.
src/const/constants.ts
View file @
1d5275b2
import
{
ChainStatus
}
from
'./enum'
;
import
{
ChainStatus
}
from
'./enum'
;
export
const
ActionList
=
{
blockChain
:
{
key
:
'blockChain'
,
icon
:
'shanglian1'
,
text
:
'上链'
},
edit
:
{
key
:
'edit'
,
icon
:
'bianji1'
,
text
:
'编辑'
},
del
:
{
key
:
'del'
,
icon
:
'shanchu3'
,
text
:
'删除'
},
copy
:
{
key
:
'copy'
,
icon
:
'fuzhi1'
,
text
:
'复制'
},
blockquery
:
{
key
:
'blockquery'
,
icon
:
'qukuailianchaxun'
,
text
:
'区块链查询'
},
copyhash
:
{
key
:
'copyhash'
,
icon
:
'fuzhiHashdizhi'
,
text
:
'复制hash地址'
},
del2
:
{
key
:
'del2'
,
icon
:
'shanchu3'
,
text
:
'删除'
},
zengliang
:
{
key
:
'zengliang'
,
icon
:
'zenglianggengxin2'
,
text
:
'增量'
},
};
export
const
ChainStatusStr
:
any
=
{
export
const
ChainStatusStr
:
any
=
{
[
ChainStatus
.
NONE
]:
'未上链'
,
[
ChainStatus
.
NONE
]:
'未上链'
,
[
ChainStatus
.
CHAINING
]:
'上链中'
,
[
ChainStatus
.
CHAINING
]:
'上链中'
,
[
ChainStatus
.
SUCCESS
]:
'已上链'
,
[
ChainStatus
.
SUCCESS
]:
'已上链'
,
[
ChainStatus
.
FAILURE
]:
'上链失败'
,
[
ChainStatus
.
FAILURE
]:
'上链失败'
,
};
[
ChainStatus
.
HIDING
]:
'隐藏中'
,
[
ChainStatus
.
HIDED
]:
'已隐藏'
,
[
ChainStatus
.
HIDEFAILURE
]:
'隐藏失败'
,
};
export
const
menu
=
[
export
const
menu
=
[
{
{
text
:
'首页'
,
text
:
'首页'
,
...
...
src/mixins/proof.ts
0 → 100644
View file @
1d5275b2
import
{
Component
,
Vue
,
Inject
}
from
'vue-property-decorator'
;
import
{
ChainStatus
}
from
'@/const/enum'
;
@
Component
export
default
class
Proof
extends
Vue
{
@
Inject
(
'goToBrowser'
)
protected
goToBrowser
!
:
(
proof
:
any
)
=>
void
;
protected
baseProof
:
any
=
''
;
protected
preProof
:
any
=
''
;
protected
isZengliang
:
boolean
=
false
;
protected
showAddProof
:
boolean
=
false
;
protected
ActionList
:
any
=
{
blockChain
:
{
key
:
'blockChain'
,
icon
:
'shanglian1'
,
text
:
'上链'
,
callback
:
this
.
blockChainProof
,
},
edit
:
{
key
:
'edit'
,
icon
:
'bianji1'
,
text
:
'编辑'
,
callback
:
this
.
goProofDetail
,
},
del
:
{
key
:
'del'
,
icon
:
'shanchu3'
,
text
:
'删除'
,
callback
:
this
.
delProof
,
},
copy
:
{
key
:
'copy'
,
icon
:
'fuzhi1'
,
text
:
'复制'
,
callback
:
this
.
copyProof
,
},
blockquery
:
{
key
:
'blockquery'
,
icon
:
'qukuailianchaxun'
,
text
:
'区块链查询'
,
callback
:
this
.
goToBrowser
,
},
copyhash
:
{
key
:
'copyhash'
,
icon
:
'fuzhiHashdizhi'
,
text
:
'复制hash地址'
,
callback
:
this
.
copyHash
,
},
del2
:
{
key
:
'del2'
,
icon
:
'shanchu3'
,
text
:
'删除'
,
callback
:
this
.
abandonProof
,
},
zengliang
:
{
key
:
'zengliang'
,
icon
:
'zenglianggengxin2'
,
text
:
'增量'
,
callback
:
this
.
increment
,
},
hide
:
{
key
:
'hide'
,
icon
:
'zenglianggengxin2'
,
text
:
'隐私设置'
,
callback
:
this
.
hide
,
},
};
protected
resetList
()
{
throw
Error
(
'resetList 在列表实现'
);
}
private
abandonProof
(
proof
:
any
)
{
const
{
id
:
proofId
}
=
proof
;
this
.
$confirmdel
().
then
((
res
:
any
)
=>
{
this
.
$api
.
proof
.
abandon
(
proofId
,
'暂无原因'
).
then
(()
=>
{
this
.
$toast
.
success
(
'已放入回收站'
);
this
.
resetList
();
});
});
}
private
blockChainProof
(
proof
:
any
)
{
this
.
$confirmchain
().
then
((
res
:
any
)
=>
{
this
.
$api
.
proof
.
sendBlockChian
(
proof
.
id
).
then
(()
=>
{
this
.
$toast
.
success
(
'提交上链成功'
);
this
.
resetList
();
}).
catch
((
err
:
any
)
=>
{
if
(
err
.
code
===
10811
)
{
this
.
$dialog
.
confirm
({
title
:
'提示'
,
message
:
'您还未认证,请先认证后在进行上链'
,
confirmButtonText
:
'去认证'
,
cancelButtonText
:
'取消'
,
}).
then
(()
=>
{
this
.
$router
.
push
({
name
:
'Auth'
});
});
}
});
});
}
private
goProofDetail
(
proof
:
any
)
{
const
toBlockStatuss
:
ChainStatus
[]
=
[
ChainStatus
.
SUCCESS
,
ChainStatus
.
HIDED
,
ChainStatus
.
HIDING
,
ChainStatus
.
HIDEFAILURE
,
];
if
(
toBlockStatuss
.
includes
(
proof
.
status
)
)
{
this
.
goToBrowser
(
proof
);
}
else
{
this
.
$router
.
push
({
name
:
'ProofDetail'
,
query
:
{
proofId
:
proof
.
id
}});
}
}
private
async
copyProof
(
proof
:
any
)
{
await
this
.
$api
.
proof
.
add
(
proof
.
name
,
JSON
.
parse
(
proof
.
detail
),
proof
.
note
);
this
.
$toast
.
success
(
'复制成功'
);
this
.
resetList
();
}
private
async
reName
(
proof
:
any
)
{
this
.
$toast
(
'重命名成功'
);
}
private
delProof
(
proof
:
any
)
{
const
{
id
:
proofId
}
=
proof
;
this
.
$dialog
.
confirm
({
title
:
'提示'
,
message
:
'删除后,信息无法找回,确定要删除吗?'
,
beforeClose
:
(
action
,
done
)
=>
{
if
(
action
===
'confirm'
)
{
this
.
$api
.
proof
.
delete
(
proofId
).
then
((
res
:
any
)
=>
{
this
.
$toast
.
success
(
'删除成功'
);
this
.
resetList
();
done
();
}).
catch
((
err
:
any
)
=>
{
done
();
});
}
else
{
done
();
}
},
});
}
private
copyHash
(
proof
:
any
)
{
this
.
$copyText
(
proof
.
hash
);
this
.
$toast
(
'hash地址复制成功'
);
}
private
async
increment
(
proof
:
any
)
{
const
{
increment_num
,
hash
}
=
proof
;
if
(
increment_num
>
0
)
{
const
{
results
}
=
await
this
.
$api
.
proof
.
incrementList
(
hash
);
const
preProof
=
results
[
0
];
if
(
!
preProof
.
hash
)
{
this
.
$toast
(
'请先上链上一条存证'
);
return
Promise
.
reject
(
'请先上链上一条存证'
);
}
this
.
preProof
=
preProof
;
}
else
{
this
.
preProof
=
proof
;
}
this
.
baseProof
=
proof
;
this
.
showAddProof
=
true
;
this
.
isZengliang
=
true
;
}
private
hide
(
proofId
:
number
)
{
this
.
$api
.
proof
.
deleteBlockChainProof
(
proofId
).
then
(()
=>
{
this
.
$toast
(
'隐藏成功'
);
this
.
resetList
();
});
}
}
src/views/proof/Index.vue
View file @
1d5275b2
...
@@ -41,7 +41,9 @@
...
@@ -41,7 +41,9 @@
:key=
"index"
:key=
"index"
icon=
"photo-o"
icon=
"photo-o"
:text=
"currentProof.status === ChainStatus.FAILURE && item.text === '上链' ? `重新$
{item.text}`:`${item.text}`"
:text=
"currentProof.status === ChainStatus.FAILURE && item.text === '上链' ? `重新$
{item.text}`:`${item.text}`"
@click="select(item.key)">
@click="callbackAction(item.callback)"
>
<!-- @click="select(item.key)" -->
<template
#
icon
>
<template
#
icon
>
<common-svg
:name=
"item.icon"
width=
"44px"
height=
"44px"
></common-svg>
<common-svg
:name=
"item.icon"
width=
"44px"
height=
"44px"
></common-svg>
</
template
>
</
template
>
...
@@ -69,10 +71,11 @@
...
@@ -69,10 +71,11 @@
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Component
,
Prop
,
Vue
,
Inject
}
from
'vue-property-decorator'
;
import
{
Component
,
Prop
,
Vue
,
Inject
,
Mixins
}
from
'vue-property-decorator'
;
import
{
List
,
Popup
,
Button
,
Image
,
Picker
,
Grid
,
GridItem
,
Empty
,
Dialog
}
from
'vant'
;
import
{
List
,
Popup
,
Button
,
Image
,
Picker
,
Grid
,
GridItem
,
Empty
,
Dialog
}
from
'vant'
;
import
{
ChainStatus
}
from
'@/const/enum'
;
import
{
ChainStatus
}
from
'@/const/enum'
;
import
{
ActionList
,
ChainStatusStr
}
from
'@/const/constants'
;
import
{
ChainStatusStr
}
from
'@/const/constants'
;
import
MixinProof
from
'@/mixins/proof.ts'
;
import
SelectTemplate
from
'@/views/template/components/SelectTemplate.vue'
;
import
SelectTemplate
from
'@/views/template/components/SelectTemplate.vue'
;
import
PreviewTemplate
from
'@/views/template/components/PreviewTemplate.vue'
;
import
PreviewTemplate
from
'@/views/template/components/PreviewTemplate.vue'
;
import
AddFolder
from
'@/views/template/components/AddFolder.vue'
;
import
AddFolder
from
'@/views/template/components/AddFolder.vue'
;
...
@@ -94,10 +97,9 @@ import AddBaseinfo from './components/AddBaseinfo.vue';
...
@@ -94,10 +97,9 @@ import AddBaseinfo from './components/AddBaseinfo.vue';
AddBaseinfo
,
AddBaseinfo
,
},
},
})
})
export
default
class
Index
extends
Vue
{
export
default
class
Index
extends
Mixins
(
MixinProof
)
{
@
Inject
(
'isSy'
)
private
isSy
!
:
boolean
;
@
Inject
(
'isSy'
)
private
isSy
!
:
boolean
;
@
Inject
(
'goToBrowser'
)
private
goToBrowser
!
:
(
proof
:
any
)
=>
void
;
private
show
:
boolean
=
false
;
private
show
:
boolean
=
false
;
private
showFilterPicker
:
boolean
=
false
;
private
showFilterPicker
:
boolean
=
false
;
private
columns
:
any
[]
=
[{
text
:
'全部'
,
status
:
[]}];
private
columns
:
any
[]
=
[{
text
:
'全部'
,
status
:
[]}];
...
@@ -118,17 +120,24 @@ export default class Index extends Vue {
...
@@ -118,17 +120,24 @@ export default class Index extends Vue {
private
detail
:
any
=
{};
private
detail
:
any
=
{};
private
showAddFolder
:
boolean
=
false
;
private
showAddFolder
:
boolean
=
false
;
private
showAddProof
:
boolean
=
false
;
private
proofName
:
string
=
''
;
private
proofName
:
string
=
''
;
private
templateInfo
:
any
=
{
private
templateInfo
:
any
=
{
id
:
''
,
id
:
''
,
name
:
''
,
name
:
''
,
};
};
protected
resetList
()
{
private
baseProof
:
any
=
''
;
this
.
total
=
0
;
private
preProof
:
any
=
''
;
this
.
list
=
[];
private
isZengliang
:
boolean
=
false
;
this
.
finished
=
false
;
this
.
page
=
1
;
this
.
loading
=
true
;
this
.
getList
();
}
private
callbackAction
(
cb
:
any
)
{
cb
.
call
(
this
,
this
.
currentProof
);
this
.
show
=
false
;
}
private
async
addProofHandler
()
{
private
async
addProofHandler
()
{
const
{
name
}
=
this
.
templateInfo
;
const
{
name
}
=
this
.
templateInfo
;
if
(
!
name
)
{
if
(
!
name
)
{
...
@@ -170,29 +179,18 @@ export default class Index extends Vue {
...
@@ -170,29 +179,18 @@ export default class Index extends Vue {
return
ChainStatus
;
return
ChainStatus
;
}
}
get
actionList
()
{
get
actionList
()
{
const
{
blockChain
,
edit
,
del
,
del2
,
copy
,
blockquery
,
copyhash
,
zengliang
}
=
ActionList
;
const
{
blockChain
,
edit
,
del
,
del2
,
copy
,
blockquery
,
copyhash
,
zengliang
,
hide
}
=
this
.
ActionList
;
const
obj
:
any
=
{
const
obj
:
any
=
{
[
ChainStatus
.
NONE
]:
[
blockChain
,
edit
,
copy
,
del
],
[
ChainStatus
.
NONE
]:
[
blockChain
,
edit
,
copy
,
del
],
[
ChainStatus
.
CHAINING
]:
[
copy
],
[
ChainStatus
.
CHAINING
]:
[
copy
],
[
ChainStatus
.
SUCCESS
]:
[
blockquery
,
copyhash
,
del2
,
zengliang
],
[
ChainStatus
.
SUCCESS
]:
[
blockquery
,
copyhash
,
del2
,
zengliang
,
hide
],
[
ChainStatus
.
FAILURE
]:
[
blockChain
,
edit
,
copy
,
del
],
[
ChainStatus
.
FAILURE
]:
[
blockChain
,
edit
,
copy
,
del
],
[
ChainStatus
.
HIDING
]:
[
blockquery
,
copyhash
,
copy
],
[
ChainStatus
.
HIDED
]:
[
copy
],
[
ChainStatus
.
HIDEFAILURE
]:
[
blockquery
,
copyhash
,
copy
,
hide
],
};
};
return
obj
[
this
.
currentProof
.
status
];
return
obj
[
this
.
currentProof
.
status
];
}
}
private
select
(
type
:
string
)
{
const
obj
:
any
=
{
blockChain
:
()
=>
{
this
.
blockChainProof
(
this
.
currentProof
);
},
edit
:
()
=>
{
this
.
goProofDetail
(
this
.
currentProof
);
},
del
:
()
=>
{
this
.
delProof
(
this
.
currentProof
.
id
);
},
copy
:
()
=>
{
this
.
copyProof
(
this
.
currentProof
);
},
blockquery
:
()
=>
{
this
.
goToBrowser
(
this
.
currentProof
);
},
copyhash
:
()
=>
{
this
.
copyHash
(
this
.
currentProof
);
},
del2
:
()
=>
{
this
.
abandonProof
(
this
.
currentProof
.
id
);
},
zengliang
:
()
=>
{
this
.
increment
(
this
.
currentProof
);
},
};
this
.
show
=
false
;
obj
[
type
]();
}
private
async
getList
()
{
private
async
getList
()
{
const
{
chainStatus
}
=
this
;
const
{
chainStatus
}
=
this
;
const
params
=
{
const
params
=
{
...
@@ -225,13 +223,6 @@ export default class Index extends Vue {
...
@@ -225,13 +223,6 @@ export default class Index extends Vue {
preProof
:
JSON
.
stringify
(
preProof
),
preProof
:
JSON
.
stringify
(
preProof
),
baseProof
:
JSON
.
stringify
(
baseProof
)
}});
baseProof
:
JSON
.
stringify
(
baseProof
)
}});
}
}
private
goProofDetail
(
proof
:
any
)
{
if
([
ChainStatus
.
SUCCESS
].
includes
(
proof
.
status
)
)
{
this
.
goToBrowser
(
proof
);
}
else
{
this
.
$router
.
push
({
name
:
'ProofDetail'
,
query
:
{
proofId
:
proof
.
id
}});
}
}
private
showMoreAction
(
data
:
any
)
{
private
showMoreAction
(
data
:
any
)
{
this
.
show
=
true
;
this
.
show
=
true
;
this
.
currentProof
=
data
;
this
.
currentProof
=
data
;
...
@@ -241,89 +232,7 @@ export default class Index extends Vue {
...
@@ -241,89 +232,7 @@ export default class Index extends Vue {
this
.
resetList
();
this
.
resetList
();
this
.
showFilterPicker
=
false
;
this
.
showFilterPicker
=
false
;
}
}
private
resetList
()
{
this
.
total
=
0
;
this
.
list
=
[];
this
.
finished
=
false
;
this
.
page
=
1
;
this
.
loading
=
true
;
this
.
getList
();
}
private
delProof
(
proofId
:
number
)
{
this
.
$dialog
.
confirm
({
title
:
'提示'
,
message
:
'删除后,信息无法找回,确定要删除吗?'
,
beforeClose
:
(
action
,
done
)
=>
{
if
(
action
===
'confirm'
)
{
this
.
$api
.
proof
.
delete
(
proofId
).
then
((
res
:
any
)
=>
{
this
.
$toast
.
success
(
'删除成功'
);
this
.
resetList
();
done
();
}).
catch
((
err
:
any
)
=>
{
done
();
});
}
else
{
done
();
}
},
});
}
private
abandonProof
(
proofId
:
number
)
{
this
.
$confirmdel
().
then
((
res
:
any
)
=>
{
this
.
$api
.
proof
.
abandon
(
proofId
,
'暂无原因'
).
then
(()
=>
{
this
.
$toast
.
success
(
'已放入回收站'
);
this
.
resetList
();
});
});
}
private
blockChainProof
(
proof
:
any
)
{
this
.
$confirmchain
().
then
((
res
:
any
)
=>
{
this
.
$api
.
proof
.
sendBlockChian
(
proof
.
id
).
then
(()
=>
{
this
.
$toast
.
success
(
'提交上链成功'
);
this
.
resetList
();
}).
catch
((
err
:
any
)
=>
{
if
(
err
.
code
===
10811
)
{
this
.
$dialog
.
confirm
({
title
:
'提示'
,
message
:
'您还未认证,请先认证后在进行上链'
,
confirmButtonText
:
'去认证'
,
cancelButtonText
:
'取消'
,
}).
then
(()
=>
{
this
.
$router
.
push
({
name
:
'Auth'
});
});
}
});
});
}
private
async
copyProof
(
proof
:
any
)
{
await
this
.
$api
.
proof
.
add
(
proof
.
name
,
JSON
.
parse
(
proof
.
detail
),
proof
.
note
);
this
.
$toast
.
success
(
'复制成功'
);
this
.
resetList
();
}
private
async
reName
(
proof
:
any
)
{
this
.
$toast
(
'重命名成功'
);
}
private
copyHash
(
proof
:
any
)
{
this
.
$copyText
(
proof
.
hash
);
this
.
$toast
(
'hash地址复制成功'
);
}
private
async
increment
(
proof
:
any
)
{
const
{
increment_num
}
=
proof
;
if
(
increment_num
>
0
)
{
const
{
results
}
=
await
this
.
$api
.
proof
.
incrementList
(
this
.
currentProof
.
hash
);
const
preProof
=
results
[
0
];
if
(
!
preProof
.
hash
)
{
this
.
$toast
(
'请先上链上一条存证'
);
return
Promise
.
reject
(
'请先上链上一条存证'
);
}
this
.
preProof
=
preProof
;
}
else
{
this
.
preProof
=
proof
;
}
this
.
baseProof
=
proof
;
this
.
showAddProof
=
true
;
this
.
isZengliang
=
true
;
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
...
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