├── pages
├── index
│ ├── index.json
│ ├── index.js
│ ├── index.wxml
│ └── index.wxss
├── read-detail
│ ├── read-detail.json
│ ├── read-detail.wxml
│ ├── read-detail.wxss
│ └── read-detail.js
├── movie
│ ├── movie.json
│ ├── movie.wxml
│ ├── movie.wxss
│ └── movie.js
└── read
│ ├── read.wxss
│ ├── read.json
│ ├── read.wxml
│ └── read.js
├── components
├── movie-item
│ ├── movie-item.json
│ ├── movie-item.js
│ ├── movie-item.wxml
│ └── movie-item.wxss
└── read-item
│ ├── read-item.json
│ ├── read-item.js
│ ├── read-item.wxml
│ └── read-item.wxss
├── images
├── mv.png
├── p0.png
├── 播放.png
├── 暂停.png
├── pan.png
├── play.jpg
├── play.png
├── shou.png
├── 千与千寻.jpg
├── icon
│ ├── dj.png
│ ├── my.png
│ ├── p0.png
│ ├── xx.png
│ ├── chat.png
│ ├── pan.png
│ ├── play.png
│ ├── shou.png
│ ├── star.png
│ ├── stop.png
│ ├── true.png
│ ├── view.png
│ ├── chat1.png
│ ├── music.png
│ ├── my_h1.png
│ ├── search.png
│ ├── share.png
│ ├── guangdie.png
│ ├── location.png
│ ├── music_h1.png
│ ├── none-star.png
│ ├── arrow-right.png
│ ├── collection.png
│ ├── share-anti.png
│ └── collection-anti.png
├── music.png
├── pause.png
├── post
│ ├── bl.png
│ ├── vr.png
│ ├── cat.png
│ ├── crab.png
│ ├── sls.png
│ └── xiaolong.jpg
├── search.png
├── tab
│ ├── my.png
│ ├── ciwei.png
│ ├── music.png
│ ├── my_h1.png
│ ├── yuedu.png
│ ├── ciwei_hl.png
│ ├── dianying.png
│ ├── music_hl.png
│ ├── yuedu_hl.png
│ └── dianying_hl.png
├── 播放 (1).png
├── 音乐 (2).png
├── avatar
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ ├── logo.png
│ └── sls.png
├── icons
│ ├── ajd.png
│ ├── ajf.png
│ ├── pause.png
│ ├── play.png
│ ├── radio@2x.png
│ ├── recmd@2x.png
│ ├── newest@2x.png
│ └── play-item.png
├── music
│ ├── xuwei.jpg
│ ├── music-start.png
│ └── music-stop.png
├── selected-mv.png
├── selected-music.png
└── movie-detail
│ ├── p616.webp
│ ├── p8555.webp
│ ├── p44986.webp
│ ├── p1406902310.0.webp
│ ├── p1376151005.51.webp
│ ├── p1463193210.13.webp
│ └── p1517449056.17.webp
├── jsconfig.json
├── app.js
├── .vscode
└── settings.json
├── sitemap.json
├── app.wxss
├── models
└── http.js
├── utils
└── http.js
├── app.json
├── project.config.json
├── data
└── local.js
└── typings
└── wx.d.ts
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/read-detail/read-detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/components/movie-item/movie-item.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/read-item/read-item.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/images/mv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/mv.png
--------------------------------------------------------------------------------
/images/p0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/p0.png
--------------------------------------------------------------------------------
/images/播放.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/播放.png
--------------------------------------------------------------------------------
/images/暂停.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/暂停.png
--------------------------------------------------------------------------------
/images/pan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/pan.png
--------------------------------------------------------------------------------
/images/play.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/play.jpg
--------------------------------------------------------------------------------
/images/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/play.png
--------------------------------------------------------------------------------
/images/shou.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/shou.png
--------------------------------------------------------------------------------
/images/千与千寻.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/千与千寻.jpg
--------------------------------------------------------------------------------
/images/icon/dj.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/dj.png
--------------------------------------------------------------------------------
/images/icon/my.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/my.png
--------------------------------------------------------------------------------
/images/icon/p0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/p0.png
--------------------------------------------------------------------------------
/images/icon/xx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/xx.png
--------------------------------------------------------------------------------
/images/music.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/music.png
--------------------------------------------------------------------------------
/images/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/pause.png
--------------------------------------------------------------------------------
/images/post/bl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/post/bl.png
--------------------------------------------------------------------------------
/images/post/vr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/post/vr.png
--------------------------------------------------------------------------------
/images/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/search.png
--------------------------------------------------------------------------------
/images/tab/my.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/my.png
--------------------------------------------------------------------------------
/images/播放 (1).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/播放 (1).png
--------------------------------------------------------------------------------
/images/音乐 (2).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/音乐 (2).png
--------------------------------------------------------------------------------
/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2015",
4 | "module": "commonjs"
5 | }
6 | }
--------------------------------------------------------------------------------
/images/avatar/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/avatar/1.png
--------------------------------------------------------------------------------
/images/avatar/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/avatar/2.png
--------------------------------------------------------------------------------
/images/avatar/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/avatar/3.png
--------------------------------------------------------------------------------
/images/avatar/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/avatar/4.png
--------------------------------------------------------------------------------
/images/avatar/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/avatar/5.png
--------------------------------------------------------------------------------
/images/icon/chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/chat.png
--------------------------------------------------------------------------------
/images/icon/pan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/pan.png
--------------------------------------------------------------------------------
/images/icon/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/play.png
--------------------------------------------------------------------------------
/images/icon/shou.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/shou.png
--------------------------------------------------------------------------------
/images/icon/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/star.png
--------------------------------------------------------------------------------
/images/icon/stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/stop.png
--------------------------------------------------------------------------------
/images/icon/true.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/true.png
--------------------------------------------------------------------------------
/images/icon/view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/view.png
--------------------------------------------------------------------------------
/images/icons/ajd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icons/ajd.png
--------------------------------------------------------------------------------
/images/icons/ajf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icons/ajf.png
--------------------------------------------------------------------------------
/images/post/cat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/post/cat.png
--------------------------------------------------------------------------------
/images/post/crab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/post/crab.png
--------------------------------------------------------------------------------
/images/post/sls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/post/sls.png
--------------------------------------------------------------------------------
/images/tab/ciwei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/ciwei.png
--------------------------------------------------------------------------------
/images/tab/music.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/music.png
--------------------------------------------------------------------------------
/images/tab/my_h1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/my_h1.png
--------------------------------------------------------------------------------
/images/tab/yuedu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/yuedu.png
--------------------------------------------------------------------------------
/images/avatar/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/avatar/logo.png
--------------------------------------------------------------------------------
/images/avatar/sls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/avatar/sls.png
--------------------------------------------------------------------------------
/images/icon/chat1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/chat1.png
--------------------------------------------------------------------------------
/images/icon/music.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/music.png
--------------------------------------------------------------------------------
/images/icon/my_h1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/my_h1.png
--------------------------------------------------------------------------------
/images/icon/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/search.png
--------------------------------------------------------------------------------
/images/icon/share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/share.png
--------------------------------------------------------------------------------
/images/icons/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icons/pause.png
--------------------------------------------------------------------------------
/images/icons/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icons/play.png
--------------------------------------------------------------------------------
/images/music/xuwei.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/music/xuwei.jpg
--------------------------------------------------------------------------------
/images/selected-mv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/selected-mv.png
--------------------------------------------------------------------------------
/images/tab/ciwei_hl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/ciwei_hl.png
--------------------------------------------------------------------------------
/images/tab/dianying.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/dianying.png
--------------------------------------------------------------------------------
/images/tab/music_hl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/music_hl.png
--------------------------------------------------------------------------------
/images/tab/yuedu_hl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/yuedu_hl.png
--------------------------------------------------------------------------------
/pages/movie/movie.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "v-movie":"/components/movie-item/movie-item"
4 | }
5 | }
--------------------------------------------------------------------------------
/images/icon/guangdie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/guangdie.png
--------------------------------------------------------------------------------
/images/icon/location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/location.png
--------------------------------------------------------------------------------
/images/icon/music_h1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/music_h1.png
--------------------------------------------------------------------------------
/images/icon/none-star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/none-star.png
--------------------------------------------------------------------------------
/images/icons/radio@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icons/radio@2x.png
--------------------------------------------------------------------------------
/images/icons/recmd@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icons/recmd@2x.png
--------------------------------------------------------------------------------
/images/post/xiaolong.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/post/xiaolong.jpg
--------------------------------------------------------------------------------
/images/selected-music.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/selected-music.png
--------------------------------------------------------------------------------
/images/icon/arrow-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/arrow-right.png
--------------------------------------------------------------------------------
/images/icon/collection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/collection.png
--------------------------------------------------------------------------------
/images/icon/share-anti.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/share-anti.png
--------------------------------------------------------------------------------
/images/icons/newest@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icons/newest@2x.png
--------------------------------------------------------------------------------
/images/icons/play-item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icons/play-item.png
--------------------------------------------------------------------------------
/images/music/music-start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/music/music-start.png
--------------------------------------------------------------------------------
/images/music/music-stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/music/music-stop.png
--------------------------------------------------------------------------------
/images/tab/dianying_hl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/tab/dianying_hl.png
--------------------------------------------------------------------------------
/images/movie-detail/p616.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/movie-detail/p616.webp
--------------------------------------------------------------------------------
/images/movie-detail/p8555.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/movie-detail/p8555.webp
--------------------------------------------------------------------------------
/pages/read/read.wxss:
--------------------------------------------------------------------------------
1 | /* pages/read/read.wxss */
2 | swiper{
3 | height: 500rpx;
4 | }
5 | .swiper-bg{
6 | width: 100%;
7 | }
--------------------------------------------------------------------------------
/images/icon/collection-anti.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/icon/collection-anti.png
--------------------------------------------------------------------------------
/images/movie-detail/p44986.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/movie-detail/p44986.webp
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | },
5 | globalData: {
6 | g_isPlay:false,
7 | g_playId:""
8 | }
9 | })
--------------------------------------------------------------------------------
/images/movie-detail/p1406902310.0.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/movie-detail/p1406902310.0.webp
--------------------------------------------------------------------------------
/images/movie-detail/p1376151005.51.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/movie-detail/p1376151005.51.webp
--------------------------------------------------------------------------------
/images/movie-detail/p1463193210.13.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/movie-detail/p1463193210.13.webp
--------------------------------------------------------------------------------
/images/movie-detail/p1517449056.17.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huangzhichao-520/smallprogram-douban/HEAD/images/movie-detail/p1517449056.17.webp
--------------------------------------------------------------------------------
/pages/read/read.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "v-item":"/components/read-item/read-item"
4 | },
5 | "navigationBarTitleText": "阅读"
6 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 |
5 | },
6 | handleToggle(){
7 | wx.switchTab({
8 | url:'/pages/read/read'
9 | })
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.associations": {
3 | "*.cjson": "jsonc",
4 | "*.wxss": "css",
5 | "*.wxs": "javascript",
6 | "*.wxml": "html"
7 | }
8 | }
--------------------------------------------------------------------------------
/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | hello,小程序
5 | 开启我的小程序之旅
6 |
7 |
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/pages/movie/movie.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 正在热映
4 | 更多>
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/components/movie-item/movie-item.js:
--------------------------------------------------------------------------------
1 | // components/movie-item/movie-item.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 |
8 | },
9 |
10 | /**
11 | * 组件的初始数据
12 | */
13 | data: {
14 |
15 | },
16 |
17 | /**
18 | * 组件的方法列表
19 | */
20 | methods: {
21 |
22 | }
23 | })
24 |
--------------------------------------------------------------------------------
/pages/movie/movie.wxss:
--------------------------------------------------------------------------------
1 | /* pages/movie/movie.wxss */
2 | .title{
3 | display: flex;
4 | justify-content: space-between;
5 | font-size: 28rpx;
6 | color: #666;
7 | line-height: 40rpx;
8 | }
9 | .more{
10 | color: #405F80;
11 | font-size: 28rpx
12 | }
13 | .flex-grid{
14 | display:flex;
15 | justify-content: space-between;
16 | }
--------------------------------------------------------------------------------
/components/movie-item/movie-item.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 千与千寻
6 |
7 |
8 | 9.2
9 |
10 |
--------------------------------------------------------------------------------
/pages/read/read.wxml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/components/movie-item/movie-item.wxss:
--------------------------------------------------------------------------------
1 | /* components/movie-item/movie-item.wxss */
2 | .img{
3 | width:200rpx;
4 | height: 280rpx;
5 | }
6 | .star{
7 | width:30rpx;
8 | height: 30rpx;
9 | }
10 | .item{
11 | margin-top: 20rpx;
12 | width:200rpx;
13 | display: flex;
14 | flex-direction: column;
15 | }
16 | .title{
17 | font-size: 26rpx;
18 | line-height: 50rpx;
19 | }
20 | .rating{
21 | font-size: 24rpx;
22 | color:#C20C0C
23 | }
--------------------------------------------------------------------------------
/components/read-item/read-item.js:
--------------------------------------------------------------------------------
1 | // components/read-item/read-item.js
2 | Component({
3 | /**
4 | * 组件的属性列表
5 | */
6 | properties: {
7 | data:{
8 | type:Object
9 | }
10 | },
11 |
12 | /**
13 | * 组件的初始数据
14 | */
15 | data: {
16 |
17 | },
18 |
19 | /**
20 | * 组件的方法列表
21 | */
22 | methods: {
23 | handleToggle(){
24 | wx.navigateTo({
25 | url: '/pages/read-detail/read-detail?id='+this.properties.data.postId
26 | })
27 | }
28 | }
29 | })
30 |
--------------------------------------------------------------------------------
/pages/read/read.js:
--------------------------------------------------------------------------------
1 | var data = require('../../data/local');
2 | var http = require("../../models/http")
3 | Page({
4 | data: {
5 | banners:[],
6 | indicatorDots:true,
7 | indicatorColor:"rgba(11, 44, 66, .6)",
8 | active:"#C20C0C",
9 | postList:[]
10 | },
11 | onLoad:async function (options) {
12 | var {bannerUrl,postList} = data;
13 | var res = await http(bannerUrl);
14 | var banners = res.data.banners.slice(0,3);
15 | this.setData({
16 | banners,
17 | postList
18 | })
19 | }
20 | })
--------------------------------------------------------------------------------
/models/http.js:
--------------------------------------------------------------------------------
1 | function http(url){
2 | return new Promise((resolve,reject)=>{
3 | wx.request({
4 | url,
5 | data: {},
6 | header: {'content-type':'application/json'},
7 | method: 'GET',
8 | dataType: 'json',
9 | responseType: 'text',
10 | success: (result)=>{
11 | resolve(result)
12 | },
13 | fail: (err)=>{
14 | reject(err)
15 | }
16 | });
17 | })
18 | }
19 | module.exports = http
--------------------------------------------------------------------------------
/pages/movie/movie.js:
--------------------------------------------------------------------------------
1 | const http = require('../../utils/http')
2 | Page({
3 | data: {
4 | movies:{}
5 | },
6 | async onLoad() {
7 | var storageData = wx.getStorageSync('movies')
8 | if(storageData){
9 | this.setData({
10 | movies:storageData
11 | })
12 | }else{
13 | var movies = {}
14 | var top250 = await http.getTop250();
15 | var inTheathers = await http.getInTheaters();
16 | var comingSoon = await http.getComingSoon();
17 | console.log(top250.data.subjects);
18 | }
19 | }
20 | })
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .container,page{
3 | height: 100%;
4 | background: #B3D4DB ;
5 | }
6 | .container{
7 | display: flex;
8 | flex-direction: column;
9 | align-items: center;
10 | text-align: center;
11 | }
12 | .logo{
13 | width: 280rpx;
14 | height: 280rpx;
15 | margin-left: auto;
16 | margin-right: auto;
17 | margin-bottom: 180rpx
18 | }
19 | .btn{
20 | background: #B3D4DB;
21 | color: rgb(63, 108, 129);
22 | margin-top: 180rpx;
23 | border:1px solid rgb(63, 108, 129);
24 | width: 280rpx;
25 | height: 80rpx;
26 | text-align: center;
27 | font-size: 28rpx;
28 | line-height: 80rpx;
29 | }
--------------------------------------------------------------------------------
/components/read-item/read-item.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{data.date}}
6 |
7 | {{data.title}}
8 |
9 | {{data.content}}
10 |
11 |
12 | {{data.collection}}
13 |
14 | {{data.reading}}
15 |
16 |
--------------------------------------------------------------------------------
/pages/read-detail/read-detail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 | 知乎 发表于:{{item.dateTime}}
9 |
10 | {{item.title}}
11 |
12 |
16 |
20 |
21 |
22 | {{item.detail}}
23 |
--------------------------------------------------------------------------------
/components/read-item/read-item.wxss:
--------------------------------------------------------------------------------
1 | /* components/read-item/read-item.wxss */
2 | .head{
3 | display: flex;
4 | align-items: center;
5 | height: 80rpx;
6 | }
7 | .head image{
8 | width:50rpx;
9 | height: 50rpx;
10 | }
11 | .head text{
12 | font-size: 28rpx;
13 | margin-left: 40rpx;
14 | color:#666;
15 | }
16 | .bg{
17 | width:100%;
18 | height: 400rpx;
19 | }
20 | .icon{
21 | width:30rpx;
22 | height: 30rpx;
23 | }
24 | .content{
25 | font-size: 34rpx;
26 | color:#666;
27 | }
28 | .title{
29 | padding:20rpx 0;
30 | font-size: 40rpx;
31 | font-weight: bold;
32 | color:#333;
33 | line-height: 60rpx;
34 | }
35 | .end text{
36 | margin:0 20rpx;
37 | }
38 | .item{
39 | padding:20rpx;
40 | margin-top: 40rpx;
41 | background: #fff;
42 | }
43 | page{
44 | background: #eee;
45 | }
--------------------------------------------------------------------------------
/utils/http.js:
--------------------------------------------------------------------------------
1 | var baseUrl = "https://douban-api.now.sh/v2/movie/";
2 | function http({url}){
3 | return new Promise((resolve,reject)=>{
4 | wx.request({
5 | url: baseUrl+url,
6 | data: {},
7 | header: {'content-type':'json'},
8 | method: 'GET',
9 | dataType: 'json',
10 | responseType: 'text',
11 | success: (res)=>{
12 | resolve(res)
13 | },
14 | fail: (err)=>{
15 | reject(err)
16 | }
17 | });
18 | })
19 | }
20 | module.exports={
21 | getTop250:()=>{
22 | return http({
23 | url:"top250"
24 | })
25 | },
26 | getInTheaters:()=>{
27 | return http({
28 | url:"in_theaters"
29 | })
30 | },
31 | getComingSoon:()=>{
32 | return http({
33 | url:"coming_soon"
34 | })
35 | }
36 | }
--------------------------------------------------------------------------------
/pages/read-detail/read-detail.wxss:
--------------------------------------------------------------------------------
1 | /* pages/read-detail/read-detail.wxss */
2 | .collection,.share{
3 | width:100rpx;
4 | height: 100rpx;
5 | }
6 | .bg{
7 | width:100%;
8 | height: 400rpx;
9 | }
10 | .music{
11 | width:80rpx;
12 | height: 80rpx;
13 | position: absolute;
14 | top:200rpx;
15 | left:50%;
16 | transform: translateX(-50%);
17 | }
18 | .detail{
19 | height: 70rpx;
20 | display: flex;
21 | align-items: center;
22 | color: #666;
23 | }
24 | .detail view{
25 | margin-left: 30rpx;
26 | }
27 | .detail image{
28 | width:60rpx;
29 | height: 60rpx;
30 | }
31 | .title{
32 | width: 100%;
33 | display: inline-block;
34 | padding-bottom: 30rpx;
35 | color: #4B556C;
36 | padding-top: 20rpx;
37 | font-weight: bold;
38 | font-size: 40rpx;
39 | }
40 | .collect-share{
41 | float: right;
42 | }
43 | .share{
44 | margin-left: 30rpx;
45 | }
46 | .text-detail{
47 | margin-top: 140rpx;
48 | color: #666;
49 | }
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/read/read",
5 | "pages/movie/movie",
6 | "pages/read-detail/read-detail"
7 | ],
8 | "window": {
9 | "backgroundTextStyle": "light",
10 | "navigationBarBackgroundColor": "#fff",
11 | "navigationBarTitleText": "WeChat",
12 | "navigationBarTextStyle": "black"
13 | },
14 | "tabBar": {
15 | "color": "#666",
16 | "selectedColor": "#3785F9",
17 | "position": "bottom",
18 | "borderStyle": "black",
19 | "list": [
20 | {
21 | "pagePath": "pages/read/read",
22 | "text": "阅读",
23 | "iconPath": "/images/tab/yuedu.png",
24 | "selectedIconPath": "/images/tab/yuedu_hl.png"
25 | },
26 | {
27 | "pagePath": "pages/movie/movie",
28 | "text": "电影",
29 | "iconPath": "/images/tab/dianying.png",
30 | "selectedIconPath": "/images/tab/dianying_hl.png"
31 | }
32 | ]
33 | },
34 | "requiredBackgroundModes": ["audio", "location"],
35 | "sitemapLocation": "sitemap.json"
36 | }
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": false,
8 | "es6": false,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "autoAudits": false,
13 | "checkInvalidKey": true
14 | },
15 | "compileType": "miniprogram",
16 | "libVersion": "2.9.4",
17 | "appid": "wx39a4c454c05ec8d6",
18 | "projectname": "%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%A1%B9%E7%9B%AE",
19 | "debugOptions": {
20 | "hidedInDevtools": []
21 | },
22 | "isGameTourist": false,
23 | "simulatorType": "wechat",
24 | "simulatorPluginLibVersion": {},
25 | "condition": {
26 | "search": {
27 | "current": -1,
28 | "list": []
29 | },
30 | "conversation": {
31 | "current": -1,
32 | "list": []
33 | },
34 | "plugin": {
35 | "current": -1,
36 | "list": []
37 | },
38 | "game": {
39 | "currentL": -1,
40 | "list": []
41 | },
42 | "miniprogram": {
43 | "current": 1,
44 | "list": [
45 | {
46 | "id": -1,
47 | "name": "yuedu",
48 | "pathName": "pages/read/read",
49 | "query": "",
50 | "scene": null
51 | },
52 | {
53 | "id": -1,
54 | "name": "movie",
55 | "pathName": "pages/movie/movie",
56 | "scene": null
57 | }
58 | ]
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/pages/read-detail/read-detail.js:
--------------------------------------------------------------------------------
1 | var data = require('../../data/local')
2 | var app = getApp();
3 | var audio = wx.getBackgroundAudioManager()
4 | Page({
5 | data: {
6 | isCollected:false,
7 | item:"",
8 | id:[],
9 | isPlay:false
10 | },
11 | onLoad: function (options) {
12 | var {id} = options;
13 | var {postList} = data;
14 | this.setData({
15 | item:postList[id],
16 | id
17 | })
18 | var collection = wx.getStorageSync('collection')
19 | if(collection){
20 | collected = collection[id];
21 | this.setData({
22 | isCollected:collected
23 | })
24 | }else{
25 | var collection = {};
26 | collection[id] = false;
27 | wx.setStorageSync('collection', collection)
28 | }
29 | audio.onPlay(()=>{
30 | this.setData({
31 | isPlay:true
32 | })
33 | })
34 | audio.onPause(()=>{
35 | this.setData({
36 | isPlay:false
37 | })
38 | })
39 | if(app.globalData.g_isPlay && app.globalData.g_playId == id){
40 | this.setData({
41 | isPlay:true
42 | })
43 | }else{
44 | this.setData({
45 | isPlay:false
46 | })
47 | }
48 | },
49 | handleCollect(){
50 | var collection= wx.getStorageSync('collection')
51 | var collected = !collection[this.data.id];
52 | collection[this.data.id] = collected;
53 | this.showModal(collected,collection)
54 | },
55 | showModal(collected,collection){
56 | wx.showModal({
57 | title: '收藏',
58 | content: '收藏文章',
59 | success: (res) => {
60 | if(res.confirm){
61 | if(collected){
62 | wx.setStorageSync('collection', collection)
63 | this.setData({
64 | isCollected: collected
65 | })
66 | }
67 | }else if(res.cancel){
68 | if (collected == false) {
69 | wx.setStorageSync('collection', collection)
70 | this.setData({
71 | isCollected: collected
72 | })
73 | }
74 | }
75 | }
76 | })
77 | },
78 | share(){
79 | wx.showActionSheet({
80 | itemList: [
81 | '分享到微信',
82 | '分享到朋友圈'
83 | ],
84 | itemColor: '#000000',
85 | success: (res)=>{
86 | console.log(res.tapIndex)
87 | },
88 | });
89 | },
90 | handleMusic(){
91 | if(this.data.isPlay){
92 | audio.pause()
93 | this.setData({
94 | isPlay:false
95 | })
96 | app.globalData. g_isPlay = false
97 | console.log(app.globalData.g_isPlay)
98 | }else{
99 | audio.title = this.data.item.music.title
100 | audio.src = this.data.item.music.url
101 | this.setData({
102 | isPlay:true
103 | })
104 | app.globalData.g_playId = this.data.id;
105 | app.globalData. g_isPlay = true;
106 | console.log(app.globalData.g_isPlay)
107 | }
108 | }
109 | })
--------------------------------------------------------------------------------
/data/local.js:
--------------------------------------------------------------------------------
1 | var local_database = [
2 | {
3 | date: "Sep 18 2016",
4 | title: "正是虾肥蟹壮时",
5 | imgSrc: "https://i.loli.net/2019/10/21/8Qrtav6KsE7XGjM.png",
6 | avatar: "https://i.loli.net/2019/10/21/tLaWIlGzAPeudjn.png",
7 | content: "菊黄蟹正肥,品尝秋之味。徐志摩把,“看初花的荻芦”和“到楼外楼吃蟹”,并列为秋天来杭州不能错过的风雅之事;用林妹妹的话讲是“螯封嫩玉双双满,",
8 | reading: "112",
9 | collection: "96",
10 | headImgSrc: "https://i.loli.net/2019/10/21/8Qrtav6KsE7XGjM.png",
11 | author: "林白衣",
12 | dateTime: "24小时前",
13 | detail: "菊黄蟹正肥,品尝秋之味。徐志摩把“看初花的荻芦”和“到楼外楼吃蟹”并列为秋天来杭州不能错过的风雅之事;用林妹妹的话讲是“螯封嫩玉双双满,壳凸红脂块块香”;在《世说新语》里,晋毕卓更是感叹“右手持酒杯,左手持蟹螯,拍浮酒船中,便足了一生矣。”漫漫人生长路,美食与爱岂可辜负?于是作为一个吃货,突然也很想回味一下属于我的味蕾记忆。记忆中的秋蟹,是家人的味道,弥漫着浓浓的亲情。\n\n是谁来自山川湖海,却囿于昼夜,厨房与爱? 是母亲,深思熟虑,聪明耐心。吃蟹前,总会拿出几件工具,煞有介事而乐此不疲。告诉我们螃蟹至寒,需要佐以姜茶以祛寒,在配备的米醋小碟里,亦添入姜丝与紫苏,前者驱寒后者增香。泡好菊花茶,岁月静好,我们静等。",
14 | postId: 0,
15 | music: {
16 | url: "http://music.163.com/song/media/outer/url?id=108390",
17 | title: "说谎",
18 | coverImg: "http://p4.music.126.net/J-So8uu3Mo9zKfN128L_pQ==/109951162875623128.jpg"
19 | }
20 | },
21 | {
22 | title: "比利·林恩的中场故事",
23 | content: "一 “李安是一位绝不会重复自己的导演,本片将极富原创性李安众所瞩目的新片《比利林恩漫长的中场休息》,正式更名《半场无战事》。",
24 | imgSrc: "https://i.loli.net/2019/10/21/4bGdIeEUqmZhKAV.png",
25 | reading: 62,
26 | detail: "一 “李安是一位绝不会重复自己的导演,本片将极富原创性”李安众所瞩目的新片《比利林恩漫长的中场休息》,正式更名《半场无战事》。预告片首次曝光后,被视作是明年奥斯卡种子选手。该片根据同名畅销书改编。原著小说荣获美国国家图书奖。也被BBC评为21世纪最伟大的12本英文小说之一。影片讲述一位19岁德州男孩的比利·林恩入伍参加伊战,在一次交火中他大难不死,意外与战友成为大众的关注焦点,并被塑造成英雄。之后他们返回国内,在橄榄球赛中场休息时授勋。这名战争英雄却面临前所未有的心灵煎熬……李安为什么选中这部电影来拍?因为李安想要挑战前所未有的技术难题:以120帧每秒的速度、4K、3D技术全面结合,来掀起一场电影视觉革命。什么意思?所谓“电影是24格每秒的谎言”,其中的24格,就是帧数。",
27 | collection: 92,
28 | dateTime: "24小时前",
29 | headImgSrc: "https://i.loli.net/2019/10/21/4bGdIeEUqmZhKAV.png",
30 | author: "迷的城",
31 | date: "Nov 20 2016",
32 | avatar: "https://i.loli.net/2019/10/21/576PQlbHG3uTm4s.png",
33 | postId: 1,
34 | music: {
35 | url: "http://music.163.com/song/media/outer/url?id=30814948",
36 | title: "从前慢",
37 | coverImg: "http://y.gtimg.cn/music/photo_new/T002R150x150M000002xOmp62kqSic.jpg?max_age=2592000"
38 | }
39 | },
40 | {
41 | //按住alt + shift + F 可以格式化代码样式
42 | title: "当我们在谈论经济学时,我们在谈论什么?",
43 | content: "引言在我跟学生课后交流时,以及我在知乎上阅读有关“经济”问题的论题时,经常会遇到这样的情况:...",
44 | detail: "1 引言\n\n在我跟学生课后交流时,以及我在知乎上阅读有关“经济”问题的论题时,经常会遇到这样的情况:有些人套用“经济理论“的知识去解释现实中发生的经济事件,结果发现很多事情讲不通,或者发现”理论告诉我们的“与现实发生的是相反的。也有学生经常跟我说:经济学有什么用?为了说明这个,我经常从两个方面来进行解释,尝试用我个人所擅长的解决问题的视角和他们能够听懂的方法来说明经济学是什么,它的作用边界在哪里:\r\n\n2 ”简笔素描“与”油画肖像“我们给人画肖像画,可以用简笔素描,也可以用油画肖像。油画肖像可以在最大程度上保存了人物的各方面的细节和特点,而简笔素描则忽略了很多细节。尽管简笔素描忽略了人物的许多细节,但我们仍旧能够很容易的认出画中的人物是谁。为什么?因为这种方法保留了人物最显著的特征,以至于我们可以忽略其次要特征而对人物做出判定。\n\n2.1 ”简笔素描“对于绝大多数的非经济学专业大众而言(经济学相关专业硕士学历以上),人们所接触到的经济学都是初级微观经济学。所谓的初级微观经济学,对于经济问题的”画法“就是一种”简笔素描“。比如初级微观经济学教材中广为使用的这种一元一次需求函数:y=bx+a,需求量的唯一变量是产品价格。但仅凭直觉我们就可以断言,现实中影响需求量的因素绝不止价格这一种,因此我们可以认为这个模型对经济问题的描述是失真的。然而但这种失真却是必要的和有意义的,其意义在与它利于揭示价格对于需求的影响,而不在于否定影响需求的其他因素——",
45 | imgSrc: "https://i.loli.net/2019/10/21/arO4bo193jphTel.png",
46 | headImgSrc: "https://i.loli.net/2019/10/21/arO4bo193jphTel.png",
47 | reading: 62,
48 | collection: 92,
49 | author: "知乎",
50 | date: "Nov 12 2016",
51 | dateTime: "三天前",
52 | avatar: "https://i.loli.net/2019/10/21/Qg5XtAaGKu7CWlE.png",
53 | postId: 2,
54 | music: {
55 | url: "http://music.163.com/song/media/outer/url?id=32835566",
56 | title: "从前的我",
57 | coverImg: "http://p3.music.126.net/1qdwtD9QaawDmX3JUE9raw==/109951162932623462.jpg"
58 | }
59 | },
60 | {
61 | title: "微信·小程序开发工具安装指南",
62 | content: "这两天闲来无事,也安装了 “微信折叠”的开发工具来玩一下。以下是一些小道消息及使用体验,过两天我会写一篇文章以开发者的角度来详细评价微信小程序",
63 | imgSrc: "https://i.loli.net/2019/10/21/m4iqF62GdMbnElp.jpg",
64 | reading: 102,
65 | detail: "这两天闲来无事,也安装了 “微信折叠”的开发工具来玩一下。以下是一些小道消息及使用体验,过两天我会写一篇文章以开发者的角度来详细评价微信小程序:微信小程序不能开发游戏类、直播类功能,小程序每个人关注的上限是20个(还不确定,不过我相信这是真的,这次公布的API里并没有视频组件。微信太大,苹果要有所顾忌,但是微信也要做出相应的让步)微信目前有没有同苹果商谈好,还是个未知数,毕竟会对AppStore有一定的冲击。抛弃了大量的javascript组件后,这个生态体系变得相当的封闭,微信解释肯定是:为了更好的性能提升。那么我们拭目以待。小程序的入口是微信里的三级菜单,就是在“Tab栏发现里的游戏下面加入一个“小程序”。反正,这一栏里的购物和游戏我是从来没点进去过的。以腾讯的尿性,小程序同服务号一样,其关系链及重要功能的开放程度会因“人”而异。对,优质的接口只会开放给腾讯的儿子们(滴滴呀、京东呀)",
66 | collection: 92,
67 | dateTime: "24小时前",
68 | headImgSrc: "https://i.loli.net/2019/10/21/m4iqF62GdMbnElp.jpg",
69 | author: "猫是猫的猫",
70 | date: "Nov 20 2016",
71 | avatar: "https://i.loli.net/2019/10/21/hebGAjIRJrVwnUE.png",
72 | postId: 3,
73 | music: {
74 | url: "http://music.163.com/song/media/outer/url?id=303283 ",
75 | title: "爱情呼叫转移",
76 | coverImg: "http://p4.music.126.net/KfA50nsD2BVup_ACFRGPPA==/19017153114621423.jpg",
77 | }
78 | },
79 | {
80 | title: "从视觉到触觉 这款VR手套能给你真实触感",
81 | content: "8月29日消息,据国外媒体VentureBeat报道,一家名为Dexta Robotics的公司最近发布了一款有望变革虚拟现实手部追踪与交互方式的新产品",
82 | imgSrc: "https://i.loli.net/2019/10/21/PcZYUaiDTbAH8yt.png",
83 | reading: 102,
84 | detail: "消息,据国外媒体VentureBeat报道,一家名为Dexta Robotics的公司最近发布了一款有望变革虚拟现实手部追踪与交互方式的新产品。该产品名为“Dexmo”,它是一款像手套那样戴在手上使用的未来主义外骨骼。它内置大量的元件,能够与VR体验进行交互,可帮助你感觉握在你的双手的虚拟物体。Dexmo据Dexta称,“Dexmo是一款针对你的双手的机械外骨骼。它能够捕捉你的手部运动,以及提供即时的力反馈。有了Dexmo,你可以感受到虚拟物体的大小、形状和坚硬度。你可以接触数字世界。”市面上已经有数款产品旨在处理虚拟现实中的手部交互,也有相关的产品即将要进入市场。例如,颇受欢迎的HTC Vive头盔配有一副控制器,其控制器能够使得追踪系统看到你的双手,让你可以用它们来在特定体验中与物体进行交互。今年晚些时候,Oculus将开始出货类似的手部控制产品Oculus Touch。10月,索尼也将开始出货配备两个PlayStation Move手部控制器的PS VR。Leap Motion甚至更进一步:利用传感器来追踪手指和手部的运动。",
85 | collection: 26,
86 | dateTime: "24小时前",
87 | headImgSrc: "https://i.loli.net/2019/10/21/PcZYUaiDTbAH8yt.png",
88 | author: "深白色",
89 | date: "Nov 20 2016",
90 | avatar: "https://i.loli.net/2019/10/21/KMiCf5XBoqId86r.png",
91 | postId: 4,
92 | music: {
93 | url: "http://music.163.com/song/media/outer/url?id=32835566",
94 | title: "往后余生",
95 | coverImg: "http://p3.music.126.net/T1nKA7zWLb8Y2vnzc5CeCQ==/3431575792207860.jpg"
96 | }
97 | },
98 | {
99 | title: "爱奇艺创维开展战略合作,合力布局开放娱乐生态",
100 | content: "爱奇艺和创维分别作为国内领先的在线视频品牌",
101 | imgSrc: "https://i.loli.net/2019/10/21/dNqHFTL1UC3kxGa.png",
102 | reading: 96,
103 | detail: "爱奇艺和创维分别作为国内领先的在线视频品牌和家电品牌。双方一直锐意创新,为用户提供优质的服务体验和产品体验。据悉,爱奇艺与创维将展开从资本到VIP会员服务等各方面的深入合作。籍由此次合作,爱奇艺将战略投资创维旗下拥有高端互联网电视品牌的酷开公司。从下一财年开始,创维旗下互联网电视将通过银河互联网电视集成播控平台,预置VIP会员服务及相关内容。这种捆绑终端与VIP内容的全新销售模式,将大幅提升互联网电视终端用户的体验,给予用户更多优质内容的选择。",
104 | collection: 26,
105 | dateTime: "21小时前",
106 | headImgSrc: "https://i.loli.net/2019/10/21/dNqHFTL1UC3kxGa.png",
107 | author: "深白色",
108 | date: "Nov 20 2016",
109 | avatar: " https://i.loli.net/2019/10/21/Qg5XtAaGKu7CWlE.png",
110 | postId: 5,
111 | music: {
112 | url: "http://music.163.com/song/media/outer/url?id=186240",
113 | title: "朋友-谭咏麟",
114 | coverImg: "http://p4.music.126.net/9PrJFGyL4jvNEQ1vFjMzzA==/3442570914300329.jpg"
115 | }
116 | },
117 | ]
118 | module.exports = {
119 | postList: local_database,
120 | bannerUrl:"http://localhost:3000/banner"
121 | }
--------------------------------------------------------------------------------
/typings/wx.d.ts:
--------------------------------------------------------------------------------
1 | // generate time:2017-08-23 21:12:06
2 | // Type definitions for wx app
3 | // Definitions by: hellopao
4 |
5 | /************************************************
6 | * *
7 | * 微信小程序 API *
8 | * *
9 | ************************************************/
10 |
11 | interface IAnimation {
12 | /**
13 | * 透明度,参数范围 0~1
14 | */
15 | opacity(value: number): IAnimation;
16 | /**
17 | * 颜色值
18 | */
19 | backgroundColor(color: string): IAnimation;
20 | /**
21 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值
22 | */
23 | width(length: number): IAnimation;
24 | /**
25 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值
26 | */
27 | height(length: number): IAnimation;
28 | /**
29 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值
30 | */
31 | top(length: number): IAnimation;
32 | /**
33 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值
34 | */
35 | left(length: number): IAnimation;
36 | /**
37 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值
38 | */
39 | bottom(length: number): IAnimation;
40 | /**
41 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值
42 | */
43 | right(length: number): IAnimation;
44 | /**
45 | * deg的范围-180~180,从原点顺时针旋转一个deg角度
46 | */
47 | rotate(deg: number): IAnimation;
48 | /**
49 | * deg的范围-180~180,在X轴旋转一个deg角度
50 | */
51 | rotateX(deg: number): IAnimation;
52 | /**
53 | * deg的范围-180~180,在Y轴旋转一个deg角度
54 | */
55 | rotateY(deg: number): IAnimation;
56 | /**
57 | * deg的范围-180~180,在Z轴旋转一个deg角度
58 | */
59 | rotateZ(deg: number): IAnimation;
60 | /**
61 | * 同transform-function rotate3d
62 | */
63 | rotate3d(x: number, y: number, z: number, deg: number): IAnimation;
64 | /**
65 | * 一个参数时,表示在X轴、Y轴同时缩放sx倍数;两个参数时表示在X轴缩放sx倍数,在Y轴缩放sy倍数
66 | */
67 | scale(sx: number, sy?: number): IAnimation;
68 | /**
69 | * 在X轴缩放sx倍数
70 | */
71 | scaleX(sx: number): IAnimation;
72 | /**
73 | * 在Y轴缩放sy倍数
74 | */
75 | scaleY(sy: number): IAnimation;
76 | /**
77 | * 在Z轴缩放sy倍数
78 | */
79 | scaleZ(sz: number): IAnimation;
80 | /**
81 | * 在X轴缩放sx倍数,在Y轴缩放sy倍数,在Z轴缩放sz倍数
82 | */
83 | scale3d(sx: number, sy: number, sz: number): IAnimation;
84 | /**
85 | * 一个参数时,表示在X轴偏移tx,单位px;两个参数时,表示在X轴偏移tx,在Y轴偏移ty,单位px。
86 | */
87 | translate(tx: number, ty?: number): IAnimation;
88 | /**
89 | * 在X轴偏移tx,单位px
90 | */
91 | translateX(tx: number): IAnimation;
92 | /**
93 | * 在Y轴偏移tx,单位px
94 | */
95 | translateY(tx: number): IAnimation;
96 | /**
97 | * 在Z轴偏移tx,单位px
98 | */
99 | translateZ(tx: number): IAnimation;
100 | /**
101 | * 在X轴偏移tx,在Y轴偏移ty,在Z轴偏移tz,单位px
102 | */
103 | translate3d(tx: number, ty: number, tz: number): IAnimation;
104 | /**
105 | * 参数范围-180~180;一个参数时,Y轴坐标不变,X轴坐标延顺时针倾斜ax度;两个参数时,分别在X轴倾斜ax度,在Y轴倾斜ay度
106 | */
107 | skew(ax: number, ay?: number): IAnimation;
108 | /**
109 | * 参数范围-180~180;Y轴坐标不变,X轴坐标延顺时针倾斜ax度
110 | */
111 | skewX(ax: number): IAnimation;
112 | /**
113 | * 参数范围-180~180;X轴坐标不变,Y轴坐标延顺时针倾斜ay度
114 | */
115 | skewY(ay: number): IAnimation;
116 | /**
117 | * 同transform-function matrix
118 | */
119 | matrix(a, b, c, d, tx, ty): IAnimation;
120 | /**
121 | * 同transform-function matrix3d
122 | */
123 | matrix3d(): IAnimation;
124 | }
125 |
126 | interface ICanvasContext {
127 | /**
128 | * 设置填充色, 如果没有设置 fillStyle,默认颜色为 black。
129 | */
130 | setFillStyle(color: string): void;
131 | /**
132 | * 设置边框颜色, 如果没有设置 fillStyle,默认颜色为 black。
133 | */
134 | setStrokeStyle(color: string): void;
135 | /**
136 | * 设置阴影
137 | */
138 | setShadow(offsetX: number, offsetY: number, blur: number, color: string): void;
139 | /**
140 | * 创建一个线性的渐变颜色。需要使用 addColorStop() 来指定渐变点,至少要两个。
141 | */
142 | createLinearGradient(x0: number, y0: number, x1: number, y1: number): void;
143 | /**
144 | * 创建一个圆形的渐变颜色。 起点在圆心,终点在圆环。 需要使用 addColorStop() 来指定渐变点,至少要两个。
145 | */
146 | createCircularGradient(x: number, y: number, r: number): void;
147 | /**
148 | * 创建一个颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染。需要使用 addColorStop() 来指定渐变点,至少要两个。
149 | */
150 | addColorStop(stop: number, color: string): void;
151 | /**
152 | * 设置线条端点的样式
153 | */
154 | setLineCap(lineCap: 'butt' | 'round' | 'square'): void;
155 | /**
156 | * 设置两线相交处的样式
157 | */
158 | setLineJoin(lineJoin: 'bevel' | 'round' | 'miter'): void;
159 | /**
160 | * 设置线条宽度
161 | */
162 | setLineWidth(lineWidth: number): void;
163 | /**
164 | * 设置最大倾斜
165 | */
166 | setMiterLimit(miterLimit: number): void;
167 | /**
168 | * 添加一个矩形路径到当前路径。
169 | */
170 | rect(x: number, y: number, width: number, height: number): void;
171 | /**
172 | * 填充一个矩形。用 setFillStyle() 设置矩形的填充色,如果没设置默认是黑色。
173 | */
174 | fillRect(x: number, y: number, width: number, height: number): void;
175 | /**
176 | * 一个矩形(非填充)。用 setFillStroke() 设置矩形线条的颜色,如果没设置默认是黑色。
177 | */
178 | strokeRect(x: number, y: number, width: number, height: number): void;
179 | /**
180 | * 在给定的矩形区域内,清除画布上的像素
181 | */
182 | clearRect(x: number, y: number, width: number, height: number): void;
183 | /**
184 | * 对当前路径进行填充
185 | */
186 | fill(): void;
187 | /**
188 | * 对当前路径进行描边
189 | */
190 | stroke(): void;
191 | /**
192 | * 开始一个路径
193 | */
194 | beginPath(): void;
195 | /**
196 | * 关闭一个路径
197 | */
198 | closePath(): void;
199 | /**
200 | * 把路径移动到画布中的指定点,但不创建线条。
201 | */
202 | moveTo(x: number, y: number): void;
203 | /**
204 | * 添加一个新点,然后在画布中创建从该点到最后指定点的线条。
205 | */
206 | lineTo(x: number, y: number): void;
207 | /**
208 | * 添加一个弧形路径到当前路径,顺时针绘制。
209 | */
210 | arc(x: number, y: number, radius: number, startAngle: number, sweepAngle: number): void;
211 | /**
212 | * 创建二次方贝塞尔曲线
213 | */
214 | quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
215 | /**
216 | * 创建三次方贝塞尔曲线
217 | */
218 | bezierCurveTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number): void;
219 | /**
220 | * 对横纵坐标进行缩放
221 | */
222 | scale(scaleWidth: number/**横坐标缩放的倍数1 = 100%,0.5 = 50%,2 = 200%,依次类 */, scaleHeight: number/** 纵坐标轴缩放的倍数1 = 100%,0.5 = 50%,2 = 200%,依次类 */): void;
223 | /**
224 | * 对坐标轴进行顺时针旋转
225 | */
226 | rotate(deg: number/**degrees * Math.PI/180;degrees范围为0~360;旋转角度,以弧度计 */): void;
227 | /**
228 | * 对坐标原点进行缩放
229 | */
230 | translate(x: number/**水平坐标平移量 */, y: number/**竖直坐标平移量 */): void;
231 | /**
232 | * 在画布上绘制被填充的文本
233 | */
234 | fillText(text: string, x: number, y: number): void;
235 | /**
236 | * 设置字体大小
237 | */
238 | setFontSize(fontSize: number): void;
239 | /**
240 | * 在画布上绘制图像
241 | */
242 | drawImage(imageResource: string, x: number, y: number, width: number, height: number): void;
243 | /**
244 | * 设置全局画笔透明度。
245 | */
246 | setGlobalAlpha(alpha: number): void;
247 | /**
248 | * 保存当前坐标轴的缩放、旋转、平移信息
249 | */
250 | save(): void;
251 | /**
252 | * 恢复之前保存过的坐标轴的缩放、旋转、平移信息
253 | */
254 | restore(): void;
255 | /**
256 | * 进行绘图
257 | */
258 | draw(): void;
259 | }
260 |
261 | interface IAudioContext {
262 | /**
263 | * 播放
264 | */
265 | play: () => void;
266 | /**
267 | * 暂停
268 | */
269 | pause: () => void;
270 | /**
271 | * 跳转到指定位置,单位 s
272 | */
273 | seek: (position: number) => void;
274 | }
275 |
276 | interface IVideoContext {
277 | /**
278 | * 播放
279 | */
280 | play: () => void;
281 | /**
282 | * 暂停
283 | */
284 | pause: () => void;
285 | /**
286 | * 跳转到指定位置,单位 s
287 | */
288 | seek: (position: number) => void;
289 | /**
290 | * 发送弹幕,danmu 包含两个属性 text, color。
291 | */
292 | sendDanmu: (danmu: {text: string; color: string;}) => void;
293 | }
294 |
295 | interface IMapContext {
296 | /**
297 | * 获取当前地图中心的经纬度,返回的是 gcj02 坐标系,可以用于 wx.openLocation
298 | */
299 | getCenterLocation: (obj: {
300 | /**
301 | * 接口调用成功的回调函数 ,res = { longitude: "经度", latitude: "纬度"}
302 | */
303 | success?: (res: {longitude: string; latitude: string}) => void;
304 | /**
305 | * 接口调用失败的回调函数
306 | */
307 | fail?: () => void;
308 | /**
309 | * 接口调用结束的回调函数(调用成功、失败都会执行)
310 | */
311 | complete?: () => void;
312 | }) => void;
313 | /**
314 | * 将地图中心移动到当前定位点,需要配合map组件的show-location使用
315 | */
316 | moveToLocation: () => void;
317 | }
318 |
319 | interface Application {
320 | setData: (obj: any) => void;
321 | }
322 |
323 | interface AppConstructor {
324 | new (): Application;
325 | (opts: {
326 | /**
327 | * 生命周期函数--监听小程序初始化
328 | */
329 | onLaunch?: () => void;
330 | /**
331 | * 生命周期函数--监听小程序显示
332 | */
333 | onShow?: () => void;
334 | /**
335 | * 生命周期函数--监听小程序隐藏
336 | */
337 | onHide?: () => void;
338 |
339 | [key: string]: any;
340 | }): Application;
341 | }
342 |
343 | declare var App: AppConstructor;
344 | declare function getApp(): Application;
345 |
346 | declare function getCurrentPages(): Page[];
347 |
348 | interface Page {
349 | setData: (obj: any) => void;
350 | }
351 |
352 | interface PageConstructor {
353 | new (): Page;
354 | (opts: {
355 | /**
356 | * 页面的初始数据
357 | */
358 | data?: any;
359 | /**
360 | * 页面的初始数据
361 | */
362 | onLoad?: () => void;
363 | /**
364 | * 生命周期函数--监听页面初次渲染完成
365 | */
366 | onReady?: () => void;
367 | /**
368 | * 生命周期函数--监听页面显示
369 | */
370 | onShow?: () => void;
371 | /**
372 | * 生命周期函数--监听页面隐藏
373 | */
374 | onHide?: () => void;
375 | /**
376 | * 生命周期函数--监听页面卸载
377 | */
378 | onUnload?: () => void;
379 | /**
380 | * 页面相关事件处理函数--监听用户下拉动作
381 | */
382 | onPullDownRefreash?: () => void;
383 | /**
384 | * 页面上拉触底事件的处理函数
385 | */
386 | onReachBottom?: () => void;
387 | /**
388 | * 用户点击右上角分享
389 | */
390 | onShareAppMessage?: () => {
391 | /**
392 | * 分享标题, 默认值当前小程序名称
393 | */
394 | title: string;
395 | /**
396 | * 分享描述, 默认值当前小程序名称
397 | */
398 | desc: string;
399 | /**
400 | * 分享路径 默认值当前页面 path ,必须是以 / 开头的完整路径
401 | */
402 | path: string;
403 | };
404 |
405 | [key: string]: any;
406 | }): Page;
407 | }
408 |
409 | declare var Page: PageConstructor;
410 |
411 | declare var wx: {
412 | // # 网络 #
413 |
414 | request(obj: {
415 | /**
416 | * 开发者服务器接口地址
417 | */
418 | url: string;
419 | /**
420 | * 请求的参数
421 | */
422 | data?: any | string;
423 | /**
424 | * 设置请求的 header , header 中不能设置 Referer
425 | */
426 | header?: any;
427 | /**
428 | * 默认为 GET,有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
429 | */
430 | method?: string;
431 | /**
432 | * 默认为 json。如果设置了 dataType 为 json,则会尝试对响应的数据做一次 JSON.parse
433 | */
434 | dataType?: string;
435 | /**
436 | * 收到开发者服务成功返回的回调函数,res = {data: '开发者服务器返回的内容'}
437 | */
438 | success?: Function;
439 | /**
440 | * 接口调用失败的回调函数
441 | */
442 | fail?: Function;
443 | /**
444 | * 接口调用结束的回调函数(调用成功、失败都会执行)
445 | */
446 | complete?: Function;
447 | }): void;
448 |
449 | /**
450 | * 将本地资源上传到开发者服务器。如页面通过 wx.chooseImage 等接口获取到一个本地资源的临时文件路径后,可通过此接口将本地资源上传到指定服务器。客户端发起一个 HTTPS POST 请求,其中 content-type 为 multipart/form-data 。
451 | */
452 | uploadFile(obj: {
453 | /**
454 | * 开发者服务器 url
455 | */
456 | url: string;
457 | /**
458 | * 要上传文件资源的路径
459 | */
460 | filePath: string;
461 | /**
462 | * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
463 | */
464 | name: string;
465 | /**
466 | * HTTP 请求 Header , header 中不能设置 Referer
467 | */
468 | header?: any;
469 | /**
470 | * HTTP 请求中其他额外的 form data
471 | */
472 | formData?: any;
473 | /**
474 | * 接口调用成功的回调函数
475 | */
476 | success?: Function;
477 | /**
478 | * 接口调用失败的回调函数
479 | */
480 | fail?: Function;
481 | /**
482 | * 接口调用结束的回调函数(调用成功、失败都会执行)
483 | */
484 | complete?: Function;
485 | }): void;
486 |
487 | /**
488 | * 下载文件资源到本地。客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
489 | */
490 | downloadFile(obj: {
491 | /**
492 | * 下载资源的 url
493 | */
494 | url: string;
495 | /**
496 | * HTTP 请求 Header
497 | */
498 | header?: any;
499 | /**
500 | * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
501 | */
502 | success?: Function;
503 | /**
504 | * 接口调用失败的回调函数
505 | */
506 | fail?: Function;
507 | /**
508 | * 接口调用结束的回调函数(调用成功、失败都会执行)
509 | */
510 | complete?: Function;
511 | }): void;
512 |
513 | /**
514 | * 创建一个 WebSocket 连接;一个微信小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。
515 | */
516 | connectSocket(obj: {
517 | /**
518 | * 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名
519 | */
520 | url: string;
521 | /**
522 | * 请求的数据
523 | */
524 | data?: any;
525 | /**
526 | * HTTP Header , header 中不能设置 Referer
527 | */
528 | header?: any;
529 | /**
530 | * 默认是GET,有效值: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
531 | */
532 | method?: string;
533 | /**
534 | * 子协议数组
535 | */
536 | protocols?: string[];
537 | /**
538 | * 接口调用成功的回调函数
539 | */
540 | success?: Function;
541 | /**
542 | * 接口调用失败的回调函数
543 | */
544 | fail?: Function;
545 | /**
546 | * 接口调用结束的回调函数(调用成功、失败都会执行)
547 | */
548 | complete?: Function;
549 | }): void;
550 |
551 | /**
552 | * 监听WebSocket连接打开事件。
553 | */
554 | onSocketOpen(callback: Function): void;
555 |
556 | /**
557 | * 监听WebSocket错误。
558 | */
559 | onSocketError(callback: Function): void;
560 |
561 | /**
562 | * 通过 WebSocket 连接发送数据,需要先 wx.connectSocket,并在 wx.onSocketOpen 回调之后才能发送。
563 | */
564 | sendSocketMessage(obj: {
565 | /**
566 | * 需要发送的内容
567 | */
568 | data: undefined;
569 | /**
570 | * 接口调用成功的回调函数
571 | */
572 | success?: Function;
573 | /**
574 | * 接口调用失败的回调函数
575 | */
576 | fail?: Function;
577 | /**
578 | * 接口调用结束的回调函数(调用成功、失败都会执行)
579 | */
580 | complete?: Function;
581 | }): void;
582 |
583 | /**
584 | * 监听WebSocket接受到服务器的消息事件。
585 | */
586 | onSocketMessage(callback: Function): void;
587 |
588 | /**
589 | * 关闭WebSocket连接。
590 | */
591 | closeSocket(obj: {
592 | /**
593 | * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭)
594 | */
595 | code?: number;
596 | /**
597 | * 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符)
598 | */
599 | reason?: string;
600 | /**
601 | * 接口调用成功的回调函数
602 | */
603 | success?: Function;
604 | /**
605 | * 接口调用失败的回调函数
606 | */
607 | fail?: Function;
608 | /**
609 | * 接口调用结束的回调函数(调用成功、失败都会执行)
610 | */
611 | complete?: Function;
612 | }): void;
613 |
614 | /**
615 | * 监听WebSocket关闭。
616 | */
617 | onSocketClose(callback: Function): void;
618 |
619 | // # 媒体 #
620 |
621 | /**
622 | * 从本地相册选择图片或使用相机拍照。
623 | */
624 | chooseImage(obj: {
625 | /**
626 | * 最多可以选择的图片张数,默认9
627 | */
628 | count?: number;
629 | /**
630 | * original 原图,compressed 压缩图,默认二者都有
631 | */
632 | sizeType?: string[];
633 | /**
634 | * album 从相册选图,camera 使用相机,默认二者都有
635 | */
636 | sourceType?: string[];
637 | /**
638 | * 成功则返回图片的本地文件路径列表 tempFilePaths
639 | */
640 | success: Function;
641 | /**
642 | * 接口调用失败的回调函数
643 | */
644 | fail?: Function;
645 | /**
646 | * 接口调用结束的回调函数(调用成功、失败都会执行)
647 | */
648 | complete?: Function;
649 | }): void;
650 |
651 | /**
652 | * 预览图片。
653 | */
654 | previewImage(obj: {
655 | /**
656 | * 当前显示图片的链接,不填则默认为 urls 的第一张
657 | */
658 | current?: string;
659 | /**
660 | * 需要预览的图片链接列表
661 | */
662 | urls: string[];
663 | /**
664 | * 接口调用成功的回调函数
665 | */
666 | success?: Function;
667 | /**
668 | * 接口调用失败的回调函数
669 | */
670 | fail?: Function;
671 | /**
672 | * 接口调用结束的回调函数(调用成功、失败都会执行)
673 | */
674 | complete?: Function;
675 | }): void;
676 |
677 | /**
678 | * 获取图片信息
679 | */
680 | getImageInfo(obj: {
681 | /**
682 | * 图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径
683 | */
684 | src: string;
685 | /**
686 | * 接口调用成功的回调函数
687 | */
688 | success?: Function;
689 | /**
690 | * 接口调用失败的回调函数
691 | */
692 | fail?: Function;
693 | /**
694 | * 接口调用结束的回调函数(调用成功、失败都会执行)
695 | */
696 | complete?: Function;
697 | }): void;
698 |
699 | saveImageToPhotosAlbum(obj: {
700 | /**
701 | * 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径
702 | */
703 | filePath: string;
704 | /**
705 | * 接口调用成功的回调函数
706 | */
707 | success?: Function;
708 | /**
709 | * 接口调用失败的回调函数
710 | */
711 | fail?: Function;
712 | /**
713 | * 接口调用结束的回调函数(调用成功、失败都会执行)
714 | */
715 | complete?: Function;
716 | }): void;
717 |
718 | /**
719 | * 开始录音。当主动调用wx.stopRecord,或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径。当用户离开小程序时,此接口无法调用。
720 | */
721 | startRecord(obj: {
722 | /**
723 | * 录音成功后调用,返回录音文件的临时文件路径,res = {tempFilePath: '录音文件的临时路径'}
724 | */
725 | success?: Function;
726 | /**
727 | * 接口调用失败的回调函数
728 | */
729 | fail?: Function;
730 | /**
731 | * 接口调用结束的回调函数(调用成功、失败都会执行)
732 | */
733 | complete?: Function;
734 | }): void;
735 |
736 | /**
737 | * 主动调用停止录音。
738 | */
739 | stopRecord(): void;
740 |
741 | /**
742 | * 开始播放语音,同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。
743 | */
744 | playVoice(obj: {
745 | /**
746 | * 需要播放的语音文件的文件路径
747 | */
748 | filePath: string;
749 | /**
750 | * 接口调用成功的回调函数
751 | */
752 | success?: Function;
753 | /**
754 | * 接口调用失败的回调函数
755 | */
756 | fail?: Function;
757 | /**
758 | * 接口调用结束的回调函数(调用成功、失败都会执行)
759 | */
760 | complete?: Function;
761 | }): void;
762 |
763 | /**
764 | * 暂停正在播放的语音。再次调用wx.playVoice播放同一个文件时,会从暂停处开始播放。如果想从头开始播放,需要先调用 wx.stopVoice。
765 | */
766 | pauseVoice(): void;
767 |
768 | /**
769 | * 结束播放语音。
770 | */
771 | stopVoice(): void;
772 |
773 | /**
774 | * 获取后台音乐播放状态。
775 | */
776 | getBackgroundAudioPlayerState(obj: {
777 | /**
778 | * 接口调用成功的回调函数
779 | */
780 | success?: Function;
781 | /**
782 | * 接口调用失败的回调函数
783 | */
784 | fail?: Function;
785 | /**
786 | * 接口调用结束的回调函数(调用成功、失败都会执行)
787 | */
788 | complete?: Function;
789 | }): void;
790 |
791 | /**
792 | * 使用后台播放器播放音乐,对于微信客户端来说,只能同时有一个后台音乐在播放。当用户离开小程序后,音乐将暂停播放;当用户点击“显示在聊天顶部”时,音乐不会暂停播放;当用户在其他小程序占用了音乐播放器,原有小程序内的音乐将停止播放。
793 | */
794 | playBackgroundAudio(obj: {
795 | /**
796 | * 音乐链接,目前支持的格式有 m4a, aac, mp3, wav
797 | */
798 | dataUrl: string;
799 | /**
800 | * 音乐标题
801 | */
802 | title?: string;
803 | /**
804 | * 封面URL
805 | */
806 | coverImgUrl?: string;
807 | /**
808 | * 接口调用成功的回调函数
809 | */
810 | success?: Function;
811 | /**
812 | * 接口调用失败的回调函数
813 | */
814 | fail?: Function;
815 | /**
816 | * 接口调用结束的回调函数(调用成功、失败都会执行)
817 | */
818 | complete?: Function;
819 | }): void;
820 |
821 | /**
822 | * 暂停播放音乐。
823 | */
824 | pauseBackgroundAudio(): void;
825 |
826 | /**
827 | * 控制音乐播放进度。
828 | */
829 | seekBackgroundAudio(obj: {
830 | /**
831 | * 音乐位置,单位:秒
832 | */
833 | position: number;
834 | /**
835 | * 接口调用成功的回调函数
836 | */
837 | success?: Function;
838 | /**
839 | * 接口调用失败的回调函数
840 | */
841 | fail?: Function;
842 | /**
843 | * 接口调用结束的回调函数(调用成功、失败都会执行)
844 | */
845 | complete?: Function;
846 | }): void;
847 |
848 | /**
849 | * 停止播放音乐。
850 | */
851 | stopBackgroundAudio(): void;
852 |
853 | /**
854 | * 监听音乐播放。
855 | */
856 | onBackgroundAudioPlay(callback: Function): void;
857 |
858 | /**
859 | * 监听音乐暂停。
860 | */
861 | onBackgroundAudioPause(callback: Function): void;
862 |
863 | /**
864 | * 监听音乐停止。
865 | */
866 | onBackgroundAudioStop(callback: Function): void;
867 |
868 | getBackgroundAudioManager(): void;
869 |
870 | /**
871 | * 创建并返回 audio 上下文 audioContext 对象
872 | */
873 | createAudioContext(audioId: string): IAudioContext;
874 |
875 | /**
876 | * 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。
877 | */
878 | chooseVideo(obj: {
879 | /**
880 | * album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera']
881 | */
882 | sourceType?: string[];
883 | /**
884 | * 拍摄视频最长拍摄时间,单位秒。最长支持 60 秒
885 | */
886 | maxDuration?: number;
887 | /**
888 | * 默认调起的为前置还是后置摄像头。front: 前置,back: 后置,默认 back
889 | */
890 | camera?: string;
891 | /**
892 | * 接口调用成功,返回视频文件的临时文件路径,详见返回参数说明
893 | */
894 | success?: Function;
895 | /**
896 | * 接口调用失败的回调函数
897 | */
898 | fail?: Function;
899 | /**
900 | * 接口调用结束的回调函数(调用成功、失败都会执行)
901 | */
902 | complete?: Function;
903 | }): void;
904 |
905 | saveVideoToPhotosAlbum(obj: {
906 | /**
907 | * 视频文件路径,可以是临时文件路径也可以是永久文件路径
908 | */
909 | filePath: string;
910 | /**
911 | * 接口调用成功的回调函数
912 | */
913 | success?: Function;
914 | /**
915 | * 接口调用失败的回调函数
916 | */
917 | fail?: Function;
918 | /**
919 | * 接口调用结束的回调函数(调用成功、失败都会执行)
920 | */
921 | complete?: Function;
922 | }): void;
923 |
924 | /**
925 | * 创建并返回 video 上下文 videoContext 对象
926 | */
927 | createVideoContext(videoId: string): IVideoContext;
928 |
929 | // # 文件 #
930 |
931 | /**
932 | * 保存文件到本地。
933 | */
934 | saveFile(obj: {
935 | /**
936 | * 需要保存的文件的临时路径
937 | */
938 | tempFilePath: string;
939 | /**
940 | * 返回文件的保存路径,res = {savedFilePath: '文件的保存路径'}
941 | */
942 | success?: Function;
943 | /**
944 | * 接口调用失败的回调函数
945 | */
946 | fail?: Function;
947 | /**
948 | * 接口调用结束的回调函数(调用成功、失败都会执行)
949 | */
950 | complete?: Function;
951 | }): void;
952 |
953 | /**
954 | * 获取本地已保存的文件列表
955 | */
956 | getSavedFileList(obj: {
957 | /**
958 | * 接口调用成功的回调函数,返回结果见success返回参数说明
959 | */
960 | success?: Function;
961 | /**
962 | * 接口调用失败的回调函数
963 | */
964 | fail?: Function;
965 | /**
966 | * 接口调用结束的回调函数(调用成功、失败都会执行)
967 | */
968 | complete?: Function;
969 | }): void;
970 |
971 | /**
972 | * 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 wx.getFileInfo 接口。
973 | */
974 | getSavedFileInfo(obj: {
975 | /**
976 | * 文件路径
977 | */
978 | filePath: string;
979 | /**
980 | * 接口调用成功的回调函数,返回结果见success返回参数说明
981 | */
982 | success?: Function;
983 | /**
984 | * 接口调用失败的回调函数
985 | */
986 | fail?: Function;
987 | /**
988 | * 接口调用结束的回调函数(调用成功、失败都会执行)
989 | */
990 | complete?: Function;
991 | }): void;
992 |
993 | /**
994 | * 删除本地存储的文件
995 | */
996 | removeSavedFile(obj: {
997 | /**
998 | * 需要删除的文件路径
999 | */
1000 | filePath: string;
1001 | /**
1002 | * 接口调用成功的回调函数
1003 | */
1004 | success?: Function;
1005 | /**
1006 | * 接口调用失败的回调函数
1007 | */
1008 | fail?: Function;
1009 | /**
1010 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1011 | */
1012 | complete?: Function;
1013 | }): void;
1014 |
1015 | /**
1016 | * 新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx
1017 | */
1018 | openDocument(obj: {
1019 | /**
1020 | * 文件路径,可通过 downFile 获得
1021 | */
1022 | filePath: string;
1023 | /**
1024 | * 文件类型,指定文件类型打开文件,有效值 doc, xls, ppt, pdf, docx, xlsx, pptx
1025 | */
1026 | fileType?: string;
1027 | /**
1028 | * 接口调用成功的回调函数
1029 | */
1030 | success?: Function;
1031 | /**
1032 | * 接口调用失败的回调函数
1033 | */
1034 | fail?: Function;
1035 | /**
1036 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1037 | */
1038 | complete?: Function;
1039 | }): void;
1040 |
1041 | getFileInfo(obj: {
1042 | /**
1043 | * 本地文件路径
1044 | */
1045 | filePath: string;
1046 | /**
1047 | * 计算文件摘要的算法,默认值 md5,有效值:md5,sha1
1048 | */
1049 | digestAlgorithm?: string;
1050 | /**
1051 | * 接口调用成功的回调函数
1052 | */
1053 | success?: Function;
1054 | /**
1055 | * 接口调用失败的回调函数
1056 | */
1057 | fail?: Function;
1058 | /**
1059 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1060 | */
1061 | complete?: Function;
1062 | }): void;
1063 |
1064 | // # 数据缓存 #
1065 |
1066 | /**
1067 | * 将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。
1068 | */
1069 | setStorage(obj: {
1070 | /**
1071 | * 本地缓存中的指定的 key
1072 | */
1073 | key: string;
1074 | /**
1075 | * 需要存储的内容
1076 | */
1077 | data: any;
1078 | /**
1079 | * 接口调用成功的回调函数
1080 | */
1081 | success?: Function;
1082 | /**
1083 | * 接口调用失败的回调函数
1084 | */
1085 | fail?: Function;
1086 | /**
1087 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1088 | */
1089 | complete?: Function;
1090 | }): void;
1091 |
1092 | /**
1093 | * 将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
1094 | */
1095 | setStorageSync(key: string, data: any, ): void;
1096 |
1097 | /**
1098 | * 从本地缓存中异步获取指定 key 对应的内容。
1099 | */
1100 | getStorage(obj: {
1101 | /**
1102 | * 本地缓存中的指定的 key
1103 | */
1104 | key: string;
1105 | /**
1106 | * 接口调用的回调函数,res = {data: key对应的内容}
1107 | */
1108 | success: Function;
1109 | /**
1110 | * 接口调用失败的回调函数
1111 | */
1112 | fail?: Function;
1113 | /**
1114 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1115 | */
1116 | complete?: Function;
1117 | }): void;
1118 |
1119 | /**
1120 | * 从本地缓存中同步获取指定 key 对应的内容。
1121 | */
1122 | getStorageSync(key: string): void;
1123 |
1124 | /**
1125 | * 异步获取当前storage的相关信息
1126 | */
1127 | getStorageInfo(obj: {
1128 | /**
1129 | * 接口调用的回调函数,详见返回参数说明
1130 | */
1131 | success: Function;
1132 | /**
1133 | * 接口调用失败的回调函数
1134 | */
1135 | fail?: Function;
1136 | /**
1137 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1138 | */
1139 | complete?: Function;
1140 | }): void;
1141 |
1142 | /**
1143 | * 同步获取当前storage的相关信息
1144 | */
1145 | getStorageInfoSync(): void;
1146 |
1147 | /**
1148 | * 从本地缓存中异步移除指定 key 。
1149 | */
1150 | removeStorage(obj: {
1151 | /**
1152 | * 本地缓存中的指定的 key
1153 | */
1154 | key: string;
1155 | /**
1156 | * 接口调用的回调函数
1157 | */
1158 | success: Function;
1159 | /**
1160 | * 接口调用失败的回调函数
1161 | */
1162 | fail?: Function;
1163 | /**
1164 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1165 | */
1166 | complete?: Function;
1167 | }): void;
1168 |
1169 | /**
1170 | * 从本地缓存中同步移除指定 key 。
1171 | */
1172 | removeStorageSync(key: string): void;
1173 |
1174 | /**
1175 | * 清理本地数据缓存。
1176 | */
1177 | clearStorage(): void;
1178 |
1179 | /**
1180 | * 同步清理本地数据缓存
1181 | */
1182 | clearStorageSync(): void;
1183 |
1184 | // # 位置 #
1185 |
1186 | /**
1187 | * 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用;当用户点击“显示在聊天顶部”时,此接口可继续调用。
1188 | */
1189 | getLocation(obj: {
1190 | /**
1191 | * 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于wx.openLocation的坐标
1192 | */
1193 | type?: string;
1194 | /**
1195 | * 接口调用成功的回调函数,返回内容详见返回参数说明。
1196 | */
1197 | success: Function;
1198 | /**
1199 | * 接口调用失败的回调函数
1200 | */
1201 | fail?: Function;
1202 | /**
1203 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1204 | */
1205 | complete?: Function;
1206 | }): void;
1207 |
1208 | /**
1209 | * 打开地图选择位置
1210 | */
1211 | chooseLocation(obj: {
1212 | /**
1213 | * 接口调用成功的回调函数,返回内容详见返回参数说明。
1214 | */
1215 | success: Function;
1216 | /**
1217 | * 用户取消时调用
1218 | */
1219 | cancel?: Function;
1220 | /**
1221 | * 接口调用失败的回调函数
1222 | */
1223 | fail?: Function;
1224 | /**
1225 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1226 | */
1227 | complete?: Function;
1228 | }): void;
1229 |
1230 | /**
1231 | * 使用微信内置地图查看位置
1232 | */
1233 | openLocation(obj: {
1234 | /**
1235 | * 纬度,范围为-90~90,负数表示南纬
1236 | */
1237 | latitude: number;
1238 | /**
1239 | * 经度,范围为-180~180,负数表示西经
1240 | */
1241 | longitude: number;
1242 | /**
1243 | * 缩放比例,范围5~18,默认为18
1244 | */
1245 | scale?: number;
1246 | /**
1247 | * 位置名
1248 | */
1249 | name?: string;
1250 | /**
1251 | * 地址的详细说明
1252 | */
1253 | address?: string;
1254 | /**
1255 | * 接口调用成功的回调函数
1256 | */
1257 | success?: Function;
1258 | /**
1259 | * 接口调用失败的回调函数
1260 | */
1261 | fail?: Function;
1262 | /**
1263 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1264 | */
1265 | complete?: Function;
1266 | }): void;
1267 |
1268 | /**
1269 | * 创建并返回 map 上下文 mapContext 对象
1270 | */
1271 | createMapContext(mapId: string): IMapContext;
1272 |
1273 | // # 设备 #
1274 |
1275 | /**
1276 | * 获取系统信息。
1277 | */
1278 | getSystemInfo(obj: {
1279 | /**
1280 | * 接口调用成功的回调
1281 | */
1282 | success: Function;
1283 | /**
1284 | * 接口调用失败的回调函数
1285 | */
1286 | fail?: Function;
1287 | /**
1288 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1289 | */
1290 | complete?: Function;
1291 | }): void;
1292 |
1293 | /**
1294 | * 获取系统信息同步接口
1295 | */
1296 | getSystemInfoSync(): void;
1297 |
1298 | /**
1299 | * 获取网络类型。
1300 | */
1301 | getNetworkType(obj: {
1302 | /**
1303 | * 接口调用成功,返回网络类型 networkType
1304 | */
1305 | success: Function;
1306 | /**
1307 | * 接口调用失败的回调函数
1308 | */
1309 | fail?: Function;
1310 | /**
1311 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1312 | */
1313 | complete?: Function;
1314 | }): void;
1315 |
1316 | onNetworkStatusChange(callback: Function): void;
1317 |
1318 | setScreenBrightness(obj: {
1319 | /**
1320 | * 屏幕亮度值,范围 0~1,0 最暗,1 最亮
1321 | */
1322 | value: number;
1323 | /**
1324 | * 接口调用成功
1325 | */
1326 | success?: Function;
1327 | /**
1328 | * 接口调用失败的回调函数
1329 | */
1330 | fail?: Function;
1331 | /**
1332 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1333 | */
1334 | complete?: Function;
1335 | }): void;
1336 |
1337 | getScreenBrightness(obj: {
1338 | /**
1339 | * 接口调用成功
1340 | */
1341 | success?: Function;
1342 | /**
1343 | * 接口调用失败的回调函数
1344 | */
1345 | fail?: Function;
1346 | /**
1347 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1348 | */
1349 | complete?: Function;
1350 | }): void;
1351 |
1352 | vibrateLong(obj: {
1353 | /**
1354 | * 接口调用成功的回调函数
1355 | */
1356 | success?: Function;
1357 | /**
1358 | * 接口调用失败的回调函数
1359 | */
1360 | fail?: Function;
1361 | /**
1362 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1363 | */
1364 | complete?: Function;
1365 | }): void;
1366 |
1367 | vibrateShort(obj: {
1368 | /**
1369 | * 接口调用成功的回调函数
1370 | */
1371 | success?: Function;
1372 | /**
1373 | * 接口调用失败的回调函数
1374 | */
1375 | fail?: Function;
1376 | /**
1377 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1378 | */
1379 | complete?: Function;
1380 | }): void;
1381 |
1382 | /**
1383 | * 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 wx.stopAccelerometer 停止监听。
1384 | */
1385 | onAccelerometerChange(callback: Function): void;
1386 |
1387 | startAccelerometer(obj: {
1388 | /**
1389 | * 接口调用成功的回调函数
1390 | */
1391 | success?: Function;
1392 | /**
1393 | * 接口调用失败的回调函数
1394 | */
1395 | fail?: Function;
1396 | /**
1397 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1398 | */
1399 | complete?: Function;
1400 | }): void;
1401 |
1402 | stopAccelerometer(obj: {
1403 | /**
1404 | * 接口调用成功的回调函数
1405 | */
1406 | success?: Function;
1407 | /**
1408 | * 接口调用失败的回调函数
1409 | */
1410 | fail?: Function;
1411 | /**
1412 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1413 | */
1414 | complete?: Function;
1415 | }): void;
1416 |
1417 | /**
1418 | * 监听罗盘数据,频率:5次/秒,接口调用后会自动开始监听,可使用wx.stopCompass停止监听。
1419 | */
1420 | onCompassChange(callback: Function): void;
1421 |
1422 | startCompass(obj: {
1423 | /**
1424 | * 接口调用成功的回调函数
1425 | */
1426 | success?: Function;
1427 | /**
1428 | * 接口调用失败的回调函数
1429 | */
1430 | fail?: Function;
1431 | /**
1432 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1433 | */
1434 | complete?: Function;
1435 | }): void;
1436 |
1437 | stopCompass(obj: {
1438 | /**
1439 | * 接口调用成功的回调函数
1440 | */
1441 | success?: Function;
1442 | /**
1443 | * 接口调用失败的回调函数
1444 | */
1445 | fail?: Function;
1446 | /**
1447 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1448 | */
1449 | complete?: Function;
1450 | }): void;
1451 |
1452 | makePhoneCall(obj: {
1453 | /**
1454 | * 需要拨打的电话号码
1455 | */
1456 | phoneNumber: string;
1457 | /**
1458 | * 接口调用成功的回调
1459 | */
1460 | success?: Function;
1461 | /**
1462 | * 接口调用失败的回调函数
1463 | */
1464 | fail?: Function;
1465 | /**
1466 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1467 | */
1468 | complete?: Function;
1469 | }): void;
1470 |
1471 | /**
1472 | * 调起客户端扫码界面,扫码成功后返回对应的结果
1473 | */
1474 | scanCode(obj: {
1475 | /**
1476 | * 是否只能从相机扫码,不允许从相册选择图片
1477 | */
1478 | onlyFromCamera?: boolean;
1479 | /**
1480 | * 接口调用成功的回调函数,返回内容详见返回参数说明。
1481 | */
1482 | success?: Function;
1483 | /**
1484 | * 接口调用失败的回调函数
1485 | */
1486 | fail?: Function;
1487 | /**
1488 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1489 | */
1490 | complete?: Function;
1491 | }): void;
1492 |
1493 | setClipboardData(obj: {
1494 | /**
1495 | * 需要设置的内容
1496 | */
1497 | data: string;
1498 | /**
1499 | * 接口调用成功的回调函数
1500 | */
1501 | success?: Function;
1502 | /**
1503 | * 接口调用失败的回调函数
1504 | */
1505 | fail?: Function;
1506 | /**
1507 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1508 | */
1509 | complete?: Function;
1510 | }): void;
1511 |
1512 | getClipboardData(obj: {
1513 | /**
1514 | * 接口调用成功的回调函数
1515 | */
1516 | success?: Function;
1517 | /**
1518 | * 接口调用失败的回调函数
1519 | */
1520 | fail?: Function;
1521 | /**
1522 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1523 | */
1524 | complete?: Function;
1525 | }): void;
1526 |
1527 | openBluetoothAdapter(obj: {
1528 | /**
1529 | * 成功则返回成功初始化信息
1530 | */
1531 | success: Function;
1532 | /**
1533 | * 接口调用失败的回调函数
1534 | */
1535 | fail?: Function;
1536 | /**
1537 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1538 | */
1539 | complete?: Function;
1540 | }): void;
1541 |
1542 | closeBluetoothAdapter(obj: {
1543 | /**
1544 | * 成功则返回成功关闭模块信息
1545 | */
1546 | success: Function;
1547 | /**
1548 | * 接口调用失败的回调函数
1549 | */
1550 | fail?: Function;
1551 | /**
1552 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1553 | */
1554 | complete?: Function;
1555 | }): void;
1556 |
1557 | getBluetoothAdapterState(obj: {
1558 | /**
1559 | * 成功则返回本机蓝牙适配器状态
1560 | */
1561 | success: Function;
1562 | /**
1563 | * 接口调用失败的回调函数
1564 | */
1565 | fail?: Function;
1566 | /**
1567 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1568 | */
1569 | complete?: Function;
1570 | }): void;
1571 |
1572 | onBluetoothAdapterStateChange(callback: Function): void;
1573 |
1574 | startBluetoothDevicesDiscovery(obj: {
1575 | /**
1576 | * 蓝牙设备主 service 的 uuid 列表
1577 | */
1578 | services?: Array;
1579 | /**
1580 | * 是否允许重复上报同一设备, 如果允许重复上报,则onDeviceFound 方法会多次上报同一设备,但是 RSSI 值会有不同
1581 | */
1582 | allowDuplicatesKey?: boolean;
1583 | /**
1584 | * 上报设备的间隔,默认为0,意思是找到新设备立即上报,否则根据传入的间隔上报
1585 | */
1586 | interval?: number;
1587 | /**
1588 | * 成功则返回本机蓝牙适配器状态
1589 | */
1590 | success: Function;
1591 | /**
1592 | * 接口调用失败的回调函数
1593 | */
1594 | fail?: Function;
1595 | /**
1596 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1597 | */
1598 | complete?: Function;
1599 | }): void;
1600 |
1601 | stopBluetoothDevicesDiscovery(obj: {
1602 | /**
1603 | * 成功则返回本机蓝牙适配器状态
1604 | */
1605 | success: Function;
1606 | /**
1607 | * 接口调用失败的回调函数
1608 | */
1609 | fail?: Function;
1610 | /**
1611 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1612 | */
1613 | complete?: Function;
1614 | }): void;
1615 |
1616 | getBluetoothDevices(obj: {
1617 | /**
1618 | * 成功则返回本机蓝牙适配器状态
1619 | */
1620 | success: Function;
1621 | /**
1622 | * 接口调用失败的回调函数
1623 | */
1624 | fail?: Function;
1625 | /**
1626 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1627 | */
1628 | complete?: Function;
1629 | }): void;
1630 |
1631 | onBluetoothDeviceFound(callback: Function): void;
1632 |
1633 | getConnectedBluetoothDevices(obj: {
1634 | /**
1635 | * 蓝牙设备主 service 的 uuid 列表
1636 | */
1637 | services: Array;
1638 | /**
1639 | * 成功则返回本机蓝牙适配器状态
1640 | */
1641 | success: Function;
1642 | /**
1643 | * 接口调用失败的回调函数
1644 | */
1645 | fail?: Function;
1646 | /**
1647 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1648 | */
1649 | complete?: Function;
1650 | }): void;
1651 |
1652 | createBLEConnection(obj: {
1653 | /**
1654 | * 蓝牙设备 id,参考 getDevices 接口
1655 | */
1656 | deviceId: string;
1657 | /**
1658 | * 成功则返回本机蓝牙适配器状态
1659 | */
1660 | success: Function;
1661 | /**
1662 | * 接口调用失败的回调函数
1663 | */
1664 | fail?: Function;
1665 | /**
1666 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1667 | */
1668 | complete?: Function;
1669 | }): void;
1670 |
1671 | closeBLEConnection(obj: {
1672 | /**
1673 | * 蓝牙设备 id,参考 getDevices 接口
1674 | */
1675 | deviceId: string;
1676 | /**
1677 | * 成功则返回本机蓝牙适配器状态
1678 | */
1679 | success: Function;
1680 | /**
1681 | * 接口调用失败的回调函数
1682 | */
1683 | fail?: Function;
1684 | /**
1685 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1686 | */
1687 | complete?: Function;
1688 | }): void;
1689 |
1690 | getBLEDeviceServices(obj: {
1691 | /**
1692 | * 蓝牙设备 id,参考 getDevices 接口
1693 | */
1694 | deviceId: string;
1695 | /**
1696 | * 成功则返回本机蓝牙适配器状态
1697 | */
1698 | success: Function;
1699 | /**
1700 | * 接口调用失败的回调函数
1701 | */
1702 | fail?: Function;
1703 | /**
1704 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1705 | */
1706 | complete?: Function;
1707 | }): void;
1708 |
1709 | getBLEDeviceCharacteristics(obj: {
1710 | /**
1711 | * 蓝牙设备 id,参考 device 对象
1712 | */
1713 | deviceId: string;
1714 | /**
1715 | * 蓝牙服务 uuid
1716 | */
1717 | serviceId: string;
1718 | /**
1719 | * 成功则返回本机蓝牙适配器状态
1720 | */
1721 | success: Function;
1722 | /**
1723 | * 接口调用失败的回调函数
1724 | */
1725 | fail?: Function;
1726 | /**
1727 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1728 | */
1729 | complete?: Function;
1730 | }): void;
1731 |
1732 | readBLECharacteristicValue(obj: {
1733 | /**
1734 | * 蓝牙设备 id,参考 device 对象
1735 | */
1736 | deviceId: string;
1737 | /**
1738 | * 蓝牙特征值对应服务的 uuid
1739 | */
1740 | serviceId: string;
1741 | /**
1742 | * 蓝牙特征值的 uuid
1743 | */
1744 | characteristicId: string;
1745 | /**
1746 | * 成功则返回本机蓝牙适配器状态
1747 | */
1748 | success: Function;
1749 | /**
1750 | * 接口调用失败的回调函数
1751 | */
1752 | fail?: Function;
1753 | /**
1754 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1755 | */
1756 | complete?: Function;
1757 | }): void;
1758 |
1759 | writeBLECharacteristicValue(obj: {
1760 | /**
1761 | * 蓝牙设备 id,参考 device 对象
1762 | */
1763 | deviceId: string;
1764 | /**
1765 | * 蓝牙特征值对应服务的 uuid
1766 | */
1767 | serviceId: string;
1768 | /**
1769 | * 蓝牙特征值的 uuid
1770 | */
1771 | characteristicId: string;
1772 | /**
1773 | * 蓝牙设备特征值对应的二进制值(注意:vConsole 无法打印出 ArrayBuffer 类型数据)
1774 | */
1775 | value: undefined;
1776 | /**
1777 | * 成功则返回本机蓝牙适配器状态
1778 | */
1779 | success: Function;
1780 | /**
1781 | * 接口调用失败的回调函数
1782 | */
1783 | fail?: Function;
1784 | /**
1785 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1786 | */
1787 | complete?: Function;
1788 | }): void;
1789 |
1790 | notifyBLECharacteristicValueChange(obj: {
1791 | /**
1792 | * 蓝牙设备 id,参考 device 对象
1793 | */
1794 | deviceId: string;
1795 | /**
1796 | * 蓝牙特征值对应服务的 uuid
1797 | */
1798 | serviceId: string;
1799 | /**
1800 | * 蓝牙特征值的 uuid
1801 | */
1802 | characteristicId: string;
1803 | /**
1804 | * true: 启用 notify; false: 停用 notify
1805 | */
1806 | state: boolean;
1807 | /**
1808 | * 成功则返回本机蓝牙适配器状态
1809 | */
1810 | success: Function;
1811 | /**
1812 | * 接口调用失败的回调函数
1813 | */
1814 | fail?: Function;
1815 | /**
1816 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1817 | */
1818 | complete?: Function;
1819 | }): void;
1820 |
1821 | onBLEConnectionStateChange(callback: Function): void;
1822 |
1823 | onBLECharacteristicValueChange(callback: Function): void;
1824 |
1825 | startBeaconDiscovery(obj: {
1826 | /**
1827 | * iBeacon设备广播的 uuids
1828 | */
1829 | uuids: string[];
1830 | /**
1831 | * 接口调用成功的回调函数
1832 | */
1833 | success?: Function;
1834 | /**
1835 | * 接口调用失败的回调函数
1836 | */
1837 | fail?: Function;
1838 | /**
1839 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1840 | */
1841 | complete?: Function;
1842 | }): void;
1843 |
1844 | stopBeaconDiscovery(obj: {
1845 | /**
1846 | * 接口调用成功的回调函数
1847 | */
1848 | success?: Function;
1849 | /**
1850 | * 接口调用失败的回调函数
1851 | */
1852 | fail?: Function;
1853 | /**
1854 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1855 | */
1856 | complete?: Function;
1857 | }): void;
1858 |
1859 | getBeacons(obj: {
1860 | /**
1861 | * 接口调用成功的回调函数
1862 | */
1863 | success?: Function;
1864 | /**
1865 | * 接口调用失败的回调函数
1866 | */
1867 | fail?: Function;
1868 | /**
1869 | * 接口调用结束的回调函数(调用成功、失败都会执行)
1870 | */
1871 | complete?: Function;
1872 | }): void;
1873 |
1874 | onBeaconUpdate(callback: Function): void;
1875 |
1876 | onBeaconServiceChange(callback: Function): void;
1877 |
1878 | onUserCaptureScreen(callback: Function): void;
1879 |
1880 | addPhoneContact(obj: {
1881 | /**
1882 | * 头像本地文件路径
1883 | */
1884 | photoFilePath?: string;
1885 | /**
1886 | * 昵称
1887 | */
1888 | nickName?: string;
1889 | /**
1890 | * 姓氏
1891 | */
1892 | lastName?: string;
1893 | /**
1894 | * 中间名
1895 | */
1896 | middleName?: string;
1897 | /**
1898 | * 名字
1899 | */
1900 | firstName: string;
1901 | /**
1902 | * 备注
1903 | */
1904 | remark?: string;
1905 | /**
1906 | * 手机号
1907 | */
1908 | mobilePhoneNumber?: string;
1909 | /**
1910 | * 微信号
1911 | */
1912 | weChatNumber?: string;
1913 | /**
1914 | * 联系地址国家
1915 | */
1916 | addressCountry?: string;
1917 | /**
1918 | * 联系地址省份
1919 | */
1920 | addressState?: string;
1921 | /**
1922 | * 联系地址城市
1923 | */
1924 | addressCity?: string;
1925 | /**
1926 | * 联系地址街道
1927 | */
1928 | addressStreet?: string;
1929 | /**
1930 | * 联系地址邮政编码
1931 | */
1932 | addressPostalCode?: string;
1933 | /**
1934 | * 公司
1935 | */
1936 | organization?: string;
1937 | /**
1938 | * 职位
1939 | */
1940 | title?: string;
1941 | /**
1942 | * 工作传真
1943 | */
1944 | workFaxNumber?: string;
1945 | /**
1946 | * 工作电话
1947 | */
1948 | workPhoneNumber?: string;
1949 | /**
1950 | * 公司电话
1951 | */
1952 | hostNumber?: string;
1953 | /**
1954 | * 电子邮件
1955 | */
1956 | email?: string;
1957 | /**
1958 | * 网站
1959 | */
1960 | url?: string;
1961 | /**
1962 | * 工作地址国家
1963 | */
1964 | workAddressCountry?: string;
1965 | /**
1966 | * 工作地址省份
1967 | */
1968 | workAddressState?: string;
1969 | /**
1970 | * 工作地址城市
1971 | */
1972 | workAddressCity?: string;
1973 | /**
1974 | * 工作地址街道
1975 | */
1976 | workAddressStreet?: string;
1977 | /**
1978 | * 工作地址邮政编码
1979 | */
1980 | workAddressPostalCode?: string;
1981 | /**
1982 | * 住宅传真
1983 | */
1984 | homeFaxNumber?: string;
1985 | /**
1986 | * 住宅电话
1987 | */
1988 | homePhoneNumber?: string;
1989 | /**
1990 | * 住宅地址国家
1991 | */
1992 | homeAddressCountry?: string;
1993 | /**
1994 | * 住宅地址省份
1995 | */
1996 | homeAddressState?: string;
1997 | /**
1998 | * 住宅地址城市
1999 | */
2000 | homeAddressCity?: string;
2001 | /**
2002 | * 住宅地址街道
2003 | */
2004 | homeAddressStreet?: string;
2005 | /**
2006 | * 住宅地址邮政编码
2007 | */
2008 | homeAddressPostalCode?: string;
2009 | /**
2010 | * 接口调用成功
2011 | */
2012 | success?: Function;
2013 | /**
2014 | * 接口调用失败的回调函数
2015 | */
2016 | fail?: Function;
2017 | /**
2018 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2019 | */
2020 | complete?: Function;
2021 | }): void;
2022 |
2023 | // # 界面 #
2024 |
2025 | /**
2026 | * 显示消息提示框
2027 | */
2028 | showToast(obj: {
2029 | /**
2030 | * 提示的内容
2031 | */
2032 | title: string;
2033 | /**
2034 | * 图标,有效值 "success", "loading"
2035 | */
2036 | icon?: string;
2037 | /**
2038 | * 自定义图标的本地路径,image 的优先级高于 icon
2039 | */
2040 | image?: string;
2041 | /**
2042 | * 提示的延迟时间,单位毫秒,默认:1500
2043 | */
2044 | duration?: number;
2045 | /**
2046 | * 是否显示透明蒙层,防止触摸穿透,默认:false
2047 | */
2048 | mask?: boolean;
2049 | /**
2050 | * 接口调用成功的回调函数
2051 | */
2052 | success?: Function;
2053 | /**
2054 | * 接口调用失败的回调函数
2055 | */
2056 | fail?: Function;
2057 | /**
2058 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2059 | */
2060 | complete?: Function;
2061 | }): void;
2062 |
2063 | showLoading(obj: {
2064 | /**
2065 | * 提示的内容
2066 | */
2067 | title: string;
2068 | /**
2069 | * 是否显示透明蒙层,防止触摸穿透,默认:false
2070 | */
2071 | mask?: boolean;
2072 | /**
2073 | * 接口调用成功的回调函数
2074 | */
2075 | success?: Function;
2076 | /**
2077 | * 接口调用失败的回调函数
2078 | */
2079 | fail?: Function;
2080 | /**
2081 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2082 | */
2083 | complete?: Function;
2084 | }): void;
2085 |
2086 | /**
2087 | * 隐藏消息提示框
2088 | */
2089 | hideToast(): void;
2090 |
2091 | hideLoading(): void;
2092 |
2093 | /**
2094 | * 显示模态弹窗
2095 | */
2096 | showModal(obj: {
2097 | /**
2098 | * 提示的标题
2099 | */
2100 | title: string;
2101 | /**
2102 | * 提示的内容
2103 | */
2104 | content: string;
2105 | /**
2106 | * 是否显示取消按钮,默认为 true
2107 | */
2108 | showCancel?: boolean;
2109 | /**
2110 | * 取消按钮的文字,默认为"取消",最多 4 个字符
2111 | */
2112 | cancelText?: string;
2113 | /**
2114 | * 取消按钮的文字颜色,默认为"#000000"
2115 | */
2116 | cancelColor?: undefined;
2117 | /**
2118 | * 确定按钮的文字,默认为"确定",最多 4 个字符
2119 | */
2120 | confirmText?: string;
2121 | /**
2122 | * 确定按钮的文字颜色,默认为"#3CC51F"
2123 | */
2124 | confirmColor?: undefined;
2125 | /**
2126 | * 接口调用成功的回调函数
2127 | */
2128 | success?: Function;
2129 | /**
2130 | * 接口调用失败的回调函数
2131 | */
2132 | fail?: Function;
2133 | /**
2134 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2135 | */
2136 | complete?: Function;
2137 | }): void;
2138 |
2139 | /**
2140 | * 显示操作菜单
2141 | */
2142 | showActionSheet(obj: {
2143 | /**
2144 | * 按钮的文字数组,数组长度最大为6个
2145 | */
2146 | itemList: undefined;
2147 | /**
2148 | * 按钮的文字颜色,默认为"#000000"
2149 | */
2150 | itemColor?: undefined;
2151 | /**
2152 | * 接口调用成功的回调函数,详见返回参数说明
2153 | */
2154 | success?: Function;
2155 | /**
2156 | * 接口调用失败的回调函数
2157 | */
2158 | fail?: Function;
2159 | /**
2160 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2161 | */
2162 | complete?: Function;
2163 | }): void;
2164 |
2165 | setTopBarText(obj: {
2166 | /**
2167 | * 置顶栏文字内容
2168 | */
2169 | text: string;
2170 | /**
2171 | * 接口调用成功的回调函数
2172 | */
2173 | success?: Function;
2174 | /**
2175 | * 接口调用失败的回调函数
2176 | */
2177 | fail?: Function;
2178 | /**
2179 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2180 | */
2181 | complete?: Function;
2182 | }): void;
2183 |
2184 | /**
2185 | * 动态设置当前页面的标题。
2186 | */
2187 | setNavigationBarTitle(obj: {
2188 | /**
2189 | * 页面标题
2190 | */
2191 | title: string;
2192 | /**
2193 | * 接口调用成功的回调函数
2194 | */
2195 | success?: Function;
2196 | /**
2197 | * 接口调用失败的回调函数
2198 | */
2199 | fail?: Function;
2200 | /**
2201 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2202 | */
2203 | complete?: Function;
2204 | }): void;
2205 |
2206 | /**
2207 | * 在当前页面显示导航条加载动画。
2208 | */
2209 | showNavigationBarLoading(): void;
2210 |
2211 | /**
2212 | * 隐藏导航条加载动画。
2213 | */
2214 | hideNavigationBarLoading(): void;
2215 |
2216 | /**
2217 | * 保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。
2218 | */
2219 | navigateTo(obj: {
2220 | /**
2221 | * 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2'
2222 | */
2223 | url: string;
2224 | /**
2225 | * 接口调用成功的回调函数
2226 | */
2227 | success?: Function;
2228 | /**
2229 | * 接口调用失败的回调函数
2230 | */
2231 | fail?: Function;
2232 | /**
2233 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2234 | */
2235 | complete?: Function;
2236 | }): void;
2237 |
2238 | /**
2239 | * 关闭当前页面,跳转到应用内的某个页面。
2240 | */
2241 | redirectTo(obj: {
2242 | /**
2243 | * 需要跳转的应用内非 tabBar 的页面的路径,路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2'
2244 | */
2245 | url: string;
2246 | /**
2247 | * 接口调用成功的回调函数
2248 | */
2249 | success?: Function;
2250 | /**
2251 | * 接口调用失败的回调函数
2252 | */
2253 | fail?: Function;
2254 | /**
2255 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2256 | */
2257 | complete?: Function;
2258 | }): void;
2259 |
2260 | reLaunch(obj: {
2261 | /**
2262 | * 需要跳转的应用内页面路径 , 路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2',如果跳转的页面路径是 tabBar 页面则不能带参数
2263 | */
2264 | url: string;
2265 | /**
2266 | * 接口调用成功的回调函数
2267 | */
2268 | success?: Function;
2269 | /**
2270 | * 接口调用失败的回调函数
2271 | */
2272 | fail?: Function;
2273 | /**
2274 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2275 | */
2276 | complete?: Function;
2277 | }): void;
2278 |
2279 | /**
2280 | * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
2281 | */
2282 | switchTab(obj: {
2283 | /**
2284 | * 需要跳转的 tabBar 页面的路径(需在 app.json 的 tabBar 字段定义的页面),路径后不能带参数
2285 | */
2286 | url: string;
2287 | /**
2288 | * 接口调用成功的回调函数
2289 | */
2290 | success?: Function;
2291 | /**
2292 | * 接口调用失败的回调函数
2293 | */
2294 | fail?: Function;
2295 | /**
2296 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2297 | */
2298 | complete?: Function;
2299 | }): void;
2300 |
2301 | /**
2302 | * 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages()) 获取当前的页面栈,决定需要返回几层。
2303 | */
2304 | navigateBack(obj: {
2305 | /**
2306 | * 返回的页面数,如果 delta 大于现有页面数,则返回到首页。
2307 | */
2308 | delta?: number;
2309 | }): void;
2310 |
2311 | /**
2312 | * 创建一个动画实例animation。调用实例的方法来描述动画。最后通过动画实例的export方法导出动画数据传递给组件的animation属性。
2313 | */
2314 | createAnimation(obj: {
2315 | /**
2316 | * 400
2317 | */
2318 | duration?: number;
2319 | /**
2320 | * "linear"
2321 | */
2322 | timingFunction?: string;
2323 | /**
2324 | * 0
2325 | */
2326 | delay?: number;
2327 | /**
2328 | * "50% 50% 0"
2329 | */
2330 | transformOrigin?: string;
2331 | }): IAnimation;
2332 |
2333 | pageScrollTo(obj: {
2334 | /**
2335 | * 滚动到页面的目标位置(单位px)
2336 | */
2337 | scrollTop: number;
2338 | }): void;
2339 |
2340 | /**
2341 | * 创建 canvas 绘图上下文(指定 canvasId).Tip: 需要指定 canvasId,该绘图上下文只作用于对应的
2342 | */
2343 | createCanvasContext(canvasId: string): ICanvasContext;
2344 |
2345 | /**
2346 | * 把当前画布的内容导出生成图片,并返回文件路径
2347 | */
2348 | canvasToTempFilePath(canvasId: string): void;
2349 |
2350 | startPullDownRefresh(obj: {
2351 | /**
2352 | * 接口调用成功的回调函数
2353 | */
2354 | success?: Function;
2355 | /**
2356 | * 接口调用失败的回调函数
2357 | */
2358 | fail?: Function;
2359 | /**
2360 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2361 | */
2362 | complete?: Function;
2363 | }): void;
2364 |
2365 | /**
2366 | * 停止当前页面下拉刷新。
2367 | */
2368 | stopPullDownRefresh(): void;
2369 |
2370 | // # WXML节点信息 #
2371 |
2372 | // # 第三方平台 #
2373 |
2374 | getExtConfig(obj: {
2375 | /**
2376 | * 返回第三方平台自定义的数据
2377 | */
2378 | success?: Function;
2379 | /**
2380 | * 接口调用失败的回调函数
2381 | */
2382 | fail?: Function;
2383 | /**
2384 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2385 | */
2386 | complete?: Function;
2387 | }): void;
2388 |
2389 | getExtConfigSync(): void;
2390 |
2391 | // # 开放接口 #
2392 |
2393 | /**
2394 | * 调用接口获取登录凭证(code)进而换取用户登录态信息,包括用户的唯一标识(openid) 及本次登录的 会话密钥(session_key)。用户数据的加解密通讯需要依赖会话密钥完成。
2395 | */
2396 | login(obj: {
2397 | /**
2398 | * 接口调用成功的回调函数
2399 | */
2400 | success?: Function;
2401 | /**
2402 | * 接口调用失败的回调函数
2403 | */
2404 | fail?: Function;
2405 | /**
2406 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2407 | */
2408 | complete?: Function;
2409 | }): void;
2410 |
2411 | /**
2412 | * 通过上述接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用wx.checkSession接口检测当前用户登录态是否有效。登录态过期后开发者可以再调用wx.login获取新的用户登录态。
2413 | */
2414 | checkSession(obj: {
2415 | /**
2416 | * 接口调用成功的回调函数,登录态未过期
2417 | */
2418 | success?: Function;
2419 | /**
2420 | * 接口调用失败的回调函数,登录态已过期
2421 | */
2422 | fail?: Function;
2423 | /**
2424 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2425 | */
2426 | complete?: Function;
2427 | }): void;
2428 |
2429 | authorize(obj: {
2430 | /**
2431 | * 需要获取权限的scope,详见 scope 列表
2432 | */
2433 | scope: string;
2434 | /**
2435 | * 接口调用成功的回调函数
2436 | */
2437 | success?: Function;
2438 | /**
2439 | * 接口调用失败的回调函数
2440 | */
2441 | fail?: Function;
2442 | /**
2443 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2444 | */
2445 | complete?: Function;
2446 | }): void;
2447 |
2448 | /**
2449 | * 获取用户信息,withCredentials 为 true 时需要先调用 wx.login 接口。
2450 | */
2451 | getUserInfo(obj: {
2452 | /**
2453 | * 是否带上登录态信息
2454 | */
2455 | withCredentials?: boolean;
2456 | /**
2457 | * 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文
2458 | */
2459 | lang?: string;
2460 | /**
2461 | * 接口调用成功的回调函数
2462 | */
2463 | success?: Function;
2464 | /**
2465 | * 接口调用失败的回调函数
2466 | */
2467 | fail?: Function;
2468 | /**
2469 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2470 | */
2471 | complete?: Function;
2472 | }): void;
2473 |
2474 | /**
2475 | * 发起微信支付。
2476 | */
2477 | requestPayment(obj: {
2478 | /**
2479 | * 时间戳从1970年1月1日00:00:00至今的秒数,即当前的时间
2480 | */
2481 | timeStamp: string;
2482 | /**
2483 | * 随机字符串,长度为32个字符以下。
2484 | */
2485 | nonceStr: string;
2486 | /**
2487 | * 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*
2488 | */
2489 | package: string;
2490 | /**
2491 | * 签名算法,暂支持 MD5
2492 | */
2493 | signType: string;
2494 | /**
2495 | * 签名,具体签名方案参见小程序支付接口文档;
2496 | */
2497 | paySign: string;
2498 | /**
2499 | * 接口调用成功的回调函数
2500 | */
2501 | success?: Function;
2502 | /**
2503 | * 接口调用失败的回调函数
2504 | */
2505 | fail?: Function;
2506 | /**
2507 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2508 | */
2509 | complete?: Function;
2510 | }): void;
2511 |
2512 | chooseAddress(obj: {
2513 | /**
2514 | * 返回用户选择的收货地址信息
2515 | */
2516 | success?: Function;
2517 | /**
2518 | * 接口调用失败的回调函数
2519 | */
2520 | fail?: Function;
2521 | /**
2522 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2523 | */
2524 | complete?: Function;
2525 | }): void;
2526 |
2527 | addCard(obj: {
2528 | /**
2529 | * 需要添加的卡券列表,列表内对象说明请参见请求对象说明
2530 | */
2531 | cardList: undefined;
2532 | /**
2533 | * 接口调用成功的回调函数
2534 | */
2535 | success?: Function;
2536 | /**
2537 | * 接口调用失败的回调函数
2538 | */
2539 | fail?: Function;
2540 | /**
2541 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2542 | */
2543 | complete?: Function;
2544 | }): void;
2545 |
2546 | openCard(obj: {
2547 | /**
2548 | * 需要打开的卡券列表,列表内参数详见openCard 请求对象说明
2549 | */
2550 | cardList: undefined;
2551 | /**
2552 | * 接口调用成功的回调函数
2553 | */
2554 | success?: Function;
2555 | /**
2556 | * 接口调用失败的回调函数
2557 | */
2558 | fail?: Function;
2559 | /**
2560 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2561 | */
2562 | complete?: Function;
2563 | }): void;
2564 |
2565 | openSetting(obj: {
2566 | /**
2567 | * 接口调用成功的回调函数,返回内容详见返回参数说明。
2568 | */
2569 | success?: Function;
2570 | /**
2571 | * 接口调用失败的回调函数
2572 | */
2573 | fail?: Function;
2574 | /**
2575 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2576 | */
2577 | complete?: Function;
2578 | }): void;
2579 |
2580 | getSetting(obj: {
2581 | /**
2582 | * 接口调用成功的回调函数,返回内容详见返回参数说明。
2583 | */
2584 | success?: Function;
2585 | /**
2586 | * 接口调用失败的回调函数
2587 | */
2588 | fail?: Function;
2589 | /**
2590 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2591 | */
2592 | complete?: Function;
2593 | }): void;
2594 |
2595 | getWeRunData(obj: {
2596 | /**
2597 | * 接口调用成功的回调函数
2598 | */
2599 | success?: Function;
2600 | /**
2601 | * 接口调用失败的回调函数
2602 | */
2603 | fail?: Function;
2604 | /**
2605 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2606 | */
2607 | complete?: Function;
2608 | }): void;
2609 |
2610 | navigateToMiniProgram(obj: {
2611 | /**
2612 | * 要打开的小程序 appId
2613 | */
2614 | appId: string;
2615 | /**
2616 | * 打开的页面路径,如果为空则打开首页
2617 | */
2618 | path?: string;
2619 | /**
2620 | * 需要传递给目标小程序的数据,目标小程序可在 App.onLaunch(),App.onShow() 中获取到这份数据。详情
2621 | */
2622 | extraData?: any;
2623 | /**
2624 | * 要打开的小程序版本,有效值 develop(开发版),trial(体验版),release(正式版) ,仅在当前小程序为开发版或体验版时此参数有效;如果当前小程序是体验版或正式版,则打开的小程序必定是正式版。默认值 release
2625 | */
2626 | envVersion?: string;
2627 | /**
2628 | * 接口调用成功的回调函数
2629 | */
2630 | success?: Function;
2631 | /**
2632 | * 接口调用失败的回调函数
2633 | */
2634 | fail?: Function;
2635 | /**
2636 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2637 | */
2638 | complete?: Function;
2639 | }): void;
2640 |
2641 | chooseInvoiceTitle(obj: {
2642 | /**
2643 | * 接口调用成功的回调函数
2644 | */
2645 | success?: Function;
2646 | /**
2647 | * 接口调用失败的回调函数
2648 | */
2649 | fail?: Function;
2650 | /**
2651 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2652 | */
2653 | complete?: Function;
2654 | }): void;
2655 |
2656 | checkIsSupportSoterAuthentication(obj: {
2657 | /**
2658 | * 接口调用成功的回调函数
2659 | */
2660 | success?: Function;
2661 | /**
2662 | * 接口调用失败的回调函数
2663 | */
2664 | fail?: Function;
2665 | /**
2666 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2667 | */
2668 | complete?: Function;
2669 | }): void;
2670 |
2671 | // # 数据 #
2672 |
2673 | /**
2674 | * 自定义分析数据上报接口。使用前,需要在小程序管理后台自定义分析中新建事件,配置好事件名与字段。
2675 | */
2676 | reportAnalytics(eventName: string, data: string, ): void;
2677 |
2678 | // # 拓展接口 #
2679 |
2680 | arrayBufferToBase64(arrayBuffer: string): void;
2681 |
2682 | base64ToArrayBuffer(base64: string): void;
2683 |
2684 | // # 调试接口 #
2685 |
2686 | setEnableDebug(obj: {
2687 | /**
2688 | * 是否打开调试
2689 | */
2690 | enableDebug: boolean;
2691 | /**
2692 | * 接口调用成功的回调函数
2693 | */
2694 | success?: Function;
2695 | /**
2696 | * 接口调用失败的回调函数
2697 | */
2698 | fail?: Function;
2699 | /**
2700 | * 接口调用结束的回调函数(调用成功、失败都会执行)
2701 | */
2702 | complete?: Function;
2703 | }): void;
2704 |
2705 | }
--------------------------------------------------------------------------------