Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
admin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baihong
admin
Commits
77bd81a8
Commit
77bd81a8
authored
Apr 24, 2021
by
baihong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:登录接口对接,活动列表获取
parent
c9d5c6b8
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
184 additions
and
129 deletions
+184
-129
App.vue
src/App.vue
+3
-0
activityClocks.js
src/api/clock/activityClocks.js
+5
-0
login-form.vue
src/components/login-form/login-form.vue
+1
-1
user.vue
src/components/main/components/user/user.vue
+8
-2
main.vue
src/components/main/main.vue
+2
-2
index.js
src/config/index.js
+2
-2
http.js
src/libs/http.js
+74
-64
util.js
src/libs/util.js
+4
-10
clockInList.vue
src/view/clockEarly/clockInList.vue
+60
-19
login.vue
src/view/login/login.vue
+22
-26
vue.config.js
vue.config.js
+3
-3
No files found.
src/App.vue
View file @
77bd81a8
...
...
@@ -25,6 +25,9 @@ body {
#app
{
.size;
}
.margin-top-10
{
margin-top
:
10px
;
}
.content
{
background
:
#ffffff
;
padding
:
30px
;
...
...
src/api/clock/activityClocks.js
0 → 100644
View file @
77bd81a8
import
{
$http
}
from
'@/libs/http'
export
const
activityClocks
=
(
data
)
=>
{
return
$http
.
get
(
'/cms/activityClocks'
,
data
)
}
\ No newline at end of file
src/components/login-form/login-form.vue
View file @
77bd81a8
...
...
@@ -61,7 +61,7 @@ export default {
this
.
$refs
.
loginForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$emit
(
'on-success-valid'
,
{
username
:
this
.
form
.
userName
,
account
:
this
.
form
.
userName
,
password
:
this
.
form
.
password
})
}
...
...
src/components/main/components/user/user.vue
View file @
77bd81a8
...
...
@@ -4,11 +4,12 @@
<Badge
:dot=
"!!messageUnreadCount"
>
<Avatar
:src=
"userAvatar"
/>
</Badge>
{{
userName
}}
<Icon
:size=
"18"
type=
"md-arrow-dropdown"
></Icon>
<DropdownMenu
slot=
"list"
>
<DropdownItem
name=
"message"
>
<
!--
<
DropdownItem
name=
"message"
>
消息中心
<Badge
style=
"margin-left: 10px"
:count=
"messageUnreadCount"
></Badge>
</DropdownItem>
</DropdownItem>
-->
<DropdownItem
name=
"logout"
>
退出登录
</DropdownItem>
</DropdownMenu>
</Dropdown>
...
...
@@ -30,6 +31,11 @@ export default {
default
:
0
}
},
data
()
{
return
{
userName
:
sessionStorage
.
getItem
(
'username'
)
}
},
methods
:
{
...
mapActions
([
'handleLogOut'
...
...
src/components/main/main.vue
View file @
77bd81a8
...
...
@@ -37,11 +37,11 @@
style=
"margin-right: 10px;"
v-if=
"$config.useI18n"
/>
<error-store
<
!--
<
error-store
:count=
"errorCount"
:has-read=
"hasReadErrorPage"
v-if=
"$config.plugin['error-store'] && $config.plugin['error-store'].showInHeader"
></error-store>
></error-store>
-->
<fullscreen
style=
"margin-right: 10px;"
v-model=
"isFullscreen"
/>
</header-bar>
</Header>
...
...
src/config/index.js
View file @
77bd81a8
...
...
@@ -17,8 +17,8 @@ export default {
* @description api请求基础路径
*/
baseUrl
:
{
dev
:
'/
bg
'
,
pro
:
'https://ap
plet.mwcx.cn/bg
'
dev
:
'/
v1
'
,
pro
:
'https://ap
i.sign.dankal.cn/v1
'
},
/**
* @description 默认打开的首页的路由name值,默认为home
...
...
src/libs/http.js
View file @
77bd81a8
import
axios
from
'axios'
import
Qs
from
'qs'
import
store
from
'@/store'
import
router
from
'@/router'
import
config
from
'@/config'
import
{
Message
}
from
'iview'
import
{
getToken
}
from
'@/libs/util'
const
baseUrl
=
process
.
env
.
NODE_ENV
===
'development'
?
config
.
baseUrl
.
dev
:
config
.
baseUrl
.
pro
import
axios
from
"axios"
;
import
Qs
from
"qs"
;
import
store
from
"@/store"
;
import
router
from
"@/router"
;
import
config
from
"@/config"
;
import
{
Message
}
from
"iview"
;
import
{
getToken
}
from
"@/libs/util"
;
const
baseUrl
=
process
.
env
.
NODE_ENV
===
"development"
?
config
.
baseUrl
.
dev
:
config
.
baseUrl
.
pro
;
const
_baseConfig
=
{
baseURL
:
baseUrl
,
headers
:
{},
params
:
{},
paramsSerializer
:
function
(
params
)
{
return
Qs
.
stringify
(
params
)
paramsSerializer
:
function
(
params
)
{
return
Qs
.
stringify
(
params
)
;
},
validateStatus
:
status
=>
{
// 处理响应状态码
switch
(
status
)
{
case
401
:
router
.
push
({
name
:
'login'
})
return
false
router
.
push
({
name
:
"login"
});
return
false
;
case
500
:
// console.log(500);
return
false
return
false
;
}
return
status
>=
200
&&
status
<
300
// 默认的, 为false时进入'响应拦截器'catch
return
status
>=
200
&&
status
<
300
;
// 默认的, 为false时进入'响应拦截器'catch
},
transformResponse
:
[
function
(
data
)
{
function
(
data
)
{
// 对 data 进行任意转换处理
// console.log(data);
return
data
return
data
;
}
],
timeout
:
3
*
60
*
1000
,
responseType
:
'json'
}
responseType
:
"json"
}
;
const
_http
=
axios
.
create
(
_baseConfig
)
const
_http
=
axios
.
create
(
_baseConfig
)
;
// 请求拦截器
_http
.
interceptors
.
request
.
use
(
function
(
config
)
{
config
.
setLoading
&&
store
.
commit
(
'setIsLoading'
,
true
)
function
(
config
)
{
config
.
setLoading
&&
store
.
commit
(
"setIsLoading"
,
true
);
// 可以在这里修改请求头
config
.
headers
.
Authorization
=
getToken
()
return
config
config
.
headers
.
Authorization
=
getToken
()
;
return
config
;
},
function
(
error
)
{
function
(
error
)
{
// 对请求错误做些什么
return
Promise
.
reject
(
error
)
return
Promise
.
reject
(
error
)
;
}
)
)
;
// 响应拦截器
_http
.
interceptors
.
response
.
use
(
function
(
response
)
{
console
.
log
(
response
)
function
(
response
)
{
console
.
log
(
response
)
;
// 在这里统一处理自定义状态码(如果有)
// console.log(response.headers.pragma);
store
.
commit
(
'setIsLoading'
,
false
)
let
result
=
response
.
data
store
.
commit
(
"setIsLoading"
,
false
);
let
result
=
response
.
data
;
if
(
result
.
code
===
-
1
)
{
Message
.
error
(
result
.
message
)
Message
.
error
(
result
.
message
)
;
}
if
(
typeof
result
===
'string'
)
{
result
=
JSON
.
parse
(
result
)
if
(
typeof
result
===
"string"
)
{
result
=
JSON
.
parse
(
result
)
;
}
return
result
return
result
;
},
function
(
error
)
{
function
(
error
)
{
if
(
!
navigator
.
onLine
)
{
console
.
log
(
'无法连接网络'
)
console
.
log
(
"无法连接网络"
);
}
store
.
commit
(
'setIsLoading'
,
false
)
return
Promise
.
reject
(
error
)
store
.
commit
(
"setIsLoading"
,
false
);
return
Promise
.
reject
(
error
)
;
}
)
)
;
const
_HttpService
=
{
post
:
(
url
,
data
,
config
)
=>
{
const
_selfConfig
=
{
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded;charset=utf-8'
"Content-Type"
:
"application/x-www-form-urlencoded;charset=utf-8"
},
setLoading
:
true
}
}
;
config
=
Object
.
assign
({},
_selfConfig
,
config
)
return
_http
.
post
(
url
,
Qs
.
stringify
(
data
),
config
)
config
=
Object
.
assign
({},
_selfConfig
,
config
)
;
return
_http
.
post
(
url
,
Qs
.
stringify
(
data
),
config
)
;
},
postObj
:
(
url
,
data
,
config
)
=>
{
const
_selfConfig
=
{
headers
:
{
'Content-Type'
:
'application/json'
"Content-Type"
:
"application/json"
,
"X-Access-Token"
:
sessionStorage
.
getItem
(
"token"
)
||
"1b8cc15a59947ce27dd62b"
},
setLoading
:
true
}
}
;
config
=
Object
.
assign
({},
_selfConfig
,
config
)
return
_http
.
post
(
url
,
JSON
.
stringify
(
data
),
config
)
config
=
Object
.
assign
({},
_selfConfig
,
config
)
;
return
_http
.
post
(
url
,
JSON
.
stringify
(
data
),
config
)
;
},
postParams
:
(
url
,
data
,
config
)
=>
{
const
_selfConfig
=
{
params
:
data
,
setLoading
:
true
}
}
;
config
=
Object
.
assign
({},
_selfConfig
,
config
)
return
_http
.
post
(
url
,
null
,
config
)
config
=
Object
.
assign
({},
_selfConfig
,
config
)
;
return
_http
.
post
(
url
,
null
,
config
)
;
},
get
:
(
url
,
data
,
config
)
=>
{
const
_selfConfig
=
{
headers
:
{
"Content-Type"
:
"application/json"
,
"X-Access-Token"
:
sessionStorage
.
getItem
(
"token"
)
||
"1b8cc15a59947ce27dd62b"
},
params
:
data
,
setLoading
:
true
}
}
;
config
=
Object
.
assign
({},
_selfConfig
,
config
)
return
_http
.
get
(
url
,
config
)
config
=
Object
.
assign
({},
_selfConfig
,
config
)
;
return
_http
.
get
(
url
,
config
)
;
},
delete
:
(
url
,
data
,
config
)
=>
{
const
_selfConfig
=
{
headers
:
{
'Content-Type'
:
'application/json'
"Content-Type"
:
"application/json"
},
data
:
JSON
.
stringify
(
data
),
setLoading
:
true
}
}
;
config
=
Object
.
assign
({},
_selfConfig
,
config
)
return
_http
.
delete
(
url
,
config
)
config
=
Object
.
assign
({},
_selfConfig
,
config
)
;
return
_http
.
delete
(
url
,
config
)
;
},
patch
:
(
url
,
data
,
config
)
=>
{
const
_selfConfig
=
{
headers
:
{
'Content-Type'
:
'application/json'
"Content-Type"
:
"application/json"
},
setLoading
:
true
}
}
;
config
=
Object
.
assign
({},
_selfConfig
,
config
)
return
_http
.
patch
(
url
,
JSON
.
stringify
(
data
),
config
)
config
=
Object
.
assign
({},
_selfConfig
,
config
)
;
return
_http
.
patch
(
url
,
JSON
.
stringify
(
data
),
config
)
;
}
}
}
;
export
const
$http
=
_HttpService
export
const
$BASEURL
=
baseUrl
export
const
$http
=
_HttpService
;
export
const
$BASEURL
=
baseUrl
;
src/libs/util.js
View file @
77bd81a8
...
...
@@ -403,7 +403,7 @@ export const formatDate = time => {
if
(
time
===
null
)
{
return
''
}
time
=
new
Date
(
time
*
1000
)
time
=
new
Date
(
time
)
let
year
=
time
.
getFullYear
()
let
month
=
time
.
getMonth
()
+
1
let
date
=
time
.
getDate
()
...
...
@@ -417,15 +417,9 @@ export const formatDate = time => {
second
=
second
<
10
?
'0'
+
second
:
second
return
(
year
+
'
年
'
+
'
-
'
+
month
+
'月'
+
date
+
'日'
+
hour
+
':'
+
minute
+
':'
+
second
'-'
+
date
)
}
src/view/clockEarly/clockInList.vue
View file @
77bd81a8
...
...
@@ -4,7 +4,7 @@
<div
class=
"left"
>
选择日期:
<DatePicker
:value=
"value2
"
v-model=
"date
"
format=
"yyyy/MM/dd"
type=
"daterange"
placement=
"bottom-end"
...
...
@@ -12,11 +12,12 @@
style=
"width: 200px"
></DatePicker>
<span
style=
"margin-left:10px"
>
活动状态:
</span>
<Select
style=
"width: 150px"
placeholder=
"请选择"
>
<Option
value=
"beijing"
>
未开始
</Option>
<Option
value=
"shanghai"
>
进行中
</Option>
<Select
v-model=
"status"
style=
"width: 150px"
placeholder=
"请选择"
>
<Option
:value=
"0"
>
未开始
</Option>
<Option
:value=
"1"
>
进行中
</Option>
<Option
:value=
"2"
>
已结束
</Option>
</Select>
<Button
type=
"primary"
@
click=
"
goDetail
"
>
查 询
</Button>
<Button
type=
"primary"
@
click=
"
search
"
>
查 询
</Button>
<Button
type=
"primary"
ghost
>
重 置
</Button>
</div>
<div
class=
"right"
>
...
...
@@ -30,11 +31,11 @@
:columns=
"columns"
:data=
"data"
>
<template
slot-scope=
"
{ row }" slot="
nam
e">
<span>
{{
row
.
details
.
name
}}
</span>
<template
slot-scope=
"
{ row }" slot="
activity_dat
e">
<span>
{{
row
.
activity_date
|
format
}}
</span>
</
template
>
<
template
slot-scope=
"{ row }"
slot=
"
title
"
>
<span>
{{
row
.
details
.
title
}}
</span>
<
template
slot-scope=
"{ row }"
slot=
"
status
"
>
<span>
{{
row
.
status
===
0
?
'未开始'
:
row
.
status
===
1
?
'进行中'
:
'已结束'
}}
</span>
</
template
>
<
template
slot-scope=
"{ row }"
slot=
"created_at"
>
<span>
{{
row
.
created_at
|
format
}}
</span>
...
...
@@ -56,41 +57,60 @@
<a
@
click=
"goTheme(row)"
>
编辑
</a>
</
template
>
</Table>
<Pager
class=
"margin-top-10"
:config=
"config"
@
on-change=
"handlePager"
></Pager>
</div>
</template>
<
script
>
import
{
getScenes
,
delScenes
,
editScenes
}
from
"@/api/scenes"
;
import
{
activityClocks
}
from
"@/api/clock/activityClocks"
;
import
{
formatDate
}
from
'@/libs/util'
import
Pager
from
"@/view/common/Pager.vue"
;
export
default
{
name
:
"categories"
,
components
:
{},
components
:
{
Pager
},
filters
:
{
format
(
value
)
{
return
formatDate
(
value
)
}
},
data
()
{
return
{
config
:
{
total
:
0
,
size
:
10
,
current
:
1
},
date
:
[],
status
:
null
,
pageIndex
:
1
,
pageSize
:
10
,
data
:
[],
columns
:
[
{
title
:
"活动日期"
,
key
:
"created_at
"
slot
:
"activity_date
"
},
{
title
:
"活动缴费金额(真我币)"
,
slot
:
"name
"
key
:
"pay_amount
"
},
{
title
:
"活动状态"
,
slot
:
"
title
"
slot
:
"
status
"
},
{
title
:
"报名人数"
,
key
:
"
created_at
"
key
:
"
apply_num
"
},
{
{
title
:
"签到人数"
,
slot
:
"title
"
key
:
"sign_in_num
"
},
{
title
:
"本场瓜分(真我币)"
,
key
:
"
created_a
t"
key
:
"
expense_amoun
t"
},
{
title
:
"操作"
,
...
...
@@ -100,11 +120,32 @@ export default {
};
},
methods
:
{
search
()
{
let
params
=
{
status
:
this
.
status
,
startDate
:
this
.
date
[
0
],
endDate
:
this
.
date
[
1
],
pageIndex
:
this
.
pageIndex
,
pageSize
:
this
.
pageSize
};
activityClocks
(
params
).
then
(
res
=>
{
this
.
config
.
total
=
res
.
total
;
this
.
data
=
res
.
data
});
},
handlePager
(
pager
)
{
this
.
pageIndex
=
pager
.
current
;
this
.
pageSize
=
pager
.
size
;
this
.
search
();
},
goDetail
()
{
this
.
$router
.
push
({
path
:
"/signIn/detail"
,
query
:
{
id
:
"new"
}
});
}
},
mounted
()
{}
mounted
()
{
console
.
log
(
11
);
this
.
search
();
}
};
</
script
>
...
...
src/view/login/login.vue
View file @
77bd81a8
<
style
lang=
"less"
>
@import
'./login.less'
;
@import
"./login.less"
;
</
style
>
<
template
>
...
...
@@ -16,44 +16,40 @@
</
template
>
<
script
>
import
LoginForm
from
'_c/login-form'
import
{
mapActions
}
from
'vuex'
import
{
$http
}
from
'@/libs/http'
import
{
setToken
}
from
'@/libs/util'
import
LoginForm
from
"_c/login-form"
;
import
{
mapActions
}
from
"vuex"
;
import
{
$http
}
from
"@/libs/http"
;
import
{
setToken
}
from
"@/libs/util"
;
export
default
{
components
:
{
LoginForm
},
methods
:
{
...
mapActions
([
'handleLogin'
,
'getUserInfo'
]),
handleSubmit
({
username
,
password
})
{
...
mapActions
([
"handleLogin"
,
"getUserInfo"
]),
handleSubmit
({
account
,
password
})
{
$http
.
post
Params
(
'/manager/login'
,
{
account
:
username
,
p
w
d
:
password
.
post
Obj
(
"/cms/admins/login"
,
{
account
:
account
,
p
asswor
d
:
password
})
.
then
(
data
=>
{
console
.
log
(
data
)
if
(
data
.
status
===
200
)
{
let
token
=
data
.
data
se
tToken
(
token
)
this
.
$Message
.
success
(
'登录成功'
)
console
.
log
(
data
)
;
if
(
data
.
token
&&
data
.
token
.
access_token
)
{
sessionStorage
.
setItem
(
"token"
,
data
.
token
.
access_token
);
se
ssionStorage
.
setItem
(
"username"
,
data
.
user_info
.
name
);
this
.
$Message
.
success
(
"登录成功"
);
this
.
$router
.
push
({
name
:
this
.
$config
.
homeName
})
}
else
{
this
.
errorMsg
=
data
.
msg
});
}
else
{
this
.
errorMsg
=
data
.
msg
;
}
})
.
catch
(()
=>
{
})
.
catch
(()
=>
{
});
}
}
}
}
;
</
script
>
<
style
>
</
style
>
<
style
></
style
>
vue.config.js
View file @
77bd81a8
...
...
@@ -40,11 +40,11 @@ module.exports = {
devServer
:
{
disableHostCheck
:
true
,
proxy
:
{
'/
bg
'
:
{
'target'
:
'https://ap
plet.mwcx
.cn'
,
'/
v1
'
:
{
'target'
:
'https://ap
i.sign.dankal
.cn'
,
'changeOrigin'
:
true
,
'pathRewirte'
:
{
'^/
bg
'
:
''
'^/
v1
'
:
''
}
}
}
...
...
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