@ -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,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;
|
||||
}
|
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 173 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 100 KiB |
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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -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 +0,0 @@
|
||||
/* pages/ModifyMap/ModifyMap.wxss */
|
@ -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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
<!--pages/text/text.wxml-->
|
||||
<text>pages/text/text.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* pages/text/text.wxss */
|
@ -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,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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -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,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,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'>>
|