diff --git a/江可飞/app.js b/江可飞/app.js new file mode 100644 index 0000000..b545190 --- /dev/null +++ b/江可飞/app.js @@ -0,0 +1,39 @@ +//app.js +App({ + 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({ + success: res => { + // 可以将 res 发送给后台解码出 unionId + this.globalData.userInfo = res.userInfo + + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 + // 所以此处加入 callback 以防止这种情况 + if (this.userInfoReadyCallback) { + this.userInfoReadyCallback(res) + } + } + }) + } + } + }) + }, + globalData: { + userInfo: null + } +}) \ No newline at end of file diff --git a/江可飞/app.json b/江可飞/app.json new file mode 100644 index 0000000..6c768d7 --- /dev/null +++ b/江可飞/app.json @@ -0,0 +1,44 @@ +{ + "pages": [ + "pages/index/index", + "pages/logs/logs", + "pages/tabone/tabone", + "pages/tabtwo/tabtwo", + "pages/tabthree/tabthree" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "WeChat", + "navigationBarTextStyle": "black" + }, + "tabBar": { + "selectedColor": "#f00", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页", + "iconPath": "pages/index/image/1.png", + "selectedIconPath": "pages/index/image/2.png" + }, + { + "pagePath": "pages/tabone/tabone", + "text": "分类", + "iconPath": "pages/index/image/3.png", + "selectedIconPath": "pages/index/image/4.png" + }, + { + "pagePath": "pages/tabtwo/tabtwo", + "text": "购物车", + "iconPath": "pages/index/image/5.png", + "selectedIconPath": "pages/index/image/6.png" + }, + { + "pagePath": "pages/tabthree/tabthree", + "text": "我的", + "iconPath": "pages/index/image/7.png", + "selectedIconPath": "pages/index/image/8.png" + } + ] + } +} \ No newline at end of file diff --git a/江可飞/app.wxss b/江可飞/app.wxss new file mode 100644 index 0000000..06c6fc9 --- /dev/null +++ b/江可飞/app.wxss @@ -0,0 +1,10 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} diff --git a/江可飞/pages/index/image/1.png b/江可飞/pages/index/image/1.png new file mode 100644 index 0000000..7111fc6 Binary files /dev/null and b/江可飞/pages/index/image/1.png differ diff --git a/江可飞/pages/index/image/2.png b/江可飞/pages/index/image/2.png new file mode 100644 index 0000000..ecc2fb6 Binary files /dev/null and b/江可飞/pages/index/image/2.png differ diff --git a/江可飞/pages/index/image/3.png b/江可飞/pages/index/image/3.png new file mode 100644 index 0000000..98d751e Binary files /dev/null and b/江可飞/pages/index/image/3.png differ diff --git a/江可飞/pages/index/image/4.png b/江可飞/pages/index/image/4.png new file mode 100644 index 0000000..c9ec545 Binary files /dev/null and b/江可飞/pages/index/image/4.png differ diff --git a/江可飞/pages/index/image/5.png b/江可飞/pages/index/image/5.png new file mode 100644 index 0000000..de5334a Binary files /dev/null and b/江可飞/pages/index/image/5.png differ diff --git a/江可飞/pages/index/image/6.png b/江可飞/pages/index/image/6.png new file mode 100644 index 0000000..5f4f492 Binary files /dev/null and b/江可飞/pages/index/image/6.png differ diff --git a/江可飞/pages/index/image/7.png b/江可飞/pages/index/image/7.png new file mode 100644 index 0000000..8e266b4 Binary files /dev/null and b/江可飞/pages/index/image/7.png differ diff --git a/江可飞/pages/index/image/8.png b/江可飞/pages/index/image/8.png new file mode 100644 index 0000000..0081fc3 Binary files /dev/null and b/江可飞/pages/index/image/8.png differ diff --git a/江可飞/pages/index/index.js b/江可飞/pages/index/index.js new file mode 100644 index 0000000..608a282 --- /dev/null +++ b/江可飞/pages/index/index.js @@ -0,0 +1,54 @@ +//index.js +//获取应用实例 +const app = getApp() + +Page({ + data: { + motto: 'Hello World', + userInfo: {}, + hasUserInfo: false, + canIUse: wx.canIUse('button.open-type.getUserInfo') + }, + //事件处理函数 + bindViewTap: function() { + wx.navigateTo({ + url: '../logs/logs' + }) + }, + onLoad: function () { + if (app.globalData.userInfo) { + this.setData({ + userInfo: app.globalData.userInfo, + hasUserInfo: true + }) + } else if (this.data.canIUse){ + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 + // 所以此处加入 callback 以防止这种情况 + app.userInfoReadyCallback = res => { + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + } else { + // 在没有 open-type=getUserInfo 版本的兼容处理 + wx.getUserInfo({ + success: res => { + app.globalData.userInfo = res.userInfo + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + } + }, + getUserInfo: function(e) { + console.log(e) + app.globalData.userInfo = e.detail.userInfo + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true + }) + } +}) diff --git a/江可飞/pages/index/index.json b/江可飞/pages/index/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/江可飞/pages/index/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/江可飞/pages/index/index.wxml b/江可飞/pages/index/index.wxml new file mode 100644 index 0000000..0243bda --- /dev/null +++ b/江可飞/pages/index/index.wxml @@ -0,0 +1,13 @@ + + + + + + + {{userInfo.nickName}} + + + + {{motto}} + + diff --git a/江可飞/pages/index/index.wxss b/江可飞/pages/index/index.wxss new file mode 100644 index 0000000..ce30de0 --- /dev/null +++ b/江可飞/pages/index/index.wxss @@ -0,0 +1,21 @@ +/**index.wxss**/ +.userinfo { + display: flex; + flex-direction: column; + align-items: center; +} + +.userinfo-avatar { + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.userinfo-nickname { + color: #aaa; +} + +.usermotto { + margin-top: 200px; +} \ No newline at end of file diff --git a/江可飞/pages/logs/logs.js b/江可飞/pages/logs/logs.js new file mode 100644 index 0000000..b2b967d --- /dev/null +++ b/江可飞/pages/logs/logs.js @@ -0,0 +1,15 @@ +//logs.js +const util = require('../../utils/util.js') + +Page({ + data: { + logs: [] + }, + onLoad: function () { + this.setData({ + logs: (wx.getStorageSync('logs') || []).map(log => { + return util.formatTime(new Date(log)) + }) + }) + } +}) diff --git a/江可飞/pages/logs/logs.json b/江可飞/pages/logs/logs.json new file mode 100644 index 0000000..3ee76c1 --- /dev/null +++ b/江可飞/pages/logs/logs.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "查看启动日志", + "usingComponents": {} +} \ No newline at end of file diff --git a/江可飞/pages/logs/logs.wxml b/江可飞/pages/logs/logs.wxml new file mode 100644 index 0000000..b5a85ac --- /dev/null +++ b/江可飞/pages/logs/logs.wxml @@ -0,0 +1,6 @@ + + + + {{index + 1}}. {{log}} + + diff --git a/江可飞/pages/logs/logs.wxss b/江可飞/pages/logs/logs.wxss new file mode 100644 index 0000000..94d4b88 --- /dev/null +++ b/江可飞/pages/logs/logs.wxss @@ -0,0 +1,8 @@ +.log-list { + display: flex; + flex-direction: column; + padding: 40rpx; +} +.log-item { + margin: 10rpx; +} diff --git a/江可飞/pages/tabone/tabone.js b/江可飞/pages/tabone/tabone.js new file mode 100644 index 0000000..fd803cf --- /dev/null +++ b/江可飞/pages/tabone/tabone.js @@ -0,0 +1,66 @@ +// pages/tabone/tabone.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/江可飞/pages/tabone/tabone.json b/江可飞/pages/tabone/tabone.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/江可飞/pages/tabone/tabone.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/江可飞/pages/tabone/tabone.wxml b/江可飞/pages/tabone/tabone.wxml new file mode 100644 index 0000000..77df77b --- /dev/null +++ b/江可飞/pages/tabone/tabone.wxml @@ -0,0 +1,6 @@ + +pages/tabone/tabone.wxml + + + + diff --git a/江可飞/pages/tabone/tabone.wxss b/江可飞/pages/tabone/tabone.wxss new file mode 100644 index 0000000..8f489a6 --- /dev/null +++ b/江可飞/pages/tabone/tabone.wxss @@ -0,0 +1 @@ +/* pages/tabone/tabone.wxss */ \ No newline at end of file diff --git a/江可飞/pages/tabthree/tabthree.js b/江可飞/pages/tabthree/tabthree.js new file mode 100644 index 0000000..3d1933e --- /dev/null +++ b/江可飞/pages/tabthree/tabthree.js @@ -0,0 +1,111 @@ +// pages/tabtwo/tabtwo.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) +var app = getApp(); + +var util = require('../../utils/util.js'); + + + +Page({ + + onShow: function () { + + var that = this; + + that.setData({ + + userInfo: app.globalData.userInfo + + }); + + + + util.req('info/mycount', { sk: app.globalData.sk }, function (data) { + + that.setData({ infoCount: data.data }); + + }) + + + + util.req('appointment/mycount', { sk: app.globalData.sk }, function (data) { + + that.setData({ appointmentCount: data.data }); + + }) + + + + + + + + }, + + + +}) diff --git a/江可飞/pages/tabthree/tabthree.json b/江可飞/pages/tabthree/tabthree.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/江可飞/pages/tabthree/tabthree.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/江可飞/pages/tabthree/tabthree.wxml b/江可飞/pages/tabthree/tabthree.wxml new file mode 100644 index 0000000..8786c53 --- /dev/null +++ b/江可飞/pages/tabthree/tabthree.wxml @@ -0,0 +1,59 @@ + + + + + + + + {{userInfo.nickName}} + + + + + + + + + + + + + 历史订单 + {{infoCount}} + + + + + + 我的钱包 + {{appointmentCount}} + + + + + + 收货地址 + + + + + + + 关于我们 + + + + + + + 个人信息 + + + + + + + + + + diff --git a/江可飞/pages/tabthree/tabthree.wxss b/江可飞/pages/tabthree/tabthree.wxss new file mode 100644 index 0000000..ae7dd63 --- /dev/null +++ b/江可飞/pages/tabthree/tabthree.wxss @@ -0,0 +1,5 @@ +/* pages/tabthree/tabthree.wxss */ +.head{display:flex;flex-direction: column;background: #efefef;width:100%;padding: 100rpx 0rpx; align-items: center; justify-content: space-between;background: #f4de3b} +.head image{width:150rpx;height:150rpx;margin:0 auto;border-radius: 50%;} +.list view{font-size:12pt;} +.list .weui-cell{padding: 15px !important} \ No newline at end of file diff --git a/江可飞/pages/tabtwo/tabtwo.js b/江可飞/pages/tabtwo/tabtwo.js new file mode 100644 index 0000000..c539c64 --- /dev/null +++ b/江可飞/pages/tabtwo/tabtwo.js @@ -0,0 +1,66 @@ +// pages/tabtwo/tabtwo.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/江可飞/pages/tabtwo/tabtwo.json b/江可飞/pages/tabtwo/tabtwo.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/江可飞/pages/tabtwo/tabtwo.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/江可飞/pages/tabtwo/tabtwo.wxml b/江可飞/pages/tabtwo/tabtwo.wxml new file mode 100644 index 0000000..dce0563 --- /dev/null +++ b/江可飞/pages/tabtwo/tabtwo.wxml @@ -0,0 +1,2 @@ + +hello world diff --git a/江可飞/pages/tabtwo/tabtwo.wxss b/江可飞/pages/tabtwo/tabtwo.wxss new file mode 100644 index 0000000..b194745 --- /dev/null +++ b/江可飞/pages/tabtwo/tabtwo.wxss @@ -0,0 +1 @@ +/* pages/tabtwo/tabtwo.wxss */ \ No newline at end of file diff --git a/江可飞/project.config.json b/江可飞/project.config.json new file mode 100644 index 0000000..6575206 --- /dev/null +++ b/江可飞/project.config.json @@ -0,0 +1,40 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "urlCheck": true, + "es6": true, + "postcss": true, + "minified": true, + "newFeature": true, + "autoAudits": false + }, + "compileType": "miniprogram", + "libVersion": "2.4.4", + "appid": "wx18f06ad86d422b11", + "projectname": "%E6%B5%8B%E8%AF%95", + "debugOptions": { + "hidedInDevtools": [] + }, + "isGameTourist": false, + "condition": { + "search": { + "current": -1, + "list": [] + }, + "conversation": { + "current": -1, + "list": [] + }, + "game": { + "currentL": -1, + "list": [] + }, + "miniprogram": { + "current": -1, + "list": [] + } + } +} \ No newline at end of file diff --git a/江可飞/utils/util.js b/江可飞/utils/util.js new file mode 100644 index 0000000..dbadbb8 --- /dev/null +++ b/江可飞/utils/util.js @@ -0,0 +1,19 @@ +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(':') +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : '0' + n +} + +module.exports = { + formatTime: formatTime +}