Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
walk_daka_h5
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
穆启卓
walk_daka_h5
Commits
8a9d7eae
Commit
8a9d7eae
authored
Mar 30, 2019
by
liu zhuoyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
线上版
parent
851f1a68
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
29 deletions
+30
-29
package-lock.json
package-lock.json
+0
-0
HelloWorld.vue
src/components/HelloWorld.vue
+1
-1
fetch.js
src/components/axios/fetch.js
+22
-22
url.js
src/components/axios/url.js
+2
-1
Author.vue
src/views/Author.vue
+2
-2
vue.config.js
vue.config.js
+3
-3
No files found.
package-lock.json
View file @
8a9d7eae
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/components/HelloWorld.vue
View file @
8a9d7eae
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
wx
.
config
({
wx
.
config
({
debug
:
false
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
debug
:
false
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId
:
"wx
9af64967a0d40159
"
,
// 必填,公众号的唯一标识
appId
:
"wx
d1aab06cc88d0a5e
"
,
// 必填,公众号的唯一标识
timestamp
:
res
.
timestamp
,
// 必填,生成签名的时间戳
timestamp
:
res
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
res
.
nonceStr
,
// 必填,生成签名的随机串
nonceStr
:
res
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
res
.
signature
,
// 必填,签名
signature
:
res
.
signature
,
// 必填,签名
...
...
src/components/axios/fetch.js
View file @
8a9d7eae
import
axios
from
'axios'
;
//引入axios
import
axios
from
'axios'
;
//引入axios
export
function
fetch
(
options
)
{
export
function
fetch
(
options
)
{
//
if (!window['userData']) {
if
(
!
window
[
'userData'
])
{
//
let user_data_str = localStorage.getItem('walk_userData');
let
user_data_str
=
localStorage
.
getItem
(
'walk_userData'
);
//
if (user_data_str) {
if
(
user_data_str
)
{
//
window['userData'] = JSON.parse(user_data_str);
window
[
'userData'
]
=
JSON
.
parse
(
user_data_str
);
//
}
}
//
}
}
//
if (!window['userData']) {
if
(
!
window
[
'userData'
])
{
//
localStorage.setItem('last_url', location.hash.slice(1));
localStorage
.
setItem
(
'last_url'
,
location
.
hash
.
slice
(
1
));
//
location.replace('#/Author');
location
.
replace
(
'#/Author'
);
//
// this.$router.push({name:"Author"})
// this.$router.push({name:"Author"})
//
}
}
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
instance
=
axios
.
create
({
//instance创建一个axios实例,可以自定义配置,可在 axios文档中查看详情
const
instance
=
axios
.
create
({
//instance创建一个axios实例,可以自定义配置,可在 axios文档中查看详情
//所有的请求都会带上这些配置,比如全局都要用的身份信息等。
//所有的请求都会带上这些配置,比如全局都要用的身份信息等。
headers
:
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
//
'Authorization': window['userData']?window['userData'].token:''
'Authorization'
:
window
[
'userData'
]?
window
[
'userData'
].
token
:
''
'Authorization'
:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJvcGVuX2lkIjoiMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsImV4cCI6MTU1Mzk3MTExOX0.KZhzLx6y6t_wDHU35DWNGVIp9M1tZLKzhaW8kMoeBoU"
//
'Authorization':"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJvcGVuX2lkIjoiMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsImV4cCI6MTU1Mzk3MTExOX0.KZhzLx6y6t_wDHU35DWNGVIp9M1tZLKzhaW8kMoeBoU"
// 'token_in_header': global_.token,//token从全局变量那里传过来
// 'token_in_header': global_.token,//token从全局变量那里传过来
},
},
timeout
:
30
*
1000
// 30秒超时
timeout
:
30
*
1000
// 30秒超时
...
@@ -31,15 +31,15 @@ export function fetch(options) {
...
@@ -31,15 +31,15 @@ export function fetch(options) {
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
console
.
log
(
'请求异常信息:'
,
error
);
console
.
log
(
'请求异常信息:'
,
error
);
//
console.log(error);
console
.
log
(
error
);
//
if (error.response.status == 401) {
if
(
error
.
response
.
status
==
401
)
{
//
localStorage.setItem('last_url', location.hash.slice(1));
localStorage
.
setItem
(
'last_url'
,
location
.
hash
.
slice
(
1
));
//
localStorage.setItem('walk_userData', '');
localStorage
.
setItem
(
'walk_userData'
,
''
);
//
location.replace('#/Author');
location
.
replace
(
'#/Author'
);
//
// this.$router.push({name:"Author"})
// this.$router.push({name:"Author"})
//
} else {
}
else
{
//
reject(error);
reject
(
error
);
//
}
}
});
});
});
});
...
...
src/components/axios/url.js
View file @
8a9d7eae
...
@@ -4,7 +4,8 @@ let service = 'dev';
...
@@ -4,7 +4,8 @@ let service = 'dev';
let
api
=
''
;
let
api
=
''
;
if
(
service
===
'dev'
)
{
if
(
service
===
'dev'
)
{
/**dev开发**/
/**dev开发**/
api
=
''
;
// api = '';
api
=
'https://miniapp-api.wxatech.com/game-bsdk'
;
}
else
if
(
service
===
'prod'
)
{
}
else
if
(
service
===
'prod'
)
{
/**prod部署**/
/**prod部署**/
api
=
'https://miniapp-api.wxatech.com/game-bsdk'
;
api
=
'https://miniapp-api.wxatech.com/game-bsdk'
;
...
...
src/views/Author.vue
View file @
8a9d7eae
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
let
local_hash
=
location
.
hash
;
let
local_hash
=
location
.
hash
;
window
.
localStorage
.
setItem
(
"local_hash"
,
local_hash
);
window
.
localStorage
.
setItem
(
"local_hash"
,
local_hash
);
let
redirect_uri
=
encodeURIComponent
(
`
${
location
.
origin
}${
location
.
pathname
}
`
);
let
redirect_uri
=
encodeURIComponent
(
`
${
location
.
origin
}${
location
.
pathname
}
`
);
location
.
replace
(
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx
9af64967a0d40159
&redirect_uri=
${
redirect_uri
}
&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
);
location
.
replace
(
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx
d1aab06cc88d0a5e
&redirect_uri=
${
redirect_uri
}
&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
);
}
else
{
}
else
{
console
.
log
(
"拿到code"
,
code
);
console
.
log
(
"拿到code"
,
code
);
console
.
log
(
"请求登录"
);
console
.
log
(
"请求登录"
);
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
// setTimeout(() => {
// setTimeout(() => {
// // this.$router.go("/MyData");
// // this.$router.go("/MyData");
location
.
replace
(
location
.
replace
(
`https://miniapp-api.wxatech.com/app_pages/
read
_daka.html?#
${
last_url
}
`
`https://miniapp-api.wxatech.com/app_pages/
walk
_daka.html?#
${
last_url
}
`
);
);
// }, 60000);
// }, 60000);
}
}
...
...
vue.config.js
View file @
8a9d7eae
//vue.config.js
//vue.config.js
module
.
exports
=
{
module
.
exports
=
{
// 选项...
// 选项...
//
publicPath: 'https://miniapp-api.wxatech.com/app_pages',
publicPath
:
'https://miniapp-api.wxatech.com/app_pages'
,
// indexPath: "read
_daka.html",
indexPath
:
"walk
_daka.html"
,
// assetsDir: "read
_static",
assetsDir
:
"walk
_static"
,
devServer
:
{
devServer
:
{
proxy
:
{
proxy
:
{
'/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