Browse Source

add readme and fix a bug of refresh

kulley 7 years ago
parent
commit
50b470dd3b
3 changed files with 48 additions and 35 deletions
  1. 8 0
      README.md
  2. 32 32
      app.js
  3. 8 3
      pages/manage/release/release.js

+ 8 - 0
README.md

@@ -0,0 +1,8 @@
+## appointment (mini-program)
+with graphql, raw miniprogrammer language
+
+<div align="center">
+    <img src="https://github.com/kulley/imgs/blob/master/appointment-mp-1.jpg" height="330" width="190" >
+    <img src="https://github.com/kulley/imgs/blob/master/appointment-mp-2.jpg" width="190">
+    <img src="https://github.com/kulley/imgs/blob/master/appointment-mp-3.jpg" height="330" width="190" >
+ </div>

+ 32 - 32
app.js

@@ -1,39 +1,39 @@
 //app.js
 App({
-  onLaunch: function () {
-    // 展示本地存储能力
-    var logs = wx.getStorageSync('logs') || [];
-    logs.unshift(Date.now());
-    wx.setStorageSync('logs', logs);
+    onLaunch: function () {
+        // 展示本地存储能力
+        var logs = wx.getStorageSync('logs') || [];
+        logs.unshift(Date.now());
+        wx.setStorageSync('logs', logs);
 
-    // 登录
-    wx.login({
-      success: res => {
-        // 发送 res.code 到后台换取 openId, sessionKey, unionId
-      }
-    });
-    // 获取用户信息
-    wx.getSetting({
-      success: res => {
-        if (res.authSetting['scope.userInfo']) {
-          // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
-          wx.getUserInfo({
+        // 登录
+        wx.login({
             success: res => {
-              // 可以将 res 发送给后台解码出 unionId
-              this.globalData.userInfo = res.userInfo
+                // 发送 res.code 到后台换取 openId, sessionKey, unionId
+            }
+        });
+        // 获取用户信息
+        wx.getSetting({
+            success: res => {
+                if (res.authSetting['scope.userInfo']) {
+                    // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
+                    wx.getUserInfo({
+                        success: res => {
+                            // 可以将 res 发送给后台解码出 unionId
+                            this.globalData.userInfo = res.userInfo
 
-              // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-              // 所以此处加入 callback 以防止这种情况
-              if (this.userInfoReadyCallback) {
-                this.userInfoReadyCallback(res)
-              }
+                            // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
+                            // 所以此处加入 callback 以防止这种情况
+                            if (this.userInfoReadyCallback) {
+                                this.userInfoReadyCallback(res)
+                            }
+                        }
+                    })
+                }
             }
-          })
-        }
-      }
-    })
-  },
-  globalData: {
-    userID: 'handsome'
-  }
+        })
+    },
+    globalData: {
+        userID: 'handsome'
+    }
 });

+ 8 - 3
pages/manage/release/release.js

@@ -64,9 +64,14 @@ Component({
         },
 
         selectServer(e) {
-            this.setData({
-                serverID: e.target.id
-            });
+            if(e.target.id === this.data.serverID) {
+                wx.startPullDownRefresh();
+            } else {
+                this.setData({
+                    serverID: e.target.id
+                });
+            }
+
             wx.showLoading({
                 title: '获取服务中',
             })