├── UV_Grid_Sm.jpg
├── pages
└── index
│ ├── index.json
│ ├── index.wxss
│ ├── index.wxml
│ ├── game
│ ├── TurnTable.js
│ ├── Pen.js
│ └── index.js
│ └── index.js
├── jsconfig.json
├── README.md
├── .vscode
└── settings.json
├── sitemap.json
├── .idea
├── misc.xml
├── typescript-compiler.xml
├── modules.xml
├── chachach.iml
└── workspace.xml
├── app.json
├── utils
├── utils
│ └── util.js
└── util.js
├── app.js
├── config.js
├── project.config.json
├── app.wxss
├── weui.wxss
└── typings
└── wx.d.ts
/UV_Grid_Sm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alanleung04/TrunTable/HEAD/UV_Grid_Sm.jpg
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 |
4 | },
5 | "disableScroll": true
6 | }
--------------------------------------------------------------------------------
/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2015",
4 | "module": "commonjs"
5 | }
6 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TrunTable
2 | 微信小程序webgl实现转盘游戏
3 |
4 | 博客地址:这里这里
5 |
--------------------------------------------------------------------------------
/.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.wxss:
--------------------------------------------------------------------------------
1 | .main {
2 | height: 200%;
3 | }
4 |
5 | .canvas-controller {
6 | position: fixed;
7 | width: 100%;
8 | height: 200rpx;
9 | background: #000;
10 | left: 0;
11 | bottom: 0;
12 | }
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/typescript-compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index"
4 | ],
5 | "window": {
6 | "backgroundTextStyle": "light",
7 | "navigationBarBackgroundColor": "#fff",
8 | "navigationBarTextStyle": "white",
9 | "navigationStyle": "custom"
10 | },
11 | "sitemapLocation": "sitemap.json"
12 | }
--------------------------------------------------------------------------------
/.idea/chachach.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/utils/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 |
18 | // 显示繁忙提示
19 | var showBusy = text => wx.showToast({
20 | title: text,
21 | icon: 'loading',
22 | duration: 10000
23 | })
24 |
25 | // 显示成功提示
26 | var showSuccess = text => wx.showToast({
27 | title: text,
28 | icon: 'success'
29 | })
30 |
31 | // 显示失败提示
32 | var showModel = (title, content) => {
33 | wx.hideToast();
34 |
35 | wx.showModal({
36 | title,
37 | content: JSON.stringify(content),
38 | showCancel: false
39 | })
40 | }
41 |
42 | module.exports = { formatTime, showBusy, showSuccess, showModel }
43 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | var getConfigCount = 0;
3 | var app = '';
4 |
5 | // const THREE = require('./utils/three.js')
6 | // const setting = require('./utils/setting.js')
7 | App({
8 | onLaunch: function(option) {
9 | //调用API从本地缓存中获取数据
10 | app = this;
11 |
12 |
13 | this.setNavBarConfig()
14 | // this.getShare()
15 | },
16 |
17 | SystemInfo: {},
18 |
19 | globalData: {},
20 |
21 |
22 | /**
23 | * 计算状态栏以及返回栏高度
24 | */
25 | setNavBarConfig() {
26 | getConfigCount++;
27 | if (getConfigCount >= 100) return;
28 | try {
29 | let res = wx.getSystemInfoSync();
30 | if (!res) {
31 | console.log('getConfig Fail');
32 | app.setNavBarConfig();
33 | return;
34 | }
35 |
36 | if (res.screenHeight <= 0 || res.screenWidth <= 0 || res.windowHeight <= 0 || res.windowWidth <= 0) {
37 | console.log('getConfig Fail');
38 | app.setNavBarConfig();
39 | return;
40 | }
41 |
42 | console.log('system res', res);
43 | this.SystemInfo = res;
44 |
45 | } catch (e) {
46 | console.log(e);
47 | }
48 | },
49 |
50 |
51 | });
--------------------------------------------------------------------------------
/pages/index/game/TurnTable.js:
--------------------------------------------------------------------------------
1 | const THREE = require('../../../utils/three');
2 | const Pen = require('./Pen');
3 | /**
4 | * 转盘
5 | */
6 | class TurnTable extends THREE.Group {
7 | static penTexture = null;
8 | static getTexture(canvas) {
9 | if (Pen.penTexture) {
10 | return Pen.penTexture
11 | }
12 | Pen.penTexture = new THREE.TextureLoader().load(canvas, '/UV_Grid_Sm.jpg');
13 | return Pen.penTexture
14 | }
15 | canvas = null;
16 | // type = 'table';
17 | constructor(canvas) {
18 | super()
19 |
20 | this.canvas = canvas;
21 | this.drawTurnTable();
22 | }
23 |
24 | drawTurnTable() {
25 | // 纹理
26 | let circleTexture = TurnTable.getTexture(this.canvas);
27 | let material = new THREE.MeshBasicMaterial({ map: circleTexture });
28 | // 圆
29 | let geometry = new THREE.CircleGeometry(100, 64);
30 |
31 | let turnTable = new THREE.Mesh(geometry, material);
32 | turnTable.name = 'table';
33 | turnTable.position.set(0, 0, 0);
34 | this.radius = 100;
35 | this.add(turnTable);
36 |
37 | this.position.y = 200;
38 |
39 |
40 | // console.log(this.position);
41 | }
42 | }
43 |
44 | module.exports = TurnTable;
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 | const formatCountTime = date => {
18 | const hour = date.getUTCHours()
19 | const minute = date.getMinutes()
20 | const second = date.getSeconds()
21 |
22 | return [hour, minute, second].map(formatNumber).join(':')
23 | }
24 |
25 |
26 | // 显示繁忙提示
27 | var showBusy = text => wx.showToast({
28 | title: text,
29 | icon: 'loading',
30 | duration: 10000
31 | })
32 |
33 | // 显示成功提示
34 | var showSuccess = text => wx.showToast({
35 | title: text,
36 | icon: 'success'
37 | })
38 |
39 | // 显示失败提示
40 | var showModel = (title, content) => {
41 | wx.hideToast();
42 |
43 | wx.showModal({
44 | title,
45 | content: JSON.stringify(content),
46 | showCancel: false
47 | })
48 | }
49 |
50 | module.exports = { formatTime, showBusy, showSuccess, showModel, formatCountTime }
51 |
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 小程序配置文件
3 | */
4 |
5 | // 此处主机域名修改成腾讯云解决方案分配的域名
6 | // var host = 'wy.bleege.com';
7 |
8 | // var host = 'test-wxa.bleege.com';
9 | // var host = 'se8204.bleege.com';
10 | // var host = 'cy.bleege.com';
11 | // var host = 'sunmen.bleege.com';
12 | var host = 'cy-test.bleege.com';
13 | // var host = 'kg.bleege.com';
14 | // var host = '192.168.19.214:8080';
15 |
16 | // var content = 'yinyu'
17 | var content = 'idiom'
18 | var config = {
19 |
20 | // 下面的地址配合云端 Demo 工作
21 | service: {
22 | host,
23 |
24 | hostUrl: `https://${host}/${content}/api`,
25 | // hostUrl: `http://${host}/${content}/api`,
26 | // 登录地址,用于建立会话
27 | loginUrl: `https://${host}/${content}/api/v1/bleege/login`,
28 | // loginUrl: `http://${host}/${content}/api/v1/bleege/login`,
29 | // 非授权登陆地址
30 | unionLoginUrl: `https://${host}/${content}/api/v1/bleege/unionLogin`,
31 | // unionLoginUrl: `http://${host}/${content}/api/v1/bleege/unionLogin`,
32 | // 测试的请求地址,用于测试会话
33 | requestUrl: `https://${host}/${content}/api/user`,
34 | // requestUrl: `http://${host}/${content}/api/user`,
35 |
36 | // 测试的信道服务地址1
37 | tunnelUrl: `https://${host}/${content}/api/tunnel`,
38 |
39 | // 测试的上传地址
40 | uploadUrl: `https://${host}/${content}/api/upload`,
41 |
42 | avatarUrl: `https://${host}/${content}/static/images/avatar/0.png`,
43 | reportSourceUrl: 'https://kf.bleege.com/api/mina_source/report',
44 |
45 | originalId: 'gh_ff474f6f5ce9',
46 |
47 | version: '1.0.2',
48 | },
49 |
50 | pixelRate: 0.5, //px与rpx换算关系
51 | platform: 'ios', //操作平台 用于适配胶囊高度
52 | capsuleHeight: 44, //胶囊高度
53 | statusBarHeight: 20, //手机顶部状态栏高度
54 | titleHeight: 136, //整个导航头高度
55 | systemHeight: 0, //手机屏幕高度
56 | isAllScreen: false, //是否是全面屏手机
57 | isHighHead: false, //是否是刘海屏手机
58 | windowWidth: 375,
59 | sampleRate: 44100,
60 | encodeBitRate: 64000,
61 | };
62 |
63 | module.exports = config;
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | var app = getApp();
4 | var THREE = require('../../utils/three')
5 | var requestAnimationFrame;
6 | var camera, scene, renderer;
7 | var mouseX = 0,
8 | mouseY = 0;
9 | var windowHalfX = 0;
10 | var windowHalfY = 0;
11 | var main = null;
12 | const Main = require('./game/index');
13 |
14 | Page({
15 | data: {},
16 | onLoad: function() {
17 |
18 | },
19 | onUnload() {
20 | main = null;
21 | },
22 | onReady: function() {
23 | this.setData({
24 | canvasWidth: app.SystemInfo.windowWidth * app.SystemInfo.pixelRatio,
25 | canvasHeight: (app.SystemInfo.windowHeight - 100) * app.SystemInfo.pixelRatio,
26 | canvasStyleWidth: app.SystemInfo.windowWidth + "px",
27 | canvasStyleHeight: (app.SystemInfo.windowHeight - 100) + "px",
28 | }, () => {
29 | var self = this;
30 | var query = wx.createSelectorQuery().select('#webgl').node();
31 | query.exec((res) => {
32 | let canvas = res[0].node;
33 | requestAnimationFrame = canvas.requestAnimationFrame;
34 |
35 | canvas.width = app.SystemInfo.windowWidth * app.SystemInfo.pixelRatio;
36 | canvas.height = (app.SystemInfo.windowHeight - 100) * app.SystemInfo.pixelRatio;
37 | canvas.style = {};
38 | canvas.style.width = canvas.width;
39 | canvas.style.height = canvas.height;
40 | console.log('canvas', canvas);
41 | main = new Main(canvas);
42 | });
43 | });
44 |
45 | },
46 | addPen() {
47 | main.addPen();
48 | },
49 | makePenFly() {
50 | main.makePenFly();
51 | },
52 | clear() {
53 | main.clear();
54 | },
55 |
56 | onTouchStart: function(event) {},
57 | onTouchMove: function(event) {
58 | // console.log(event);
59 | mouseX = (event.touches[0].clientX || event.touches[0].x - windowHalfX) * 3;
60 | mouseY = (event.touches[0].clientY || event.touches[0].y - windowHalfY) * 3;
61 | },
62 | onTouchEnd: function(event) {},
63 | })
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "setting": {
4 | "urlCheck": false,
5 | "es6": true,
6 | "enhance": false,
7 | "postcss": true,
8 | "minified": true,
9 | "newFeature": true,
10 | "coverView": true,
11 | "autoAudits": false,
12 | "checkInvalidKey": true,
13 | "checkSiteMap": true,
14 | "uploadWithSourceMap": true,
15 | "babelSetting": {
16 | "ignore": [],
17 | "disablePlugins": [],
18 | "outputPath": ""
19 | }
20 | },
21 | "compileType": "miniprogram",
22 | "libVersion": "2.8.0",
23 | "appid": "wxcddc17929870f018",
24 | "projectname": "%E5%8F%89%E5%8F%89%E5%8F%89github",
25 | "simulatorType": "wechat",
26 | "simulatorPluginLibVersion": {},
27 | "condition": {
28 | "search": {
29 | "current": -1,
30 | "list": []
31 | },
32 | "conversation": {
33 | "current": -1,
34 | "list": []
35 | },
36 | "plugin": {
37 | "current": -1,
38 | "list": []
39 | },
40 | "game": {
41 | "currentL": -1,
42 | "list": []
43 | },
44 | "miniprogram": {
45 | "current": 0,
46 | "list": [
47 | {
48 | "id": 0,
49 | "name": "room",
50 | "pathName": "pageRoom/pages/room/room",
51 | "query": "gameStatus=3",
52 | "scene": null
53 | },
54 | {
55 | "id": 1,
56 | "name": "startGame",
57 | "pathName": "pageRoom/pages/startGame/startGame",
58 | "query": "gameStatus=3",
59 | "scene": null
60 | },
61 | {
62 | "id": 2,
63 | "name": "好友组队",
64 | "pathName": "pageRoom/pages/room/room",
65 | "query": "gameStatus=5&date=190624&roomId=331391",
66 | "scene": null
67 | },
68 | {
69 | "id": -1,
70 | "name": "rank",
71 | "pathName": "/pages/rank/rank",
72 | "query": "",
73 | "scene": null
74 | },
75 | {
76 | "id": 4,
77 | "name": "好友组队",
78 | "pathName": "pageRoom/pages/room/room",
79 | "query": "gameStatus=0&teamId=1143363923189178370",
80 | "scene": null
81 | },
82 | {
83 | "id": -1,
84 | "name": "游戏回顾",
85 | "pathName": "pageRoom/pages/room/room",
86 | "query": "gameStatus=6",
87 | "scene": null
88 | },
89 | {
90 | "id": -1,
91 | "name": "录音测试",
92 | "pathName": "pages/room/room",
93 | "query": "",
94 | "scene": null
95 | },
96 | {
97 | "id": 7,
98 | "name": "bank",
99 | "pathName": "pages/index/index",
100 | "query": "status=3&userId=11471856",
101 | "scene": null
102 | }
103 | ]
104 | }
105 | }
106 | }
--------------------------------------------------------------------------------
/pages/index/game/Pen.js:
--------------------------------------------------------------------------------
1 | const THREE = require('../../../utils/three');
2 | const ray = new THREE.Raycaster();
3 | class Pen extends THREE.Group {
4 | canvas = null;
5 | move = false;
6 | main = null;
7 | fall = false;
8 | static penTexture = null;
9 | static getTexture(canvas) {
10 | if (Pen.penTexture) {
11 | return Pen.penTexture
12 | }
13 | Pen.penTexture = new THREE.TextureLoader().load(canvas, '/UV_Grid_Sm.jpg');
14 | return Pen.penTexture
15 | }
16 | constructor(canvas, main) {
17 | super();
18 | this.main = main;
19 | this.canvas = canvas;
20 | // console.log('here');
21 | this.drawPen();
22 | }
23 |
24 | clone() {
25 | return super.clone(false);
26 | }
27 | pen = null;
28 | drawPen() {
29 |
30 | let material = new THREE.MeshBasicMaterial({ map: Pen.getTexture(this.canvas) });
31 | let geometry = new THREE.PlaneGeometry(20, 60);
32 | let pen = new THREE.Mesh(geometry, material);
33 | this.pen = pen;
34 | pen.name = 'pen';
35 | this.add(pen);
36 | // this.matrixAutoUpdate = true;
37 | this.position.set(0, -400, -1);
38 | }
39 |
40 | reset(main, canvas, deg) {
41 | this.main = main;
42 | this.canvas = canvas;
43 | this.position.set(0, -400, -1);
44 | // let deg = this.position.z
45 | // console.log('deg', deg);
46 | this.rotateZ(deg);
47 | // this.quaternion.z = 0;
48 | // console.log(this);
49 | // this.quaternion;
50 | // this.rotation = rotation;
51 | }
52 |
53 | flyPen(object) {
54 | if (this.fall) {
55 | this.fallPen();
56 | return;
57 | }
58 | if (this.move) {
59 | this.position.y += 15;
60 | // 检测碰撞
61 | this.crashTest(object);
62 |
63 | // if (this.position.y > 0) {
64 | // this.move = false;
65 | // // this.main.penFlySuccess(100);
66 | // }
67 | }
68 | }
69 |
70 | fallPen() {
71 | // console.log('fall');
72 | this.position.y -= 35;
73 | if (this.position.y == -500) {
74 | this.fall = false;
75 | }
76 | }
77 |
78 | // 碰撞检查
79 | crashTest(object) {
80 | let originPoint = this.position.clone();
81 | originPoint.z = 100;
82 | // console.log(object);
83 | // return;
84 | for (let posIndex = 0; posIndex < this.pen.geometry.vertices.length; posIndex++) {
85 | // 原顶点坐标
86 | let localVertex = this.pen.geometry.vertices[posIndex].clone();
87 | // 对顶点坐标作变换,获取变换后的真实坐标
88 | let globalVertex = localVertex.applyMatrix4(this.pen.matrix);
89 | // 刀对象的位置,因为这里的顶点位置都是在刀对象上的,所以计算方向向量要用到刀在group中的相对位置
90 | let pen_pos = this.pen.position.clone();
91 | // 给 "高度"
92 | pen_pos.z = 100;
93 | // 坐标相减获取方向向量
94 | let directionVector = globalVertex.sub(pen_pos);
95 | // 设置射线
96 | ray.set(originPoint, directionVector.clone().normalize())
97 | // 获取相交的对象,返回是一个数组
98 | let result = ray.intersectObjects(object.children, true)
99 | console.log(result);
100 | if (result.length > 0) {
101 | this.move = false;
102 |
103 | // if (result[0].object.name == 'table') {
104 | // this.main.penFlySuccess(result[0].distance);
105 | // } else {
106 | // this.main.penFlyFail();
107 | // }
108 | break;
109 | }
110 | }
111 | }
112 | }
113 |
114 | module.exports = Pen;
--------------------------------------------------------------------------------
/pages/index/game/index.js:
--------------------------------------------------------------------------------
1 | const app = getApp();
2 | const THREE = require('../../../utils/three');
3 | const TurnTable = require('./TurnTable');
4 | const Pen = require('./Pen');
5 | var requestAnimationFrame;
6 | class GameMain {
7 | canvas = null
8 | constructor(canvas) {
9 | this.canvas = canvas;
10 | requestAnimationFrame = canvas.requestAnimationFrame;
11 | this.init(canvas);
12 | this.animate();
13 | }
14 |
15 | // 镜头
16 | camera = null;
17 | // 场景
18 | scene = null;
19 | // 灯光
20 | light = null;
21 |
22 | // 渲染器
23 | renderer = null;
24 |
25 | // 转盘
26 | turnTable = null;
27 |
28 | // 主场景
29 | mainObj = null;
30 |
31 | init(canvas) {
32 |
33 | // this.camera = new THREE.PerspectiveCamera()
34 | // 2d画面,直接用正交相机
35 | this.camera = new THREE.OrthographicCamera(canvas.width / -2, canvas.width / 2, canvas.height / 2, canvas.height / -2, 1, 500);
36 | // 设置相机位置
37 | this.camera.position.set(0, 0, 4);
38 | // 创建场景
39 | this.scene = new THREE.Scene();
40 | // 设置背景色
41 | this.scene.background = new THREE.Color(0xffffff);
42 | // 设置灯光
43 | this.light = new THREE.PointLight(0xff0000, 1, 0);
44 | this.light.position.set(200, 200, 200);
45 | // 将灯光添加到场景
46 | this.scene.add(this.light);
47 |
48 | // 转盘
49 | this.turnTable = new TurnTable(canvas);
50 | // group
51 | this.mainObj = new THREE.Group();
52 | this.mainObj.add(this.turnTable);
53 | this.scene.add(this.mainObj);
54 |
55 |
56 | this.renderer = new THREE.WebGLRenderer({ canvas: canvas, antalias: true });
57 | this.renderer.setSize(canvas.width, canvas.height);
58 | this.addPen()
59 | }
60 |
61 | clear() {
62 |
63 | this.scene.remove(this.mainObj);
64 | // this.scene.dispose();
65 | this.mainObj = null;
66 | this.turnTable = null;
67 | this.pen = null;
68 | if (this.gameStatus == 'fail') {
69 | this.restart()
70 | } else {
71 | this.gameStatus = 'restart'
72 | }
73 |
74 | }
75 |
76 | restart() {
77 | // 转盘
78 | this.gameStatus = 'start'
79 | this.turnTable = new TurnTable(this.canvas);
80 | // group
81 | this.mainObj = new THREE.Group();
82 | this.mainObj.add(this.turnTable);
83 | this.scene.add(this.mainObj);
84 | this.addPen()
85 |
86 | // this.animate();
87 | }
88 |
89 | // 碰撞一起转
90 | penFlySuccess(dis) {
91 | this.pen.move = false;
92 | this.turnTable.add(this.pen);
93 | // console.log('turnTable', this.turnTable.rotation.z);
94 | // console.log(-Math.cos(this.turnTable.rotation.z) * this.turnTable.radius);
95 |
96 | let deg = this.turnTable.rotation.z;
97 | dis = this.turnTable.radius + 15;
98 | console.log('dis', dis);
99 | this.pen.rotateZ(-deg);
100 | this.pen.position.x = -Math.sin(this.turnTable.rotation.z) * dis;
101 | // this.pen.position.y = -this.turnTable.radius;
102 | this.pen.position.y = this.pen.position.x * Math.cos(deg) / Math.sin(deg);
103 | // this.pen.position.y = -this.turnTable.radius;
104 | this.addPen(deg);
105 | }
106 |
107 | penFlyFail() {
108 | this.gameStatus = 'fail';
109 | this.pen.fall = true;
110 | this.pen.move = false;
111 | wx.showToast({
112 | title: 'gameover'
113 | })
114 | }
115 |
116 | gameStatus = 'start'
117 |
118 | // 动画
119 | animate() {
120 |
121 |
122 |
123 |
124 | let self = this;
125 | requestAnimationFrame(() => {
126 | // console.log(this);
127 | this.animate();
128 | });
129 |
130 | this.render();
131 | }
132 |
133 | render() {
134 | if (this.pen) {
135 | this.pen.flyPen(this.turnTable);
136 | }
137 |
138 | if (this.gameStatus == 'restart') {
139 | this.restart();
140 | return;
141 | }
142 | if (this.gameStatus == 'start') {
143 | if (this.turnTable) {
144 | this.turnTable.rotateZ(0.05);
145 | }
146 | }
147 |
148 |
149 | // 弧度deg
150 |
151 | // this.pen.rotateZ(0.02);
152 | // console.log(this.turnTable.position)
153 | // this.turnTable.translateZ(0.02);
154 | // this.turnTable.position.x += 1;
155 | this.renderer.render(this.scene, this.camera);
156 | }
157 |
158 | //
159 | pen = null;
160 | penList = [];
161 | // 加刀
162 |
163 | addPen(deg = 0) {
164 | if (this.pen) {
165 | let pen = this.pen.clone()
166 | this.pen = pen;
167 | this.pen.reset(this, this.canvas, deg);
168 | this.mainObj.add(this.pen);
169 | return;
170 | }
171 | this.pen = new Pen(this.canvas, this);
172 | this.mainObj.add(this.pen);
173 | // this.penList.push(this.pen);
174 | }
175 |
176 | // 飞刀
177 | makePenFly() {
178 | this.pen.move = true;
179 | }
180 | }
181 |
182 | module.exports = GameMain;
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 |
3 | /**app.wxss**/
4 | @import 'weui.wxss';
5 |
6 | .container {
7 | height: 100%;
8 | display: flex;
9 | flex-direction: column;
10 | /* align-items: center; *//* justify-content: space-between; *//* padding: 200rpx 20rpx; */
11 | box-sizing: border-box;
12 | }
13 |
14 | .main-bg {
15 | width: 100%;
16 | position: fixed;
17 | bottom: 0;
18 | z-index: -1;
19 | left: 0;
20 | }
21 |
22 | page {
23 | /*background-color: #fbf9fe !important;*/
24 | background-color: #f2f2f2 !important;
25 | /* background-color: #f5f6f5 ; */
26 | height: 100%;
27 | font-family: Microsoft YaHei;
28 | }
29 |
30 | .page-body {
31 | width: 100%;
32 | flex-grow: 1;
33 | overflow-x: hidden;
34 | }
35 |
36 | .page-foot {
37 | padding: 0 0 34rpx 0;
38 | text-align: center;
39 | color: #1aad19;
40 | font-size: 0;
41 | }
42 |
43 | .foot2 {
44 | color: #586c94;
45 | font-size: 26rpx;
46 | display: inline-block;
47 | }
48 |
49 | .foot1 {
50 | margin: 0 auto;
51 | color: #888;
52 | font-size: 24rpx;
53 | }
54 |
55 | .content-container {
56 | height: 100%;
57 | display: flex;
58 | display: -webkit-flex;
59 | flex-direction: column;
60 | -webkit-flex-direction: column;
61 | }
62 |
63 | .content-body {
64 | flex-grow: 1;
65 | -webkit-flex-grow: 1;
66 | }
67 |
68 | .torecord {
69 | color: #586c94;
70 | font-size: 28rpx;
71 | display: inline-block;
72 | }
73 |
74 | .descript {
75 | margin: 0 auto;
76 | color: #888;
77 | font-size: 28rpx;
78 | }
79 |
80 | /* authorization modal */
81 |
82 | .auth-container {
83 | position: absolute;
84 | height: 100%;
85 | width: 100%;
86 | left: 0;
87 | top: 0;
88 | background: rgba(0, 0, 0, 0.75);
89 | z-index: 900;
90 | display: flex;
91 | flex-direction: column;
92 | justify-content: center;
93 | align-items: center;
94 | }
95 |
96 | .auth-modal-container {
97 | margin: -64rpx 90rpx 0;
98 | background-color: white;
99 | border-radius: 8rpx;
100 | position: relative;
101 | }
102 |
103 | .auth-modal-title {
104 | font-size: 36rpx;
105 | color: black;
106 | font-weight: bold;
107 | height: 100rpx;
108 | line-height: 100rpx;
109 | text-align: center;
110 | border-bottom: 1rpx solid #eaeaea;
111 | }
112 |
113 | .auth-modal-content {
114 | margin-top: 42rpx;
115 | padding: 0 48rpx;
116 | font-size: 34rpx;
117 | color: #333;
118 | text-align: left;
119 | line-height: 1.5;
120 | }
121 |
122 | .auth-modal-content-tips {
123 | margin-top: 20rpx;
124 | padding: 0 48rpx;
125 | font-size: 30rpx;
126 | color: #ccc;
127 | text-align: left;
128 | line-height: 1.4;
129 | }
130 |
131 | .auth-btn-container {
132 | width: 100%;
133 | text-align: center;
134 | padding-bottom: 16rpx;
135 | margin-top: 42rpx;
136 | }
137 |
138 | .modal-auth-button {
139 | font-size: 34rpx !important;
140 | margin: 0 48rpx !important;
141 | font-weight: bold;
142 | }
143 |
144 | /* .song-list{
145 | style="padding-bottom:64rpx;"
146 | } */
147 |
148 | .song-info {
149 | display: flex;
150 | justify-content: space-between;
151 | border-bottom: 1rpx solid rgba(224, 224, 224, 0.6);
152 | padding: 30rpx 0 30rpx 0;
153 | align-items: center;
154 | overflow: visible;
155 | }
156 |
157 | .song-colunm {
158 | display: flex;
159 | flex-direction: column;
160 | }
161 |
162 | .song-row {
163 | display: flex;
164 | align-items: baseline;
165 | line-height: 1;
166 | overflow: hidden;
167 | text-overflow: ellipsis;
168 | white-space: nowrap;
169 | }
170 |
171 | .song-lyrics-row {
172 | display: block !important;
173 | margin-top: 26rpx;
174 | line-height: 36rpx;
175 | }
176 |
177 | .song-lyrics {
178 | font-size: 26rpx;
179 | color: #a5a5a5;
180 | }
181 |
182 | .song-title {
183 | display: flex;
184 | align-items: baseline;
185 | font-size: 30rpx;
186 | color: #333;
187 | /* line-height: 34rpx; */
188 | height: 34rpx;
189 | }
190 |
191 | .song-listen {
192 | display: flex;
193 | font-size: 26rpx;
194 | padding: 0 20rpx;
195 | align-items: center;
196 | }
197 |
198 | .ic-play-btn {
199 | width: 16rpx;
200 | height: 20rpx;
201 | display: flex;
202 | /* margin-top: 10rpx; */
203 | margin-left: 8rpx;
204 | }
205 |
206 | .ic-pause-btn {
207 | width: 23rpx;
208 | height: 23rpx;
209 | /* display: flex; */
210 | margin-top: 9rpx;
211 | margin-left: 8rpx;
212 | }
213 |
214 | .song-lyrics {
215 | font-size: 26rpx;
216 | color: #a5a5a5;
217 | margin-right: 20rpx;
218 | }
219 |
220 | .song-artist {
221 | color: #ccc;
222 | font-size: 26rpx;
223 | margin-left: 10rpx;
224 | }
225 |
226 | .listen {
227 | display: flex;
228 | font-size: 26rpx;
229 | color: #efa150;
230 | line-height: 1;
231 | }
232 |
233 | .song-right {
234 | display: flex;
235 | align-items: center;
236 | height: 100%;
237 | /* width: 80rpx; */
238 | position: relative;
239 | }
240 |
241 | .songlist-add, .songlist-del {
242 | display: flex;
243 | }
244 |
245 | .song-left {
246 | width: 600rpx;
247 | }
248 |
249 | .song-name {
250 | max-width: 290rpx;
251 | overflow: hidden;
252 | text-overflow: ellipsis;
253 | white-space: nowrap;
254 | }
255 |
256 | .ic-song-chose {
257 | height: 52rpx;
258 | width: 52rpx;
259 | }
260 |
261 | .bottom-bar {
262 | position: fixed;
263 | left: 0;
264 | bottom: -110rpx;
265 | z-index: 1003;
266 | height: 110rpx;
267 | width: 100%;
268 | background: #f5535e;
269 | display: flex;
270 | justify-content: space-between;
271 | align-items: center;
272 | transition: all 0.5s ease;
273 | }
274 |
275 | .bar-ani {
276 | bottom: 0;
277 | }
278 |
279 | .bar-left {
280 | display: flex;
281 | justify-content: center;
282 | align-items: center;
283 | position: relative;
284 | width: 162rpx;
285 | height: 100%;
286 | background: #ffd666;
287 | }
288 |
289 | .bar-right {
290 | /* display: flex; */
291 | justify-content: center;
292 | align-items: center;
293 | flex: 1;
294 | height: 100%;
295 | color: #fff;
296 | font-size: 36rpx;
297 | }
298 |
299 | .ic-song-chose {
300 | height: 52rpx;
301 | width: 52rpx;
302 | }
303 |
304 | .chose-song-num {
305 | position: absolute;
306 | left: 106rpx;
307 | top: 22rpx;
308 | background-color: #f5535e;
309 | color: #fff;
310 | height: 28rpx;
311 | width: 28rpx;
312 | border-radius: 50%;
313 | text-align: center;
314 | line-height: 28rpx;
315 | font-size: 20rpx;
316 | }
317 |
318 | .select-list-mask {
319 | position: fixed;
320 | top: 0;
321 | left: 0;
322 | z-index: 1001;
323 | height: 100%;
324 | width: 100%;
325 | background: rgba(0, 0, 0, 0.6);
326 | }
327 |
328 | .select-list-box {
329 | position: fixed;
330 | bottom: 110rpx;
331 | left: 0;
332 | z-index: 1002;
333 | width: 100%;
334 | max-height: 100%;
335 | background: #fff;
336 | border-radius: 20rpx 20rpx 0 0;
337 | box-sizing: border-box;
338 | transition: all 0.3s linear;
339 | transform: translate3d(0, 140%, 0);
340 | }
341 |
342 | .select-list-bot {
343 | padding-bottom: 0;
344 | }
345 |
346 | .select-box-tip {
347 | font-size: 26rpx;
348 | color: #ccc;
349 | height: 80rpx;
350 | text-align: center;
351 | line-height: 80rpx;
352 | /* text-align: center; */
353 | }
354 |
355 | .navbar-div {
356 | flex: 1;
357 | position: absolute;
358 | width: 100%;
359 | top: 96rpx;
360 | left: 0;
361 | bottom: 0;
362 | right: 0;
363 | }
364 |
365 | .word-area {
366 | /* padding-left: 32rpx; */
367 | padding-top: 0;
368 | padding-bottom: 0;
369 | box-sizing: border-box;
370 | }
371 |
372 | .word-item {
373 | border: 0 !important;
374 | display: flex;
375 | padding: 40rpx 32rpx;
376 | }
377 |
378 | .container-bg {
379 | position: fixed;
380 | top: 0;
381 | bottom: 0;
382 | left: 0;
383 | right: 0;
384 | width: 100%;
385 | height: 100%;
386 | z-index: -1;
387 | background: #23174f;
388 | }
389 |
390 | .bg-t {
391 | position: absolute;
392 | top: 0;
393 | width: 100%;
394 | }
395 |
396 | .bg-b {
397 | position: absolute;
398 | bottom: 0;
399 | width: 100%;
400 | }
401 |
402 | .default-btn {
403 | padding: 0;
404 | margin: 0;
405 | border-radius: 0;
406 | background-color: transparent;
407 | }
408 |
409 | .default-btn::after {
410 | border: none;
411 | padding: 0;
412 | margin: 0;
413 | background: none;
414 | }
415 |
416 | .btn-click {
417 | transform: scale(0.9, 0.9)!important;
418 | opacity: 0.9!important
419 | }
420 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | mesh
64 | renderer
65 |
66 |
67 |
68 |
76 |
77 |
78 |
79 |
80 | true
81 | DEFINITION_ORDER
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 | 1566207750831
143 |
144 |
145 | 1566207750831
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
--------------------------------------------------------------------------------
/weui.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * weui.js v1.1.0 (https://github.com/weui/weui-wxss)
3 | * Copyright 2016, wechat ui team
4 | * MIT license
5 | */
6 | page {
7 | line-height: 1.6;
8 | font-family: -apple-system-font, "Helvetica Neue", sans-serif;
9 | }
10 | icon {
11 | vertical-align: middle;
12 | }
13 | .weui-cells {
14 | position: relative;
15 | margin-top: 1.17647059em;
16 | background-color: #FFFFFF;
17 | line-height: 1.41176471;
18 | font-size: 17px;
19 | }
20 | .weui-cells:before {
21 | content: " ";
22 | position: absolute;
23 | left: 0;
24 | top: 0;
25 | right: 0;
26 | height: 1px;
27 | border-top: 1rpx solid #D9D9D9;
28 | color: #D9D9D9;
29 | }
30 | .weui-cells:after {
31 | content: " ";
32 | position: absolute;
33 | left: 0;
34 | bottom: 0;
35 | right: 0;
36 | height: 1px;
37 | border-bottom: 1rpx solid #D9D9D9;
38 | color: #D9D9D9;
39 | }
40 | .weui-cells__title {
41 | margin-top: .77em;
42 | margin-bottom: .3em;
43 | padding-left: 15px;
44 | padding-right: 15px;
45 | color: #999999;
46 | font-size: 14px;
47 | }
48 | .weui-cells_after-title {
49 | margin-top: 0;
50 | }
51 | .weui-cells__tips {
52 | margin-top: .3em;
53 | color: #999999;
54 | padding-left: 15px;
55 | padding-right: 15px;
56 | font-size: 14px;
57 | }
58 | .weui-cell {
59 | padding: 10px 15px;
60 | position: relative;
61 | display: -webkit-box;
62 | display: -webkit-flex;
63 | display: flex;
64 | -webkit-box-align: center;
65 | -webkit-align-items: center;
66 | align-items: center;
67 | }
68 | .weui-cell:before {
69 | content: " ";
70 | position: absolute;
71 | left: 0;
72 | top: 0;
73 | right: 0;
74 | height: 1px;
75 | border-top: 1rpx solid #D9D9D9;
76 | color: #D9D9D9;
77 | left: 15px;
78 | }
79 | .weui-cell:first-child:before {
80 | display: none;
81 | }
82 | .weui-cell_active {
83 | background-color: #ECECEC;
84 | }
85 | .weui-cell_primary {
86 | -webkit-box-align: start;
87 | -webkit-align-items: flex-start;
88 | align-items: flex-start;
89 | }
90 | .weui-cell__bd {
91 | -webkit-box-flex: 1;
92 | -webkit-flex: 1;
93 | flex: 1;
94 | }
95 | .weui-cell__ft {
96 | text-align: right;
97 | color: #999999;
98 | }
99 | .weui-cell_access {
100 | color: inherit;
101 | }
102 | .weui-cell__ft_in-access {
103 | padding-right: 13px;
104 | position: relative;
105 | }
106 | .weui-cell__ft_in-access:after {
107 | content: " ";
108 | display: inline-block;
109 | height: 6px;
110 | width: 6px;
111 | border-width: 2px 2px 0 0;
112 | border-color: #C8C8CD;
113 | border-style: solid;
114 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
115 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
116 | position: relative;
117 | top: -2px;
118 | position: absolute;
119 | top: 50%;
120 | margin-top: -4px;
121 | right: 2px;
122 | }
123 | .weui-cell_link {
124 | color: #586C94;
125 | font-size: 14px;
126 | }
127 | .weui-cell_link:active {
128 | background-color: #ECECEC;
129 | }
130 | .weui-cell_link:first-child:before {
131 | display: block;
132 | }
133 | .weui-icon-radio {
134 | margin-left: 3.2px;
135 | margin-right: 3.2px;
136 | }
137 | .weui-icon-checkbox_circle,
138 | .weui-icon-checkbox_success {
139 | margin-left: 4.6px;
140 | margin-right: 4.6px;
141 | }
142 | .weui-check__label:active {
143 | background-color: #ECECEC;
144 | }
145 | .weui-check {
146 | position: absolute;
147 | left: -9999px;
148 | }
149 | .weui-check__hd_in-checkbox {
150 | padding-right: 0.35em;
151 | }
152 | .weui-cell__ft_in-radio {
153 | padding-left: 0.35em;
154 | }
155 | .weui-cell_input {
156 | padding-top: 0;
157 | padding-bottom: 0;
158 | }
159 | .weui-label {
160 | width: 105px;
161 | word-wrap: break-word;
162 | word-break: break-all;
163 | }
164 | .weui-input {
165 | height: 2.58823529em;
166 | min-height: 2.58823529em;
167 | line-height: 2.58823529em;
168 | }
169 | .weui-toptips {
170 | position: fixed;
171 | -webkit-transform: translateZ(0);
172 | transform: translateZ(0);
173 | top: 0;
174 | left: 0;
175 | right: 0;
176 | padding: 5px;
177 | font-size: 14px;
178 | text-align: center;
179 | color: #FFFFFF;
180 | z-index: 5000;
181 | word-wrap: break-word;
182 | word-break: break-all;
183 | }
184 | .weui-toptips_warn {
185 | background-color: #E64340;
186 | }
187 | .weui-textarea {
188 | display: block;
189 | width: 100%;
190 | }
191 | .weui-textarea-counter {
192 | color: #B2B2B2;
193 | text-align: right;
194 | }
195 | .weui-textarea-counter_warn {
196 | color: #E64340;
197 | }
198 | .weui-cell_warn {
199 | color: #E64340;
200 | }
201 | .weui-form-preview {
202 | position: relative;
203 | background-color: #FFFFFF;
204 | }
205 | .weui-form-preview:before {
206 | content: " ";
207 | position: absolute;
208 | left: 0;
209 | top: 0;
210 | right: 0;
211 | height: 1px;
212 | border-top: 1rpx solid #D9D9D9;
213 | color: #D9D9D9;
214 | }
215 | .weui-form-preview:after {
216 | content: " ";
217 | position: absolute;
218 | left: 0;
219 | bottom: 0;
220 | right: 0;
221 | height: 1px;
222 | border-bottom: 1rpx solid #D9D9D9;
223 | color: #D9D9D9;
224 | }
225 | .weui-form-preview__value {
226 | font-size: 14px;
227 | }
228 | .weui-form-preview__value_in-hd {
229 | font-size: 26px;
230 | }
231 | .weui-form-preview__hd {
232 | position: relative;
233 | padding: 10px 15px;
234 | text-align: right;
235 | line-height: 2.5em;
236 | }
237 | .weui-form-preview__hd:after {
238 | content: " ";
239 | position: absolute;
240 | left: 0;
241 | bottom: 0;
242 | right: 0;
243 | height: 1px;
244 | border-bottom: 1rpx solid #D9D9D9;
245 | color: #D9D9D9;
246 | left: 15px;
247 | }
248 | .weui-form-preview__bd {
249 | padding: 10px 15px;
250 | font-size: .9em;
251 | text-align: right;
252 | color: #999999;
253 | line-height: 2;
254 | }
255 | .weui-form-preview__ft {
256 | position: relative;
257 | line-height: 50px;
258 | display: -webkit-box;
259 | display: -webkit-flex;
260 | display: flex;
261 | }
262 | .weui-form-preview__ft:after {
263 | content: " ";
264 | position: absolute;
265 | left: 0;
266 | top: 0;
267 | right: 0;
268 | height: 1px;
269 | border-top: 1rpx solid #D5D5D6;
270 | color: #D5D5D6;
271 | }
272 | .weui-form-preview__item {
273 | overflow: hidden;
274 | }
275 | .weui-form-preview__label {
276 | float: left;
277 | margin-right: 1em;
278 | min-width: 4em;
279 | color: #999999;
280 | text-align: justify;
281 | text-align-last: justify;
282 | }
283 | .weui-form-preview__value {
284 | display: block;
285 | overflow: hidden;
286 | word-break: normal;
287 | word-wrap: break-word;
288 | }
289 | .weui-form-preview__btn {
290 | position: relative;
291 | display: block;
292 | -webkit-box-flex: 1;
293 | -webkit-flex: 1;
294 | flex: 1;
295 | color: #3CC51F;
296 | text-align: center;
297 | }
298 | .weui-form-preview__btn:after {
299 | content: " ";
300 | position: absolute;
301 | left: 0;
302 | top: 0;
303 | width: 1px;
304 | bottom: 0;
305 | border-left: 1rpx solid #D5D5D6;
306 | color: #D5D5D6;
307 | }
308 | .weui-form-preview__btn:first-child:after {
309 | display: none;
310 | }
311 | .weui-form-preview__btn_active {
312 | background-color: #EEEEEE;
313 | }
314 | .weui-form-preview__btn_default {
315 | color: #999999;
316 | }
317 | .weui-form-preview__btn_primary {
318 | color: #0BB20C;
319 | }
320 | .weui-cell_select {
321 | padding: 0;
322 | }
323 | .weui-select {
324 | position: relative;
325 | padding-left: 15px;
326 | padding-right: 30px;
327 | height: 2.58823529em;
328 | min-height: 2.58823529em;
329 | line-height: 2.58823529em;
330 | border-right: 1rpx solid #D9D9D9;
331 | }
332 | .weui-select:before {
333 | content: " ";
334 | display: inline-block;
335 | height: 6px;
336 | width: 6px;
337 | border-width: 2px 2px 0 0;
338 | border-color: #C8C8CD;
339 | border-style: solid;
340 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
341 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
342 | position: relative;
343 | top: -2px;
344 | position: absolute;
345 | top: 50%;
346 | right: 15px;
347 | margin-top: -4px;
348 | }
349 | .weui-select_in-select-after {
350 | padding-left: 0;
351 | }
352 | .weui-cell__hd_in-select-after,
353 | .weui-cell__bd_in-select-before {
354 | padding-left: 15px;
355 | }
356 | .weui-cell_vcode {
357 | padding-right: 0;
358 | }
359 | .weui-vcode-img {
360 | margin-left: 5px;
361 | height: 2.58823529em;
362 | vertical-align: middle;
363 | }
364 | .weui-vcode-btn {
365 | display: inline-block;
366 | height: 2.58823529em;
367 | margin-left: 5px;
368 | padding: 0 0.6em 0 0.7em;
369 | border-left: 1px solid #E5E5E5;
370 | line-height: 2.58823529em;
371 | vertical-align: middle;
372 | font-size: 17px;
373 | color: #3CC51F;
374 | white-space: nowrap;
375 | }
376 | .weui-vcode-btn:active {
377 | color: #52a341;
378 | }
379 | .weui-cell_switch {
380 | padding-top: 6px;
381 | padding-bottom: 6px;
382 | }
383 | .weui-uploader__hd {
384 | display: -webkit-box;
385 | display: -webkit-flex;
386 | display: flex;
387 | padding-bottom: 10px;
388 | -webkit-box-align: center;
389 | -webkit-align-items: center;
390 | align-items: center;
391 | }
392 | .weui-uploader__title {
393 | -webkit-box-flex: 1;
394 | -webkit-flex: 1;
395 | flex: 1;
396 | }
397 | .weui-uploader__info {
398 | color: #B2B2B2;
399 | }
400 | .weui-uploader__bd {
401 | margin-bottom: -4px;
402 | margin-right: -9px;
403 | overflow: hidden;
404 | }
405 | .weui-uploader__file {
406 | float: left;
407 | margin-right: 9px;
408 | margin-bottom: 9px;
409 | }
410 | .weui-uploader__img {
411 | display: block;
412 | width: 79px;
413 | height: 79px;
414 | }
415 | .weui-uploader__file_status {
416 | position: relative;
417 | }
418 | .weui-uploader__file_status:before {
419 | content: " ";
420 | position: absolute;
421 | top: 0;
422 | right: 0;
423 | bottom: 0;
424 | left: 0;
425 | background-color: rgba(0, 0, 0, 0.5);
426 | }
427 | .weui-uploader__file-content {
428 | position: absolute;
429 | top: 50%;
430 | left: 50%;
431 | -webkit-transform: translate(-50%, -50%);
432 | transform: translate(-50%, -50%);
433 | color: #FFFFFF;
434 | }
435 | .weui-uploader__input-box {
436 | float: left;
437 | position: relative;
438 | margin-right: 9px;
439 | margin-bottom: 9px;
440 | width: 77px;
441 | height: 77px;
442 | border: 1px solid #D9D9D9;
443 | }
444 | .weui-uploader__input-box:before,
445 | .weui-uploader__input-box:after {
446 | content: " ";
447 | position: absolute;
448 | top: 50%;
449 | left: 50%;
450 | -webkit-transform: translate(-50%, -50%);
451 | transform: translate(-50%, -50%);
452 | background-color: #D9D9D9;
453 | }
454 | .weui-uploader__input-box:before {
455 | width: 2px;
456 | height: 39.5px;
457 | }
458 | .weui-uploader__input-box:after {
459 | width: 39.5px;
460 | height: 2px;
461 | }
462 | .weui-uploader__input-box:active {
463 | border-color: #999999;
464 | }
465 | .weui-uploader__input-box:active:before,
466 | .weui-uploader__input-box:active:after {
467 | background-color: #999999;
468 | }
469 | .weui-uploader__input {
470 | position: absolute;
471 | z-index: 1;
472 | top: 0;
473 | left: 0;
474 | width: 100%;
475 | height: 100%;
476 | opacity: 0;
477 | }
478 | .weui-article {
479 | padding: 20px 15px;
480 | font-size: 15px;
481 | }
482 | .weui-article__section {
483 | margin-bottom: 1.5em;
484 | }
485 | .weui-article__h1 {
486 | font-size: 18px;
487 | font-weight: 400;
488 | margin-bottom: .9em;
489 | }
490 | .weui-article__h2 {
491 | font-size: 16px;
492 | font-weight: 400;
493 | margin-bottom: .34em;
494 | }
495 | .weui-article__h3 {
496 | font-weight: 400;
497 | font-size: 15px;
498 | margin-bottom: .34em;
499 | }
500 | .weui-article__p {
501 | margin: 0 0 .8em;
502 | }
503 | .weui-msg {
504 | padding-top: 36px;
505 | text-align: center;
506 | }
507 | .weui-msg__link {
508 | display: inline;
509 | color: #586C94;
510 | }
511 | .weui-msg__icon-area {
512 | margin-bottom: 30px;
513 | }
514 | .weui-msg__text-area {
515 | margin-bottom: 25px;
516 | padding: 0 20px;
517 | }
518 | .weui-msg__title {
519 | margin-bottom: 5px;
520 | font-weight: 400;
521 | font-size: 20px;
522 | }
523 | .weui-msg__desc {
524 | font-size: 14px;
525 | color: #999999;
526 | }
527 | .weui-msg__opr-area {
528 | margin-bottom: 25px;
529 | }
530 | .weui-msg__extra-area {
531 | margin-bottom: 15px;
532 | font-size: 14px;
533 | color: #999999;
534 | }
535 | @media screen and (min-height: 438px) {
536 | .weui-msg__extra-area {
537 | position: fixed;
538 | left: 0;
539 | bottom: 0;
540 | width: 100%;
541 | text-align: center;
542 | }
543 | }
544 | .weui-flex {
545 | display: -webkit-box;
546 | display: -webkit-flex;
547 | display: flex;
548 | }
549 | .weui-flex__item {
550 | -webkit-box-flex: 1;
551 | -webkit-flex: 1;
552 | flex: 1;
553 | }
554 | .weui-btn {
555 | margin-top: 15px;
556 | }
557 | .weui-btn:first-child {
558 | margin-top: 0;
559 | }
560 | .weui-btn-area {
561 | margin: 1.17647059em 15px 0.3em;
562 | }
563 | .weui-agree {
564 | display: block;
565 | padding: .5em 15px;
566 | font-size: 13px;
567 | }
568 | .weui-agree__text {
569 | color: #999999;
570 | }
571 | .weui-agree__link {
572 | display: inline;
573 | color: #586C94;
574 | }
575 | .weui-agree__checkbox {
576 | position: absolute;
577 | left: -9999px;
578 | }
579 | .weui-agree__checkbox-icon {
580 | position: relative;
581 | top: 2px;
582 | display: inline-block;
583 | border: 1px solid #D1D1D1;
584 | background-color: #FFFFFF;
585 | border-radius: 3px;
586 | width: 11px;
587 | height: 11px;
588 | }
589 | .weui-agree__checkbox-icon-check {
590 | position: absolute;
591 | top: 1px;
592 | left: 1px;
593 | }
594 | .weui-footer {
595 | color: #999999;
596 | font-size: 14px;
597 | text-align: center;
598 | }
599 | .weui-footer_fixed-bottom {
600 | position: fixed;
601 | bottom: .52em;
602 | left: 0;
603 | right: 0;
604 | }
605 | .weui-footer__links {
606 | font-size: 0;
607 | }
608 | .weui-footer__link {
609 | display: inline-block;
610 | vertical-align: top;
611 | margin: 0 .62em;
612 | position: relative;
613 | font-size: 14px;
614 | color: #586C94;
615 | }
616 | .weui-footer__link:before {
617 | content: " ";
618 | position: absolute;
619 | left: 0;
620 | top: 0;
621 | width: 1px;
622 | bottom: 0;
623 | border-left: 1rpx solid #C7C7C7;
624 | color: #C7C7C7;
625 | left: -0.65em;
626 | top: .36em;
627 | bottom: .36em;
628 | }
629 | .weui-footer__link:first-child:before {
630 | display: none;
631 | }
632 | .weui-footer__text {
633 | padding: 0 .34em;
634 | font-size: 12px;
635 | }
636 | .weui-grids {
637 | border-top: 1rpx solid #D9D9D9;
638 | border-left: 1rpx solid #D9D9D9;
639 | overflow: hidden;
640 | }
641 | .weui-grid {
642 | position: relative;
643 | float: left;
644 | padding: 20px 10px;
645 | width: 33.33333333%;
646 | box-sizing: border-box;
647 | border-right: 1rpx solid #D9D9D9;
648 | border-bottom: 1rpx solid #D9D9D9;
649 | }
650 | .weui-grid_active {
651 | background-color: #ECECEC;
652 | }
653 | .weui-grid__icon {
654 | display: block;
655 | width: 28px;
656 | height: 28px;
657 | margin: 0 auto;
658 | }
659 | .weui-grid__label {
660 | margin-top: 5px;
661 | display: block;
662 | text-align: center;
663 | color: #000000;
664 | font-size: 14px;
665 | white-space: nowrap;
666 | text-overflow: ellipsis;
667 | overflow: hidden;
668 | }
669 | .weui-loading {
670 | margin: 0 5px;
671 | width: 20px;
672 | height: 20px;
673 | display: inline-block;
674 | vertical-align: middle;
675 | -webkit-animation: weuiLoading 1s steps(12, end) infinite;
676 | animation: weuiLoading 1s steps(12, end) infinite;
677 | background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;
678 | background-size: 100%;
679 | }
680 | @-webkit-keyframes weuiLoading {
681 | 0% {
682 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
683 | transform: rotate3d(0, 0, 1, 0deg);
684 | }
685 | 100% {
686 | -webkit-transform: rotate3d(0, 0, 1, 360deg);
687 | transform: rotate3d(0, 0, 1, 360deg);
688 | }
689 | }
690 | @keyframes weuiLoading {
691 | 0% {
692 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
693 | transform: rotate3d(0, 0, 1, 0deg);
694 | }
695 | 100% {
696 | -webkit-transform: rotate3d(0, 0, 1, 360deg);
697 | transform: rotate3d(0, 0, 1, 360deg);
698 | }
699 | }
700 | .weui-badge {
701 | display: inline-block;
702 | padding: .15em .4em;
703 | min-width: 8px;
704 | border-radius: 18px;
705 | background-color: #F43530;
706 | color: #FFFFFF;
707 | line-height: 1.2;
708 | text-align: center;
709 | font-size: 12px;
710 | vertical-align: middle;
711 | }
712 | .weui-badge_dot {
713 | padding: .4em;
714 | min-width: 0;
715 | }
716 | .weui-loadmore {
717 | width: 65%;
718 | margin: 1.5em auto;
719 | line-height: 1.6em;
720 | font-size: 14px;
721 | text-align: center;
722 | }
723 | .weui-loadmore__tips {
724 | display: inline-block;
725 | vertical-align: middle;
726 | }
727 | .weui-loadmore_line {
728 | border-top: 1px solid #E5E5E5;
729 | margin-top: 2.4em;
730 | }
731 | .weui-loadmore__tips_in-line {
732 | position: relative;
733 | top: -0.9em;
734 | padding: 0 .55em;
735 | background-color: #FFFFFF;
736 | color: #999999;
737 | }
738 | .weui-loadmore__tips_in-dot {
739 | position: relative;
740 | padding: 0 .16em;
741 | width: 4px;
742 | height: 1.6em;
743 | }
744 | .weui-loadmore__tips_in-dot:before {
745 | content: " ";
746 | position: absolute;
747 | top: 50%;
748 | left: 50%;
749 | margin-top: -1px;
750 | margin-left: -2px;
751 | width: 4px;
752 | height: 4px;
753 | border-radius: 50%;
754 | background-color: #E5E5E5;
755 | }
756 | .weui-panel {
757 | background-color: #FFFFFF;
758 | margin-top: 10px;
759 | position: relative;
760 | overflow: hidden;
761 | }
762 | .weui-panel:first-child {
763 | margin-top: 0;
764 | }
765 | .weui-panel:before {
766 | content: " ";
767 | position: absolute;
768 | left: 0;
769 | top: 0;
770 | right: 0;
771 | height: 1px;
772 | border-top: 1rpx solid #E5E5E5;
773 | color: #E5E5E5;
774 | }
775 | .weui-panel:after {
776 | content: " ";
777 | position: absolute;
778 | left: 0;
779 | bottom: 0;
780 | right: 0;
781 | height: 1px;
782 | border-bottom: 1rpx solid #E5E5E5;
783 | color: #E5E5E5;
784 | }
785 | .weui-panel__hd {
786 | padding: 14px 15px 10px;
787 | color: #999999;
788 | font-size: 13px;
789 | position: relative;
790 | }
791 | .weui-panel__hd:after {
792 | content: " ";
793 | position: absolute;
794 | left: 0;
795 | bottom: 0;
796 | right: 0;
797 | height: 1px;
798 | border-bottom: 1rpx solid #E5E5E5;
799 | color: #E5E5E5;
800 | left: 15px;
801 | }
802 | .weui-media-box {
803 | padding: 15px;
804 | position: relative;
805 | }
806 | .weui-media-box:before {
807 | content: " ";
808 | position: absolute;
809 | left: 0;
810 | top: 0;
811 | right: 0;
812 | height: 1px;
813 | border-top: 1rpx solid #E5E5E5;
814 | color: #E5E5E5;
815 | left: 15px;
816 | }
817 | .weui-media-box:first-child:before {
818 | display: none;
819 | }
820 | .weui-media-box__title {
821 | font-weight: 400;
822 | font-size: 17px;
823 | width: auto;
824 | overflow: hidden;
825 | text-overflow: ellipsis;
826 | white-space: nowrap;
827 | word-wrap: normal;
828 | word-wrap: break-word;
829 | word-break: break-all;
830 | }
831 | .weui-media-box__desc {
832 | color: #999999;
833 | font-size: 13px;
834 | line-height: 1.2;
835 | overflow: hidden;
836 | text-overflow: ellipsis;
837 | display: -webkit-box;
838 | -webkit-box-orient: vertical;
839 | -webkit-line-clamp: 2;
840 | }
841 | .weui-media-box__info {
842 | margin-top: 15px;
843 | padding-bottom: 5px;
844 | font-size: 13px;
845 | color: #CECECE;
846 | line-height: 1em;
847 | list-style: none;
848 | overflow: hidden;
849 | }
850 | .weui-media-box__info__meta {
851 | float: left;
852 | padding-right: 1em;
853 | }
854 | .weui-media-box__info__meta_extra {
855 | padding-left: 1em;
856 | border-left: 1px solid #CECECE;
857 | }
858 | .weui-media-box__title_in-text {
859 | margin-bottom: 8px;
860 | }
861 | .weui-media-box_appmsg {
862 | display: -webkit-box;
863 | display: -webkit-flex;
864 | display: flex;
865 | -webkit-box-align: center;
866 | -webkit-align-items: center;
867 | align-items: center;
868 | }
869 | .weui-media-box__thumb {
870 | width: 100%;
871 | height: 100%;
872 | vertical-align: top;
873 | }
874 | .weui-media-box__hd_in-appmsg {
875 | margin-right: .8em;
876 | width: 60px;
877 | height: 60px;
878 | line-height: 60px;
879 | text-align: center;
880 | }
881 | .weui-media-box__bd_in-appmsg {
882 | -webkit-box-flex: 1;
883 | -webkit-flex: 1;
884 | flex: 1;
885 | min-width: 0;
886 | }
887 | .weui-media-box_small-appmsg {
888 | padding: 0;
889 | }
890 | .weui-cells_in-small-appmsg {
891 | margin-top: 0;
892 | }
893 | .weui-cells_in-small-appmsg:before {
894 | display: none;
895 | }
896 | .weui-progress {
897 | display: -webkit-box;
898 | display: -webkit-flex;
899 | display: flex;
900 | -webkit-box-align: center;
901 | -webkit-align-items: center;
902 | align-items: center;
903 | }
904 | .weui-progress__bar {
905 | -webkit-box-flex: 1;
906 | -webkit-flex: 1;
907 | flex: 1;
908 | }
909 | .weui-progress__opr {
910 | margin-left: 15px;
911 | font-size: 0;
912 | }
913 | .weui-navbar {
914 | display: -webkit-box;
915 | display: -webkit-flex;
916 | display: flex;
917 | position: absolute;
918 | z-index: 500;
919 | top: 0;
920 | width: 100%;
921 | border-bottom: 1rpx solid #CCCCCC;
922 | }
923 | .weui-navbar__item {
924 | position: relative;
925 | display: block;
926 | -webkit-box-flex: 1;
927 | -webkit-flex: 1;
928 | flex: 1;
929 | padding: 13px 0;
930 | text-align: center;
931 | font-size: 0;
932 | }
933 | .weui-navbar__item.weui-bar__item_on {
934 | color: #1AAD19;
935 | }
936 | .weui-navbar__slider {
937 | position: absolute;
938 | content: " ";
939 | left: 0;
940 | bottom: 0;
941 | width: 6em;
942 | height: 3px;
943 | background-color: #1AAD19;
944 | -webkit-transition: -webkit-transform .3s;
945 | transition: -webkit-transform .3s;
946 | transition: transform .3s;
947 | transition: transform .3s, -webkit-transform .3s;
948 | }
949 | .weui-navbar__title {
950 | display: inline-block;
951 | font-size: 15px;
952 | max-width: 8em;
953 | width: auto;
954 | overflow: hidden;
955 | text-overflow: ellipsis;
956 | white-space: nowrap;
957 | word-wrap: normal;
958 | }
959 | .weui-tab {
960 | position: relative;
961 | height: 100%;
962 | }
963 | .weui-tab__panel {
964 | box-sizing: border-box;
965 | height: 100%;
966 | padding-top: 50px;
967 | overflow: auto;
968 | -webkit-overflow-scrolling: touch;
969 | }
970 | .weui-search-bar {
971 | position: relative;
972 | padding: 8px 10px;
973 | display: -webkit-box;
974 | display: -webkit-flex;
975 | display: flex;
976 | box-sizing: border-box;
977 | background-color: #EFEFF4;
978 | border-top: 1rpx solid #D7D6DC;
979 | border-bottom: 1rpx solid #D7D6DC;
980 | }
981 | .weui-icon-search {
982 | margin-right: 8px;
983 | font-size: inherit;
984 | }
985 | .weui-icon-search_in-box {
986 | position: absolute;
987 | left: 10px;
988 | top: 7px;
989 | }
990 | .weui-search-bar__text {
991 | display: inline-block;
992 | font-size: 14px;
993 | vertical-align: middle;
994 | }
995 | .weui-search-bar__form {
996 | position: relative;
997 | -webkit-box-flex: 1;
998 | -webkit-flex: auto;
999 | flex: auto;
1000 | border-radius: 5px;
1001 | background: #FFFFFF;
1002 | border: 1rpx solid #E6E6EA;
1003 | }
1004 | .weui-search-bar__box {
1005 | position: relative;
1006 | padding-left: 30px;
1007 | padding-right: 30px;
1008 | width: 100%;
1009 | box-sizing: border-box;
1010 | z-index: 1;
1011 | }
1012 | .weui-search-bar__input {
1013 | height: 28px;
1014 | line-height: 28px;
1015 | font-size: 14px;
1016 | }
1017 | .weui-icon-clear {
1018 | position: absolute;
1019 | top: 0;
1020 | right: 0;
1021 | padding: 7px 8px;
1022 | font-size: 0;
1023 | }
1024 | .weui-search-bar__label {
1025 | position: absolute;
1026 | top: 0;
1027 | right: 0;
1028 | bottom: 0;
1029 | left: 0;
1030 | z-index: 2;
1031 | border-radius: 3px;
1032 | text-align: center;
1033 | color: #9B9B9B;
1034 | background: #FFFFFF;
1035 | line-height: 28px;
1036 | }
1037 | .weui-search-bar__cancel-btn {
1038 | margin-left: 10px;
1039 | line-height: 28px;
1040 | color: #09BB07;
1041 | white-space: nowrap;
1042 | }
1043 |
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------