张延森 3 år sedan
förälder
incheckning
2538997f1c

+ 1
- 0
package.json Visa fil

@@ -8,6 +8,7 @@
8 8
     "lint": "vue-cli-service lint"
9 9
   },
10 10
   "dependencies": {
11
+    "axios": "^0.26.1",
11 12
     "core-js": "^3.8.3",
12 13
     "two.js": "^0.8.4",
13 14
     "vue": "^3.2.13",

+ 5
- 50
src/App.vue Visa fil

@@ -1,58 +1,13 @@
1 1
 <template>
2
-  <div ref="el"></div>
3
-  <FireWorkListVue :center="center" :raduis="raduis" ref="firesRef" />
2
+  <router-view />
4 3
 </template>
5 4
 
6
-<script setup>
7
-  import { onBeforeUnmount, onMounted, ref } from 'vue';
8
-  import Two from "two.js";
9
-  import FireWorkListVue from './components/FireWorkList.vue';
10
-  import game from "./game";
11
-
12
-  const el = ref()
13
-  const destroyRef = ref()
14
-  const firesRef = ref()
15
-
16
-  const raduis = 145
17
-  const center = {
18
-        x: document.body.offsetWidth / 2,
19
-        y: document.body.offsetHeight / 2,
20
-      }
21
-
22
-
23
-  const gameInit = () => {
24
-    destroyRef.value = game({
25
-      el: el.value,
26
-      center,
27
-      raduis,
28
-      onError: () => {
29
-        alert('oo ~')
30
-      },
31
-      onSuccess: () => {
32
-        alert('你真牛逼')
33
-      },
34
-      onBingo: () => {
35
-        firesRef.value.toggle()
36
-      }
37
-    })
38
-  }
39
-
40
-  onMounted(() => {
41
-    gameInit()
42
-  })
43
-
44
-  onBeforeUnmount(() => {
45
-    if (destroyRef.value) {
46
-      destroyRef.value();
47
-    }
48
-  })
49
-
50
-</script>
51
-
52 5
 <style>
53
-html, body, #app {
6
+html,
7
+body,
8
+#app {
54 9
   height: 100%;
55
-  margin: 0;
56 10
   padding: 0;
11
+  margin: 0;
57 12
 }
58 13
 </style>

Binär
src/assets/BackImage/backHome.jpg Visa fil


Binär
src/assets/BackImage/首页背景.jpg Visa fil


Binär
src/assets/TipsImage/3-4.png Visa fil


Binär
src/assets/shareImage/share.png Visa fil


Binär
src/assets/shareImage/转发预览图.jpg Visa fil


+ 1
- 0
src/components/FireWorkList.vue Visa fil

@@ -16,6 +16,7 @@
16 16
 <script setup>
17 17
 import { ref } from 'vue'
18 18
 import FireWork from './FireWork.vue'
19
+
19 20
 const colorList = [
20 21
   '#f5222d',
21 22
   '#d4380d',

+ 117
- 0
src/components/OverPage.vue Visa fil

@@ -0,0 +1,117 @@
1
+<template>
2
+  <BackPage>
3
+    <div>
4
+      <div class="overImage-box">
5
+        <img :src="overImage" class="overImage-boxBack" />
6
+      </div>
7
+      <img v-if="route.query.type =='win'" :src="winTopImage" class="overImage-top-box" />
8
+      <img v-else :src="loseTopImage" class="overImage-top-box" />
9
+
10
+      <div class="IKnow-box">
11
+        <div class="IKnow-box-top">
12
+          <img :src="tryAgain" @click="tryAgains" />
13
+          <img :src="goShare" @click="goShares" />
14
+        </div>
15
+        <div class="IKnow-box-bottom">
16
+          <img :src="goTop" @click="goTops" />
17
+        </div>
18
+      </div>
19
+    </div>
20
+  </BackPage>
21
+</template>
22
+
23
+<script>
24
+import { ref, reactive } from 'vue'
25
+import { useRoute, useRouter } from 'vue-router'
26
+
27
+import overImage from '../assets/TipsImage/3-4.png'
28
+import winTopImage from '../assets/RoundaboutImage/2-11.png'
29
+import loseTopImage from '../assets/RoundaboutImage/2-12.png'
30
+import tryAgain from '../assets/ButtonImage/再玩一次.png'
31
+import goShare from '../assets/ButtonImage/和好友一起玩.png'
32
+import goTop from '../assets/ButtonImage/排行榜.png'
33
+export default {
34
+  setup() {
35
+    const route = useRoute() //跳转
36
+    const router = useRouter() //拿参
37
+    const tryAgains = () => {
38
+      // 字符串路径
39
+      // router.push('/about')
40
+      router.back(-1)
41
+    }
42
+    const goTops = () => {
43
+      router.push({
44
+        path: '/TopRulePage',
45
+        query: {
46
+          // type: 'top'
47
+          type: 'top'
48
+        }
49
+      })
50
+    }
51
+    const goShares = () => {
52
+      //     router.push({
53
+      //   path: '/TopRulePage',
54
+      //   query: {
55
+      //     // type: 'top'
56
+      //     type: 'top'
57
+      //   }
58
+      // })
59
+    }
60
+    goShare
61
+
62
+    return {
63
+      overImage,
64
+      winTopImage,
65
+      loseTopImage,
66
+      tryAgain,
67
+      goShare,
68
+      goTop,
69
+      route,
70
+      tryAgains,
71
+      goTops,
72
+      goShares
73
+    }
74
+  }
75
+}
76
+</script>
77
+
78
+
79
+<style lang="less" scoped>
80
+.overImage-box {
81
+  width: 100vw;
82
+  position: absolute;
83
+  top: 13vh;
84
+  display: flex;
85
+  justify-content: center;
86
+  .overImage-boxBack {
87
+    width: 93%;
88
+    height: 100%;
89
+  }
90
+}
91
+.overImage-top-box {
92
+  position: absolute;
93
+  width: 67%;
94
+  top: 9vh;
95
+  left: 15vw;
96
+}
97
+.IKnow-box {
98
+  position: absolute;
99
+  bottom: 7vh;
100
+  &-top {
101
+    display: flex;
102
+    align-items: center;
103
+    justify-content: center;
104
+    > img {
105
+      width: 30%;
106
+    }
107
+  }
108
+  &-bottom {
109
+    align-items: center;
110
+    justify-content: center;
111
+    display: flex;
112
+    > img {
113
+      width: 30%;
114
+    }
115
+  }
116
+}
117
+</style>

+ 147
- 0
src/components/TopRulePage.vue Visa fil

@@ -0,0 +1,147 @@
1
+<template>
2
+  <BackPage>
3
+    <div v-if="route.query.type =='rule'">
4
+      <div class="ruleImage-box">
5
+        <img :src="ruleImage" />
6
+      </div>
7
+      <div class="IKnow-box">
8
+        <img :src="IKnow" @click="goBack" />
9
+      </div>
10
+    </div>
11
+    <div v-else>
12
+      <div class="ruleImage-box">
13
+        <img :src="TopImage" />
14
+        <div class="Scroll-box">
15
+          <div class="Scroll-box-Content" v-for="(item,index) in Toplist" :key="index">
16
+            <div class="Scroll-box-Content-sum">{{item.sum}}</div>
17
+            <div class="Scroll-box-Content-name">{{item.name}}</div>
18
+            <img
19
+              src="https://cn.bing.com/th?id=OVFT.JaWQdfSE_pzTsHLmGjbsgS&pid=News&w=197&h=112&c=14&rs=2&qlt=90"
20
+            />
21
+            <div class="Scroll-box-Content-time">{{item.tiem}}</div>
22
+          </div>
23
+        </div>
24
+      </div>
25
+      <div class="IKnow-box">
26
+        <img :src="GoHome" @click="gohomePage" />
27
+      </div>
28
+    </div>
29
+  </BackPage>
30
+</template>
31
+
32
+<script>
33
+import { useRoute, useRouter } from 'vue-router'
34
+import ruleImage from '../assets/TipsImage/3-3.png'
35
+import IKnow from '../assets/ButtonImage/我知道了.png'
36
+import { onMounted } from 'vue'
37
+
38
+import TopImage from '../assets/TipsImage/3-2.png'
39
+import GoHome from '../assets/ButtonImage/返回首页.png'
40
+export default {
41
+  setup() {
42
+    const route = useRoute()
43
+    const router = useRouter()
44
+
45
+    const goBack = () => {
46
+      // 字符串路径
47
+      router.go(-1)
48
+    }
49
+
50
+    const gohomePage = () => {
51
+      // 字符串路径
52
+      router.push('/')
53
+    }
54
+
55
+    onMounted(() => {
56
+      if (route.query.type == 'top') {
57
+      }
58
+      console.log(router)
59
+      // 打印
60
+    })
61
+
62
+    const Toplist = [
63
+      { sum: 2, name: '陈一狗', tiem: '10s' },
64
+      { sum: 45, name: '陈二狗', tiem: '10s' },
65
+      { sum: 5, name: '陈三狗', tiem: '10s' },
66
+      { sum: 4, name: '陈四狗', tiem: '26s' },
67
+      { sum: 2, name: '陈五狗', tiem: '10s' },
68
+      { sum: 1, name: '陈六狗', tiem: '10s' },
69
+      { sum: 2, name: '陈七狗', tiem: '6s' },
70
+      { sum: 2, name: '陈八狗', tiem: '10s' },
71
+      { sum: 2, name: '陈九个狗', tiem: '10s' },
72
+      { sum: 2, name: '陈十狗', tiem: '10m6s' },
73
+      { sum: 2, name: '山二猫', tiem: '10s' },
74
+      { sum: 2, name: '陈把饭狗', tiem: '1h12m33s' }
75
+    ]
76
+    return {
77
+      goBack,
78
+      gohomePage,
79
+      ruleImage,
80
+      IKnow,
81
+      TopImage,
82
+      GoHome,
83
+      Toplist,
84
+      router,
85
+      route
86
+    }
87
+  }
88
+}
89
+</script>
90
+
91
+<style lang="less" scoped>
92
+.ruleImage-box {
93
+  width: 100vw;
94
+  position: absolute;
95
+  top: 13vh;
96
+  display: flex;
97
+  justify-content: center;
98
+  > img {
99
+    width: 93%;
100
+    height: 100%;
101
+  }
102
+  .Scroll-box {
103
+    width: 80%;
104
+    height: 40vh;
105
+    top: 18vh;
106
+    position: absolute;
107
+    overflow: auto;
108
+    .Scroll-box-Content {
109
+      display: flex;
110
+      border-bottom: 1px dashed rgba(0, 0, 0, 0.3);
111
+      align-items: center;
112
+      height: 7vh;
113
+
114
+      > img {
115
+        width: 10vw;
116
+        height: 5vh;
117
+        border-radius: 50%;
118
+      }
119
+      &-sum {
120
+        // text-align: left;
121
+        // padding-left: 2em;
122
+        width: 25vw;
123
+        text-align: center;
124
+      }
125
+      &-name {
126
+        width: 30vw;
127
+        text-align: left;
128
+      }
129
+      &-time {
130
+        width: 30vw;
131
+        text-align: center;
132
+      }
133
+    }
134
+  }
135
+}
136
+.IKnow-box {
137
+  position: absolute;
138
+  width: 100vw;
139
+  display: flex;
140
+  bottom: 7vh;
141
+
142
+  justify-content: center;
143
+  > img {
144
+    width: 30%;
145
+  }
146
+}
147
+</style>

+ 33
- 0
src/components/componentsPages/BackPage.vue Visa fil

@@ -0,0 +1,33 @@
1
+
2
+<template>
3
+  <div>
4
+    <!-- :style="HomeStyle" -->
5
+    <div class="index-image">
6
+      <img :src="backHome" class="bg-image" />
7
+      <slot></slot>
8
+    </div>
9
+  </div>
10
+</template>
11
+
12
+<script >
13
+import backHome from '../../assets/BackImage/backHome.jpg'
14
+export default {
15
+  name: 'BackPage',
16
+  setup() {
17
+    return {
18
+      backHome
19
+    }
20
+  }
21
+}
22
+</script>
23
+
24
+<style lang="less" scoped>
25
+.index-image {
26
+  height: 100vh;
27
+  overflow: hidden;
28
+
29
+  .bg-image {
30
+    width: 100vw;
31
+  }
32
+}
33
+</style>

+ 135
- 0
src/components/homePage.vue Visa fil

@@ -0,0 +1,135 @@
1
+
2
+<template>
3
+  <div>
4
+    <!-- :style="HomeStyle" -->
5
+    <BackPage>
6
+      <!-- <img :src="backHome" class="bg-image" /> -->
7
+
8
+      <div class="TitleBox">
9
+        <img :src="gameTitle" />
10
+      </div>
11
+      <div class="bth-div">
12
+        <!-- <img src="../assets/index/开始游戏.png" class="bth-image" /> -->
13
+        <img :src="gameSatrt" class="bth-image" @click="linkTo" />
14
+        <img :src="gameRule" class="bth-image" @click="goRule" />
15
+      </div>
16
+    </BackPage>
17
+  </div>
18
+</template>
19
+
20
+<script >
21
+import { useRouter } from 'vue-router'
22
+import backHome from '../assets/BackImage/backHome.jpg'
23
+import gameTitle from '../assets/BackImage/首页大标.png'
24
+
25
+import gameSatrt from '../assets/ButtonImage/开始游戏.png'
26
+import gameRule from '../assets/ButtonImage/游戏规则.png'
27
+// import BackPage from './componentsPages/BackPage.vue'
28
+
29
+export default {
30
+  setup() {
31
+    const router = useRouter()
32
+    const HomeStyle = {
33
+      backgroundImage:
34
+        'url(' + require('../assets/BackImage/backHome.jpg') + ')',
35
+      backgroundRepeat: 'no-repeat',
36
+      backgroundSize: '100% auto'
37
+    }
38
+
39
+    const linkTo = () => {
40
+      // 字符串路径
41
+      // router.push('/about')
42
+
43
+      // 带有路径的对象
44
+      router.push({
45
+        path: '/OverPage',
46
+        query: {
47
+          type: 'win'
48
+        }
49
+      })
50
+    }
51
+    const goRule = () => {
52
+      // 字符串路径
53
+      // router.push('/about')
54
+
55
+      // 带有路径的对象
56
+      router.push({
57
+        path: '/TopRulePage',
58
+        query: {
59
+          // type: 'top'
60
+          type: 'rule'
61
+        }
62
+      })
63
+    }
64
+
65
+    return {
66
+      HomeStyle,
67
+      linkTo,
68
+      backHome,
69
+      gameSatrt,
70
+      gameRule,
71
+      gameTitle,
72
+      goRule
73
+    }
74
+  }
75
+}
76
+</script>
77
+
78
+<style lang="less" scoped>
79
+// @keyframes scaleDraw {
80
+//   0% {
81
+//     transform: scale(0.2);
82
+//   }
83
+//   50% {
84
+//     transform: scale(1.1);
85
+//   }
86
+//   100% {
87
+//     transform: scale(1);
88
+//   }
89
+// }
90
+@keyframes scaleDraw {
91
+  0% {
92
+    transform: scale(0.9);
93
+  }
94
+  25% {
95
+    transform: scale(1.1);
96
+  }
97
+  45% {
98
+    transform: scale(0.9);
99
+  }
100
+
101
+  75% {
102
+    transform: scale(1);
103
+  }
104
+}
105
+
106
+.TitleBox {
107
+  width: 99%;
108
+  position: absolute;
109
+  top: 15vh;
110
+  display: flex;
111
+  justify-content: center;
112
+  animation: scaleDraw 1.4s ease-out 1;
113
+
114
+  > img {
115
+    width: 85%;
116
+    height: 100%;
117
+  }
118
+}
119
+
120
+.bg-image {
121
+  // width: 100%;
122
+  width: 100vw;
123
+}
124
+.bth-div {
125
+  width: 33vw;
126
+  position: absolute;
127
+  top: 80vh;
128
+  left: 35vw;
129
+  display: flex;
130
+  justify-content: center;
131
+  .bth-image {
132
+    width: 100%;
133
+  }
134
+}
135
+</style>

+ 31
- 1
src/main.js Visa fil

@@ -1,4 +1,34 @@
1 1
 import { createApp } from 'vue'
2 2
 import App from './App.vue'
3 3
 
4
-createApp(App).mount('#app')
4
+import router from './router'
5
+import BackPage from './components/componentsPages/BackPage.vue'
6
+
7
+// 创建 App实例
8
+const app = createApp(App)
9
+
10
+// redirect()
11
+
12
+// Login().then(e => {
13
+//   new Vue({
14
+//     router,
15
+//     store,
16
+//     render: h => h(App),
17
+//   }).$mount('#app')
18
+
19
+// }).catch(e => {
20
+//   console.error(e)
21
+//   // alert('系统错误, 请刷新重试')
22
+//   // 重试一次
23
+//   redirect(true)
24
+// })
25
+
26
+// 让整个App应用支持路由
27
+app.use(router)
28
+// 将实例挂载到 #app节点上
29
+app.mount('#app')
30
+app.component('BackPage', BackPage)
31
+
32
+// createApp(App).mount('#app')
33
+
34
+

+ 26
- 0
src/router/index.js Visa fil

@@ -0,0 +1,26 @@
1
+import { createRouter, createWebHistory } from 'vue-router'
2
+import homePage from '../components/homePage.vue'
3
+import OverPage from '../components/OverPage.vue'
4
+import TopRulePage from '../components/TopRulePage.vue'
5
+const routerHistory = createWebHistory()
6
+const routes = [
7
+  {
8
+    path: '/',
9
+    component: homePage
10
+  },
11
+  {
12
+    path: '/OverPage',
13
+    component: OverPage
14
+  },
15
+  {
16
+    path: '/TopRulePage',
17
+    component: TopRulePage
18
+  }
19
+]
20
+
21
+
22
+const router = createRouter({
23
+  history: routerHistory,
24
+  routes
25
+})
26
+export default router

+ 11
- 0
src/utils/api.js Visa fil

@@ -0,0 +1,11 @@
1
+import request from "./request";
2
+
3
+
4
+
5
+// /**
6
+//  * @login
7
+//  *
8
+//  */
9
+// //
10
+// export const LoginUser = (params, data,) => request(`/api/wx/login?code=${params}`, { method: 'post' })
11
+

+ 173
- 0
src/utils/initial.js Visa fil

@@ -0,0 +1,173 @@
1
+import request from './request'
2
+import { LoginUser, pv } from './api'
3
+
4
+
5
+
6
+const jsApiList = [
7
+  'updateAppMessageShareData',
8
+  'updateTimelineShareData',
9
+  'onMenuShareTimeline',
10
+  'onMenuShareAppMessage',
11
+  'onMenuShareQQ',
12
+  'onMenuShareWeibo',
13
+  'onMenuShareQZone'
14
+]
15
+
16
+function initSDK (url) {
17
+  request(`/api/wx/jssdk?url=${encodeURIComponent(url)}`)
18
+    .then((res) => {
19
+      window.wx.config({
20
+        debug: process.env.NODE_ENV === 'development', // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
21
+        appId: res.appId, // 必填,公众号的唯一标识
22
+        timestamp: res.timestamp, // 必填,生成签名的时间戳
23
+        nonceStr: res.nonceStr, // 必填,生成签名的随机串
24
+        signature: res.signature, // 必填,签名
25
+        jsApiList // 必填,需要使用的JS接口列表
26
+      })
27
+    })
28
+}
29
+// Vue.use(Vuex)
30
+
31
+/**
32
+ * 分享
33
+ * @param {*} opt
34
+ */
35
+export function share (opt) {
36
+  const { origin, pathname, search } = window.location
37
+  // const defaultLink = origin + pathname
38
+  const defaultImg = `${origin}${pathname}images/share.png`
39
+
40
+  const link = origin + pathname + search // window.location.href
41
+  const imgUrl = opt.imgUrl || defaultImg
42
+
43
+  initSDK(link)
44
+  window.wx.ready(function () {
45
+    jsApiList.map((apiName) => {
46
+      const fn = window.wx[apiName]
47
+      if (typeof fn === 'function') {
48
+        fn({
49
+          title: opt.title || '干洗护理 诠释新生', // 分享标题
50
+          link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
51
+          imgUrl, // 分享图标
52
+          desc: opt.desc || 'COLMO开启干洗护理新时代'
53
+        })
54
+      }
55
+    })
56
+  })
57
+}
58
+
59
+
60
+export function Login () {
61
+  console.log(1);
62
+  const code = process.env.NODE_ENV === 'development' ? '123' : getCode()
63
+
64
+  let isLoaded = false; //定义变量
65
+
66
+
67
+  //执行Timeout 如果一秒内登陆成功,由LoginUser改变isLoaded状态,Timeout 一秒后发现isLoaded为true,则关闭。
68
+  const t = setTimeout(() => {
69
+    console.log(2);
70
+
71
+    if (isLoaded) {
72
+      console.log(isLoaded);
73
+
74
+      hideLoading()
75
+    } else {
76
+      console.log('isLoaded=true');
77
+
78
+      isLoaded = true
79
+    }
80
+    clearTimeout(t);
81
+  }, 2000);
82
+
83
+
84
+  return LoginUser(code).then(e => {
85
+    // PVsum
86
+    console.log(e);
87
+    let userInfo = {
88
+      token: e.token,
89
+      name: e.person.name,
90
+      phone: e.person.phone,
91
+      personId: e.person.personId,
92
+    }
93
+    let location = window.location.href
94
+
95
+    console.log(3, isLoaded);
96
+
97
+
98
+    try {
99
+      pv({ addr: location })
100
+    } catch (error) {
101
+      console.error(error)
102
+    }
103
+    try {
104
+      share({
105
+        title: '干洗护理 诠释新生',
106
+        desc: 'COLMO开启干洗护理新时代'
107
+      })
108
+    } catch (error) {
109
+      console.error(error)
110
+    }
111
+    if (isLoaded) {
112
+      console.log('hideLoading', isLoaded);
113
+      hideLoading()
114
+
115
+
116
+    } else {
117
+      isLoaded = true
118
+
119
+      console.log(4, isLoaded);
120
+
121
+    }
122
+    // setTimeout(() => {
123
+    //   console.log("🚀 ~ file: initial.js ~ line 110 ~ setTimeout ~ isLoaded", isLoaded)
124
+
125
+    //   if (isLoaded) {
126
+    //     hideLoading()
127
+    //   } else {
128
+
129
+    //     isLoaded = true
130
+    //   }
131
+    // }, 5000)
132
+
133
+
134
+    return;
135
+  })
136
+}
137
+
138
+function hideLoading () {
139
+  document.getElementsByClassName('boxZoom')[0].style = "display: none"
140
+
141
+}
142
+
143
+/**
144
+ * 获取 code
145
+ * @returns 
146
+ */
147
+export function getCode () {
148
+  const matched = /[?&]*code=([^&]+)/.exec(location.search)
149
+  if (matched) {
150
+    return decodeURIComponent(matched[1])
151
+  }
152
+}
153
+
154
+/**
155
+ * 跳转授权页面
156
+ */
157
+export function redirect (force) {
158
+  if (process.env.NODE_ENV === 'development') return;
159
+
160
+  const originCode = localStorage.getItem('wxcode');
161
+  const wxfirst = localStorage.getItem('wxfirst') === null;
162
+  const queryCode = getCode();
163
+
164
+  localStorage.setItem('wxcode', queryCode)
165
+  localStorage.setItem('wxfirst', 'not');
166
+
167
+  if (force || wxfirst || !queryCode || queryCode === originCode) {
168
+
169
+    const local = encodeURIComponent(location.origin + location.pathname)
170
+    const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd3bab568bc42d1de&redirect_uri=${local}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`
171
+    window.location.href = url;
172
+  }
173
+}

+ 38
- 0
src/utils/request.js Visa fil

@@ -0,0 +1,38 @@
1
+
2
+import axios from 'axios'
3
+
4
+export const domain = process.env.NODE_ENV === 'development' ? '' : 'http://colmo-service.dianyang.njyunzhi.com'
5
+
6
+export default function (url, options) {
7
+  const { params, header, ...leftOptions } = options || {}
8
+
9
+  return new Promise((resolve, reject) => {
10
+    // const { code, token } = store.state.user
11
+    // let header = {
12
+    //   'X-Authorization-JWT': token,
13
+    // }
14
+    axios.request({
15
+      ...leftOptions,
16
+      url: `${domain}${url}`,
17
+      // header: header,
18
+      headers: header,
19
+    }).then(res => {
20
+      const { code, data, message } = res.data
21
+      if (code === 1000) {
22
+        resolve(data)
23
+      } else {
24
+        reject(res.data)
25
+      }
26
+    }).catch(err => {
27
+      const message = err.message || err.errMsg || err
28
+      console.error("🚀 错误~ err", err)
29
+
30
+
31
+      if (err.message.includes('timeout')) {
32
+        // 请求超时
33
+        // Message.error('请求超时')
34
+      }
35
+      reject(err)
36
+    })
37
+  })
38
+}

+ 8
- 1
yarn.lock Visa fil

@@ -1939,6 +1939,13 @@ autoprefixer@^10.2.4:
1939 1939
     picocolors "^1.0.0"
1940 1940
     postcss-value-parser "^4.2.0"
1941 1941
 
1942
+axios@^0.26.1:
1943
+  version "0.26.1"
1944
+  resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9"
1945
+  integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==
1946
+  dependencies:
1947
+    follow-redirects "^1.14.8"
1948
+
1942 1949
 babel-loader@^8.2.2:
1943 1950
   version "8.2.4"
1944 1951
   resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.4.tgz#95f5023c791b2e9e2ca6f67b0984f39c82ff384b"
@@ -3224,7 +3231,7 @@ flatted@^3.1.0:
3224 3231
   resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3"
3225 3232
   integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==
3226 3233
 
3227
-follow-redirects@^1.0.0:
3234
+follow-redirects@^1.0.0, follow-redirects@^1.14.8:
3228 3235
   version "1.14.9"
3229 3236
   resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
3230 3237
   integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==