pull/24/head
wny 2 years ago
parent 9b8a80d30b
commit 263177911b

@ -1,19 +0,0 @@
# Build and Release Folders
bin/
bin-debug/
bin-release/
[Oo]bj/ # FlashDevelop obj
[Bb]in/ # FlashDevelop bin
# Other files and folders
.settings/
# Executables
*.swf
*.air
*.ipa
*.apk
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder.

@ -1,24 +0,0 @@
# wechat-weapp-mapdemo
微信小程序开发mapdemo地图导航、marker标注
版本信息:
微信web开发者工具 `v0.15.152900`
## Screenshot
![](./image/screenshot1.png)
![](./image/screenshot2.png)
![](./image/navigator.jpg)
![](./image/screenshot-marker.png)
---
## License
MIT

@ -1,30 +0,0 @@
//app.js
App({
onLaunch: function () {
//调用API从本地缓存中获取数据
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
},
getUserInfo:function(cb){
var that = this;
if(this.globalData.userInfo){
typeof cb == "function" && cb(this.globalData.userInfo)
}else{
//调用登录接口
wx.login({
success: function () {
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo;
typeof cb == "function" && cb(that.globalData.userInfo)
}
})
}
});
}
},
globalData:{
userInfo:null
}
})

@ -1,42 +0,0 @@
{
"pages":[
"pages/login/login",
"pages/location/location",
"pages/Find directions/Find directions",
"pages/text/text",
"pages/ModifyMap/ModifyMap",
"pages/ModifyInformation/ModifyInformation",
"pages/ManageAccount/ManageAccount"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "login",
"navigationBarTextStyle":"black"
},
"tabBar": {
"color": "#dddddd",
"selectedColor": "#3cc51f",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/location/location",
"iconPath": "image/wechat.png",
"selectedIconPath": "image/locate.png",
"text": "导航"
},{
"pagePath": "pages/Find directions/Find directions",
"iconPath": "image/map.png",
"selectedIconPath": "image/map_active.png",
"text": "查询路线"
},{
"pagePath": "pages/text/text",
"iconPath": "image/locate.png",
"selectedIconPath": "image/locateHL.png",
"text": "信息栏"
}
]
},
"debug": true
}

@ -1,10 +0,0 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

@ -1,25 +0,0 @@
{
"name": "wechat-weapp-mapdemo",
"version": "1.0.0",
"description": "微信小程序demo,地图",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/giscafer/wechat-weapp-mapdemo.git"
},
"keywords": [
"微信小程序demo"
],
"author": "giscafer",
"license": "ISC",
"bugs": {
"url": "https://github.com/giscafer/wechat-weapp-mapdemo/issues"
},
"homepage": "https://github.com/giscafer/wechat-weapp-mapdemo#readme",
"dependencies": {
"mapbox-gl": "^0.24.0"
}
}

@ -1,26 +0,0 @@
//index.js
//获取应用实例
var app = getApp()
Page({
data: {
motto: '中航大查询路线系统',
userInfo: {},
appInfo:{
logoUrl:'../../image/logo.png',
title:'查询路线'
}
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../location/location'
})
},
onLoad: function () {
console.log('onLoad')
var that = this
that.setData({
appInfo:this.data.appInfo
})
}
})

@ -1,10 +0,0 @@
<!--index.wxml-->
<view class="container">
<view bindtap="bindViewTap" class="userinfo">
<image class="userinfo-avatar" src="{{appInfo.logoUrl}}" background-size="cover"></image>
<text class="userinfo-nickname">{{appInfo.title}}</text>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>

@ -1,21 +0,0 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.userinfo-nickname {
color: #aaa;
}
.usermotto {
margin-top: 200px;
}

@ -1,23 +0,0 @@
Page({
data: {
loginOK: false
},
//map
map() {
wx.navigateTo({
url: '/pages/ModifyMap/ModifyMap',
})
},
//information
information() {
wx.navigateTo({
url: '/pages/ModifyInformation/ModifyInformation',
})
},
//account
account() {
wx.navigateTo({
url: '/pages/ManageAccount/ManageAccount'
})
}
})

@ -1,5 +0,0 @@
<view class="ModifyAccount">
<button class="map" type="primary" bindtap="map" style="position: relative; left: -244rpx; top: 1081rpx; width: 263rpx; height: 108rpx; display: block; box-sizing: border-box">修改地图</button>
<button class="information" type="primary" bindtap="information" style="width: 263rpx; height: 108rpx; display: block; box-sizing: border-box; left: 19rpx; top: 973rpx; position: relative">修改信息</button>
<button class="account" type="primary" bindtap="account" style="width: 263rpx; height: 108rpx; display: block; box-sizing: border-box; left: 282rpx; top: 865rpx; position: relative">管理账户</button>
</view>

@ -1 +0,0 @@
/* pages/ManageAccount/ManageAccount.wxss */

@ -1,23 +0,0 @@
Page({
data: {
loginOK: false
},
//map
map() {
wx.navigateTo({
url: '/pages/ModifyMap/ModifyMap',
})
},
//information
information() {
wx.navigateTo({
url: '/pages/ModifyInformation/ModifyInformation',
})
},
//account
account() {
wx.navigateTo({
url: '/pages/ManageAccount/ManageAccount'
})
}
})

@ -1,5 +0,0 @@
<view class="ModifyInformation">
<button class="map" type="primary" bindtap="map" style="position: relative; left: -244rpx; top: 1081rpx; width: 263rpx; height: 108rpx; display: block; box-sizing: border-box">修改地图</button>
<button class="information" type="primary" bindtap="information" style="width: 263rpx; height: 108rpx; display: block; box-sizing: border-box; left: 19rpx; top: 973rpx; position: relative">修改信息</button>
<button class="account" type="primary" bindtap="account" style="width: 263rpx; height: 108rpx; display: block; box-sizing: border-box; left: 282rpx; top: 865rpx; position: relative">管理账户</button>
</view>

@ -1 +0,0 @@
/* pages/ModifyInformation/ModifyInformation.wxss */

@ -1,23 +0,0 @@
Page({
data: {
loginOK: false
},
//map
map() {
wx.navigateTo({
url: '/pages/ModifyMap/ModifyMap',
})
},
//information
information() {
wx.navigateTo({
url: '/pages/ModifyInformation/ModifyInformation',
})
},
//account
account() {
wx.navigateTo({
url: '/pages/ManageAccount/ManageAccount'
})
}
})

@ -1,5 +0,0 @@
<view class="ModifyMap">
<button class="map" type="primary" bindtap="map" style="position: relative; left: -244rpx; top: 1081rpx; width: 263rpx; height: 108rpx; display: block; box-sizing: border-box">修改地图</button>
<button class="information" type="primary" bindtap="information" style="width: 263rpx; height: 108rpx; display: block; box-sizing: border-box; left: 19rpx; top: 973rpx; position: relative">修改信息</button>
<button class="account" type="primary" bindtap="account" style="width: 263rpx; height: 108rpx; display: block; box-sizing: border-box; left: 282rpx; top: 865rpx; position: relative">管理账户</button>
</view>

@ -1,727 +0,0 @@
var click =true
Page({
/**
* 页面的初始数据
*/
data: {
longitude: 112.5840817937609,
latitude: 37.42334029843902,
scale:16,
ishow:true
},
// 校门
hx_door: function () {
this.setData({
hx_door: true,
hx_canteen: false,
hx_supermarket: false,
hx_teach: false,
hx_hospital: false,
hx_playground: false,
hx_library: false,
hx_dorm: false,
ishow:false,
latitude: 37.42334029843902, //经度
longitude: 112.5840817937609, //纬度
scale: 16,
markers: [{
iconPath: '../../images/hxLocation.png',
latitude: 37.42460923822909,
longitude: 112.57850807958519,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.42505982099957,
longitude: 112.58448746351345,
width: 20,
height: 30
},{
iconPath: '../../images/hxLocation.png',
latitude: 37.423356091749176,
longitude: 112.59020697584626,
width: 20,
height: 30
},{
iconPath: '../../images/hxLocation.png',
latitude: 37.420850652498494,
longitude: 112.58636394568849,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.42046830521278,
longitude: 112.59089438639249,
width: 20,
height: 30
}]
})
},
// 餐厅
hx_canteen: function () {
this.setData({
hx_door: false,
hx_canteen: true,
hx_supermarket: false,
hx_teach: false,
hx_hospital: false,
hx_playground: false,
hx_library: false,
hx_dorm: false,
ishow: false,
latitude: 37.42334029843902, //经度
longitude: 112.5840817937609, //纬度
scale: 16,
markers: [{
iconPath: '../../images/hxLocation.png',
latitude: 37.42217098294637,
longitude: 112.58554120048987,
width: 20,
height: 30
},
{
iconPath: '../../images/hxLocation.png',
latitude: 37.424741,
longitude: 112.580423,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.421674,
longitude: 112.591431,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.421563,
longitude: 112.585369,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.421137,
longitude: 112.585305,
width: 20,
height: 30
}
]
})
},
/******超市***/
hx_supermarket: function () {
this.setData({
hx_door: false,
hx_canteen: false,
hx_supermarket: true,
hx_teach: false,
hx_hospital: false,
hx_playground: false,
hx_library: false,
hx_dorm: false,
ishow: false,
latitude: 37.42334029843902, //经度
longitude: 112.5840817937609, //纬度
scale: 16,
markers: [{
iconPath: '../../images/hxLocation.png', //大超市
latitude: 37.422066, /**大超市 */
longitude: 112.585868,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //进门超市
latitude: 37.421014, /**进门超市*/
longitude: 112.585155,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //进门超市
latitude: 37.421546, /**进门超市*/
longitude: 112.591259,
width: 20,
height: 30
}
]
})
},
/****************************************教学楼***************************************** */
hx_teach: function () {
this.setData({
hx_door: false,
hx_canteen: false,
hx_supermarket: false,
hx_teach: true,
hx_hospital: false,
hx_playground: false,
hx_library: false,
hx_dorm: false,
ishow: false,
latitude: 37.42334029843902, //经度
longitude: 112.5840817937609, //纬度
scale: 16,
markers: [{
iconPath: '../../images/hxLocation.png', //教学楼1
latitude: 37.423821,
longitude: 112.585863,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //教学楼2
latitude: 37.424622,
longitude: 112.581378,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //实验楼3
latitude: 37.425074,
longitude: 112.583610,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //实验楼4
latitude: 37.424545,
longitude: 112.585037,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼5
latitude: 37.424230,
longitude: 112.585917,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼6
latitude: 37.423016,
longitude: 112.586625,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼7
latitude: 37.421550,
longitude: 112.582945,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼8
latitude: 37.423335,
longitude: 112.584801,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼9
latitude: 37.421452,
longitude: 112.580155,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼10
latitude: 37.421555,
longitude: 112.579050,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼11
latitude: 37.422398,
longitude: 112.578599,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼12
latitude: 37.424882,
longitude: 112.582687,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png', //办公楼13
latitude: 37.421883,
longitude: 112.587698,
width: 20,
height: 30
}
]
})
},
/****************************************医 务 室***************************************** */
hx_hospital: function () {
this.setData({
hx_door: false,
hx_canteen: false,
hx_supermarket: false,
hx_teach: false,
hx_hospital: true,
hx_playground: false,
hx_library: false,
hx_dorm: false,
ishow: false,
latitude: 37.42334029843902, //经度
longitude: 112.5840817937609, //纬度
scale: 16,
markers: [{
iconPath: '../../images/hxLocation.png',
latitude: 37.425022,
longitude: 112.585133,
width: 20,
height: 30
}]
})
},
/****************************************农大 体 育 场***************************************** */
hx_playground: function () {
this.setData({
hx_door: false,
hx_canteen: false,
hx_supermarket: false,
hx_teach: false,
hx_hospital: false,
hx_playground: true,
hx_library: false,
hx_dorm: false,
ishow: false,
latitude: 37.42334029843902, //经度
longitude: 112.5840817937609, //纬度
scale: 16,
markers: [{
iconPath: '../../images/hxLocation.png',
latitude: 37.421947, /**大操场 */
longitude: 112.589071,
width: 20,
height: 30
},
{
iconPath: '../../images/hxLocation.png',
latitude: 37.425636,
longitude: 112.582322, /**小操场 */
width: 20,
height: 30
}]
})
},
/****************************************农大 图 书 馆***************************************** */
hx_library: function () {
this.setData({
hx_door: false,
hx_canteen: false,
hx_supermarket: false,
hx_teach: false,
hx_hospital: false,
hx_playground: false,
hx_library: true,
hx_dorm: false,
ishow: false,
latitude: 37.42334029843902, //经度
longitude: 112.5840817937609, //纬度
scale: 16,
markers: [{
iconPath: '../../images/hxLocation.png',
latitude: 37.424051, /**图书馆 */
longitude: 112.580541,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.424524, /**图书馆 */
longitude: 112.583980,
width: 20,
height: 30
}]
})
},
/****************************************农大 宿 舍***************************************** */
hx_dorm: function () {
this.setData({
hx_door: false,
hx_canteen: false,
hx_supermarket: false,
hx_teach: false,
hx_hospital: false,
hx_playground: false,
hx_library: false,
hx_dorm: true,
ishow: false,
latitude: 37.42334029843902, //经度
longitude: 112.5840817937609, //纬度
scale: 16,
markers: [{
iconPath: '../../images/hxLocation.png',
latitude: 37.422066, /**学生公寓1 */
longitude: 112.584833,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.422394, /**学生公寓2 */
longitude: 112.586399,
width:20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.421751, /**学生公寓3 */
longitude: 112.590798,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.425917, /**学生公寓4 */
longitude: 112.580520,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.421261, /**活动中心宿舍楼*/
longitude: 112.587896,
width: 20,
height: 30
}, {
iconPath: '../../images/hxLocation.png',
latitude: 37.421090, /**洗浴中心宿舍楼 */
longitude: 112.589441,
width: 20,
height: 30
}
]
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
go: function (e) {
var id = e.currentTarget.id; //获取id
switch (id) {
/*农大校门门*/
case "door1":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.42460923822909,
longitude: 112.57850807958519,
scale: 25
})
break;
case "door2":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.42505982099957,
longitude: 112.58448746351345,
scale: 25
})
break;
case "door3":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.423356091749176,
longitude: 112.59020697584626,
scale: 25
})
break;
case "door4":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.420850652498494,
longitude: 112.58636394568849,
scale: 25
})
break;
case "door5":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.42046830521278,
longitude: 112.59089438639249,
scale: 25
})
break;
/*农大餐饮*/
case "canteen1":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.42217098294637,
longitude: 112.58554120048987,
scale: 25
})
break;
case "canteen2":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421674,
longitude: 112.591431,
scale: 25
})
break;
case "canteen3":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.424741,
longitude: 112.580423,
scale: 25
})
break;
case "canteen4":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421563,
longitude: 112.585369,
scale: 25
})
break;
case "canteen5":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421137,
longitude: 112.585305,
scale: 25
})
break;
/*农大超市*/
case "supermarket1":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.422066, /**大超市 */
longitude: 112.585868,
scale: 25
})
break;
case "supermarket2":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421014, /**进门超市*/
longitude: 112.585155,
scale: 25
})
break;
case "supermarket3":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421546, /**进门超市*/
longitude: 112.591259,
scale: 25
})
break;
/**农大教学楼 */
case "teach1":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.423821,
longitude: 112.585863,
scale: 25
})
break;
case "teach2":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.424622,
longitude: 112.581378,
scale: 25
})
break;
case "teach3":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.425074,
longitude: 112.583610,
scale: 25
})
break;
case "teach4":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.424545,
longitude: 112.585037,
scale: 25
})
break;
case "teach5":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.424230,
longitude: 112.585917,
scale: 25
})
break;
case "teach6":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.423016,
longitude: 112.586625,
scale: 25
})
break;
case "teach7":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421550,
longitude: 112.582945,
scale: 25
})
break;
case "teach8":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.423335,
longitude: 112.584801,
scale: 25
})
break;
case "teach9":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421452,
longitude: 112.580155,
scale: 25
})
break;
case "teach10":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421555,
longitude: 112.579050,
scale: 25
})
break;
case "teach11":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.422398,
longitude: 112.578599,
scale: 25
})
break;
case "teach12":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.424882,
longitude: 112.582687,
scale: 25
})
break;
case "teach13":
wx.openLocation({ /*使用微信内置地图查看位置*/
latitude: 37.421883,
longitude: 112.587698,
scale: 25
})
break;
/**农大医务室 */
case "hospital1":
wx.openLocation({
latitude: 37.425022,
longitude: 112.585133,
scale: 25
})
break;
/**农大体育场 */
case "playground1":
wx.openLocation({
latitude: 37.421947, /**大操场 */
longitude: 112.589071,
scale: 25
})
break;
case "playground2":
wx.openLocation({
latitude: 37.425636,
longitude: 112.582322, /**小操场 */
scale: 25
})
break;
/**农大图书馆*/
case "library1":
wx.openLocation({
latitude: 37.424051, /**图书馆 */
longitude: 112.580541,
scale: 25
})
break;
case "library2":
wx.openLocation({
latitude: 37.424524, /**图书馆 */
longitude: 112.583980,
scale: 25
})
break;
/**农大宿舍楼*/
case "dorm1":
wx.openLocation({
latitude: 37.422066, /**学生公寓1 */
longitude: 112.584833,
scale: 25
})
break;
case "dorm2":
wx.openLocation({
latitude: 37.422394, /**学生公寓2 */
longitude: 112.586399,
scale: 25
})
break;
case "dorm3":
wx.openLocation({
latitude: 37.421751, /**学生公寓3 */
longitude: 112.590798,
scale: 25
})
break;
case "dorm4":
wx.openLocation({
latitude: 37.425917, /**学生公寓4 */
longitude: 112.580520,
scale: 25
})
break;
case "dorm5":
wx.openLocation({
latitude: 37.421261, /**活动中心宿舍楼*/
longitude: 112.587896,
scale: 25
})
break;
case "dorm6":
wx.openLocation({
latitude: 37.421090, /**洗浴中心宿舍楼 */
longitude: 112.589441,
scale: 25
})
break;
}
}
})

@ -1,417 +0,0 @@
<!--pages/sxauguide/sxauguide.wxml-->
<scroll-view scroll-x class='scrollx' >
<navigator open-type="redirect" catchtap='hx_door'>校门</navigator>
<navigator open-type="redirect" catchtap='hx_canteen'>餐饮</navigator>
<navigator open-type="redirect" catchtap='hx_supermarket'>超市</navigator>
<navigator open-type="redirect" catchtap='hx_teach'>教学楼</navigator>
<navigator open-type="redirect" catchtap='hx_hospital'>医院</navigator>
<navigator open-type="redirect" catchtap='hx_playground'>体育场</navigator>
<navigator open-type="redirect" catchtap='hx_library'>图书馆</navigator>
<navigator open-type="redirect" catchtap='hx_dorm'>学生公寓</navigator>
</scroll-view>
<!--地图-->
<!--longitude经度 latitude纬度 -->
<map
id="map"
longitude="{{longitude}}"
latitude="{{latitude}}"
scale="{{scale}}"
style="width: 100%; height: 300px;"
markers='{{markers}}'
show-location='true'
bindcallouttap='click'
bindmarkertap='background'
></map>
<!-- 校门 -->
<view class='bottom' style='bottom:{{bootom}};' wx:if="{{hx_door}}">
<cover-view class='hx_bottomtext'>校门</cover-view>
<view class="page__bd">
<view class="weui-cells__title"></view>
<view class="weui-cells weui-cells_after-title">
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 西门</view>
<cover-image id='door1' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 旧北门</view>
<cover-image id='door2' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 新北门</view>
<cover-image id='door3' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 前南门(可过)</view>
<cover-image id='door4' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 后南门(一般不开)</view>
<cover-image id='door5' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
</view>
</view>
</view>
<!--农大餐饮-->
<view class='bottom' style='bottom:{{bootom}};' wx:if="{{hx_canteen}}">
<cover-view class='hx_bottomtext'>餐饮</cover-view>
<view class="page__bd">
<view class="weui-cells__title"></view>
<view class="weui-cells weui-cells_after-title">
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 谷园</view>
<cover-image id='canteen1' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 碧桃园</view>
<cover-image id='canteen2' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 教职工餐厅</view>
<cover-image id='canteen3' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 小木屋</view>
<cover-image id='canteen4' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 怡膳园</view>
<cover-image id='canteen5' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
</view>
</view>
</view>
<!--农大超市-->
<view class='bottom' style='bottom:{{bootom}};' wx:if="{{hx_supermarket}}">
<cover-view class='hx_bottomtext'>超市</cover-view>
<view class="page__bd">
<view class="weui-cells__title"></view>
<view class="weui-cells weui-cells_after-title">
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 寸草心超市</view>
<cover-image id='supermarket1' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 周边小超市</view>
<cover-image id='supermarket2' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 周边小超市</view>
<cover-image id='supermarket3' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
</view>
</view>
</view>
<!--农大教学楼-->
<view class='bottom' style='bottom:{{bootom}};' wx:if="{{hx_teach}}">
<cover-view class='hx_bottomtext'>教学楼</cover-view>
<view class="page__bd">
<view class="weui-cells__title"></view>
<view class="weui-cells weui-cells_after-title">
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 农学楼1号</view>
<cover-image id='teach1' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 实验大楼</view>
<cover-image id='teach2' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 崇学楼</view>
<cover-image id='teach3' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 理化楼</view>
<cover-image id='teach4' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 教学北楼</view>
<cover-image id='teach5' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 教学主楼5号楼</view>
<cover-image id='teach6' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 6号楼</view>
<cover-image id='teach7' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 动物科技学院</view>
<cover-image id='teach8' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 崇实楼</view>
<cover-image id='teach9' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 工学院</view>
<cover-image id='teach10' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 资源环境学院</view>
<cover-image id='teach11' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 嘉桂教学楼</view>
<cover-image id='teach12' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 体育部</view>
<cover-image id='teach13' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
</view>
</view>
</view>
<!--农大校医院-->
<view class='bottom' style='bottom:{{bootom}};' wx:if="{{hx_hospital}}">
<cover-view class='hx_bottomtext'>医院</cover-view>
<view class="page__bd">
<view class="weui-cells__title"></view>
<view class="weui-cells weui-cells_after-title">
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 校医院</view>
<cover-image id='hospital1' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
</view>
</view>
</view>
<!--农大体育场-->
<view class='bottom' style='bottom:{{bootom}};' wx:if="{{hx_playground}}">
<cover-view class='hx_bottomtext'>体育场</cover-view>
<view class="page__bd">
<view class="weui-cells__title"></view>
<view class="weui-cells weui-cells_after-title">
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 大操场</view>
<cover-image id='playground1' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 小操场</view>
<cover-image id='playground2' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
</view>
</view>
</view>
<!--农大图书馆-->
<view class='bottom' style='bottom:{{bootom}};' wx:if="{{hx_library}}">
<cover-view class='hx_bottomtext'>图书馆</cover-view>
<view class="page__bd">
<view class="weui-cells__title"></view>
<view class="weui-cells weui-cells_after-title">
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 图书馆</view>
<cover-image id='library1' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">山西农业大学 - 亭兰图书馆</view>
<cover-image id='library2' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
</view>
</view>
</view>
<!--农大学生公寓-->
<view class='bottom' style='bottom:{{bootom}};' wx:if="{{hx_dorm}}">
<cover-view class='hx_bottomtext'>学生公寓</cover-view>
<view class="page__bd">
<view class="weui-cells__title"></view>
<view class="weui-cells weui-cells_after-title">
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">学生公寓 1-5</view>
<cover-image id='dorm1' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">学生公寓 6-10</view>
<cover-image id='dorm2' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">学生公寓 11-19</view>
<cover-image id='dorm3' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">学生公寓 21-23</view>
<cover-image id='dorm4' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">游泳馆 - (活动中心)</view>
<cover-image id='dorm5' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
<navigator url="" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../../images/xm.jpg" class='hx_img'></image>
</view>
<view class="weui-cell__bd">睿智体育馆 - (活动中心)</view>
<cover-image id='dorm6' style='width:25px;height:25px' catchtap='go' src='../../images/gps.jpg' mode='aspectFit'></cover-image>
</navigator>
</view>
</view>
</view>

@ -1,62 +0,0 @@
/* pages/sxauguide/sxauguide.wxss */
/*顶部滑块*/
.scrollx{
display: flex; /*水平居中*/
white-space: nowrap; /* 文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。*/
}
.scrollx navigator{
display: inline-block; /*垂直居中,多个孩子共享一行*/
padding-left: 20rpx;
padding-right: 20rpx;
background: #2d572b;
color: white;
font-family: "微软雅黑";
font-size: 15px;
padding-top: 10px;
padding-bottom: 10px;
}
.bottom{
position:relative; /*相对定位*/
float: left;
width: 100%;
}
.hx_bottomtext{
display: block;
position: relative;
font-family: "微软雅黑";
font-size: 15px;
width: 100%;
top: 10px;
left: 45%;
color: #ed5e53;
margin-bottom: 20px;
}
/*控制地点列表的单行展示形式*/
.hxdoor{
position: relative;
display: flex; /*水平居中*/
width: 100%;
height: 50px;
}
/*控制单行图片位置*/
.hx_img{
margin-right: 10px;
float: left;
width: 80px;
height: 40px;
}
/*控制单行文字*/
.hxdoor_text{
font-size: 16px;
font-family: "微软雅黑";
color:#333333;
margin-left: 20rpx;
margin-top: 5rpx;
}
/*控制go图标*/
.go{
width:20px ;
height:20px;
}

@ -1,28 +0,0 @@
//获取应用实例
var app = getApp()
Page({
data: {
user_name:'',
user_password:''
},
//输入用户名
userNameChange: function (e) {
this.data.user_name = e.detail.value;
},
//输入密码
userPasswordChange: function (e) {
this.data.user_password = e.detail.value;
},
showLive: function () {
wx.reLaunch({
url: '../Find directions/Find directions',
})
},
showpage: function(){
wx.reLaunch(
{
url:'../ModifyMap/ModifyMap'
}
)
}
})

@ -1,32 +0,0 @@
<view class="page">
<view class="page__bd">
<view class="weui-toptips weui-toptips_warn" wx:if="{{showTopTips}}">错误提示</view>
<view class="weui-cells__title">登录</view>
<view class="weui-cells weui-cells_after-title" style="width: 750rpx; height: 303rpx; display: block; box-sizing: border-box">
<view class="weui-cell weui-cell_input">
<view class="weui-cell__hd">
<view class="weui-label">用户名</view>
</view>
<view class="weui-cell__bd">
<input class="weui-input" placeholder="请输入用户名" name="user_name" value="{{user_name}}" bindblur="userNameChange" />
</view>
</view>
<view class="weui-cell weui-cell_input weui-cell_vcode">
<view class="weui-cell__hd">
<view class="weui-label">密码</view>
</view>
<view class="weui-cell__bd">
<input password type="text" class="weui-input" placeholder="请输入密码" name="user_password" value="{{user_password}}" bindblur="userPasswordChange" />
</view>
</view>
</view>
<view class="weui-btn-area" bindtap="showLive" style="width: 750rpx; height: 190rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx">
<button class="weui-btn" type="primary" style="width: 347rpx; height: 108rpx; display: block; box-sizing: border-box; left: -174rpx; top: -61rpx; position: relative">用户登陆</button>
</view>
<view class="weui-btn-area" bindtap="showpage">
<button class="weui-btn" type="primary" style="width: 331rpx; height: 108rpx; display: block; box-sizing: border-box; left: 188rpx; top: -249rpx; position: relative">管理员登陆</button>
</view>
<view class="weui-cells__title" style="position: relative; left: 0rpx; top: -79rpx">注册,忘记密码请联系qq:xx</view>
</view>
</view>

@ -1,20 +0,0 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.userinfo-nickname {
color: red;
}
.usermotto {
margin-top: 200px;
}

@ -1,66 +0,0 @@
// pages/logs/logs.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -1,2 +0,0 @@
<!--pages/logs/logs.wxml-->
<text>pages/logs/logs.wxml</text>

@ -1,77 +0,0 @@
// map.js
let schoolData = require('../../resources/gis-school')
Page({
data: {
centerX:113.3245211,
centerY:23.10229,
markers: [],
controls: [{
id: 1,
iconPath: '/image/location-control.png',
position: {
left: 0,
top:10,
width: 40,
height: 40
},
clickable: true
}]
},
onReady: function (e) {
// 使用 wx.createMapContext 获取 map 上下文
this.mapCtx = wx.createMapContext('myMap')
},
onLoad: function () {
console.log('地图定位!')
let that = this
wx.getLocation({
type: 'gcj02', //返回可以用于wx.openLocation的经纬度
success:(res)=>{
console.log(res)
let latitude = res.latitude;
let longitude = res.longitude;
let marker=this.createMarker(res);
this.setData({
centerX:longitude,
centerY:latitude,
markers:this.getSchoolMarkers()
})
}
});
},
regionchange(e) {
console.log(e.type)
},
markertap(e) {
console.log(e)
},
controltap(e) {
console.log(e.controlId)
this.moveToLocation()
},
getSchoolMarkers(){
let markers=[];
for(let item of schoolData){
let marker=this.createMarker(item);
markers.push(marker)
}
return markers;
},
moveToLocation: function () {
this.mapCtx.moveToLocation()
},
createMarker(point){
let latitude = point.latitude;
let longitude = point.longitude;
let marker= {
iconPath: "/image/location.png",
id:point.id || 0,
name:point.name || '',
latitude: latitude,
longitude: longitude,
width: 25,
height: 48
};
return marker;
}
})

@ -1,3 +0,0 @@
{
"navigationBarTitleText": "地图标注"
}

@ -1 +0,0 @@
<map id="map" scale="5" controls="{{controls}}" bindcontroltap="controltap" markers="{{markers}}" bindmarkertap="markertap" bindregionchange="regionchange" show-location style="width: 100%; height: 580px;"></map>

@ -1,66 +0,0 @@
// pages/text/text.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -1,2 +0,0 @@
<!--pages/text/text.wxml-->
<text>pages/text/text.wxml</text>

@ -1,29 +0,0 @@
{
"compileType": "miniprogram",
"setting": {
"coverView": true,
"es6": false,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"ignoreUploadUnusedFiles": true
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"libVersion": "2.27.0",
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wx5e77d1bb9e24f179"
}

@ -1,7 +0,0 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "wechat-weapp-mapdemo-master",
"setting": {
"compileHotReLoad": false
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -1,21 +0,0 @@
function formatTime(date) {
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds();
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
function formatNumber(n) {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime
}

@ -1,31 +0,0 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}

@ -1,14 +0,0 @@
{
"pages": [
"pages/index/index",
"pages/logs/logs"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle": "black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

@ -1,18 +0,0 @@
// app.ts
App<IAppOption>({
globalData: {},
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
console.log(res.code)
// 发送 res.code 到后台换取 openId, sessionKey, unionId
},
})
},
})

@ -1,10 +0,0 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}

@ -1,49 +0,0 @@
// index.ts
// 获取应用实例
const app = getApp<IAppOption>()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
canIUseGetUserProfile: false,
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
},
// 事件处理函数
bindViewTap() {
wx.navigateTo({
url: '../logs/logs',
})
},
onLoad() {
// @ts-ignore
if (wx.getUserProfile) {
this.setData({
canIUseGetUserProfile: true
})
}
},
getUserProfile() {
// 推荐使用wx.getUserProfile获取用户信息开发者每次通过该接口获取用户个人信息均需用户确认开发者妥善保管用户快速填写的头像昵称避免重复弹窗
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(res)
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
},
getUserInfo(e: any) {
// 不推荐使用getUserInfo获取用户信息预计自2021年4月13日起getUserInfo将不再弹出弹窗并直接返回匿名的用户个人信息
console.log(e)
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})

@ -1,23 +0,0 @@
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<block wx:if="{{canIUseOpenData}}">
<view class="userinfo-avatar" bindtap="bindViewTap">
<open-data type="userAvatarUrl"></open-data>
</view>
<open-data type="userNickName"></open-data>
</block>
<block wx:elif="{{!hasUserInfo}}">
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<button wx:elif="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<view wx:else> 请使用1.4.4及以上版本基础库 </view>
</block>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>

@ -1,19 +0,0 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
color: #aaa;
}
.userinfo-avatar {
overflow: hidden;
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.usermotto {
margin-top: 200px;
}

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}

@ -1,19 +0,0 @@
// logs.ts
// const util = require('../../utils/util.js')
import { formatTime } from '../../utils/util'
Page({
data: {
logs: [],
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map((log: string) => {
return {
date: formatTime(new Date(log)),
timeStamp: log
}
}),
})
},
})

@ -1,6 +0,0 @@
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log.date}}</text>
</block>
</view>

@ -1,8 +0,0 @@
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}

@ -1,7 +0,0 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

@ -1,19 +0,0 @@
export const formatTime = (date: Date) => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return (
[year, month, day].map(formatNumber).join('/') +
' ' +
[hour, minute, second].map(formatNumber).join(':')
)
}
const formatNumber = (n: number) => {
const s = n.toString()
return s[1] ? s : '0' + s
}

@ -1,15 +0,0 @@
{
"name": "miniprogram-ts-less-quickstart",
"version": "1.0.0",
"description": "",
"scripts": {
},
"keywords": [],
"author": "",
"license": "",
"dependencies": {
},
"devDependencies": {
"miniprogram-api-typings": "^2.8.3-1"
}
}

@ -1,30 +0,0 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": [],
"include": []
},
"miniprogramRoot": "miniprogram/",
"compileType": "miniprogram",
"projectname": "ts-demo",
"setting": {
"useCompilerPlugins": [
"typescript"
],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {},
"srcMiniprogramRoot": "miniprogram/",
"appid": "wxc5e37420ae989824",
"libVersion": "2.27.0",
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

@ -1,7 +0,0 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "weichat_work",
"setting": {
"compileHotReLoad": true
}
}

@ -1,30 +0,0 @@
{
"compilerOptions": {
"strictNullChecks": true,
"noImplicitAny": true,
"module": "CommonJS",
"target": "ES2020",
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"strictPropertyInitialization": true,
"lib": ["ES2020"],
"typeRoots": [
"./typings"
]
},
"include": [
"./**/*.ts"
],
"exclude": [
"node_modules"
]
}

@ -1,8 +0,0 @@
/// <reference path="./types/index.d.ts" />
interface IAppOption {
globalData: {
userInfo?: WechatMiniprogram.UserInfo,
}
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback,
}

@ -1 +0,0 @@
/// <reference path="./wx/index.d.ts" />

@ -1,134 +0,0 @@
/*! *****************************************************************************
Copyright (c) 2022 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
***************************************************************************** */
/// <reference path="./lib.wx.app.d.ts" />
/// <reference path="./lib.wx.page.d.ts" />
/// <reference path="./lib.wx.api.d.ts" />
/// <reference path="./lib.wx.cloud.d.ts" />
/// <reference path="./lib.wx.component.d.ts" />
/// <reference path="./lib.wx.behavior.d.ts" />
/// <reference path="./lib.wx.event.d.ts" />
declare namespace WechatMiniprogram {
type IAnyObject = Record<string, any>
type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
interface AsyncMethodOptionLike {
success?: (...args: any[]) => void
}
type PromisifySuccessResult<
P,
T extends AsyncMethodOptionLike
> = P extends {
success: any
}
? void
: P extends { fail: any }
? void
: P extends { complete: any }
? void
: Promise<Parameters<Exclude<T['success'], undefined>>[0]>
// TODO: Extract real definition from `lib.dom.d.ts` to replace this
type IIRFilterNode = any
type WaveShaperNode = any
type ConstantSourceNode = any
type OscillatorNode = any
type GainNode = any
type BiquadFilterNode = any
type PeriodicWaveNode = any
type BufferSourceNode = any
type ChannelSplitterNode = any
type ChannelMergerNode = any
type DelayNode = any
type DynamicsCompressorNode = any
type ScriptProcessorNode = any
type PannerNode = any
type AnalyserNode = any
type AudioListener = any
type WebGLTexture = any
type WebGLRenderingContext = any
}
declare let console: WechatMiniprogram.Console
declare let wx: WechatMiniprogram.Wx
/** 引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */
declare function require(
/** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
module: string
): any
/** 引入插件。返回插件通过 `main` 暴露的接口。 */
declare function requirePlugin(
/** 需要引入的插件的 alias */
module: string
): any
/** 插件引入当前使用者小程序。返回使用者小程序通过 [插件配置中 `export` 暴露的接口](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html#%E5%AF%BC%E5%87%BA%E5%88%B0%E6%8F%92%E4%BB%B6)
*
*
*
* `2.11.1` */
declare function requireMiniProgram(): any
/** 当前模块对象 */
declare let module: {
/** 模块向外暴露的对象,使用 `require` 引用该模块时可以获取 */
exports: any
}
/** `module.exports` 的引用 */
declare let exports: any
/** [clearInterval(number intervalID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearInterval.html)
*
* setInterval */
declare function clearInterval(
/** 要取消的定时器的 ID */
intervalID: number
): void
/** [clearTimeout(number timeoutID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearTimeout.html)
*
* setTimeout */
declare function clearTimeout(
/** 要取消的定时器的 ID */
timeoutID: number
): void
/** [number setInterval(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setInterval.html)
*
* */
declare function setInterval(
/** 回调函数 */
callback: (...args: any[]) => any,
/** 执行回调函数之间的时间间隔,单位 ms。 */
delay?: number,
/** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
rest?: any
): number
/** [number setTimeout(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setTimeout.html)
*
* */
declare function setTimeout(
/** 回调函数 */
callback: (...args: any[]) => any,
/** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */
delay?: number,
/** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
rest?: any
): number

File diff suppressed because it is too large Load Diff

@ -1,270 +0,0 @@
/*! *****************************************************************************
Copyright (c) 2022 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
***************************************************************************** */
declare namespace WechatMiniprogram.App {
interface ReferrerInfo {
/** App appId
*
* referrerInfo.appId
* - 1020 profile appId
* - 1035 appId
* - 1036App appId
* - 1037 appId
* - 1038 appId
* - 1043 appId
*/
appId: string
/** 来源小程序传过来的数据scene=1037或1038时支持 */
extraData?: any
}
type SceneValues =
| 1001
| 1005
| 1006
| 1007
| 1008
| 1011
| 1012
| 1013
| 1014
| 1017
| 1019
| 1020
| 1023
| 1024
| 1025
| 1026
| 1027
| 1028
| 1029
| 1030
| 1031
| 1032
| 1034
| 1035
| 1036
| 1037
| 1038
| 1039
| 1042
| 1043
| 1044
| 1045
| 1046
| 1047
| 1048
| 1049
| 1052
| 1053
| 1056
| 1057
| 1058
| 1059
| 1064
| 1067
| 1069
| 1071
| 1072
| 1073
| 1074
| 1077
| 1078
| 1079
| 1081
| 1082
| 1084
| 1089
| 1090
| 1091
| 1092
| 1095
| 1096
| 1097
| 1099
| 1102
| 1124
| 1125
| 1126
| 1129
interface LaunchShowOption {
/** 打开小程序的路径 */
path: string
/** 打开小程序的query */
query: IAnyObject
/**
* - 1001使2.2.4
* - 1005
* - 1006
* - 1007
* - 1008
* - 1011
* - 1012
* - 1013
* - 1014
* - 1017
* - 10197.0.0
* - 1020 profile
* - 1023
* - 1024 profile
* - 1025
* - 1026
* - 1027使
* - 1028
* - 1029
* - 1030
* - 1031
* - 1032
* - 1034
* - 1035
* - 1036App
* - 1037
* - 1038
* - 1039
* - 1042
* - 1043
* - 1044 shareTicket [](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html)
* - 1045广
* - 1046广
* - 1047
* - 1048
* - 1049
* - 1052
* - 1053
* - 1056
* - 1057
* - 1058
* - 1059
* - 1064Wi-Fi
* - 1067广
* - 1069
* - 1071
* - 1072
* - 1073
* - 1074
* - 1077
* - 1078Wi-Fi
* - 1079
* - 1081
* - 1082
* - 1084广
* - 1089使2.2.4
* - 1090使
* - 1091
* - 1092
* - 1095广
* - 1096
* - 1097
* - 1099
* - 1102 profile
* - 1124
* - 1125
* - 1126
* - 1129访 [](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html)
*/
scene: SceneValues
/** shareTicket详见 [获取更多转发信息]((转发#获取更多转发信息)) */
shareTicket: string
/** 当场景为由从另一个小程序或公众号或App打开时返回此字段 */
referrerInfo?: ReferrerInfo
}
interface PageNotFoundOption {
/** 不存在页面的路径 */
path: string
/** 打开不存在页面的 query */
query: IAnyObject
/** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */
isEntryPage: boolean
}
interface Option {
/**
*
*
*/
onLaunch(options: LaunchShowOption): void
/**
*
*
*/
onShow(options: LaunchShowOption): void
/**
*
*
*/
onHide(): void
/**
*
* api
*/
onError(/** 错误信息,包含堆栈 */ error: string): void
/**
*
*
*
* ****
* 1. `onPageNotFound`
* 2. `onPageNotFound` `onPageNotFound`
*
* 1.9.90
*/
onPageNotFound(options: PageNotFoundOption): void
/**
* Promise 使 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 绑定监听。注意事项请参考 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)。
* **** [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 一致
*/
onUnhandledRejection: OnUnhandledRejectionCallback
/**
* 使 wx.onThemeChange
*
* 2.11.0
*/
onThemeChange: OnThemeChangeCallback
}
type Instance<T extends IAnyObject> = Option & T
type Options<T extends IAnyObject> = Partial<Option> &
T &
ThisType<Instance<T>>
type TrivialInstance = Instance<IAnyObject>
interface Constructor {
<T extends IAnyObject>(options: Options<T>): void
}
interface GetAppOption {
/** `App` AppApp
*
* 2.2.4
*/
allowDefault?: boolean
}
interface GetApp {
<T extends IAnyObject = IAnyObject>(opts?: GetAppOption): Instance<T>
}
}
declare let App: WechatMiniprogram.App.Constructor
declare let getApp: WechatMiniprogram.App.GetApp

@ -1,68 +0,0 @@
/*! *****************************************************************************
Copyright (c) 2022 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
***************************************************************************** */
declare namespace WechatMiniprogram.Behavior {
type BehaviorIdentifier = string
type Instance<
TData extends DataOption,
TProperty extends PropertyOption,
TMethod extends MethodOption,
TCustomInstanceProperty extends IAnyObject = Record<string, never>
> = Component.Instance<TData, TProperty, TMethod, TCustomInstanceProperty>
type TrivialInstance = Instance<IAnyObject, IAnyObject, IAnyObject>
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject>
type Options<
TData extends DataOption,
TProperty extends PropertyOption,
TMethod extends MethodOption,
TCustomInstanceProperty extends IAnyObject = Record<string, never>
> = Partial<Data<TData>> &
Partial<Property<TProperty>> &
Partial<Method<TMethod>> &
Partial<OtherOption> &
Partial<Lifetimes> &
ThisType<Instance<TData, TProperty, TMethod, TCustomInstanceProperty>>
interface Constructor {
<
TData extends DataOption,
TProperty extends PropertyOption,
TMethod extends MethodOption,
TCustomInstanceProperty extends IAnyObject = Record<string, never>
>(
options: Options<TData, TProperty, TMethod, TCustomInstanceProperty>
): BehaviorIdentifier
}
type DataOption = Component.DataOption
type PropertyOption = Component.PropertyOption
type MethodOption = Component.MethodOption
type Data<D extends DataOption> = Component.Data<D>
type Property<P extends PropertyOption> = Component.Property<P>
type Method<M extends MethodOption> = Component.Method<M>
type DefinitionFilter = Component.DefinitionFilter
type Lifetimes = Component.Lifetimes
type OtherOption = Omit<Component.OtherOption, 'options'>
}
/** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/
declare let Behavior: WechatMiniprogram.Behavior.Constructor

@ -1,979 +0,0 @@
/*! *****************************************************************************
Copyright (c) 2022 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
***************************************************************************** */
interface IAPIError {
errMsg: string
}
interface IAPIParam<T = any> {
config?: ICloudConfig
success?: (res: T) => void
fail?: (err: IAPIError) => void
complete?: (val: T | IAPIError) => void
}
interface IAPISuccessParam {
errMsg: string
}
type IAPICompleteParam = IAPISuccessParam | IAPIError
type IAPIFunction<T, P extends IAPIParam<T>> = (param?: P) => Promise<T>
interface IInitCloudConfig {
env?:
| string
| {
database?: string
functions?: string
storage?: string
}
traceUser?: boolean
}
interface ICloudConfig {
env?: string
traceUser?: boolean
}
interface IICloudAPI {
init: (config?: IInitCloudConfig) => void
[api: string]: AnyFunction | IAPIFunction<any, any>
}
interface ICloudService {
name: string
getAPIs: () => { [name: string]: IAPIFunction<any, any> }
}
interface ICloudServices {
[serviceName: string]: ICloudService
}
interface ICloudMetaData {
session_id: string
}
declare class InternalSymbol {}
interface AnyObject {
[x: string]: any
}
type AnyArray = any[]
type AnyFunction = (...args: any[]) => any
/**
* extend wx with cloud
*/
interface WxCloud {
init: (config?: ICloudConfig) => void
callFunction(param: OQ<ICloud.CallFunctionParam>): void
callFunction(
param: RQ<ICloud.CallFunctionParam>
): Promise<ICloud.CallFunctionResult>
uploadFile(param: OQ<ICloud.UploadFileParam>): WechatMiniprogram.UploadTask
uploadFile(
param: RQ<ICloud.UploadFileParam>
): Promise<ICloud.UploadFileResult>
downloadFile(
param: OQ<ICloud.DownloadFileParam>
): WechatMiniprogram.DownloadTask
downloadFile(
param: RQ<ICloud.DownloadFileParam>
): Promise<ICloud.DownloadFileResult>
getTempFileURL(param: OQ<ICloud.GetTempFileURLParam>): void
getTempFileURL(
param: RQ<ICloud.GetTempFileURLParam>
): Promise<ICloud.GetTempFileURLResult>
deleteFile(param: OQ<ICloud.DeleteFileParam>): void
deleteFile(
param: RQ<ICloud.DeleteFileParam>
): Promise<ICloud.DeleteFileResult>
database: (config?: ICloudConfig) => DB.Database
CloudID: ICloud.ICloudIDConstructor
CDN: ICloud.ICDNConstructor
callContainer(param: OQ<ICloud.CallContainerParam>): void
callContainer(
param: RQ<ICloud.CallContainerParam>
): Promise<ICloud.CallContainerResult>
connectContainer(param: OQ<ICloud.ConnectContainerParam>): void
connectContainer(
param: RQ<ICloud.ConnectContainerParam>
): Promise<ICloud.ConnectContainerResult>
}
declare namespace ICloud {
interface ICloudAPIParam<T = any> extends IAPIParam<T> {
config?: ICloudConfig
}
// === API: callFunction ===
type CallFunctionData = AnyObject
interface CallFunctionResult extends IAPISuccessParam {
result: AnyObject | string | undefined
}
interface CallFunctionParam extends ICloudAPIParam<CallFunctionResult> {
name: string
data?: CallFunctionData
slow?: boolean
}
// === end ===
// === API: container ===
type CallContainerData = AnyObject
interface CallContainerResult extends IAPISuccessParam {
data: any
statusCode: number
header: Record<string, any>
callID: string
}
interface CallContainerParam extends ICloudAPIParam<CallContainerResult> {
path: string
service?: string
method?: string
header?: Record<string, any>
data?: any // string, object, ArrayBuffer
dataType?: string
responseType?: string
timeout?: number
verbose?: boolean
followRedirect?: boolean
}
interface ConnectContainerResult extends IAPISuccessParam {
socketTask: WechatMiniprogram.SocketTask
}
interface ConnectSocketOptions extends IAPIParam<void> {
header?: Record<string, string>
protocols?: string[]
tcpNoDelay?: boolean
perMessageDeflate?: boolean
timeout?: number
}
type ConnectContainerParam = Omit<
ConnectSocketOptions,
'success' | 'fail' | 'complete'
> &
ICloudAPIParam<ConnectContainerResult> & {
service: string
path?: string
}
// === end ===
// === API: uploadFile ===
interface UploadFileResult extends IAPISuccessParam {
fileID: string
statusCode: number
}
interface UploadFileParam extends ICloudAPIParam<UploadFileResult> {
cloudPath: string
filePath: string
header?: AnyObject
}
// === end ===
// === API: downloadFile ===
interface DownloadFileResult extends IAPISuccessParam {
tempFilePath: string
statusCode: number
}
interface DownloadFileParam extends ICloudAPIParam<DownloadFileResult> {
fileID: string
cloudPath?: string
}
// === end ===
// === API: getTempFileURL ===
interface GetTempFileURLResult extends IAPISuccessParam {
fileList: GetTempFileURLResultItem[]
}
interface GetTempFileURLResultItem {
fileID: string
tempFileURL: string
maxAge: number
status: number
errMsg: string
}
interface GetTempFileURLParam extends ICloudAPIParam<GetTempFileURLResult> {
fileList: string[]
}
// === end ===
// === API: deleteFile ===
interface DeleteFileResult extends IAPISuccessParam {
fileList: DeleteFileResultItem[]
}
interface DeleteFileResultItem {
fileID: string
status: number
errMsg: string
}
interface DeleteFileParam extends ICloudAPIParam<DeleteFileResult> {
fileList: string[]
}
// === end ===
// === API: CloudID ===
abstract class CloudID {
constructor(cloudID: string)
}
interface ICloudIDConstructor {
new (cloudId: string): CloudID
(cloudId: string): CloudID
}
// === end ===
// === API: CDN ===
abstract class CDN {
target: string | ArrayBuffer | ICDNFilePathSpec
constructor(target: string | ArrayBuffer | ICDNFilePathSpec)
}
interface ICDNFilePathSpec {
type: 'filePath'
filePath: string
}
interface ICDNConstructor {
new (options: string | ArrayBuffer | ICDNFilePathSpec): CDN
(options: string | ArrayBuffer | ICDNFilePathSpec): CDN
}
// === end ===
}
// === Database ===
declare namespace DB {
/**
* The class of all exposed cloud database instances
*/
class Database {
readonly config: ICloudConfig
readonly command: DatabaseCommand
readonly Geo: IGeo
readonly serverDate: () => ServerDate
readonly RegExp: IRegExpConstructor
private constructor()
collection(collectionName: string): CollectionReference
}
class CollectionReference extends Query {
readonly collectionName: string
private constructor(name: string, database: Database)
doc(docId: string | number): DocumentReference
add(options: OQ<IAddDocumentOptions>): void
add(options: RQ<IAddDocumentOptions>): Promise<IAddResult>
}
class DocumentReference {
private constructor(docId: string | number, database: Database)
field(object: Record<string, any>): this
get(options: OQ<IGetDocumentOptions>): void
get(options?: RQ<IGetDocumentOptions>): Promise<IQuerySingleResult>
set(options: OQ<ISetSingleDocumentOptions>): void
set(options?: RQ<ISetSingleDocumentOptions>): Promise<ISetResult>
update(options: OQ<IUpdateSingleDocumentOptions>): void
update(
options?: RQ<IUpdateSingleDocumentOptions>
): Promise<IUpdateResult>
remove(options: OQ<IRemoveSingleDocumentOptions>): void
remove(
options?: RQ<IRemoveSingleDocumentOptions>
): Promise<IRemoveResult>
watch(options: IWatchOptions): RealtimeListener
}
class RealtimeListener {
// "And Now His Watch Is Ended"
close: () => Promise<void>
}
class Query {
where(condition: IQueryCondition): Query
orderBy(fieldPath: string, order: string): Query
limit(max: number): Query
skip(offset: number): Query
field(object: Record<string, any>): Query
get(options: OQ<IGetDocumentOptions>): void
get(options?: RQ<IGetDocumentOptions>): Promise<IQueryResult>
count(options: OQ<ICountDocumentOptions>): void
count(options?: RQ<ICountDocumentOptions>): Promise<ICountResult>
watch(options: IWatchOptions): RealtimeListener
}
interface DatabaseCommand {
eq(val: any): DatabaseQueryCommand
neq(val: any): DatabaseQueryCommand
gt(val: any): DatabaseQueryCommand
gte(val: any): DatabaseQueryCommand
lt(val: any): DatabaseQueryCommand
lte(val: any): DatabaseQueryCommand
in(val: any[]): DatabaseQueryCommand
nin(val: any[]): DatabaseQueryCommand
geoNear(options: IGeoNearCommandOptions): DatabaseQueryCommand
geoWithin(options: IGeoWithinCommandOptions): DatabaseQueryCommand
geoIntersects(
options: IGeoIntersectsCommandOptions
): DatabaseQueryCommand
and(
...expressions: Array<DatabaseLogicCommand | IQueryCondition>
): DatabaseLogicCommand
or(
...expressions: Array<DatabaseLogicCommand | IQueryCondition>
): DatabaseLogicCommand
nor(
...expressions: Array<DatabaseLogicCommand | IQueryCondition>
): DatabaseLogicCommand
not(expression: DatabaseLogicCommand): DatabaseLogicCommand
exists(val: boolean): DatabaseQueryCommand
mod(divisor: number, remainder: number): DatabaseQueryCommand
all(val: any[]): DatabaseQueryCommand
elemMatch(val: any): DatabaseQueryCommand
size(val: number): DatabaseQueryCommand
set(val: any): DatabaseUpdateCommand
remove(): DatabaseUpdateCommand
inc(val: number): DatabaseUpdateCommand
mul(val: number): DatabaseUpdateCommand
min(val: number): DatabaseUpdateCommand
max(val: number): DatabaseUpdateCommand
rename(val: string): DatabaseUpdateCommand
bit(val: number): DatabaseUpdateCommand
push(...values: any[]): DatabaseUpdateCommand
pop(): DatabaseUpdateCommand
shift(): DatabaseUpdateCommand
unshift(...values: any[]): DatabaseUpdateCommand
addToSet(val: any): DatabaseUpdateCommand
pull(val: any): DatabaseUpdateCommand
pullAll(val: any): DatabaseUpdateCommand
project: {
slice(val: number | [number, number]): DatabaseProjectionCommand
}
aggregate: {
__safe_props__?: Set<string>
abs(val: any): DatabaseAggregateCommand
add(val: any): DatabaseAggregateCommand
addToSet(val: any): DatabaseAggregateCommand
allElementsTrue(val: any): DatabaseAggregateCommand
and(val: any): DatabaseAggregateCommand
anyElementTrue(val: any): DatabaseAggregateCommand
arrayElemAt(val: any): DatabaseAggregateCommand
arrayToObject(val: any): DatabaseAggregateCommand
avg(val: any): DatabaseAggregateCommand
ceil(val: any): DatabaseAggregateCommand
cmp(val: any): DatabaseAggregateCommand
concat(val: any): DatabaseAggregateCommand
concatArrays(val: any): DatabaseAggregateCommand
cond(val: any): DatabaseAggregateCommand
convert(val: any): DatabaseAggregateCommand
dateFromParts(val: any): DatabaseAggregateCommand
dateToParts(val: any): DatabaseAggregateCommand
dateFromString(val: any): DatabaseAggregateCommand
dateToString(val: any): DatabaseAggregateCommand
dayOfMonth(val: any): DatabaseAggregateCommand
dayOfWeek(val: any): DatabaseAggregateCommand
dayOfYear(val: any): DatabaseAggregateCommand
divide(val: any): DatabaseAggregateCommand
eq(val: any): DatabaseAggregateCommand
exp(val: any): DatabaseAggregateCommand
filter(val: any): DatabaseAggregateCommand
first(val: any): DatabaseAggregateCommand
floor(val: any): DatabaseAggregateCommand
gt(val: any): DatabaseAggregateCommand
gte(val: any): DatabaseAggregateCommand
hour(val: any): DatabaseAggregateCommand
ifNull(val: any): DatabaseAggregateCommand
in(val: any): DatabaseAggregateCommand
indexOfArray(val: any): DatabaseAggregateCommand
indexOfBytes(val: any): DatabaseAggregateCommand
indexOfCP(val: any): DatabaseAggregateCommand
isArray(val: any): DatabaseAggregateCommand
isoDayOfWeek(val: any): DatabaseAggregateCommand
isoWeek(val: any): DatabaseAggregateCommand
isoWeekYear(val: any): DatabaseAggregateCommand
last(val: any): DatabaseAggregateCommand
let(val: any): DatabaseAggregateCommand
literal(val: any): DatabaseAggregateCommand
ln(val: any): DatabaseAggregateCommand
log(val: any): DatabaseAggregateCommand
log10(val: any): DatabaseAggregateCommand
lt(val: any): DatabaseAggregateCommand
lte(val: any): DatabaseAggregateCommand
ltrim(val: any): DatabaseAggregateCommand
map(val: any): DatabaseAggregateCommand
max(val: any): DatabaseAggregateCommand
mergeObjects(val: any): DatabaseAggregateCommand
meta(val: any): DatabaseAggregateCommand
min(val: any): DatabaseAggregateCommand
millisecond(val: any): DatabaseAggregateCommand
minute(val: any): DatabaseAggregateCommand
mod(val: any): DatabaseAggregateCommand
month(val: any): DatabaseAggregateCommand
multiply(val: any): DatabaseAggregateCommand
neq(val: any): DatabaseAggregateCommand
not(val: any): DatabaseAggregateCommand
objectToArray(val: any): DatabaseAggregateCommand
or(val: any): DatabaseAggregateCommand
pow(val: any): DatabaseAggregateCommand
push(val: any): DatabaseAggregateCommand
range(val: any): DatabaseAggregateCommand
reduce(val: any): DatabaseAggregateCommand
reverseArray(val: any): DatabaseAggregateCommand
rtrim(val: any): DatabaseAggregateCommand
second(val: any): DatabaseAggregateCommand
setDifference(val: any): DatabaseAggregateCommand
setEquals(val: any): DatabaseAggregateCommand
setIntersection(val: any): DatabaseAggregateCommand
setIsSubset(val: any): DatabaseAggregateCommand
setUnion(val: any): DatabaseAggregateCommand
size(val: any): DatabaseAggregateCommand
slice(val: any): DatabaseAggregateCommand
split(val: any): DatabaseAggregateCommand
sqrt(val: any): DatabaseAggregateCommand
stdDevPop(val: any): DatabaseAggregateCommand
stdDevSamp(val: any): DatabaseAggregateCommand
strcasecmp(val: any): DatabaseAggregateCommand
strLenBytes(val: any): DatabaseAggregateCommand
strLenCP(val: any): DatabaseAggregateCommand
substr(val: any): DatabaseAggregateCommand
substrBytes(val: any): DatabaseAggregateCommand
substrCP(val: any): DatabaseAggregateCommand
subtract(val: any): DatabaseAggregateCommand
sum(val: any): DatabaseAggregateCommand
switch(val: any): DatabaseAggregateCommand
toBool(val: any): DatabaseAggregateCommand
toDate(val: any): DatabaseAggregateCommand
toDecimal(val: any): DatabaseAggregateCommand
toDouble(val: any): DatabaseAggregateCommand
toInt(val: any): DatabaseAggregateCommand
toLong(val: any): DatabaseAggregateCommand
toObjectId(val: any): DatabaseAggregateCommand
toString(val: any): DatabaseAggregateCommand
toLower(val: any): DatabaseAggregateCommand
toUpper(val: any): DatabaseAggregateCommand
trim(val: any): DatabaseAggregateCommand
trunc(val: any): DatabaseAggregateCommand
type(val: any): DatabaseAggregateCommand
week(val: any): DatabaseAggregateCommand
year(val: any): DatabaseAggregateCommand
zip(val: any): DatabaseAggregateCommand
}
}
class DatabaseAggregateCommand {}
enum LOGIC_COMMANDS_LITERAL {
AND = 'and',
OR = 'or',
NOT = 'not',
NOR = 'nor'
}
class DatabaseLogicCommand {
and(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand
or(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand
nor(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand
not(expression: DatabaseLogicCommand): DatabaseLogicCommand
}
enum QUERY_COMMANDS_LITERAL {
// comparison
EQ = 'eq',
NEQ = 'neq',
GT = 'gt',
GTE = 'gte',
LT = 'lt',
LTE = 'lte',
IN = 'in',
NIN = 'nin',
// geo
GEO_NEAR = 'geoNear',
GEO_WITHIN = 'geoWithin',
GEO_INTERSECTS = 'geoIntersects',
// element
EXISTS = 'exists',
// evaluation
MOD = 'mod',
// array
ALL = 'all',
ELEM_MATCH = 'elemMatch',
SIZE = 'size'
}
class DatabaseQueryCommand extends DatabaseLogicCommand {
eq(val: any): DatabaseLogicCommand
neq(val: any): DatabaseLogicCommand
gt(val: any): DatabaseLogicCommand
gte(val: any): DatabaseLogicCommand
lt(val: any): DatabaseLogicCommand
lte(val: any): DatabaseLogicCommand
in(val: any[]): DatabaseLogicCommand
nin(val: any[]): DatabaseLogicCommand
exists(val: boolean): DatabaseLogicCommand
mod(divisor: number, remainder: number): DatabaseLogicCommand
all(val: any[]): DatabaseLogicCommand
elemMatch(val: any): DatabaseLogicCommand
size(val: number): DatabaseLogicCommand
geoNear(options: IGeoNearCommandOptions): DatabaseLogicCommand
geoWithin(options: IGeoWithinCommandOptions): DatabaseLogicCommand
geoIntersects(
options: IGeoIntersectsCommandOptions
): DatabaseLogicCommand
}
enum PROJECTION_COMMANDS_LITERAL {
SLICE = 'slice'
}
class DatabaseProjectionCommand {}
enum UPDATE_COMMANDS_LITERAL {
// field
SET = 'set',
REMOVE = 'remove',
INC = 'inc',
MUL = 'mul',
MIN = 'min',
MAX = 'max',
RENAME = 'rename',
// bitwise
BIT = 'bit',
// array
PUSH = 'push',
POP = 'pop',
SHIFT = 'shift',
UNSHIFT = 'unshift',
ADD_TO_SET = 'addToSet',
PULL = 'pull',
PULL_ALL = 'pullAll'
}
class DatabaseUpdateCommand {}
class Batch {}
/**
* A contract that all API provider must adhere to
*/
class APIBaseContract<
PromiseReturn,
CallbackReturn,
Param extends IAPIParam,
Context = any
> {
getContext(param: Param): Context
/**
* In case of callback-style invocation, this function will be called
*/
getCallbackReturn(param: Param, context: Context): CallbackReturn
getFinalParam<T extends Param>(param: Param, context: Context): T
run<T extends Param>(param: T): Promise<PromiseReturn>
}
interface IGeoPointConstructor {
new (longitude: number, latitide: number): GeoPoint
new (geojson: IGeoJSONPoint): GeoPoint
(longitude: number, latitide: number): GeoPoint
(geojson: IGeoJSONPoint): GeoPoint
}
interface IGeoMultiPointConstructor {
new (points: GeoPoint[] | IGeoJSONMultiPoint): GeoMultiPoint
(points: GeoPoint[] | IGeoJSONMultiPoint): GeoMultiPoint
}
interface IGeoLineStringConstructor {
new (points: GeoPoint[] | IGeoJSONLineString): GeoLineString
(points: GeoPoint[] | IGeoJSONLineString): GeoLineString
}
interface IGeoMultiLineStringConstructor {
new (
lineStrings: GeoLineString[] | IGeoJSONMultiLineString
): GeoMultiLineString
(
lineStrings: GeoLineString[] | IGeoJSONMultiLineString
): GeoMultiLineString
}
interface IGeoPolygonConstructor {
new (lineStrings: GeoLineString[] | IGeoJSONPolygon): GeoPolygon
(lineStrings: GeoLineString[] | IGeoJSONPolygon): GeoPolygon
}
interface IGeoMultiPolygonConstructor {
new (polygons: GeoPolygon[] | IGeoJSONMultiPolygon): GeoMultiPolygon
(polygons: GeoPolygon[] | IGeoJSONMultiPolygon): GeoMultiPolygon
}
interface IGeo {
Point: IGeoPointConstructor
MultiPoint: IGeoMultiPointConstructor
LineString: IGeoLineStringConstructor
MultiLineString: IGeoMultiLineStringConstructor
Polygon: IGeoPolygonConstructor
MultiPolygon: IGeoMultiPolygonConstructor
}
interface IGeoJSONPoint {
type: 'Point'
coordinates: [number, number]
}
interface IGeoJSONMultiPoint {
type: 'MultiPoint'
coordinates: Array<[number, number]>
}
interface IGeoJSONLineString {
type: 'LineString'
coordinates: Array<[number, number]>
}
interface IGeoJSONMultiLineString {
type: 'MultiLineString'
coordinates: Array<Array<[number, number]>>
}
interface IGeoJSONPolygon {
type: 'Polygon'
coordinates: Array<Array<[number, number]>>
}
interface IGeoJSONMultiPolygon {
type: 'MultiPolygon'
coordinates: Array<Array<Array<[number, number]>>>
}
type IGeoJSONObject =
| IGeoJSONPoint
| IGeoJSONMultiPoint
| IGeoJSONLineString
| IGeoJSONMultiLineString
| IGeoJSONPolygon
| IGeoJSONMultiPolygon
abstract class GeoPoint {
longitude: number
latitude: number
constructor(longitude: number, latitude: number)
toJSON(): Record<string, any>
toString(): string
}
abstract class GeoMultiPoint {
points: GeoPoint[]
constructor(points: GeoPoint[])
toJSON(): IGeoJSONMultiPoint
toString(): string
}
abstract class GeoLineString {
points: GeoPoint[]
constructor(points: GeoPoint[])
toJSON(): IGeoJSONLineString
toString(): string
}
abstract class GeoMultiLineString {
lines: GeoLineString[]
constructor(lines: GeoLineString[])
toJSON(): IGeoJSONMultiLineString
toString(): string
}
abstract class GeoPolygon {
lines: GeoLineString[]
constructor(lines: GeoLineString[])
toJSON(): IGeoJSONPolygon
toString(): string
}
abstract class GeoMultiPolygon {
polygons: GeoPolygon[]
constructor(polygons: GeoPolygon[])
toJSON(): IGeoJSONMultiPolygon
toString(): string
}
type GeoInstance =
| GeoPoint
| GeoMultiPoint
| GeoLineString
| GeoMultiLineString
| GeoPolygon
| GeoMultiPolygon
interface IGeoNearCommandOptions {
geometry: GeoPoint
maxDistance?: number
minDistance?: number
}
interface IGeoWithinCommandOptions {
geometry: GeoPolygon | GeoMultiPolygon
}
interface IGeoIntersectsCommandOptions {
geometry:
| GeoPoint
| GeoMultiPoint
| GeoLineString
| GeoMultiLineString
| GeoPolygon
| GeoMultiPolygon
}
interface IServerDateOptions {
offset: number
}
abstract class ServerDate {
readonly options: IServerDateOptions
constructor(options?: IServerDateOptions)
}
interface IRegExpOptions {
regexp: string
options?: string
}
interface IRegExpConstructor {
new (options: IRegExpOptions): RegExp
(options: IRegExpOptions): RegExp
}
abstract class RegExp {
readonly regexp: string
readonly options: string
constructor(options: IRegExpOptions)
}
type DocumentId = string | number
interface IDocumentData {
_id?: DocumentId
[key: string]: any
}
type IDBAPIParam = IAPIParam
interface IAddDocumentOptions extends IDBAPIParam {
data: IDocumentData
}
type IGetDocumentOptions = IDBAPIParam
type ICountDocumentOptions = IDBAPIParam
interface IUpdateDocumentOptions extends IDBAPIParam {
data: IUpdateCondition
}
interface IUpdateSingleDocumentOptions extends IDBAPIParam {
data: IUpdateCondition
}
interface ISetDocumentOptions extends IDBAPIParam {
data: IUpdateCondition
}
interface ISetSingleDocumentOptions extends IDBAPIParam {
data: IUpdateCondition
}
interface IRemoveDocumentOptions extends IDBAPIParam {
query: IQueryCondition
}
type IRemoveSingleDocumentOptions = IDBAPIParam
interface IWatchOptions {
// server realtime data init & change event
onChange: (snapshot: ISnapshot) => void
// error while connecting / listening
onError: (error: any) => void
}
interface ISnapshot {
id: number
docChanges: ISingleDBEvent[]
docs: Record<string, any>
type?: SnapshotType
}
type SnapshotType = 'init'
interface ISingleDBEvent {
id: number
dataType: DataType
queueType: QueueType
docId: string
doc: Record<string, any>
updatedFields?: Record<string, any>
removedFields?: string[]
}
type DataType = 'init' | 'update' | 'replace' | 'add' | 'remove' | 'limit'
type QueueType = 'init' | 'enqueue' | 'dequeue' | 'update'
interface IQueryCondition {
[key: string]: any
}
type IStringQueryCondition = string
interface IQueryResult extends IAPISuccessParam {
data: IDocumentData[]
}
interface IQuerySingleResult extends IAPISuccessParam {
data: IDocumentData
}
interface IUpdateCondition {
[key: string]: any
}
type IStringUpdateCondition = string
interface IAddResult extends IAPISuccessParam {
_id: DocumentId
}
interface IUpdateResult extends IAPISuccessParam {
stats: {
updated: number
// created: number,
}
}
interface ISetResult extends IAPISuccessParam {
_id: DocumentId
stats: {
updated: number
created: number
}
}
interface IRemoveResult extends IAPISuccessParam {
stats: {
removed: number
}
}
interface ICountResult extends IAPISuccessParam {
total: number
}
}
type Optional<T> = { [K in keyof T]+?: T[K] }
type OQ<
T extends Optional<
Record<'complete' | 'success' | 'fail', (...args: any[]) => any>
>
> =
| (RQ<T> & Required<Pick<T, 'success'>>)
| (RQ<T> & Required<Pick<T, 'fail'>>)
| (RQ<T> & Required<Pick<T, 'complete'>>)
| (RQ<T> & Required<Pick<T, 'success' | 'fail'>>)
| (RQ<T> & Required<Pick<T, 'success' | 'complete'>>)
| (RQ<T> & Required<Pick<T, 'fail' | 'complete'>>)
| (RQ<T> & Required<Pick<T, 'fail' | 'complete' | 'success'>>)
type RQ<
T extends Optional<
Record<'complete' | 'success' | 'fail', (...args: any[]) => any>
>
> = Pick<T, Exclude<keyof T, 'complete' | 'success' | 'fail'>>

@ -1,676 +0,0 @@
/*! *****************************************************************************
Copyright (c) 2022 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
***************************************************************************** */
declare namespace WechatMiniprogram.Component {
type Instance<
TData extends DataOption,
TProperty extends PropertyOption,
TMethod extends Partial<MethodOption>,
TCustomInstanceProperty extends IAnyObject = {},
TIsPage extends boolean = false
> = InstanceProperties &
InstanceMethods<TData> &
TMethod &
(TIsPage extends true ? Page.ILifetime : {}) &
TCustomInstanceProperty & {
/** 组件数据,**包括内部数据和属性值** */
data: TData & PropertyOptionToData<TProperty>
/** 组件数据,**包括内部数据和属性值**(与 `data` 一致) */
properties: TData & PropertyOptionToData<TProperty>
}
type TrivialInstance = Instance<
IAnyObject,
IAnyObject,
IAnyObject,
IAnyObject
>
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, IAnyObject>
type Options<
TData extends DataOption,
TProperty extends PropertyOption,
TMethod extends MethodOption,
TCustomInstanceProperty extends IAnyObject = {},
TIsPage extends boolean = false
> = Partial<Data<TData>> &
Partial<Property<TProperty>> &
Partial<Method<TMethod, TIsPage>> &
Partial<OtherOption> &
Partial<Lifetimes> &
ThisType<
Instance<
TData,
TProperty,
TMethod,
TCustomInstanceProperty,
TIsPage
>
>
interface Constructor {
<
TData extends DataOption,
TProperty extends PropertyOption,
TMethod extends MethodOption,
TCustomInstanceProperty extends IAnyObject = {},
TIsPage extends boolean = false
>(
options: Options<
TData,
TProperty,
TMethod,
TCustomInstanceProperty,
TIsPage
>
): string
}
type DataOption = Record<string, any>
type PropertyOption = Record<string, AllProperty>
type MethodOption = Record<string, Function>
interface Data<D extends DataOption> {
/** 组件的内部数据,和 `properties` 一同用于组件的模板渲染 */
data?: D
}
interface Property<P extends PropertyOption> {
/** 组件的对外属性,是属性名到属性设置的映射表 */
properties: P
}
interface Method<M extends MethodOption, TIsPage extends boolean = false> {
/** 组件的方法,包括事件响应函数和任意的自定义方法,关于事件响应函数的使用,参见 [组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) */
methods: M & (TIsPage extends true ? Partial<Page.ILifetime> : {})
}
type PropertyType =
| StringConstructor
| NumberConstructor
| BooleanConstructor
| ArrayConstructor
| ObjectConstructor
| null
type ValueType<T extends PropertyType> = T extends null
? any
: T extends StringConstructor
? string
: T extends NumberConstructor
? number
: T extends BooleanConstructor
? boolean
: T extends ArrayConstructor
? any[]
: T extends ObjectConstructor
? IAnyObject
: never
type FullProperty<T extends PropertyType> = {
/** 属性类型 */
type: T
/** 属性初始值 */
value?: ValueType<T>
/** 属性值被更改时的响应函数 */
observer?:
| string
| ((
newVal: ValueType<T>,
oldVal: ValueType<T>,
changedPath: Array<string | number>
) => void)
/** 属性的类型(可以指定多个) */
optionalTypes?: ShortProperty[]
}
type AllFullProperty =
| FullProperty<StringConstructor>
| FullProperty<NumberConstructor>
| FullProperty<BooleanConstructor>
| FullProperty<ArrayConstructor>
| FullProperty<ObjectConstructor>
| FullProperty<null>
type ShortProperty =
| StringConstructor
| NumberConstructor
| BooleanConstructor
| ArrayConstructor
| ObjectConstructor
| null
type AllProperty = AllFullProperty | ShortProperty
type PropertyToData<T extends AllProperty> = T extends ShortProperty
? ValueType<T>
: FullPropertyToData<Exclude<T, ShortProperty>>
type FullPropertyToData<T extends AllFullProperty> = ValueType<T['type']>
// type FullPropertyToData<T extends AllFullProperty> = unknown extends T['value'] ? ValueType<T['type']> : T['value']
type PropertyOptionToData<P extends PropertyOption> = {
[name in keyof P]: PropertyToData<P[name]>
}
interface InstanceProperties {
/** 组件的文件路径 */
is: string
/** 节点id */
id: string
/** 节点dataset */
dataset: Record<string, string>
}
interface InstanceMethods<D extends DataOption> {
/** `setData`
* `this.data`
*
* ****
*
* 1. ** this.data this.setData **
* 1. JSON
* 1. 1024kB
* 1. data value `undefined`
*/
setData(
/**
*
* `key: value` `this.data` `key` `value`
*
* `key` `array[2].message``a.b.c.d` this.data
*/
data: Partial<D> & IAnyObject,
/** setData引起的界面更新渲染完毕后的回调函数最低基础库 `1.5.0` */
callback?: () => void
): void
/** 检查组件是否具有 `behavior` 检查时会递归检查被直接或间接引入的所有behavior */
hasBehavior(behavior: Behavior.BehaviorIdentifier): void
/** 触发事件,参见组件事件 */
triggerEvent<DetailType = any>(
name: string,
detail?: DetailType,
options?: TriggerEventOption
): void
/** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
createSelectorQuery(): SelectorQuery
/** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
createIntersectionObserver(
options: CreateIntersectionObserverOption
): IntersectionObserver
/** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 `wx://component-export` 影响) */
selectComponent(selector: string): TrivialInstance
/** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组 */
selectAllComponents(selector: string): TrivialInstance[]
/**
* `wx://component-export`
*
* [`2.8.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
**/
selectOwnerComponent(): TrivialInstance
/** 获取这个关系所对应的所有关联节点,参见 组件间关系 */
getRelationNodes(relationKey: string): TrivialInstance[]
/**
* callback setData setData
*
* [`2.4.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
**/
groupSetData(callback?: () => void): void
/**
* custom-tab-bar
*
* [`2.6.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
**/
getTabBar(): TrivialInstance
/**
*
*
* [`2.7.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
**/
getPageId(): string
/**
* [](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
*
* [`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
**/
animate(
selector: string,
keyFrames: KeyFrame[],
duration: number,
callback?: () => void
): void
/**
* [](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
*
* [`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
**/
animate(
selector: string,
keyFrames: ScrollTimelineKeyframe[],
duration: number,
scrollTimeline: ScrollTimelineOption
): void
/**
* [](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
*
* [`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
**/
clearAnimation(selector: string, callback: () => void): void
/**
* [](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
*
* [`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
**/
clearAnimation(
selector: string,
options?: ClearAnimationOptions,
callback?: () => void
): void
/**
* [wx.navigateTo]((wx.navigateTo))
*
* [`2.7.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
getOpenerEventChannel(): EventChannel
/**
* []((custom-component/update-perf-stat))
*
*
* [`2.12.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
setUpdatePerformanceListener<WithDataPath extends boolean = false>(
options: SetUpdatePerformanceListenerOption<WithDataPath>,
callback?: UpdatePerformanceListener<WithDataPath>
): void
}
interface ComponentOptions {
/**
* [slot](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件wxml的slot)
*/
multipleSlots?: boolean
/**
* [](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件样式隔离)
*/
addGlobalClass?: boolean
/**
* [](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件样式隔离)
*/
styleIsolation?:
| 'isolated'
| 'apply-shared'
| 'shared'
| 'page-isolated'
| 'page-apply-shared'
| 'page-shared'
/**
* [](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/pure-data.html) 是一些不用于界面渲染的 data 字段,可以用于提升页面更新性能。从小程序基础库版本 2.8.2 开始支持。
*/
pureDataPattern?: RegExp
/**
* [](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#%E8%99%9A%E6%8B%9F%E5%8C%96%E7%BB%84%E4%BB%B6%E8%8A%82%E7%82%B9) 使自定义组件内部的第一层节点由自定义组件本身完全决定。从小程序基础库版本 [`2.11.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持 */
virtualHost?: boolean
}
interface TriggerEventOption {
/**
*
* `false`
*/
bubbles?: boolean
/** 穿false
*
* `false`
*/
composed?: boolean
/**
*
* `false`
*/
capturePhase?: boolean
}
interface RelationOption {
/** 目标组件的相对关系 */
type: 'parent' | 'child' | 'ancestor' | 'descendant'
/** 关系生命周期函数当关系被建立在页面节点树中时触发触发时机在组件attached生命周期之后 */
linked?(target: TrivialInstance): void
/** 关系生命周期函数当关系在页面节点树中发生改变时触发触发时机在组件moved生命周期之后 */
linkChanged?(target: TrivialInstance): void
/** 关系生命周期函数当关系脱离页面节点树时触发触发时机在组件detached生命周期之后 */
unlinked?(target: TrivialInstance): void
/** 如果这一项被设置则它表示关联的目标节点所应具有的behavior所有拥有这一behavior的组件节点都会被关联 */
target?: string
}
interface PageLifetimes {
/**
*
* /
*/
show(): void
/**
*
* / `navigateTo` `tab`
*/
hide(): void
/**
*
*
*/
resize(size: Page.IResizeOption): void
}
type DefinitionFilter = <T extends TrivialOption>(
/** 使用该 behavior 的 component/behavior 的定义对象 */
defFields: T,
/** 该 behavior 所使用的 behavior 的 definitionFilter 函数列表 */
definitionFilterArr?: DefinitionFilter[]
) => void
interface Lifetimes {
/** `created``attached``ready``moved``detached` `lifetimes` `lifetimes`
*
* `2.2.3` */
lifetimes: Partial<{
/**
* `setData`
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
created(): void
/**
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
attached(): void
/**
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
ready(): void
/**
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
moved(): void
/**
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
detached(): void
/**
*
*
* [`2.4.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
error(err: Error): void
}>
/**
* @deprecated `2.2.3` lifetimes
*
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
created(): void
/**
* @deprecated `2.2.3` lifetimes
*
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
attached(): void
/**
* @deprecated `2.2.3` lifetimes
*
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
ready(): void
/**
* @deprecated `2.2.3` lifetimes
*
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
moved(): void
/**
* @deprecated `2.2.3` lifetimes
*
*
*
* [`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
detached(): void
/**
* @deprecated `2.2.3` lifetimes
*
*
*
* [`2.4.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
error(err: Error): void
}
interface OtherOption {
/** 类似于mixins和traits的组件间代码复用机制参见 [behaviors](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/behaviors.html) */
behaviors: Behavior.BehaviorIdentifier[]
/**
* properties data [](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/observer.html)
*
* [`2.6.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
*/
observers: Record<string, (...args: any[]) => any>
/** 组件间关系定义,参见 [组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html) */
relations: {
[componentName: string]: RelationOption
}
/** 组件接受的外部样式类,参见 [外部样式类](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html) */
externalClasses?: string[]
/** 组件所在页面的生命周期声明对象,参见 [组件生命周期](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html)
*
* [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */
pageLifetimes?: Partial<PageLifetimes>
/** 一些选项(文档中介绍相关特性时会涉及具体的选项设置,这里暂不列举) */
options: ComponentOptions
/** 定义段过滤器,用于自定义组件扩展,参见 [自定义组件扩展](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/extend.html)
*
* [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */
definitionFilter?: DefinitionFilter
/**
* 使 `behavior: wx://component-export` selectComponent [](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html)
* [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */
export: () => IAnyObject
}
interface KeyFrame {
/** 关键帧的偏移,范围[0-1] */
offset?: number
/** 动画缓动函数 */
ease?: string
/** 基点位置,即 CSS transform-origin */
transformOrigin?: string
/** 背景颜色,即 CSS background-color */
backgroundColor?: string
/** 底边位置,即 CSS bottom */
bottom?: number | string
/** 高度,即 CSS height */
height?: number | string
/** 左边位置,即 CSS left */
left?: number | string
/** 宽度,即 CSS width */
width?: number | string
/** 不透明度,即 CSS opacity */
opacity?: number | string
/** 右边位置,即 CSS right */
right?: number | string
/** 顶边位置,即 CSS top */
top?: number | string
/** 变换矩阵,即 CSS transform matrix */
matrix?: number[]
/** 三维变换矩阵,即 CSS transform matrix3d */
matrix3d?: number[]
/** 旋转,即 CSS transform rotate */
rotate?: number
/** 三维旋转,即 CSS transform rotate3d */
rotate3d?: number[]
/** X 方向旋转,即 CSS transform rotateX */
rotateX?: number
/** Y 方向旋转,即 CSS transform rotateY */
rotateY?: number
/** Z 方向旋转,即 CSS transform rotateZ */
rotateZ?: number
/** 缩放,即 CSS transform scale */
scale?: number[]
/** 三维缩放,即 CSS transform scale3d */
scale3d?: number[]
/** X 方向缩放,即 CSS transform scaleX */
scaleX?: number
/** Y 方向缩放,即 CSS transform scaleY */
scaleY?: number
/** Z 方向缩放,即 CSS transform scaleZ */
scaleZ?: number
/** 倾斜,即 CSS transform skew */
skew?: number[]
/** X 方向倾斜,即 CSS transform skewX */
skewX?: number
/** Y 方向倾斜,即 CSS transform skewY */
skewY?: number
/** 位移,即 CSS transform translate */
translate?: Array<number | string>
/** 三维位移,即 CSS transform translate3d */
translate3d?: Array<number | string>
/** X 方向位移,即 CSS transform translateX */
translateX?: number | string
/** Y 方向位移,即 CSS transform translateY */
translateY?: number | string
/** Z 方向位移,即 CSS transform translateZ */
translateZ?: number | string
}
interface ClearAnimationOptions {
/** 基点位置,即 CSS transform-origin */
transformOrigin?: boolean
/** 背景颜色,即 CSS background-color */
backgroundColor?: boolean
/** 底边位置,即 CSS bottom */
bottom?: boolean
/** 高度,即 CSS height */
height?: boolean
/** 左边位置,即 CSS left */
left?: boolean
/** 宽度,即 CSS width */
width?: boolean
/** 不透明度,即 CSS opacity */
opacity?: boolean
/** 右边位置,即 CSS right */
right?: boolean
/** 顶边位置,即 CSS top */
top?: boolean
/** 变换矩阵,即 CSS transform matrix */
matrix?: boolean
/** 三维变换矩阵,即 CSS transform matrix3d */
matrix3d?: boolean
/** 旋转,即 CSS transform rotate */
rotate?: boolean
/** 三维旋转,即 CSS transform rotate3d */
rotate3d?: boolean
/** X 方向旋转,即 CSS transform rotateX */
rotateX?: boolean
/** Y 方向旋转,即 CSS transform rotateY */
rotateY?: boolean
/** Z 方向旋转,即 CSS transform rotateZ */
rotateZ?: boolean
/** 缩放,即 CSS transform scale */
scale?: boolean
/** 三维缩放,即 CSS transform scale3d */
scale3d?: boolean
/** X 方向缩放,即 CSS transform scaleX */
scaleX?: boolean
/** Y 方向缩放,即 CSS transform scaleY */
scaleY?: boolean
/** Z 方向缩放,即 CSS transform scaleZ */
scaleZ?: boolean
/** 倾斜,即 CSS transform skew */
skew?: boolean
/** X 方向倾斜,即 CSS transform skewX */
skewX?: boolean
/** Y 方向倾斜,即 CSS transform skewY */
skewY?: boolean
/** 位移,即 CSS transform translate */
translate?: boolean
/** 三维位移,即 CSS transform translate3d */
translate3d?: boolean
/** X 方向位移,即 CSS transform translateX */
translateX?: boolean
/** Y 方向位移,即 CSS transform translateY */
translateY?: boolean
/** Z 方向位移,即 CSS transform translateZ */
translateZ?: boolean
}
interface ScrollTimelineKeyframe {
composite?: 'replace' | 'add' | 'accumulate' | 'auto'
easing?: string
offset?: number | null
[property: string]: string | number | null | undefined
}
interface ScrollTimelineOption {
/** 指定滚动元素的选择器(只支持 scroll-view该元素滚动时会驱动动画的进度 */
scrollSource: string
/** 指定滚动的方向。有效值为 horizontal 或 vertical */
orientation?: string
/** 指定开始驱动动画进度的滚动偏移量,单位 px */
startScrollOffset: number
/** 指定停止驱动动画进度的滚动偏移量,单位 px */
endScrollOffset: number
/** 起始和结束的滚动范围映射的时间长度,该时间可用于与关键帧动画里的时间 (duration) 相匹配,单位 ms */
timeRange: number
}
interface SetUpdatePerformanceListenerOption<WithDataPath> {
/** 是否返回变更的 data 字段信息 */
withDataPaths?: WithDataPath
}
interface UpdatePerformanceListener<WithDataPath> {
(res: UpdatePerformance<WithDataPath>): void
}
interface UpdatePerformance<WithDataPath> {
/** 此次更新过程的 ID */
updateProcessId: number
/** 对于子更新,返回它所属的更新过程 ID */
parentUpdateProcessId?: number
/** 是否是被合并更新,如果是,则 updateProcessId 表示被合并到的更新过程 ID */
isMergedUpdate: boolean
/** 此次更新的 data 字段信息,只有 withDataPaths 设为 true 时才会返回 */
dataPaths: WithDataPath extends true ? string[] : undefined
/** 此次更新进入等待队列时的时间戳 */
pendingStartTimestamp: number
/** 更新运算开始时的时间戳 */
updateStartTimestamp: number
/** 更新运算结束时的时间戳 */
updateEndTimestamp: number
}
}
/** ComponentComponent
*
* * 使 `this.data` 使 `setData`
* * `this` 访
* * data `dataXyz` WXML `data-xyz=""` dataset
* * 使 data
* * `2.0.9` data
* * `bug` : type Object Array `this.setData` observer observer `newVal` `oldVal` `changedPath`
*/
declare let Component: WechatMiniprogram.Component.Constructor

File diff suppressed because it is too large Load Diff

@ -1,263 +0,0 @@
/*! *****************************************************************************
Copyright (c) 2022 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
***************************************************************************** */
declare namespace WechatMiniprogram.Page {
type Instance<
TData extends DataOption,
TCustom extends CustomOption
> = OptionalInterface<ILifetime> &
InstanceProperties &
InstanceMethods<TData> &
Data<TData> &
TCustom
type Options<
TData extends DataOption,
TCustom extends CustomOption
> = (TCustom &
Partial<Data<TData>> &
Partial<ILifetime> & {
options?: Component.ComponentOptions
}) &
ThisType<Instance<TData, TCustom>>
type TrivialInstance = Instance<IAnyObject, IAnyObject>
interface Constructor {
<TData extends DataOption, TCustom extends CustomOption>(
options: Options<TData, TCustom>
): void
}
interface ILifetime {
/**
*
* onLoad
*/
onLoad(
/** 打开当前页面路径中的参数 */
query: Record<string, string | undefined>
): void | Promise<void>
/**
*
* /
*/
onShow(): void | Promise<void>
/**
*
*
*
* API `wx.setNavigationBarTitle``onReady`
*/
onReady(): void | Promise<void>
/**
*
* / `navigateTo` `tab`
*/
onHide(): void | Promise<void>
/**
*
* `redirectTo``navigateBack`
*/
onUnload(): void | Promise<void>
/**
*
*
* - `app.json``window``enablePullDownRefresh`
* - `wx.startPullDownRefresh`
* - `wx.stopPullDownRefresh`
*/
onPullDownRefresh(): void | Promise<void>
/**
*
*
* - `app.json``window``onReachBottomDistance`
* -
*/
onReachBottom(): void | Promise<void>
/**
*
* `<button>` `open-type="share"`
*
* ****
*
* return Object
*/
onShareAppMessage(
/** 分享发起来源参数 */
options: IShareAppMessageOption
): ICustomShareContent | void
/**
*
*
* Beta Android [ (Beta)](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html)
*
* 2.11.3
*/
onShareTimeline(): ICustomTimelineContent | void
/**
*
*
*/
onPageScroll(
/** 页面滚动参数 */
options: IPageScrollOption
): void | Promise<void>
/** 当前是 tab 页时,点击 tab 时触发,最低基础库: `1.9.0` */
onTabItemTap(
/** tab 点击参数 */
options: ITabItemTapOption
): void | Promise<void>
/** 窗口尺寸改变时触发,最低基础库:`2.4.0` */
onResize(
/** 窗口尺寸参数 */
options: IResizeOption
): void | Promise<void>
/**
*
* 2.10.3 7.0.15 iOS
*/
onAddToFavorites(options: IAddToFavoritesOption): IAddToFavoritesContent
}
interface InstanceProperties {
/** 页面的文件路径 */
is: string
/** 到当前页面的路径 */
route: string
/** 打开当前页面路径中的参数 */
options: Record<string, string | undefined>
}
type DataOption = Record<string, any>
type CustomOption = Record<string, any>
type InstanceMethods<D extends DataOption> = Component.InstanceMethods<D>
interface Data<D extends DataOption> {
/**
*
* `data` 使****
*
* `data` `JSON``data``JSON`
*
* `WXML`
*/
data: D
}
interface ICustomShareContent {
/** 转发标题。默认值:当前小程序名称 */
title?: string
/** 转发路径,必须是以 / 开头的完整路径。默认值:当前页面 path */
path?: string
/** 自定义图片路径可以是本地文件路径、代码包文件路径或者网络图片路径。支持PNG及JPG。显示图片长宽比是 5:4最低基础库 `1.5.0`。默认值:使用默认截图 */
imageUrl?: string
}
interface ICustomTimelineContent {
/** 自定义标题,即朋友圈列表页上显示的标题。默认值:当前小程序名称 */
title?: string
/** 自定义页面路径中携带的参数,如 `path?a=1&b=2` 的 “?” 后面部分 默认值:当前页面路径携带的参数 */
query?: string
/** 自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径。支持 PNG 及 JPG。显示图片长宽比是 1:1。默认值默认使用小程序 Logo*/
imageUrl?: string
}
interface IPageScrollOption {
/** 页面在垂直方向已滚动的距离单位px */
scrollTop: number
}
interface IShareAppMessageOption {
/**
*
*
* - `button`
* - `menu`
*
* `1.2.4`
*/
from: 'button' | 'menu' | string
/** `from` `button` `target` `button` `undefined`
*
* `1.2.4` */
target: any
/** `<web-view>``<web-view>`url
*
* `1.6.4`
*/
webViewUrl?: string
}
interface ITabItemTapOption {
/** 被点击tabItem的序号从0开始最低基础库 `1.9.0` */
index: string
/** 被点击tabItem的页面路径最低基础库 `1.9.0` */
pagePath: string
/** 被点击tabItem的按钮文字最低基础库 `1.9.0` */
text: string
}
interface IResizeOption {
size: {
/** 变化后的窗口宽度,单位 px */
windowWidth: number
/** 变化后的窗口高度,单位 px */
windowHeight: number
}
}
interface IAddToFavoritesOption {
/** 页面中包含web-view组件时返回当前web-view的url */
webviewUrl?: string
}
interface IAddToFavoritesContent {
/** 自定义标题,默认值:页面标题或账号名称 */
title?: string
/** 自定义图片,显示图片长宽比为 11默认值页面截图 */
imageUrl?: string
/** 自定义query字段默认值当前页面的query */
query?: string
}
interface GetCurrentPages {
(): Array<Instance<IAnyObject, IAnyObject>>
}
}
/**
* `Object`
*/
declare let Page: WechatMiniprogram.Page.Constructor
/**
*
* ____
* - ____
* - `App.onLaunch` `getCurrentPages()` `page`
*/
declare let getCurrentPages: WechatMiniprogram.Page.GetCurrentPages
Loading…
Cancel
Save