短视频
This commit is contained in:
39
app.js
39
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
|
||||||
|
}
|
||||||
|
})
|
||||||
14
app.json
14
app.json
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
"pages/shortVideo/shortVideo"
|
"pages/index/index"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"navigationBarBackgroundColor": "#ffffff",
|
|
||||||
"navigationBarTextStyle": "black",
|
|
||||||
"navigationBarTitleText": "小程序",
|
|
||||||
"backgroundColor": "#eeeeee",
|
|
||||||
"backgroundTextStyle": "light",
|
"backgroundTextStyle": "light",
|
||||||
"enablePullDownRefresh": false
|
"navigationBarBackgroundColor": "#fff",
|
||||||
}
|
"navigationBarTitleText": "短视频",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
},
|
||||||
|
"style": "v2",
|
||||||
|
"sitemapLocation": "sitemap.json"
|
||||||
}
|
}
|
||||||
10
app.wxss
10
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
|
// pages/index/index.js
|
||||||
import apis from "../../apis/index"
|
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,8 +12,6 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad (options) {
|
onLoad (options) {
|
||||||
apis.auth.authInfo().then(res=>{
|
|
||||||
console.log(res)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
5
pages/index/index.json
Normal file
5
pages/index/index.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
2
pages/index/index.wxml
Normal file
2
pages/index/index.wxml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<!--pages/index/index.wxml-->
|
||||||
|
<text>pages/index/index.wxml</text>
|
||||||
1
pages/index/index.wxss
Normal file
1
pages/index/index.wxss
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/* pages/index/index.wxss */
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<!--pages/shortVideo/shortVideo.wxml-->
|
|
||||||
<text>pages/shortVideo/shortVideo.wxml</text>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* pages/shortVideo/shortVideo.wxss */
|
|
||||||
@@ -39,9 +39,9 @@
|
|||||||
"minifyWXSS": true
|
"minifyWXSS": true
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.14.1",
|
"libVersion": "2.14.0",
|
||||||
"appid": "wxd931d03dfe955254",
|
"appid": "wxdf57201e20fce566",
|
||||||
"projectname": "miniprogram-1",
|
"projectname": "%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E5%B0%8F%E7%A8%8B%E5%BA%8F",
|
||||||
"debugOptions": {
|
"debugOptions": {
|
||||||
"hidedInDevtools": []
|
"hidedInDevtools": []
|
||||||
},
|
},
|
||||||
|
|||||||
7
sitemap.json
Normal file
7
sitemap.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||||
|
"rules": [{
|
||||||
|
"action": "allow",
|
||||||
|
"page": "*"
|
||||||
|
}]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user