diff --git a/app.js b/app.js index e69de29..b545190 100644 --- a/app.js +++ 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 index ff49914..302210a 100644 --- a/app.json +++ b/app.json @@ -1,13 +1,13 @@ { "pages": [ - "pages/shortVideo/shortVideo" + "pages/index/index" ], "window": { - "navigationBarBackgroundColor": "#ffffff", - "navigationBarTextStyle": "black", - "navigationBarTitleText": "小程序", - "backgroundColor": "#eeeeee", "backgroundTextStyle": "light", - "enablePullDownRefresh": false - } + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "短视频", + "navigationBarTextStyle": "black" + }, + "style": "v2", + "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/app.wxss b/app.wxss index 139597f..531897e 100644 --- a/app.wxss +++ b/app.wxss @@ -1,2 +1,10 @@ - +.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/shortVideo/shortVideo.js b/pages/index/index.js similarity index 50% rename from pages/shortVideo/shortVideo.js rename to pages/index/index.js index c28538a..0c5bbb2 100644 --- a/pages/shortVideo/shortVideo.js +++ b/pages/index/index.js @@ -1,6 +1,4 @@ - -import apis from "../../apis/index" - +// pages/index/index.js Page({ /** @@ -13,9 +11,7 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad(options) { - apis.auth.authInfo().then(res=>{ - console.log(res) - }) + onLoad (options) { + } -}) +}) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..6cdce25 --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,5 @@ +{ + "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..a7772aa --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,2 @@ + +pages/index/index.wxml diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..8e9c81f --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1 @@ +/* pages/index/index.wxss */ \ No newline at end of file diff --git a/pages/shortVideo/shortVideo.json b/pages/shortVideo/shortVideo.json deleted file mode 100644 index 8835af0..0000000 --- a/pages/shortVideo/shortVideo.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/shortVideo/shortVideo.wxml b/pages/shortVideo/shortVideo.wxml deleted file mode 100644 index 940687f..0000000 --- a/pages/shortVideo/shortVideo.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/shortVideo/shortVideo.wxml diff --git a/pages/shortVideo/shortVideo.wxss b/pages/shortVideo/shortVideo.wxss deleted file mode 100644 index 55ac4ea..0000000 --- a/pages/shortVideo/shortVideo.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/shortVideo/shortVideo.wxss */ \ No newline at end of file diff --git a/project.config.json b/project.config.json index dd38798..d02a669 100644 --- a/project.config.json +++ b/project.config.json @@ -39,9 +39,9 @@ "minifyWXSS": true }, "compileType": "miniprogram", - "libVersion": "2.14.1", - "appid": "wxd931d03dfe955254", - "projectname": "miniprogram-1", + "libVersion": "2.14.0", + "appid": "wxdf57201e20fce566", + "projectname": "%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E5%B0%8F%E7%A8%8B%E5%BA%8F", "debugOptions": { "hidedInDevtools": [] }, diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..a106c1c --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file