diff --git a/江可飞/小程序开发/.gitignore b/江可飞/小程序开发/.gitignore new file mode 100644 index 0000000..14ea590 --- /dev/null +++ b/江可飞/小程序开发/.gitignore @@ -0,0 +1,14 @@ +# Windows +[Dd]esktop.ini +Thumbs.db +$RECYCLE.BIN/ + +# macOS +.DS_Store +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes + +# Node.js +node_modules/ diff --git a/江可飞/小程序开发/app.js b/江可飞/小程序开发/app.js index e69de29..841d482 100644 --- a/江可飞/小程序开发/app.js +++ b/江可飞/小程序开发/app.js @@ -0,0 +1,41 @@ +//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 index 8f594d2..20062c1 100644 --- a/江可飞/小程序开发/app.json +++ b/江可飞/小程序开发/app.json @@ -1,11 +1,16 @@ { "pages": [ + "pages/shouye/shouye", "pages/index/index", "pages/logs/logs", "pages/fenlei/fenlei", "pages/gouwu/gouwu", - "pages/wode/wode" + "pages/wode/wode", + "pages/detail/detail", + "pages/shdz/shdz" + + ], "window": { "backgroundTextStyle": "light", diff --git a/江可飞/小程序开发/app.wxss b/江可飞/小程序开发/app.wxss index b6d706e..06c6fc9 100644 --- a/江可飞/小程序开发/app.wxss +++ b/江可飞/小程序开发/app.wxss @@ -1,6 +1,4 @@ /**app.wxss**/ -@import 'weui.wxss'; -@import "html-view/index.wxss"; .container { height: 100%; display: flex; @@ -10,11 +8,3 @@ padding: 200rpx 0; box-sizing: border-box; } - -.containers { - height: 100%; - flex-direction: column; - align-items: center; - justify-content: space-between; - box-sizing: border-box; -} \ No newline at end of file diff --git a/江可飞/小程序开发/html-view/each/default.js b/江可飞/小程序开发/html-view/each/default.js deleted file mode 100644 index 604014b..0000000 --- a/江可飞/小程序开发/html-view/each/default.js +++ /dev/null @@ -1,79 +0,0 @@ -const html5Entities = require('../vendors/html5-entities') -const { windowWidth } = wx.getSystemInfoSync() - -module.exports = item => { - // decode html entities - if (item.type === 'Text') { - item.content = html5Entities.decode(item.content) - return - } - - //