diff --git a/miniprogram/app.json b/miniprogram/app.json
index b423578e..de244421 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -29,6 +29,9 @@
"page/component/pages/movable-view/movable-view",
"page/component/pages/cover-view/cover-view",
"page/component/pages/rich-text/rich-text",
+ "page/component/pages/live-player/live-player",
+ "page/component/pages/live-pusher/live-pusher",
+ "page/component/pages/official-account/official-account",
"page/API/index",
"page/API/pages/login/login",
"page/API/pages/get-user-info/get-user-info",
diff --git a/miniprogram/page/component/index.js b/miniprogram/page/component/index.js
index 1ed67f14..42e91345 100644
--- a/miniprogram/page/component/index.js
+++ b/miniprogram/page/component/index.js
@@ -35,7 +35,7 @@ Page({
id: 'media',
name: '媒体组件',
open: false,
- pages: ['image', 'audio', 'video', 'camera']
+ pages: ['image', 'audio', 'video', 'camera', 'live-pusher', 'live-player']
}, {
id: 'map',
name: '地图',
@@ -50,7 +50,7 @@ Page({
id: 'open',
name: '开放能力',
open: false,
- pages: ['ad', 'open-data', 'web-view']
+ pages: ['ad', 'open-data', 'web-view', 'official-account']
}
]
},
diff --git a/miniprogram/page/component/pages/button/button.js b/miniprogram/page/component/pages/button/button.js
index 5919317d..5b8dfb4a 100644
--- a/miniprogram/page/component/pages/button/button.js
+++ b/miniprogram/page/component/pages/button/button.js
@@ -32,6 +32,26 @@ const pageObject = {
this.setData({
loading: !this.data.loading
})
+ },
+
+ handleContact(e) {
+ console.log(e.detail)
+ },
+
+ handleGetPhoneNumber(e) {
+ console.log(e.detail)
+ },
+
+ handleGetUserInfo(e) {
+ console.log(e.detail)
+ },
+
+ handleOpenSetting(e) {
+ console.log(e.detail.authSetting)
+ },
+
+ handleGetUserInfo(e) {
+ console.log(e.detail.userInfo)
}
}
diff --git a/miniprogram/page/component/pages/button/button.wxml b/miniprogram/page/component/pages/button/button.wxml
index 958660a8..b3d4ba7c 100644
--- a/miniprogram/page/component/pages/button/button.wxml
+++ b/miniprogram/page/component/pages/button/button.wxml
@@ -27,6 +27,13 @@
+
+
+
+
+
+
+
diff --git a/miniprogram/page/component/pages/camera/camera.js b/miniprogram/page/component/pages/camera/camera.js
index c0bb2ac4..a4c2922b 100644
--- a/miniprogram/page/component/pages/camera/camera.js
+++ b/miniprogram/page/component/pages/camera/camera.js
@@ -11,10 +11,24 @@ Page({
videoSrc: '',
position: 'back',
mode: 'scanCode',
- result: {}
+ result: {},
+ frameWidth: 0,
+ frameHeight: 0
},
onLoad() {
this.ctx = wx.createCameraContext()
+ const listener = this.ctx.onCameraFrame((frame) => {
+ const { frameWidth, frameHeight } = this.data;
+
+ // you can print buffer data by executing codes below:
+ // console.log(frame.data)
+ if (frameWidth === frame.width && frameHeight == frame.height) return;
+ this.setData({
+ frameWidth: frame.width,
+ frameHeight: frame.height
+ })
+ })
+ listener.start()
},
takePhoto() {
this.ctx.takePhoto({
diff --git a/miniprogram/page/component/pages/camera/camera.wxml b/miniprogram/page/component/pages/camera/camera.wxml
index 35d46ed1..f3a73064 100644
--- a/miniprogram/page/component/pages/camera/camera.wxml
+++ b/miniprogram/page/component/pages/camera/camera.wxml
@@ -12,6 +12,23 @@
binderror="error"
>
+
+
+
+ 帧高度
+
+ {{ frameHeight }}
+
+
+
+ 帧宽度
+
+ {{ frameWidth }}
+
+
+
+
+
diff --git a/miniprogram/page/component/pages/editor/editor.js b/miniprogram/page/component/pages/editor/editor.js
index 4456d3a7..3e8618b5 100644
--- a/miniprogram/page/component/pages/editor/editor.js
+++ b/miniprogram/page/component/pages/editor/editor.js
@@ -3,18 +3,13 @@ const util = require('../../../../util/util.js')
const compareVersion = util.compareVersion
Page({
- onShareAppMessage() {
- return {
- title: 'editor',
- path: 'page/component/pages/editor/editor'
- }
- },
-
data: {
formats: {},
- bottom: 0,
readOnly: false,
placeholder: '开始输入...',
+ editorHeight: 300,
+ keyboardHeight: 0,
+ isIOS: false
},
readOnlyChange() {
this.setData({
@@ -22,62 +17,72 @@ Page({
})
},
onLoad() {
- this.canUse = true
- wx.loadFontFace({
- family: 'Pacifico',
- source: 'url("https://sungd.github.io/Pacifico.ttf")',
- success: console.log
- })
- const {SDKVersion} = wx.getSystemInfoSync()
+ const platform = wx.getSystemInfoSync().platform
+ const isIOS = platform === 'ios'
+ this.setData({ isIOS })
+ const that = this
+ this.updatePosition(0)
+ let keyboardHeight = 0
+ wx.onKeyboardHeightChange(res => {
+ if (res.height === keyboardHeight) return
+ const duration = res.height > 0 ? res.duration * 1000 : 0
+ keyboardHeight = res.height
+ setTimeout(() => {
+ wx.pageScrollTo({
+ scrollTop: 0,
+ success() {
+ that.updatePosition(keyboardHeight)
+ that.editorCtx.scrollIntoView()
+ }
+ })
+ }, duration)
- if (compareVersion(SDKVersion, '2.7.0') >= 0) {
- //
- } else {
- this.canUse = false
- // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
- wx.showModal({
- title: '提示',
- content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
- })
- }
+ })
+ },
+ updatePosition(keyboardHeight) {
+ const toolbarHeight = 50
+ const { windowHeight, platform } = wx.getSystemInfoSync()
+ let editorHeight = keyboardHeight > 0 ? (windowHeight - keyboardHeight - toolbarHeight) : windowHeight
+ this.setData({ editorHeight, keyboardHeight })
+ },
+ calNavigationBarAndStatusBar() {
+ const systemInfo = wx.getSystemInfoSync()
+ const { statusBarHeight, platform } = systemInfo
+ const isIOS = platform === 'ios'
+ const navigationBarHeight = isIOS ? 44 : 48
+ return statusBarHeight + navigationBarHeight
},
-
onEditorReady() {
const that = this
wx.createSelectorQuery().select('#editor').context(function (res) {
that.editorCtx = res.context
}).exec()
},
-
- undo() {
- this.editorCtx.undo()
- },
- redo() {
- this.editorCtx.redo()
+ blur() {
+ this.editorCtx.blur()
},
format(e) {
- if (!this.canUse) return
- const {name, value} = e.target.dataset
+ let { name, value } = e.target.dataset
if (!name) return
// console.log('format', name, value)
this.editorCtx.format(name, value)
- },
+ },
onStatusChange(e) {
const formats = e.detail
- this.setData({formats})
+ this.setData({ formats })
},
insertDivider() {
this.editorCtx.insertDivider({
- success() {
+ success: function () {
console.log('insert divider success')
}
})
},
clear() {
this.editorCtx.clear({
- success() {
- console.log('clear success')
+ success: function (res) {
+ console.log("clear success")
}
})
},
@@ -95,14 +100,15 @@ Page({
const that = this
wx.chooseImage({
count: 1,
- success() {
+ success: function (res) {
that.editorCtx.insertImage({
- src: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1543767268337&di=5a3bbfaeb30149b2afd33a3c7aaa4ead&imgtype=0&src=http%3A%2F%2Fimg02.tooopen.com%2Fimages%2F20151031%2Ftooopen_sy_147004931368.jpg',
+ src: res.tempFilePaths[0],
data: {
id: 'abcd',
role: 'god'
},
- success() {
+ width: '80%',
+ success: function () {
console.log('insert image success')
}
})
diff --git a/miniprogram/page/component/pages/editor/editor.wxml b/miniprogram/page/component/pages/editor/editor.wxml
index 36ed9eaf..28dfede3 100644
--- a/miniprogram/page/component/pages/editor/editor.wxml
+++ b/miniprogram/page/component/pages/editor/editor.wxml
@@ -5,52 +5,22 @@
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/miniprogram/page/component/pages/editor/editor.wxss b/miniprogram/page/component/pages/editor/editor.wxss
index e79e58f6..cbf1fc7f 100644
--- a/miniprogram/page/component/pages/editor/editor.wxss
+++ b/miniprogram/page/component/pages/editor/editor.wxss
@@ -1,41 +1,49 @@
@import "../../../common/lib/weui.wxss";
@import "./assets/iconfont.wxss"
-.wrapper {
- padding: 5px;
-}
-
-.iconfont {
- display: inline-block;
- padding: 8px 8px;
- width: 24px;
- height: 24px;
- cursor: pointer;
- font-size: 20px;
-}
-
-.toolbar {
- box-sizing: border-box;
- /* border: 1px solid #ccc; */
- border-bottom: 0;
- font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
+.container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
}
-
.ql-container {
box-sizing: border-box;
- padding: 12px 15px;
width: 100%;
- min-height: 30vh;
- height: auto;
- /* border-top: 1px solid #ccc;
- border-bottom: 1px solid #ccc; */
- background: #fff;
- margin-top: 20px;
+ height: 100%;
font-size: 16px;
line-height: 1.5;
+ overflow: auto;
+ padding: 10px 10px 20px 10px;
+ border: 1px solid #ECECEC;
}
.ql-active {
- color: #06c;
+ color: #22C704;
}
+
+.iconfont {
+ display: inline-block;
+ width: 30px;
+ height: 30px;
+ cursor: pointer;
+ font-size: 20px;
+}
+
+.toolbar {
+ box-sizing: border-box;
+ padding: 0 10px;
+ height: 50px;
+ width: 100%;
+ position: fixed;
+ left: 0;
+ right: 100%;
+ bottom: 0;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ border: 1px solid #ECECEC;
+ border-left: none;
+ border-right: none;
+}
\ No newline at end of file
diff --git a/miniprogram/page/component/pages/live-player/live-player.js b/miniprogram/page/component/pages/live-player/live-player.js
new file mode 100644
index 00000000..f1094a7b
--- /dev/null
+++ b/miniprogram/page/component/pages/live-player/live-player.js
@@ -0,0 +1,75 @@
+Page({
+ data: {
+ videoSrc: ""
+ },
+ onShareAppMessage() {
+ return {
+ title: 'view',
+ path: 'page/component/pages/live-player/view'
+ }
+ },
+ onReady(res) {
+ this.ctx = wx.createLivePlayerContext('player')
+ },
+ handleLivePlayerStateChange(e) {
+ console.log('live-player code:', e.detail.code)
+ },
+ handleLivePlayerError(e) {
+ console.error('live-player error:', e.detail.errMsg)
+ },
+ handlePlay() {
+ this.ctx.play({
+ success: res => {
+ console.log('play success')
+ },
+ fail: res => {
+ console.log('play fail')
+ }
+ })
+ },
+ handlePause() {
+ this.ctx.pause({
+ success: res => {
+ console.log('pause success')
+ },
+ fail: res => {
+ console.log('pause fail')
+ }
+ })
+ },
+ handleStop() {
+ this.ctx.stop({
+ success: res => {
+ console.log('stop success')
+ },
+ fail: res => {
+ console.log('stop fail')
+ }
+ })
+ },
+ handleResume() {
+ this.ctx.resume({
+ success: res => {
+ console.log('resume success')
+ },
+ fail: res => {
+ console.log('resume fail')
+ }
+ })
+ },
+ handleMute() {
+ this.ctx.mute({
+ success: res => {
+ console.log('mute success')
+ },
+ fail: res => {
+ console.log('mute fail')
+ }
+ })
+ },
+ handleVideoSrcInput(e) {
+ this.setData({
+ videoSrc: e.detail.value
+ })
+ }
+})
diff --git a/miniprogram/page/component/pages/live-player/live-player.json b/miniprogram/page/component/pages/live-player/live-player.json
new file mode 100644
index 00000000..96fabf42
--- /dev/null
+++ b/miniprogram/page/component/pages/live-player/live-player.json
@@ -0,0 +1,3 @@
+{
+ "navigationBarTitleText": "live-player"
+}
diff --git a/miniprogram/page/component/pages/live-player/live-player.wxml b/miniprogram/page/component/pages/live-player/live-player.wxml
new file mode 100644
index 00000000..9a82ef0d
--- /dev/null
+++ b/miniprogram/page/component/pages/live-player/live-player.wxml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 视频地址 (支持flv, rtmp)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/miniprogram/page/component/pages/live-player/live-player.wxss b/miniprogram/page/component/pages/live-player/live-player.wxss
new file mode 100644
index 00000000..8a014de8
--- /dev/null
+++ b/miniprogram/page/component/pages/live-player/live-player.wxss
@@ -0,0 +1,11 @@
+@import "../../../common/lib/weui.wxss";
+
+live-player {
+ display: flex;
+ width: 100%;
+ height: 350rpx;
+}
+
+.page-body-button {
+ margin-bottom: 30rpx;
+}
\ No newline at end of file
diff --git a/miniprogram/page/component/pages/live-pusher/live-pusher.js b/miniprogram/page/component/pages/live-pusher/live-pusher.js
new file mode 100644
index 00000000..1fbdfed1
--- /dev/null
+++ b/miniprogram/page/component/pages/live-pusher/live-pusher.js
@@ -0,0 +1,75 @@
+Page({
+ data: {
+ videoSrc: ""
+ },
+ onShareAppMessage() {
+ return {
+ title: 'view',
+ path: 'page/component/pages/live-pusher/view'
+ }
+ },
+ onReady(res) {
+ this.ctx = wx.createLivePusherContext('pusher')
+ },
+ handleLivePusherStateChange(e) {
+ console.log('live-pusher code:', e.detail.code)
+ },
+ handleLivePusherError(e) {
+ console.error('live-pusher error:', e.detail.errMsg)
+ },
+ handleStart() {
+ this.ctx.start({
+ success: res => {
+ console.log('start success')
+ },
+ fail: res => {
+ console.log('start fail')
+ }
+ })
+ },
+ handlePause() {
+ this.ctx.pause({
+ success: res => {
+ console.log('pause success')
+ },
+ fail: res => {
+ console.log('pause fail')
+ }
+ })
+ },
+ handleStop() {
+ this.ctx.stop({
+ success: res => {
+ console.log('stop success')
+ },
+ fail: res => {
+ console.log('stop fail')
+ }
+ })
+ },
+ handleResume() {
+ this.ctx.resume({
+ success: res => {
+ console.log('resume success')
+ },
+ fail: res => {
+ console.log('resume fail')
+ }
+ })
+ },
+ handleSwitchCamera() {
+ this.ctx.switchCamera({
+ success: res => {
+ console.log('switch camera success')
+ },
+ fail: res => {
+ console.log('switch camera fail')
+ }
+ })
+ },
+ handleVideoSrcInput(e) {
+ this.setData({
+ videoSrc: e.detail.value
+ })
+ }
+})
diff --git a/miniprogram/page/component/pages/live-pusher/live-pusher.json b/miniprogram/page/component/pages/live-pusher/live-pusher.json
new file mode 100644
index 00000000..f456cf24
--- /dev/null
+++ b/miniprogram/page/component/pages/live-pusher/live-pusher.json
@@ -0,0 +1,3 @@
+{
+ "navigationBarTitleText": "live-pusher"
+}
diff --git a/miniprogram/page/component/pages/live-pusher/live-pusher.wxml b/miniprogram/page/component/pages/live-pusher/live-pusher.wxml
new file mode 100644
index 00000000..46ea0f8f
--- /dev/null
+++ b/miniprogram/page/component/pages/live-pusher/live-pusher.wxml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 视频地址 (支持rtmp)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/miniprogram/page/component/pages/live-pusher/live-pusher.wxss b/miniprogram/page/component/pages/live-pusher/live-pusher.wxss
new file mode 100644
index 00000000..2b34997e
--- /dev/null
+++ b/miniprogram/page/component/pages/live-pusher/live-pusher.wxss
@@ -0,0 +1,11 @@
+@import "../../../common/lib/weui.wxss";
+
+live-pusher {
+ display: flex;
+ margin: 12rpx auto;
+ height: 350rpx;
+}
+
+.page-body-button {
+ margin-bottom: 30rpx;
+}
\ No newline at end of file
diff --git a/miniprogram/page/component/pages/official-account/official-account.js b/miniprogram/page/component/pages/official-account/official-account.js
new file mode 100644
index 00000000..1c6c2be9
--- /dev/null
+++ b/miniprogram/page/component/pages/official-account/official-account.js
@@ -0,0 +1,8 @@
+Page({
+ data: {
+
+ },
+ handleErr(e) {
+ console.error(e)
+ }
+})
\ No newline at end of file
diff --git a/miniprogram/page/component/pages/official-account/official-account.json b/miniprogram/page/component/pages/official-account/official-account.json
new file mode 100644
index 00000000..0cb27721
--- /dev/null
+++ b/miniprogram/page/component/pages/official-account/official-account.json
@@ -0,0 +1,4 @@
+{
+ "usingComponents": {},
+ "navigationBarTitleText": "official-account"
+}
\ No newline at end of file
diff --git a/miniprogram/page/component/pages/official-account/official-account.wxml b/miniprogram/page/component/pages/official-account/official-account.wxml
new file mode 100644
index 00000000..bc2933a0
--- /dev/null
+++ b/miniprogram/page/component/pages/official-account/official-account.wxml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/miniprogram/page/component/pages/official-account/official-account.wxss b/miniprogram/page/component/pages/official-account/official-account.wxss
new file mode 100644
index 00000000..8da220af
--- /dev/null
+++ b/miniprogram/page/component/pages/official-account/official-account.wxss
@@ -0,0 +1 @@
+/* page/component/pages/official-account/official-account.wxss */
\ No newline at end of file
diff --git a/miniprogram/page/component/pages/scroll-view/scroll-view.js b/miniprogram/page/component/pages/scroll-view/scroll-view.js
index 57a93832..91eb44fa 100644
--- a/miniprogram/page/component/pages/scroll-view/scroll-view.js
+++ b/miniprogram/page/component/pages/scroll-view/scroll-view.js
@@ -46,5 +46,52 @@ Page({
this.setData({
scrollTop: this.data.scrollTop + 10
})
+ },
+
+ onLoad() {
+ this.animate('#scroll-sample-object1', [{
+ borderRadius: '0',
+ offset: 0,
+ }, {
+ borderRadius: '25%',
+ offset: .5,
+ }, {
+ borderRadius: '50%',
+ offset: 1
+ }], 2000, {
+ scrollSource: '#scroll-view_D',
+ timeRange: 2000,
+ startScrollOffset: 0,
+ endScrollOffset: 150,
+ })
+
+ this.animate('#scroll-sample-object2', [{
+ opacity: 1,
+ offset: 0,
+ }, {
+ opacity: .5,
+ offset: .5,
+ }, {
+ opacity: .3,
+ offset: 1
+ }], 2000, {
+ scrollSource: '#scroll-view_D',
+ timeRange: 2000,
+ startScrollOffset: 150,
+ endScrollOffset: 300,
+ })
+
+ this.animate('#scroll-sample-object3', [{
+ background: "white",
+ offset: 0,
+ }, {
+ background: "yellow",
+ offset: 1
+ }], 2000, {
+ scrollSource: '#scroll-view_D',
+ timeRange: 2000,
+ startScrollOffset: 300,
+ endScrollOffset: 400,
+ })
}
})
diff --git a/miniprogram/page/component/pages/scroll-view/scroll-view.wxml b/miniprogram/page/component/pages/scroll-view/scroll-view.wxml
index df5dfbc1..e4b037a0 100644
--- a/miniprogram/page/component/pages/scroll-view/scroll-view.wxml
+++ b/miniprogram/page/component/pages/scroll-view/scroll-view.wxml
@@ -29,6 +29,19 @@
+
+
+
+ 滚动驱动动画
+
+
+
+
+
+
+
+
+
diff --git a/miniprogram/page/component/pages/scroll-view/scroll-view.wxss b/miniprogram/page/component/pages/scroll-view/scroll-view.wxss
index 5a97e25a..2537ab30 100644
--- a/miniprogram/page/component/pages/scroll-view/scroll-view.wxss
+++ b/miniprogram/page/component/pages/scroll-view/scroll-view.wxss
@@ -11,4 +11,4 @@
display: inline-block;
width: 100%;
height: 300rpx;
-}
+}
\ No newline at end of file
diff --git a/miniprogram/page/component/pages/video/video.js b/miniprogram/page/component/pages/video/video.js
index 5a3aa4a7..f5854b97 100644
--- a/miniprogram/page/component/pages/video/video.js
+++ b/miniprogram/page/component/pages/video/video.js
@@ -23,8 +23,7 @@ Page({
inputValue: '',
data: {
src: '',
- danmuList:
- [{
+ danmuList: [{
text: '第 1s 出现的弹幕',
color: '#ff0000',
time: 1
@@ -32,7 +31,8 @@ Page({
text: '第 3s 出现的弹幕',
color: '#ff00ff',
time: 3
- }]
+ }],
+ enableAutoRotation: true
},
bindInputBlur(e) {
@@ -63,5 +63,11 @@ Page({
videoErrorCallback(e) {
console.log('视频错误信息:')
console.log(e.detail.errMsg)
+ },
+
+ handleSwitchChange(e) {
+ this.setData({
+ enableAutoRotation: e.detail.value
+ })
}
})
diff --git a/miniprogram/page/component/pages/video/video.json b/miniprogram/page/component/pages/video/video.json
index 4a07605c..370aca3f 100644
--- a/miniprogram/page/component/pages/video/video.json
+++ b/miniprogram/page/component/pages/video/video.json
@@ -1,3 +1,4 @@
{
- "navigationBarTitleText": "video"
+ "navigationBarTitleText": "video",
+ "pageOrientation": "auto"
}
diff --git a/miniprogram/page/component/pages/video/video.wxml b/miniprogram/page/component/pages/video/video.wxml
index f492492e..91cf2851 100644
--- a/miniprogram/page/component/pages/video/video.wxml
+++ b/miniprogram/page/component/pages/video/video.wxml
@@ -6,7 +6,7 @@
-
+
@@ -21,7 +21,18 @@
-
+
+
+
+
+ 开启自动旋转
+
+
+
+
+
+
+