张延森 3 years ago
parent
commit
4d5ddbab7d
3 changed files with 5 additions and 3 deletions
  1. 1
    1
      src/components/BgMusic.vue
  2. 3
    1
      src/utils/request.js
  3. 1
    1
      src/utils/wx.js

+ 1
- 1
src/components/BgMusic.vue View File

13
     return {
13
     return {
14
       show: false,
14
       show: false,
15
       playing: false,
15
       playing: false,
16
-      url: `${origin}${pathname}/bg.mp3`
16
+      url: `${origin}${pathname}bg.mp3`
17
     }
17
     }
18
   },
18
   },
19
   mounted() {
19
   mounted() {

+ 3
- 1
src/utils/request.js View File

5
   const headers = new Headers();
5
   const headers = new Headers();
6
   headers.append('Content-Type', 'application/json;charset=utf8');
6
   headers.append('Content-Type', 'application/json;charset=utf8');
7
   headers.append('X-Authorization-JWT', getToken());
7
   headers.append('X-Authorization-JWT', getToken());
8
+  // headers.append('credentials', 'include');
9
+  // headers.append('mode', 'cors');
8
 
10
 
9
   Object.keys(options.headers || {}).forEach(key => headers.append(key, options.headers[key]))
11
   Object.keys(options.headers || {}).forEach(key => headers.append(key, options.headers[key]))
10
 
12
 
11
-  return fetch(url, {...options, headers })
13
+  return fetch(url, {...options, headers, credentials: 'include', mode: 'cors' })
12
     .then(response => response.json())
14
     .then(response => response.json())
13
     .then(data => {
15
     .then(data => {
14
       if (data.code === 1000) return data.data
16
       if (data.code === 1000) return data.data

+ 1
- 1
src/utils/wx.js View File

68
   const queryCode = getCode();
68
   const queryCode = getCode();
69
   localStorage.setItem('wxcode', queryCode)
69
   localStorage.setItem('wxcode', queryCode)
70
 
70
 
71
-  if (!queryCode || queryCode !== originCode) {
71
+  if (!queryCode || queryCode === originCode) {
72
     const local = encodeURIComponent(location.origin + location.pathname)
72
     const local = encodeURIComponent(location.origin + location.pathname)
73
     const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd3bab568bc42d1de&redirect_uri=${local}&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect`
73
     const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd3bab568bc42d1de&redirect_uri=${local}&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect`
74
     window.location.href = url
74
     window.location.href = url