diff --git a/README.md b/README.md
index a16e8cb..3cc166c 100644
--- a/README.md
+++ b/README.md
@@ -104,4 +104,4 @@ FinClip 小程序支持以下第三方框架,您可以在以下框架的基础
[](https://github.com/finogeeks/miniprogram-demo/stargazers)
## Forkers
-[](https://github.com/finogeeks/miniprogram-demo/network/members)
+[](https://github.com/finogeeks/miniprogram-demo/network/members)
\ No newline at end of file
diff --git a/app.js b/app.js
index e8613fa..b0da6b2 100644
--- a/app.js
+++ b/app.js
@@ -1,6 +1,7 @@
//app.js
App({
- onLaunch: function () {
+ onLaunch: function (opt) {
+ console.log('onLaunch: ', opt)
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
diff --git a/app.json b/app.json
index a1759e7..ea94f5e 100644
--- a/app.json
+++ b/app.json
@@ -32,8 +32,14 @@
"pages/component/movable/movable",
"pages/component/doc-web-view/doc-web-view",
"pages/component/page-meta/page-meta",
+ "pages/component/map/map",
+ "pages/component/multiple-map/multiple-map",
+ "pages/component/keyboard-accessory/keyboard-accessory",
"pages/component/camera/camera",
- "pages/component/cover-view/cover-view"
+ "pages/component/cover-view/cover-view",
+ "pages/component/webrtc/webrtc",
+ "pages/component/page-container/page-container",
+ "pages/component/share-element/share-element"
],
"subpackages": [
{
@@ -83,7 +89,10 @@
"pages/FileSystemManager/writefile",
"pages/EventChannel/firstpage/index",
"pages/EventChannel/secondpage/index",
- "pages/Accelerometer/index"
+ "pages/Accelerometer/index",
+ "pages/getRandomValues/getRandomValues",
+ "pages/checkIsOpenAccessibility/index",
+ "pages/locationapi/index"
]
}
],
diff --git a/fide.project.config.json b/fide.project.config.json
new file mode 100644
index 0000000..edc8dad
--- /dev/null
+++ b/fide.project.config.json
@@ -0,0 +1,12 @@
+{
+ "description": "项目配置文件",
+ "packOptions": {
+ "ignore": []
+ },
+ "setting": {
+ "useOldBuilder": false
+ },
+ "compileType": "miniprogram",
+ "projectname": "applet-demo",
+ "isGameTourist": false
+}
\ No newline at end of file
diff --git a/image/anne.png b/image/anne.png
new file mode 100644
index 0000000..9e00fb5
Binary files /dev/null and b/image/anne.png differ
diff --git a/image/bob.png b/image/bob.png
new file mode 100644
index 0000000..33dc61a
Binary files /dev/null and b/image/bob.png differ
diff --git a/image/demo1.jpg b/image/demo1.jpg
new file mode 100644
index 0000000..f876dc3
Binary files /dev/null and b/image/demo1.jpg differ
diff --git a/image/demo2.jpg b/image/demo2.jpg
new file mode 100644
index 0000000..c0071b2
Binary files /dev/null and b/image/demo2.jpg differ
diff --git a/image/duck.gif b/image/duck.gif
new file mode 100644
index 0000000..54632da
Binary files /dev/null and b/image/duck.gif differ
diff --git a/image/emma.png b/image/emma.png
new file mode 100644
index 0000000..fe441c4
Binary files /dev/null and b/image/emma.png differ
diff --git a/image/frank.png b/image/frank.png
new file mode 100644
index 0000000..aee6e91
Binary files /dev/null and b/image/frank.png differ
diff --git a/image/green_tri.png b/image/green_tri.png
index a83f974..40ddb2b 100644
Binary files a/image/green_tri.png and b/image/green_tri.png differ
diff --git a/image/icon64_appwx_logo.png b/image/icon64_appwx_logo.png
index 91a38f9..4a751d3 100644
Binary files a/image/icon64_appwx_logo.png and b/image/icon64_appwx_logo.png differ
diff --git a/image/icon_API.png b/image/icon_API.png
index 76e6cb9..5a9f649 100644
Binary files a/image/icon_API.png and b/image/icon_API.png differ
diff --git a/image/icon_API_HL.png b/image/icon_API_HL.png
index 6fa3707..423f306 100644
Binary files a/image/icon_API_HL.png and b/image/icon_API_HL.png differ
diff --git a/image/icon_API_dark.png b/image/icon_API_dark.png
index 7b8f2e2..f8db640 100644
Binary files a/image/icon_API_dark.png and b/image/icon_API_dark.png differ
diff --git a/image/icon_cloud.png b/image/icon_cloud.png
index 8530b16..48244ff 100644
Binary files a/image/icon_cloud.png and b/image/icon_cloud.png differ
diff --git a/image/icon_cloud_HL.png b/image/icon_cloud_HL.png
index 7285cc8..eb5c23a 100644
Binary files a/image/icon_cloud_HL.png and b/image/icon_cloud_HL.png differ
diff --git a/image/icon_cloud_dark.png b/image/icon_cloud_dark.png
index d30fc6f..aa2555e 100644
Binary files a/image/icon_cloud_dark.png and b/image/icon_cloud_dark.png differ
diff --git a/image/icon_component.png b/image/icon_component.png
index 301f579..bc88a63 100644
Binary files a/image/icon_component.png and b/image/icon_component.png differ
diff --git a/image/icon_component_HL.png b/image/icon_component_HL.png
index 65c3fcb..1d98c0b 100644
Binary files a/image/icon_component_HL.png and b/image/icon_component_HL.png differ
diff --git a/image/icon_component_dark.png b/image/icon_component_dark.png
index 1228520..2842352 100644
Binary files a/image/icon_component_dark.png and b/image/icon_component_dark.png differ
diff --git a/image/icon_foot.png b/image/icon_foot.png
index 3288ee1..67d9f07 100644
Binary files a/image/icon_foot.png and b/image/icon_foot.png differ
diff --git a/image/location.png b/image/location.png
index b9e731e..8dc57c3 100644
Binary files a/image/location.png and b/image/location.png differ
diff --git a/image/logo.png b/image/logo.png
new file mode 100644
index 0000000..e5b0627
Binary files /dev/null and b/image/logo.png differ
diff --git a/image/olivia.png b/image/olivia.png
new file mode 100644
index 0000000..4025830
Binary files /dev/null and b/image/olivia.png differ
diff --git a/image/pause.png b/image/pause.png
index 9acb73d..8abff52 100644
Binary files a/image/pause.png and b/image/pause.png differ
diff --git a/image/play.png b/image/play.png
index 982f2f2..b025c6c 100644
Binary files a/image/play.png and b/image/play.png differ
diff --git a/image/plus.png b/image/plus.png
index 73ddfe3..83857c3 100644
Binary files a/image/plus.png and b/image/plus.png differ
diff --git a/image/plus_dark.png b/image/plus_dark.png
index b9bb683..27cbae5 100644
Binary files a/image/plus_dark.png and b/image/plus_dark.png differ
diff --git a/image/record.png b/image/record.png
index a62ef81..3161053 100644
Binary files a/image/record.png and b/image/record.png differ
diff --git a/image/scott.png b/image/scott.png
new file mode 100644
index 0000000..7bb975f
Binary files /dev/null and b/image/scott.png differ
diff --git a/image/share.png b/image/share.png
index baac7f9..a478782 100644
Binary files a/image/share.png and b/image/share.png differ
diff --git a/image/stop.png b/image/stop.png
index 9e65f3e..fcb6cb0 100644
Binary files a/image/stop.png and b/image/stop.png differ
diff --git a/image/susan.png b/image/susan.png
new file mode 100644
index 0000000..1b553fc
Binary files /dev/null and b/image/susan.png differ
diff --git a/image/trash.png b/image/trash.png
index 83d68f3..8920900 100644
Binary files a/image/trash.png and b/image/trash.png differ
diff --git a/image/wechat.png b/image/wechat.png
index 470931c..a761227 100644
Binary files a/image/wechat.png and b/image/wechat.png differ
diff --git a/image/wechatHL.png b/image/wechatHL.png
index 3c5e52b..1b4ad2f 100644
Binary files a/image/wechatHL.png and b/image/wechatHL.png differ
diff --git a/packageAPI/pages/FileSystemManager/writefile.js b/packageAPI/pages/FileSystemManager/writefile.js
index 9e678cc..93aa8d3 100644
--- a/packageAPI/pages/FileSystemManager/writefile.js
+++ b/packageAPI/pages/FileSystemManager/writefile.js
@@ -1,526 +1,167 @@
// pages/writefile/index.js
console.log('page 打印', wx.env.USER_DATA_PATH);
+
+// const base64 = require('../../utils/data')
+let fs = null
Page({
/**
* 页面的初始数据
*/
data: {
- filePath: `${wx.env.USER_DATA_PATH}/d`,
+ // base64,
+ // 配置路径循环生成
+ paths: [
+ `finfile://usr/a.txt`,
+ `finfile://usr/b.txt`,
+ `finfile://usr/c.txt`,
+ `finfile://usr/test`,
+ `finfile://usr/1.zip`,
+ `finfile://usr/test/a.txt`,
+ `finfile://usr/test/b.txt`,
+ `finfile://usr/test/c.txt`,
+ `finfile://temp/c.txt`,
+ `finfile://temp/a/b/c`,
+ `finfile://store/c.txt`,
+ `http://usr/1.zip`,
+ `http://usr/aa`,
+ `http://usr/aa/ab.txt`,
+ `http://store/a.txt`,
+ `http://store/b.txt`,
+ `http://store/test`,
+ `wxfile://usr/aa`,
+ `wxfile://usr/aa/abc.txt`,
+
+ ],
+
+
+ filePath: '',
data: "",
- encoding: "utf-8",
- source: "",
- readencoding:"utf-8"
-
+ encoding: "",
+ recursive: null,
+ path1: '',
+ path2: '',
+ flag: '',
+ position: '',
+ offset:'',
+ entries:''
},
- readFileFunc(path, encoding,position,length) {
- console.log('readFile encoding:', encoding, '; path:', path);
-
- const fs = wx.getFileSystemManager()
- fs.readFile({
- filePath: path,
- encoding,
- position,
- length,
-
- success(res) {
- console.log('readFile success:', res)
- },
- fail(res) {
- console.log('readFile fail:', res)
- }
+ onLoad() {
+ this.setData({
+ filePath: `${wx.env.USER_DATA_PATH}`
})
+ fs = wx.getFileSystemManager()
},
- readFileSyncFunc(path, encoding, position, length) {
- console.log('readFileSync encoding:', encoding, '; path:', path);
-
- const fs = wx.getFileSystemManager()
-
- try {
- const res = fs.readFileSync(path, encoding,position,length)
- console.log('readFileSync res:', res)
- } catch (e) {
- console.log('readFileSync error:', e)
- }
- },
-
- //同步
- writeFileSync() {
- const fs = wx.getFileSystemManager()
- try {
- const res = fs.writeFileSync(
- /* `${wx.env.USER_DATA_PATH}/hello.mp3` */null, "", 'utf8'
- )
- console.log('writeFileSync:', res)
-
- } catch (e) {
- console.error('writeFileSync err:', e)
- }
- },
-
- //异步文件测试
- writeFile() {
- console.log("打印地址", this.data.filePath)
- console.log("当前选中deta:",this.data.data)
- const fs = wx.getFileSystemManager()
- fs.writeFile({
- filePath: this.data.filePath,
- data: this.data.data,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeFile success:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- this.readFileSyncFunc(this.data.filePath, this.data.encoding,1,3)
- this.readFileFunc(this.data.filePath, this.data.encoding,2,4)
- },
- fail(res) {
- console.log('writeFile fail:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- }
- })
- },
-
- writeFileStartRange() {
- console.log("打印地址", this.data.filePath)
- console.log("当前选中deta:",this.data.data)
- const fs = wx.getFileSystemManager()
- fs.writeFile({
- filePath: this.data.filePath,
- data: this.data.data,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeFile success:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- this.readFileSyncFunc(this.data.filePath, this.data.encoding,3,1)
- this.readFileFunc(this.data.filePath, this.data.encoding,3,1)
- },
- fail(res) {
- console.log('writeFile fail:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- }
- })
- },
-
- writeFileLength0() {
- console.log("打印地址", this.data.filePath)
- console.log("当前选中deta:",this.data.data)
- const fs = wx.getFileSystemManager()
- fs.writeFile({
- filePath: this.data.filePath,
- data: this.data.data,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeFile success:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- this.readFileSyncFunc(this.data.filePath, this.data.encoding,2,0)
- this.readFileFunc(this.data.filePath, this.data.encoding,2,0)
- },
- fail(res) {
- console.log('writeFile fail:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- }
- })
- },
-
- writeFileLengthPoint() {
- console.log("打印地址", this.data.filePath)
- console.log("当前选中deta:",this.data.data)
- const fs = wx.getFileSystemManager()
- fs.writeFile({
- filePath: this.data.filePath,
- data: this.data.data,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeFile success:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- this.readFileSyncFunc(this.data.filePath, this.data.encoding,2,1.2)
- this.readFileFunc(this.data.filePath, this.data.encoding,2,1.2)
- },
- fail(res) {
- console.log('writeFile fail:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- }
+ setParams(e) {
+ const { key } = e.currentTarget.dataset
+ this.setData({
+ [key]: e.detail.value
})
},
- writeFileReadnoEncoding() {
- console.log("打印地址", this.data.filePath)
- console.log("当前选中deta:",this.data.data)
- const fs = wx.getFileSystemManager()
- const path = `${wx.env.USER_DATA_PATH}/nc`
- fs.writeFile({
- filePath:path,
- data: this.data.data,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeFile success:', res)
- console.log('写文件路径:' ,path),
- this.readFileSyncFunc(path)
- this.readFileFunc(path)
- },
- fail(res) {
- console.log('writeFile fail:', res)
-// console.log(`${wx.env.USER_DATA_PATH}/d`)
- }
- })
- },
+
- writeFilePermission() {
- console.log("打印地址", this.data.filePath)
- console.log("当前选中deta:",this.data.data)
- const fs = wx.getFileSystemManager()
- fs.writeFile({
-
- data: this.data.data,
- filePath:`${wx.env.USER_DATA_PATH}/d`,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeFile success:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- this.readFileSyncFunc(this.data.filePath, this.data.encoding,1,3)
- this.readFileFunc(this.data.filePath, this.data.encoding,2,4)
- },
- fail(res) {
- console.log('writeFile fail:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- }
- })
- },
-
- writeFileNotFound() {
- console.log("打印地址", this.data.filePath)
- console.log("当前选中deta:",this.data.data)
- const fs = wx.getFileSystemManager()
- fs.writeFile({
-
- data: this.data.data,
- filePath:`${wx.env.USER_DATA_PATH}/d`,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeFile success:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- this.readFileSyncFunc(`${wx.env.USER_DATA_PATH}/dl`,this.data.encoding,1,3)
- this.readFileFunc(`${wx.env.USER_DATA_PATH}/dl`, this.data.encoding,2,4)
- },
- fail(res) {
- console.log('writeFile fail:', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- }
- })
- },
-
- base64File() {
- const path = `${wx.env.USER_DATA_PATH}/d`
- wx.fileToBase64({
- url: path,
- success: (res) => {
- console.log('fileToBase64 success: ', res)
- console.log(res.data)
- },
- fail(res) {
- console.log('fileToBase64 fail: ', res)
- }
- })
- },
-
- saveFile() {
- wx.saveFile({
- filePath: `${wx.env.USER_DATA_PATH}/d`,
- success(res) {
- console.log("保存成功", res)
- },
- fail(res) {
- console.log("保存失败", res)
- }
- })
- },
-
-
-
- downFile() {
+ downZipSave(){
+ const fs=wx.getFileSystemManager()
wx.downloadFile({
- url: `${wx.env.USER_DATA_PATH}/d`,
- success(res) {
- console.log("下载成功", res)
- },
- fail(res) {
- console.log("下载失败", res)
- }
- })
- },
-
- //图片
- writeImage() {
- const fs = wx.getFileSystemManager()
- const path = `${wx.env.USER_DATA_PATH}/a`
- fs.writeFile({
- filePath: path,
- data: this.data.data,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeImagSuccess', res)
- console.log(path)
- this.readFileSyncFunc(path, 'base64')
- this.readFileFunc(path, 'base64')
- },
- fail(res) {
- console.log('writeImageFail', res)
- }
- })
- },
-
- imagePreview() {
- wx.previewImage({
- urls: [`${wx.env.USER_DATA_PATH}/a`],
- success(res) {
- console.log("图片预览成功", res)
- },
- fail(res) {
- console.log("图片预览失败", res)
- }
- })
- },
-
-
- imageCompress() {
-
- wx.compressImage({
- src: '`${wx.env.USER_DATA_PATH}/a`',
-
- success(res) {
- console.log("图片压缩成功", res)
- },
- fail(res) {
- console.log("图片压缩失败", res)
- }
- })
- },
-
-
- imageSaveToPhotosAlbum() {
- wx.saveImageToPhotosAlbum({
- filePath: `${wx.env.USER_DATA_PATH}/a`,
-
- success(res) {
- console.log("图片保存到相册成功", res)
- },
- fail(res) {
- console.log("图片保存到相册失败", res)
- }
- })
- },
-
- fileUpload() {
-
- wx.uploadFile({
- filePath: `${wx.env.USER_DATA_PATH}/a`,
- name: 'file',
- url: 'https://finchat-mop-b.finogeeks.club/api/v1/mop/finstore/dev/files?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MjUxOTQyMjgsImZjaWQiOiI1ZmYzZDhmZWU3YzNiNTAwMDExYWQxMmEiLCJpYXQiOjE2MjUxODcwMjgsImlzcyI6Ijc1NWUxNnFrNVZLUnBlcWhKM1IySVFwV2NOdlQ5TWJOIn0.IQXdjiH5One-GVsU9E5KTze0fXJ7InJE-BrmcQs9yIc',
- success(res) {
- console.log("文件上传成功", res)
- },
- fail(res) {
- console.log("文件上传失败", res)
- }
- })
- },
-
-
-
- //视频
- writeVideo() {
- const fs = wx.getFileSystemManager()
- const path = `${wx.env.USER_DATA_PATH}/b.mp4`
- fs.writeFile({
- filePath: path,
- data: this.data.data,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeVideo Success', res)
- console.log(`${wx.env.USER_DATA_PATH}/b.mp4`)
-
- this.readFileSyncFunc(path, 'base64')
- this.readFileFunc(path, 'base64')
- },
-
- fail(res) {
- console.log('writeFail', res)
- }
- })
- },
-
- videoSaveToPhotosAlbum() {
- wx.saveVideoToPhotosAlbum({
- filePath: `${wx.env.USER_DATA_PATH}/b.mp4`,
- success(res) {
- console.log("视频保存到相册成功", res)
- },
- fail(res) {
- console.log("视频保存到相册失败", res)
- }
- })
- },
-
-
- mediaPreview() {
- wx.previewMedia({
- sources: [
- {
- "url": `${wx.env.USER_DATA_PATH}/b.mp4`,
- "type": "video"
- }
- ],
- success(res) {
- console.log("视频播放成功", res)
- },
- fail(res) {
- console.log("视频播放失败", res)
- }
- })
- },
-
-
- videoPreview() {
- wx.previewVideo({
-
- url: `${wx.env.USER_DATA_PATH}/b.mp4`,
- autoplay: true,
- success(res) {
- console.log('视频播放成功', res)
- },
- fail(res) {
- console.log('播放失败', res)
- }
- })
-
- },
-
- //语音
- writeAudio() {
- const fs = wx.getFileSystemManager()
- const path = `${wx.env.USER_DATA_PATH}/c.mp3`
- fs.writeFile({
- filePath: path,
- data: this.data.data,
- encoding: this.data.encoding,
- success: (res) => {
- console.log('writeAudio Success', res)
- console.log(`${wx.env.USER_DATA_PATH}/c.mp3`)
- this.readFileSyncFunc(path, 'base64',10,13)
- this.readFileFunc(path, 'base64',20,15)
- },
-
- fail(res) {
- console.log('writeFail', res)
- }
- })
- },
-
- innerAudioPlay() {
- const ctx = wx.createInnerAudioContext()
- ctx.src = `${wx.env.USER_DATA_PATH}/c.mp3`
- /* ctx.seek(20) */
- ctx.play()
- ctx.onPlay(() => {
- console.log('开始播放')
- })
- ctx.onError((res) => {
- console.log(res.errMsg)
- console.log(res.errCode)
- console.log(res)
- })
- },
-
-
- voicePlay() {
-
- wx.playVoice({
- filePath: `${wx.env.USER_DATA_PATH}/c.mp3`,
- success(res) {
- console.log("播放成功", res)
- },
- fail(res) {
- console.log("播放失败", res)
- }
- })
- },
-
-
- documentOpen() {
- const fs = wx.getFileSystemManager()
- fs.writeFile({
- filePath: `${wx.env.USER_DATA_PATH}/wd.doc`,
- data: this.data.data,
- encoding: this.data.encoding,
- success(res) {
- console.log('writeSuccess', res)
- console.log(`${wx.env.USER_DATA_PATH}/wd.doc`)
- wx.openDocument({
- filePath: `${wx.env.USER_DATA_PATH}/wd.doc`,
-
- success(res) {
- console.log("文件打开成功", res)
+ url: 'https://app.finogeeks.com/finchat/sdk/FinApplet-dev-2.34.0-alpha20210826v06.zip',
+ success(res){
+ console.log("文件下载成功",res)
+ fs.saveFile({
+ tempFilePath: res.tempFilePath,
+ filePath: `${wx.env.USER_DATA_PATH}/1.zip`,
+ success(res){
+ console.log("zip保存成功",res)
},
- fail(res) {
- console.log("文件打开失败", res)
+ fail(res){
+ console.log("zip保存失败",res)
}
})
- },
- fail(res) {
- console.log('writeFail', res)
}
})
},
+ invokeApi(e) {
+ console.log('点击了 button')
+ const { api, encoding, data, recursive, flag, length, entries, position, offset, arr = [], set, arrayBuffer, ...params } = e.currentTarget.dataset
+ if (api) {
+ // 将配置的参数转换为 data 参数
+ Object.keys(params).forEach(value => {
+ const key = params[value]
+ params[value] = this.data[key]
+ })
-
-
-
-
- writeFileArrayBuffer() {
- console.log("打印地址", this.data.filePath)
- /* console.log("打印data",this.data.data) */
- const fs = wx.getFileSystemManager()
- fs.writeFile({
- data: wx.base64ToArrayBuffer(this.data.data),
- filePath: `${wx.env.USER_DATA_PATH}/d`,
- encoding: this.data.encoding,
- success(res) {
- console.log('writeSuccess', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
- },
- fail(res) {
- console.log('writeFail', res)
- console.log(`${wx.env.USER_DATA_PATH}/d`)
+ // encoding 和 data 有配置就是 true,直接赋值
+ if (encoding !== undefined) {
+ params.encoding = this.data.encoding
+ }
+
+ if (entries !== undefined) {
+ params.entries = this.data.entries
+ }
+
+ if (length !== undefined) {
+ params.length = this.data.length
+ }
+ if (position !== undefined) {
+ params.position = this.data.position
+ }
+
+ if (data !== undefined) {
+ params.data = this.data.data
+ }
+ if (recursive !== undefined) {
+ params.recursive = this.data.recursive
+ }
+
+ if (flag !== undefined) {
+ params.flag = this.data.flag
+ }
+
+ if (arrayBuffer !== undefined) {
+ params.arrayBuffer = new ArrayBuffer(arrayBuffer)
+ }
+
+ if (api.endsWith('Sync') && arr && arr.length) {
+ let list = arr.split(',').map(key => this.data[key])
+ console.log('准备执行同步 api:', api, list)
+ fs[api].apply(this, list)
+ } else {
+ console.log('准备执行 api:', api, params)
+ const res = fs[api]({
+ ...params,
+ success: (res) =>{
+ if (set && res[set]) {
+ this.setData({
+ [set]: res[set]
+ })
+ }
+ console.log('调用成功 success')
+ console.log(res)
+ },
+ fail (res) {
+ console.log('调用失败 fail')
+ console.log(res)
+ }
+ })
+ if (res) {
+ console.log('调用成功 success:', res)
+ }
+ if (set) {
+ this.setData({
+ [set]: res
+ })
+ }
}
- })
- },
-
- bindchangepath(e) {
- this.setData({
- filePath: e.detail.value
- })
- },
-
- bindchangeencoding(e) {
- this.setData({
- encoding: e.detail.value
- })
- },
-
- bindchangedata(e) {
- this.setData({
- data: e.detail.value
- })
- },
-
-
+ }
+ }
})
+
\ No newline at end of file
diff --git a/packageAPI/pages/FileSystemManager/writefile.json b/packageAPI/pages/FileSystemManager/writefile.json
index 59917b8..8835af0 100644
--- a/packageAPI/pages/FileSystemManager/writefile.json
+++ b/packageAPI/pages/FileSystemManager/writefile.json
@@ -1,4 +1,3 @@
{
- "usingComponents": {},
- "disableScroll":false
+ "usingComponents": {}
}
\ No newline at end of file
diff --git a/packageAPI/pages/FileSystemManager/writefile.wxml b/packageAPI/pages/FileSystemManager/writefile.wxml
index d1d768b..646006a 100644
--- a/packageAPI/pages/FileSystemManager/writefile.wxml
+++ b/packageAPI/pages/FileSystemManager/writefile.wxml
@@ -1,133 +1,383 @@
-
-
-
-
-设置
-
-验证filePath允许设置的值(打开页面初始化时,设置的是本地路径)
-
-http地址
-代码包中的一个图片路径
-设置为空
-本地路径
-null
+
+路径参数 path 1
+
+ http地址
+ 代码包中的一个图片路径
+ 本地路径
+ 设置为空
+ null
+ {{item}}
-修改writeFile encoding类型
-
-ascii
-base64
-binary
-hex
-ucs2(以小端序读取)
-ucs-2(以小端序读取)
-utf16le(以小端序读取)
-utf-16le(以小端序读取)
-utf-8
-utf8
-latin1
-空
-123
+修改 entries 参数
+
+ true
+ 111
+ 设置为空
-修改data类型
-
-空值
-abc
-中文
-[]
-null
-
-image_base64
-
-
-
-video_base64
-
-audio_base64
-
-
-wenjian
-
-
-新文件
+修改 recursive 参数
+
+ true
+ 111
+ 设置为空
-
-
-
-
+修改 flag 参数
+
+ a
+ ax
+ a+
+ ax+
+ as
+ as+
+ r
+ r+
+ w
+ wx
+ w+
+ wx+
+ null
+ 111
+ 设置为空
+
-
-
-
-
-
-
-
-
-
-
+修改 length 参数
+
+ -1
+ 空
+ 0.5
+ 1
+ 3
+ 3.1zsad
+ 3.9
+ 50
+ sss
+ null
+
-
-
+修改 position 参数
+
+ -1
+ 空
+ 0.5
+ 3
+ 3.1zsad
+ 3.9
+ 50
+ sss
+ null
+
+
+修改 offset 参数
+
+ -1
+ 空
+ 0.5
+ 3
+ 3.1zsad
+ 3.9
+ 50
+ sss
+ null
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-image
-
-
-
-
-
+修改 encoding 参数
+
+ ascii
+ base64
+ binary
+ hex
+ ucs2(以小端序读取)
+ ucs-2(以小端序读取)
+ utf16le(以小端序读取)
+ utf-16le(以小端序读取)
+ utf-8
+ utf8
+ latin1
+ 空
+ 123
+
-video
-
-
-
-
+修改 data 参数
+
+ 空值
+ abc
+ 中文
+ []
+ null
+
+ image_base64
+
+ video_base64
+
+ audio_base64
+
+ wenjian
+ 新文件
+
-audio
-
-
-
-
+ 路径参数 path 2
+
+ http地址
+ 代码包中的一个图片路径
+ 本地路径
+ 设置为空
+ null
+ {{item}}
+
\ No newline at end of file
diff --git a/packageAPI/pages/FileSystemManager/writefile.wxss b/packageAPI/pages/FileSystemManager/writefile.wxss
index b2b35dc..1ac0271 100644
--- a/packageAPI/pages/FileSystemManager/writefile.wxss
+++ b/packageAPI/pages/FileSystemManager/writefile.wxss
@@ -1,8 +1,6 @@
-/* pages/writefile/index.wxss */
-
-.title {
- padding: 10rpx 20rpx;
- font-size: 30rpx;
- font-weight: bold;
- text-align: center;
+/* pages/file-2/index.wxss */
+.box {
+ display: flex;
+ flex-wrap: wrap;
+ padding-bottom: 300rpx;
}
diff --git a/packageAPI/pages/audio/xuwei.jpg b/packageAPI/pages/audio/xuwei.jpg
index 7095142..316ae2c 100644
Binary files a/packageAPI/pages/audio/xuwei.jpg and b/packageAPI/pages/audio/xuwei.jpg differ
diff --git a/packageAPI/pages/canvas/canvas.js b/packageAPI/pages/canvas/canvas.js
index c3ba3cb..8cf412c 100644
--- a/packageAPI/pages/canvas/canvas.js
+++ b/packageAPI/pages/canvas/canvas.js
@@ -1,5 +1,14 @@
const example = require('./example.js')
+function randomHexColor() {
+ var r = Math.floor(Math.random() * 256); //随机生成256以内r值
+ var g = Math.floor(Math.random() * 256); //随机生成256以内g值
+ var b = Math.floor(Math.random() * 256); //随机生成256以内b值
+ var alpha = Math.random() * 0.4 + 0.6; //随机生成1以内a值
+ return `rgba(${r},${g},${b},${alpha})`; //返回rgba(r,g,b,a)格式颜色
+
+}
+
Page({
onShareAppMessage() {
return {
@@ -8,53 +17,165 @@ Page({
}
},
+ log1(e) {
+ console.log('ctx1:', e.type, e)
+ },
+
+ log2(e) {
+ console.log('ctx2:', e.type, e)
+ },
+
onLoad() {
- this.context = wx.createContext()
- console.log('wx.createContext', this.context);
const methods = Object.keys(example)
- console.log(methods);
this.setData({
methods
})
+ // 旧获取 canvas 方式
+ const ctx1 = wx.createCanvasContext('canvas1');
+ console.log('ctx1', ctx1)
+
+ // 新获取 canvas 方式
+ let ctx2
+ let canvas2
+ const query = wx.createSelectorQuery()
+ query.select('#canvas2').fields({ node: true, size: true }).exec((res) => {
+ canvas2 = res[0].node
+ ctx2 = canvas2.getContext('2d')
+
+ // 可以设置 dpr 的值,绘制高分辨率的图
+ const dpr = 1 || wx.getSystemInfoSync().pixelRatio
+ canvas2.width = res[0].width * dpr
+ canvas2.height = res[0].height * dpr
+ console.log('ctx2', ctx2)
+ })
+
+ // fino 基础库兼容新旧写法,两者均可获取到同样的 context
+ // 当 canvas 带 native 时,表示用原生组件
+ // 原生组件下,仅 putImageData 和 getImageData api 会有区别
+
const that = this
methods.forEach(function (method) {
that[method] = function () {
- // 写法1 官方文档有描述的写法, 微信基础库支持,我们不支持
- //
- console.log('call action', method)
- const ctx = wx.createCanvasContext('canvas');
- example[method](ctx)
- ctx.draw(false, (res) => { console.log(res) });
- const actions = that.context.getActions()
- console.log('that.context.getActions()', actions, ctx);
-
- // 写法2 更旧版本的写法 微信支持,fino基础库不支持
- // wx.createContext 和 wx.drawCanvas 疑似已经被从官方基础库文档中移除,但是官方基础库依旧支持
+ console.log("run:", method)
+ let color = null
+ if (method === 'setRandom') {
+ color = randomHexColor()
+ }
+ example[method](ctx1, true, color)
+ // 旧版需要调用 draw 接口
+ ctx1.draw(true, (res) => { console.log('ctx1 draw finish:', res) });
- // example[method](that.context)
- // const actions = that.context.getActions()
- // wx.drawCanvas({
- // canvasId: 'canvas',
- // actions
- // })
-
- // 写法3 同层渲染的原生canvas 就没实现
+ example[method](ctx2, false, color, canvas2)
+ try {
+ // 微信新的 canvas 没有 draw 方法,加个报错兼容
+ ctx2.draw(true, (res) => { console.log('ctx2 draw finish:', res) })
+ } catch (err) {
+ }
}
})
},
toTempFilePath() {
wx.canvasToTempFilePath({
- canvasId: 'canvas',
+ canvasId: 'canvas1',
success(res) {
- console.log(res)
+ console.log('canvas1', res)
},
fail(res) {
- console.log(res)
+ console.log('canvas1', res)
}
})
+
+ const query = wx.createSelectorQuery()
+ query.select('#canvas2').fields({ node: true, size: true }).exec((res) => {
+ const canvas = res[0].node
+
+ wx.canvasToTempFilePath({
+ canvas,
+ success(res) {
+ console.log('canvas2', res)
+ },
+
+ fail(res) {
+ console.log('canvas2', res)
+ }
+ })
+ })
+ },
+ imageData() {
+
+ // 旧版
+ // 整一个绿色方块
+ const arr = new Array(100 * 100 * 4);
+ for (var i = 0; i < arr.length; i += 4) {
+ arr[i + 0] = 0;
+ arr[i + 1] = 255;
+ arr[i + 2] = 0;
+ arr[i + 3] = 255;
+ }
+ // 把绿色方块画到 0 0 坐标
+ wx.canvasPutImageData({
+ canvasId: 'canvas1',
+ x: 0,
+ y: 0,
+ width: 100,
+ height: 100,
+ data: new Uint8ClampedArray(arr),
+ success(res) {
+ console.log(res)
+ },
+ fail: console.log
+ })
+ // 获取 0 0 坐标,100 * 100 的图
+ wx.canvasGetImageData({
+ canvasId: 'canvas1',
+ x: 50,
+ y: 50,
+ width: 100,
+ height: 100,
+ success(res) {
+ console.log(res)
+ // 把获取到的,画到 200 0 坐标上
+ // 会出现两个绿色方块
+ wx.canvasPutImageData({
+ canvasId: 'canvas1',
+ x: 200,
+ y: 0,
+ width: 100,
+ height: 100,
+ data: res.data,
+ success(res) {
+ console.log(res)
+ },
+ fail: console.log
+ })
+ },
+ fail: console.log
+ })
+
+
+ // 新版
+ const query = wx.createSelectorQuery()
+ query.select('#canvas2').fields({ node: true, size: true }).exec((res) => {
+ const canvas = res[0].node
+ const context = canvas.getContext('2d')
+ // 一个绿色方块数据
+ const imgData = context.createImageData(100, 100);
+ for (var i = 0; i < imgData.data.length; i += 4) {
+ imgData.data[i + 0] = 0;
+ imgData.data[i + 1] = 255;
+ imgData.data[i + 2] = 0;
+ imgData.data[i + 3] = 255;
+ }
+
+ context.putImageData(imgData, 0, 0, 20, 20, 100, 100)
+
+ const image = context.getImageData(50, 50, 100, 100)
+ context.putImageData(image, 200, 0, 20, 20, 100, 100)
+ })
+
}
})
diff --git a/packageAPI/pages/canvas/canvas.wxml b/packageAPI/pages/canvas/canvas.wxml
index 7961737..d000dd0 100644
--- a/packageAPI/pages/canvas/canvas.wxml
+++ b/packageAPI/pages/canvas/canvas.wxml
@@ -2,16 +2,47 @@
-
- 本demo使用官方文档中的CanvasContext的调用方式
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packageAPI/pages/canvas/canvas.wxss b/packageAPI/pages/canvas/canvas.wxss
index a389d5e..58ff35b 100644
--- a/packageAPI/pages/canvas/canvas.wxss
+++ b/packageAPI/pages/canvas/canvas.wxss
@@ -2,20 +2,32 @@
display: block;
margin-bottom: 50px;
}
+
.canvas-element {
width: 100%;
- height: 250px;
+ height: 200px;
background-color: #ffffff;
-}
-.canvas-buttons {
- padding: 15px 25px 5px;
- width: 100%;
- height: 330px;
box-sizing: border-box;
}
-.canvas-button {
- float: left;
- line-height: 2;
- width: 150px;
- margin: 8px 11px;
+
+.canvas-buttons {
+ padding: 5px;
+ width: 100%;
+ height: 450px;
+ box-sizing: border-box;
+}
+
+.canvas-button-box {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+}
+
+.canvas-button {
+ flex: 0 1 45% !important;
+ width: 45% !important;
+ line-height: 2;
+ padding: 4rpx;
+ margin: 0 4rpx 4rpx 0 !important;
+ border: 1rpx solid #666;
}
diff --git a/packageAPI/pages/canvas/example.js b/packageAPI/pages/canvas/example.js
index 88cec11..f74649f 100644
--- a/packageAPI/pages/canvas/example.js
+++ b/packageAPI/pages/canvas/example.js
@@ -1,18 +1,211 @@
const example = {}
-example.measureText = function (context) {
+example.setGreen = function (context, isOld) {
+ example.setRandom(context, isOld, 'green')
+}
+
+example.setRed = function (context, isOld) {
+ example.setRandom(context, isOld, 'red')
+}
+
+// 设置随机颜色
+example.setRandom = function (context, isOld, color) {
+ if (isOld) {
+ context.setFillStyle(color)
+ context.setStrokeStyle(color)
+ context.setFontSize(10)
+ context.setShadow(10, 10, 30, color)
+ context.setLineCap('butt')
+ context.setLineJoin('miter')
+ context.setLineWidth(1)
+ context.setMiterLimit(10)
+ } else {
+ context.fillStyle = color
+ context.strokeStyle = color
+ context.fontSize = 10
+ context.shadowColor = color
+ context.shadowBlur = 30
+ context.shadowOffsetX = 10
+ context.shadowOffsetY = 10
+ context.lineCap = 'butt'
+ context.lineJoin = 'miter'
+ context.lineWidth = 1
+ context.miterLimit = 10
+ }
+}
+
+// 重置颜色
+example.reset = function (context, isOld) {
+ context.beginPath()
+
+ if (isOld) {
+ context.setFillStyle('#000000')
+ context.setStrokeStyle('#000000')
+ context.setFontSize(10)
+ context.setShadow(0, 0, 0, 'rgba(0, 0, 0, 0)')
+ context.setLineCap('butt')
+ context.setLineJoin('miter')
+ context.setLineWidth(1)
+ context.setMiterLimit(10)
+ } else {
+ context.fillStyle = '#000000'
+ context.strokeStyle = '#000000'
+ context.fontSize = 10
+ context.shadowColor = 'rgba(0, 0, 0, 0)'
+ context.shadowBlur = 0
+ context.shadowOffsetX = 0
+ context.shadowOffsetY = 0
+ context.lineCap = 'butt'
+ context.lineJoin = 'miter'
+ context.lineWidth = 1
+ context.miterLimit = 10
+ }
+}
+
+example.transform = function (context, isOld) {
+ context.transform(1, 0, 0, 1, 30, 10)
+}
+
+example.measureText = function (context, isOld) {
const data = context.measureText('123')
console.log(`width: ${data.width}`)
}
-example.rotate = function (context) {
+example.arc = function (context, isOld) {
context.beginPath()
- context.rotate(10 * Math.PI / 180)
- context.rect(225, 75, 20, 10)
- context.fill()
+ context.arc(75, 75, 50, 0, Math.PI * 2, true)
+ context.moveTo(110, 75)
+ context.arc(75, 75, 35, 0, Math.PI, false)
+ context.moveTo(65, 65)
+ context.arc(60, 65, 5, 0, Math.PI * 2, true)
+ context.moveTo(95, 65)
+ context.arc(90, 65, 5, 0, Math.PI * 2, true)
+
+ context.stroke()
}
-example.scale = function (context) {
+example.arcTo = function (context, isOld) {
+ context.beginPath();
+ context.moveTo(20, 20); // 创建开始点
+ context.lineTo(100, 20); // 创建水平线
+ context.arcTo(150, 20, 150, 70, 50); // 创建弧
+ context.lineTo(150, 120);
+ context.arcTo(200, 120, 200, 170, 20); // 创建弧
+ context.stroke();
+}
+
+example.beginPath = function (context, isOld) {
+ context.beginPath()
+ context.moveTo(20, 75)
+ context.lineTo(250, 75)
+ context.stroke()
+
+ context.beginPath()
+ context.moveTo(50, 20)
+ context.lineTo(150, 130)
+ context.stroke()
+}
+
+example.bezierCurveTo = function (context, isOld) {
+ context.beginPath()
+ context.moveTo(20, 20)
+ context.bezierCurveTo(20, 100, 200, 100, 200, 20)
+ context.stroke()
+ context.beginPath()
+ context.moveTo(60, 60)
+ context.bezierCurveTo(60, 100, 200, 100, 200, 60)
+ context.stroke()
+}
+
+example.clearRect = function (context, isOld) {
+ context.beginPath()
+ context.rect(0, 0, 300, 150)
+ context.fill()
+ context.clearRect(20, 20, 100, 50)
+}
+
+example.clip = function (context, isOld) {
+ // 剪切矩形区域
+ context.rect(50, 20, 200, 120)
+ context.stroke()
+ context.clip()
+ context.fillRect(0, 0, 150, 100)
+}
+
+example.closePath = function (context, isOld) {
+ context.beginPath()
+ context.moveTo(20, 20)
+ context.lineTo(20, 100)
+ context.lineTo(70, 100)
+ context.closePath()
+ context.stroke()
+
+ context.beginPath()
+ context.moveTo(100, 100)
+ context.lineTo(120, 120)
+ context.lineTo(100, 200)
+ context.closePath()
+ context.stroke()
+}
+
+example.rotate = function (context, isOld) {
+ context.beginPath()
+ context.rotate(10 * Math.PI / 180)
+ context.rect(225, 75, 50, 50)
+ context.fill()
+ context.strokeStyle = 'red'
+ context.rect(225, 75, 50, 50)
+ context.stroke()
+}
+
+example.createCircularGradient = function (context, isOld) {
+ if (isOld) {
+ const grd = context.createCircularGradient(75, 50, 50)
+ grd.addColorStop(0, 'red')
+ grd.addColorStop(1, 'green')
+ context.setFillStyle(grd)
+ context.fillRect(10, 10, 150, 80)
+ context.draw()
+ } else {
+ const grd = context.createRadialGradient(75, 50, 5, 20, 20, 20);
+ grd.addColorStop(0, "red")
+ grd.addColorStop(1, "green")
+ context.fillStyle = grd
+ context.fillRect(10, 10, 150, 80)
+ }
+}
+
+example.createLinearGradient = function (context, isOld) {
+ const grd = context.createLinearGradient(0, 0, 170, 0)
+ grd.addColorStop(0, "black")
+ grd.addColorStop(1, "white")
+ if (isOld) {
+ context.setFillStyle(grd)
+ } else {
+ context.fillStyle = grd
+ }
+ context.fillRect(20, 20, 150, 100)
+}
+
+example.createPattern = function (context, isOld, color, canvas) {
+ if (isOld) {
+ const pat = context.createPattern('../../../image/icon_cloud_HL.png', "repeat")
+ context.setFillStyle(pat)
+ context.rect(0, 0, 150, 100)
+ context.fill()
+ } else {
+ const img = canvas.createImage()
+ img.onload = () => {
+ const pat = context.createPattern(img, "repeat")
+ context.fillStyle = pat
+ context.rect(0, 0, 150, 100)
+ context.fill()
+ }
+ img.src = '../../../image/icon_cloud_HL.png'
+ }
+}
+
+example.scale = function (context, isOld) {
context.beginPath()
context.rect(25, 25, 50, 50)
context.stroke()
@@ -22,50 +215,58 @@ example.scale = function (context) {
context.beginPath()
context.rect(25, 25, 50, 50)
context.stroke()
-}
-example.reset = function (context) {
+
+ context.scale(3, 3)
context.beginPath()
+ context.rect(40, 40, 50, 50)
+ context.stroke()
- context.setFillStyle('#000000')
- context.setStrokeStyle('#000000')
- context.setFontSize(10)
- context.setShadow(0, 0, 0, 'rgba(0, 0, 0, 0)')
+ context.scale(1, 1)
- context.setLineCap('butt')
- context.setLineJoin('miter')
- context.setLineWidth(1)
- context.setMiterLimit(10)
}
-example.translate = function (context) {
+example.translate = function (context, isOld) {
context.beginPath()
context.rect(10, 10, 100, 50)
context.fill()
context.translate(70, 70)
+ context.beginPath()
+ context.fill()
+
+ context.translate(120, 120)
context.beginPath()
context.fill()
}
-example.save = function (context) {
+example.save = function (context, isOld) {
context.beginPath()
- context.setStrokeStyle('#00ff00')
+ if (isOld) {
+ context.setStrokeStyle('#00ff00')
+ } else {
+ context.strokeStyle = '#00ff00'
+ }
context.save()
context.scale(2, 2)
- context.setStrokeStyle('#ff0000')
+ if (isOld) {
+ context.setStrokeStyle('#ff0000')
+ } else {
+ context.strokeStyle = '#ff0000'
+ }
context.rect(0, 0, 100, 100)
context.stroke()
context.restore()
context.rect(0, 0, 50, 50)
context.stroke()
+ context.scale(1, 1)
}
-example.restore = function (context) {
+example.restore = function (context, isOld) {
[3, 2, 1].forEach(function (item) {
context.beginPath()
context.save()
@@ -76,27 +277,37 @@ example.restore = function (context) {
})
}
-example.drawImage = function (context) {
- context.drawImage('/image/wechat.png', 0, 0)
+example.drawImage = function (context, isOld, color, canvas) {
+ if (isOld) {
+ context.drawImage('/image/wechat.png', 0, 0)
+ } else {
+ const img = canvas.createImage()
+ img.onload = () => {
+ context.drawImage(img, 0, 0)
+ }
+ img.src = '/image/wechat.png'
+ }
}
-example.fillText = function (context) {
- context.setStrokeStyle('#ff0000')
-
+example.fillText = function (context, isOld) {
context.beginPath()
context.moveTo(0, 10)
context.lineTo(300, 10)
context.stroke()
- // context.save()
- // context.scale(1.5, 1.5)
- // context.translate(20, 20)
- context.setFontSize(10)
- context.fillText('Hello World', 0, 30)
- context.setFontSize(20)
- context.fillText('Hello World', 100, 30)
- // context.restore()
+ if (isOld) {
+ context.setFontSize(10)
+ } else {
+ context.font = '10px arial'
+ }
+ context.fillText('Hello World', 0, 30)
+ if (isOld) {
+ context.setFontSize(20)
+ } else {
+ context.font = '20px arial'
+ }
+ context.fillText('Hello World', 100, 30)
context.beginPath()
context.moveTo(0, 30)
@@ -104,160 +315,281 @@ example.fillText = function (context) {
context.stroke()
}
-example.fill = function (context) {
+example.fill = function (context, isOld) {
context.beginPath()
context.rect(20, 20, 150, 100)
- context.setStrokeStyle('#00ff00')
context.fill()
}
-example.stroke = function (context) {
+example.stroke = function (context, isOld) {
context.beginPath()
context.moveTo(20, 20)
context.lineTo(20, 100)
context.lineTo(70, 100)
- context.setStrokeStyle('#00ff00')
context.stroke()
}
-example.clearRect = function (context) {
- context.setFillStyle('#ff0000')
- context.beginPath()
- context.rect(0, 0, 300, 150)
- context.fill()
- context.clearRect(20, 20, 100, 50)
+example.strokeRect = function (context, isOld) {
+ context.strokeRect(20, 20, 150, 100)
+ context.strokeRect(160, 180, 200, 200)
}
-example.beginPath = function (context) {
- context.beginPath()
- context.setLineWidth(5)
- context.setStrokeStyle('#ff0000')
- context.moveTo(0, 75)
- context.lineTo(250, 75)
- context.stroke()
+example.strokeText = function (context, isOld) {
+ context.font = "20px arial"
+ context.strokeText("Hello World!", 10, 50)
- context.beginPath()
- context.setStrokeStyle('#0000ff')
- context.moveTo(50, 0)
- context.lineTo(150, 130)
- context.stroke()
+ context.font = "30px arial"
+ // 创建渐变
+ const gradient = context.createLinearGradient(0, 0, 200, 0)
+ gradient.addColorStop("0", "magenta")
+ gradient.addColorStop("0.5", "blue")
+ gradient.addColorStop("1.0", "red")
+ // 用渐变填色
+ if (isOld) {
+ context.setStrokeStyle(gradient)
+ } else {
+ context.strokeStyle = gradient
+ }
+ context.strokeText("finclip", 10, 90)
}
-example.closePath = function (context) {
- context.beginPath()
- context.moveTo(20, 20)
- context.lineTo(20, 100)
- context.lineTo(70, 100)
- context.closePath()
- context.stroke()
-}
-example.moveTo = function (context) {
+example.moveTo = function (context, isOld) {
context.beginPath()
context.moveTo(0, 0)
context.lineTo(300, 150)
context.stroke()
+
+ context.beginPath()
+ context.moveTo(40, 40)
+ context.lineTo(200, 180)
+ context.stroke()
}
-example.lineTo = function (context) {
+example.lineTo = function (context, isOld) {
context.beginPath()
context.moveTo(20, 20)
context.lineTo(20, 100)
context.lineTo(70, 100)
context.stroke()
+
+ context.beginPath()
+ context.moveTo(40, 40)
+ context.lineTo(200, 180)
+ context.lineTo(70, 100)
+ context.stroke()
}
-example.rect = function (context) {
+example.rect = function (context, isOld) {
context.beginPath()
context.rect(20, 20, 150, 100)
context.stroke()
-}
-example.arc = function (context) {
context.beginPath()
- context.arc(75, 75, 50, 0, Math.PI * 2, true)
- context.moveTo(110, 75)
- context.arc(75, 75, 35, 0, Math.PI, false)
- context.moveTo(65, 65)
- context.arc(60, 65, 5, 0, Math.PI * 2, true)
- context.moveTo(95, 65)
- context.arc(90, 65, 5, 0, Math.PI * 2, true)
+ context.rect(40, 40, 180, 100)
context.stroke()
}
-example.quadraticCurveTo = function (context) {
+example.quadraticCurveTo = function (context, isOld) {
context.beginPath()
context.moveTo(20, 20)
context.quadraticCurveTo(20, 100, 200, 20)
context.stroke()
-}
-example.bezierCurveTo = function (context) {
context.beginPath()
- context.moveTo(20, 20)
- context.bezierCurveTo(20, 100, 200, 100, 200, 20)
+ context.moveTo(60, 60)
+ context.quadraticCurveTo(30, 130, 200, 20)
context.stroke()
}
-example.setFillStyle = function (context) {
+example.setFillStyle = function (context, isOld) {
['#fef957', 'rgb(242,159,63)', 'rgb(242,117,63)', '#e87e51'].forEach(function (item, index) {
- context.setFillStyle(item)
+ if (isOld) {
+ context.setFillStyle(item)
+ } else {
+ context.fillStyle = item
+ }
context.beginPath()
context.rect(0 + 75 * index, 0, 50, 50)
context.fill()
})
}
-example.setStrokeStyle = function (context) {
+example.setStrokeStyle = function (context, isOld) {
['#fef957', 'rgb(242,159,63)', 'rgb(242,117,63)', '#e87e51'].forEach(function (item, index) {
- context.setStrokeStyle(item)
+ if (isOld) {
+ context.setStrokeStyle(item)
+ } else {
+ context.strokeStyle = item
+ }
context.beginPath()
context.rect(0 + 75 * index, 0, 50, 50)
context.stroke()
})
}
-example.setGlobalAlpha = function (context) {
- context.setFillStyle('#000000');
+
+example.setTextAlign = function (context, isOld) {
+ // 在位置 150 创建蓝线
+ function setTextAlign(text) {
+ if (isOld) {
+ context.setTextAlign(text)
+ } else {
+ context.textAlign = text
+ }
+ }
+ context.moveTo(150, 20)
+ context.lineTo(150, 170)
+ context.stroke()
+
+ context.font = "15px Arial"
+
+ // 显示不同的 textAlign 值
+ setTextAlign("start")
+ context.fillText("textAlign=start", 150, 60)
+ setTextAlign("end")
+ context.fillText("textAlign=end", 150, 80)
+ setTextAlign("left")
+ context.fillText("textAlign=left", 150, 100)
+ setTextAlign("center")
+ context.fillText("textAlign=center", 150, 120)
+ setTextAlign("right")
+ context.fillText("textAlign=right", 150, 140)
+}
+
+example.setTextBaseline = function (context, isOld) {
+ // 在位置 150 创建蓝线
+
+ function setTextBaseline(text) {
+ if (isOld) {
+ context.setTextBaseline(text)
+ } else {
+ context.textBaseline = text
+ }
+ }
+ context.moveTo(5, 100)
+ context.lineTo(395, 100)
+ context.stroke()
+
+ context.font = "20px Arial"
+
+ // 显示不同的 textAlign 值
+ setTextBaseline("top")
+ context.fillText("Top", 5, 100)
+ setTextBaseline("bottom")
+ context.fillText("Bottom", 50, 100)
+ setTextBaseline("middle")
+ context.fillText("Middle", 120, 100)
+ setTextBaseline("alphabetic")
+ context.fillText("Alphabetic", 190, 100)
+ setTextBaseline("hanging")
+ context.fillText("Hanging", 290, 100)
+}
+
+example.setTransform = function (context, isOld) {
+ // 在位置 150 创建蓝线
+
+ context.fillRect(0, 0, 250, 100)
+
+ context.setTransform(1, 0.5, -0.5, 1, 30, 10)
+ if (isOld) {
+ context.setFillStyle('red')
+ } else {
+ context.fillStyle = 'red'
+ }
+ context.fillRect(0, 0, 250, 100);
+
+ context.setTransform(1, 0.5, -0.5, 1, 30, 10)
+ if (isOld) {
+ context.setFillStyle('blue')
+ } else {
+ context.fillStyle = 'blue'
+ }
+ context.fillRect(0, 0, 250, 100)
+}
+
+example.setGlobalAlpha = function (context, isOld) {
[1, 0.5, 0.1].forEach(function (item, index) {
- context.setGlobalAlpha(item)
+ try {
+ context.setGlobalAlpha(item)
+ } catch (e) {
+ context.globalAlpha = item
+ }
context.beginPath()
context.rect(0 + 75 * index, 0, 50, 50)
context.fill()
})
}
-example.setShadow = function (context) {
+example.setShadow = function (context, isOld) {
context.beginPath()
- context.setShadow(10, 10, 10, 'rgba(0, 0, 0, 199)')
context.rect(10, 10, 100, 100)
context.fill()
+
+ context.beginPath()
+ context.rect(50, 50, 100, 100)
+ context.fill()
}
-example.setFontSize = function (context) {
+example.setFontSize = function (context, isOld) {
[10, 20, 30, 40].forEach(function (item, index) {
- context.setFontSize(item)
+ if (isOld) {
+ context.setFontSize(item)
+ } else {
+ context.font = item + 'px arial'
+ }
context.fillText('Hello, world', 20, 20 + 40 * index)
})
}
-example.setLineCap = function (context) {
- context.setLineWidth(10);
+example.setLineCap = function (context, isOld) {
+ context.setLineWidth(10)
+ if (isOld) {
+ context.setLineWidth(10)
+ } else {
+ context.lineWidth = 10
+ }
['butt', 'round', 'square'].forEach(function (item, index) {
context.beginPath()
- context.setLineCap(item)
+ if (isOld) {
+ context.setLineCap(item)
+ } else {
+ context.lineCap = item
+ }
context.moveTo(20, 20 + 20 * index)
context.lineTo(100, 20 + 20 * index)
context.stroke()
})
}
-example.setLineJoin = function (context) {
- context.setLineWidth(10);
+example.setLineDash = function (context, isOld) {
+ context.beginPath()
+ context.setLineDash([5, 15])
+ context.moveTo(0, 50)
+ context.lineTo(300, 50)
+ context.stroke()
+
+ // Solid line
+ context.beginPath()
+ context.setLineDash([])
+ context.moveTo(0, 100)
+ context.lineTo(300, 100)
+ context.stroke()
+}
+
+example.setLineJoin = function (context, isOld) {
+ if (isOld) {
+ context.setLineWidth(10)
+ } else {
+ context.lineWidth = 10
+ }
['bevel', 'round', 'miter'].forEach(function (item, index) {
context.beginPath()
-
- context.setLineJoin(item)
+ if (isOld) {
+ context.setLineJoin(item)
+ } else {
+ context.lineJoin = item
+ }
context.moveTo(20 + 80 * index, 20)
context.lineTo(100 + 80 * index, 50)
context.lineTo(20 + 80 * index, 100)
@@ -265,22 +597,34 @@ example.setLineJoin = function (context) {
})
}
-example.setLineWidth = function (context) {
+example.setLineWidth = function (context, isOld) {
[2, 4, 6, 8, 10].forEach(function (item, index) {
context.beginPath()
- context.setLineWidth(item)
+ if (isOld) {
+ context.setLineWidth(item)
+ } else {
+ context.lineWidth = item
+ }
context.moveTo(20, 20 + 20 * index)
context.lineTo(100, 20 + 20 * index)
context.stroke()
})
}
-example.setMiterLimit = function (context) {
- context.setLineWidth(4);
+example.setMiterLimit = function (context, isOld) {
+ if (isOld) {
+ context.setLineWidth(4)
+ } else {
+ context.lineWidth = 4
+ }
[2, 4, 6, 8, 10].forEach(function (item, index) {
context.beginPath()
- context.setMiterLimit(item)
+ if (isOld) {
+ context.setMiterLimit(item)
+ } else {
+ context.miterLimit = item
+ }
context.moveTo(20 + 80 * index, 20)
context.lineTo(100 + 80 * index, 50)
context.lineTo(20 + 80 * index, 100)
@@ -288,4 +632,67 @@ example.setMiterLimit = function (context) {
})
}
+example.globalCompositeOperation = function (context, isOld) {
+ if (isOld) {
+ context.setFillStyle('red')
+ } else {
+ context.fillStyle = 'red'
+ }
+ context.fillRect(20, 20, 75, 50)
+ context.globalCompositeOperation = "source-over"
+ if (isOld) {
+ context.setFillStyle('blue')
+ } else {
+ context.fillStyle = 'blue'
+ }
+ context.fillRect(50, 50, 75, 50)
+
+ if (isOld) {
+ context.setFillStyle('red')
+ } else {
+ context.fillStyle = 'red'
+ }
+ context.fillRect(150, 20, 75, 50)
+ context.globalCompositeOperation = "destination-over"
+ if (isOld) {
+ context.setFillStyle('blue')
+ } else {
+ context.fillStyle = 'blue'
+ }
+ context.fillRect(180, 50, 75, 50)
+}
+
+example.createImage = function (context, isOld, color, canvas) {
+ if (isOld) {
+ context.fillText('createImage 不会生效', 20, 20)
+ } else {
+ // 本地路径 1
+ const img = canvas.createImage()
+ img.src = '../../../image/wechat.png'
+ img.onload = () => {
+ context.drawImage(img, 0, 0, 100, 100)
+ }
+
+ wx.getImageInfo({
+ src: 'http://img.daimg.com/uploads/allimg/210526/3-2105261P1490-L.jpg',
+ success(res) {
+ const img = canvas.createImage()
+ img.src = res.path
+ // finfile
+ img.onload = () => {
+ context.drawImage(img, 120, 0, 100, 100)
+ }
+ }
+ })
+
+ // 网络路径
+ const img2 = canvas.createImage()
+ img2.src = 'http://img.daimg.com/uploads/allimg/211113/3-2111131612510-L.jpg'
+ img2.onload = () => {
+ context.drawImage(img2, 240, 0, 100, 100)
+ }
+
+ }
+}
+
module.exports = example
diff --git a/packageAPI/pages/checkIsOpenAccessibility/index.js b/packageAPI/pages/checkIsOpenAccessibility/index.js
new file mode 100644
index 0000000..6a4c370
--- /dev/null
+++ b/packageAPI/pages/checkIsOpenAccessibility/index.js
@@ -0,0 +1,21 @@
+
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ status: ''
+ },
+ checkIsOpenAccessibility () {
+ const self = this
+ wx.checkIsOpenAccessibility({
+ complete (res) {
+ console.log('checkIsOpenAccessibility complete: ', res)
+ self.setData({
+ status: res.open
+ })
+ }
+ })
+ }
+})
\ No newline at end of file
diff --git a/packageAPI/pages/checkIsOpenAccessibility/index.json b/packageAPI/pages/checkIsOpenAccessibility/index.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/packageAPI/pages/checkIsOpenAccessibility/index.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/packageAPI/pages/checkIsOpenAccessibility/index.wxml b/packageAPI/pages/checkIsOpenAccessibility/index.wxml
new file mode 100644
index 0000000..adf3236
--- /dev/null
+++ b/packageAPI/pages/checkIsOpenAccessibility/index.wxml
@@ -0,0 +1,6 @@
+
+
+ 无障碍功能开启状态: {{status}}
+
+
+
\ No newline at end of file
diff --git a/packageAPI/pages/checkIsOpenAccessibility/index.wxss b/packageAPI/pages/checkIsOpenAccessibility/index.wxss
new file mode 100644
index 0000000..acd85a8
--- /dev/null
+++ b/packageAPI/pages/checkIsOpenAccessibility/index.wxss
@@ -0,0 +1 @@
+/* pages/navcustom/navcustom.wxss */
\ No newline at end of file
diff --git a/packageAPI/pages/get-system-info/get-system-info.js b/packageAPI/pages/get-system-info/get-system-info.js
index 1e2e432..7f45bbc 100644
--- a/packageAPI/pages/get-system-info/get-system-info.js
+++ b/packageAPI/pages/get-system-info/get-system-info.js
@@ -32,6 +32,21 @@ Page({
// Do something when catch error
}
},
+ getSystemInfoAsync () {
+ const that = this;
+ console.log('getSystemInfoAsync start')
+ wx.getSystemInfoAsync({
+ success(res) {
+ that.setData({
+ systemInfo: res
+ })
+ },
+ complete (res) {
+ console.log('getSystemInfoAsync complete: ', res)
+ }
+ })
+ console.log('getSystemInfoAsync end')
+ },
clearInfo() {
this.setData({
systemInfo: {}
diff --git a/packageAPI/pages/get-system-info/get-system-info.wxml b/packageAPI/pages/get-system-info/get-system-info.wxml
index 591e3b5..11daf65 100644
--- a/packageAPI/pages/get-system-info/get-system-info.wxml
+++ b/packageAPI/pages/get-system-info/get-system-info.wxml
@@ -76,6 +76,7 @@
+
diff --git a/packageAPI/pages/getRandomValues/getRandomValues.js b/packageAPI/pages/getRandomValues/getRandomValues.js
new file mode 100644
index 0000000..1c3a450
--- /dev/null
+++ b/packageAPI/pages/getRandomValues/getRandomValues.js
@@ -0,0 +1,15 @@
+const app = getApp()
+
+Page({
+ data: {
+
+ },
+ getRandomValues () {
+ wx.getRandomValues({
+ length: 20,
+ complete (res) {
+ console.log('getRandomValues complete: ', res)
+ }
+ })
+ }
+})
diff --git a/packageAPI/pages/getRandomValues/getRandomValues.json b/packageAPI/pages/getRandomValues/getRandomValues.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/packageAPI/pages/getRandomValues/getRandomValues.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/packageAPI/pages/getRandomValues/getRandomValues.wxml b/packageAPI/pages/getRandomValues/getRandomValues.wxml
new file mode 100644
index 0000000..c2f3008
--- /dev/null
+++ b/packageAPI/pages/getRandomValues/getRandomValues.wxml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/packageAPI/pages/getRandomValues/getRandomValues.wxss b/packageAPI/pages/getRandomValues/getRandomValues.wxss
new file mode 100644
index 0000000..e69de29
diff --git a/packageAPI/pages/innerAudioContext/index.js b/packageAPI/pages/innerAudioContext/index.js
index 5a09179..497b07a 100644
--- a/packageAPI/pages/innerAudioContext/index.js
+++ b/packageAPI/pages/innerAudioContext/index.js
@@ -4,24 +4,25 @@ const app = getApp()
Page({
data: {
- volume:1,
- rate:1,
+ volume: 1,
+ rate: 1,
},
- onLoad(){
+ onLoad() {
const innerAudioContext = wx.createInnerAudioContext()
this.ctx = innerAudioContext
console.log(innerAudioContext)
-
+
// innerAudioContext.playbackRate = 2.0
-
- innerAudioContext.src = '/packageAPI/pages/innerAudioContext/mucis.mp3'
+
+ // innerAudioContext.src = '/packageAPI/pages/innerAudioContext/mucis.mp3'
// innerAudioContext.src = 'http://cdn.amathclass.cn/quesAudio/42fe780d-1607959109843.m4a'
+ innerAudioContext.src = 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/mucis.mp3'
const listener = ['Canplay', 'Ended', 'Pause', 'Play', 'Seeked', 'Seeking', 'Stop', 'TimeUpdate', 'Waiting']
- listener.forEach(key=>{
- innerAudioContext['on'+key](()=>{
- console.log('on'+key)
+ listener.forEach(key => {
+ innerAudioContext['on' + key](() => {
+ console.log('on' + key)
})
})
innerAudioContext.onError((res) => {
@@ -38,33 +39,33 @@ Page({
this.ctx.destroy()
console.log(this.ctx)
},
- play(){
- this.ctx.play()
- // this.ctx.src = '/mucis.mp3'
- // this.ctx.autoplay = true
+ play() {
+ this.ctx.play()
+ // this.ctx.src = '/mucis.mp3'
+ // this.ctx.autoplay = true
},
- seek(){
+ seek() {
this.ctx.seek(60)
},
- pause(){
+ pause() {
this.ctx.pause()
},
- destroy(){
+ destroy() {
this.ctx.destroy()
console.log(this.ctx)
},
- stop(){
+ stop() {
this.ctx.stop()
},
- handleVolumeChange(e){
+ handleVolumeChange(e) {
this.setData({
- volume:e.detail.value
+ volume: e.detail.value
})
this.ctx.volume = this.data.volume
},
- handleRateChange(e){
+ handleRateChange(e) {
this.setData({
- rate:e.detail.value
+ rate: e.detail.value
})
this.ctx.playbackRate = this.data.rate
}
diff --git a/packageAPI/pages/innerAudioContext/mucis.mp3 b/packageAPI/pages/innerAudioContext/mucis.mp3
deleted file mode 100644
index c935aa6..0000000
Binary files a/packageAPI/pages/innerAudioContext/mucis.mp3 and /dev/null differ
diff --git a/packageAPI/pages/locationapi/index.js b/packageAPI/pages/locationapi/index.js
new file mode 100644
index 0000000..880e737
--- /dev/null
+++ b/packageAPI/pages/locationapi/index.js
@@ -0,0 +1,149 @@
+
+Page({
+ data: {
+ openLocation_latitude: 22.53332,
+ openLocation_longitude: 113.93041,
+ openLocation_scale: 18,
+ openLocation_name: 'testname',
+ openLocation_address: 'addressaddressaddressaddress',
+ getLocation_type: 'gcj02',
+ getLocation_altitude: 'false',
+ getLocation_isHighAccuracy: 'false',
+ getLocation_highAccuracyExpireTime: 3000,
+ chooseLocation_latitude: 22.53332,
+ chooseLocation_longitude: 113.93041
+ },
+ onLoad() {
+
+ },
+ valueChange (e) {
+ const { changekey } = e.target.dataset
+ const { value } = e.detail
+ const obj = {}
+ obj[changekey] = value
+ this.setData(obj)
+ },
+ emitopenLocation () {
+ let {
+ openLocation_latitude: latitude,
+ openLocation_longitude: longitude,
+ openLocation_scale: scale,
+ openLocation_name: name,
+ openLocation_address: address
+ } = this.data
+ const args = {}
+ try {
+ latitude = JSON.parse(latitude)
+ } catch (e) {}
+ try {
+ longitude = JSON.parse(longitude)
+ } catch (e) {}
+ try {
+ scale = JSON.parse(scale)
+ } catch (e) {}
+ // try {
+ // name = JSON.parse(name)
+ // } catch (e) {}
+ // try {
+ // address = JSON.parse(address)
+ // } catch (e) {}
+ latitude !== 'no' && (args.latitude = latitude)
+ longitude !== 'no' && (args.longitude = longitude)
+ scale !== 'no' && (args.scale = scale)
+ name !== 'no' && (args.name = name)
+ address !== 'no' && (args.address = address)
+ console.log('openLocation 参数: ', args)
+ wx.openLocation({
+ ...args,
+ success (res) {
+ console.log('openLocation success: ', res)
+ },
+ fail (res) {
+ console.log('openLocation fail: ', res)
+ },
+ complete (res) {
+ console.log('openLocation complete: ', res)
+ }
+ })
+ },
+ emitgetLocation () {
+ let {
+ getLocation_type: type,
+ getLocation_altitude: altitude,
+ getLocation_isHighAccuracy: isHighAccuracy,
+ getLocation_highAccuracyExpireTime: highAccuracyExpireTime,
+ } = this.data
+ const args = {}
+ try {
+ type = JSON.parse(type)
+ } catch (e) {}
+ try {
+ altitude = JSON.parse(altitude)
+ } catch (e) {}
+ try {
+ isHighAccuracy = JSON.parse(isHighAccuracy)
+ } catch (e) {}
+ try {
+ highAccuracyExpireTime = JSON.parse(highAccuracyExpireTime)
+ } catch (e) {}
+ type !== 'no' && (args.type = type)
+ altitude !== 'no' && (args.altitude = altitude)
+ isHighAccuracy !== 'no' && (args.isHighAccuracy = isHighAccuracy)
+ highAccuracyExpireTime !== 'no' && (args.highAccuracyExpireTime = highAccuracyExpireTime)
+ console.log('getLocation 参数: ', args)
+ wx.getLocation({
+ ...args,
+ success (res) {
+ console.log('getLocation success: ', res)
+ },
+ fail (res) {
+ console.log('getLocation fail: ', res)
+ },
+ complete (res) {
+ console.log('getLocation complete: ', res)
+ }
+ })
+ },
+ emitchoosePoi () {
+ wx.choosePoi({
+ success (res) {
+ console.log('emitchoosePoi success: ', res)
+ },
+ fail (res) {
+ console.log('emitchoosePoi fail: ', res)
+ },
+ complete (res) {
+ console.log('emitchoosePoi complete: ', res)
+ }
+ })
+ },
+ emitchooseLocation () {
+ let {
+ chooseLocation_latitude: latitude,
+ chooseLocation_longitude: longitude
+ } = this.data
+ const args = {}
+ try {
+ latitude = JSON.parse(latitude)
+ } catch (e) {}
+ try {
+ longitude = JSON.parse(longitude)
+ } catch (e) {}
+
+ latitude !== 'no' && (args.latitude = latitude)
+ longitude !== 'no' && (args.longitude = longitude)
+ console.log('chooseLocation 参数: ', args)
+ wx.chooseLocation({
+ ...args,
+ success (res) {
+ console.log('chooseLocation success: ', res)
+ },
+ fail (res) {
+ console.log('chooseLocation fail: ', res)
+ },
+ complete (res) {
+ console.log('chooseLocation complete: ', res)
+ }
+ })
+ }
+})
diff --git a/packageAPI/pages/locationapi/index.json b/packageAPI/pages/locationapi/index.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/packageAPI/pages/locationapi/index.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/packageAPI/pages/locationapi/index.wxml b/packageAPI/pages/locationapi/index.wxml
new file mode 100644
index 0000000..e99f277
--- /dev/null
+++ b/packageAPI/pages/locationapi/index.wxml
@@ -0,0 +1,59 @@
+
+
+ 输入框规则与map组件的一致,可以输入json串解析成各种类型的数据,no不传参
+
+
+
+
+ latitude:
+
+
+ longitude:
+
+
+ scale:
+
+
+ name:
+
+
+ address:
+
+
+
+
+
+
+
+ type:
+
+
+ altitude:
+
+
+ isHighAccuracy:
+
+
+ highAccuracyExpireTime:
+
+
+
+
+
+
+
+
+
+
+
+ latitude:
+
+
+ longitude:
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packageAPI/pages/locationapi/index.wxss b/packageAPI/pages/locationapi/index.wxss
new file mode 100644
index 0000000..9928597
--- /dev/null
+++ b/packageAPI/pages/locationapi/index.wxss
@@ -0,0 +1,34 @@
+/**index.wxss**/
+.userinfo {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ color: #aaa;
+}
+
+.userinfo-avatar {
+ overflow: hidden;
+ width: 128rpx;
+ height: 128rpx;
+ margin: 20rpx;
+ border-radius: 50%;
+}
+
+.usermotto {
+ margin-top: 200px;
+}
+
+.item{
+ border-bottom: 1px solid #dddddd;
+ padding: 20rpx;
+ margin-top: 20rpx;
+}
+
+.key-change{
+ display: flex;
+ padding: 7rpx;
+}
+.key-change input{
+ border: 1px solid #abcdef;
+ flex-grow: 1;
+}
diff --git a/packageAPI/pages/on-network-status-change/on-network-status-change.js b/packageAPI/pages/on-network-status-change/on-network-status-change.js
index a3df7c1..a900e9d 100644
--- a/packageAPI/pages/on-network-status-change/on-network-status-change.js
+++ b/packageAPI/pages/on-network-status-change/on-network-status-change.js
@@ -12,12 +12,13 @@ Page({
},
onLoad() {
const that = this
- wx.onNetworkStatusChange(function (res) {
- that.setData({
- isConnected: res.isConnected,
- networkType: res.networkType
- })
- })
+ this.onNetworkStatusChange()
+ // wx.onNetworkStatusChange(function (res) {
+ // that.setData({
+ // isConnected: res.isConnected,
+ // networkType: res.networkType
+ // })
+ // })
},
onShow() {
const that = this
@@ -29,5 +30,17 @@ Page({
})
}
})
+ },
+ networkstatuschangehandler (res) {
+ this.setData({
+ isConnected: res.isConnected,
+ networkType: res.networkType
+ })
+ },
+ onNetworkStatusChange () {
+ wx.onNetworkStatusChange(this.networkstatuschangehandler)
+ },
+ offNetworkStatusChange () {
+ wx.offNetworkStatusChange(this.networkstatuschangehandler)
}
})
diff --git a/packageAPI/pages/on-network-status-change/on-network-status-change.wxml b/packageAPI/pages/on-network-status-change/on-network-status-change.wxml
index 9d9ca6a..1936a86 100644
--- a/packageAPI/pages/on-network-status-change/on-network-status-change.wxml
+++ b/packageAPI/pages/on-network-status-change/on-network-status-change.wxml
@@ -16,6 +16,10 @@
{{networkType}}
+
+
+
+
diff --git a/packageAPI/pages/previewMedia/index.js b/packageAPI/pages/previewMedia/index.js
index 346ea7c..aedf832 100644
--- a/packageAPI/pages/previewMedia/index.js
+++ b/packageAPI/pages/previewMedia/index.js
@@ -67,19 +67,19 @@ Page({
wx.previewMedia({
sources: [
{
- url: typeof url === 'string' ? url : 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1830914723,3154965800&fm=26&gp=0.jpg',
+ url: typeof url === 'string' ? url : 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/304-400x400.jpeg',
type: 'image',
- poster: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1091405991,859863778&fm=26&gp=0.jpg'
+ poster: 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/1071-400x600.jpeg'
},
{
- url: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1091405991,859863778&fm=26&gp=0.jpg',
+ url: 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/1071-400x600.jpeg',
type: 'image',
- poster: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1091405991,859863778&fm=26&gp=0.jpg'
+ poster: 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/1071-400x600.jpeg'
},
{
url: 'https://dn-odum9helk.qbox.me/spjc/1.mp4',
type: 'video',
- poster: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1091405991,859863778&fm=26&gp=0.jpg'
+ poster: 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/1071-400x600.jpeg'
}
],
success(res) {
@@ -95,7 +95,7 @@ Page({
},
previewMedialocal: function() {
wx.getImageInfo({
- src: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1078861629,3747050294&fm=26&gp=0.jpg',
+ src: 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/1071-400x600.jpeg',
success: (res)=> {
console.log(res)
this.previewMedia(res.path)
@@ -108,8 +108,8 @@ Page({
previewImage() {
wx.previewImage({
urls: [
- 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1830914723,3154965800&fm=26&gp=0.jpg',
- 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1091405991,859863778&fm=26&gp=0.jpg',
+ 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/304-400x400.jpeg',
+ 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/1071-400x600.jpeg',
],
showmenu: true
})
diff --git a/pages/API/index/index.js b/pages/API/index/index.js
index 60c363c..bde284d 100644
--- a/pages/API/index/index.js
+++ b/pages/API/index/index.js
@@ -190,6 +190,9 @@ Page({
}, {
zh: '使用原生地图选择位置',
url: 'choose-location/choose-location'
+ }, {
+ zh: 'locationapi',
+ url: 'locationapi/index'
}
]
}, {
@@ -236,6 +239,24 @@ Page({
url: 'Accelerometer/index'
}
],
+ }, {
+ id: 'encryption',
+ name: '加密',
+ pages: [
+ {
+ zh: 'getRandomValues',
+ url: 'getRandomValues/getRandomValues'
+ }
+ ],
+ }, {
+ id: 'checkIsOpenAccessibility',
+ name: '无障碍',
+ pages: [
+ {
+ zh: 'checkIsOpenAccessibility',
+ url: 'checkIsOpenAccessibility/index'
+ }
+ ],
}
],
isSetTabBarPage: false,
diff --git a/pages/component/camera/camera.wxml b/pages/component/camera/camera.wxml
index ed7c3a7..979d615 100644
--- a/pages/component/camera/camera.wxml
+++ b/pages/component/camera/camera.wxml
@@ -43,8 +43,8 @@
预览
-
+
diff --git a/pages/component/canvas/canvas.wxml b/pages/component/canvas/canvas.wxml
index 85c6ad4..8225ec2 100644
--- a/pages/component/canvas/canvas.wxml
+++ b/pages/component/canvas/canvas.wxml
@@ -2,32 +2,35 @@
-
+
绘制
-
+
绘制图片
-
+
绘制图片-高清
-
+
-
-
diff --git a/pages/component/index/index.js b/pages/component/index/index.js
index eceab2b..6f3a43b 100644
--- a/pages/component/index/index.js
+++ b/pages/component/index/index.js
@@ -12,7 +12,7 @@ Page({
id: 'view',
name: '视图容器',
open: false,
- pages: ['view', 'scroll-view', 'swiper', 'match-media', 'movable', 'cover-view']
+ pages: ['view', 'scroll-view', 'swiper', 'match-media', 'movable', 'cover-view','page-container', 'share-element']
}, {
id: 'content',
name: '基础内容',
@@ -22,7 +22,7 @@ Page({
id: 'form',
name: '表单组件',
open: false,
- pages: ['button', 'checkbox', 'form', 'input', 'label', 'picker', 'picker-view', 'radio', 'slider', 'switch', 'textarea','editor']
+ pages: ['button', 'checkbox', 'form', 'input', 'label', 'picker', 'picker-view', 'radio', 'slider', 'switch', 'textarea','editor','keyboard-accessory']
}, {
id: 'nav',
name: '导航',
@@ -32,7 +32,7 @@ Page({
id: 'media',
name: '媒体组件',
open: false,
- pages: ['image', 'video', 'camera']
+ pages: ['image', 'video', 'camera', 'webrtc']
}, {
id: 'canvas',
name: '画布',
@@ -47,6 +47,10 @@ Page({
id: 'page-attr',
name: '页面属性配置节点',
pages: ['page-meta']
+ }, {
+ id: 'map',
+ name: '地图',
+ pages: ['map','multiple-map']
}
],
theme: 'light'
diff --git a/pages/component/keyboard-accessory/keyboard-accessory.js b/pages/component/keyboard-accessory/keyboard-accessory.js
new file mode 100644
index 0000000..0f94c6f
--- /dev/null
+++ b/pages/component/keyboard-accessory/keyboard-accessory.js
@@ -0,0 +1,78 @@
+const app = getApp()
+
+Page({
+ data: {
+ height: 50,
+ flex: 1,
+ show: true,
+ position: 0,
+ kbastyle: `height: 66px;position:44;`,
+ editingvalue: `height: 66px;`,
+ covershow: false
+ },
+ onLoad: function () {
+
+ },
+
+ focus1() {
+ console.log('focus input\n')
+ },
+
+ blur1() {
+ console.log('blur input')
+ },
+
+ focus2() {
+ console.log('focus textarea')
+ },
+
+ blur2() {
+ console.log('blur textarea')
+ },
+
+ tap (e) {
+ console.log('bindtap', e)
+ },
+
+ positionchange (e) {
+ console.log(e.detail.value)
+ this.setData({
+ position: e.detail.value
+ })
+ },
+
+ textareainput (e) {
+ const value = e.detail.value || ''
+ console.log('textareainput', value)
+ // const reg = new RegExp(`(?<=;)position:.*?(?=;)`)
+ // const hasp = reg.exec(value)
+ const hasp = value.indexOf('position:')
+ console.log('textareainput', hasp)
+ if (hasp > -1) {
+ console.log('textareainput hasp ', value.slice((hasp+9), -1))
+ this.setData({
+ position: value.slice((hasp+9), -1)
+ })
+ }
+ this.setData({
+ kbastyle: value
+ })
+ },
+
+ kbheightchange (e) {
+ console.log('~~~~~~~~~~kbheightchange~~~~~~~~', e)
+ },
+
+ kbfocus () {
+ console.log('~~~~~~~~~~kbfocus~~~~~~~~')
+ },
+
+ kbblur () {
+ console.log('~~~~~~~~~~kbblur~~~~~~~~')
+ },
+ changecovershow () {
+ this.setData({
+ covershow: !this.data.covershow
+ })
+ }
+})
diff --git a/pages/component/keyboard-accessory/keyboard-accessory.json b/pages/component/keyboard-accessory/keyboard-accessory.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/pages/component/keyboard-accessory/keyboard-accessory.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/component/keyboard-accessory/keyboard-accessory.wxml b/pages/component/keyboard-accessory/keyboard-accessory.wxml
new file mode 100644
index 0000000..42b43cb
--- /dev/null
+++ b/pages/component/keyboard-accessory/keyboard-accessory.wxml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+ click
+
+
+
+
+
+
+
+
+ 测试update。 以下输入框的内容将会作为keyboard-accessory的style属性。 匹配position改变position值。 例如:height: 66px;position:44;
+
+
+
\ No newline at end of file
diff --git a/pages/component/keyboard-accessory/keyboard-accessory.wxss b/pages/component/keyboard-accessory/keyboard-accessory.wxss
new file mode 100644
index 0000000..d55ea20
--- /dev/null
+++ b/pages/component/keyboard-accessory/keyboard-accessory.wxss
@@ -0,0 +1,8 @@
+.intro {
+ margin: 30px;
+ text-align: center;
+}
+
+.container {
+ display: flex;
+}
\ No newline at end of file
diff --git a/pages/component/map/map.js b/pages/component/map/map.js
new file mode 100644
index 0000000..660da87
--- /dev/null
+++ b/pages/component/map/map.js
@@ -0,0 +1,1724 @@
+// pages/component/map/map.js
+let mapcontext
+let unde
+
+const data = {
+ maptype: '3',
+ maptypes: ['amap','google','baidu','auto'],
+ booleanArray: [true, false, 'no'],
+ showingSence: 'latlong',
+ mapShow: true,
+ editingLongitude: '113.93041',
+ editingLatitude: '22.53332',
+ // longitude: '114.063848',
+ // latitude: '22.551365',
+ // longitude: '85.1318117790985',
+ // latitude: '45.69139458288415',
+ latitude: 22.53332,
+ longitude: 113.93041,
+ // latitude: 200,
+ // longitude: 200,
+ scale: 12,
+ editingScale: 12,
+ minScale: 3,
+ editingMinscale: 3,
+ maxScale: 20,
+ editingMaxscale: 20,
+ markers:[
+ {
+ "id": 1,
+ "latitude": 22.54332,
+ "longitude": 113.94041,
+ "joinCluster": true,
+ "title": "title1",
+ "zIndex": 1,
+ "iconPath": "/assets/images/logo.png",
+ "rotate": 0,
+ "alpha": 1,
+ "width": 30,
+ "height": 30,
+ "callout": {
+ "content": "point1",
+ "color": "#ff0000",
+ "fontSize": 14,
+ "borderRadius": 7,
+ "borderWidth": 2,
+ "borderColor": "#000000",
+ "bgColor": "#ffffff",
+ "padding": 1,
+ "display": "ALWAYS",
+ "textAlign": "center",
+ "anchorX": 0,
+ "anchorY": 0
+ },
+ "customCallout": {
+ "display": "BYCLICK",
+ "anchorX": 0,
+ "anchorY": 0
+ },
+ "label": {
+ "content": "label1",
+ "color": "",
+ "fontSize": 16,
+ "anchorX": 0,
+ "anchorY": 0,
+ "borderWidth": 30,
+ "borderColor": "",
+ "borderRadius": 10,
+ "bgColor": "",
+ "padding": 10,
+ "textAlign": "center"
+ },
+ "anchor": {
+ "x": 0,
+ "y": 0
+ },
+ "aria-label": "marker1 aria-label"
+ },
+ {
+ "id": 2,
+ "latitude": 22.52332,
+ "longitude": 113.92041
+ },
+ {
+ "id": 3,
+ "latitude": 22.52332,
+ "longitude": 113.93041
+ },
+ {
+ "id":4,
+ "latitude": 22.53332,
+ "longitude": 113.93041,
+ "callout": {
+ "content": "point4",
+ },
+ "label": {
+ "content": "label4"
+ }
+ },
+ {
+ "id":5,
+ "latitude": 22.51332,
+ "longitude": 113.92041,
+ "joinCluster": true,
+ "callout": {
+ "content": "point5",
+ },
+ "label": {
+ "content": "label5"
+ }
+ },
+ {
+ "id":6,
+ "latitude": 22.51332,
+ "longitude": 113.91041,
+ "joinCluster": true,
+ "label": {
+ "content": "label6"
+ }
+ },
+ {
+ "id":7,
+ "latitude": 22.50332,
+ "longitude": 113.90041,
+ "joinCluster": true,
+ "callout": {
+ "content": "point7",
+ },
+ "label": {
+ "content": "label7"
+ }
+ }
+ ],
+ editingMarkers: `
+ [
+ {
+ "id": 1,
+ "latitude": 22.54332,
+ "longitude": 113.94041,
+ "joinCluster": true,
+ "title": "title1",
+ "zIndex": 1,
+ "iconPath": "/assets/images/logo.png",
+ "rotate": 0,
+ "alpha": 1,
+ "width": 30,
+ "height": 30,
+ "callout": {
+ "content": "point1",
+ "color": "#ff0000",
+ "fontSize": 14,
+ "borderRadius": 7,
+ "borderWidth": 2,
+ "borderColor": "#000000",
+ "bgColor": "#ffffff",
+ "padding": 1,
+ "display": "ALWAYS",
+ "textAlign": "center",
+ "anchorX": 0,
+ "anchorY": 0
+ },
+ "customCallout": {
+ "display": "BYCLICK",
+ "anchorX": 0,
+ "anchorY": 0
+ },
+ "label": {
+ "content": "label1",
+ "color": "",
+ "fontSize": 16,
+ "anchorX": 0,
+ "anchorY": 0,
+ "borderWidth": 30,
+ "borderColor": "",
+ "borderRadius": 10,
+ "bgColor": "",
+ "padding": 10,
+ "textAlign": "center"
+ },
+ "anchor": {
+ "x": 0,
+ "y": 0
+ },
+ "aria-label": "marker1 aria-label"
+ },
+ {
+ "id": 2,
+ "latitude": 22.52332,
+ "longitude": 113.92041
+ },
+ {
+ "id": 3,
+ "latitude": 22.52332,
+ "longitude": 113.93041
+ },
+ {
+ "id":4,
+ "latitude": 22.53332,
+ "longitude": 113.93041,
+ "callout": {
+ "content": "point4"
+ },
+ "label": {
+ "content": "label4"
+ }
+ },
+ {
+ "id":5,
+ "latitude": 22.51332,
+ "longitude": 113.92041,
+ "joinCluster": true,
+ "callout": {
+ "content": "point5"
+ },
+ "label": {
+ "content": "label5"
+ }
+ },
+ {
+ "id":6,
+ "latitude": 22.51332,
+ "longitude": 113.91041,
+ "joinCluster": true,
+ "label": {
+ "content": "label6"
+ }
+ },
+ {
+ "id":7,
+ "latitude": 22.50332,
+ "longitude": 113.90041,
+ "joinCluster": true,
+ "callout": {
+ "content": "point7"
+ },
+ "label": {
+ "content": "label7"
+ }
+ }
+ ]
+ `,
+ polyline: [{
+ "points": [{
+ "latitude": 22.53332,
+ "longitude": 113.93041
+ },{
+ "latitude": 22.52332,
+ "longitude": 113.92041
+ },{
+ "latitude": 22.52332,
+ "longitude": 113.93041
+ }],
+ "color": "#02ecff",
+ "colorList": ["#00bcd4","#ff9800"],
+ "dottedLine": false,
+ "arrowIconPath": "",
+ "width": 6,
+ "arrowLine": true,
+ "borderColor": "#000000",
+ "borderWidth": 6,
+ "level": "abovelabels"
+ }],
+ editingPolyline: `
+ [{
+ "points": [{
+ "latitude": 22.52332,
+ "longitude": 113.93041
+ },{
+ "latitude": 22.51332,
+ "longitude": 113.92041
+ },{
+ "latitude": 22.51332,
+ "longitude": 113.93041
+ }],
+ "color": "#02ecff",
+ "colorList": ["#00bcd4","#ff9800"],
+ "dottedLine": false,
+ "arrowIconPath": "",
+ "width": 6,
+ "arrowLine": true,
+ "borderColor": "#000000",
+ "borderWidth": 6,
+ "level": "abovelabels"
+ }]
+ `,
+ circles: [{
+ "latitude": 22.53932,
+ "longitude": 113.93641,
+ "color": "#ff455b",
+ "fillColor": "#acfd00",
+ "radius": 500,
+ "strokeWidth": 5,
+ "level": "abovelabels"
+ }],
+ editingCircles: `[{
+ "latitude": 22.53932,
+ "longitude": 113.93641,
+ "color": "#ff455b",
+ "fillColor": "#acfd00",
+ "radius": 500,
+ "strokeWidth": 5,
+ "level": "abovelabels"
+ }]`,
+ controls: [{
+ "id": 4,
+ "position": {
+ "left": 20,
+ "top": 60,
+ "width": 30,
+ "height": 30
+ },
+ iconPath: "https://img2.baidu.com/it/u=1558944015,1677859960&fm=26&fmt=auto",
+ clickable: true
+ },{
+ "id": 5,
+ "position": {
+ "left": 20,
+ "top": 100,
+ "width": 30,
+ "height": 30
+ },
+ iconPath: "/image/duck.gif",
+ clickable: true
+ }],
+ editingControls: `
+ [{
+ "id": 4,
+ "position": {
+ "left": 20,
+ "top": 60,
+ "width": 30,
+ "height": 30
+ },
+ "iconPath": "/assets/images/logo.png",
+ "clickable": true
+ },{
+ "id": 5,
+ "position": {
+ "left": 20,
+ "top": 100,
+ "width": 30,
+ "height": 30
+ },
+ "iconPath": "/image/duck.gif",
+ "clickable": true
+ }]
+ `,
+ includePoints: [
+ {
+ "id": 1,
+ "latitude": 22.03332,
+ "longitude": 113.03041,
+ },{
+ "id": 2,
+ "latitude": 21.53332,
+ "longitude": 112.93041,
+ },{
+ "id": 3,
+ "latitude": 23.53332,
+ "longitude": 114.93041,
+ }
+ ],
+ editingIncludePoints: `[
+ {
+ "id": 1,
+ "latitude": 22.03332,
+ "longitude": 113.03041
+ },{
+ "id": 2,
+ "latitude": 21.53332,
+ "longitude": 112.93041
+ },{
+ "id": 3,
+ "latitude": 23.53332,
+ "longitude": 114.93041
+ }
+ ]`,
+ showLocation: false,
+ polygons: [{
+ "points": [
+ {
+ "latitude": 22.53932,
+ "longitude": 113.93641
+ },
+ {
+ "latitude": 22.53932,
+ "longitude": 113.92641
+ },
+ {
+ "latitude": 22.52932,
+ "longitude": 113.92641
+ },
+ {
+ "latitude": 22.52932,
+ "longitude": 113.93641
+ }
+ ],
+ "strokeWidth": 4,
+ "strokeColor": "#9C27B0",
+ "fillColor": "#fff202",
+ "zIndex": 1,
+ "level": "abovelabels"
+ }],
+ editingPolygons: `
+ [{
+ "points": [
+ {
+ "latitude": 22.53932,
+ "longitude": 113.93641
+ },
+ {
+ "latitude": 22.53932,
+ "longitude": 113.92641
+ },
+ {
+ "latitude": 22.52932,
+ "longitude": 113.92641
+ },
+ {
+ "latitude": 22.52932,
+ "longitude": 113.93641
+ }
+ ],
+ "strokeWidth": 4,
+ "strokeColor": "#9C27B0",
+ "fillColor": "#fff202",
+ "zIndex": 1,
+ "level": "abovelabels"
+ }]
+ `,
+ rotate: 90,
+ editingrotate: 90,
+ skew: 20,
+ editingskew: 20,
+ enable3D: true,
+ showCompass: false,
+ showScale: true,
+ enableOverlooking: true,
+ enableZoom: true,
+ enableScroll: true,
+ enableRotate: true,
+ enableSatellite: true,
+ enableTraffic: false,
+ enablePoi: true,
+ enableBuilding: true,
+ setting: {
+ "skew": 0,
+ "rotate": 0,
+ "showLocation": false,
+ "showScale": false,
+ "enableZoom": true,
+ "enableScroll": true,
+ "enableRotate": true,
+ "showCompass": false,
+ "enable3D": false,
+ "enableOverlooking": false,
+ "enableSatellite": false,
+ "enableTraffic": false,
+ },
+ eidtingSetting: `
+ {
+ "skew": 0,
+ "rotate": 0,
+ "showLocation": false,
+ "showScale": false,
+ "enableZoom": true,
+ "enableScroll": true,
+ "enableRotate": true,
+ "showCompass": false,
+ "enable3D": false,
+ "enableOverlooking": false,
+ "enableSatellite": false,
+ "enableTraffic": false
+ }
+ `,
+ controlAreaHeight: '400px',
+ latlong: `[22.53332,113.93041]`,
+ translatemarkerMarkerid: 'no',
+ translatemarker_marker_autoRotate: 2,
+ translatemarker_rotate: 'no',
+ translatemarker_duration: 'no',
+ translatemarker_marker_moveWithRotate: 2,
+ translatemarker_destination: `{"latitude": 22.33332, "longitude": 113.83041 }`,
+ markerIconPath: '/assets/images/logo.png',
+ toNumber: true,
+ moveAlong_path: `[
+ {
+ "latitude": 22.54332,
+ "longitude": 113.94041
+ },
+ {
+ "latitude": 22.53332,
+ "longitude": 113.93041
+ },
+ {
+ "latitude": 22.51332,
+ "longitude": 113.93041
+ },
+ {
+ "latitude": 22.51332,
+ "longitude": 113.95041
+ },
+ {
+ "latitude": 22.53332,
+ "longitude": 113.95041
+ },
+ {
+ "latitude": 22.54332,
+ "longitude": 113.94041
+ }
+ ]`,
+ moveAlongMarkerid: 'no',
+ moveAlong_autoRotate: 2,
+ moveAlong_duration: 'no',
+ moveAlong2_path: `[
+ {
+ "latitude": 22.54332,
+ "longitude": 113.94041
+ },
+ {
+ "latitude": 22.53332,
+ "longitude": 113.93041
+ },
+ {
+ "latitude": 22.51332,
+ "longitude": 113.93041
+ },
+ {
+ "latitude": 22.51332,
+ "longitude": 113.95041
+ },
+ {
+ "latitude": 22.53332,
+ "longitude": 113.95041
+ },
+ {
+ "latitude": 22.54332,
+ "longitude": 113.94041
+ }
+ ]`,
+ moveAlong2Markerid: 'no',
+ moveAlong2_autoRotate: 2,
+ moveAlong2_duration: 'no',
+ centerOffset: [0.5,0.5],
+ editingcenterOffset : `[0.5,0.5]`,
+ controls_id: 'no',
+ controls_position: `{
+ "left": 20,
+ "top": 20,
+ "width": 30,
+ "height": 30
+ }`,
+ controls_iconPath: '',
+ controls_clickable: 2,
+ polyline_points: `[{
+ "latitude": 22.53332,
+ "longitude": 113.93041
+ },{
+ "latitude": 22.52332,
+ "longitude": 113.92041
+ },{
+ "latitude": 22.52332,
+ "longitude": 113.93041
+ }]`,
+ polyline_color: "no",
+ polyline_colorList: `["#00bcd4","#ff9800"]`,
+ polyline_dottedLine: 2,
+ polyline_arrowIconPath: "no",
+ polyline_width: 'no',
+ polyline_arrowLine: false,
+ polyline_borderColor: 'no',
+ polyline_borderWidth: 'no',
+ polyline_level: 'abovelabels',
+ circle_latitude: 'no',
+ circle_longitude: 'no',
+ circle_color: 'no',
+ circle_fillColor: 'no',
+ circle_radius: 'no',
+ circle_strokeWidth: 'no',
+ circle_level: 'abovelabels',
+ includePoints_points: `[
+ {
+ "id": 1,
+ "latitude": 22.03332,
+ "longitude": 113.03041
+ },{
+ "id": 2,
+ "latitude": 21.53332,
+ "longitude": 112.93041
+ },{
+ "id": 3,
+ "latitude": 23.53332,
+ "longitude": 114.93041
+ }
+ ]`,
+ includePoints_padding: `[10,10,10,10]`,
+ polygons_points: `[
+ {
+ "latitude": 22.53932,
+ "longitude": 113.93641
+ },
+ {
+ "latitude": 22.53932,
+ "longitude": 113.92641
+ },
+ {
+ "latitude": 22.52932,
+ "longitude": 113.92641
+ },
+ {
+ "latitude": 22.52932,
+ "longitude": 113.93641
+ }
+ ]`,
+ polygons_strokeWidth: 'no',
+ polygons_strokeColor: 'no',
+ polygons_fillColor: 'no',
+ polygons_zIndex: 'no',
+ polygons_level: 'no',
+ markers_id: '5',
+ markers_latitude: '22.51932',
+ markers_longitude: '113.92641',
+ markers_joinCluster: 2,
+ markers_title: 'no',
+ markers_zIndex: 'no',
+ markers_iconPath: 'no',
+ markers_rotate: 'no',
+ markers_alpha: 'no',
+ markers_width: 'no',
+ markers_height: 'no',
+ markers_callout: `
+ {
+ "content": "point1",
+ "color": "#ff0000",
+ "fontSize": 14,
+ "borderRadius": 7,
+ "borderWidth": 2,
+ "borderColor": "#000000",
+ "bgColor": "#ffffff",
+ "padding": 1,
+ "display": "ALWAYS",
+ "textAlign": "center",
+ "anchorX": 0,
+ "anchorY": 0
+ }
+ `,
+ markers_customCallout: `
+ {
+ "display": "BYCLICK",
+ "anchorX": 0,
+ "anchorY": 0
+ }
+ `,
+ markers_label: `
+ {
+ "content": "label1",
+ "color": "#ff0000",
+ "fontSize": 5,
+ "anchorX": 0,
+ "anchorY": 0,
+ "borderWidth": 1,
+ "borderColor": "#000000",
+ "borderRadius": 2,
+ "bgColor": "#ffffff",
+ "padding": 1,
+ "textAlign": "center"
+ }
+ `,
+ markers_anchor: `
+ {
+ "x": 0,
+ "y": 0
+ }
+ `,
+ markers_arialabel: 'no',
+ addmarkers_clear: 2,
+ addmarkers_markers: `[
+ {
+ "id": 666,
+ "latitude": 22.51332,
+ "longitude": 113.92041
+ },
+ {
+ "id": 667,
+ "latitude": 22.50332,
+ "longitude": 113.93041
+ }
+ ]`,
+ removemarker_markerIds: `[]`,
+ initmarkercluster_enableDefaultStyle: 2,
+ initmarkercluster_zoomOnClick: 2,
+ initmarkercluster_gridSize: 60,
+ movetolocation_longitude: '113.93041',
+ movetolocation_latitude: '22.53332',
+ openmapapp_longitude: '113.93041',
+ openmapapp_latitude: '22.53332',
+ openmapapp_destination: '目的地'
+}
+
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ ...data
+ },
+
+ resetData () {
+ this.setData(data)
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ // const {windowHeight} = wx.getSystemInfoSync()
+ const windowHeight = 650
+ this.setData({
+ controlAreaHeight: (windowHeight - 324) + 'px',
+ // latlong: `[${this.data.latitude}, ${this.data.longitude}]`
+ })
+ this.emitCreateMapContext()
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+ emitCreateMapContext() {
+ mapcontext = wx.createMapContext('maplearn')
+ console.log(mapcontext)
+ },
+ bindtapHandler (res) {
+ console.log('debug: bindtapHandler ', res)
+ },
+ bindmarkertapHandler (res) {
+ console.log('debug: bindmarkertapHandler ', res)
+ },
+ bindlabeltapHandler (res) {
+ console.log('debug: bindlabeltapHandler ', res)
+ },
+ bindcontroltapHandler (res) {
+ console.log('debug: bindcontroltapHandler ', res)
+ },
+ bindcallouttapHandler (res) {
+ console.log('debug: bindcallouttapHandler ', res)
+ },
+ bindupdatedHandler (res) {
+ console.log('debug: bindupdatedHandler ', res)
+ },
+ bindregionchangeHandler (res) {
+ console.log('debug: bindregionchangeHandler ', res)
+ },
+ bindpoitapHandler (res) {
+ console.log('debug: bindpoitapHandler ', res)
+ },
+ bindanchorpointtapHandler (res) {
+ console.log('debug: bindanchorpointtapHandler ', res)
+ },
+ countMarker () {
+ let {
+ markers_id,
+ markers_latitude,
+ markers_longitude,
+ markers_joinCluster,
+ markers_title,
+ markers_zIndex,
+ markers_iconPath,
+ markers_rotate,
+ markers_alpha,
+ markers_width,
+ markers_height,
+ markers_callout,
+ markers_customCallout,
+ markers_label,
+ markers_anchor,
+ markers_arialabel,
+ booleanArray,
+ toNumber
+ } = this.data
+
+ markers_joinCluster = booleanArray[markers_joinCluster]
+
+ try {
+ markers_callout = JSON.parse(markers_callout)
+ } catch (e) {}
+ try {
+ markers_customCallout = JSON.parse(markers_customCallout)
+ } catch (e) {}
+ try {
+ markers_label = JSON.parse(markers_label)
+ } catch (e) {}
+ try {
+ markers_anchor = JSON.parse(markers_anchor)
+ } catch (e) {}
+
+ const params = {}
+
+ markers_id !== 'no' && (params.id = toNumber ? Number(markers_id) : String(markers_id))
+ markers_latitude !== 'no' && (params.latitude = toNumber ? Number(markers_latitude) : String(markers_latitude))
+ markers_longitude !== 'no' && (params.longitude = toNumber ? Number(markers_longitude) : String(markers_longitude))
+ markers_zIndex !== 'no' && (params.zIndex = toNumber ? Number(markers_zIndex) : String(markers_zIndex))
+ markers_rotate !== 'no' && (params.rotate = toNumber ? Number(markers_rotate) : String(markers_rotate))
+ markers_alpha !== 'no' && (params.alpha = toNumber ? Number(markers_alpha) : String(markers_alpha))
+ markers_width !== 'no' && (params.width = toNumber ? Number(markers_width) : String(markers_width))
+ markers_height !== 'no' && (params.height = toNumber ? Number(markers_height) : String(markers_height))
+ markers_callout !== 'no' && (params.callout = markers_callout)
+ markers_customCallout !== 'no' && (params.customCallout = markers_customCallout)
+ markers_label !== 'no' && (params.label = markers_label)
+ markers_anchor !== 'no' && (params.anchor = markers_anchor)
+ markers_joinCluster !== 'no' && (params.joinCluster = markers_joinCluster)
+ markers_title !== 'no' && (params.title = markers_title)
+ markers_iconPath !== 'no' && (params.iconPath = markers_iconPath)
+ markers_arialabel !== 'no' && (params['aria-label'] = markers_arialabel)
+
+ return params
+ },
+ addMarker () {
+ const params = this.countMarker()
+
+ console.log('添加markers: ', params)
+ const markers = this.data.markers
+ markers.push(params)
+
+ this.setData({
+ markers
+ })
+ },
+ changeMarker () {
+ let { editingMarkers } = this.data
+ try {
+ editingMarkers = JSON.parse(editingMarkers)
+ } catch (e) {
+ console.log(e)
+ }
+ console.log('changeMarker: ', editingMarkers)
+ this.setData({
+ markers: editingMarkers
+ })
+ },
+ randomHexColor() {
+ var hex = Math.floor(Math.random() * 16777216).toString(16); //生成ffffff以内16进制数
+ while (hex.length < 6) { //while循环判断hex位数,少于6位前面加0凑够6位
+ hex = '0' + hex;
+ }
+ return '#' + hex; //返回‘#'开头16进制颜色
+ },
+ randomRadius() {
+ return Math.floor(Math.random() * 3000)
+ },
+ changePolyline () {
+ let polyline
+ try {
+ polyline = JSON.parse(this.data.editingPolyline)
+ } catch(e) {
+ polyline = this.data.editingPolyline
+ }
+ this.setData({
+ polyline
+ })
+ console.log('当前polyline: ', this.data.polyline)
+ },
+ addPolyline () {
+ let {
+ polyline_points,
+ polyline_color,
+ polyline_colorList,
+ polyline_dottedLine,
+ polyline_arrowIconPath,
+ polyline_width,
+ polyline_arrowLine,
+ polyline_borderColor,
+ polyline_borderWidth,
+ polyline_level,
+ booleanArray,
+ toNumber
+ } = this.data
+
+ polyline_dottedLine = booleanArray[polyline_dottedLine]
+ polyline_arrowLine = booleanArray[polyline_arrowLine]
+
+ const params = {}
+ try {
+ polyline_points = JSON.parse(polyline_points)
+ } catch (e) {}
+ try {
+ polyline_colorList = JSON.parse(polyline_colorList)
+ } catch (e) {}
+
+ polyline_points !== 'no' && (params.points = polyline_points)
+ polyline_color !== 'no' && (params.color = polyline_color)
+ polyline_colorList !== 'no' && (params.colorList = polyline_colorList)
+ polyline_dottedLine !== 'no' && (params.dottedLine = polyline_dottedLine)
+ polyline_arrowIconPath !== 'no' && (params.arrowIconPath = polyline_arrowIconPath)
+ polyline_width !== 'no' && (params.width = toNumber ? Number(polyline_width) : String(polyline_width))
+ polyline_arrowLine !== 'no' && (params.arrowLine = polyline_arrowLine)
+ polyline_borderColor !== 'no' && (params.borderColor = polyline_borderColor)
+ polyline_borderWidth !== 'no' && (params.borderWidth = toNumber ? Number(polyline_borderWidth) : String(polyline_borderWidth))
+ polyline_level !== 'no' && (params.level = polyline_level)
+
+ console.log('添加polyline : ', params)
+
+ const polyline = this.data.polyline
+ polyline.push(params)
+ this.setData({
+ polyline
+ })
+ },
+ addCircles () {
+ let {
+ circle_latitude,
+ circle_longitude,
+ circle_color,
+ circle_fillColor,
+ circle_radius,
+ circle_strokeWidth,
+ circle_level,
+ toNumber
+ } = this.data
+
+ const params = {}
+
+ circle_latitude !== 'no' && (params.latitude = toNumber ? Number(circle_latitude) : String(circle_latitude))
+ circle_longitude !== 'no' && (params.longitude = toNumber ? Number(circle_longitude) : String(circle_longitude))
+ circle_color !== 'no' && (params.color = circle_color)
+ circle_fillColor !== 'no' && (params.fillColor = circle_fillColor)
+ circle_radius !== 'no' && (params.radius = circle_radius)
+ circle_strokeWidth !== 'no' && (params.strokeWidth = circle_strokeWidth)
+ circle_level !== 'no' && (params.level = circle_level)
+
+ console.log('添加circle : ', params)
+
+ const circles = this.data.circles
+ circles.push(params)
+ this.setData({
+ circles
+ })
+ },
+ changeCircles () {
+ let { editingCircles } = this.data
+ try {
+ editingCircles = JSON.parse(editingCircles)
+ } catch (e) {}
+ this.setData({
+ circles: editingCircles
+ })
+ },
+ addControls () {
+ let { controls_id, controls_iconPath, controls_position, controls_clickable, toNumber, booleanArray } = this.data
+
+ controls_clickable = booleanArray[controls_clickable]
+
+ try {
+ controls_position = JSON.parse(controls_position)
+ } catch(e) {}
+
+ const params = {}
+ controls_id !== 'no' && (params.id = toNumber ? Number(controls_id) : String(controls_id))
+ controls_iconPath !== 'no' && (params.iconPath = controls_iconPath)
+ controls_position !== 'no' && (params.position = controls_position)
+ controls_clickable !== 'no' && (params.clickable = controls_clickable)
+ const controls = this.data.controls
+ controls.push(params)
+ console.log('添加controls 参数: ', params)
+ this.setData({
+ controls
+ })
+ },
+ consoleControls () {
+ console.log('当前controls: ', this.data.controls)
+ this.setData({
+ editingControls: JSON.stringify(this.data.controls)
+ })
+ },
+ changeControls () {
+ let controls
+ try {
+ controls = JSON.parse(this.data.editingControls)
+ } catch(e) {
+ controls = this.data.editingControls
+ }
+ this.setData({
+ controls
+ })
+ console.log('当前controls: ', this.data.controls)
+ },
+ changeIncludePoints () {
+ let { editingIncludePoints } = this.data
+ try {
+ editingIncludePoints = JSON.parse(editingIncludePoints)
+ } catch (e) {}
+ console.log('includePoints : ', editingIncludePoints)
+ this.setData({
+ includePoints: editingIncludePoints
+ })
+ },
+ switchtoNumber (event) {
+ this.setData({
+ toNumber: event.detail.value
+ });
+ },
+ changeAttribute (e) {
+ const attribute = e.target.dataset.attribute
+ const obj = {}
+ obj[attribute] = !!!this.data[attribute]
+ console.log('修改参数 ', obj)
+ this.setData(obj)
+ },
+ attributePickerChange(e) {
+ const attribute = e.target.dataset.attribute
+ const obj = {}
+ obj[attribute] = e.detail.value
+ console.log('修改参数 ', obj)
+ this.setData(obj)
+ },
+ changeInputValue (e) {
+ const attribute = e.target.dataset.attribute
+ const obj = {}
+ obj[attribute] = e.detail.value
+ console.log('修改数据 ', obj)
+ this.setData(obj)
+ },
+ changePolygons () {
+ let { editingPolygons } = this.data
+ try {
+ editingPolygons = JSON.parse(editingPolygons)
+ } catch (e) {}
+ console.log('改变polygons: ', editingPolygons)
+ this.setData({
+ polygons: editingPolygons
+ })
+ },
+ addPolygons () {
+ let {
+ polygons_points,
+ polygons_strokeWidth,
+ polygons_strokeColor,
+ polygons_fillColor,
+ polygons_zIndex,
+ polygons_level,
+ toNumber
+ } = this.data
+
+ try {
+ polygons_points = JSON.parse(polygons_points)
+ } catch (e) {}
+
+ const params = {}
+ polygons_points !== 'no' && (params.points = polygons_points)
+ polygons_strokeWidth !== 'no' && (params.strokeWidth = toNumber ? Number(polygons_strokeWidth) : String(polygons_strokeWidth))
+ polygons_zIndex !== 'no' && (params.zIndex = toNumber ? Number(polygons_zIndex) : String(polygons_zIndex))
+ polygons_strokeColor !== 'no' && (params.strokeColor = polygons_strokeColor)
+ polygons_fillColor !== 'no' && (params.fillColor = polygons_fillColor)
+ polygons_level !== 'no' && (params.level = polygons_level)
+
+ console.log('添加polygons: ', params)
+
+ const polygons = this.data.polygons
+ polygons.push(params)
+
+ this.setData({
+ polygons
+ })
+ },
+ changeSetting () {
+
+ let {eidtingSetting} = this.data
+ try {
+ eidtingSetting = JSON.parse(eidtingSetting)
+ } catch (e) {}
+
+ console.log('修改setting: ', eidtingSetting)
+
+ this.setData({
+ setting: eidtingSetting
+ })
+ },
+ switchType (e) {
+ const type = e.target.dataset.sencetype
+ this.setData({
+ showingSence: type
+ })
+ },
+ emitAddMarkers () {
+ let {
+ addmarkers_clear,
+ booleanArray
+ } = this.data
+
+ addmarkers_clear = booleanArray[addmarkers_clear]
+
+ const marker = this.countMarker()
+
+ const params = {
+ markers: [marker]
+ }
+
+ addmarkers_clear !== 'no' && (params.clear = addmarkers_clear)
+
+ console.log('addMarkers 参数: ', params)
+
+ mapcontext.addMarkers(Object.assign({
+ success: (res) => {
+ console.log('debug: addMarkers succcess ', res)
+ },
+ fail: (res) => {
+ console.log('debug: addMarkers fail ', res)
+ },
+ complete: (res) => {
+ console.log('debug: addMarkers complete ', res)
+ }
+ }, params))
+ },
+ emitAddMarkers2 () {
+ let {
+ addmarkers_markers,
+ addmarkers_clear,
+ booleanArray
+ } = this.data
+
+ addmarkers_clear = booleanArray[addmarkers_clear]
+
+ try {
+ addmarkers_markers = JSON.parse(addmarkers_markers)
+ } catch(e) {}
+
+ const params = {}
+
+ addmarkers_markers !== 'no' && (params.markers = addmarkers_markers)
+ addmarkers_clear !== 'no' && (params.clear = addmarkers_clear)
+
+ console.log('addMarkers 参数: ', params)
+
+ mapcontext.addMarkers(Object.assign({
+ success: (res) => {
+ console.log('debug: addMarkers succcess ', res)
+ },
+ fail: (res) => {
+ console.log('debug: addMarkers fail ', res)
+ },
+ complete: (res) => {
+ console.log('debug: addMarkers complete ', res)
+ }
+ }, params))
+
+ },
+ emitFromScreenLocation () {
+ mapcontext.fromScreenLocation({
+ success: (res) => {
+ console.log('debug: fromScreenLocation succcess ', res)
+ },
+ fail: (res) => {
+ console.log('debug: fromScreenLocation fail ', res)
+ },
+ complete: (res) => {
+ console.log('debug: fromScreenLocation complete ', res)
+ }
+ })
+ },
+ emitGetCenterLocation () {
+ mapcontext.getCenterLocation({
+ iconPath: '/assets/images/logo.png',
+ success: (res) => {
+ console.log('debug: getCenterLocation succcess ', res)
+ },
+ fail: (res) => {
+ console.log('debug: getCenterLocation fail ', res)
+ },
+ complete: (res) => {
+ console.log('debug: getCenterLocation complete ', res)
+ }
+ })
+ },
+ emitApi (e) {
+ const apiname = e.target.dataset.apiname
+ mapcontext[apiname]({
+ success: (res) => {
+ console.log(`debug: ${apiname} succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: ${apiname} fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: ${apiname} complete `, res)
+ }
+ })
+ },
+ emitIncludePoints () {
+
+ let {
+ includePoints_points,
+ includePoints_padding
+ } = this.data
+
+ try {
+ includePoints_points = JSON.parse(includePoints_points)
+ includePoints_padding = JSON.parse(includePoints_padding)
+ } catch (e) {}
+
+ const params = {}
+
+ includePoints_points !== 'no' && (params.points = includePoints_points)
+ includePoints_padding !== 'no' && (params.padding = includePoints_padding)
+
+ console.log('includePoints 参数: ', params)
+
+ mapcontext.includePoints(Object.assign({
+ success: (res) => {
+ console.log(`debug: includePoints succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: includePoints fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: includePoints complete `, res)
+ }
+ }, params))
+ },
+ emitInitMarkerCluster () {
+
+ let {
+ initmarkercluster_enableDefaultStyle,
+ initmarkercluster_zoomOnClick,
+ initmarkercluster_gridSize,
+ booleanArray,
+ toNumber
+ } = this.data
+
+ initmarkercluster_enableDefaultStyle = booleanArray[initmarkercluster_enableDefaultStyle]
+ initmarkercluster_zoomOnClick = booleanArray[initmarkercluster_zoomOnClick]
+
+ const params = {}
+
+ initmarkercluster_enableDefaultStyle !== 'no' && (params.enableDefaultStyle = initmarkercluster_enableDefaultStyle)
+ initmarkercluster_zoomOnClick !== 'no' && (params.zoomOnClick = initmarkercluster_zoomOnClick)
+ initmarkercluster_gridSize !== 'no' && (params.gridSize = toNumber ? Number(initmarkercluster_gridSize) : String(initmarkercluster_gridSize))
+
+ console.log('initMarkerCluster 参数: ', params)
+
+ mapcontext.initMarkerCluster(Object.assign({
+ success: (res) => {
+ console.log(`debug: initMarkerCluster succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: initMarkerCluster fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: initMarkerCluster complete `, res)
+ }
+ }, params))
+ },
+ emitMoveAlong2 () {
+ let {
+ moveAlong2_path,
+ moveAlong2Markerid,
+ moveAlong2_autoRotate,
+ moveAlong2_duration,
+ booleanArray,
+ toNumber
+ } = this.data
+
+ moveAlong2_autoRotate = booleanArray[moveAlong2_autoRotate]
+
+ let path = moveAlong2_path
+ // if (moveAlong2_path === '{}') {
+ // path = {}
+ // } else if (moveAlong2_path === '[]') {
+ // path = []
+ // } else {
+ // try {
+ // path = moveAlong2_path.replace('[', '').replace(']', '').split('},').map(e => {
+ // const str = e.indexOf('}') > -1 ? e : (e + '}')
+ // return JSON.parse(str)
+ // })
+ // } catch (e) {}
+ // }
+ try {
+ path = JSON.parse(moveAlong2_path)
+ } catch (e) {}
+
+ try {
+ moveAlong2Markerid = JSON.parse(moveAlong2Markerid)
+ } catch(e) {
+ if (!isNaN(moveAlong2Markerid)) {
+ moveAlong2Markerid = toNumber ? Number(moveAlong2Markerid) : String(moveAlong2Markerid)
+ }
+ }
+
+ const params = {}
+ moveAlong2Markerid !== 'no' && (params.markerId = moveAlong2Markerid)
+ moveAlong2_autoRotate !== 'no' && (params.autoRotate = moveAlong2_autoRotate)
+ moveAlong2_duration !== 'no' && (params.duration = toNumber ? Number(moveAlong2_duration) : String(moveAlong2_duration))
+ moveAlong2_path !== 'no' && (params.path = path)
+
+ console.log('moveAlong 参数: ', params)
+
+ mapcontext.moveAlong(Object.assign({
+ success: (res) => {
+ console.log(`debug: moveAlong succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: moveAlong fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: moveAlong complete `, res)
+ }
+ }, params))
+ },
+ emitMoveAlong () {
+ let {
+ moveAlong_path,
+ moveAlongMarkerid,
+ moveAlong_autoRotate,
+ moveAlong_duration,
+ booleanArray,
+ toNumber
+ } = this.data
+
+ moveAlong_autoRotate = booleanArray[moveAlong_autoRotate]
+
+ let path = moveAlong_path
+ // if (moveAlong_path === '{}') {
+ // path = {}
+ // } else if (moveAlong_path === '[]') {
+ // path = []
+ // } else {
+ // try {
+ // path = moveAlong_path.replace('[', '').replace(']', '').split('},').map(e => {
+ // const str = e.indexOf('}') > -1 ? e : (e + '}')
+ // return JSON.parse(str)
+ // })
+ // } catch (e) {}
+ // }
+
+ try {
+ path = JSON.parse(moveAlong_path)
+ } catch (e) {}
+
+ try {
+ moveAlongMarkerid = JSON.parse(moveAlongMarkerid)
+ } catch (e) {
+ if (!isNaN(moveAlongMarkerid)) {
+ moveAlongMarkerid = toNumber ? Number(moveAlongMarkerid) : String(moveAlongMarkerid)
+ }
+ }
+
+ const params = {}
+ moveAlongMarkerid !== 'no' && (params.markerId = moveAlongMarkerid)
+ moveAlong_autoRotate !== 'no' && (params.autoRotate = moveAlong_autoRotate)
+ moveAlong_duration !== 'no' && (params.duration = toNumber ? Number(moveAlong_duration) : String(moveAlong_duration))
+ moveAlong_path !== 'no' && (params.path = path)
+
+ console.log('moveAlong 参数: ', params)
+
+ mapcontext.moveAlong(Object.assign({
+ success: (res) => {
+ console.log(`debug: moveAlong succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: moveAlong fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: moveAlong complete `, res)
+ }
+ }, params))
+ },
+ emitMoveToLocation () {
+ let {
+ movetolocation_longitude,
+ movetolocation_latitude,
+ toNumber
+ } = this.data
+ const params = {}
+
+ movetolocation_longitude !== 'no' && (params.longitude = toNumber ? Number(movetolocation_longitude) : String(movetolocation_longitude))
+ movetolocation_latitude !== 'no' && (params.latitude = toNumber ? Number(movetolocation_latitude) : String(movetolocation_latitude))
+
+ console.log('moveToLocation 参数: ', params)
+
+ mapcontext.moveToLocation(Object.assign({
+ success: (res) => {
+ console.log(`debug: moveToLocation succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: moveToLocation fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: moveToLocation complete `, res)
+ }
+ }, params))
+ },
+ emitOn () {
+ mapcontext.on('markerClusterCreate', (res) => {
+ console.log('debug: mapcontext.on markerClusterCreate ',res)
+ })
+ mapcontext.on('markerClusterClick', (res) => {
+ console.log('debug: mapcontext.on markerClusterClick ',res)
+ })
+ },
+ emitOpenMapApp () {
+ let {
+ openmapapp_longitude,
+ openmapapp_latitude,
+ openmapapp_destination,
+ toNumber
+ } = this.data
+ const params = {}
+
+ openmapapp_longitude !== 'no' && (params.longitude = toNumber ? Number(openmapapp_longitude) : String(openmapapp_longitude))
+ openmapapp_latitude !== 'no' && (params.latitude = toNumber ? Number(openmapapp_latitude) : String(openmapapp_latitude))
+ openmapapp_destination !== 'no' && (params.destination = openmapapp_destination)
+
+ console.log('openMapApp 参数: ', params)
+
+ mapcontext.openMapApp(Object.assign({
+ success: (res) => {
+ console.log(`debug: openMapApp succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: openMapApp fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: openMapApp complete `, res)
+ }
+ }, params))
+ },
+ emitRemoveMarkers () {
+ let { removemarker_markerIds } = this.data
+ try {
+ removemarker_markerIds = JSON.parse(removemarker_markerIds)
+ } catch (e) {}
+
+ const params = {}
+
+ removemarker_markerIds !== 'no' && (params.markerIds = removemarker_markerIds)
+
+ console.log('removeMarkers 参数: ', params)
+
+ mapcontext.removeMarkers(Object.assign({
+ success: (res) => {
+ console.log(`debug: removeMarkers succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: removeMarkers fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: removeMarkers complete `, res)
+ }
+ }, params))
+ },
+ emitSetCenterOffset () {
+ const params = {}
+ let { centerOffset } = this.data
+ try {
+ centerOffset = JSON.parse(centerOffset)
+ } catch (e) {}
+ centerOffset !== 'no' && (params.offset = centerOffset)
+ console.log('setCenterOffset 参数: ', params)
+ mapcontext.setCenterOffset(Object.assign({
+ success: (res) => {
+ console.log(`debug: setCenterOffset succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: setCenterOffset fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: setCenterOffset complete `, res)
+ }
+ }, params))
+ },
+ emitSetLocMarkerIcon () {
+ const params = {}
+ this.data.markerIconPath !== 'no' && (params.iconPath = this.data.markerIconPath)
+ console.log('setLocMarkerIcon 参数: ', params)
+ mapcontext.setLocMarkerIcon({
+ iconPath: '/assets/images/logo.png',
+ success: (res) => {
+ console.log(`debug: setLocMarkerIcon succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: setLocMarkerIcon fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: setLocMarkerIcon complete `, res)
+ }
+ })
+ },
+ emitTranslateMarker ({nodest}) {
+ let {
+ translatemarkerMarkerid,
+ translatemarker_marker_autoRotate,
+ translatemarker_rotate,
+ translatemarker_duration,
+ translatemarker_marker_moveWithRotate,
+ translatemarker_destination,
+ booleanArray,
+ toNumber
+ } = this.data
+ translatemarker_marker_autoRotate = booleanArray[translatemarker_marker_autoRotate]
+ translatemarker_marker_moveWithRotate = booleanArray[translatemarker_marker_moveWithRotate]
+ let destination = translatemarker_destination
+ if (translatemarker_destination === 'null') {
+ destination = null
+ } else if (translatemarker_destination === '[]') {
+ destination = []
+ } else {
+ try {
+ destination = JSON.parse(translatemarker_destination)
+ } catch (e) {}
+ }
+ try {
+ translatemarkerMarkerid = JSON.parse(translatemarkerMarkerid)
+ } catch(e) {
+ if (!isNaN(translatemarkerMarkerid)) {
+ translatemarkerMarkerid = toNumber ? Number(translatemarkerMarkerid) : String(translatemarkerMarkerid)
+ }
+ }
+ const params = {}
+ translatemarkerMarkerid !== 'no' && (params.markerId = translatemarkerMarkerid)
+ translatemarker_marker_autoRotate !== 'no' && (params.autoRotate = translatemarker_marker_autoRotate)
+ translatemarker_rotate !== 'no' && (params.rotate = toNumber ? Number(translatemarker_rotate) : String(translatemarker_rotate))
+ translatemarker_duration !== 'no' && (params.duration = toNumber ? Number(translatemarker_duration) : String(translatemarker_duration))
+ translatemarker_marker_moveWithRotate !== 'no' && (params.moveWithRotate = translatemarker_marker_moveWithRotate)
+ destination !== 'no' && (params.destination = destination)
+ console.log('translateMarker 参数: ', params)
+ mapcontext.translateMarker(Object.assign({
+ animationEnd: (res) => {
+ console.log(`debug: translateMarker animationEnd `, res)
+ },
+ success: (res) => {
+ console.log(`debug: translateMarker succcess `, res)
+ },
+ fail: (res) => {
+ console.log(`debug: translateMarker fail `, res)
+ },
+ complete: (res) => {
+ console.log(`debug: translateMarker complete `, res)
+ }
+ }, params))
+ },
+ goBack () {
+ wx.redirectTo({
+ url: '/pages/jumppage/index',
+ })
+ },
+ latlongChange (e) {
+ // const {toNumber} = this.data
+ let latlong = e.detail.value
+ try {
+ if (latlong === '') {
+ latlong = ['','']
+ } else if (latlong === 'null') {
+ latlong = [null, null]
+ } else {
+ latlong = JSON.parse(e.detail.value)
+ }
+ } catch (e) {
+ latlong = [latlong, null]
+ }
+ console.log(latlong)
+ // const latitude = toNumber ? Number(latlong[0]) : String(latlong[0])
+ // const longitude = toNumber ? Number(latlong[1]) : String(latlong[1])
+ const latitude = latlong[0]
+ const longitude = latlong[1]
+ console.log(`改变latitude、longitude : ` )
+ console.log(latitude, longitude)
+ this.setData({
+ latitude,
+ longitude
+ })
+ },
+ chooseLocalImage () {
+ wx.chooseImage({
+ count: 1,
+ success: (res) => {
+ console.log(res)
+ this.setData({
+ markerIconPath: res.tempFilePaths[0],
+ controls_iconPath: res.tempFilePaths[0],
+ polyline_arrowIconPath: res.tempFilePaths[0],
+ markers_iconPath: res.tempFilePaths[0]
+ })
+ }
+ })
+ },
+ getstorepath () {
+ wx.saveFile({
+ tempFilePath: this.data.markerIconPath,
+ success: (res) => {
+ console.log(res)
+ this.setData({
+ markerIconPath: res.savedFilePath,
+ controls_iconPath: res.savedFilePath,
+ polyline_arrowIconPath: res.savedFilePath,
+ markers_iconPath: res.savedFilePath
+ })
+ }
+ })
+ },
+ getusrpath () {
+ wx.getFileSystemManager().saveFile({
+ tempFilePath: this.data.markerIconPath,
+ filePath: `${wx.env.USER_DATA_PATH}/markericon/test.jpg`,
+ success: (res) => {
+ console.log(res)
+ this.setData({
+ markerIconPath: res.savedFilePath,
+ controls_iconPath: res.savedFilePath,
+ polyline_arrowIconPath: res.savedFilePath,
+ markers_iconPath: res.savedFilePath
+ })
+ },
+ complete: (res) => {
+ console.log(res)
+ }
+ })
+ },
+ attributeKeyChange (e) {
+ const { toNumber } = this.data
+ const { attribute, defaultnum, orginalattribute } = e.target.dataset
+ let value = e.detail.value
+ const orginalval = e.detail.value
+ try {
+ value = JSON.parse(value)
+ } catch (e) {
+ if (defaultnum) {
+ value = toNumber ? (isNaN(value) ? value : Number(value)) : String(value)
+ }
+ }
+ if (typeof value === 'number' && !toNumber) {
+ value = String(value)
+ }
+ const obj = {}
+ obj[attribute] = value
+ orginalattribute && (obj[orginalattribute] = orginalval)
+ console.log('改变的属性: ', obj)
+ this.setData(obj)
+ },
+ showMap () {
+ this.setData({
+ mapShow: !this.data.mapShow
+ })
+ },
+ emitchooseLocation () {
+ wx.chooseLocation({
+ longitude: '85.1318117790985',
+ latitude: '45.69139458288415',
+ complete (res) {
+ console.log('chooseLocation complete ', res)
+ }
+ })
+ },
+ emitinvokeMapTask: function () {
+ wx.invokeMapTask({
+ complete: (res) => {
+ console.log(res)
+ }
+ })
+ },
+ emitchooseimage () {
+ wx.chooseImage({
+ count: 3,
+ // sizeType: 'original',
+ sourceType: ['album', 'camera'],
+ complete: function complete(res) {
+ console.log(res)
+ }
+ })
+ },
+ goPage () {
+ wx.navigateTo({
+ url: '/pages/mapmultiple/mapmultiple'
+ })
+ },
+ testundefined () {
+ this.setData({
+ latitude: undefined
+ })
+ }
+})
\ No newline at end of file
diff --git a/pages/component/map/map.json b/pages/component/map/map.json
new file mode 100644
index 0000000..50907b6
--- /dev/null
+++ b/pages/component/map/map.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {},
+ "enablePullDownRefresh": false,
+ "navigationBarTitleText": "map组件用例"
+}
\ No newline at end of file
diff --git a/pages/component/map/map.wxml b/pages/component/map/map.wxml
new file mode 100644
index 0000000..2e56da8
--- /dev/null
+++ b/pages/component/map/map.wxml
@@ -0,0 +1,1061 @@
+
+
+
+
+
+ 经纬、缩放、角度
+
+
+ 图形、线条
+
+
+ 控制属性
+
+
+ markers
+
+
+ 其他参数及api
+
+
+
+
+
+ 数字类型: {{toNumber}}
+
+
+
+
+
+
+
+
+
+ 选择maptype: {{maptypes[maptype]}}
+
+
+
+
+
+
+ latitude : {{latitude}}
+
+
+
+
+
+
+
+ longitude : {{longitude}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ markerIconPath: (输入no不传)
+
+
+
+
+ 说明:赋值no不传参
+
+ 经度:
+
+
+ 纬度:
+
+
+
+
+ 说明:支持对象、数字、字符串、数字
+
+ scale:
+
+
+
+ minScale:
+
+
+
+ maxScale:
+
+
+
+
+
+
+
+
+
+
+
+ centerOffset:
+ offset 说明:赋值no不传参; 按照json格式解析
+
+
+
+
+
+ rotate:{{rotate}}
+ 说明:支持对象、数字、字符串、数字
+
+
+
+
+
+
+ skew:
+
+
+
+
+
+
+
+
+
+
+
+ controls:
+
+ id:
+ 说明:赋值no不传参
+
+
+
+ position
+
+ 说明: 赋值no不传参; {} => {} ; [] => [] ; '' => '' ; null => null
+
+
+
+
+ iconPath:
+ 说明:赋值no不传参 ; 测试其他路径可以点击上方按钮【获取tmp地址】
+
+
+
+ clickable
+
+
+ 点击选择(选no不传) -> {{booleanArray[controls_clickable]}}
+
+
+
+
+
+
+
+ controls:
+
+ 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+
+
+ polyline:
+
+
+ points: 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+
+ color:
+ 说明:赋值no不传参
+
+
+
+ colorList:
+ 说明:赋值no不传参
+
+
+
+ dottedLine
+
+
+ 点击选择(选no不传) -> {{booleanArray[polyline_dottedLine]}}
+
+
+
+
+ arrowIconPath:
+ 说明:赋值no不传参 ; 可以点击上方按钮【获取tmp地址】
+
+
+
+ width:
+ 说明:赋值no不传参
+
+
+
+ arrowLine
+
+
+ 点击选择(选no不传) -> {{booleanArray[polyline_arrowLine]}}
+
+
+
+
+ borderColor:
+ 说明:赋值no不传参
+
+
+
+ borderWidth:
+ 说明:赋值no不传参
+
+
+
+ level:
+ 说明:赋值no不传参
+
+
+
+
+
+ polyline:
+
+ 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+
+
+ circles:
+
+ latitude:
+ 说明:赋值no不传参
+
+
+
+ longitude:
+ 说明:赋值no不传参
+
+
+
+ color:
+ 说明:赋值no不传参
+
+
+
+ fillColor:
+ 说明:赋值no不传参
+
+
+
+ radius:
+ 说明:赋值no不传参
+
+
+
+ strokeWidth:
+ 说明:赋值no不传参
+
+
+
+ level:
+ 说明:赋值no不传参
+
+
+
+
+
+ circles:
+
+ 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+
+
+ polygons:
+
+ points:
+ 说明:赋值no不传参
+
+
+
+ strokeWidth:
+ 说明:赋值no不传参
+
+
+
+ strokeColor:
+ 说明:赋值no不传参
+
+
+
+ fillColor:
+ 说明:赋值no不传参
+
+
+
+ zIndex:
+ 说明:赋值no不传参
+
+
+
+ level:
+ 说明:赋值no不传参
+
+
+
+
+
+ polygons:
+
+ 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+
+
+
+
+
+
+
+ show-location: {{showLocation}}
+
+
+
+
+ enableZoom: {{enableZoom}}
+
+
+
+
+
+
+ enableRotate: {{enableRotate}}
+
+
+
+ enable3D: {{enable3D}}
+
+
+
+ showCompass: {{showCompass}}
+
+
+
+ showScale: {{showScale}}
+
+
+
+ enableOverlooking: {{enableOverlooking}}
+
+
+
+ enableScroll: {{enableScroll}}
+
+
+
+ enableSatellite: {{enableSatellite}}
+
+
+
+ enableTraffic: {{enableTraffic}}
+
+
+
+ enablePoi: {{enablePoi}}
+
+
+
+ enableBuilding: {{enableBuilding}}
+
+
+
+
+
+
+
+
+
+ markerId:
+ 说明:赋值no不传参
+
+
+
+ autoRotate:
+
+
+ 点击选择(选no不传) -> {{booleanArray[translatemarker_marker_autoRotate]}}
+
+
+
+
+ rotate:
+ 说明:赋值no不传参
+
+
+
+ duration:
+ 说明:赋值no不传参
+
+
+
+ moveWithRotate:
+
+
+ 点击选择(选no不传) -> {{booleanArray[translatemarker_marker_moveWithRotate]}}
+
+
+
+
+ destination:
+
+
+ 说明:赋值no不传参
+
+
+
+
+
+ moveAlong1
+
+ markerId:
+ 说明:赋值no不传参
+
+
+
+ autoRotate:
+
+
+ 点击选择(选no不传) -> {{booleanArray[moveAlong_autoRotate]}}
+
+
+
+
+ duration:
+ 说明:赋值no不传参
+
+
+
+ path:
+
+
+ 说明: {} => {} ; [] => [] ; '' => '' ; null => null
+
+
+
+
+
+ moveAlong2
+
+ markerId2:
+ 说明:赋值no不传参
+
+
+
+ autoRotate2:
+
+
+ 点击选择(选no不传) -> {{booleanArray[moveAlong2_autoRotate]}}
+
+
+
+
+ duration2:
+ 说明:赋值no不传参
+
+
+
+ path2:
+
+
+ 说明: {} => {} ; [] => [] ; '' => '' ; null => null
+
+
+
+
+
+ markers:
+
+ id:
+ 说明:赋值no不传参
+
+
+
+ latitude:
+ 说明:赋值no不传参
+
+
+
+ longitude:
+ 说明:赋值no不传参
+
+
+
+ joinCluster: {{markers_joinCluster}}
+
+
+ 点击选择(选no不传) -> {{booleanArray[markers_joinCluster]}}
+
+
+
+
+ title:
+ 说明:赋值no不传参
+
+
+
+ zIndex:
+ 说明:赋值no不传参
+
+
+
+ iconPath:
+ 说明:赋值no不传参 ; 可点击[获取tmp地址]
+
+
+
+ rotate:
+ 说明:赋值no不传参
+
+
+
+ alpha:
+ 说明:赋值no不传参
+
+
+
+ width:
+ 说明:赋值no不传参
+
+
+
+ height:
+ 说明:赋值no不传参
+
+
+
+ callout:
+ 说明:赋值no不传参
+
+
+
+ customCallout:
+ 说明:赋值no不传参
+
+
+
+ label:
+ 说明:赋值no不传参
+
+
+
+ anchor:
+ 说明:赋值no不传参
+
+
+
+ aria-label:
+ 说明:赋值no不传参
+
+
+
+
+ addmarkers-clear: {{addmarkers_clear}}
+
+
+ 点击选择(选no不传) -> {{booleanArray[addmarkers_clear]}}
+
+
+
+
+
+
+ addmarkers:
+
+ 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+ addmarkers-clear: {{addmarkers_clear}}
+
+
+ 点击选择(选no不传) -> {{booleanArray[addmarkers_clear]}}
+
+
+
+
+
+
+ markers:
+
+ 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+
+
+ removeMarkers:
+
+ markerIds:
+ 说明:赋值no不传参
+
+
+
+
+
+ initMarkerCluster:
+
+ enableDefaultStyle: {{initmarkercluster_enableDefaultStyle}}
+
+
+ 点击选择(选no不传) -> {{booleanArray[initmarkercluster_enableDefaultStyle]}}
+
+
+
+
+ zoomOnClick: {{initmarkercluster_zoomOnClick}}
+
+
+ 点击选择(选no不传) -> {{booleanArray[initmarkercluster_zoomOnClick]}}
+
+
+
+
+ gridSize: {{initmarkercluster_gridSize}}
+
+
+
+
+
+
+
+
+
+
+ includePoints:
+
+ 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+
+
+ includePoints:
+
+ points:
+ 说明:赋值no不传参
+
+
+
+ padding:
+ 说明:赋值no不传参
+
+
+
+
+
+
+ 经度:
+
+
+ 纬度:
+
+
+ 目的地:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setting:
+
+ 说明:可验证字符串、数组、对象类型
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/component/map/map.wxss b/pages/component/map/map.wxss
new file mode 100644
index 0000000..1826715
--- /dev/null
+++ b/pages/component/map/map.wxss
@@ -0,0 +1,58 @@
+.my-map{
+ width: 100%;
+ height: 200px;
+}
+.change-item{
+ display: flex;
+ border-bottom: 1px solid #4caf50;
+ padding: 5px;
+}
+.change-item2{
+ padding: 5px;
+ border-bottom: 1px solid #4caf50;
+}
+.change-input{
+ border: 1px solid #03e3ff;
+ display: inline-block;
+ border-radius: 5px;
+ width: 100%;
+}
+.label{
+ margin-right: 5px;
+ font-size: 40rpx;
+ color: deeppink;
+}
+.tabs{
+ display: flex;
+ white-space: nowrap;
+}
+.tab{
+ /* border: 1px solid #4caf50; */
+ margin: 5px;
+ border-radius: 5px;
+ padding: 5px;
+ border: 1px solid #3875FF;
+ color: #3875FF;
+ width: auto;
+ display: inline-block;
+}
+.tab.choosen{
+ background: #3875FF;
+ color: #ffffff;
+}
+.btn{
+ width: 100%!important;
+}
+scroll-view{
+ padding-bottom: 100rpx;
+}
+.my-picker{
+ color: #795548;
+ font-weight: 500;
+ font-size: 18px;
+}
+
+.callout1{
+ background-color: #03e3ff;
+ color: #ffffff;
+}
\ No newline at end of file
diff --git a/pages/component/multiple-map/multiple-map.js b/pages/component/multiple-map/multiple-map.js
new file mode 100644
index 0000000..42098fc
--- /dev/null
+++ b/pages/component/multiple-map/multiple-map.js
@@ -0,0 +1,111 @@
+// pages/mapmultiple/mapmultiple.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ no1: null,
+ no2: null,
+ no3: null,
+ non4: null
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ const no1 = wx.createMapContext('abcdef1')
+ const no2 = wx.createMapContext('abcdef2')
+ const no3 = wx.createMapContext('abcdef3')
+ const no4 = wx.createMapContext('abcdef4')
+ this.setData({
+ no1,
+ no2,
+ no3,
+ no4
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+ emitaddmarkers (e) {
+ console.log(e.target.dataset.mapid)
+ const mapcontext = this.data[`no${e.target.dataset.mapid}`]
+ mapcontext.getCenterLocation({
+ complete:(res) => {
+ console.log(res)
+ const { latitude, longitude } = res
+ mapcontext.addMarkers({
+ markers: [{
+ latitude, longitude
+ }],
+ complete: (res)=> {
+ console.log('addMarkers complete: ',res)
+ }
+ })
+ }
+ })
+ },
+ emitgetcenterlocation(e) {
+ const mapcontext = this.data[`no${e.target.dataset.mapid}`]
+ mapcontext.getCenterLocation({
+ iconPath: '/assets/images/logo.png',
+ success: (res) => {
+ console.log('debug: getCenterLocation succcess ', res)
+ },
+ fail: (res) => {
+ console.log('debug: getCenterLocation fail ', res)
+ },
+ complete: (res) => {
+ console.log('debug: getCenterLocation complete ', res)
+ }
+ })
+ }
+})
\ No newline at end of file
diff --git a/pages/component/multiple-map/multiple-map.json b/pages/component/multiple-map/multiple-map.json
new file mode 100644
index 0000000..ca19edd
--- /dev/null
+++ b/pages/component/multiple-map/multiple-map.json
@@ -0,0 +1,4 @@
+{
+ "usingComponents": {},
+ "navigationBarTitleText": "multiple map"
+}
\ No newline at end of file
diff --git a/pages/component/multiple-map/multiple-map.wxml b/pages/component/multiple-map/multiple-map.wxml
new file mode 100644
index 0000000..1cab57e
--- /dev/null
+++ b/pages/component/multiple-map/multiple-map.wxml
@@ -0,0 +1,24 @@
+
+
+ 地图1 id: abcdef1
+
+
+
+ 地图2 id: abcdef2 (只传latitude)
+
+
+
+ 地图3 id: abcdef3 (只传longitude)
+
+
+
+ 地图4 id: abcdef4
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/component/multiple-map/multiple-map.wxss b/pages/component/multiple-map/multiple-map.wxss
new file mode 100644
index 0000000..383884e
--- /dev/null
+++ b/pages/component/multiple-map/multiple-map.wxss
@@ -0,0 +1 @@
+/* pages/mapmultiple/mapmultiple.wxss */
\ No newline at end of file
diff --git a/pages/component/page-container/page-container.js b/pages/component/page-container/page-container.js
new file mode 100644
index 0000000..3bde8e9
--- /dev/null
+++ b/pages/component/page-container/page-container.js
@@ -0,0 +1,96 @@
+const app = getApp()
+
+Page({
+ data: {
+ show: false,
+ duration: 300,
+ position: 'right',
+ round: false,
+ overlay: false,
+ customStyle: '',
+ overlayStyle: '',
+ },
+ onLoad: function () {
+
+ },
+ onShow() {
+
+ },
+
+ popup(e) {
+ const position = e.currentTarget.dataset.position
+ let customStyle = ''
+ let duration = this.data.duration
+ switch(position) {
+ case 'top':
+ case 'bottom':
+ customStyle = 'height: 30%;'
+ break
+ case 'right':
+ break
+ }
+ this.setData({
+ position,
+ show: true,
+ customStyle,
+ duration
+ })
+ },
+
+ changeRound() {
+ this.setData({round: !this.data.round})
+ },
+
+ changeOverlay() {
+ this.setData({overlay: !this.data.overlay, show: true})
+ },
+
+ changeOverlayStyle(e) {
+ let overlayStyle = ''
+ const type = e.currentTarget.dataset.type
+ switch(type) {
+ case 'black':
+ overlayStyle = 'background-color: rgba(0, 0, 0, 0.7)'
+ break
+ case 'white':
+ overlayStyle = 'background-color: rgba(255, 255, 255, 0.7)'
+ break
+ case 'blur':
+ overlayStyle = 'background-color: rgba(0, 0, 0, 0.7); filter: blur(4px);'
+ }
+ this.setData({overlayStyle, show: true})
+
+ },
+
+ exit() {
+ // this.setData({show: false})
+ wx.navigateBack()
+ },
+
+ goTo(e) {
+ wx.navigateTo({url: `../shareElement/index`})
+ },
+
+ onBeforeEnter(res) {
+ console.log(res)
+ },
+ onEnter(res) {
+ console.log(res)
+ },
+ onAfterEnter(res) {
+ console.log(res)
+ },
+ onBeforeLeave(res) {
+ console.log(res)
+ },
+ onLeave(res) {
+ console.log(res)
+ },
+ onAfterLeave(res) {
+ console.log(res)
+ },
+
+ onClickOverlay(res) {
+ console.log(res)
+ }
+})
diff --git a/pages/component/page-container/page-container.json b/pages/component/page-container/page-container.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/pages/component/page-container/page-container.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/component/page-container/page-container.wxml b/pages/component/page-container/page-container.wxml
new file mode 100644
index 0000000..1ba122b
--- /dev/null
+++ b/pages/component/page-container/page-container.wxml
@@ -0,0 +1,48 @@
+
+
+ 弹出位置
+
+
+
+
+
+
+
+
+弹窗圆角
+
+
+
+
+遮罩层
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/component/page-container/page-container.wxss b/pages/component/page-container/page-container.wxss
new file mode 100644
index 0000000..ebf8a27
--- /dev/null
+++ b/pages/component/page-container/page-container.wxss
@@ -0,0 +1,36 @@
+page {
+ background-color: #ee5509;
+ color: #323232;
+ width: 100%;
+ height: 100%;
+}
+
+.box {
+ margin: 0 12px;
+}
+
+.title {
+ margin: 0;
+ padding: 32px 16px 16px;
+ color: rgba(69, 90, 100, 0.6);
+ font-weight: normal;
+ font-size: 18px;
+ line-height: 20px;
+ text-align: center;
+}
+
+.btn {
+ display: block;
+ width: 100%;
+ margin: 10px 0;
+ background-color: #fff;
+}
+
+.detail-page {
+ width: 100%;
+ height: 100%;
+ min-height: 300px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
diff --git a/pages/component/resources/kind/canvas.png b/pages/component/resources/kind/canvas.png
index 21b38cb..19fcf6a 100644
Binary files a/pages/component/resources/kind/canvas.png and b/pages/component/resources/kind/canvas.png differ
diff --git a/pages/component/resources/kind/content.png b/pages/component/resources/kind/content.png
index 817fa69..cc521b5 100644
Binary files a/pages/component/resources/kind/content.png and b/pages/component/resources/kind/content.png differ
diff --git a/pages/component/resources/kind/daytime.png b/pages/component/resources/kind/daytime.png
index 07ec1f6..1bfb9d8 100644
Binary files a/pages/component/resources/kind/daytime.png and b/pages/component/resources/kind/daytime.png differ
diff --git a/pages/component/resources/kind/form.png b/pages/component/resources/kind/form.png
index a47bd24..c0d8f06 100644
Binary files a/pages/component/resources/kind/form.png and b/pages/component/resources/kind/form.png differ
diff --git a/pages/component/resources/kind/logo.png b/pages/component/resources/kind/logo.png
index c778660..7e8548b 100644
Binary files a/pages/component/resources/kind/logo.png and b/pages/component/resources/kind/logo.png differ
diff --git a/pages/component/resources/kind/media.png b/pages/component/resources/kind/media.png
index 62e54cd..8405c61 100644
Binary files a/pages/component/resources/kind/media.png and b/pages/component/resources/kind/media.png differ
diff --git a/pages/component/resources/kind/nav.png b/pages/component/resources/kind/nav.png
index 24e15b3..c2a38ba 100644
Binary files a/pages/component/resources/kind/nav.png and b/pages/component/resources/kind/nav.png differ
diff --git a/pages/component/resources/kind/night.png b/pages/component/resources/kind/night.png
index 0b86ac1..7797eeb 100644
Binary files a/pages/component/resources/kind/night.png and b/pages/component/resources/kind/night.png differ
diff --git a/pages/component/resources/kind/obstacle-free.png b/pages/component/resources/kind/obstacle-free.png
index 7e7e843..3ce0494 100644
Binary files a/pages/component/resources/kind/obstacle-free.png and b/pages/component/resources/kind/obstacle-free.png differ
diff --git a/pages/component/resources/kind/open.png b/pages/component/resources/kind/open.png
index 157edd7..9f39a20 100644
Binary files a/pages/component/resources/kind/open.png and b/pages/component/resources/kind/open.png differ
diff --git a/pages/component/resources/kind/view.png b/pages/component/resources/kind/view.png
index 03c9003..094680c 100644
Binary files a/pages/component/resources/kind/view.png and b/pages/component/resources/kind/view.png differ
diff --git a/pages/component/resources/pic/1.jpg b/pages/component/resources/pic/1.jpg
index 614071b..b0ed6e9 100644
Binary files a/pages/component/resources/pic/1.jpg and b/pages/component/resources/pic/1.jpg differ
diff --git a/pages/component/resources/pic/2.jpg b/pages/component/resources/pic/2.jpg
index 478fb49..082ddf3 100644
Binary files a/pages/component/resources/pic/2.jpg and b/pages/component/resources/pic/2.jpg differ
diff --git a/pages/component/resources/pic/custom_map_template_1.png b/pages/component/resources/pic/custom_map_template_1.png
index b7abbb4..96bdf40 100644
Binary files a/pages/component/resources/pic/custom_map_template_1.png and b/pages/component/resources/pic/custom_map_template_1.png differ
diff --git a/pages/component/resources/pic/custom_map_template_2.png b/pages/component/resources/pic/custom_map_template_2.png
index b676d22..03f6306 100644
Binary files a/pages/component/resources/pic/custom_map_template_2.png and b/pages/component/resources/pic/custom_map_template_2.png differ
diff --git a/pages/component/resources/pic/custom_map_template_3.png b/pages/component/resources/pic/custom_map_template_3.png
index a408377..88713f9 100644
Binary files a/pages/component/resources/pic/custom_map_template_3.png and b/pages/component/resources/pic/custom_map_template_3.png differ
diff --git a/pages/component/resources/pic/custom_map_template_4.png b/pages/component/resources/pic/custom_map_template_4.png
index abfa874..b8bbb37 100644
Binary files a/pages/component/resources/pic/custom_map_template_4.png and b/pages/component/resources/pic/custom_map_template_4.png differ
diff --git a/pages/component/share-element/share-element.js b/pages/component/share-element/share-element.js
new file mode 100644
index 0000000..9e61e7d
--- /dev/null
+++ b/pages/component/share-element/share-element.js
@@ -0,0 +1,115 @@
+const contacts = [
+ { id: 1, name: 'Frank', img: 'frank.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
+ { id: 2, name: 'Susan', img: 'susan.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
+ { id: 3, name: 'Emma', img: 'emma.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
+ { id: 4, name: 'Scott', img: 'scott.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
+ { id: 5, name: 'Bob', img: 'bob.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
+ { id: 6, name: 'Olivia', img: 'olivia.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
+ { id: 7, name: 'Anne', img: 'anne.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' },
+ { id: 8, name: 'sunny', img: 'olivia.png', phone: '0101 123456', mobile: '0770 123456', email: 'frank@emailionicsorter.com' }
+]
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ contacts,
+ contact: contacts[0],
+ transformIdx: 0,
+ position: 'center',
+ duration: 300,
+ show: false,
+ overlay: false
+ },
+
+ showNext(e) {
+ const idx = e.currentTarget.dataset.idx
+ this.setData({
+ show: true,
+ contact: contacts[idx],
+ transformIdx: idx
+ })
+ },
+
+ showPrev() {
+ this.setData({
+ show: false
+ })
+ },
+
+ onBeforeEnter(res) {
+ console.log(res)
+ },
+ onEnter(res) {
+ console.log(res)
+ },
+ onAfterEnter(res) {
+ console.log(res)
+ },
+ onBeforeLeave(res) {
+ console.log(res)
+ },
+ onLeave(res) {
+ console.log(res)
+ },
+ onAfterLeave(res) {
+ console.log(res)
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ 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/component/share-element/share-element.json b/pages/component/share-element/share-element.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/pages/component/share-element/share-element.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/component/share-element/share-element.wxml b/pages/component/share-element/share-element.wxml
new file mode 100644
index 0000000..4f03043
--- /dev/null
+++ b/pages/component/share-element/share-element.wxml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+ {{contact.name}}
+
+
+ Phone: {{contact.phone}}
+ Mobile: {{contact.mobile}}
+ Email: {{contact.email}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{contact.name}}
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus nisl enim, sodales non augue efficitur, sagittis
+ varius neque. Fusce dolor turpis, maximus eu volutpat quis, pellentesque et ligula. Ut vehicula metus in nibh
+ mollis ornare. Etiam aliquam lacinia malesuada. Vestibulum dignissim mollis quam a tristique. Maecenas neque
+ mauris, malesuada vitae magna eu, congue consectetur risus. Etiam vitae pulvinar ex. Maecenas suscipit mi ac
+ imperdiet pretium. Aliquam velit mauris, euismod quis elementum sed, malesuada non dui. Nunc rutrum sagittis
+ ligula in dapibus. Cras suscipit ut augue eget mollis. Donec auctor feugiat ipsum id viverra. Vestibulum eu nisi
+ risus. Vestibulum eleifend dignissim.
+
+
+
+
+
+
+
diff --git a/pages/component/share-element/share-element.wxss b/pages/component/share-element/share-element.wxss
new file mode 100644
index 0000000..a1c2575
--- /dev/null
+++ b/pages/component/share-element/share-element.wxss
@@ -0,0 +1,85 @@
+/* app css stylesheet */
+
+page {
+ color: #333;
+ background-color: #ddd;
+ overflow: hidden;
+}
+
+button {
+ border: 0 solid #0010ae;
+ background-color: #1f2afe;
+ color: #fff;
+ font-size: 120%;
+ padding: 8px 16px;
+ outline-width: 0;
+ -webkit-appearance: none;
+ box-shadow: 0 8px 17px rgba(0, 0, 0, 0.2);
+}
+
+.screen {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ padding: 16px;
+ -webkit-overflow-scrolling: touch;
+}
+
+.contact {
+ position: relative;
+ padding: 16px;
+ background-color: #fff;
+ width: 100%;
+ height: 100%;
+ box-sizing: border-box;
+}
+
+.avatar {
+ position: absolute;
+ top: 16px;
+ left: 16px;
+ font-size: 0;
+}
+
+.name {
+ height: 65px;
+ font-size: 2em;
+ font-weight: bold;
+ text-align: center;
+ margin-left: 30%;
+}
+
+.list {
+ padding-top: 8px;
+ padding-left: 32px;
+}
+
+.screen1 {
+ overflow-y: scroll;
+ padding: 0;
+}
+
+.screen1 .contact {
+ margin: 16px;
+ height: auto;
+ width: auto;
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.2);
+}
+
+.screen2-button {
+ display: block;
+ margin: 24px auto;
+}
+
+.paragraph {
+ -webkit-transition: transform ease-in-out 300ms;
+ transition: transform ease-in-out 300ms;
+ -webkit-transform: scale(0.6);
+ transform: scale(0.6);
+}
+
+.enter.paragraph {
+ transform: none;
+}
\ No newline at end of file
diff --git a/pages/component/webrtc/webrtc.js b/pages/component/webrtc/webrtc.js
new file mode 100644
index 0000000..427351a
--- /dev/null
+++ b/pages/component/webrtc/webrtc.js
@@ -0,0 +1,186 @@
+// logs.js
+
+let sockTask
+let socketId
+let pc1
+let mediaRecorder
+
+Page({
+ data: {
+ logs: [],
+ show: false,
+ toggle: true,
+ connectId: '',
+ toId: '',
+ localStream: null,
+ localStreamId: '',
+ remoteStreamId: '',
+ showwebrtc: true,
+ recordFile: ''
+ },
+ tuIdChange(e) {
+ this.setData({
+ toId: e.detail.value
+ })
+ },
+ onLoad() {
+ const connectId = Math.random().toString(36).slice(-4).toUpperCase()
+ this.setData({
+ connectId
+ })
+ },
+ startSocket() {
+ sockTask = wx.connectSocket({
+ url: 'wss://finogeeks-tools.finogeeks.club/webrtc-server',
+ // url: 'ws://localhost:8989',
+ complete (res) {
+ console.log('DEBUG: socket-staff |||| connectSocket complete: ', res)
+ }
+ })
+ sockTask.onOpen((res) => {
+ console.log('DEBUG: socket-staff |||| sockTask.onOpen: ', res)
+ sockTask.send({
+ data: JSON.stringify({
+ type: 'ready',
+ id: this.data.connectId
+ })
+ })
+ })
+ sockTask.onMessage(async (res) => {
+ let data
+ try {
+ data = JSON.parse(res.data)
+ } catch (e) {
+ data = {}
+ }
+ console.log('DEBUG: socket-staff |||| sockTask.onMessage: ', data)
+ if (data.type === 'sendOffer') {
+ // 收到 sendOffer 时,表示自己是 remote 端
+ await pc1.setRemoteDescription(data.args)
+ const answer = await pc1.createAnswer()
+ sockTask.send({
+ data: JSON.stringify({
+ type: 'sendAnswer',
+ args: answer,
+ to: data.from,
+ from: this.data.connectId
+ })
+ })
+ await pc1.setLocalDescription(answer)
+ }
+
+ if (data.type === 'sendAnswer') {
+ // 收到 answer 时,表示自己是 host 端
+ await pc1.setRemoteDescription(data.args)
+ }
+
+ if (data.type === 'icecandidate') {
+ await pc1.addIceCandidate(data.args)
+ }
+ })
+ },
+ async makeCall () {
+ const offer = await pc1.createOffer({
+ offerToReceiveAudio: 1,
+ offerToReceiveVideo: 1
+ })
+ pc1.setLocalDescription(offer)
+ sockTask.send({
+ data: JSON.stringify({
+ type: 'sendOffer',
+ args: offer,
+ to: this.data.toId,
+ from: this.data.connectId
+ })
+ })
+ },
+ async startWebrtc() {
+ const stream = await wx.webrtc.mediaDevices.getUserMedia({ audio: true, video: true })
+ const { streamId } = stream
+ this.setData({
+ localStreamId: streamId,
+ localStream: stream
+ })
+ const servers = { iceServers: [{ urls: "stun:stun.stunprotocol.org" }] }
+ const mediaConstraints = { optional: [{ RtpDataChannels: true }] }
+ pc1 = await wx.webrtc.createRTCPeerConnection(servers, mediaConstraints)
+ console.log('pc1', pc1.id)
+ pc1.addEventListener('icecandidate', e => {
+ console.log('DEBUG: listener-callback ---- icecandidate', e)
+ sockTask.send({
+ data: JSON.stringify({
+ args: e.candidate,
+ type: 'icecandidate',
+ to: this.data.toId,
+ from: this.data.connectId
+ }),
+ complete (res) {
+ console.log('sockTask.send complete: ',res)
+ }
+ })
+ });
+ pc1.addEventListener('negotiationneeded', e => {
+ console.log('DEBUG: listener-callback ---- negotiationneeded', e)
+ })
+ pc1.addEventListener('iceconnectionstatechange', e => {
+ console.log('DEBUG: listener-callback ---- iceconnectionstatechange', e)
+ })
+ pc1.addEventListener('signalingstatechange', e => {
+ console.log('DEBUG: listener-callback ---- signalingstatechange', e)
+ })
+
+
+ pc1.addEventListener('track', e => {
+ console.log('DEBUG: listener-callback ---- ontrack', e)
+ this.setData({
+ remoteStreamId: e.streams[0].streamId
+ })
+ })
+
+ const tracks = await stream.getTracks()
+ console.log('tracks: ', tracks)
+ tracks.forEach(t => {
+ pc1.addTrack(t)
+ })
+ },
+ goBack () {
+ wx.redirectTo({
+ url: '/pages/index/index',
+ })
+ },
+ webrtcshow () {
+ this.setData({
+ showwebrtc: !this.data.showwebrtc
+ })
+ },
+ newalocalRecord () {
+ mediaRecorder = wx.webrtc.createMediaRecorder(this.data.localStream)
+ mediaRecorder.ondataavailable = (event) => {
+ console.log('DEBUG: listener-callback ---- mediaRecorder.ondataavailable , ', event)
+ }
+ mediaRecorder.onerror = (event) => {
+ console.log('DEBUG: listener-callback ---- mediaRecorder.onerror , ', event)
+ }
+ mediaRecorder.onstop = (event) => {
+ console.log('DEBUG: listener-callback ---- mediaRecorder.onstop , ', event)
+ this.setData({
+ recordFile: event.tempFilePath
+ })
+ }
+ mediaRecorder.onresume = (event) => {
+ console.log('DEBUG: listener-callback ---- mediaRecorder.onresume , ', event)
+ }
+ mediaRecorder.onpause = (event) => {
+ console.log('DEBUG: listener-callback ---- mediaRecorder.onpause , ', event)
+ }
+ mediaRecorder.onstart = (event) => {
+ console.log('DEBUG: listener-callback ---- mediaRecorder.onstart , ', event)
+ }
+ },
+ startLocalRecord () {
+ mediaRecorder.start()
+ },
+ stopLocalRecord () {
+ mediaRecorder.stop()
+ }
+})
diff --git a/pages/component/webrtc/webrtc.json b/pages/component/webrtc/webrtc.json
new file mode 100644
index 0000000..6bb6c6a
--- /dev/null
+++ b/pages/component/webrtc/webrtc.json
@@ -0,0 +1,5 @@
+{
+ "navigationBarTitleText": "webrtc",
+ "usingComponents": {
+ }
+}
\ No newline at end of file
diff --git a/pages/component/webrtc/webrtc.wxml b/pages/component/webrtc/webrtc.wxml
new file mode 100644
index 0000000..79b5ef9
--- /dev/null
+++ b/pages/component/webrtc/webrtc.wxml
@@ -0,0 +1,28 @@
+
+
+
+ id:{{connectId}}
+
+
+
+
+
+
+
+
+
+
+
+ local:
+
+
+ remote:
+
+
+ 录制:
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/component/webrtc/webrtc.wxss b/pages/component/webrtc/webrtc.wxss
new file mode 100644
index 0000000..c1e3f7e
--- /dev/null
+++ b/pages/component/webrtc/webrtc.wxss
@@ -0,0 +1,14 @@
+.log-list {
+ display: flex;
+ flex-direction: column;
+ padding: 40rpx;
+}
+.log-item {
+ margin: 10rpx;
+}
+.my-webrtc-video{
+ width: 300px;
+ height: 200px;
+ display: block;
+ border: 1px solid green;
+}
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
deleted file mode 100644
index b5bef26..0000000
--- a/project.config.json
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- "description": "项目配置文件",
- "packOptions": {
- "ignore": []
- },
- "setting": {
- "urlCheck": false,
- "es6": true,
- "enhance": false,
- "postcss": true,
- "preloadBackgroundData": false,
- "minified": true,
- "newFeature": false,
- "coverView": true,
- "nodeModules": false,
- "autoAudits": false,
- "showShadowRootInWxmlPanel": true,
- "scopeDataCheck": false,
- "uglifyFileName": false,
- "checkInvalidKey": true,
- "checkSiteMap": true,
- "uploadWithSourceMap": true,
- "compileHotReLoad": false,
- "useMultiFrameRuntime": true,
- "useApiHook": true,
- "useApiHostProcess": true,
- "babelSetting": {
- "ignore": [],
- "disablePlugins": [],
- "outputPath": ""
- },
- "bundle": false,
- "useIsolateContext": true,
- "useCompilerModule": true,
- "userConfirmedUseCompilerModuleSwitch": false,
- "userConfirmedBundleSwitch": false,
- "packNpmManually": false,
- "packNpmRelationList": [],
- "minifyWXSS": true
- },
- "compileType": "miniprogram",
- "libVersion": "2.14.1",
- "appid": "wx723eeedb1222c3c8",
- "projectname": "wx-api-v2",
- "debugOptions": {
- "hidedInDevtools": []
- },
- "scripts": {},
- "isGameTourist": false,
- "simulatorType": "wechat",
- "simulatorPluginLibVersion": {},
- "condition": {
- "search": {
- "list": []
- },
- "conversation": {
- "list": []
- },
- "game": {
- "list": []
- },
- "plugin": {
- "list": []
- },
- "gamePlugin": {
- "list": []
- },
- "miniprogram": {
- "list": []
- }
- }
-}
\ No newline at end of file
diff --git a/project.private.config.json b/project.private.config.json
new file mode 100644
index 0000000..253a43f
--- /dev/null
+++ b/project.private.config.json
@@ -0,0 +1,23 @@
+{
+ "condition": {
+ "plugin": {
+ "list": []
+ },
+ "game": {
+ "list": []
+ },
+ "gamePlugin": {
+ "list": []
+ },
+ "miniprogram": {
+ "list": [
+ {
+ "name": "",
+ "pathName": "pages/component/button/button",
+ "query": "test1=123&test2=999",
+ "scene": null
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/readme_en.md b/readme_en.md
index 74599a2..baf5e14 100644
--- a/readme_en.md
+++ b/readme_en.md
@@ -103,4 +103,4 @@ Our current documentation is still in progress, if you are interested in finclip
[](https://github.com/finogeeks/miniprogram-demo/stargazers)
## Forkers
-[](https://github.com/finogeeks/miniprogram-demo/network/members)
+[](https://github.com/finogeeks/miniprogram-demo/network/members)
\ No newline at end of file