浏览代码

Merge branch 'master' of http://116.63.33.55/git/light-application

zxy 3 年之前
父节点
当前提交
ac70ae2e78

+ 3 - 2
light-application-wx/app.js

@@ -14,9 +14,10 @@ App({
     })
   },
   globalData: {
-    userInfo: null,
     imgPath: 'http://192.168.0.46/image',
     path: 'http://192.168.1.218:8081',
-    Authorization: ''
+    Authorization: '',
+    userInfo: {},
+    roleInfo: {}
   }
 })

+ 7 - 4
light-application-wx/pages/index-admin/index-admin.js

@@ -9,8 +9,8 @@ Page({
     data: {
         imgPath: app.globalData.imgPath,
         path: app.globalData.path,
-        username: '李海东',
-        role_name: '管理员',
+        username: app.globalData.userInfo.usernameShow,
+        role_name: app.globalData.roleInfo.name,
         app_bottom: '大城细管·大城众管·大城智管'
     },
 
@@ -19,11 +19,14 @@ Page({
      */
     onLoad: function (options) {
         let that = this;
+        that.setData({
+            username: app.globalData.userInfo.usernameShow,
+            role_name: app.globalData.roleInfo.name
+        });
         // 下一场会议
         util.get({
             url: '/api/meeting/info/getNextMeeting',
             success: (res) => {
-                console.info(res);
                 wx.hideLoading();
                 if (res.data.code != 200) {
                     util.toast(res.data.msg);
@@ -31,7 +34,7 @@ Page({
                     let datas = res.data.data;
                     that.setData({
                         nextTitle: datas.title,
-                        nextTime: datas.receptionTime,
+                        nextTime: util.formatDate(datas.receptionTime),
                         nextUnit: datas.receptionObject
                     });
                 }

+ 118 - 6
light-application-wx/pages/index-guest/index-guest.js

@@ -1,5 +1,6 @@
 // pages/index-guest/index-guest.js
 const app = getApp();
+const util = require('../../utils/util.js');
 Page({
 
     /**
@@ -8,16 +9,82 @@ Page({
     data: {
         imgPath: app.globalData.imgPath,
         path: app.globalData.path,
-        username: '李海东',
-        role_name: '嘉宾',
-        app_bottom: '大城细管·大城众管·大城智管'
+        username: app.globalData.userInfo.usernameShow,
+        role_name: app.globalData.roleInfo.name,
+        app_bottom: '大城细管·大城众管·大城智管',
+        nowTime: util.formatDate('', 'yyyy.MM.dd'),
+        nextMeeting: {}
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        let that = this;
+        if (!app.globalData.userInfo.usernameShow || !app.globalData.userInfo.nickName || !app.globalData.userInfo.headImgUrl) {
+            wx.showModal({
+                title: '提示',
+                content: '轻应用需要取您的用户信息',
+                showCancel: false,
+                confirmText: '确定',
+                success: (res) => {
+                    if (res.confirm) {
+                        wx.getUserProfile({
+                            desc: '提供优质服务',
+                            success: (res) => {
+                                console.info(res.userInfo)
+                                app.globalData.userInfo.usernameShow = res.userInfo.nickName;
+                                app.globalData.userInfo.nickName = res.userInfo.nickName;
+                                app.globalData.userInfo.headImgUrl = res.userInfo.avatarUrl;
+                                that.setData({
+                                    username: app.globalData.userInfo.usernameShow,
+                                    role_name: app.globalData.roleInfo.name
+                                });
+                                util.post({
+                                    url: '/sys/user/updateNoAuth',
+                                    data: {
+                                        id: app.globalData.userInfo.id,
+                                        nickName: res.userInfo.nickName,
+                                        usernameShow: res.userInfo.nickName,
+                                        headImgUrl: res.userInfo.avatarUrl
+                                    }
+                                });
+                            },
+                            fail: (res) => {
+                                util.toast('拒绝授权将影响您的体验感');
+                                that.setData({
+                                    username: '未知用户',
+                                    role_name: app.globalData.roleInfo.name
+                                });
+                            }
+                        });
+                    }
+                },
+            });
+        } else {
+            that.setData({
+                username: app.globalData.userInfo.usernameShow,
+                role_name: app.globalData.roleInfo.name
+            });
+        }
+        // 下一场会议
+        util.get({
+            url: '/api/meeting/info/getNextMeeting',
+            success: (res) => {
+                wx.hideLoading();
+                if (res.data.code != 200) {
+                    util.toast(res.data.msg);
+                } else {
+                    let datas = res.data.data;
+                    that.setData({
+                        nextMeeting: datas,
+                        nextTitle: datas.title,
+                        nextTime: util.formatDate(datas.receptionTime),
+                        nextUnit: datas.receptionObject
+                    });
+                }
+            }
+        });
     },
 
     /**
@@ -68,26 +135,71 @@ Page({
     onShareAppMessage: function () {
 
     },
+
     changeRole: function () {
         wx.redirectTo({
             url: '../index/index',
-        })
+        });
+    },
+
+    /**
+     * 点击查看下一场会议详情
+     */
+    meetingInfo: function () {
+        wx.navigateTo({
+            url: '../meeting-cover/meeting-cover?item=' + this.data.nextMeeting,
+        });
     },
+
+    /**
+     * 点击参观议程跳转至会议列表
+     */
     visitAgenda: function () {
         wx.navigateTo({
             url: '../meeting-list/meeting-list',
-        })
+        });
     },
+
+    /**
+     * 图片回传
+     */
+    uploadImage: function () {
+        let that = this;
+        wx.chooseImage({
+            count: 1,
+            success: function (res) {
+                console.info(res.tempFilePaths);
+                wx.uploadFile({
+                    filePath: res.tempFilePaths[0],
+                    name: 'file',
+                    url: that.data.path + '/api/upload/record/upload',
+                    header: {
+                        "Content-Type": "multipart/form-data",
+                        "Authorization": app.globalData.Authorization
+                    },
+                    formData: {
+                        fileType: 10
+                    },
+                    success(res) {
+                        console.info(res)
+                    }
+                });
+            }
+        });
+    },
+
     fileBrowse: function () {
         wx.navigateTo({
             url: '../file-browse/file-browse',
         })
     },
+
     chatRoom: function () {
         wx.navigateTo({
             url: '../chat-room/chat-room',
         })
     },
+
     lightMap: function () {
         wx.navigateTo({
             url: '../light-map/light-map',

+ 7 - 7
light-application-wx/pages/index-guest/index-guest.wxml

@@ -9,27 +9,27 @@
     <view class="line-row">热烈欢迎领导莅临指导</view>
     <image class="next-line" mode="scaleToFill" src="{{imgPath}}/index-next-line.png"></image>
     <view class="next-row-org">重庆市城市管理局</view>
-    <view class="next-row-time">2021.09.23</view>
+    <view class="next-row-time">{{nowTime}}</view>
   </view>
 </view>
 <view class="second-part">
-  <view class="curr-meeting">
-    <view class="curr-time">2022-12-13 14:30</view>
+  <view class="curr-meeting" bindtap="meetingInfo">
+    <view class="curr-time">{{nextTime}}</view>
     <view class="curr-row">
       <text class="row-title">单位:</text>
-      <text class="row-value">重庆市交通局</text>
+      <text class="row-value">{{nextUnit}}</text>
     </view>
     <view class="curr-row">
       <text class="row-title">主题:</text>
-      <text class="row-value">重庆市交通管理经验交流分享会</text>
+      <text class="row-value">{{nextTitle}}</text>
     </view>
   </view>
   <view class="bottmo-module">
-    <view class="light">
+    <view class="light" bindtap="visitAgenda">
       <image mode="heightFix" src="{{imgPath}}/index-light1.png"></image>
       <text>参观议程</text>
     </view>
-    <view class="light">
+    <view class="light" bindtap="uploadImage">
       <image mode="heightFix" src="{{imgPath}}/index-light2.png"></image>
       <text>图片回传</text>
     </view>

+ 13 - 6
light-application-wx/pages/index/index.js

@@ -4,8 +4,9 @@ const util = require('../../utils/util.js');
 Page({
     data: {
         imgPath: app.globalData.imgPath,
-        username: '李海东',
-        role_name: '工作人员',
+        path: app.globalData.path,
+        username: app.globalData.userInfo.usernameShow,
+        role_name: app.globalData.roleInfo.name,
         app_bottom: '大城细管·大城众管·大城智管'
     },
 
@@ -14,11 +15,14 @@ Page({
      */
     onLoad: function (options) {
         let that = this;
+        that.setData({
+            username: app.globalData.userInfo.usernameShow,
+            role_name: app.globalData.roleInfo.name
+        });
         // 下一场会议
         util.get({
             url: '/api/meeting/info/getNextMeeting',
             success: (res) => {
-                console.info(res);
                 wx.hideLoading();
                 if (res.data.code != 200) {
                     util.toast(res.data.msg);
@@ -26,7 +30,7 @@ Page({
                     let datas = res.data.data;
                     that.setData({
                         nextTitle: datas.title,
-                        nextTime: datas.receptionTime,
+                        nextTime: util.formatDate(datas.receptionTime),
                         nextUnit: datas.receptionObject
                     });
                 }
@@ -84,7 +88,7 @@ Page({
     },
 
     /**
-     * 参观议程
+     * 点击参观议程跳转至会议列表
      */
     visitAgenda: function () {
         wx.navigateTo({
@@ -109,7 +113,10 @@ Page({
                         "Content-Type": "multipart/form-data",
                         "Authorization": app.globalData.Authorization
                     },
-                    success: function (res) {
+                    formData: {
+                        fileType: 10
+                    },
+                    success(res) {
                         console.info(res)
                     }
                 });

+ 76 - 52
light-application-wx/pages/login/login.js

@@ -11,7 +11,17 @@ Page({
         phone: '',
         vCode: '',
         sendText: '发送验证码',
-        disabled: false
+        disabled: false,
+        roleList: [{
+            code: 'ADMIN',
+            page: '../index-admin/index-admin'
+        }, {
+            code: 'OPERATION',
+            page: '../index/index'
+        }, {
+            code: 'GUEST',
+            page: '../index-guest/index-guest'
+        }]
     },
 
     /**
@@ -122,8 +132,14 @@ Page({
         this.timeTask();
         util.post({
             url: '/api/sms/sendSms/' + that.data.phone,
-            success: function (res) {
+            success: (res) => {
+                wx.hideLoading();
                 console.info(res);
+                if (res.code != 200) {
+                    util.toast(res.data.msg);
+                } else {
+                    util.toast(res.data.msg);
+                }
             },
         });
     },
@@ -154,12 +170,9 @@ Page({
      * 登录系统
      */
     loginSys: function (e) {
-        console.info(e);
+        let that = this;
         let values = e.detail.value;
         if (!values.phone) {
-            // wx.hideLoading({
-            //   success: (res) => {},
-            // });
             wx.showToast({
                 title: '请输入手机号',
                 icon: 'error'
@@ -181,14 +194,14 @@ Page({
             });
             return false;
         }
-        values.name = 'zhangsan';
+        values.type = 'CAPTCHA';
         util.post({
             url: '/login/mobile',
             data: values,
             header: {
                 'Content-Type': 'application/x-www-form-urlencoded'
             },
-            success: function (res) {
+            success: (res) => {
                 console.info(res);
                 let code = res.data.code;
                 if ('200' != code) {
@@ -198,62 +211,73 @@ Page({
                     });
                 } else {
                     app.globalData.Authorization = res.data.data.Authorization;
-                    // app.globalData.Authorization = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMSIsImlhdCI6MTY1MDM1MjgyOCwiZXhwIjoxNjUwOTU3NjI4fQ.dcTXu9mxHjWxZBic093KuDyialjE7BktMqmwJQTnL61yBxXjKNqLDjQ0viaK4TUQFah95BlE_dBso4ipSDlUZg";
-                    console.info(app.globalData.Authorization)
-                    wx.redirectTo({
-                        url: '../index/index',
-                    });
+                    that.getUserInfo();
+                }
+            }
+        });
+    },
+
+    /**
+     * 登录验证通过后获取用户信息和角色信息
+     */
+    getUserInfo: function () {
+        let that = this;
+        util.get({
+            url: '/sys/userInfoAndRole',
+            success: (res) => {
+                wx.hideLoading();
+                if (res.data.code != 200) {
+                    util.toast(res.data.msg);
+                } else {
+                    let datas = res.data.data;
+                    console.info(datas);
+                    app.globalData.userInfo = datas;
+                    app.globalData.roleInfo = datas.roleList[0];
+                    let roleList = that.data.roleList;
+                    for (let i in roleList) {
+                        if (roleList[i].code == datas.roleList[0].code) {
+                            wx.redirectTo({
+                                url: roleList[i].page
+                            });
+                            break;
+                        }
+                    }
                 }
             }
         });
     },
 
+    /**
+     * 微信获取手机号快捷登录
+     * @param {*} res 
+     */
     getPhoneNumber: function (res) {
+        let that = this;
         console.info(res)
-        const encryptedData = res.detail.encryptedData;
-        const iv = res.detail.iv;
+        // const encryptedData = res.detail.encryptedData;
+        // const iv = res.detail.iv;
         //用户按了允许授权按钮
         if (res.detail.encryptedData) {
-            var that = this;
-            // wx.login({
-            //     success(res) {
-            //         const code = res.code
-            //         console.info(code)
-            // 根据小程序返回的密钥传给后端获取真正的手机号
-            // wx.request({
-            //     url: '/wx/miniProgram/login',
-            //     method: "POST",
-            //     data: {
-            //         code: code
-            //     },
-            //     success: function (res) {
-            //         if (res.status === 0) {
-            wx.request({
-                url: 'https://miniapp.cqjudong.com/api/wechat/getPhone',
-                method: "POST",
+            util.post({
+                url: '/login/mobile',
+                header: {
+                    'Content-Type': 'application/x-www-form-urlencoded'
+                },
                 data: {
-                    code: code,
-                    encryptedData: encryptedData,
-                    iv: iv
-                }, success: function (res) {
-                    // wx.switchTab({
-                    //     url: '../index/index',
-                    //     success: (res) => { }
-                    // })
-                    console.info(res)
+                    code: res.detail.code,
+                    type: 'QUICK'
                 },
-                fail: function (err) {
-                    console.info(err)
+                success: (res) => {
+                    wx.hideLoading();
+                    console.info(res)
+                    if (res.data.code != 200) {
+                        util.toast(res.data.msg);
+                    } else {
+                        app.globalData.Authorization = res.data.data.Authorization;
+                        that.getUserInfo();
+                    }
                 }
-            })
-            // }
-            //     },
-            //     fail: function (err) {
-            //         console.info(err)
-            //     }
-            // })
-            // }
-            // })
+            });
         } else {//用户按了拒绝按钮
             wx.showModal({
                 title: '警告',

+ 8 - 4
light-application-wx/pages/meeting-cover/meeting-cover.js

@@ -1,5 +1,6 @@
 // pages/meeting-cover/meeting-cover.js
 const app = getApp();
+const util = require('../../utils/util.js');
 Page({
 
     /**
@@ -17,12 +18,11 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        console.info(options.item)
         let item = JSON.parse(options.item);
         this.setData({
             item: item,
             title: item.title,
-            receptionTime: item.receptionTime
+            receptionTime: util.formatDate(item.receptionTime, 'yyyy年MM月dd日 HH:mm'),
         });
     },
 
@@ -74,9 +74,13 @@ Page({
     onShareAppMessage: function () {
 
     },
-    meetingAgenda: function (e) {
+
+    /**
+     * 点击跳转至会议议程页面
+     */
+    meetingAgenda: function () {
         wx.navigateTo({
-            url: '../visit-agenda/visit-agenda',
+            url: '../visit-agenda/visit-agenda?item=' + JSON.stringify(this.data.item),
         })
     }
 })

+ 1 - 1
light-application-wx/pages/meeting-cover/meeting-cover.wxml

@@ -1,7 +1,7 @@
 <!--pages/meeting-cover/meeting-cover.wxml-->
 <view class="body" style="background-image: url({{imgPath}}/meeting-cover-bg.png);">
     <view class="welcome">诚挚邀您参加</view>
-    <view class="topic">{{title}}</view>
+    <view class="topic" bindtap="meetingAgenda">{{title}}</view>
     <view class="line"></view>
     <view class="block" style="background-image: url({{imgPath}}/meeting-cover-block.png);" bindtap="meetingAgenda">
         <view class="block-row">

+ 24 - 50
light-application-wx/pages/meeting-list/meeting-list.js

@@ -9,23 +9,7 @@ Page({
         current: 1,
         size: 10,
         total: 0,
-        list: [{
-            id: 1,
-            receptionTime: '2022-10-12 15:30',
-            receptionObject: '重庆市生态环境局',
-            title: '重庆市生活垃圾管理',
-            status: 10
-        }, {
-            id: 2,
-            receptionTime: '2022-12-13 14:30',
-            receptionObject: '重庆市交通局',
-            title: '重庆市交通管理经验交流分享会'
-        }, {
-            id: 3,
-            receptionTime: '2022-10-12 15:30',
-            receptionObject: '重庆市生态环境局',
-            title: '重庆市生活垃圾管理'
-        }]
+        list: []
     },
 
     /**
@@ -41,19 +25,14 @@ Page({
             },
             success: function (res) {
                 wx.hideLoading();
-                console.info(res);
                 if (res.data.code != 200) {
-                    wx.showToast({
-                        title: res.data.msg,
-                        icon: 'error'
+                    util.toast(res.data.msg);
+                } else {
+                    that.setData({
+                        total: res.data.data.total,
+                        list: res.data.data.records
                     });
-                    return;
                 }
-                let list = res.data.data.records;
-                that.setData({
-                    total: res.data.data.total,
-                    list: list
-                });
             }
         });
     },
@@ -104,18 +83,14 @@ Page({
             success: (res) => {
                 wx.hideLoading();
                 wx.stopPullDownRefresh();
-                console.info(res);
                 if (res.data.code != 200) {
-                    wx.showToast({
-                        title: res.data.msg,
-                        icon: 'error'
+                    util.toast(res.data.msg);
+                } else {
+                    that.setData({
+                        total: res.data.data.total,
+                        list: res.data.data.records
                     });
-                    return;
                 }
-                that.setData({
-                    total: res.data.data.total,
-                    list: res.data.data.records
-                });
             }
         });
     },
@@ -128,10 +103,7 @@ Page({
         let arr = that.data.list;
         let page = that.data.current;
         if (arr.length >= that.data.total) {
-            wx.showToast({
-                title: '没有更多数据了',
-                icon: 'error'
-            });
+            util.toast('没有更多数据了');
             return;
         }
         that.setData({
@@ -165,13 +137,22 @@ Page({
     onShareAppMessage: function () {
 
     },
+
+    /**
+     * 点击跳转到会议封面页面
+     * @param {*} e 
+     */
     meetingCover: function (e) {
-        console.info(e)
         let item = e.currentTarget.dataset.item;
         wx.navigateTo({
             url: '../meeting-cover/meeting-cover?item=' + JSON.stringify(item),
         });
     },
+
+    /**
+     * 编辑会议
+     * @param {*} e 
+     */
     editMeeting: function (e) {
 
     },
@@ -194,16 +175,9 @@ Page({
             success: (res) => {
                 console.info(res);
                 if (res.data.code != 200) {
-                    wx.showToast({
-                        title: res.data.msg,
-                        icon: 'error'
-                    });
-                    return;
+                    util.toast(res.data.msg);
                 } else {
-                    wx.showToast({
-                        title: res.data.msg,
-                        icon: 'success'
-                    });
+                    util.toast(res.data.msg, 'success');
                     that.onPullDownRefresh();
                 }
             }

+ 9 - 24
light-application-wx/pages/visit-agenda/visit-agenda.js

@@ -1,5 +1,6 @@
 // pages/visit-agenda/visit-agenda.js
 const app = getApp();
+const util = require('../../utils/util.js');
 Page({
 
     /**
@@ -7,36 +8,20 @@ Page({
      */
     data: {
         imgPath: app.globalData.imgPath,
-        path: app.globalData.path,
-        list: [{
-            time: '14:00-14:30',
-            name: '会议签到',
-            desc: ''
-        }, {
-            time: '14:30-15:30',
-            name: '参观大厅',
-            desc: '重庆市人民政府市场讲话重庆城市管理局局长致辞'
-        }, {
-            time: '15:30-16:00',
-            name: '会议',
-            desc: '重庆城市管理局指挥大厅009号厅'
-        }, {
-            time: '16:30-17:00',
-            name: '交流问答',
-            desc: '参会人员自由提问'
-        }, {
-            time: '17:20-18:00',
-            name: '案例分享',
-            desc: '《人工智能算法商城》陈硕 重庆视角科技有限公司联合...'
-        },]
+        item: {}
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        console.info(options)
-        // var id = options.id;
+        let item = JSON.parse(options.item);
+        this.setData({
+            item: item,
+            title: item.title,
+            receptionTime: util.formatDate(item.receptionTime, 'yyyy年MM月dd日 HH:mm'),
+            receptionDirector: item.receptionDirector
+        });
     },
 
     /**

+ 5 - 4
light-application-wx/pages/visit-agenda/visit-agenda.wxml

@@ -1,16 +1,17 @@
 <!--pages/visit-agenda/visit-agenda.wxml-->
 <view class="container" style="background-image: url({{imgPath}}/meeting-arrangement-bg.png);">
-    <view class="agenda-title">城市管理主题会议议程</view>
+    <view class="agenda-title">{{title}}会议议程</view>
     <view class="english-name">Agenda arrangement</view>
     <view class="agenda-name">议程安排</view>
-    <view class="now-time">2022年4月12日 10:22</view>
+    <view class="now-time">{{receptionTime}}</view>
 
     <view class="arrangement-list">
-        <view class="item" wx:for="{{list}}" wx:for-item="item" wx:key="i" style="--bg--: url({{imgPath}}/meeting-arrangement1.png);">
+        <!-- <view class="item" wx:for="{{list}}" wx:for-item="item" wx:key="i" style="--bg--: url({{imgPath}}/meeting-arrangement1.png);">
             <view class="time">{{item.time}}</view>
             <view class="name">{{item.name}}</view>
             <view class="vertical" wx:if="{{item.desc != null && item.desc != ''}}"></view>
             <view class="desc" wx:if="{{item.desc != null && item.desc != ''}}">{{item.desc}}</view>
-        </view>
+        </view> -->
+        <view>{{receptionDirector}}</view>
     </view>
 </view>

+ 1 - 1
light-application-wx/project.config.json

@@ -47,7 +47,7 @@
         "ignoreUploadUnusedFiles": true
     },
     "compileType": "miniprogram",
-    "libVersion": "2.19.4",
+    "libVersion": "2.23.4",
     "appid": "wxc4466f468dcf82a5",
     "projectname": "light-application-wx",
     "debugOptions": {

+ 54 - 33
light-application-wx/utils/util.js

@@ -1,28 +1,29 @@
-const formatTime = date => {
-    const year = date.getFullYear()
-    const month = date.getMonth() + 1
-    const day = date.getDate()
-    const hour = date.getHours()
-    const minute = date.getMinutes()
-    const second = date.getSeconds()
+// const formatTime = date => {
+//     const year = date.getFullYear()
+//     const month = date.getMonth() + 1
+//     const day = date.getDate()
+//     const hour = date.getHours()
+//     const minute = date.getMinutes()
+//     const second = date.getSeconds()
 
-    return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
-}
+//     return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
+// }
 
-const formatNumber = n => {
-    n = n.toString()
-    return n[1] ? n : `0${n}`
-}
+// const formatNumber = n => {
+//     n = n.toString()
+//     return n[1] ? n : `0${n}`
+// }
 
 const app = getApp();
 const PATH = app.globalData.path;
 
 module.exports = {
-    formatTime,
+    // formatTime,
     request: request,
     post: post,
     get: get,
     toast: toast,
+    formatDate: formatDate
 }
 
 /**
@@ -47,14 +48,12 @@ function post(options) {
         data: options.data || {},
         header: options.header || header,
         success: options.success || function (res) {
-            wx.hideLoading({
-                success: (res) => { },
-            });
+            console.info(res);
+            wx.hideLoading();
         },
         fail: options.fail || function (e) {
-            wx.hideLoading({
-                success: (res) => { },
-            });
+            console.info(e);
+            wx.hideLoading();
             wx.showToast({
                 title: '请求失败',
                 icon: 'error'
@@ -86,14 +85,12 @@ function get(options) {
         data: options.data || {},
         header: options.header || header,
         success: options.success || function (res) {
-            wx.hideLoading({
-                success: (res) => { },
-            });
+            console.info(res);
+            wx.hideLoading();
         },
         fail: options.fail || function (e) {
-            wx.hideLoading({
-                success: (res) => { },
-            });
+            console.info(e);
+            wx.hideLoading();
             wx.showToast({
                 title: '请求失败',
                 icon: 'error'
@@ -124,14 +121,12 @@ function request(options) {
         data: options.data || {},
         header: options.header || header,
         success: options.success || function (res) {
-            wx.hideLoading({
-                success: (res) => { },
-            });
+            console.info(res)
+            wx.hideLoading();
         },
         fail: options.fail || function (e) {
-            wx.hideLoading({
-                success: (res) => { },
-            });
+            console.info(e)
+            wx.hideLoading();
             wx.showToast({
                 title: '请求失败',
                 icon: 'error'
@@ -144,6 +139,32 @@ function toast(msg, icon) {
     wx.showToast({
         title: msg || 'title',
         icon: icon || 'none',
-        duration: 2000
+        duration: 3000
     });
 }
+
+function formatDate(date, fmt) {
+    if (date) {
+        date = new Date(date);
+    } else {
+        date = new Date();
+    }
+    fmt = fmt || 'yyyy-MM-dd HH:mm';
+    let ret;
+    const opt = {
+        "y+": date.getFullYear().toString(),        // 年
+        "M+": (date.getMonth() + 1).toString(),     // 月
+        "d+": date.getDate().toString(),            // 日
+        "H+": date.getHours().toString(),           // 时
+        "m+": date.getMinutes().toString(),         // 分
+        "s+": date.getSeconds().toString()          // 秒
+        // 有其他格式化字符需求可以继续添加,必须转化成字符串
+    };
+    for (let k in opt) {
+        ret = new RegExp("(" + k + ")").exec(fmt);
+        if (ret) {
+            fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
+        };
+    };
+    return fmt;
+}