Browse Source

完成数据请求

kulley 7 years ago
parent
commit
0caeab0194

+ 116 - 3
config/gql.js

@@ -122,7 +122,6 @@ const orderbyprops = `
               id
               name
               description
-              img
               createdAt
               updatedAt
            }
@@ -175,7 +174,6 @@ const adminorderbyprops = `
               id
               name
               description
-              img
               createdAt
               updatedAt
            }
@@ -185,6 +183,115 @@ const adminorderbyprops = `
     }
 `;
 
+const updateorderAndupdaterepertory = `
+    mutation updateorderAndupdaterepertory ($order_id: ID, $repertory_id: ID, $updatedAt: String, $orderStatus: String, $count: Int) {
+      updateorder: update_order(id: $order_id updatedAt: $updatedAt orderStatus: $orderStatus) {
+        payStatus
+        remark
+        payCount
+        updatedAt
+        payTime
+        createdAt
+        orderStatus
+        id
+        customerNumber
+      }
+      
+      updaterepertory: update_repertory(id: $repertory_id count: $count updatedAt: $updatedAt) {
+        id
+        count
+        updatedAt
+      }
+    }
+`;
+
+const updateorder = `
+    mutation updateorder($updatedAt: String, $orderStatus: String, $id: ID, $user_id: ID) {
+      updateorder: update_order(updatedAt: $updatedAt orderStatus: $orderStatus id: $id user_id: $user_id ) {
+        payStatus
+        remark
+        payCount
+        updatedAt
+        payTime
+        createdAt
+        orderStatus
+        id
+        customerNumber
+      }
+    }
+`;
+
+const updateuser = `
+    mutation updateuser($id: ID, $nickname: String, $telephone: String, $updatedAt: String) {
+      updateuser: update_user(id: $id nickname: $nickname  telephone: $telephone updatedAt: $updatedAt) {
+        id
+        openid
+        admin
+        username
+        nickname
+        password
+        telephone
+        email
+        createdAt
+        updatedAt
+      }
+    }
+`;
+
+const createserver = `
+    mutation createserver($id: ID!, $name: String, $description: String, $img: String, $createdAt: String, $updatedAt: String) {
+      createserver: create_server(id: $id name: $name description: $description img: $img createdAt: $createdAt updatedAt: $updatedAt) {
+        id
+        name
+        description
+        img
+        createdAt
+        updatedAt
+      }
+    }
+`;
+
+const updateserviceAndupdaterepertory = `
+    mutation createserviceAndcreaterepertory($service_id: ID, $server_id: ID, $repertory_id: ID!, $count: Int, $description: String, $price: Float, $startTime: String, $lastTime: String, $updatedAt: String) {
+      updateservice: update_service(id: $service_id server_id: $server_id repertory_id: $repertory_id description: $description price: $price startTime: $startTime lastTime: $lastTime updatedAt: $updatedAt) {
+        id
+        description
+        price
+        startTime
+        lastTime
+        createdAt
+        updatedAt
+      }
+      
+      updaterepertory: update_repertory(id: $repertory_id service_id: $service_id count: $count updatedAt: $updatedAt) {
+        id
+        count
+        createdAt
+        updatedAt
+      }
+    }
+`;
+
+const createserviceAndcreaterepertory = `
+    mutation createserviceAndcreaterepertory($service_id: ID!, $server_id: ID, $repertory_id: ID!, $count: Int, $description: String, $price: Float, $startTime: String, $lastTime: String, $createdAt: String, $updatedAt: String) {
+      createservice: create_service(id: $service_id server_id: $server_id repertory_id: $repertory_id description: $description price: $price startTime: $startTime lastTime: $lastTime createdAt: $createdAt updatedAt: $updatedAt) {
+        id
+        description
+        price
+        startTime
+        lastTime
+        createdAt
+        updatedAt
+      }
+      
+      createrepertory: create_repertory(id: $repertory_id service_id: $service_id count: $count createdAt: $createdAt updatedAt: $updatedAt) {
+        id
+        count
+        createdAt
+        updatedAt
+      }
+    }
+`;
 
 module.exports = {
     serverbyprops: serverbyprops,
@@ -192,5 +299,11 @@ module.exports = {
     createorderAndupdaterepertory: createorderAndupdaterepertory,
     userbyid: userbyid,
     orderbyprops: orderbyprops,
-    adminorderbyprops: adminorderbyprops
+    adminorderbyprops: adminorderbyprops,
+    updateorderAndupdaterepertory: updateorderAndupdaterepertory,
+    updateorder: updateorder,
+    updateuser: updateuser,
+    createserver: createserver,
+    updateserviceAndupdaterepertory: updateserviceAndupdaterepertory,
+    createserviceAndcreaterepertory: createserviceAndcreaterepertory
 };

+ 27 - 15
pages/home/contact/contact.js

@@ -1,6 +1,6 @@
 // import Notify from '../../dist/notify/notify';
 const { fetchGraphql } = require('../../../utils/util.js');
-const { userbyid } = require('../../../config/gql.js');
+const { userbyid, updateuser } = require('../../../config/gql.js');
 const app = getApp();
 
 Component({
@@ -22,18 +22,13 @@ Component({
             });
         }
     },
-  /**
-   * 组件的初始数据
-   */
+
     data: {
         loading: true,
         phone: '',
         name: ''
     },
 
-  /**
-   * 组件的方法列表
-   */
   methods: {
       phoneInput: function (e) {
           this.setData({
@@ -45,18 +40,35 @@ Component({
               name: e.detail
           })
       },
+
       submit: function() {
-          if(this.data.name && this.data.phone) {
-              wx.showToast({
-                  title: '修改成功',
-                  icon: 'success'
+          let {name, phone} = this.data;
+          if(name && phone) {
+              fetchGraphql(updateuser,
+                  {
+                      id: app.globalData.userID,
+                      telephone: phone,
+                      nickname: name,
+                      updatedAt: Date.now()
+                  },
+                  null,
+                  'updateuser',
+                  null
+              )
+              .then(user => {
+                  console.log(user);
+                  wx.showToast({
+                      title: '修改成功',
+                      icon: 'success'
+                  });
               });
-              console.log('仅做展示,无操作');
+
           } else {
               wx.showToast({
-                  title: '修改成功',
-                  icon: 'success'
-              });
+                  title: '无效的姓名或联系方式',
+                  icon: 'none',
+                  duration: 1000
+              })
           }
 
 

+ 9 - 1
pages/home/home.js

@@ -2,7 +2,8 @@
 Page({
     data: {
         activeTab: 0,
-        kind: 'success'
+        kind: 'success',
+        refresh: ''
     },
 
     onReady() {
@@ -11,6 +12,13 @@ Page({
         })
     },
 
+    onPullDownRefresh: function () {
+        console.log('home 下拉');
+        this.setData({
+            refresh: Date.now()
+        })
+    },
+
     switchTab(e) {
         switch(e.detail.index) {
             case 0: 

+ 4 - 1
pages/home/home.json

@@ -1,8 +1,11 @@
 {
+  "enablePullDownRefresh": true,
   "usingComponents": {
     "van-tab": "../../dist/tab/index",
     "van-tabs": "../../dist/tabs/index",
     "showMy": "./showMy/showMy",
     "contact": "./contact/contact"
-  }
+  },
+  "backgroundTextStyle": "dark",
+  "backgroundColor": "#ffffff"
 }

+ 2 - 2
pages/home/home.wxml

@@ -7,8 +7,8 @@
     animated="{{true}}"
     bind:change="switchTab"
 >
-    <van-tab title="已预约" ><showMy kind="{{kind}}"/></van-tab>
-    <van-tab title="已取消" ><showMy kind="{{kind}}"/></van-tab>
+    <van-tab title="已预约" ><showMy kind="{{kind}}" refresh="{{refresh}}"/></van-tab>
+    <van-tab title="已取消" ><showMy kind="{{kind}}" refresh="{{refresh}}"/></van-tab>
     <van-tab title="我的信息"><contact /></van-tab>
 </van-tabs>
 

+ 74 - 61
pages/home/showMy/showMy.js

@@ -1,6 +1,5 @@
-// import Dialog from '../../../dist/dialog/dialog';
 const {fetchGraphql, dateTime} = require('../../../utils/util.js');
-const {orderbyprops} = require('../../../config/gql.js');
+const {orderbyprops, updateorderAndupdaterepertory, updateorder} = require('../../../config/gql.js');
 const app = getApp();
 
 Component({
@@ -8,45 +7,57 @@ Component({
         kind: {
             type: String,
             value: 'success',
-            observer(newVal, oldVal, changedPath) {
+            observer(newVal) {
                 this.setData({
                     loading: true,
-                    orders: ''
+                    orders: '',
+                    orderStatus: newVal
                 });
                 if (newVal !== '') {
-                    fetchGraphql(orderbyprops,
-                        {
-                            user_id: app.globalData.userID,
-                            orderStatus: newVal
-                        },
-                        null,
-                        'orderbyprops',
-                        null
-                    )
-                        .then(orders => {
-                            orders.forEach(order => {
-                                order.service_id.formatDate = dateTime(Number(order.service_id.startTime), true).date;
-                                order.service_id.formatStartTime = dateTime(Number(order.service_id.startTime), true).time;
-                                order.service_id.formatEndTime = dateTime(Number(order.service_id.startTime) + Number(order.service_id.lastTime), true).time;
-                            });
-                            this.setData({
-                                loading: false,
-                                orders
-                            });
-                            console.log(orders)
+                    this.noUseStorge(newVal);
+                }
+            }
+        },
+
+        refresh: {
+            type: Number,
+            observer(newVal) {
+                if (newVal !== '' && Date.now() - newVal < 1000) {
+                    this.noUseStorge(this.data.orderStatus, () => {
+                        wx.stopPullDownRefresh({
+                            complete: function () {
+                                wx.showToast({
+                                    title: '已刷新',
+                                    icon: 'success',
+                                    duration: 800
+                                });
+                            }
                         });
+                    });
                 }
             }
         }
     },
 
+
     lifetimes: {
         attached() {
-            // 在组件实例进入页面节点树时执行
+            this.noUseStorge(this.data.orderStatus);
+        }
+    },
+
+    data: {
+        loading: true,
+        orders: '',
+        orderStatus: 'success'
+    },
+
+    methods: {
+        noUseStorge (orderStatus, func) {
             fetchGraphql(orderbyprops,
                 {
                     user_id: app.globalData.userID,
-                    orderStatus: 'success'
+                    orderStatus
                 },
                 null,
                 'orderbyprops',
@@ -61,49 +72,51 @@ Component({
                     this.setData({
                         loading: false,
                         orders
-                    })
+                    });
+                    if (func) func();
                 });
-        }
-    },
-
-    data: {
-        loading: true,
-        orders: ''
-    },
-
-    methods: {
-        deleteThis() {
-            wx.showToast({
-                title: '已删除',
-                icon: 'success',
-                duration: 2000
-            });
-            console.log('仅做展示,无操作');
         },
 
-        cancelThis() {
-            // console.log('函数是进的来的');
-            // Dialog.confirm({
-            //     title: '您确定取消?',
-            //     message: '取消后30分钟内不能再次执行',
-            //
-            // }).then(() => {
-            //     // on confirm
-            // }).catch(() => {
-            //     // on cancel
-            // });
+        deleteThis(e) {
+            let orderID = e.target.id;
+            fetchGraphql(updateorder,
+                {
+                    id: orderID,
+                    user_id: app.globalData.userID,
+                    orderStatus: 'deleted',
+                    updatedAt: Date.now()
+                },
+                null,
+                'updateorder',
+                null
+            )
+                .then(order => {
+                    wx.startPullDownRefresh();
+                });
+        },
 
+        cancelThis(e) {
+            let orderID = e.target.id;
+            let repertoryID = e.target.dataset.repertoryid;
+            let count = e.target.dataset.count;
             wx.showModal({
                 title: '确定取消?',
-                content: '取消后30分钟内不能再次预约',
+                content: '真的不考虑考虑吗?',
                 success(res) {
                     if (res.confirm) {
-                        console.log('仅做展示,无操作');
-                        wx.showToast({
-                            title: '已取消',
-                            icon: 'success',
-                            duration: 2000
-                        });
+                        fetchGraphql(updateorderAndupdaterepertory,
+                            {
+                                order_id: orderID,
+                                repertory_id: repertoryID,
+                                updatedAt: Date.now(),
+                                orderStatus: 'cancelled',
+                                count: count + 1
+                            }
+                        )
+                            .then(updateBothTwo => {
+                                wx.startPullDownRefresh();
+                            });
+
                     } else if (res.cancel) {
                         console.log('你取消了')
                     }

+ 5 - 5
pages/home/showMy/showMy.wxml

@@ -8,9 +8,9 @@
 
 <block wx:for="{{orders}}" wx:key="{{order.id}}" wx:for-item="order">
     <van-card
-            num="{{order.customerNumber}}"
+            num="{{order.customerNumber}}"
             price="{{order.service_id.price}}"
-            desc="{{order.service_id.formatDate}} : {{order.service_id.formatStartTime}} - {{order.service_id.formatEndTime}}"
+            desc="服务时间: {{order.service_id.formatDate}} 的 {{order.service_id.formatStartTime}} ~ {{order.service_id.formatEndTime}}"
             title="{{order.service_id.description}}"
             custom-class="card"
             title-class="title"
@@ -22,8 +22,8 @@
             <van-button
                     wx:if="{{kind==='success'}}"
                     id="{{order.id}}"
-                    data-count="{{order.repertory_id.count}}"
-                    data-repertoryid="{{order.repertory_id.id}}"
+                    data-count="{{order.service_id.repertory_id.count}}"
+                    data-repertoryid="{{order.service_id.repertory_id.id}}"
                     bind:click="cancelThis"
                     size="small"
                     type='danger'
@@ -33,7 +33,7 @@
             <van-button
                     wx:else
                     id="{{order.id}}"
-                    data-count="{{order.repertory_id.count}}"
+                    data-count="{{order.service_id.repertory_id.count}}"
                     bind:click="deleteThis"
                     size="small"
             >

+ 2 - 0
pages/home/showMy/showMy.wxss

@@ -16,6 +16,8 @@
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
+    color: #999999;
+    font-size: 30rpx;
 }
 
 .title {

+ 7 - 3
pages/manage/allOrders/selectedOrders/selectedOrders.js

@@ -9,7 +9,8 @@ Component({
             observer(newVal, oldVal, changedPath) {
                 this.setData({
                     loading: true,
-                    orders: ''
+                    orders: '',
+                    status: newVal
                 });
                 if (newVal !== '') {
                     let varObj = {orderStatus: newVal};
@@ -25,6 +26,7 @@ Component({
                                 order.service_id.formatDate = dateTime(Number(order.service_id.startTime), true).date;
                                 order.service_id.formatStartTime = dateTime(Number(order.service_id.startTime), true).time;
                                 order.service_id.formatEndTime = dateTime(Number(order.service_id.startTime) + Number(order.service_id.lastTime), true).time;
+                                delete order.service_id.server_id.img;
                             });
 
                             this.setData({
@@ -42,7 +44,7 @@ Component({
             // 在组件实例进入页面节点树时执行
             fetchGraphql(adminorderbyprops,
                 {
-                    orderStatus: 'success'
+                    orderStatus: this.data.status
                 },
                 null,
                 'adminorderbyprops',
@@ -53,6 +55,7 @@ Component({
                         order.service_id.formatDate = dateTime(Number(order.service_id.startTime), true).date;
                         order.service_id.formatStartTime = dateTime(Number(order.service_id.startTime), true).time;
                         order.service_id.formatEndTime = dateTime(Number(order.service_id.startTime) + Number(order.service_id.lastTime), true).time;
+                        delete order.service_id.server_id.img;
                     });
 
                     this.setData({
@@ -65,7 +68,8 @@ Component({
 
     data: {
         loading: true,
-        orders: ''
+        orders: '',
+        status: 'success'
     },
 
     methods: {}

+ 2 - 2
pages/manage/allOrders/selectedOrders/selectedOrders.wxml

@@ -9,9 +9,9 @@
 <view wx:if="{{orders !== '' && orders.length !== 0}}">
     <block wx:for="{{orders}}" wx:key="{{order.id}}" wx:for-item="order">
         <van-card
-                num="{{order.customerNumber}}"
+                num="{{order.customerNumber}}"
                 price="{{order.service_id.price}}"
-                desc="{{order.service_id.formatDate}} : {{order.service_id.formatStartTime}} - {{order.service_id.formatEndTime}}"
+                desc="服务时间: {{order.service_id.formatDate}} 的 {{order.service_id.formatStartTime}} ~ {{order.service_id.formatEndTime}}"
                 title="{{order.service_id.description}}"
                 custom-class="card"
                 title-class="title"

+ 3 - 4
pages/manage/allOrders/selectedOrders/selectedOrders.wxss

@@ -11,10 +11,9 @@
 }
 
 .no-order {
-    position: absolute;
-    top: 50%;
-    left: 50%;
-    transform: translate(-50%, -50%);
+    margin: 50rpx 0 0 250rpx;
+    color: #999999;
+    font-size: 30rpx;
 }
 
 .title {

+ 9 - 1
pages/manage/manage.js

@@ -1,6 +1,7 @@
 Page({
     data: {
         activeTab: 0,
+        refresh: ''
     },
 
     onReady() {
@@ -13,5 +14,12 @@ Page({
         this.setData({
             activeTab: e.detail.index
         });
-    }
+    },
+
+    onPullDownRefresh: function () {
+        console.log('manage 下拉');
+        this.setData({
+            refresh: Date.now()
+        })
+    },
 });

+ 4 - 1
pages/manage/manage.json

@@ -8,5 +8,8 @@
     "van-tabs": "../../../dist/tabs/index",
     "AllOrders": "./allOrders/allOrders",
     "Release": "./release/release"
-  }
+  },
+  "enablePullDownRefresh": true,
+  "backgroundTextStyle": "dark",
+  "backgroundColor": "#ffffff"
 }

+ 1 - 1
pages/manage/manage.wxml

@@ -9,7 +9,7 @@
         bind:change="switchTab"
 >
   <van-tab title="所有订单" ><AllOrders /></van-tab>
-  <van-tab title="发布服务" ><Release /></van-tab>
+  <van-tab title="发布服务" ><Release refresh="{{refresh}}"/></van-tab>
 </van-tabs>
 
 

+ 32 - 17
pages/manage/release/release.js

@@ -2,31 +2,44 @@ const {fetchGraphql} = require('../../../utils/util.js');
 const {serverbyprops} = require('../../../config/gql.js');
 
 Component({
-    /**
-     * 组件的属性列表
-     */
-    properties: {},
+    properties: {
+        refresh: {
+            type: Number,
+            observer(newVal) {
+                if (newVal !== '' && Date.now() - newVal < 1000) {
+                    this.noUseStorge(() => {
+                        this.setData({
+                            serverID: ''
+                        });
+                        wx.stopPullDownRefresh({
+                            complete: function () {
+                                wx.showToast({
+                                    title: '已刷新',
+                                    icon: 'success',
+                                    duration: 800
+                                });
+                            }
+                        });
+                    });
+                }
+            }
+        }
+    },
 
-    /**
-     * 组件的初始数据
-     */
     data: {
         servers: '',
         serverID: '',
     },
 
-    /**
-     * 组件的方法列表
-     */
     methods: {
-        useStorge() {
+        useStorge(func) {
             const servers = wx.getStorageSync('servers');
-            console.log(servers);
             if (servers) {
                 this.setData({
                     servers,
                     loading: false
-                })
+                });
+                if(func) func();
             } else {
                 fetchGraphql(serverbyprops, {}, 'servers', 'serverbyprops', this).then(servers => {
                     wx.setStorage({
@@ -35,16 +48,18 @@ Component({
                     });
                     this.setData({
                         loading: false
-                    })
+                    });
+                    if(func) func();
                 })
             }
         },
 
-        noUserStorge() {
+        noUseStorge(func) {
             fetchGraphql(serverbyprops, {}, 'servers', 'serverbyprops', this).then(servers => {
                 this.setData({
                     loading: false
-                })
+                });
+                if(func) func();
             })
         },
 
@@ -66,7 +81,7 @@ Component({
 
     lifetimes: {
         attached() {
-            this.useStorge()
+            this.noUseStorge()
         }
     }
 });

+ 3 - 0
pages/manage/release/release.wxml

@@ -24,6 +24,9 @@
             <view class="avatar" style='background-image: url({{server.img}})'/>
         </view>
     </van-cell>
+</van-cell-group>
+
+<van-cell-group wx:if="{{servers !== ''}}">
     <van-cell
             title="添加"
             is-link

+ 21 - 9
pages/manage/release/serverAdd/serverAdd.js

@@ -1,8 +1,8 @@
-// pages/manage/release/serverAdd/serverAdd.js
-Component({
-    properties: {
+import {idGen, fetchGraphql} from '../../../../utils/util';
+import {createserver} from '../../../../config/gql';
 
-    },
+Component({
+    properties: {},
 
     data: {
         name: '',
@@ -23,11 +23,23 @@ Component({
         },
 
         submit() {
-            wx.showToast({
-                title: '添加成功',
-                icon: 'success'
-            });
-            console.log('仅做展示,无操作');
+            let {name, remark} = this.data;
+            fetchGraphql(createserver,
+                {
+                    id: idGen('server'),
+                    name,
+                    description: remark,
+                    img: '',
+                    createdAt: Date.now(),
+                    updatedAt: ''
+                },
+                null,
+                'createserver',
+                null
+            )
+                .then(server => {
+                    wx.startPullDownRefresh();
+                });
         },
 
         reset() {

+ 42 - 10
pages/manage/release/serviceShow/serviceRelease/serviceRelease.js

@@ -1,4 +1,5 @@
-import {dateTime} from '../../../../../utils/util';
+import {idGen, dateTime, fetchGraphql} from '../../../../../utils/util';
+import {createserviceAndcreaterepertory, updateserviceAndupdaterepertory} from '../../../../../config/gql';
 
 Component({
     properties: {
@@ -12,7 +13,7 @@ Component({
                 console.log(newVal);
                 service.id === 'add' ?
                     this.setData({
-                        price: 0,
+                        price: '',
                         description: '',
                         repertory: 0,
                         date: dateTime(Date.now(), true).date,
@@ -34,7 +35,7 @@ Component({
 
     data: {
         service: '',
-        price: 0,
+        price: '',
         description: '',
         repertory: 0,
         date: '2019-01-01',
@@ -102,7 +103,7 @@ Component({
 
         reset() {
             this.setData({
-                price: 0,
+                price: '',
                 description: '',
                 repertory: 0,
                 date: dateTime(Date.now(), true).date,
@@ -115,12 +116,43 @@ Component({
             let startTime = dateTime({date: this.data.date, time: this.data.startTime}, false);
             let endTime = dateTime({date: this.data.date, time: this.data.endTime}, false);
             let lastTime = endTime - startTime;
-            wx.showToast({
-                title: this.data.service.id==='add'?'已添加': '已修改',
-                icon: 'success',
-                duration: 2000
-            });
-            console.log('仅做展示,无操作');
+            let {price, description, repertory} = this.data;
+            if (this.data.service.id === 'add') {
+                fetchGraphql(createserviceAndcreaterepertory,
+                    {
+                        server_id: this.properties.service.server_id.id,
+                        service_id: idGen('service'),
+                        repertory_id: idGen('repertory'),
+                        description,
+                        startTime,
+                        lastTime,
+                        price,
+                        count: repertory,
+                        createdAt: Date.now(),
+                        updatedAt: ''
+                    }
+                )
+                    .then(result => {
+                        wx.startPullDownRefresh()
+                    });
+            } else {
+                fetchGraphql(updateserviceAndupdaterepertory,
+                    {
+                        server_id: this.properties.service.server_id.id,
+                        service_id: this.properties.service.id,
+                        repertory_id: this.properties.service.repertory_id.id,
+                        description,
+                        startTime,
+                        lastTime,
+                        price,
+                        count: repertory,
+                        updatedAt: Date.now()
+                    }
+                )
+                    .then(result => {
+                        wx.startPullDownRefresh()
+                    });
+            }
         },
     }
 });

+ 6 - 4
pages/manage/release/serviceShow/serviceShow.js

@@ -5,7 +5,7 @@ Component({
     properties: {
         serverID: {
             type: String,
-            observer(newVal, oldVal, changedPath) {
+            observer(newVal) {
                 this.setData({
                     services: '',
                     service: ''
@@ -20,7 +20,7 @@ Component({
                     .then(services => {
                         console.log(services);
                         wx.hideLoading()
-                    });
+                    })
                 }
             }
         }
@@ -39,9 +39,11 @@ Component({
                     service: {id: 'add', server_id: {id: this.properties.serverID}}
                 })
             } else {
+                let service = this.data.services[index];
+                delete service.server_id.img;
                 this.setData({
-                    service: this.data.services[index]
-                })
+                    service
+                });
             }
         }
     }

+ 6 - 2
utils/util.js

@@ -2,7 +2,7 @@ const idGen = (kind) => {
     return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
 };
 
-const graphqlURL = 'https://orderfcdb.szu.im/graphql';
+const graphqlURL = 'https://order.szu.im/graphql';
 
 const fetchGraphql = (query, variables, dataName, dataBack, that) => {
     // 如果给了 databack,则返回对应的数据,没有则返回全部
@@ -30,8 +30,12 @@ const fetchGraphql = (query, variables, dataName, dataBack, that) => {
                         [dataName]: data
                     })
                 }
-
+                console.log('request success', res);
                 resolve(data);
+            },
+
+            fail: function (err) {
+                console.log('request err', err)
             }
         })
     })