Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
community_vote
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
community_vote
Commits
775c2beb
Commit
775c2beb
authored
Jul 15, 2021
by
xhx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加载调整
parent
350c6ff3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
35 deletions
+50
-35
Attend.vue
src/components/mine/Attend.vue
+6
-14
index.ts
src/service/index.ts
+26
-2
index.ts
src/store/app/index.ts
+8
-1
Home.vue
src/views/Home.vue
+7
-18
MyProject.vue
src/views/mine/MyProject.vue
+3
-0
No files found.
src/components/mine/Attend.vue
View file @
775c2beb
...
@@ -46,7 +46,6 @@ import Vue from 'vue'
...
@@ -46,7 +46,6 @@ import Vue from 'vue'
import
Card
from
'@/components/Card.vue'
import
Card
from
'@/components/Card.vue'
import
CardTwo
from
'@/components/Card_two.vue'
import
CardTwo
from
'@/components/Card_two.vue'
import
{
service
}
from
'@/service/index'
import
{
service
}
from
'@/service/index'
// import { test } from '@/constants/test'
import
{
Dialog
}
from
'vant'
import
{
Dialog
}
from
'vant'
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
components
:
{
components
:
{
...
@@ -71,7 +70,7 @@ export default Vue.extend({
...
@@ -71,7 +70,7 @@ export default Vue.extend({
getBlockHeight
()
{
getBlockHeight
()
{
service
.
getHeight
().
then
(
res
=>
{
service
.
getHeight
().
then
(
res
=>
{
this
.
blockHeight
=
res
.
data
.
result
.
mainHeight
this
.
blockHeight
=
res
.
data
.
result
.
mainHeight
this
.
blockTime
=
+
res
.
data
.
result
.
para
BlockTime
this
.
blockTime
=
+
res
.
data
.
result
.
main
BlockTime
})
})
},
},
goPage
(
item
:
any
,
n
:
number
,
i
?:
any
)
{
goPage
(
item
:
any
,
n
:
number
,
i
?:
any
)
{
...
@@ -123,12 +122,11 @@ export default Vue.extend({
...
@@ -123,12 +122,11 @@ export default Vue.extend({
})
})
})
})
},
},
setRank
()
{
// 统一 description
setDesc
()
{
for
(
const
item
of
this
.
lists
)
{
for
(
const
item
of
this
.
lists
)
{
if
(
item
.
type
===
2
)
{
if
(
item
.
type
===
2
)
{
item
.
voteOptions
=
item
.
voteOptions
.
sort
((
a
:
any
,
b
:
any
)
=>
b
.
score
-
a
.
score
)
item
.
voteOptions
.
forEach
((
item
:
any
)
=>
{
item
.
voteOptions
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
item
.
rank
=
index
+
1
item
.
description
=
item
.
desc
item
.
description
=
item
.
desc
})
})
}
}
...
@@ -148,7 +146,6 @@ export default Vue.extend({
...
@@ -148,7 +146,6 @@ export default Vue.extend({
execer
:
'user.p.szhtest.rankvote'
,
execer
:
'user.p.szhtest.rankvote'
,
funcName
:
'GetRankVoteList'
,
funcName
:
'GetRankVoteList'
,
payload
:
{
payload
:
{
// addr: test.addr,
addr
:
this
.
$store
.
state
.
app
.
address
,
addr
:
this
.
$store
.
state
.
app
.
address
,
count
:
-
1
,
count
:
-
1
,
direction
:
0
,
direction
:
0
,
...
@@ -157,7 +154,7 @@ export default Vue.extend({
...
@@ -157,7 +154,7 @@ export default Vue.extend({
}
}
}).
then
(
res
=>
{
}).
then
(
res
=>
{
this
.
lists
=
res
.
data
.
result
&&
res
.
data
.
result
.
list
||
[]
this
.
lists
=
res
.
data
.
result
&&
res
.
data
.
result
.
list
||
[]
this
.
set
Rank
()
this
.
set
Desc
()
this
.
filterSetList
()
this
.
filterSetList
()
if
(
fn
)
fn
()
if
(
fn
)
fn
()
})
})
...
@@ -168,7 +165,6 @@ export default Vue.extend({
...
@@ -168,7 +165,6 @@ export default Vue.extend({
execer
:
'user.p.szhtest.rankvote'
,
execer
:
'user.p.szhtest.rankvote'
,
funcName
:
'GetUserVotedList'
,
funcName
:
'GetUserVotedList'
,
payload
:
{
payload
:
{
// addr: test.addr,
addr
:
this
.
$store
.
state
.
app
.
address
,
addr
:
this
.
$store
.
state
.
app
.
address
,
index
:
0
,
index
:
0
,
count
:
-
1
,
count
:
-
1
,
...
@@ -178,7 +174,7 @@ export default Vue.extend({
...
@@ -178,7 +174,7 @@ export default Vue.extend({
}).
then
(
res
=>
{
}).
then
(
res
=>
{
this
.
lists
=
res
.
data
.
result
&&
res
.
data
.
result
.
list
||
[]
this
.
lists
=
res
.
data
.
result
&&
res
.
data
.
result
.
list
||
[]
this
.
lists
=
this
.
lists
.
filter
(
item
=>
item
.
type
===
1
)
this
.
lists
=
this
.
lists
.
filter
(
item
=>
item
.
type
===
1
)
this
.
set
Rank
()
this
.
set
Desc
()
})
})
},
},
getAttendOption
()
{
getAttendOption
()
{
...
@@ -198,7 +194,6 @@ export default Vue.extend({
...
@@ -198,7 +194,6 @@ export default Vue.extend({
this
.
lists
.
forEach
((
item
:
any
)
=>
{
this
.
lists
.
forEach
((
item
:
any
)
=>
{
item
.
description
=
item
.
desc
item
.
description
=
item
.
desc
})
})
// this.setRank()
})
})
},
},
getSetOption
()
{
getSetOption
()
{
...
@@ -206,7 +201,6 @@ export default Vue.extend({
...
@@ -206,7 +201,6 @@ export default Vue.extend({
execer
:
'user.p.szhtest.rankvote'
,
execer
:
'user.p.szhtest.rankvote'
,
funcName
:
'GetUserSignUpList'
,
funcName
:
'GetUserSignUpList'
,
payload
:
{
payload
:
{
// addr: test.addr,
addr
:
this
.
$store
.
state
.
app
.
address
,
addr
:
this
.
$store
.
state
.
app
.
address
,
index
:
0
,
index
:
0
,
count
:
-
1
,
count
:
-
1
,
...
@@ -218,10 +212,8 @@ export default Vue.extend({
...
@@ -218,10 +212,8 @@ export default Vue.extend({
this
.
lists
.
forEach
((
item
:
any
)
=>
{
this
.
lists
.
forEach
((
item
:
any
)
=>
{
item
.
description
=
item
.
desc
item
.
description
=
item
.
desc
})
})
// this.setRank()
})
})
},
},
updateTab
()
{
updateTab
()
{
console
.
log
(
this
.
tab
)
console
.
log
(
this
.
tab
)
if
(
this
.
tab
===
1
)
{
if
(
this
.
tab
===
1
)
{
...
...
src/service/index.ts
View file @
775c2beb
...
@@ -10,8 +10,15 @@ import { whiteList } from "@/constants/whiteList"
...
@@ -10,8 +10,15 @@ import { whiteList } from "@/constants/whiteList"
function
isSame
(
w
:
any
,
c
:
any
)
{
function
isSame
(
w
:
any
,
c
:
any
)
{
const
_d
=
c
.
data
let
o
=
{}
as
any
if
(
typeof
_d
===
'string'
)
{
o
=
JSON
.
parse
(
_d
)
}
else
{
o
=
_d
}
for
(
const
item
of
w
)
{
for
(
const
item
of
w
)
{
if
(
item
.
method
===
c
.
data
.
method
&&
item
.
funcName
===
c
.
data
.
params
[
0
].
funcName
)
{
if
(
item
.
method
===
o
.
method
&&
item
.
funcName
===
o
.
params
[
0
].
funcName
)
{
return
true
return
true
}
}
}
}
...
@@ -41,8 +48,12 @@ class ChainService {
...
@@ -41,8 +48,12 @@ class ChainService {
method
:
'post'
method
:
'post'
})
})
this
.
service
.
interceptors
.
request
.
use
(
config
=>
{
this
.
service
.
interceptors
.
request
.
use
(
config
=>
{
// 加载页设置 (过滤等待验证接口及名称校验接口)
if
(
config
.
data
.
method
!==
'Chain33.QueryTransaction'
&&
!
isSame
(
whiteList
,
config
))
{
if
(
config
.
data
.
method
!==
'Chain33.QueryTransaction'
&&
!
isSame
(
whiteList
,
config
))
{
loading
.
showLoading
()
loading
.
showLoading
()
store
.
commit
(
'app/ADD_REQUEST'
)
// console.log('request:',(store as any).state.app.requestCount)
// console.log(config.data)
}
}
return
config
return
config
},
error
=>
{
},
error
=>
{
...
@@ -50,9 +61,22 @@ class ChainService {
...
@@ -50,9 +61,22 @@ class ChainService {
})
})
this
.
service
.
interceptors
.
response
.
use
(
res
=>
{
this
.
service
.
interceptors
.
response
.
use
(
res
=>
{
if
(
res
.
config
.
data
.
method
!==
'Chain33.QueryTransaction'
&&
!
isSame
(
whiteList
,
res
.
config
))
{
const
_d
=
res
.
config
.
data
let
o
=
{}
as
any
if
(
typeof
_d
===
'string'
)
{
o
=
JSON
.
parse
(
_d
)
}
else
{
o
=
_d
}
// 加载页设置
if
(
o
.
method
!==
'Chain33.QueryTransaction'
&&
!
isSame
(
whiteList
,
res
.
config
))
{
store
.
commit
(
'app/DEC_REQUEST'
)
// console.log('res:',(store as any).state.app.requestCount)
// console.log(res.config.data)
if
((
store
as
any
).
state
.
app
.
requestCount
===
0
)
{
loading
.
hideLoading
()
loading
.
hideLoading
()
}
}
}
return
res
return
res
},
error
=>
{
},
error
=>
{
Toast
(
'网络异常'
)
Toast
(
'网络异常'
)
...
...
src/store/app/index.ts
View file @
775c2beb
...
@@ -8,6 +8,7 @@ const stateData = {
...
@@ -8,6 +8,7 @@ const stateData = {
},
},
members
:
[]
as
any
,
members
:
[]
as
any
,
loading
:
0
,
loading
:
0
,
requestCount
:
0
,
type
:
1
,
type
:
1
,
res
:
''
,
// 提交失败信息
res
:
''
,
// 提交失败信息
text
:
''
,
// 提交提示
text
:
''
,
// 提交提示
...
@@ -88,7 +89,13 @@ export const appStore = {
...
@@ -88,7 +89,13 @@ export const appStore = {
},
},
CLEAR_FORM
(
state
:
AppType
)
{
CLEAR_FORM
(
state
:
AppType
)
{
state
.
form
=
{}
state
.
form
=
{}
}
},
ADD_REQUEST
(
state
:
AppType
)
{
state
.
requestCount
++
},
DEC_REQUEST
(
state
:
AppType
)
{
state
.
requestCount
--
},
},
},
actions
:
{
actions
:
{
...
...
src/views/Home.vue
View file @
775c2beb
...
@@ -77,7 +77,6 @@ export default Vue.extend({
...
@@ -77,7 +77,6 @@ export default Vue.extend({
this
.
timer
=
setInterval
(()
=>
{
this
.
timer
=
setInterval
(()
=>
{
if
(
+
this
.
timeStamp
<=
Date
.
now
())
{
if
(
+
this
.
timeStamp
<=
Date
.
now
())
{
this
.
getList
()
this
.
getList
()
// clearInterval(this.timer)
}
}
},
waiter
)
},
waiter
)
},
},
...
@@ -148,7 +147,7 @@ export default Vue.extend({
...
@@ -148,7 +147,7 @@ export default Vue.extend({
}
}
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
data
.
error
!=
null
)
{
if
(
res
.
data
.
error
!=
null
)
{
clearInterval
(
this
.
timer
)
if
(
this
.
timer
)
clearInterval
(
this
.
timer
)
return
return
}
}
this
.
res
=
res
.
data
.
result
this
.
res
=
res
.
data
.
result
...
@@ -161,22 +160,10 @@ export default Vue.extend({
...
@@ -161,22 +160,10 @@ export default Vue.extend({
this
.
voteId
=
res
.
data
.
result
.
ID
this
.
voteId
=
res
.
data
.
result
.
ID
const
end
=
res
.
data
.
result
?.
endHeight
const
end
=
res
.
data
.
result
?.
endHeight
const
start
=
res
.
data
.
result
?.
startHeight
const
start
=
res
.
data
.
result
?.
startHeight
if
(
this
.
status
===
3
)
{
//
clearInterval
(
this
.
timer
)
if
(
this
.
status
&&
this
.
status
===
3
)
{
if
(
this
.
timer
)
clearInterval
(
this
.
timer
)
}
}
// chainService.getLastBlocks().then(res => {
// const v = res.data.result.height
// if (+start > v) {
// this.voteType = 1
// this.timeStamp = res.data.result.blockTime * 1000 + (+start - v) * 5000 + ''
// } else if (+end > v) {
// this.voteType = 2
// this.timeStamp = res.data.result.blockTime * 1000 + (+end - v) * 5000 + ''
// } else {
// this.voteType = 3
// this.timeStamp = res.data.result.blockTime * 1000 + (+end - v) * 5000 + ''
// }
// })
service
.
getHeight
().
then
(
res
=>
{
service
.
getHeight
().
then
(
res
=>
{
const
v
=
res
.
data
.
result
.
mainHeight
const
v
=
res
.
data
.
result
.
mainHeight
if
(
+
start
>
v
)
{
if
(
+
start
>
v
)
{
...
@@ -189,9 +176,11 @@ export default Vue.extend({
...
@@ -189,9 +176,11 @@ export default Vue.extend({
this
.
voteType
=
3
this
.
voteType
=
3
this
.
timeStamp
=
res
.
data
.
result
.
mainBlockTime
*
1000
+
(
+
end
-
v
)
*
5000
+
''
this
.
timeStamp
=
res
.
data
.
result
.
mainBlockTime
*
1000
+
(
+
end
-
v
)
*
5000
+
''
}
}
// this.timeStamp = Date.now() + 10000 + ''
// this.createInterval(7000)
})
})
}).
catch
(()
=>
{
}).
catch
(()
=>
{
clearInterval
(
this
.
timer
)
if
(
this
.
timer
)
clearInterval
(
this
.
timer
)
})
})
}
}
},
},
...
...
src/views/mine/MyProject.vue
View file @
775c2beb
...
@@ -84,6 +84,9 @@ export default Vue.extend({
...
@@ -84,6 +84,9 @@ export default Vue.extend({
methods
:
{
methods
:
{
goVote
()
{
goVote
()
{
if
(
this
.
community
.
status
<
3
)
{
if
(
this
.
community
.
status
<
3
)
{
if
(
this
.
community
.
type
===
2
)
{
return
}
this
.
$router
.
push
({
path
:
'/Square/SquareVote'
,
query
:
{
...
this
.
$route
.
query
}})
this
.
$router
.
push
({
path
:
'/Square/SquareVote'
,
query
:
{
...
this
.
$route
.
query
}})
}
else
{
}
else
{
this
.
$router
.
push
({
path
:
'/Square/SquareDetails'
,
query
:
{
...
this
.
$route
.
query
}})
this
.
$router
.
push
({
path
:
'/Square/SquareDetails'
,
query
:
{
...
this
.
$route
.
query
}})
...
...
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