yuantianjiao 6 years ago
parent
commit
a37d16f45a

+ 2
- 1
package.json View File

@@ -27,6 +27,7 @@
27 27
     "vue-awesome-swiper": "^3.1.3",
28 28
     "vue-router": "^3.0.1",
29 29
     "vue-template-compiler": "^2.5.17",
30
-    "vuex": "^3.0.1"
30
+    "vuex": "^3.0.1",
31
+    "weixin-js-sdk": "^1.3.3"
31 32
   }
32 33
 }

+ 1
- 1
public/index.html View File

@@ -6,7 +6,7 @@
6 6
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
7 7
   <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
8 8
     charset="utf-8" />
9
-  <link rel="stylesheet" href="//at.alicdn.com/t/font_775069_5i50qqneuws.css">
9
+  <link rel="stylesheet" href="//at.alicdn.com/t/font_775069_fqsik3e9to7.css">
10 10
   <link rel="icon" href="<%= BASE_URL %>favicon.ico">
11 11
   <title>
12 12
     <%= htmlWebpackPlugin.options.title %>

BIN
src/common/icon/logoTop.png View File


+ 53
- 13
src/pages/sales/cardAndCouponNum/index.vue View File

@@ -1,12 +1,12 @@
1 1
 <template>
2
-  <div class="mainPage flex-v">
2
+  <div class="mainPage flex-v" v-if="data">
3 3
     <div class="top flex-h">
4
-      <span>¥<em>199</em>元</span>
4
+      <span>¥<em>{{parseInt(data.Price)}}</em>元</span>
5 5
       <div class="flex-item">
6 6
         <div>
7
-          <span>健身团课一次体验卡</span>
7
+          <span>{{data.CardName}}</span>
8 8
           <span>卡券描述卡券描述卡券描述卡券描述卡券描述</span>
9
-          <span>2018年02月02日 - 2018年02月03日</span>
9
+          <span>{{toolClass.dateFormat(data.StartDate)}} - {{toolClass.dateFormat(data.EndDate)}}</span>
10 10
         </div>
11 11
       </div>
12 12
     </div>
@@ -14,25 +14,25 @@
14 14
       <li class="flex-item">
15 15
         <div>
16 16
           <span>总数量</span>
17
-          <span>10</span>
17
+          <span>{{data.TotalCount}}</span>
18 18
         </div>
19 19
       </li>
20 20
       <li class="flex-item">
21 21
         <div>
22 22
           <span>剩余</span>
23
-          <span>5</span>
23
+          <span>{{data.TotalCount - data.SentCount}}</span>
24 24
         </div>
25 25
       </li>
26 26
       <li class="flex-item">
27 27
         <div>
28 28
           <span>用户领取</span>
29
-          <span>5</span>
29
+          <span>{{data.SentCount}}</span>
30 30
         </div>
31 31
       </li>
32 32
       <li class="flex-item">
33 33
         <div>
34 34
           <span>实际使用</span>
35
-          <span>2</span>
35
+          <span>{{data.UsedCount}}</span>
36 36
         </div>
37 37
       </li>
38 38
     </ul>
@@ -49,14 +49,14 @@
49 49
               </div>
50 50
               <span>用户领取</span>
51 51
             </li>
52
-            <li class="flex-h" v-for="(item,index) in 10" :key="index">
53
-              <span>xxx</span>
52
+            <li class="flex-h" v-for="(item,index) in data.CustomerCard" :key="index">
53
+              <span>{{item.SalesName}}</span>
54 54
               <div class="flex-item">
55 55
                 <div>
56
-                  <span>2</span>
56
+                  <span>{{salesData(item).receive}}</span>
57 57
                 </div>
58 58
               </div>
59
-              <span>5</span>
59
+              <span>{{salesData(item).used}}</span>
60 60
             </li>
61 61
           </ul>
62 62
         </div>
@@ -66,16 +66,56 @@
66 66
 </template>
67 67
 
68 68
 <script>
69
-
69
+import { createNamespacedHelpers } from 'vuex'
70
+const { mapState: mapForbidState, mapActions: mapForbidActions } = createNamespacedHelpers('forbid')
70 71
 export default {
71 72
   name: '',
72 73
   data () {
73 74
     return {
75
+      data: {}
74 76
     }
75 77
   },
76 78
   created () {
79
+    if (this.$route.query.type === 'card') {
80
+      this.getCardNum({ id: this.$route.query.id }).then(() => {
81
+        this.getSales({ type: 'sales' }).then(() => {
82
+          this.data = this.cardAndCoupon
83
+          this.data.CustomerCard = this.data.CustomerCard || []
84
+        })
85
+      })
86
+    } else {
87
+      this.getCouponNum({ id: this.$route.query.id }).then(() => {
88
+        this.getSales({ type: 'sales' }).then(() => {
89
+          this.data = this.cardAndCoupon
90
+          this.data.CustomerCard = this.data.CustomerCard || []
91
+        })
92
+      })
93
+    }
94
+  },
95
+  computed: {
96
+    ...mapForbidState({
97
+      salesList: x => x.salesList,
98
+      cardAndCoupon: x => x.cardAndCoupon
99
+    })
77 100
   },
78 101
   methods: {
102
+    ...mapForbidActions(['getCardNum', 'getCouponNum', 'getSales']),
103
+    salesData (item) {
104
+      let receive
105
+      let used
106
+      if (this.$route.query.type === 'card') {
107
+        receive = this.salesList.filter(x => x.UserId === item.UserId).length > 0 ? this.salesList.filter(x => x.UserId === item.UserId) : 0
108
+        used = this.salesList.filter(x => x.UserId === item.UserId && item.VerifyStatus === '已核销').length > 0 ? this.salesList.filter(x => x.UserId === item.UserId && item.VerifyStatus === '已核销').length : 0
109
+      } else {
110
+        receive = this.salesList.filter(x => x.UserId === item.UserId).length > 0 ? this.salesList.filter(x => x.UserId === item.UserId) : 0
111
+        used = this.salesList.filter(x => x.UserId === item.UserId && item.VerifyStatus === '已核销').length > 0 ? this.salesList.filter(x => x.UserId === item.UserId && item.VerifyStatus === '已核销').length : 0
112
+      }
113
+
114
+      return {
115
+        'receive': receive,
116
+        'used': used
117
+      }
118
+    },
79 119
   }
80 120
 }
81 121
 </script>

+ 23
- 21
src/pages/sales/salesGiveOutDetail/index.vue View File

@@ -3,16 +3,16 @@
3 3
     <div class="top">
4 4
       <topCaseInfo :data="topCaseInfoData" @selectCase="showSelect = true"></topCaseInfo>
5 5
     </div>
6
-    <div class="flex-item flex-v body">
7
-      <span>销售姓名:<em>柳依依</em></span>
6
+    <div class="flex-item flex-v body" v-if="data.allCard">
7
+      <span>销售姓名:<em>{{data.RealName}}</em></span>
8 8
       <ul class="flex-h">
9 9
         <li class="flex-item" :class="{'active': activeIndex === 0}" @click="cutNav(0)">
10 10
           <span>饮品</span>
11
-          <span>(已赠送12杯)</span>  
11
+          <span>(已赠送{{data.CustomerCard.length + data.CustomerCoupon.length}}杯)</span>  
12 12
         </li> 
13 13
         <li class="flex-item" :class="{'active': activeIndex === 1}" @click="cutNav(1)">
14 14
           <span>卡券</span>
15
-          <span>(已发出12张)</span>  
15
+          <span>(已发出{{data.OrdersDetail.length}}张)</span>  
16 16
         </li> 
17 17
       </ul>
18 18
       <div class="flex-item">
@@ -20,35 +20,35 @@
20 20
           <ul>
21 21
             <li :hidden="activeIndex === 1">
22 22
               <ul class="list">
23
-                <li class="flex-h" v-for="(item,index) in 40" :key="index">
23
+                <li class="flex-h" v-for="(item,index) in data.OrdersDetail" :key="index">
24 24
                   <div class="flex-item">
25 25
                     <div>
26
-                      <span>水吧特级调试咖啡水吧特级调试咖啡水吧特级调试咖啡水吧特级调试咖啡</span>
26
+                      <span>{{item.GoodsName}}</span>
27 27
                     </div>
28 28
                   </div>
29 29
                   <div class="flex-item">
30 30
                     <div>
31
-                      <span>¥50 * 1</span>
31
+                      <span>¥{{item.Price}} * 1</span>
32 32
                     </div>
33 33
                   </div>
34
-                  <span>2018/03/03 15:02:02</span>
34
+                  <span>{{toolClass.dateFormat(item.ReceiveDate)}}</span>
35 35
                 </li>
36 36
               </ul>
37 37
             </li>
38 38
             <li :hidden="activeIndex === 0">
39 39
               <ul class="list">
40
-                <router-link tag="li" class="flex-h" v-for="(item,index) in 40" :key="index" :to="{name: 'cardAndCouponNum', query: {}}">
40
+                <router-link tag="li" class="flex-h" v-for="(item,index) in data.allCard" :key="index" :to="{name: 'cardAndCouponNum', query: { id: item.CardId || item.CaseId, type:item.CardId ? 'card' : 'coupon' }}">
41 41
                   <div class="flex-item">
42 42
                     <div>
43
-                      <span>健身团课体验卡</span>
43
+                      <span>{{item.CustomerCardName || item.CustomerCouponName}}</span>
44 44
                     </div>
45 45
                   </div>
46 46
                   <div class="flex-item">
47 47
                     <div>
48
-                      <span>¥50 * 1</span>
48
+                      <span>¥{{item.Price}} * 1</span>
49 49
                     </div>
50 50
                   </div>
51
-                  <span>2018/03/03 15:02:02</span>
51
+                  <span>{{toolClass.dateFormat(item.ReceiveDate)}}</span>
52 52
                 </router-link>
53 53
               </ul>
54 54
             </li>
@@ -75,14 +75,7 @@ export default {
75 75
         showSelect: false,
76 76
         userName: 'xxx'
77 77
       },
78
-      data: [
79
-        [
80
-          {}
81
-        ],
82
-        [
83
-
84
-        ]
85
-      ]
78
+      data: {}
86 79
     }
87 80
   },
88 81
   computed: {
@@ -94,13 +87,22 @@ export default {
94 87
     topCaseInfo,
95 88
   },
96 89
   created () {
97
-    this.getSalesCardList({ id: this.$route.query.id })
90
+    this.getSalesCardList({ id: this.$route.query.id }).then(() => {
91
+      this.data = this.salesCardList
92
+      this.data.CustomerCard = this.data.CustomerCard ? this.data.CustomerCard : []
93
+      this.data.CustomerCoupon = this.data.CustomerCoupon ? this.data.CustomerCoupon : []
94
+      this.data.OrdersDetail = this.data.OrdersDetail ? this.data.OrdersDetail : []
95
+      this.data.allCard = this.data.CustomerCard.concat(this.data.CustomerCoupon)
96
+    })
98 97
   },
99 98
   methods: {
100 99
     ...mapForbidActions(['getSalesCardList']),
101 100
     cutNav (index) {
102 101
       this.activeIndex = index
103 102
     },
103
+    dateFomart (date) {
104
+      return this.toolClass.dateFormat(date)
105
+    }
104 106
   }
105 107
 }
106 108
 </script>

+ 1
- 1
src/pages/user/App.vue View File

@@ -12,7 +12,7 @@ export default {
12 12
   name: 'app',
13 13
   data () {
14 14
     return {
15
-      showPage: false
15
+      showPage: true
16 16
     }
17 17
   },
18 18
   components: {},

+ 63
- 0
src/pages/user/receive/index.vue View File

@@ -0,0 +1,63 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <div v-if='video' class="logo">
4
+      <img :src="logo" alt="">
5
+    </div>
6
+    <div class="banner"  v-if="!video">
7
+      <img src="" alt="" width="100%" height="100%">
8
+    </div>
9
+    <div class="content">
10
+      <div class="title">彻天彻地童玩探险乐园家庭套餐</div>
11
+      <div class="video" v-if='video'>
12
+        <video src="http://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/c395af03fd02acc07edcea5b21e5a3231536905593.mp4" width="100%" height="100%"></video>
13
+      </div>
14
+      <div class="text">
15
+        <div>
16
+          <i class="icon-shuoming iconfont"></i>
17
+          <span>卡券使用说明</span>
18
+        </div>
19
+        <pre>1. 本券不兑现金,不找零; 2. 票券仅作为门票费用,不能抵扣其他消费; 3. 营业时间:周一、二闭馆,周三、四(9:30-17:00),周五、六、日(9:30-20:00) 4. 咨询电话:0571-89008367</pre>
20
+      </div>
21
+      <div class="text">
22
+        <div>
23
+          <i class="icon-kaquan iconfont"></i>
24
+          <span>卡券有效期</span>
25
+        </div>
26
+        <pre>有效期至2018年10月1号,请在有效期结束前使用, 过期作废;</pre>
27
+      </div>
28
+      <div class="text" v-if="video">
29
+        <div>
30
+          <i class="icon-dingwei iconfont"></i>
31
+          <span>服务网点</span>
32
+        </div>
33
+        <pre>银城G99门店 地址:金马路230号</pre>
34
+      </div>
35
+      <div class="submit">确认领取</div>
36
+    </div>
37
+  </div>
38
+</template>
39
+
40
+<script>
41
+import wxsdk from '../../../util/share'
42
+import logo from '../../../common/icon/logoTop.png'
43
+export default {
44
+  data () {
45
+    return {
46
+      logo,
47
+      video: true
48
+    }
49
+  },
50
+  created () {
51
+    wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
52
+      title: '悦见山,金秋送好礼',
53
+      desc: '扫码分享,免费抽取赢森林音乐节门票,机会有限,速来参加',
54
+      link: `${window.location.origin}${window.location.pathname}`,
55
+      thu_image: `${window.location.origin}${window.location.pathname}${logo}`
56
+    })
57
+  }
58
+}
59
+</script>
60
+
61
+<style lang="scss" scoped>
62
+@import 'page.scss';
63
+</style>

src/pages/user/share/page.scss → src/pages/user/receive/page.scss View File

@@ -1,4 +1,9 @@
1 1
 .mainPage{
2
+  .logo{
3
+    img{
4
+      width: 1.05rem;
5
+    }
6
+  }
2 7
   .banner{
3 8
     width: 100%;
4 9
     height: 1.8rem;
@@ -6,6 +11,13 @@
6 11
   .content{
7 12
     padding: .2rem;
8 13
     box-sizing: border-box;
14
+    .video{
15
+      width: 100%;
16
+      height: 1.8rem;
17
+      box-sizing: border-box;
18
+      padding: .15rem;
19
+      margin-bottom: .15rem;
20
+    }
9 21
     .title{
10 22
       font-size: .18rem;
11 23
       padding-bottom: .2rem;
@@ -22,6 +34,8 @@
22 34
       }
23 35
       pre{
24 36
         color: #323232;
37
+        white-space: pre-wrap;
38
+        word-wrap: break-word;
25 39
       }
26 40
     }
27 41
     .submit{

+ 32
- 0
src/pages/user/receiveResults/index.vue View File

@@ -0,0 +1,32 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <div class="contenr">
4
+      <i class="iconfont icon-ziyuan" v-if="status === 'success'"></i>
5
+      <i class="iconfont icon-shibai fail" v-else></i>
6
+      <span>领取成功!</span>
7
+      <span>快去个人中心查看我的体验券</span>
8
+      <div class="back" v-if="status === 'success'">查看我的体验券</div>
9
+      <div v-else></div>
10
+      <img :src="logo">
11
+    </div>
12
+  </div>
13
+</template>
14
+
15
+<script>
16
+import logo from '../../../common/icon/logoTop.png'
17
+export default {
18
+  data () {
19
+    return {
20
+      logo,
21
+      status: 'fail'
22
+    }
23
+  },
24
+  created () {
25
+
26
+  }
27
+}
28
+</script>
29
+
30
+<style lang="scss" scoped>
31
+@import 'page.scss';
32
+</style>

+ 36
- 0
src/pages/user/receiveResults/page.scss View File

@@ -0,0 +1,36 @@
1
+.contenr{
2
+  display: flex;
3
+  flex-flow: column nowrap;
4
+  justify-content: center;
5
+  align-items: center;
6
+  padding-top: 1.35rem;
7
+  i{
8
+    font-size: .6rem;
9
+    color: rgb(253, 89, 58);
10
+    &.fail{
11
+      color: #323B45;
12
+    }
13
+  }
14
+  span{
15
+    color: #323B45;
16
+    font-size: .16rem;
17
+    margin-top: .1rem;
18
+  }
19
+  div{
20
+    width: 3rem;
21
+    height: .5rem;
22
+    margin-top: .67rem;
23
+  }
24
+  .back{
25
+    border-radius: .25rem;
26
+    border:1px solid rgba(114,114,114,1);
27
+    line-height: .5rem;
28
+    text-align: center;
29
+    color: #323B45;
30
+    font-size: .16rem;
31
+  }
32
+  img{
33
+    width: 1rem;
34
+    margin-top: 1rem;
35
+  }
36
+}

+ 11
- 5
src/pages/user/router.js View File

@@ -20,7 +20,8 @@ import coupons from './coupons/index' // 优惠券
20 20
 import lessonDetail from './lessonDetail/index' // 课程详情
21 21
 import cardDetail from './cardDetail/index' // 体验卡详情
22 22
 import couponsDetail from './couponsDetail/index' // 体验券详情
23
-import share from './share/index' // 卡券分享页面
23
+import receive from './receive/index' // 领取页面
24
+import receiveResults from './receiveResults/index' // 领取结果页面
24 25
 
25 26
 Vue.use(Router)
26 27
 
@@ -120,10 +121,15 @@ const router = new Router({
120 121
     name: 'couponsDetail',
121 122
     component: couponsDetail,
122 123
     children: []
123
-  }, { // 卡券分享
124
-    path: '/share',
125
-    name: 'share',
126
-    component: share,
124
+  }, { // 卡券领取
125
+    path: '/receive',
126
+    name: 'receive',
127
+    component: receive,
128
+    children: []
129
+  }, { // 卡券领取结果
130
+    path: '/receiveResults',
131
+    name: 'receiveResults',
132
+    component: receiveResults,
127 133
     children: []
128 134
   }],
129 135
   linkActiveClass: 'active',

+ 0
- 39
src/pages/user/share/index.vue View File

@@ -1,39 +0,0 @@
1
-<template>
2
-  <div class="mainPage">
3
-    <div class="banner">
4
-      <img src="" alt="" width="100%" height="100%">
5
-    </div>
6
-    <div class="content">
7
-      <div class="title">彻天彻地童玩探险乐园家庭套餐</div>
8
-      <div class="text">
9
-        <div>
10
-          <i class="icon-shuoming iconfont"></i>
11
-          <span>卡券使用说明</span>
12
-        </div>
13
-        <pre>工作工作工作工作工作工作工作工作工作给</pre>
14
-      </div>
15
-      <div class="text">
16
-        <div>
17
-          <i class="icon-shuoming iconfont"></i>
18
-          <span>卡券使用说明</span>
19
-        </div>
20
-        <pre>工作工作工作工作工作工作工作工作工作给</pre>
21
-      </div>
22
-      <div class="submit">确认领取</div>
23
-    </div>
24
-  </div>
25
-</template>
26
-
27
-<script>
28
-export default {
29
-  data () {
30
-    return {
31
-
32
-    }
33
-  }
34
-}
35
-</script>
36
-
37
-<style lang="scss" scoped>
38
-@import 'page.scss';
39
-</style>

+ 35
- 1
src/store/forbid/index.js View File

@@ -7,7 +7,8 @@ export default {
7 7
   state: {
8 8
     salesList: [],
9 9
     forbidList: [],
10
-    salesCardList: []
10
+    salesCardList: [],
11
+    cardAndCoupon: {}
11 12
   },
12 13
   mutations: {
13 14
     setSalesList (state, data) {
@@ -18,6 +19,9 @@ export default {
18 19
     },
19 20
     setSalesCardList (state, data) {
20 21
       state.salesCardList = data || []
22
+    },
23
+    setCardAndCoupon (state, data) {
24
+      state.cardAndCoupon = data || {}
21 25
     }
22 26
   },
23 27
   actions: {
@@ -90,6 +94,36 @@ export default {
90 94
           reject(err)
91 95
         })
92 96
       })
97
+    },
98
+    getCardNum (context, data) {
99
+      return new Promise((resolve, reject) => {
100
+        Ajax(api.director.getCardNum.url, {
101
+          method: api.director.getCardNum.method,
102
+          urlData: {
103
+            ...data
104
+          }
105
+        }).then(res => {
106
+          context.commit('setCardAndCoupon', res)
107
+          resolve(res)
108
+        }).catch((err) => {
109
+          reject(err)
110
+        })
111
+      })
112
+    },
113
+    getCouponNum (context, data) {
114
+      return new Promise((resolve, reject) => {
115
+        Ajax(api.director.getCouponNum.url, {
116
+          method: api.director.getCouponNum.method,
117
+          urlData: {
118
+            ...data
119
+          }
120
+        }).then(res => {
121
+          context.commit('setCardAndCoupon', res)
122
+          resolve(res)
123
+        }).catch((err) => {
124
+          reject(err)
125
+        })
126
+      })
93 127
     }
94 128
   }
95 129
 }

+ 0
- 1
src/util/ajax.js View File

@@ -10,7 +10,6 @@ const token = function (headers) {
10 10
     localStorage.setItem('JWT', headers.authorization)
11 11
     JWT = headers.authorization
12 12
   }
13
-  console.log(JWT)
14 13
   return JWT ? JWT : localStorage.getItem('JWT')
15 14
 }
16 15
 

+ 16
- 2
src/util/api.js View File

@@ -124,13 +124,21 @@ const $api = {
124 124
       method: 'post',
125 125
       url: `${baseUrl}${wechat}/user/forbid/:userid/:type`
126 126
     },
127
-    putForbid:{ // 关闭禁用状态
127
+    putForbid: { // 关闭禁用状态
128 128
       method: 'put',
129 129
       url: `${baseUrl}${wechat}/user/forbid/:userid/:type`
130 130
     },
131
-    getSalesCardList: {
131
+    getSalesCardList: { // 获取销售发卡详情
132 132
       method: 'get',
133 133
       url: `${baseUrl}${wechat}/user/detail/:id`
134
+    },
135
+    getCardNum: { // 获取卡数量
136
+      method: 'get',
137
+      url: `${baseUrl}${wechat}/card/detail/:id`
138
+    },
139
+    getCouponNum: { // 获取券数量
140
+      method: 'get',
141
+      url: `${baseUrl}${wechat}/coupon/detail/:id`
134 142
     }
135 143
   },
136 144
   login: { // 主管、销售端登陆
@@ -151,5 +159,11 @@ const $api = {
151 159
       url: `${baseUrl}${wechat}/goods/user`
152 160
     }
153 161
   },
162
+  share: {
163
+    share: {
164
+      method: 'get',
165
+      url: `${baseUrl}${guest}/wechat/jssdk/signature/:url`
166
+    }
167
+  }
154 168
 }
155 169
 export default $api

+ 57
- 26
src/util/share.js View File

@@ -1,4 +1,4 @@
1
-import axios from 'axios'
1
+import Ajax from './ajax'
2 2
 import api from './api'
3 3
 
4 4
 function wxsdk (params, config) {
@@ -12,33 +12,64 @@ function wxsdk (params, config) {
12 12
   }
13 13
   // 初始化
14 14
   return new Promise(function (resolve) {
15
-    axios.post(api.common.shareWx.url + '?url=' + params.url)
16
-      .then(function (res) {
17
-        let result = JSON.parse(res.data)
18
-        wx.config({
19
-          debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
20
-          appId: result.appId, // 必填,公众号的唯一标识
21
-          timestamp: result.timestamp, // 必填,生成签名的时间戳
22
-          nonceStr: result.noncestr, // 必填,生成签名的随机串
23
-          signature: result.signature, // 必填,签名,见附录1
24
-          jsApiList: [
25
-            'onMenuShareTimeline',
26
-            'onMenuShareAppMessage',
27
-            'onMenuShareQQ',
28
-            'onMenuShareWeibo',
29
-            'onMenuShareQZone',
30
-            'openLocation'
31
-          ]
32
-        })
33
-        wx.ready(function () {
34
-          wx.onMenuShareTimeline(shareData)
35
-          wx.onMenuShareAppMessage(shareData)
36
-          // resolve()
37
-        })
15
+    Ajax(api.share.share.url, {
16
+      method: api.share.share.method,
17
+      urlData: {
18
+        ...params
19
+      }
20
+    }).then(result => {
21
+      wx.config({
22
+        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
23
+        appId: result.appId, // 必填,公众号的唯一标识
24
+        timestamp: result.timestamp, // 必填,生成签名的时间戳
25
+        nonceStr: result.noncestr, // 必填,生成签名的随机串
26
+        signature: result.signature, // 必填,签名,见附录1
27
+        jsApiList: [
28
+          'onMenuShareTimeline',
29
+          'onMenuShareAppMessage',
30
+          'onMenuShareQQ',
31
+          'onMenuShareWeibo',
32
+          'onMenuShareQZone',
33
+          'openLocation'
34
+        ]
38 35
       })
39
-      .catch(function (error) {
40
-        console.log(error)
36
+      wx.ready(function () {
37
+        wx.onMenuShareTimeline(shareData)
38
+        wx.onMenuShareAppMessage(shareData)
39
+        resolve()
41 40
       })
41
+      // resolve(res)
42
+    }).catch((err) => {
43
+      reject(err)
44
+    })
45
+
46
+    // axios.post(api.share.share.url + '?url=' + params.url)
47
+    //   .then(function (res) {
48
+    //     let result = JSON.parse(res.data)
49
+    //     wx.config({
50
+    //       debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
51
+    //       appId: result.appId, // 必填,公众号的唯一标识
52
+    //       timestamp: result.timestamp, // 必填,生成签名的时间戳
53
+    //       nonceStr: result.noncestr, // 必填,生成签名的随机串
54
+    //       signature: result.signature, // 必填,签名,见附录1
55
+    //       jsApiList: [
56
+    //         'onMenuShareTimeline',
57
+    //         'onMenuShareAppMessage',
58
+    //         'onMenuShareQQ',
59
+    //         'onMenuShareWeibo',
60
+    //         'onMenuShareQZone',
61
+    //         'openLocation'
62
+    //       ]
63
+    //     })
64
+    //     wx.ready(function () {
65
+    //       wx.onMenuShareTimeline(shareData)
66
+    //       wx.onMenuShareAppMessage(shareData)
67
+    //       // resolve()
68
+    //     })
69
+    //   })
70
+    //   .catch(function (error) {
71
+    //     console.log(error)
72
+    //   })
42 73
   })
43 74
 }
44 75