Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
mongo-ui
Commits
5db1fe93
Commit
5db1fe93
authored
Sep 03, 2020
by
郭志伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/consultant_pay' into 'master'
fix: 替换cookies-js为js-cookie See merge request
!207
parents
107fbb91
6cadec98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
+16
-18
localStorage.js
src/service/localStorage.js
+7
-6
index.vue
src/views/Consultant/Buy/index.vue
+9
-12
No files found.
src/service/localStorage.js
View file @
5db1fe93
import
c
ookies
from
"
js-cookie
"
;
import
C
ookies
from
"
js-cookie
"
;
export
default
{
export
default
{
get
(
key
)
{
get
(
key
)
{
let
result
=
window
.
localStorage
.
getItem
(
key
);
let
result
=
window
.
localStorage
.
getItem
(
key
);
// 如果本地存储拿不到tokenn,那就去
c
ookies拿
// 如果本地存储拿不到tokenn,那就去
C
ookies拿
if
(
!
result
&&
key
===
"
mongoToken
"
)
{
if
(
!
result
&&
key
===
"
mongoToken
"
)
{
return
c
ookies
.
get
(
key
)
||
""
;
return
C
ookies
.
get
(
key
)
||
""
;
}
}
try
{
try
{
return
JSON
.
parse
(
result
);
return
JSON
.
parse
(
result
);
...
@@ -19,15 +19,16 @@ export default {
...
@@ -19,15 +19,16 @@ export default {
if
(
toString
.
call
(
value
)
===
"
[object Array]
"
||
toString
.
call
(
value
)
===
"
[object Object]
"
)
{
if
(
toString
.
call
(
value
)
===
"
[object Array]
"
||
toString
.
call
(
value
)
===
"
[object Object]
"
)
{
value
=
JSON
.
stringify
(
value
);
value
=
JSON
.
stringify
(
value
);
}
}
// token存
c
ookies一份,做备份
// token存
C
ookies一份,做备份
if
(
key
===
"
mongoToken
"
)
{
if
(
key
===
"
mongoToken
"
)
{
cookies
.
set
(
key
,
value
,
{
expires
:
"
01/01/2030
"
});
Cookies
.
set
(
key
,
value
,
{
expires
:
3650
});
}
}
console
.
log
(
value
);
return
window
.
localStorage
.
setItem
(
key
,
value
);
return
window
.
localStorage
.
setItem
(
key
,
value
);
},
},
remove
(
key
)
{
remove
(
key
)
{
if
(
key
===
"
mongoToken
"
)
{
if
(
key
===
"
mongoToken
"
)
{
c
ookies
.
remove
(
key
);
C
ookies
.
remove
(
key
);
}
}
return
window
.
localStorage
.
removeItem
(
key
);
return
window
.
localStorage
.
removeItem
(
key
);
},
},
...
...
src/views/Consultant/Buy/index.vue
View file @
5db1fe93
...
@@ -262,6 +262,12 @@ export default {
...
@@ -262,6 +262,12 @@ export default {
},
},
async
goPay
()
{
async
goPay
()
{
this
.
isPayWait
=
true
;
this
.
isPayWait
=
true
;
function
getOrderInfo
()
{
setTimeout
(()
=>
{
this
.
isPayWait
=
false
;
this
.
$parent
.
getOrderInfo
(
true
);
},
1000
);
}
try
{
try
{
const
res
=
await
goPay
({
tradeType
:
this
.
tradeType
,
openId
:
this
.
openId
});
const
res
=
await
goPay
({
tradeType
:
this
.
tradeType
,
openId
:
this
.
openId
});
if
(
res
)
{
if
(
res
)
{
...
@@ -296,23 +302,14 @@ export default {
...
@@ -296,23 +302,14 @@ export default {
}
}
payByWay
(
this
.
tradeType
,
payInfo
)
payByWay
(
this
.
tradeType
,
payInfo
)
.
then
(()
=>
{
.
then
(()
=>
{
setTimeout
(()
=>
{
getOrderInfo
();
this
.
isPayWait
=
false
;
this
.
$parent
.
getOrderInfo
(
true
);
},
1000
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
setTimeout
(()
=>
{
getOrderInfo
();
this
.
isPayWait
=
false
;
this
.
$parent
.
getOrderInfo
(
true
);
},
1000
);
});
});
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
isPayWait
=
false
;
getOrderInfo
();
setTimeout
(()
=>
{
this
.
$parent
.
getOrderInfo
(
true
);
},
1000
);
}
}
}
}
}
}
...
...
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