diff --git a/src/map - 副本/.eslintrc.js b/src/map - 副本/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/src/map - 副本/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * 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: {}, +} diff --git a/src/map - 副本/README.md b/src/map - 副本/README.md new file mode 100644 index 0000000..e097b0c --- /dev/null +++ b/src/map - 副本/README.md @@ -0,0 +1,12 @@ +# 云开发 quickstart + +这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力: + +- 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库 +- 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理 +- 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码 + +## 参考文档 + +- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html) + diff --git a/src/map - 副本/cloud/useroption/config.json b/src/map - 副本/cloud/useroption/config.json new file mode 100644 index 0000000..5ecc33e --- /dev/null +++ b/src/map - 副本/cloud/useroption/config.json @@ -0,0 +1,6 @@ +{ + "permissions": { + "openapi": [ + ] + } +} \ No newline at end of file diff --git a/src/map - 副本/cloud/useroption/index.js b/src/map - 副本/cloud/useroption/index.js new file mode 100644 index 0000000..3bc31f0 --- /dev/null +++ b/src/map - 副本/cloud/useroption/index.js @@ -0,0 +1,83 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') + +cloud.init() + +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext() + + //写有关于数据库操作的地方 + //获取数据库的连接对象 + const db = cloud.database(); + + //在一个云函数里面有4种数据库操作。所以要先判断是什么操作:增删改查 + + //增 + if(event.option=='add'){ + return await db.collection('users').add({ + //花括号里面是你要添加的对象 + data:event.addData + //可添加多条或一条 + //event:包含传过来的所有数据的一个对象 + }); + } +//删 +else if(event.option=="deleteuser"){ + return await db.collection('users').where({ + //将要删除的值赋给name + User_ID:event.delUser_ID + }).remove(); +} +else if(event.option=="deleteusers"){ + return await db.collection('users').where({ + //将要删除的值赋给name + User_College:event.delUser_College, + User_Grade:event.delUser_Grade, + User_Class:event.delUser_Class + }).remove(); +} +//查 +else if(event.option=="getID"){ + return await db.collection('users').where({ + User_ID:event.getUser_ID + }).get({ + success:function(res){ + return res + } + }) +} + +else if(event.option=="getCollege"){ + return await db.collection('users').where({ + User_College:event.getUser_College, + User_Grade:event.getUser_Grade, + User_Class:event.getUser_Class + }).get({ + success:function(res){ + return res + } + }) +} + +else if(event.option=="getusers"){ + return await db.collection('users').where({ + }).get({ + success:function(res){ + return res + } + }) +} + +//改 +else if(event.option=="update"){ + return await db.collection('users').where({ + User_ID:event.updateUser_ID + }).update({ + data:{ + User_College:event.updateUser_College + } + }) +} + +} diff --git a/src/map - 副本/cloud/useroption/package.json b/src/map - 副本/cloud/useroption/package.json new file mode 100644 index 0000000..35b0810 --- /dev/null +++ b/src/map - 副本/cloud/useroption/package.json @@ -0,0 +1,14 @@ +{ + "name": "useroption", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "~2.6.3" + } +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/app.js b/src/map - 副本/miniprogram/app.js new file mode 100644 index 0000000..404830d --- /dev/null +++ b/src/map - 副本/miniprogram/app.js @@ -0,0 +1,20 @@ +// app.js +App({ + onLaunch: function () { + if (!wx.cloud) { + console.error('请使用 2.2.3 或以上的基础库以使用云能力'); + } else { + wx.cloud.init({ + // env 参数说明: + // env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源 + // 此处请填入环境 ID, 环境 ID 可打开云控制台查看 + // 如不填则使用默认环境(第一个创建的环境) + // env: 'my-env-id', + env:'cloud1-5gsqi02q8e4bd2dc', + traceUser: true, + }); + } + + this.globalData = {}; + } +}); diff --git a/src/map - 副本/miniprogram/app.json b/src/map - 副本/miniprogram/app.json new file mode 100644 index 0000000..e1adfa7 --- /dev/null +++ b/src/map - 副本/miniprogram/app.json @@ -0,0 +1,72 @@ +{ + "pages": [ + "pages/login/login", + "pages/Find directions/Find directions", + "pages/text/text", + "pages/ModifyMap/ModifyMap", + "pages/ModifyInformation/ModifyInformation", + "pages/ManageAccount/ManageAccount", + "pages/index/index", + "pages/adduser/index", + "pages/addusers/index", + "pages/adduserssuccess/index", + "pages/delete/index", + "pages/deleteuser/index", + "pages/deleteusers/index", + "pages/deleteuserssuccess/index", + "pages/selectusers/index", + "pages/selectusers(ID)/index", + "pages/selectusers(college)/index", + "pages/selectuserss/index", + "pages/selectuserssuccess/index", + "pages/updateusers/index", + "pages/updateuserssuccess/index", + "pages/index_hjf/index_hjf", + "pages/index1/index1", + "pages/adlogin/adlogin", + "pages/login_1/login_1", + "pages/getWeather/getWeather", + "pages/map/map" + + ], + "window": { + "backgroundColor": "#F6F6F6", + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#F6F6F6", + "navigationBarTitleText": "管理用户", + "navigationBarTextStyle": "black" + }, + "tabBar": { + "color": "#dddddd", + "selectedColor": "#3cc51f", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [{ + "pagePath": "pages/map/map", + "iconPath": "image/wechat.png", + "selectedIconPath": "image/locate.png", + "text": "导航" + },{ + "pagePath": "pages/text/text", + "iconPath": "image/locate.png", + "selectedIconPath": "image/locateHL.png", + "text": "信息栏" + } + ] + }, + "debug": true, + "style": "v2", + "sitemapLocation": "sitemap.json", + "requiredPrivateInfos":[ + "getLocation" + ], + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + }, + "navigateToMiniProgramAppIdList": [ + "wx5e77d1bb9e24f179" + ] + +} diff --git a/src/map - 副本/miniprogram/app.wxss b/src/map - 副本/miniprogram/app.wxss new file mode 100644 index 0000000..df96b0e --- /dev/null +++ b/src/map - 副本/miniprogram/app.wxss @@ -0,0 +1,27 @@ +/**app.wxss**/ +.container { + display: flex; + flex-direction: column; + align-items: center; + box-sizing: border-box; +} + +button { + background: initial; +} + +button:focus{ + outline: 0; +} + +button::after{ + border: none; +} + + +page { + background: #f6f6f6; + display: flex; + flex-direction: column; + justify-content: flex-start; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/components/cloudTipModal/index.js b/src/map - 副本/miniprogram/components/cloudTipModal/index.js new file mode 100644 index 0000000..f5ca0c1 --- /dev/null +++ b/src/map - 副本/miniprogram/components/cloudTipModal/index.js @@ -0,0 +1,37 @@ +// miniprogram/components/cloudTipModal/index.js +const { isMac } = require('../../envList.js'); + +Component({ + + /** + * 页面的初始数据 + */ + data: { + showUploadTip: false, + tipText: isMac ? 'sh ./uploadCloudFunction.sh' : './uploadCloudFunction.bat' + }, + properties: { + showUploadTipProps: Boolean + }, + observers: { + showUploadTipProps: function(showUploadTipProps) { + this.setData({ + showUploadTip: showUploadTipProps + }); + } + }, + methods: { + onChangeShowUploadTip() { + this.setData({ + showUploadTip: !this.data.showUploadTip + }); + }, + + copyShell() { + wx.setClipboardData({ + data: this.data.tipText, + }); + }, + } + +}); diff --git a/src/map - 副本/miniprogram/components/cloudTipModal/index.json b/src/map - 副本/miniprogram/components/cloudTipModal/index.json new file mode 100644 index 0000000..4575d1b --- /dev/null +++ b/src/map - 副本/miniprogram/components/cloudTipModal/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "component": true +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/components/cloudTipModal/index.wxml b/src/map - 副本/miniprogram/components/cloudTipModal/index.wxml new file mode 100644 index 0000000..5611267 --- /dev/null +++ b/src/map - 副本/miniprogram/components/cloudTipModal/index.wxml @@ -0,0 +1,13 @@ + + + + + 体验前需部署云资源 + 请开启调试器进入终端窗口,复制并运行以下命令 + + {{tipText}} + 复制 + + 已执行命令 + + diff --git a/src/map - 副本/miniprogram/components/cloudTipModal/index.wxss b/src/map - 副本/miniprogram/components/cloudTipModal/index.wxss new file mode 100644 index 0000000..ae36531 --- /dev/null +++ b/src/map - 副本/miniprogram/components/cloudTipModal/index.wxss @@ -0,0 +1,57 @@ +.install_tip_back { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(0,0,0,0.4); + z-index: 1; +} + +.install_tip_detail { + position: fixed; + background-color: white; + right: 0; + bottom: 0; + left: 0; + top: 60%; + border-radius: 40rpx 40rpx 0 0; + padding: 50rpx; + z-index: 9; +} + +.install_tip_detail_title { + font-weight: 400; + font-size: 40rpx; + text-align: center; +} + +.install_tip_detail_tip { + font-size: 25rpx; + color: rgba(0,0,0,0.4); + margin-top: 20rpx; + text-align: center; +} + +.install_tip_detail_shell { + margin: 70rpx 0; + display: flex; + justify-content: center; +} + +.install_tip_detail_copy { + color: #546488; + margin-left: 10rpx; +} + +.install_tip_detail_button { + color: #07C160; + font-weight: 500; + background-color: rgba(0,0,0,0.1); + width: 60%; + text-align: center; + height: 90rpx; + line-height: 90rpx; + border-radius: 10rpx; + margin: 0 auto; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/envList.js b/src/map - 副本/miniprogram/envList.js new file mode 100644 index 0000000..949c90a --- /dev/null +++ b/src/map - 副本/miniprogram/envList.js @@ -0,0 +1,6 @@ +const envList = [{"envId":"cloud1-7gnkwzfv6ba72e50","alias":"cloud1"}] +const isMac = false +module.exports = { + envList, + isMac +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/image/arrowright.png b/src/map - 副本/miniprogram/image/arrowright.png new file mode 100644 index 0000000..109f4fe Binary files /dev/null and b/src/map - 副本/miniprogram/image/arrowright.png differ diff --git a/src/map - 副本/miniprogram/image/icon64_appwx_logo.png b/src/map - 副本/miniprogram/image/icon64_appwx_logo.png new file mode 100644 index 0000000..91a38f9 Binary files /dev/null and b/src/map - 副本/miniprogram/image/icon64_appwx_logo.png differ diff --git a/src/map - 副本/miniprogram/image/locate.png b/src/map - 副本/miniprogram/image/locate.png new file mode 100644 index 0000000..0ac1474 Binary files /dev/null and b/src/map - 副本/miniprogram/image/locate.png differ diff --git a/src/map - 副本/miniprogram/image/locateHL.png b/src/map - 副本/miniprogram/image/locateHL.png new file mode 100644 index 0000000..119c934 Binary files /dev/null and b/src/map - 副本/miniprogram/image/locateHL.png differ diff --git a/src/map - 副本/miniprogram/image/location-control.png b/src/map - 副本/miniprogram/image/location-control.png new file mode 100644 index 0000000..a76333c Binary files /dev/null and b/src/map - 副本/miniprogram/image/location-control.png differ diff --git a/src/map - 副本/miniprogram/image/location.png b/src/map - 副本/miniprogram/image/location.png new file mode 100644 index 0000000..045971e Binary files /dev/null and b/src/map - 副本/miniprogram/image/location.png differ diff --git a/src/map - 副本/miniprogram/image/logo.png b/src/map - 副本/miniprogram/image/logo.png new file mode 100644 index 0000000..76e8095 Binary files /dev/null and b/src/map - 副本/miniprogram/image/logo.png differ diff --git a/src/map - 副本/miniprogram/image/map.png b/src/map - 副本/miniprogram/image/map.png new file mode 100644 index 0000000..0ac1474 Binary files /dev/null and b/src/map - 副本/miniprogram/image/map.png differ diff --git a/src/map - 副本/miniprogram/image/map_active.png b/src/map - 副本/miniprogram/image/map_active.png new file mode 100644 index 0000000..119c934 Binary files /dev/null and b/src/map - 副本/miniprogram/image/map_active.png differ diff --git a/src/map - 副本/miniprogram/image/navigator.jpg b/src/map - 副本/miniprogram/image/navigator.jpg new file mode 100644 index 0000000..ffbc1cf Binary files /dev/null and b/src/map - 副本/miniprogram/image/navigator.jpg differ diff --git a/src/map - 副本/miniprogram/image/pause.png b/src/map - 副本/miniprogram/image/pause.png new file mode 100644 index 0000000..9acb73d Binary files /dev/null and b/src/map - 副本/miniprogram/image/pause.png differ diff --git a/src/map - 副本/miniprogram/image/play.png b/src/map - 副本/miniprogram/image/play.png new file mode 100644 index 0000000..982f2f2 Binary files /dev/null and b/src/map - 副本/miniprogram/image/play.png differ diff --git a/src/map - 副本/miniprogram/image/plus.png b/src/map - 副本/miniprogram/image/plus.png new file mode 100644 index 0000000..73ddfe3 Binary files /dev/null and b/src/map - 副本/miniprogram/image/plus.png differ diff --git a/src/map - 副本/miniprogram/image/record.png b/src/map - 副本/miniprogram/image/record.png new file mode 100644 index 0000000..a62ef81 Binary files /dev/null and b/src/map - 副本/miniprogram/image/record.png differ diff --git a/src/map - 副本/miniprogram/image/screenshot-marker.png b/src/map - 副本/miniprogram/image/screenshot-marker.png new file mode 100644 index 0000000..b12bc29 Binary files /dev/null and b/src/map - 副本/miniprogram/image/screenshot-marker.png differ diff --git a/src/map - 副本/miniprogram/image/screenshot1.png b/src/map - 副本/miniprogram/image/screenshot1.png new file mode 100644 index 0000000..ea42c4d Binary files /dev/null and b/src/map - 副本/miniprogram/image/screenshot1.png differ diff --git a/src/map - 副本/miniprogram/image/screenshot2.png b/src/map - 副本/miniprogram/image/screenshot2.png new file mode 100644 index 0000000..586be04 Binary files /dev/null and b/src/map - 副本/miniprogram/image/screenshot2.png differ diff --git a/src/map - 副本/miniprogram/image/stop.png b/src/map - 副本/miniprogram/image/stop.png new file mode 100644 index 0000000..9e65f3e Binary files /dev/null and b/src/map - 副本/miniprogram/image/stop.png differ diff --git a/src/map - 副本/miniprogram/image/trash.png b/src/map - 副本/miniprogram/image/trash.png new file mode 100644 index 0000000..83d68f3 Binary files /dev/null and b/src/map - 副本/miniprogram/image/trash.png differ diff --git a/src/map - 副本/miniprogram/image/wechat.png b/src/map - 副本/miniprogram/image/wechat.png new file mode 100644 index 0000000..470931c Binary files /dev/null and b/src/map - 副本/miniprogram/image/wechat.png differ diff --git a/src/map - 副本/miniprogram/image/wechatHL.png b/src/map - 副本/miniprogram/image/wechatHL.png new file mode 100644 index 0000000..3c5e52b Binary files /dev/null and b/src/map - 副本/miniprogram/image/wechatHL.png differ diff --git a/src/map - 副本/miniprogram/images/arrow.svg b/src/map - 副本/miniprogram/images/arrow.svg new file mode 100644 index 0000000..cd32a7d --- /dev/null +++ b/src/map - 副本/miniprogram/images/arrow.svg @@ -0,0 +1,11 @@ + + + ☀ iOS/☀ 图标/线型/icons_outlined_arrow@3x + + + + + + + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/images/database.png b/src/map - 副本/miniprogram/images/database.png new file mode 100644 index 0000000..d0499c1 Binary files /dev/null and b/src/map - 副本/miniprogram/images/database.png differ diff --git a/src/map - 副本/miniprogram/images/deploy_step1.png b/src/map - 副本/miniprogram/images/deploy_step1.png new file mode 100644 index 0000000..738b71c Binary files /dev/null and b/src/map - 副本/miniprogram/images/deploy_step1.png differ diff --git a/src/map - 副本/miniprogram/images/deploy_step2.png b/src/map - 副本/miniprogram/images/deploy_step2.png new file mode 100644 index 0000000..d77faab Binary files /dev/null and b/src/map - 副本/miniprogram/images/deploy_step2.png differ diff --git a/src/map - 副本/miniprogram/images/destination.jpeg b/src/map - 副本/miniprogram/images/destination.jpeg new file mode 100644 index 0000000..b8aeb1f Binary files /dev/null and b/src/map - 副本/miniprogram/images/destination.jpeg differ diff --git a/src/map - 副本/miniprogram/images/dh.jpg b/src/map - 副本/miniprogram/images/dh.jpg new file mode 100644 index 0000000..b3b3eda Binary files /dev/null and b/src/map - 副本/miniprogram/images/dh.jpg differ diff --git a/src/map - 副本/miniprogram/images/gps.jpg b/src/map - 副本/miniprogram/images/gps.jpg new file mode 100644 index 0000000..addd9dc Binary files /dev/null and b/src/map - 副本/miniprogram/images/gps.jpg differ diff --git a/src/map - 副本/miniprogram/images/hxLocation.png b/src/map - 副本/miniprogram/images/hxLocation.png new file mode 100644 index 0000000..308f101 Binary files /dev/null and b/src/map - 副本/miniprogram/images/hxLocation.png differ diff --git a/src/map - 副本/miniprogram/images/logo1.png b/src/map - 副本/miniprogram/images/logo1.png new file mode 100644 index 0000000..396bc68 Binary files /dev/null and b/src/map - 副本/miniprogram/images/logo1.png differ diff --git a/src/map - 副本/miniprogram/images/src.jpeg b/src/map - 副本/miniprogram/images/src.jpeg new file mode 100644 index 0000000..bce35dd Binary files /dev/null and b/src/map - 副本/miniprogram/images/src.jpeg differ diff --git a/src/map - 副本/miniprogram/images/sxaubg.jpg b/src/map - 副本/miniprogram/images/sxaubg.jpg new file mode 100644 index 0000000..920fb36 Binary files /dev/null and b/src/map - 副本/miniprogram/images/sxaubg.jpg differ diff --git a/src/map - 副本/miniprogram/images/tag.png b/src/map - 副本/miniprogram/images/tag.png new file mode 100644 index 0000000..308f101 Binary files /dev/null and b/src/map - 副本/miniprogram/images/tag.png differ diff --git a/src/map - 副本/miniprogram/images/xm.jpg b/src/map - 副本/miniprogram/images/xm.jpg new file mode 100644 index 0000000..fda6731 Binary files /dev/null and b/src/map - 副本/miniprogram/images/xm.jpg differ diff --git a/src/map - 副本/miniprogram/pages/Find directions/Find directions.js b/src/map - 副本/miniprogram/pages/Find directions/Find directions.js new file mode 100644 index 0000000..60e72cd --- /dev/null +++ b/src/map - 副本/miniprogram/pages/Find directions/Find directions.js @@ -0,0 +1,66 @@ +// pages/Find directions/Find directions.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/Find directions/Find directions.wxml b/src/map - 副本/miniprogram/pages/Find directions/Find directions.wxml new file mode 100644 index 0000000..3118fd3 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/Find directions/Find directions.wxml @@ -0,0 +1,2 @@ + +pages/Find directions/Find directions.wxml diff --git a/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.js b/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.js new file mode 100644 index 0000000..3002583 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.js @@ -0,0 +1,17 @@ +Page({ + data: { + loginOK: false + }, + //information + information() { + wx.navigateTo({ + url: '/pages/ModifyInformation/ModifyInformation', + }) + }, + //account + account() { + wx.navigateTo({ + url: '/pages/index/index' + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.json b/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.wxml b/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.wxml new file mode 100644 index 0000000..c9af81f --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.wxss b/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.wxss new file mode 100644 index 0000000..ee27500 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ManageAccount/ManageAccount.wxss @@ -0,0 +1 @@ +/* pages/ManageAccount/ManageAccount.wxss */ \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.js b/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.js new file mode 100644 index 0000000..22917b1 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.js @@ -0,0 +1,32 @@ +Page({ + check() { + wx.navigateToMiniProgram({ + appId: 'wx5e77d1bb9e24f179', // 小程序B的appid** + path: 'pages/index/index', //小程序B的页面路径** + extraData: {}, + envVersion: 'release', //打开版本 开发版 develop;体验版trial; 正式版release + success(res) { + // 打开成功 + }, + fail(res){ + //打开失败 + } + }) + + }, + data: { + loginOK: false + }, + //information + information() { + wx.navigateTo({ + url: '/pages/ModifyInformation/ModifyInformation', + }) + }, + //account + account() { + wx.navigateTo({ + url: '/pages/index/index' + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.json b/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.wxml b/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.wxml new file mode 100644 index 0000000..c43160a --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.wxml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.wxss b/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.wxss new file mode 100644 index 0000000..5124cdd --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ModifyInformation/ModifyInformation.wxss @@ -0,0 +1 @@ +/* pages/ModifyInformation/ModifyInformation.wxss */ \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ModifyMap/ModifyMap.js b/src/map - 副本/miniprogram/pages/ModifyMap/ModifyMap.js new file mode 100644 index 0000000..b2e88b9 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ModifyMap/ModifyMap.js @@ -0,0 +1,66 @@ +// pages/ModifyMap/ModifyMap.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/ModifyMap/ModifyMap.wxml b/src/map - 副本/miniprogram/pages/ModifyMap/ModifyMap.wxml new file mode 100644 index 0000000..206e0cf --- /dev/null +++ b/src/map - 副本/miniprogram/pages/ModifyMap/ModifyMap.wxml @@ -0,0 +1,2 @@ + +pages/ModifyMap/ModifyMap.wxml diff --git a/src/map - 副本/miniprogram/pages/adduser/index.js b/src/map - 副本/miniprogram/pages/adduser/index.js new file mode 100644 index 0000000..84bccd3 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adduser/index.js @@ -0,0 +1,89 @@ +// pages/index/index.js +//连接数据库 +const db = wx.cloud.database() +Page({ + + + /** + * 页面的初始数据 + */ + data: { + User_ID:'', + User_College:'', + User_Key:'', + User_Class:'', + User_Grade:'' + }, + + //监听并修改用户名和年龄的输入 + inputID:function(e){ + this.setData({ + User_ID:e.detail.value + }) + }, + + inputCollege:function(e){ + this.setData({ + User_College:e.detail.value + }) + }, + + inputGrade:function(e){ + this.setData({ + User_Grade:e.detail.value + }) + }, + + inputClass:function(e){ + this.setData({ + User_Class:e.detail.value + }) + }, + + inputKey:function(e){ + this.setData({ + User_Key:e.detail.value + }) + }, + //使用云函数 + //插入数据(增) + add:function(e){ + //要添加的数据是一个对象 + // var user={ + // username:this.data.username, + // age:this.data.age + // }; + + console.log(e); + wx.cloud.callFunction({ + name: 'useroption', + data: { + option: 'add', + addData:{ + User_ID:this.data.User_ID, + User_College:this.data.User_College, + User_Grade:this.data.User_Grade, + User_Class:this.data.User_Class, + User_Key:this.data.User_Key + } + }, + success: res => { + wx.showToast({ + title: '用户添加成功', + }) + console.log("添加成功") + console.log(res) + }, + fail:err => { + wx.showToast({ + title: '用户添加失败', + }) + } + }) + }, + getback:function(){ + wx.navigateBack({ + delta:1, + }) + } +}) diff --git a/src/map - 副本/miniprogram/pages/adduser/index.json b/src/map - 副本/miniprogram/pages/adduser/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adduser/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/adduser/index.wxml b/src/map - 副本/miniprogram/pages/adduser/index.wxml new file mode 100644 index 0000000..fa4839b --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adduser/index.wxml @@ -0,0 +1,35 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/adduser/index.wxss b/src/map - 副本/miniprogram/pages/adduser/index.wxss new file mode 100644 index 0000000..41625a0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adduser/index.wxss @@ -0,0 +1,100 @@ +/* pages/addusers/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #888888; + margin-bottom: 28rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/addusers/index.js b/src/map - 副本/miniprogram/pages/addusers/index.js new file mode 100644 index 0000000..9bdf998 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/addusers/index.js @@ -0,0 +1,88 @@ +// pages/addusers/index.js +const db = wx.cloud.database() +Page({ + + + /** + * 页面的初始数据 + */ + data: { + User_ID:'', + User_College:'', + User_Key:'', + User_Class:'', + User_Grade:'' + }, + + //监听并修改用户名和年龄的输入 + inputID:function(e){ + this.setData({ + User_ID:e.detail.value + }) + }, + + inputCollege:function(e){ + this.setData({ + User_College:e.detail.value + }) + }, + + inputGrade:function(e){ + this.setData({ + User_Grade:e.detail.value + }) + }, + + inputClass:function(e){ + this.setData({ + User_Class:e.detail.value + }) + }, + + inputKey:function(e){ + this.setData({ + User_Key:e.detail.value + }) + }, + //使用云函数 + //插入数据(增) + add:function(e){ + //要添加的数据是一个对象 + // var user={ + // username:this.data.username, + // age:this.data.age + // }; + + console.log(e); + wx.cloud.callFunction({ + name: 'useroption', + data: { + option: 'add', + addData:{ + User_ID:this.data.User_ID, + User_College:this.data.User_College, + User_Grade:this.data.User_Grade, + User_Class:this.data.User_Class, + User_Key:this.data.User_Key + } + }, + success: res => { + wx.showToast({ + title: '用户添加成功', + }) + console.log("添加成功") + console.log(res) + }, + fail:err => { + wx.showToast({ + title: '用户添加失败', + }) + } + }) + }, + getback:function(){ + wx.navigateBack({ + delta:1, + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/addusers/index.json b/src/map - 副本/miniprogram/pages/addusers/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/addusers/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/addusers/index.wxml b/src/map - 副本/miniprogram/pages/addusers/index.wxml new file mode 100644 index 0000000..7dc62bb --- /dev/null +++ b/src/map - 副本/miniprogram/pages/addusers/index.wxml @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/src/map - 副本/miniprogram/pages/addusers/index.wxss b/src/map - 副本/miniprogram/pages/addusers/index.wxss new file mode 100644 index 0000000..41625a0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/addusers/index.wxss @@ -0,0 +1,100 @@ +/* pages/addusers/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #888888; + margin-bottom: 28rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/adduserssuccess/index.js b/src/map - 副本/miniprogram/pages/adduserssuccess/index.js new file mode 100644 index 0000000..791d6ca --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adduserssuccess/index.js @@ -0,0 +1,66 @@ +// pages/adduserssuccess/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/adduserssuccess/index.wxml b/src/map - 副本/miniprogram/pages/adduserssuccess/index.wxml new file mode 100644 index 0000000..42fae23 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adduserssuccess/index.wxml @@ -0,0 +1,2 @@ + +pages/adduserssuccess/index.wxml diff --git a/src/map - 副本/miniprogram/pages/adlogin/adlogin.js b/src/map - 副本/miniprogram/pages/adlogin/adlogin.js new file mode 100644 index 0000000..03b85ca --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adlogin/adlogin.js @@ -0,0 +1,82 @@ +// pages/adlogin/adlogin.js +Page({ + data: { + account:'', + password:'' + }, + + //获取输入的账号 + getAccount(evt) { + //console.log('账号', evt.detail.value) + this.setData({ + account: evt.detail.value + }) + }, + + //获取管理员输入的密码 + getPassword(event) { + // console.log('密码', event.detail.value) + this.setData({ + password: event.detail.value + }) + }, + +//点击管理员登陆 + guanliyuanlogin() { + + let account = this.data.account + let password = this.data.password + console.log('管理员账号', account, '管理员密码', password) + if (account.length < 4) { + wx.showToast({ + icon: 'none', + title: '账号至少4位', + }) + return + } + if (password.length < 4) { + wx.showToast({ + icon: 'none', + title: '密码至少4位', + }) + return + } + + + //管理员登陆 + wx.cloud.database().collection('manager').where({ + account: account + }).get({ + success(res) { + console.log("获取数据成功", res) + let manager = res.data[0] + console.log("manager", manager) + if (password == manager.password) { + console.log('登陆成功') + wx.showToast({ + title: '登陆成功', + }) + // wx.navigateTo({ + // url: '../home/home?name=' + user.name, + // }) + wx.navigateTo({ + url: '../index/index', + }) + //保存管理员登陆状态 + wx.setStorageSync('manager', manager) + } else { + console.log('登陆失败') + wx.showToast({ + icon: 'none', + title: '账号或密码不正确', + }) + } + }, + fail(res) { + console.log("获取数据失败", res) + } + }) + + } + + }) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/adlogin/adlogin.json b/src/map - 副本/miniprogram/pages/adlogin/adlogin.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adlogin/adlogin.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/adlogin/adlogin.wxml b/src/map - 副本/miniprogram/pages/adlogin/adlogin.wxml new file mode 100644 index 0000000..75ad50d --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adlogin/adlogin.wxml @@ -0,0 +1,5 @@ +输入管理员账号 + +输入管理员密码 + + diff --git a/src/map - 副本/miniprogram/pages/adlogin/adlogin.wxss b/src/map - 副本/miniprogram/pages/adlogin/adlogin.wxss new file mode 100644 index 0000000..01d4bfe --- /dev/null +++ b/src/map - 副本/miniprogram/pages/adlogin/adlogin.wxss @@ -0,0 +1,5 @@ +/* pages/adlogin/adlogin.wxss */ +.input{ + border: 1px solid gainsboro; + margin: 20rpx; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/delete/index.js b/src/map - 副本/miniprogram/pages/delete/index.js new file mode 100644 index 0000000..9e6333e --- /dev/null +++ b/src/map - 副本/miniprogram/pages/delete/index.js @@ -0,0 +1,14 @@ +// pages/delete/index.js +const db = wx.cloud.database() +Page({ + removeuser:function(){ + wx.navigateTo({ + url: '/pages/deleteuser/index', + }) + }, + removeusers:function(){ + wx.navigateTo({ + url: '/pages/deleteusers/index', + }) + }, +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/delete/index.json b/src/map - 副本/miniprogram/pages/delete/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/delete/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/delete/index.wxml b/src/map - 副本/miniprogram/pages/delete/index.wxml new file mode 100644 index 0000000..3ba3a34 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/delete/index.wxml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/map - 副本/miniprogram/pages/delete/index.wxss b/src/map - 副本/miniprogram/pages/delete/index.wxss new file mode 100644 index 0000000..35ab744 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/delete/index.wxss @@ -0,0 +1,100 @@ +/* pages/delete/index.wxss */ +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #888888; + margin-bottom: 28rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/deleteuser/index.js b/src/map - 副本/miniprogram/pages/deleteuser/index.js new file mode 100644 index 0000000..c5ec9a8 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteuser/index.js @@ -0,0 +1,34 @@ +// pages/deleteuser/index.js +Page({ + inputdelID:function(e){ + this.setData({ + delUser_ID:e.detail.value + }) + }, + removeDataFn:function(){ + wx.cloud.callFunction({ + name: 'useroption', + data: { + option: 'deleteuser', + //要删除的数据 + delUser_ID:this.data.delUser_ID + }, + success: res => { + wx.showToast({ + title: '用户删除成功', + }) + console.log(res) + }, + fail: err => { + wx.showToast({ + title: '用户删除失败', + }) + } + }) + }, + getback:function(){ + wx.navigateBack({ + delta:2, + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/deleteuser/index.json b/src/map - 副本/miniprogram/pages/deleteuser/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteuser/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/deleteuser/index.wxml b/src/map - 副本/miniprogram/pages/deleteuser/index.wxml new file mode 100644 index 0000000..f48e51b --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteuser/index.wxml @@ -0,0 +1,10 @@ + + + + + + diff --git a/src/map - 副本/miniprogram/pages/deleteuser/index.wxss b/src/map - 副本/miniprogram/pages/deleteuser/index.wxss new file mode 100644 index 0000000..2b3c0a2 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteuser/index.wxss @@ -0,0 +1,100 @@ +/* pages/deleteuser/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #888888; + margin-bottom: 28rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/deleteusers/index.js b/src/map - 副本/miniprogram/pages/deleteusers/index.js new file mode 100644 index 0000000..8d384d1 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteusers/index.js @@ -0,0 +1,46 @@ +// pages/deleteusers/index.js +Page({ + inputdelCollege:function(e){ + this.setData({ + delUser_College:e.detail.value, + }) + }, + inputdelGrade:function(e){ + this.setData({ + delUser_Grade:e.detail.value, + }) + }, + inputdelClass:function(e){ + this.setData({ + delUser_Class:e.detail.value, + }) + }, + removeDataFn:function(){ + wx.cloud.callFunction({ + name: 'useroption', + data: { + option: 'deleteusers', + //要删除的数据 + delUser_College:this.data.delUser_College, + delUser_Grade:this.data.delUser_Grade, + delUser_Class:this.data.delUser_Class + }, + success: res => { + wx.showToast({ + title: '用户删除成功', + }) + console.log(res) + }, + fail: err => { + wx.showToast({ + title: '用户删除失败', + }) + } + }) + }, + getback:function(){ + wx.navigateBack({ + delta:2, + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/deleteusers/index.json b/src/map - 副本/miniprogram/pages/deleteusers/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteusers/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/deleteusers/index.wxml b/src/map - 副本/miniprogram/pages/deleteusers/index.wxml new file mode 100644 index 0000000..416b368 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteusers/index.wxml @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/src/map - 副本/miniprogram/pages/deleteusers/index.wxss b/src/map - 副本/miniprogram/pages/deleteusers/index.wxss new file mode 100644 index 0000000..bff6131 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteusers/index.wxss @@ -0,0 +1,100 @@ +/* pages/deleteusers/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #888888; + margin-bottom: 28rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/deleteuserssuccess/index.js b/src/map - 副本/miniprogram/pages/deleteuserssuccess/index.js new file mode 100644 index 0000000..ab6c037 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteuserssuccess/index.js @@ -0,0 +1,66 @@ +// pages/deleteuserssuccess/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/deleteuserssuccess/index.wxml b/src/map - 副本/miniprogram/pages/deleteuserssuccess/index.wxml new file mode 100644 index 0000000..4b74ca1 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/deleteuserssuccess/index.wxml @@ -0,0 +1,2 @@ + +pages/deleteuserssuccess/index.wxml diff --git a/src/map - 副本/miniprogram/pages/getWeather/getWeather.js b/src/map - 副本/miniprogram/pages/getWeather/getWeather.js new file mode 100644 index 0000000..25b720e --- /dev/null +++ b/src/map - 副本/miniprogram/pages/getWeather/getWeather.js @@ -0,0 +1,36 @@ +var amapFile = require('../../utils/amap-wx.js'); +var app = getApp(); + +Page({ + data: { + city:"天津", + weather:"晴", + temperature:"10", + windpower:"18级", + winddirection:"南", + humidity:"5", + }, + onLoad: function(options){ + var that = this; + var myAmapFun = new amapFile.AMapWX({key:'78a99442f6e5cad3bfb832e33bdcf629'}); + myAmapFun.getWeather({ + success: function(res){ + //成功回调 + console.log("调取天气接口成功", res) + // 一定要在接口里进行赋值,否则接口数据还未返回,页面就已经将数据取走进行显示 + that.setData({ + city: res.city.data, + weather: res.weather.data, + temperature: res.temperature.data, + windpower: res.windpower.data, + winddirection: res.winddirection.data, + humidity: res.humidity.data + }) + }, + fail: function(info){ + //失败回调 + console.log(info) + } + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/getWeather/getWeather.json b/src/map - 副本/miniprogram/pages/getWeather/getWeather.json new file mode 100644 index 0000000..f9e31e9 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/getWeather/getWeather.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "天气", + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/getWeather/getWeather.wxml b/src/map - 副本/miniprogram/pages/getWeather/getWeather.wxml new file mode 100644 index 0000000..70176bf --- /dev/null +++ b/src/map - 副本/miniprogram/pages/getWeather/getWeather.wxml @@ -0,0 +1,10 @@ + + + + 城市:{{city}} + 天气:{{weather}} + 温度:{{temperature}} + 风力:{{windpower}} + 风向:{{winddirection}} + 湿度:{{humidity}} + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/getWeather/getWeather.wxss b/src/map - 副本/miniprogram/pages/getWeather/getWeather.wxss new file mode 100644 index 0000000..693eaa5 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/getWeather/getWeather.wxss @@ -0,0 +1,14 @@ +/* pages/getWeather/getWeather.wxss */ + +.container{ + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: #4D8AD7; + color: #fff; + font-size: 18px; + padding-top: 200rpx; + padding-left: 150rpx; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/home/home.js b/src/map - 副本/miniprogram/pages/home/home.js new file mode 100644 index 0000000..0ab33e6 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/home/home.js @@ -0,0 +1,66 @@ +// pages/home/home.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/home/home.json b/src/map - 副本/miniprogram/pages/home/home.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/home/home.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/home/home.wxml b/src/map - 副本/miniprogram/pages/home/home.wxml new file mode 100644 index 0000000..cc4fafe --- /dev/null +++ b/src/map - 副本/miniprogram/pages/home/home.wxml @@ -0,0 +1,2 @@ + +pages/home/home.wxml diff --git a/src/map - 副本/miniprogram/pages/home/home.wxss b/src/map - 副本/miniprogram/pages/home/home.wxss new file mode 100644 index 0000000..bc0eec7 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/home/home.wxss @@ -0,0 +1 @@ +/* pages/home/home.wxss */ \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index/index.js b/src/map - 副本/miniprogram/pages/index/index.js new file mode 100644 index 0000000..f4e2740 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index/index.js @@ -0,0 +1,64 @@ +// pages/index/index.js +//连接数据库 +const db = wx.cloud.database() +Page({ + data: { + loginOK: false + }, + //information + information() { + wx.navigateTo({ + url: '/pages/ModifyInformation/ModifyInformation', + }) + }, + //account + account() { + wx.navigateTo({ + url: '/pages/index/index' + }) + }, + + + /** + * 页面的初始数据 + */ + + + + //使用云函数 + //插入数据(增) + add:function(e){ + wx.navigateTo({ + url: '/pages/adduser/index', + }) + }, + + //删除数据(删) + removeDataFn:function(){ + wx.navigateTo({ + url: '/pages/delete/index', + }) + }, + + + //查询数据(查) + searchDataNameFn:function(){ + wx.navigateTo({ + url: '/pages/selectusers/index', + }) + }, + + + //修改数据(改) + updateDataFn(){ + wx.navigateTo({ + url: '/pages/updateusers/index', + }) + }, + //返回 + getback:function(){ + wx.navigateBack({ + delta: 1, + }) + }, +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index/index.json b/src/map - 副本/miniprogram/pages/index/index.json new file mode 100644 index 0000000..3ea1434 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "cloud-tip-modal": "/components/cloudTipModal/index" + } +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index/index.wxml b/src/map - 副本/miniprogram/pages/index/index.wxml new file mode 100644 index 0000000..f815c0a --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index/index.wxml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/map - 副本/miniprogram/pages/index/index.wxss b/src/map - 副本/miniprogram/pages/index/index.wxss new file mode 100644 index 0000000..9589666 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index/index.wxss @@ -0,0 +1,101 @@ +/**index.wxss**/ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #888888; + margin-bottom: 28rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index1/index1.js b/src/map - 副本/miniprogram/pages/index1/index1.js new file mode 100644 index 0000000..cb26b78 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index1/index1.js @@ -0,0 +1,90 @@ +Page({ + data: { + name: '', + account: '', + password: '' + }, + //获取用户名 + getName(event) { + console.log('获取输入的用户名', event.detail.value) + this.setData({ + name: event.detail.value + }) + }, + //获取用户账号 + getAccount(event) { + console.log('获取输入的账号', event.detail.value) + this.setData({ + account: event.detail.value + }) + }, + // 获取密码 + getPassword(event) { + console.log('获取输入的密码', event.detail.value) + this.setData({ + password: event.detail.value + }) + }, + + //注册 + adzhuce() { + let name = this.data.name + let account = this.data.account + let password = this.data.password + console.log("点击了注册") + console.log("name", name) + console.log("account", account) + console.log("password", password) + //校验用户名 + if (name.length < 2) { + wx.showToast({ + icon: 'none', + title: '用户名至少2位', + }) + return + } + if (name.length > 10) { + wx.showToast({ + icon: 'none', + title: '用户名最多10位', + }) + return + } + //校验账号 + if (account.length < 4) { + wx.showToast({ + icon: 'none', + title: '账号至少4位', + }) + return + } + //校验密码 + if (password.length < 4) { + wx.showToast({ + icon: 'none', + title: '密码至少4位', + }) + return + } + //注册功能的实现 + wx.cloud.database().collection('manager').add({ + data: { + name: name, + account: account, + password: password + }, + success(res) { + console.log('注册成功', res) + wx.showToast({ + title: '注册成功', + }) + wx.navigateTo({ + url: '../adlogin/adlogin', + }) + }, + fail(res) { + console.log('注册失败', res) + } + }) + } + }) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index1/index1.json b/src/map - 副本/miniprogram/pages/index1/index1.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index1/index1.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index1/index1.wxml b/src/map - 副本/miniprogram/pages/index1/index1.wxml new file mode 100644 index 0000000..bd53fbc --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index1/index1.wxml @@ -0,0 +1,8 @@ + +输入管理员用户名 + +输入管理员用户账号 + +输入管理员密码 + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index1/index1.wxss b/src/map - 副本/miniprogram/pages/index1/index1.wxss new file mode 100644 index 0000000..02428e2 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index1/index1.wxss @@ -0,0 +1,5 @@ +/**index.wxss**/ +.input{ + border: 1px solid gainsboro; + margin: 15rpx; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.js b/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.js new file mode 100644 index 0000000..0795310 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.js @@ -0,0 +1,90 @@ +Page({ + data: { + name: '', + zhanghao: '', + mima: '' + }, + //获取用户名 + getName(event) { + console.log('获取输入的用户名', event.detail.value) + this.setData({ + name: event.detail.value + }) + }, + //获取用户账号 + getZhangHao(event) { + console.log('获取输入的账号', event.detail.value) + this.setData({ + zhanghao: event.detail.value + }) + }, + // 获取密码 + getMiMa(event) { + console.log('获取输入的密码', event.detail.value) + this.setData({ + mima: event.detail.value + }) + }, + + //注册 + zhuce() { + let name = this.data.name + let zhanghao = this.data.zhanghao + let mima = this.data.mima + console.log("点击了注册") + console.log("name", name) + console.log("zhanghao", zhanghao) + console.log("mima", mima) + //校验用户名 + if (name.length < 2) { + wx.showToast({ + icon: 'none', + title: '用户名至少2位', + }) + return + } + if (name.length > 10) { + wx.showToast({ + icon: 'none', + title: '用户名最多10位', + }) + return + } + //校验账号 + if (zhanghao.length < 4) { + wx.showToast({ + icon: 'none', + title: '账号至少4位', + }) + return + } + //校验密码 + if (mima.length < 4) { + wx.showToast({ + icon: 'none', + title: '密码至少4位', + }) + return + } + //注册功能的实现 + wx.cloud.database().collection('user').add({ + data: { + name: name, + zhanghao: zhanghao, + mima: mima + }, + success(res) { + console.log('注册成功', res) + wx.showToast({ + title: '注册成功', + }) + wx.navigateTo({ + url: '../login_1/login_1', + }) + }, + fail(res) { + console.log('注册失败', res) + } + }) + } + }) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.json b/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.wxml b/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.wxml new file mode 100644 index 0000000..8697e97 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.wxml @@ -0,0 +1,8 @@ + +输入用户名 + +输入用户账号 + +输入密码 + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.wxss b/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.wxss new file mode 100644 index 0000000..02428e2 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/index_hjf/index_hjf.wxss @@ -0,0 +1,5 @@ +/**index.wxss**/ +.input{ + border: 1px solid gainsboro; + margin: 15rpx; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/login/login.js b/src/map - 副本/miniprogram/pages/login/login.js new file mode 100644 index 0000000..3bc5b0f --- /dev/null +++ b/src/map - 副本/miniprogram/pages/login/login.js @@ -0,0 +1,50 @@ +//获取应用实例 +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; + }, + denglu() { + wx.navigateTo({ + url: '/pages/login_1/login_1', + }) + }, + + zhuce() { + wx.navigateTo({ + url: '/pages/index_hjf/index_hjf', + }) + }, + guanliyuandenglu() { + wx.navigateTo({ + url: '/pages/adlogin/adlogin', + }) + }, + adzhuce() { + wx.navigateTo({ + url: '/pages/index1/index1', + }) + }, + /*showLive: function () { + wx.reLaunch({ + url: '../Find directions/Find directions', + }) + }, + showpage: function(){ + wx.reLaunch( + { + url:'../ModifyMap/ModifyMap' + } + ) + }*/ +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/login/login.json b/src/map - 副本/miniprogram/pages/login/login.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/login/login.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/login/login.wxml b/src/map - 副本/miniprogram/pages/login/login.wxml new file mode 100644 index 0000000..58e1c14 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/login/login.wxml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/login/login.wxss b/src/map - 副本/miniprogram/pages/login/login.wxss new file mode 100644 index 0000000..1ac561b --- /dev/null +++ b/src/map - 副本/miniprogram/pages/login/login.wxss @@ -0,0 +1,20 @@ +/**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; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/login_1/login_1.js b/src/map - 副本/miniprogram/pages/login_1/login_1.js new file mode 100644 index 0000000..5bcd6b8 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/login_1/login_1.js @@ -0,0 +1,97 @@ +// pages/login/login.js +Page({ + data: { + zhanghao: '', + mima: '' + }, + + + //获取输入的账号 + getZhanghao(event) { + //console.log('账号', event.detail.value) + this.setData({ + zhanghao: event.detail.value + }) + }, + + + //获取输入的密码 + getMima(event) { + // console.log('密码', event.detail.value) + this.setData({ + mima: event.detail.value + }) + }, + + //点击登陆 + login() { + let zhanghao = this.data.zhanghao + let mima = this.data.mima + console.log('账号', zhanghao, '密码', mima) + if(this.data.zhanghao == '') { + wx.showToast({ + title: '请输入账号!', + icon: 'none' + }) + return + } + if(this.data.mima == '') { + wx.showToast({ + title: '请输入密码!', + icon: 'none' + }) + return + } + if (zhanghao.length < 4) { + wx.showToast({ + icon: 'none', + title: '账号至少4位', + }) + return + } + if (mima.length < 4) { + wx.showToast({ + icon: 'none', + title: '密码至少4位', + }) + return + } + + //登陆 + wx.cloud.database().collection('user').where({ + zhanghao: zhanghao + }).get({ + success(res) { + console.log("获取数据成功", res) + let user = res.data[0] + console.log("user", user) + if (mima == user.mima) { + console.log('登陆成功') + wx.reLaunch({ + url: '../map/map', + }) + wx.showToast({ + title: '登陆成功', + }) + // wx.navigateTo({ + // url: '../home/home?name=' + user.name, + // }) + + //保存用户登陆状态 + wx.setStorageSync('user', user) + } else { + console.log('登陆失败') + wx.showToast({ + icon: 'none', + title: '账号或密码不正确', + }) + } + }, + fail(res) { + console.log("获取数据失败", res) + } + }) + + } + + }) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/login_1/login_1.json b/src/map - 副本/miniprogram/pages/login_1/login_1.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/login_1/login_1.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/login_1/login_1.wxml b/src/map - 副本/miniprogram/pages/login_1/login_1.wxml new file mode 100644 index 0000000..49b7eae --- /dev/null +++ b/src/map - 副本/miniprogram/pages/login_1/login_1.wxml @@ -0,0 +1,8 @@ + +输入账号 + +输入密码 + + + + diff --git a/src/map - 副本/miniprogram/pages/login_1/login_1.wxss b/src/map - 副本/miniprogram/pages/login_1/login_1.wxss new file mode 100644 index 0000000..2c01333 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/login_1/login_1.wxss @@ -0,0 +1,5 @@ +/* pages/login/login.wxss */ +.input{ + border: 1px solid gainsboro; + margin: 20rpx; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/logs/logs.js b/src/map - 副本/miniprogram/pages/logs/logs.js new file mode 100644 index 0000000..26e868a --- /dev/null +++ b/src/map - 副本/miniprogram/pages/logs/logs.js @@ -0,0 +1,66 @@ +// pages/logs/logs.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/logs/logs.wxml b/src/map - 副本/miniprogram/pages/logs/logs.wxml new file mode 100644 index 0000000..c49f50c --- /dev/null +++ b/src/map - 副本/miniprogram/pages/logs/logs.wxml @@ -0,0 +1,2 @@ + +pages/logs/logs.wxml diff --git a/src/map - 副本/miniprogram/pages/map/map.js b/src/map - 副本/miniprogram/pages/map/map.js new file mode 100644 index 0000000..5bafa37 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/map/map.js @@ -0,0 +1,946 @@ +var amapFile = require('../../utils/amap-wx.js'); +var QQMapWX = require('../../utils/qqmap-wx-jssdk.js'); +var app = getApp(); + +Page({ + data:{ + location_table:[{ + name:"中国民航大学", + longitude: 117.35002, + latitude: 39.11198, + },{ + name:"中国民航大学北苑南门", + longitude: 117.34731127236174, + latitude: 39.10971874275899, + },{ + name:"中国民航大学北苑西门", + longitude: 117.34878648731993, + latitude: 39.11463444059635, + },{ + name:"中国民航大学北苑北门", + longitude: 117.3517905614166, + latitude: 39.11623685901714, + },{ + name:"中国民航大学北苑操场", + longitude: 117.35193003628538, + latitude: 39.11286133256378, + },{ + name:"中国民航大学北苑体育场", + longitude: 117.35319067452238, + latitude: 39.11298620078748, + },{ + name:"中国民航大学北苑游泳馆", + longitude: 117.35225190136717, + latitude: 39.113331668385676, + },{ + name:"中国民航大学北教一", + longitude: 117.34819103691862, + latitude: 39.111167265141056, + },{ + name:"中国民航大学北教四", + longitude: 117.35005785439299, + latitude: 39.11041387072548, + },{ + name:"中国民航大学北教五", + longitude: 117.348979606369, + latitude: 39.110580367422955, + },{ + name:"中国民航大学北二十一宿舍楼", + longitude: 117.3529251358299, + latitude: 39.111835323611125, + },{ + name:"中国民航大学北一食堂", + longitude: 117.351141466835, + latitude: 39.11229109820452, + },{ + name:"中国民航大学北四食堂", + longitude: 117.34990228627012, + latitude: 39.11351064491374, + },{ + name:"中国民航大学北五食堂", + longitude: 117.35222507927702, + latitude: 39.114359736647195, + },{ + name:"中国民航大学北苑礼堂", + longitude: 117.34922100518034, + latitude: 39.11285300801614, + },{ + name:"中国民航大学文化艺术教育中心", + longitude: 117.35004712555693, + latitude: 39.11260327087659, + },{ + name:"中国民航大学北区实验大楼", + longitude: 117.35049773667143, + latitude: 39.111554365211944, + },{ + name:"中国民航大学南一教学楼", + longitude: 117.35323358986662, + latitude: 39.10597242612648, + },{ + name:"中国民航大学南二教学楼", + longitude: 117.35212851975248, + latitude: 39.10647610917062, + },{ + name:"中国民航大学南三教学楼", + longitude: 117.35269714806364, + latitude: 39.10509825692947, + },{ + name:"中国民航大学南四教学楼", + longitude: 117.35289563153074, + latitude: 39.104253216397744, + },{ + name:"中国民航大学南五教学楼", + longitude: 117.35373784516142, + latitude: 39.10181794441759, + },{ + name:"中国民航大学南三教学楼", + longitude: 117.35483755085752, + latitude: 39.1078414467564, + },{ + name:"中国民航大学南苑北门", + longitude: 117.35484023306654, + latitude: 39.10783936546857, + },{ + name:"中国民航大学南苑体育馆", + longitude: 117.35579778168486, + latitude: 39.10689653606183, + },{ + name:"中国民航大学南苑图书馆", + longitude: 117.35313703034208, + latitude: 39.10710050464082, + },{ + name:"中国民航大学南苑田径场西", + longitude: 117.3557870528488, + latitude: 39.104977537473204, + },{ + name:"中国民航大学南苑田径场东", + longitude: 117.35731054756926, + latitude: 39.105185674336425, + },{ + name:"中国民航大学南苑篮球场", + longitude: 117.3557870528488, + latitude: 39.1060598424514, + },{ + name:"中国民航大学南苑排球场", + longitude: 117.35521842453764, + latitude: 39.10398679758133, + },{ + name:"中国民航大学南苑网球场", + longitude: 117.35609818909452, + latitude: 39.10344563125516, + },{ + name:"中国民航大学南苑羽乒馆", + longitude: 117.35184957001493, + latitude: 39.105310556161044, + },{ + name:"中国民航大学南苑明德馆", + longitude: 117.35486437294767, + latitude: 39.10133087992974, + },{ + name:"中国民航大学南一食堂", + longitude: 117.35289026711271, + latitude: 39.10357884181467, + },{ + name:"中国民航大学南二食堂", + longitude: 117.35157598469542, + latitude: 39.1017846409744, + },{ + name:"中国民航大学南三食堂", + longitude: 117.35169400189207, + latitude: 39.10357467898941, + },{ + name:"中国民航大学南一宿舍楼", + longitude: 117.3534642598419, + latitude: 39.10355386485458, + },{ + name:"中国民航大学南苑菜鸟驿站", + longitude: 117.35596944306181, + latitude: 39.10322500071765, + }], + src: { + longitude: 1.1, + latitude: 1.1, + }, + des: { + longitude: 1.1, + latitude: 1.1, + }, + src_location: "", + des_location: "", + // 初始展示时的经纬度 + longitude: 117.35002, + latitude: 39.11198, + // 初始的缩放比例 + scale:15, + // 统一设置地图 + setting : { + skew: 0, + rotate: 0, + showLocation: false, + showScale: false, + subKey: '', + layerStyle: 1, + enableZoom: true, + enableScroll: true, + enableRotate: false, + showCompass: false, + enable3D: false, + enableOverlooking: false, + enableSatellite: false, + enableTraffic: false, + }, + // 初始化显示地标 + markers:[{ + //id: 1, + longitude: 117.35002, + latitude: 39.11198, + title:"中国民航大学", + iconPath:"../../images/tag.png", + width: 20, + height: 30 + }], + // 显示按钮是否被点击 + type_door: "type", + type_mess: "type", + type_bathroom: "type", + type_print_shop: "type", + type_supermarket: "type", + type_post_station: "type", + type_library: "type", + type_barber_shop: "type", + type_playground: "type", + type_gymnasium: "type", + type_cancel: "type", + distance: '', + cost: '', + polyline: [] + }, + + // 界面出现即执行 + onLoad:function(options){ + this.setData({ + // 仅设置的属性会生效,其它的不受影响 + setting: { + // 展示目前位置 + showLocation: true, + // 右上角指南针 + showCompass: true, + // 左下角比例尺 + showScale: true, + enable3D: true, + //enableTraffic: true + } + }) + }, + + // 输入框获取出发地 + getSrc_location: function(event){ + this.setData({ + src_location: event.detail.value + }) + console.log("获取出发地调用成功", event) + // 对内部使用变量重新赋值,否则无法使用 + let location_table = this.data.location_table + let src_location = this.data.src_location + var that = this; + var qqmapsdk = new QQMapWX({ + key: 'MVJBZ-KOICX-B6W4G-TH5QR-MKW2E-5YBJA' //必需,自己申请 + }) + // geoCoder 根据地址获取经纬度 + qqmapsdk.geocoder({ + address: this.data.src_location, //需要转换为经纬度的地址 + success: function (res) { //返回的数据里面有该地址的经纬度 + console.log("qqmapsdk.geocoder 接口调用成功返回的回调", res) + that.data.src.longitude = res.result.location.lng; + that.data.src.latitude = res.result.location.lat; + }, + fail: function (res) { + console.log("qqmapsdk.geocoder 接口调用失败返回的回调,准备查询本地映射表", res) + // 查询映射表 + // let location = app.globalData.location + // let location = this.data.location + let i + let length = location_table.length + for (i=0; i +出发地: + + +目的地: + + + + + + + + + + + + + + {{distance}} + {{cost}} + 详情 + + + + + + {{index==1? '校门':''}} + {{index==2? '食堂':''}} + {{index==3? '浴室':''}} + {{index==4? '打印店':''}} + {{index==5? '超市':''}} + {{index==6? '菜鸟驿站':''}} + {{index==7? '图书馆':''}} + {{index==8? '理发店':''}} + {{index==9? '操场':''}} + {{index==10? '体育馆':''}} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/map/map.wxss b/src/map - 副本/miniprogram/pages/map/map.wxss new file mode 100644 index 0000000..0618695 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/map/map.wxss @@ -0,0 +1,137 @@ +/* 显示位置按钮 */ +/* map { + width: 750rpx; +} */ + +/* .show_all { + position: absolute; + right: 100rpx; + bottom: 100rpx; + color: rgb(62, 207, 142); + background-color: rgb(255, 255, 255); + box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08); +} */ + +/* .cover { + color: #fff; + height: 100rpx; + width: 220rpx; + line-height: 100rpx; + font-size: 35rpx; + text-align: center; + position: absolute; + left: 100rpx; + bottom: 100rpx; + border-radius: 50rpx; + text-shadow: 0 1px 3px rgba(36, 180, 126, .4); +} */ + +/* .add_me { + font-size: 30rpx; + color: #fff; + background-color: rgb(62, 207, 142); + width: 450rpx; + padding: 20rpx; + position: absolute; + right: 10rpx; + top: 20rpx; + text-align: center; +} */ + +/* .up { + position: absolute; + right: 150rpx; + top: 5rpx; + border-right: 20rpx solid transparent; + border-left: 20rpx solid transparent; + border-bottom: 20rpx solid rgb(62, 207, 142); +} */ + +/* .getLocation { + position: absolute; + left: 20rpx; + bottom: 250rpx; + text-align: center; + width: 20px; + background-color:rgb(255, 255, 255,0.9); + padding: 13px; + box-shadow: 1px 2px 3px #999999; + border-radius: 100px; +} */ + + /* .list { + position: absolute; + left: 20rpx; + bottom: 360rpx; + text-align: center; + width: 20px; + background-color: rgb(62, 207, 142,0.9); + padding: 13px; + box-shadow: 1px 2px 3px #999999; + border-radius: 100px; +} */ + +.tab-h{ + height: 400rpx; + width: 140rpx; + bottom:250rpx; + right: 12px; + box-sizing: border-box; + overflow: hidden; + line-height: 80rpx; + background: rgba(255, 255, 255, 0.9); + font-size: 16px; + white-space: nowrap; + position: fixed; + z-index: 99; + border-radius: 10px; +} +.chouse_type { + font-size: 32rpx; + color: rgb(62, 207, 142); + text-align: center; +} +.type { + font-size: 32rpx; + + color: rgb(192, 192, 192); + text-align: center; +} +scroll-view ::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; + display: none; +} + +/***************************************************************/ + +.text_box{ + position:absolute; + height: 90px; + bottom: 0px; + left: 0px; + right: 0px; +} +.text_box .text{ + margin: 15px; +} +.detail_button{ + position:absolute; + bottom: 30px; + right: 10px; + padding: 3px 5px; + color: #fff; + background: #0091ff; + width:50px; + text-align:center; + border-radius:5px; +} + +.weather_button{ + bottom:150rpx; + right: 12px; + font-size: 16px; + position: fixed; +} + diff --git a/src/map - 副本/miniprogram/pages/selectusers(ID)/index.js b/src/map - 副本/miniprogram/pages/selectusers(ID)/index.js new file mode 100644 index 0000000..c5fc052 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers(ID)/index.js @@ -0,0 +1,36 @@ +// pages/selectusers/index.js +Page({ + inputgetID:function(e){ + this.setData({ + getUser_ID:e.detail.value + }) + }, + searchDataNameFn:function(){ + wx.cloud.callFunction({ + name: 'useroption', + data: { + option: 'getID', + getUser_ID:this.data.getUser_ID + }, + success: res => { + this.setData({ + array: res.result.data + }) + wx.showToast({ + title: '用户查询成功', + }) + console.log(res.result.data) + }, + fail: err => { + wx.showToast({ + title: '用户查询失败', + }) + } + }) + }, + getback:function(){ + wx.navigateBack({ + delta:2, + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectusers(ID)/index.json b/src/map - 副本/miniprogram/pages/selectusers(ID)/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers(ID)/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectusers(ID)/index.wxml b/src/map - 副本/miniprogram/pages/selectusers(ID)/index.wxml new file mode 100644 index 0000000..4e95312 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers(ID)/index.wxml @@ -0,0 +1,31 @@ + + + + + + + + 用户库 + + 年级 + 院系 + 班级 + 学号 + + + + {{item.User_College}} + {{item.User_Grade}} + {{item.User_Class}} + {{item.User_ID}} + + + + + + + diff --git a/src/map - 副本/miniprogram/pages/selectusers(ID)/index.wxss b/src/map - 副本/miniprogram/pages/selectusers(ID)/index.wxss new file mode 100644 index 0000000..541b7d5 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers(ID)/index.wxss @@ -0,0 +1,145 @@ +/* pages/selectusers/index.wxss */ +/* pages/selectusers(college)/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + color: rgba(0, 0, 0, 0.5); + width: 90%; + text-align: left; + margin-top: 30rpx; + margin-left: 20rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} + +.code_box { + text-align: center; + background-color: white; + margin-top: 30rpx; + padding: 17rpx; +} + +.code_box_title { + color: rgba(0, 0, 0, 0.5); + font-size: 26rpx; + margin-bottom: 20rpx; + text-align: left; +} + +.code_box_record { + display: flex; +} + +.code_box_record_title { + width: 33%; + font-size: 26rpx; + color: rgba(0, 0, 0, 0.5); + padding: 20rpx 0; +} + +.code_box_record_detail { + width: 33%; + font-size: 26rpx; + padding: 20rpx 0; +} + +.button { + width: 300rpx; + text-align: center; + margin: 20% auto 0 auto; + height: 80rpx; + color: white; + border-radius: 5px; + line-height: 80rpx; + background-color: #07c160; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectusers(college)/index.js b/src/map - 副本/miniprogram/pages/selectusers(college)/index.js new file mode 100644 index 0000000..8df6942 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers(college)/index.js @@ -0,0 +1,48 @@ +// pages/selectusers(college)/index.js +Page({ + inputgetCollege:function(e){ + this.setData({ + getUser_College:e.detail.value + }) + }, + inputgetGrade:function(e){ + this.setData({ + getUser_Grade:e.detail.value + }) + }, + inputgetClass:function(e){ + this.setData({ + getUser_Class:e.detail.value + }) + }, + searchDataNameFn:function(){ + wx.cloud.callFunction({ + name: 'useroption', + data: { + option: 'getCollege', + getUser_College:this.data.getUser_College, + getUser_Grade:this.data.getUser_Grade, + getUser_Class:this.data.getUser_Class + }, + success: res => { + this.setData({ + array: res.result.data + }) + wx.showToast({ + title: '用户查询成功', + }) + console.log(res.result.data) + }, + fail: err => { + wx.showToast({ + title: '用户查询失败', + }) + } + }) + }, + getback:function(){ + wx.navigateBack({ + delta:2, + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectusers(college)/index.json b/src/map - 副本/miniprogram/pages/selectusers(college)/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers(college)/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectusers(college)/index.wxml b/src/map - 副本/miniprogram/pages/selectusers(college)/index.wxml new file mode 100644 index 0000000..2d27ab7 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers(college)/index.wxml @@ -0,0 +1,41 @@ + + + + + + + + + + 用户库 + + 年级 + 院系 + 班级 + 学号 + + + + {{item.User_College}} + {{item.User_Grade}} + {{item.User_Class}} + {{item.User_ID}} + + + + + + + diff --git a/src/map - 副本/miniprogram/pages/selectusers(college)/index.wxss b/src/map - 副本/miniprogram/pages/selectusers(college)/index.wxss new file mode 100644 index 0000000..d670baa --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers(college)/index.wxss @@ -0,0 +1,144 @@ +/* pages/selectusers(college)/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + color: rgba(0, 0, 0, 0.5); + width: 90%; + text-align: left; + margin-top: 30rpx; + margin-left: 20rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} + +.code_box { + text-align: center; + background-color: white; + margin-top: 30rpx; + padding: 17rpx; +} + +.code_box_title { + color: rgba(0, 0, 0, 0.5); + font-size: 26rpx; + margin-bottom: 20rpx; + text-align: left; +} + +.code_box_record { + display: flex; +} + +.code_box_record_title { + width: 33%; + font-size: 26rpx; + color: rgba(0, 0, 0, 0.5); + padding: 20rpx 0; +} + +.code_box_record_detail { + width: 33%; + font-size: 26rpx; + padding: 20rpx 0; +} + +.button { + width: 300rpx; + text-align: center; + margin: 20% auto 0 auto; + height: 80rpx; + color: white; + border-radius: 5px; + line-height: 80rpx; + background-color: #07c160; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectusers/index.js b/src/map - 副本/miniprogram/pages/selectusers/index.js new file mode 100644 index 0000000..998b938 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers/index.js @@ -0,0 +1,22 @@ +// pages/selectusers/index.js +const db = wx.cloud.database() +Page({ + //查询数据(查) + searchID:function(){ + wx.navigateTo({ + url: '/pages/selectusers(ID)/index', + }) + }, + + searchCollege:function(){ + wx.navigateTo({ + url: '/pages/selectusers(college)/index', + }) + }, + + search:function(){ + wx.navigateTo({ + url: '/pages/selectuserss/index', + }) + }, +}) diff --git a/src/map - 副本/miniprogram/pages/selectusers/index.json b/src/map - 副本/miniprogram/pages/selectusers/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectusers/index.wxml b/src/map - 副本/miniprogram/pages/selectusers/index.wxml new file mode 100644 index 0000000..cf209a6 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers/index.wxml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/map - 副本/miniprogram/pages/selectusers/index.wxss b/src/map - 副本/miniprogram/pages/selectusers/index.wxss new file mode 100644 index 0000000..1a73360 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectusers/index.wxss @@ -0,0 +1,101 @@ +/* pages/selectusers/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #888888; + margin-bottom: 28rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectuserss/index.js b/src/map - 副本/miniprogram/pages/selectuserss/index.js new file mode 100644 index 0000000..fa90b3b --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectuserss/index.js @@ -0,0 +1,30 @@ +// pages/selectuserss/index.js +Page({ + searchDataNameFn:function(){ + wx.cloud.callFunction({ + name: 'useroption', + data: { + option: 'getusers', + }, + success: res => { + this.setData({ + array: res.result.data + }) + wx.showToast({ + title: '用户查询成功', + }) + console.log(res.result.data) + }, + fail: err => { + wx.showToast({ + title: '用户查询失败', + }) + } + }) + }, + getback:function(){ + wx.navigateBack({ + delta:2, + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectuserss/index.json b/src/map - 副本/miniprogram/pages/selectuserss/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectuserss/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectuserss/index.wxml b/src/map - 副本/miniprogram/pages/selectuserss/index.wxml new file mode 100644 index 0000000..10829ee --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectuserss/index.wxml @@ -0,0 +1,20 @@ + + + + 用户库 + + 年级 + 院系 + 班级 + 学号 + + + + {{item.User_College}} + {{item.User_Grade}} + {{item.User_Class}} + {{item.User_ID}} + + + + diff --git a/src/map - 副本/miniprogram/pages/selectuserss/index.wxss b/src/map - 副本/miniprogram/pages/selectuserss/index.wxss new file mode 100644 index 0000000..2ec4ff6 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectuserss/index.wxss @@ -0,0 +1,145 @@ +/* pages/selectuserss/index.wxss */ +/* pages/selectusers(college)/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + color: rgba(0, 0, 0, 0.5); + width: 90%; + text-align: left; + margin-top: 30rpx; + margin-left: 20rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} + +.code_box { + text-align: center; + background-color: white; + margin-top: 30rpx; + padding: 17rpx; +} + +.code_box_title { + color: rgba(0, 0, 0, 0.5); + font-size: 26rpx; + margin-bottom: 20rpx; + text-align: left; +} + +.code_box_record { + display: flex; +} + +.code_box_record_title { + width: 33%; + font-size: 26rpx; + color: rgba(0, 0, 0, 0.5); + padding: 20rpx 0; +} + +.code_box_record_detail { + width: 33%; + font-size: 26rpx; + padding: 20rpx 0; +} + +.button { + width: 300rpx; + text-align: center; + margin: 20% auto 0 auto; + height: 80rpx; + color: white; + border-radius: 5px; + line-height: 80rpx; + background-color: #07c160; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectuserssuccess/index.js b/src/map - 副本/miniprogram/pages/selectuserssuccess/index.js new file mode 100644 index 0000000..ac586a6 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectuserssuccess/index.js @@ -0,0 +1,66 @@ +// pages/selectuserssuccess/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/selectuserssuccess/index.wxml b/src/map - 副本/miniprogram/pages/selectuserssuccess/index.wxml new file mode 100644 index 0000000..9976e30 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/selectuserssuccess/index.wxml @@ -0,0 +1,2 @@ + +pages/selectuserssuccess/index.wxml diff --git a/src/map - 副本/miniprogram/pages/text/text.js b/src/map - 副本/miniprogram/pages/text/text.js new file mode 100644 index 0000000..3370131 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/text/text.js @@ -0,0 +1,81 @@ +// pages/text/text.js +Page({ + check() { + wx.navigateToMiniProgram({ + appId: 'wx5e77d1bb9e24f179', // 小程序B的appid** + path: 'pages/index/index', //小程序B的页面路径** + extraData: {}, + envVersion: 'release', //打开版本 开发版 develop;体验版trial; 正式版release + success(res) { + // 打开成功 + }, + fail(res){ + //打开失败 + } + }) + + }, + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/text/text.json b/src/map - 副本/miniprogram/pages/text/text.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/text/text.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/text/text.wxml b/src/map - 副本/miniprogram/pages/text/text.wxml new file mode 100644 index 0000000..d7496d0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/text/text.wxml @@ -0,0 +1,2 @@ + + diff --git a/src/map - 副本/miniprogram/pages/text/text.wxss b/src/map - 副本/miniprogram/pages/text/text.wxss new file mode 100644 index 0000000..25d00ed --- /dev/null +++ b/src/map - 副本/miniprogram/pages/text/text.wxss @@ -0,0 +1 @@ +/* pages/text/text.wxss */ \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/updateusers/index.js b/src/map - 副本/miniprogram/pages/updateusers/index.js new file mode 100644 index 0000000..0702779 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/updateusers/index.js @@ -0,0 +1,46 @@ +// pages/updateusers/index.js +Page({ + //修改数据(改) + inputupdateID:function(e){ + this.setData({ + updateUser_ID:e.detail.value + }) + }, + inputupdateCollege:function(e){ + this.setData({ + updateUser_College:e.detail.value + }) + }, + inputupdateKey:function(e){ + this.setData({ + updateUser_Key:e.detail.value + }) + }, + updateDataFn(){ + wx.cloud.callFunction({ + name: 'useroption', + data: { + option: 'update', + updateUser_ID:this.data.updateUser_ID, + updateUser_College:this.data.updateUser_College, + updateUser_Key:this.data.updateUser_Key + }, + success: res => { + wx.showToast({ + title: '用户修改成功', + }) + console.log(res) + }, + fail:err => { + wx.showToast({ + title: '用户修改失败', + }) + } + }) + }, + getback:function(){ + wx.navigateBack({ + delta:1, + }) + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/updateusers/index.json b/src/map - 副本/miniprogram/pages/updateusers/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/updateusers/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/updateusers/index.wxml b/src/map - 副本/miniprogram/pages/updateusers/index.wxml new file mode 100644 index 0000000..82a32f7 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/updateusers/index.wxml @@ -0,0 +1,24 @@ + + + + + + + + + + + + diff --git a/src/map - 副本/miniprogram/pages/updateusers/index.wxss b/src/map - 副本/miniprogram/pages/updateusers/index.wxss new file mode 100644 index 0000000..3d1e9e7 --- /dev/null +++ b/src/map - 副本/miniprogram/pages/updateusers/index.wxss @@ -0,0 +1,100 @@ +/* pages/updateusers/index.wxss */ + +page { + padding-top: 54rpx; + background-color: #f6f6f6; + padding-bottom: 60rpx; +} + +.button { + margin-top: 50px; + margin-left: 50px; + margin-right: 50px; +} + +.title { + font-family: PingFang SC; + font-weight: 500; + color: #000000; + font-size: 44rpx; + margin-bottom: 40rpx; +} + +.top_tip { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #888888; + margin-bottom: 28rpx; +} + +.power { + margin-top: 30rpx; + border-radius: 5px; + background-color: white; + width: 93%; + padding-bottom: 1rpx; +} + +.power_info { + display: flex; + padding: 30rpx 25rpx; + align-items: center; + justify-content: space-between; +} + +.power_info_more { + width: 30rpx; + height: 30rpx; + transform: rotate(90deg); +} + +.power_info_less { + width: 30rpx; + height: 30rpx; + transform: rotate(270deg); +} + +.power_info_text { + display: flex; + flex-direction: column; +} + +.power_info_text_title { + margin-bottom: 10rpx; + font-weight: 400; + font-size: 35rpx; +} + +.power_info_text_tip { + color: rgba(0, 0, 0, 0.4); + font-size: 25rpx; +} + +.power_item { + padding: 30rpx 25rpx; + display: flex; + justify-content: space-between; +} + +.power_item_title { + font-size: 30rpx; +} + +.power_item_icon { + width: 30rpx; + height: 30rpx; +} + +.line { + width: 95%; + margin: 0 auto; + height: 2rpx; + background-color: rgba(0, 0, 0, 0.1); +} + +.environment { + color: rgba(0, 0, 0, 0.4); + font-size: 24rpx; + margin-top: 25%; +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/updateuserssuccess/index.js b/src/map - 副本/miniprogram/pages/updateuserssuccess/index.js new file mode 100644 index 0000000..ae7c08b --- /dev/null +++ b/src/map - 副本/miniprogram/pages/updateuserssuccess/index.js @@ -0,0 +1,66 @@ +// pages/updateuserssuccess/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/src/map - 副本/miniprogram/pages/updateuserssuccess/index.wxml b/src/map - 副本/miniprogram/pages/updateuserssuccess/index.wxml new file mode 100644 index 0000000..8a0c4ef --- /dev/null +++ b/src/map - 副本/miniprogram/pages/updateuserssuccess/index.wxml @@ -0,0 +1,2 @@ + +pages/updateuserssuccess/index.wxml diff --git a/src/map - 副本/miniprogram/sitemap.json b/src/map - 副本/miniprogram/sitemap.json new file mode 100644 index 0000000..27b2b26 --- /dev/null +++ b/src/map - 副本/miniprogram/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/src/map - 副本/miniprogram/utils/Find directions.wxml b/src/map - 副本/miniprogram/utils/Find directions.wxml new file mode 100644 index 0000000..088eb73 --- /dev/null +++ b/src/map - 副本/miniprogram/utils/Find directions.wxml @@ -0,0 +1,13 @@ +出发地: + + +目的地: + + + + + + + \ No newline at end of file diff --git a/src/map - 副本/miniprogram/utils/amap-wx.js b/src/map - 副本/miniprogram/utils/amap-wx.js new file mode 100644 index 0000000..c8dd42d --- /dev/null +++ b/src/map - 副本/miniprogram/utils/amap-wx.js @@ -0,0 +1 @@ +function AMapWX(a) { this.key = a.key, this.requestConfig = { key: a.key, s: "rsx", platform: "WXJS", appname: a.key, sdkversion: "1.2.0", logversion: "2.0" } } AMapWX.prototype.getWxLocation = function (a, b) { wx.getLocation({ type: "gcj02", success: function (a) { var c = a.longitude + "," + a.latitude; wx.setStorage({ key: "userLocation", data: c }), b(c) }, fail: function (c) { wx.getStorage({ key: "userLocation", success: function (a) { a.data && b(a.data) } }), a.fail({ errCode: "0", errMsg: c.errMsg || "" }) } }) }, AMapWX.prototype.getRegeo = function (a) { function c(c) { var d = b.requestConfig; wx.request({ url: "https://restapi.amap.com/v3/geocode/regeo", data: { key: b.key, location: c, extensions: "all", s: d.s, platform: d.platform, appname: b.key, sdkversion: d.sdkversion, logversion: d.logversion }, method: "GET", header: { "content-type": "application/json" }, success: function (b) { var d, e, f, g, h, i, j, k; b.data.status && "1" == b.data.status ? (d = b.data.regeocode, e = d.addressComponent, f = [], g = d.roads[0].name + "附近", h = c.split(",")[0], i = c.split(",")[1], d.pois && d.pois[0] && (g = d.pois[0].name + "附近", j = d.pois[0].location, j && (h = parseFloat(j.split(",")[0]), i = parseFloat(j.split(",")[1]))), e.provice && f.push(e.provice), e.city && f.push(e.city), e.district && f.push(e.district), e.streetNumber && e.streetNumber.street && e.streetNumber.number ? (f.push(e.streetNumber.street), f.push(e.streetNumber.number)) : f.push(d.roads[0].name), f = f.join(""), k = [{ iconPath: a.iconPath, width: a.iconWidth, height: a.iconHeight, name: f, desc: g, longitude: h, latitude: i, id: 0, regeocodeData: d }], a.success(k)) : a.fail({ errCode: b.data.infocode, errMsg: b.data.info }) }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) } var b = this; a.location ? c(a.location) : b.getWxLocation(a, function (a) { c(a) }) }, AMapWX.prototype.getWeather = function (a) { function d(d) { var e = "base"; a.type && "forecast" == a.type && (e = "all"), wx.request({ url: "https://restapi.amap.com/v3/weather/weatherInfo", data: { key: b.key, city: d, extensions: e, s: c.s, platform: c.platform, appname: b.key, sdkversion: c.sdkversion, logversion: c.logversion }, method: "GET", header: { "content-type": "application/json" }, success: function (b) { function c(a) { var b = { city: { text: "城市", data: a.city }, weather: { text: "天气", data: a.weather }, temperature: { text: "温度", data: a.temperature }, winddirection: { text: "风向", data: a.winddirection + "风" }, windpower: { text: "风力", data: a.windpower + "级" }, humidity: { text: "湿度", data: a.humidity + "%" } }; return b } var d, e; b.data.status && "1" == b.data.status ? b.data.lives ? (d = b.data.lives, d && d.length > 0 && (d = d[0], e = c(d), e["liveData"] = d, a.success(e))) : b.data.forecasts && b.data.forecasts[0] && a.success({ forecast: b.data.forecasts[0] }) : a.fail({ errCode: b.data.infocode, errMsg: b.data.info }) }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) } function e(e) { wx.request({ url: "https://restapi.amap.com/v3/geocode/regeo", data: { key: b.key, location: e, extensions: "all", s: c.s, platform: c.platform, appname: b.key, sdkversion: c.sdkversion, logversion: c.logversion }, method: "GET", header: { "content-type": "application/json" }, success: function (b) { var c, e; b.data.status && "1" == b.data.status ? (e = b.data.regeocode, e.addressComponent ? c = e.addressComponent.adcode : e.aois && e.aois.length > 0 && (c = e.aois[0].adcode), d(c)) : a.fail({ errCode: b.data.infocode, errMsg: b.data.info }) }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) } var b = this, c = b.requestConfig; a.city ? d(a.city) : b.getWxLocation(a, function (a) { e(a) }) }, AMapWX.prototype.getPoiAround = function (a) { function d(d) { var e = { key: b.key, location: d, s: c.s, platform: c.platform, appname: b.key, sdkversion: c.sdkversion, logversion: c.logversion }; a.querytypes && (e["types"] = a.querytypes), a.querykeywords && (e["keywords"] = a.querykeywords), wx.request({ url: "https://restapi.amap.com/v3/place/around", data: e, method: "GET", header: { "content-type": "application/json" }, success: function (b) { var c, d, e, f; if (b.data.status && "1" == b.data.status) { if (b = b.data, b && b.pois) { for (c = [], d = 0; d < b.pois.length; d++)e = 0 == d ? a.iconPathSelected : a.iconPath, c.push({ latitude: parseFloat(b.pois[d].location.split(",")[1]), longitude: parseFloat(b.pois[d].location.split(",")[0]), iconPath: e, width: 22, height: 32, id: d, name: b.pois[d].name, address: b.pois[d].address }); f = { markers: c, poisData: b.pois }, a.success(f) } } else a.fail({ errCode: b.data.infocode, errMsg: b.data.info }) }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) } var b = this, c = b.requestConfig; a.location ? d(a.location) : b.getWxLocation(a, function (a) { d(a) }) }, AMapWX.prototype.getStaticmap = function (a) { function f(b) { c.push("location=" + b), a.zoom && c.push("zoom=" + a.zoom), a.size && c.push("size=" + a.size), a.scale && c.push("scale=" + a.scale), a.markers && c.push("markers=" + a.markers), a.labels && c.push("labels=" + a.labels), a.paths && c.push("paths=" + a.paths), a.traffic && c.push("traffic=" + a.traffic); var e = d + c.join("&"); a.success({ url: e }) } var e, b = this, c = [], d = "https://restapi.amap.com/v3/staticmap?"; c.push("key=" + b.key), e = b.requestConfig, c.push("s=" + e.s), c.push("platform=" + e.platform), c.push("appname=" + e.appname), c.push("sdkversion=" + e.sdkversion), c.push("logversion=" + e.logversion), a.location ? f(a.location) : b.getWxLocation(a, function (a) { f(a) }) }, AMapWX.prototype.getInputtips = function (a) { var b = this, c = b.requestConfig, d = { key: b.key, s: c.s, platform: c.platform, appname: b.key, sdkversion: c.sdkversion, logversion: c.logversion }; a.location && (d["location"] = a.location), a.keywords && (d["keywords"] = a.keywords), a.type && (d["type"] = a.type), a.city && (d["city"] = a.city), a.citylimit && (d["citylimit"] = a.citylimit), wx.request({ url: "https://restapi.amap.com/v3/assistant/inputtips", data: d, method: "GET", header: { "content-type": "application/json" }, success: function (b) { b && b.data && b.data.tips && a.success({ tips: b.data.tips }) }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) }, AMapWX.prototype.getDrivingRoute = function (a) { var b = this, c = b.requestConfig, d = { key: b.key, s: c.s, platform: c.platform, appname: b.key, sdkversion: c.sdkversion, logversion: c.logversion }; a.origin && (d["origin"] = a.origin), a.destination && (d["destination"] = a.destination), a.strategy && (d["strategy"] = a.strategy), a.waypoints && (d["waypoints"] = a.waypoints), a.avoidpolygons && (d["avoidpolygons"] = a.avoidpolygons), a.avoidroad && (d["avoidroad"] = a.avoidroad), wx.request({ url: "https://restapi.amap.com/v3/direction/driving", data: d, method: "GET", header: { "content-type": "application/json" }, success: function (b) { b && b.data && b.data.route && a.success({ paths: b.data.route.paths, taxi_cost: b.data.route.taxi_cost || "" }) }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) }, AMapWX.prototype.getWalkingRoute = function (a) { var b = this, c = b.requestConfig, d = { key: b.key, s: c.s, platform: c.platform, appname: b.key, sdkversion: c.sdkversion, logversion: c.logversion }; a.origin && (d["origin"] = a.origin), a.destination && (d["destination"] = a.destination), wx.request({ url: "https://restapi.amap.com/v3/direction/walking", data: d, method: "GET", header: { "content-type": "application/json" }, success: function (b) { b && b.data && b.data.route && a.success({ paths: b.data.route.paths }) }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) }, AMapWX.prototype.getTransitRoute = function (a) { var b = this, c = b.requestConfig, d = { key: b.key, s: c.s, platform: c.platform, appname: b.key, sdkversion: c.sdkversion, logversion: c.logversion }; a.origin && (d["origin"] = a.origin), a.destination && (d["destination"] = a.destination), a.strategy && (d["strategy"] = a.strategy), a.city && (d["city"] = a.city), a.cityd && (d["cityd"] = a.cityd), wx.request({ url: "https://restapi.amap.com/v3/direction/transit/integrated", data: d, method: "GET", header: { "content-type": "application/json" }, success: function (b) { if (b && b.data && b.data.route) { var c = b.data.route; a.success({ distance: c.distance || "", taxi_cost: c.taxi_cost || "", transits: c.transits }) } }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) }, AMapWX.prototype.getRidingRoute = function (a) { var b = this, c = b.requestConfig, d = { key: b.key, s: c.s, platform: c.platform, appname: b.key, sdkversion: c.sdkversion, logversion: c.logversion }; a.origin && (d["origin"] = a.origin), a.destination && (d["destination"] = a.destination), wx.request({ url: "https://restapi.amap.com/v3/direction/riding", data: d, method: "GET", header: { "content-type": "application/json" }, success: function (b) { b && b.data && b.data.route && a.success({ paths: b.data.route.paths }) }, fail: function (b) { a.fail({ errCode: "0", errMsg: b.errMsg || "" }) } }) }, module.exports.AMapWX = AMapWX; \ No newline at end of file diff --git a/src/map - 副本/miniprogram/utils/location.js b/src/map - 副本/miniprogram/utils/location.js new file mode 100644 index 0000000..f5e6edd --- /dev/null +++ b/src/map - 副本/miniprogram/utils/location.js @@ -0,0 +1,40 @@ +// Page({ +// data:{ +// location:[{ +// id:0, +// name:"中国民航大学南一教学楼", +// longitude: 116.481028, +// latitude: 39.989643, +// },{ +// id:1, +// name:"中国民航大学南二教学楼", +// longitude: 116.481028, +// latitude: 39.989643, +// },{ +// id:3, +// name:"中国民航大学南三教学楼", +// longitude: 116.481028, +// latitude: 39.989643, +// } +// ] +// } +// }) + +module.exports.location = [ + { + id:0, + name:"中国民航大学南一教学楼", + longitude: 116.481028, + latitude: 39.989643, + },{ + id:1, + name:"中国民航大学南二教学楼", + longitude: 116.481028, + latitude: 39.989643, + },{ + id:3, + name:"中国民航大学南三教学楼", + longitude: 116.481028, + latitude: 39.989643, + } +] \ No newline at end of file diff --git a/src/map - 副本/miniprogram/utils/qqmap-wx-jssdk.js b/src/map - 副本/miniprogram/utils/qqmap-wx-jssdk.js new file mode 100644 index 0000000..b114e29 --- /dev/null +++ b/src/map - 副本/miniprogram/utils/qqmap-wx-jssdk.js @@ -0,0 +1,741 @@ +/** + * 微信小程序JavaScriptSDK + * + * @version 1.1 + * @date 2019-01-20 + */ + +var ERROR_CONF = { + KEY_ERR: 311, + KEY_ERR_MSG: 'key格式错误', + PARAM_ERR: 310, + PARAM_ERR_MSG: '请求参数信息有误', + SYSTEM_ERR: 600, + SYSTEM_ERR_MSG: '系统错误', + WX_ERR_CODE: 1000, + WX_OK_CODE: 200 +}; +var BASE_URL = 'https://apis.map.qq.com/ws/'; +var URL_SEARCH = BASE_URL + 'place/v1/search'; +var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; +var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; +var URL_CITY_LIST = BASE_URL + 'district/v1/list'; +var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; +var URL_DISTANCE = BASE_URL + 'distance/v1/'; +var EARTH_RADIUS = 6378136.49; +var Utils = { + /** + * 得到终点query字符串 + * @param {Array|String} 检索数据 + */ + location2query(data) { + if (typeof data == 'string') { + return data; + } + var query = ''; + for (var i = 0; i < data.length; i++) { + var d = data[i]; + if (!!query) { + query += ';'; + } + if (d.location) { + query = query + d.location.lat + ',' + d.location.lng; + } + if (d.latitude && d.longitude) { + query = query + d.latitude + ',' + d.longitude; + } + } + return query; + }, + + /** + * 计算角度 + */ + rad(d) { + return d * Math.PI / 180.0; + }, + /** + * 处理终点location数组 + * @return 返回终点数组 + */ + getEndLocation(location){ + var to = location.split(';'); + var endLocation = []; + for (var i = 0; i < to.length; i++) { + endLocation.push({ + lat: parseFloat(to[i].split(',')[0]), + lng: parseFloat(to[i].split(',')[1]) + }) + } + return endLocation; + }, + + /** + * 计算两点间直线距离 + * @param a 表示纬度差 + * @param b 表示经度差 + * @return 返回的是距离,单位m + */ + getDistance(latFrom, lngFrom, latTo, lngTo) { + var radLatFrom = this.rad(latFrom); + var radLatTo = this.rad(latTo); + var a = radLatFrom - radLatTo; + var b = this.rad(lngFrom) - this.rad(lngTo); + var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2))); + distance = distance * EARTH_RADIUS; + distance = Math.round(distance * 10000) / 10000; + return parseFloat(distance.toFixed(0)); + }, + /** + * 使用微信接口进行定位 + */ + getWXLocation(success, fail, complete) { + wx.getLocation({ + type: 'gcj02', + success: success, + fail: fail, + complete: complete + }); + }, + + /** + * 获取location参数 + */ + getLocationParam(location) { + if (typeof location == 'string') { + var locationArr = location.split(','); + if (locationArr.length === 2) { + location = { + latitude: location.split(',')[0], + longitude: location.split(',')[1] + }; + } else { + location = {}; + } + } + return location; + }, + + /** + * 回调函数默认处理 + */ + polyfillParam(param) { + param.success = param.success || function () { }; + param.fail = param.fail || function () { }; + param.complete = param.complete || function () { }; + }, + + /** + * 验证param对应的key值是否为空 + * + * @param {Object} param 接口参数 + * @param {String} key 对应参数的key + */ + checkParamKeyEmpty(param, key) { + if (!param[key]) { + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误'); + param.fail(errconf); + param.complete(errconf); + return true; + } + return false; + }, + + /** + * 验证参数中是否存在检索词keyword + * + * @param {Object} param 接口参数 + */ + checkKeyword(param){ + return !this.checkParamKeyEmpty(param, 'keyword'); + }, + + /** + * 验证location值 + * + * @param {Object} param 接口参数 + */ + checkLocation(param) { + var location = this.getLocationParam(param.location); + if (!location || !location.latitude || !location.longitude) { + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误'); + param.fail(errconf); + param.complete(errconf); + return false; + } + return true; + }, + + /** + * 构造错误数据结构 + * @param {Number} errCode 错误码 + * @param {Number} errMsg 错误描述 + */ + buildErrorConfig(errCode, errMsg) { + return { + status: errCode, + message: errMsg + }; + }, + + /** + * + * 数据处理函数 + * 根据传入参数不同处理不同数据 + * @param {String} feature 功能名称 + * search 地点搜索 + * suggest关键词提示 + * reverseGeocoder逆地址解析 + * geocoder地址解析 + * getCityList获取城市列表:父集 + * getDistrictByCityId获取区县列表:子集 + * calculateDistance距离计算 + * @param {Object} param 接口参数 + * @param {Object} data 数据 + */ + handleData(param,data,feature){ + if (feature === 'search') { + var searchResult = data.data; + var searchSimplify = []; + for (var i = 0; i < searchResult.length; i++) { + searchSimplify.push({ + id: searchResult[i].id || null, + title: searchResult[i].title || null, + latitude: searchResult[i].location && searchResult[i].location.lat || null, + longitude: searchResult[i].location && searchResult[i].location.lng || null, + address: searchResult[i].address || null, + category: searchResult[i].category || null, + tel: searchResult[i].tel || null, + adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null, + city: searchResult[i].ad_info && searchResult[i].ad_info.city || null, + district: searchResult[i].ad_info && searchResult[i].ad_info.district || null, + province: searchResult[i].ad_info && searchResult[i].ad_info.province || null + }) + } + param.success(data, { + searchResult: searchResult, + searchSimplify: searchSimplify + }) + } else if (feature === 'suggest') { + var suggestResult = data.data; + var suggestSimplify = []; + for (var i = 0; i < suggestResult.length; i++) { + suggestSimplify.push({ + adcode: suggestResult[i].adcode || null, + address: suggestResult[i].address || null, + category: suggestResult[i].category || null, + city: suggestResult[i].city || null, + district: suggestResult[i].district || null, + id: suggestResult[i].id || null, + latitude: suggestResult[i].location && suggestResult[i].location.lat || null, + longitude: suggestResult[i].location && suggestResult[i].location.lng || null, + province: suggestResult[i].province || null, + title: suggestResult[i].title || null, + type: suggestResult[i].type || null + }) + } + param.success(data, { + suggestResult: suggestResult, + suggestSimplify: suggestSimplify + }) + } else if (feature === 'reverseGeocoder') { + var reverseGeocoderResult = data.result; + var reverseGeocoderSimplify = { + address: reverseGeocoderResult.address || null, + latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null, + longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null, + adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null, + city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null, + district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null, + nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null, + province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null, + street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null, + street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null, + recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null, + rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null + }; + if (reverseGeocoderResult.pois) {//判断是否返回周边poi + var pois = reverseGeocoderResult.pois; + var poisSimplify = []; + for (var i = 0;i < pois.length;i++) { + poisSimplify.push({ + id: pois[i].id || null, + title: pois[i].title || null, + latitude: pois[i].location && pois[i].location.lat || null, + longitude: pois[i].location && pois[i].location.lng || null, + address: pois[i].address || null, + category: pois[i].category || null, + adcode: pois[i].ad_info && pois[i].ad_info.adcode || null, + city: pois[i].ad_info && pois[i].ad_info.city || null, + district: pois[i].ad_info && pois[i].ad_info.district || null, + province: pois[i].ad_info && pois[i].ad_info.province || null + }) + } + param.success(data,{ + reverseGeocoderResult: reverseGeocoderResult, + reverseGeocoderSimplify: reverseGeocoderSimplify, + pois: pois, + poisSimplify: poisSimplify + }) + } else { + param.success(data, { + reverseGeocoderResult: reverseGeocoderResult, + reverseGeocoderSimplify: reverseGeocoderSimplify + }) + } + } else if (feature === 'geocoder') { + var geocoderResult = data.result; + var geocoderSimplify = { + title: geocoderResult.title || null, + latitude: geocoderResult.location && geocoderResult.location.lat || null, + longitude: geocoderResult.location && geocoderResult.location.lng || null, + adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null, + province: geocoderResult.address_components && geocoderResult.address_components.province || null, + city: geocoderResult.address_components && geocoderResult.address_components.city || null, + district: geocoderResult.address_components && geocoderResult.address_components.district || null, + street: geocoderResult.address_components && geocoderResult.address_components.street || null, + street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null, + level: geocoderResult.level || null + }; + param.success(data,{ + geocoderResult: geocoderResult, + geocoderSimplify: geocoderSimplify + }); + } else if (feature === 'getCityList') { + var provinceResult = data.result[0]; + var cityResult = data.result[1]; + var districtResult = data.result[2]; + param.success(data,{ + provinceResult: provinceResult, + cityResult: cityResult, + districtResult: districtResult + }); + } else if (feature === 'getDistrictByCityId') { + var districtByCity = data.result[0]; + param.success(data, districtByCity); + } else if (feature === 'calculateDistance') { + var calculateDistanceResult = data.result.elements; + var distance = []; + for (var i = 0; i < calculateDistanceResult.length; i++){ + distance.push(calculateDistanceResult[i].distance); + } + param.success(data, { + calculateDistanceResult: calculateDistanceResult, + distance: distance + }); + } else { + param.success(data); + } + }, + + /** + * 构造微信请求参数,公共属性处理 + * + * @param {Object} param 接口参数 + * @param {Object} param 配置项 + * @param {String} feature 方法名 + */ + buildWxRequestConfig(param, options, feature) { + var that = this; + options.header = { "content-type": "application/json" }; + options.method = 'GET'; + options.success = function (res) { + var data = res.data; + if (data.status === 0) { + that.handleData(param, data, feature); + } else { + param.fail(data); + } + }; + options.fail = function (res) { + res.statusCode = ERROR_CONF.WX_ERR_CODE; + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + }; + options.complete = function (res) { + var statusCode = +res.statusCode; + switch(statusCode) { + case ERROR_CONF.WX_ERR_CODE: { + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + break; + } + case ERROR_CONF.WX_OK_CODE: { + var data = res.data; + if (data.status === 0) { + param.complete(data); + } else { + param.complete(that.buildErrorConfig(data.status, data.message)); + } + break; + } + default:{ + param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)); + } + + } + }; + return options; + }, + + /** + * 处理用户参数是否传入坐标进行不同的处理 + */ + locationProcess(param, locationsuccess, locationfail, locationcomplete) { + var that = this; + locationfail = locationfail || function (res) { + res.statusCode = ERROR_CONF.WX_ERR_CODE; + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + }; + locationcomplete = locationcomplete || function (res) { + if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + } + }; + if (!param.location) { + that.getWXLocation(locationsuccess, locationfail, locationcomplete); + } else if (that.checkLocation(param)) { + var location = Utils.getLocationParam(param.location); + locationsuccess(location); + } + } +}; + + +class QQMapWX { + + /** + * 构造函数 + * + * @param {Object} options 接口参数,key 为必选参数 + */ + constructor(options) { + if (!options.key) { + throw Error('key值不能为空'); + } + this.key = options.key; + }; + + /** + * POI周边检索 + * + * @param {Object} options 接口参数对象 + * + * 参数对象结构可以参考 + * @see http://lbs.qq.com/webservice_v1/guide-search.html + */ + search(options) { + var that = this; + options = options || {}; + + Utils.polyfillParam(options); + + if (!Utils.checkKeyword(options)) { + return; + } + + var requestParam = { + keyword: options.keyword, + orderby: options.orderby || '_distance', + page_size: options.page_size || 10, + page_index: options.page_index || 1, + output: 'json', + key: that.key + }; + + if (options.address_format) { + requestParam.address_format = options.address_format; + } + + if (options.filter) { + requestParam.filter = options.filter; + } + + var distance = options.distance || "1000"; + var auto_extend = options.auto_extend || 1; + var region = null; + var rectangle = null; + + //判断城市限定参数 + if (options.region) { + region = options.region; + } + + //矩形限定坐标(暂时只支持字符串格式) + if (options.rectangle) { + rectangle = options.rectangle; + } + + var locationsuccess = function (result) { + if (region && !rectangle) { + //城市限定参数拼接 + requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")"; + } else if (rectangle && !region) { + //矩形搜索 + requestParam.boundary = "rectangle(" + rectangle + ")"; + } else { + requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")"; + } + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_SEARCH, + data: requestParam + }, 'search')); + }; + Utils.locationProcess(options, locationsuccess); + }; + + /** + * sug模糊检索 + * + * @param {Object} options 接口参数对象 + * + * 参数对象结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-suggestion.html + */ + getSuggestion(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (!Utils.checkKeyword(options)) { + return; + } + + var requestParam = { + keyword: options.keyword, + region: options.region || '全国', + region_fix: options.region_fix || 0, + policy: options.policy || 0, + page_size: options.page_size || 10,//控制显示条数 + page_index: options.page_index || 1,//控制页数 + get_subpois : options.get_subpois || 0,//返回子地点 + output: 'json', + key: that.key + }; + //长地址 + if (options.address_format) { + requestParam.address_format = options.address_format; + } + //过滤 + if (options.filter) { + requestParam.filter = options.filter; + } + //排序 + if (options.location) { + var locationsuccess = function (result) { + requestParam.location = result.latitude + ',' + result.longitude; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_SUGGESTION, + data: requestParam + }, "suggest")); + }; + Utils.locationProcess(options, locationsuccess); + } else { + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_SUGGESTION, + data: requestParam + }, "suggest")); + } + }; + + /** + * 逆地址解析 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-gcoder.html + */ + reverseGeocoder(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + var requestParam = { + coord_type: options.coord_type || 5, + get_poi: options.get_poi || 0, + output: 'json', + key: that.key + }; + if (options.poi_options) { + requestParam.poi_options = options.poi_options + } + + var locationsuccess = function (result) { + requestParam.location = result.latitude + ',' + result.longitude; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_GET_GEOCODER, + data: requestParam + }, 'reverseGeocoder')); + }; + Utils.locationProcess(options, locationsuccess); + }; + + /** + * 地址解析 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-geocoder.html + */ + geocoder(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'address')) { + return; + } + + var requestParam = { + address: options.address, + output: 'json', + key: that.key + }; + + //城市限定 + if (options.region) { + requestParam.region = options.region; + } + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_GET_GEOCODER, + data: requestParam + },'geocoder')); + }; + + + /** + * 获取城市列表 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-region.html + */ + getCityList(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + var requestParam = { + output: 'json', + key: that.key + }; + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_CITY_LIST, + data: requestParam + },'getCityList')); + }; + + /** + * 获取对应城市ID的区县列表 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-region.html + */ + getDistrictByCityId(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'id')) { + return; + } + + var requestParam = { + id: options.id || '', + output: 'json', + key: that.key + }; + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_AREA_LIST, + data: requestParam + },'getDistrictByCityId')); + }; + + /** + * 用于单起点到多终点的路线距离(非直线距离)计算: + * 支持两种距离计算方式:步行和驾车。 + * 起点到终点最大限制直线距离10公里。 + * + * 新增直线距离计算。 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-distance.html + */ + calculateDistance(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'to')) { + return; + } + + var requestParam = { + mode: options.mode || 'walking', + to: Utils.location2query(options.to), + output: 'json', + key: that.key + }; + + if (options.from) { + options.location = options.from; + } + + //计算直线距离 + if(requestParam.mode == 'straight'){ + var locationsuccess = function (result) { + var locationTo = Utils.getEndLocation(requestParam.to);//处理终点坐标 + var data = { + message:"query ok", + result:{ + elements:[] + }, + status:0 + }; + for (var i = 0; i < locationTo.length; i++) { + data.result.elements.push({//将坐标存入 + distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng), + duration:0, + from:{ + lat: result.latitude, + lng:result.longitude + }, + to:{ + lat: locationTo[i].lat, + lng: locationTo[i].lng + } + }); + } + var calculateResult = data.result.elements; + var distanceResult = []; + for (var i = 0; i < calculateResult.length; i++) { + distanceResult.push(calculateResult[i].distance); + } + return options.success(data,{ + calculateResult: calculateResult, + distanceResult: distanceResult + }); + }; + + Utils.locationProcess(options, locationsuccess); + } else { + var locationsuccess = function (result) { + requestParam.from = result.latitude + ',' + result.longitude; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_DISTANCE, + data: requestParam + },'calculateDistance')); + }; + + Utils.locationProcess(options, locationsuccess); + } + } +}; + +module.exports = QQMapWX; \ No newline at end of file diff --git a/src/map - 副本/miniprogram/utils/qqmap-wx-jssdk.min.js b/src/map - 副本/miniprogram/utils/qqmap-wx-jssdk.min.js new file mode 100644 index 0000000..b8fbad4 --- /dev/null +++ b/src/map - 副本/miniprogram/utils/qqmap-wx-jssdk.min.js @@ -0,0 +1,3 @@ +var ERROR_CONF={KEY_ERR:311,KEY_ERR_MSG:'key格式错误',PARAM_ERR:310,PARAM_ERR_MSG:'请求参数信息有误',SYSTEM_ERR:600,SYSTEM_ERR_MSG:'系统错误',WX_ERR_CODE:1000,WX_OK_CODE:200};var BASE_URL='https://apis.map.qq.com/ws/';var URL_SEARCH=BASE_URL+'place/v1/search';var URL_SUGGESTION=BASE_URL+'place/v1/suggestion';var URL_GET_GEOCODER=BASE_URL+'geocoder/v1/';var URL_CITY_LIST=BASE_URL+'district/v1/list';var URL_AREA_LIST=BASE_URL+'district/v1/getchildren';var URL_DISTANCE=BASE_URL+'distance/v1/';var EARTH_RADIUS=6378136.49;var Utils={location2query(data){if(typeof data=='string'){return data}var query='';for(var i=0;i