Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qsh-wc
Project
Project
Details
Activity
Releases
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
honghuiliu
qsh-wc
Commits
922be8cf
Commit
922be8cf
authored
Sep 02, 2022
by
mahui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
4f3dac54
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
47 deletions
+90
-47
getData.js
pc/src/api/getData.js
+3
-4
index.js
pc/src/api/methods/index.js
+17
-2
test.js
pc/src/api/methods/test.js
+0
-7
index.js
pc/src/router/index.js
+21
-18
login.vue
pc/src/views/login.vue
+37
-5
vue.config.js
pc/vue.config.js
+12
-11
No files found.
pc/src/api/getData.js
View file @
922be8cf
...
...
@@ -5,10 +5,9 @@ import { ElMessage } from 'element-plus'
import
{
useStore
}
from
'@/store/modules/app'
;
import
myPublic
from
'@/utils/public'
;
let
id
=
0
;
const
API_HOST
=
''
;
const
API_HOST
=
'
/api
'
;
const
list
=
[
'phone/sms/sendCode'
,
'phone/login/login'
'web/login/login'
];
axios
.
interceptors
.
request
.
use
(
config
=>
{
// loading
...
...
@@ -53,7 +52,7 @@ function checkCode(res,url) {
});
}
if
(
res
.
code
==
1000
)
{
localStorage
.
removeItem
(
'token'
);
localStorage
.
removeItem
(
'
qsh-wc-
token'
);
location
.
href
=
location
.
origin
+
location
.
pathname
+
'#/login'
;
return
res
}
...
...
pc/src/api/methods/index.js
View file @
922be8cf
import
test
from
'./test
'
;
import
http
from
'../getData
'
;
export
default
{
test
:
test
,
//用户登录
login
(
params
)
{
return
http
.
post
(
'web/login/login'
,
params
)
},
//公厕详情
getToiletDetail
(
params
)
{
return
http
.
post
(
'web/toilet/getToiletDetail'
,
params
)
},
//公厕列表
toiletList
(
params
)
{
return
http
.
post
(
'web/toilet/toiletList'
,
params
)
},
//工单列表
getPatrolList
(
params
)
{
return
http
.
post
(
'web/toilet/getPatrolList'
,
params
)
}
}
pc/src/api/methods/test.js
deleted
100644 → 0
View file @
4f3dac54
import
http
from
'../getData'
;
export
default
{
//待检查车辆
// getToCheck(params) {
// return http.post('phone/back_detail/getToCheck', params)
// }
}
pc/src/router/index.js
View file @
922be8cf
...
...
@@ -34,24 +34,27 @@ const router = createRouter({
history
:
createWebHashHistory
(
process
.
env
.
BASE_URL
),
routes
});
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
const
store
=
useStore
();
// let token = myPublic.getStorage('token');
// if(!token){
// if(to.path!='/login'){
// next({path:'/login'})
// }else{
// next();
// }
// }else{
// if(!store.state.token){
// store.commit('token',token);
// }
// if(store.state.firstGo){
//
// }
// next()
// }
next
()
let
token
=
myPublic
.
getStorage
(
'qsh-wc-token'
)?
myPublic
.
getStorage
(
'qsh-wc-token'
):
myPublic
.
getUrlKey
(
'token'
);
if
(
!
token
){
store
.
FirstGO
(
0
);
if
(
to
.
path
!=
'/login'
){
next
({
path
:
'/login'
})
}
else
{
next
();
}
}
else
{
if
(
!
store
.
token
){
store
.
TOKEN
(
token
);
if
(
token
!=
myPublic
.
getStorage
(
'qsh-wc-token'
)){
myPublic
.
setStorage
(
'qsh-wc-token'
,
token
);
}
}
if
(
store
.
firstGo
<
3
){
store
.
FirstGO
(
1
);
}
next
()
}
});
export
default
router
pc/src/views/login.vue
View file @
922be8cf
...
...
@@ -7,14 +7,14 @@
<p
class=
"account-title"
>
账户登录
</p>
<div
class=
"row"
>
<span
class=
"icon icon-16"
></span>
<input
class=
"input"
type=
"text"
v-model=
"name"
placeholder=
"请输入您的账号"
/>
<input
class=
"input"
type=
"text"
v-model=
"
user
name"
placeholder=
"请输入您的账号"
/>
</div>
<div
class=
"row"
>
<span
class=
"icon icon-17"
></span>
<input
class=
"input"
type=
"password"
v-model=
"password"
placeholder=
"请输入密码"
/>
</div>
<div
class=
"opt"
>
<span
class=
"btn"
>
登录
</span>
<span
class=
"btn"
@
click=
"submit"
>
登录
</span>
</div>
</div>
</div>
...
...
@@ -23,16 +23,48 @@
<
script
>
// @ is an alias to /src
import
{
reactive
,
ref
}
from
"vue"
import
{
reactive
,
toRefs
}
from
"vue"
import
{
ElMessage
}
from
"element-plus"
import
api
from
"@/api/methods/index"
import
myPublic
from
"@/utils/public"
import
{
useRouter
}
from
"vue-router"
export
default
{
name
:
'login'
,
setup
(
props
,{
emit
}){
const
router
=
useRouter
();
const
state
=
reactive
({
name
:
''
,
user
name
:
''
,
password
:
''
});
function
submit
()
{
if
(
!
state
.
username
){
return
ElMessage
({
type
:
'warning'
,
message
:
'请输入用户名'
})
}
if
(
!
state
.
password
){
return
ElMessage
({
type
:
'warning'
,
message
:
'请输入密码'
})
}
api
.
login
({
username
:
state
.
username
,
password
:
state
.
password
,
}).
then
(
async
(
res
)
=>
{
if
(
res
.
code
==
0
){
if
(
res
.
data
){
myPublic
.
setStorage
(
"qsh-wc-token"
,
res
.
data
);
await
router
.
replace
({
path
:
"/home"
});
window
.
reload
();
}
}
})
}
return
{
...
ref
(
state
)
...
toRefs
(
state
),
submit
}
},
components
:
{}
...
...
pc/vue.config.js
View file @
922be8cf
...
...
@@ -59,16 +59,17 @@ module.exports = {
},
devServer
:{
open
:
true
,
// proxy: {
// '/phone_html/phone': {
// target: 'http://127.0.0.1:14101/phone',
// changeOrigin: true,
// pathRewrite: {
// // '^/apis': ''表示把/apis替换为‘’(空字符串),这样既能使用代理,
// // 又能在请求接口api时去掉/apis,获得正确的短信api路径。
// '^/phone_html/phone': ''
// },
// }
// }
port
:
80
,
proxy
:
{
'/api'
:
{
target
:
'http://qsh-wc-test.linanquan.com/api'
,
changeOrigin
:
true
,
pathRewrite
:
{
// '^/apis': ''表示把/apis替换为‘’(空字符串),这样既能使用代理,
// 又能在请求接口api时去掉/apis,获得正确的短信api路径。
'^/api'
:
''
},
}
}
}
};
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