Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
occloud-server
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
yangjiarong
occloud-server
Commits
f12ac4a2
Commit
f12ac4a2
authored
Aug 03, 2022
by
liuliufashi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4f3f6d65
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
13 deletions
+19
-13
request.ts
web-vue-admin/src/utils/request.ts
+4
-1
token.ts
web-vue-admin/src/utils/token.ts
+2
-0
index.vue
web-vue-admin/src/views/login/index.vue
+5
-3
index.vue
web-vue-admin/src/views/pay-bind/index.vue
+8
-9
No files found.
web-vue-admin/src/utils/request.ts
View file @
f12ac4a2
import
axios
from
"axios"
;
import
{
message
}
from
"ant-design-vue"
;
import
{
getToken
}
from
"./token"
;
// 创建axios实例
const
instance
=
axios
.
create
({
...
...
@@ -12,11 +13,13 @@ const instance = axios.create({
"Content-Type"
:
"application/json"
,
},
});
const
token
:
String
=
getToken
();
// 请求拦截器
instance
.
interceptors
.
request
.
use
(
function
(
config
:
any
)
{
const
token
:
String
=
getToken
();
// 这里判断localStorage里面是否存在token,如果有则在请求头里面设置
if
(
token
)
{
config
.
headers
.
Authorization
=
token
;
...
...
web-vue-admin/src/utils/token.ts
View file @
f12ac4a2
export
const
setToken
=
(
token
:
String
)
=>
{
console
.
log
(
token
,
'token'
);
if
(
localStorage
.
getItem
(
'session_id'
)){
localStorage
.
removeItem
(
'session_id'
)
localStorage
.
setItem
(
'session_id'
,
JSON
.
stringify
(
token
))
...
...
web-vue-admin/src/views/login/index.vue
View file @
f12ac4a2
...
...
@@ -77,7 +77,7 @@ import { defineExpose, reactive, ref, toRaw,onMounted } from "vue";
import
{
onLogin
}
from
"@/api/index"
;
import
{
message
}
from
"ant-design-vue"
;
import
{
useStore
}
from
"vuex"
;
import
{
setToken
}
from
"@/utils/token"
;
import
{
setToken
,
getToken
}
from
"@/utils/token"
;
import
{
setUserInfo
,
setUid
}
from
"@/utils/userInfo"
;
interface
FormState
{
username
:
string
;
...
...
@@ -105,16 +105,18 @@ const onSubmit = async () => {
password
:
toRaw
(
formState
).
password
,
};
if
(
checked
.
value
)
{
const
data
:
any
=
await
onLogin
(
JSON
.
stringify
(
user
));
loading
.
value
=
true
if
(
data
.
message
===
"ok"
&&
data
.
state
===
1
)
{
setUserInfo
(
user
);
setUid
(
data
.
data
.
uid
)
setToken
(
data
.
data
.
session_id
);
const
token
=
getToken
()
router
.
push
({
path
:
"/home"
,
path
:
"/home"
,
});
}
else
{
loading
.
value
=
false
message
.
warning
(
data
.
data
);
...
...
web-vue-admin/src/views/pay-bind/index.vue
View file @
f12ac4a2
...
...
@@ -80,11 +80,11 @@
<a-form-item
:label=
"appidName"
has-feedback
labelAlign=
"left"
v-bind=
"validateInfos.appid"
>
<a-input
v-model:value=
"modelRef.appid"
placeholder=
"请输入appid"
/>
</a-form-item>
<a-form-item
:label=
"goodsId"
has-feedback
labelAlign=
"left"
v-bind=
"validateInfos.
private
key"
>
<a-input
v-model:value=
"modelRef.
private
key"
placeholder=
"请输入商户id"
/>
<a-form-item
:label=
"goodsId"
has-feedback
labelAlign=
"left"
v-bind=
"validateInfos.
alipaypublic
key"
>
<a-input
v-model:value=
"modelRef.
alipaypublic
key"
placeholder=
"请输入商户id"
/>
</a-form-item>
<a-form-item
:label=
"labelKey"
has-feedback
labelAlign=
"left"
v-bind=
"validateInfos.
alipaypublic
key"
>
<a-input
v-model:value=
"modelRef.
alipaypublic
key"
placeholder=
"请输入密钥"
/>
<a-form-item
:label=
"labelKey"
has-feedback
labelAlign=
"left"
v-bind=
"validateInfos.
private
key"
>
<a-input
v-model:value=
"modelRef.
private
key"
placeholder=
"请输入密钥"
/>
</a-form-item>
<!-- <a-form-item
label="域名配置:"
...
...
@@ -249,8 +249,8 @@ const onSubmit = async () => {
paytype
:
dataFrom
.
value
.
paytype
,
status
:
dataFrom
.
value
.
status
,
weight
:
dataFrom
.
value
.
weight
,
mchid
:
toRaw
(
modelRef
).
private
key
,
mchkey
:
toRaw
(
modelRef
).
alipaypublic
key
,
mchid
:
toRaw
(
modelRef
).
alipaypublic
key
,
mchkey
:
toRaw
(
modelRef
).
private
key
,
...
toRaw
(
modelRef
),
uid
};
...
...
@@ -285,7 +285,6 @@ const onSubmit = async () => {
let
prarms
:
any
=
{
}
if
(
query
.
value
.
paytype
==
"1"
){
prarms
=
{
amount
:
dataFrom
.
value
.
amount
,
id
:
dataFrom
.
value
.
id
,
...
...
@@ -293,8 +292,8 @@ const onSubmit = async () => {
paytype
:
dataFrom
.
value
.
paytype
,
status
:
dataFrom
.
value
.
status
,
weight
:
dataFrom
.
value
.
weight
,
mchid
:
toRaw
(
modelRef
).
private
key
,
mchkey
:
toRaw
(
modelRef
).
alipaypublic
key
,
mchid
:
toRaw
(
modelRef
).
alipaypublic
key
,
mchkey
:
toRaw
(
modelRef
).
private
key
,
...
toRaw
(
modelRef
),
uid
,
};
...
...
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