@ -1,19 +0,0 @@
|
||||
// app.js
|
||||
App({
|
||||
onLaunch() {
|
||||
// 展示本地存储能力
|
||||
const logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
|
||||
// 登录
|
||||
wx.login({
|
||||
success: res => {
|
||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||
}
|
||||
})
|
||||
},
|
||||
globalData: {
|
||||
userInfo: null
|
||||
}
|
||||
})
|
@ -1,19 +0,0 @@
|
||||
{
|
||||
"pages":[
|
||||
"pages/index/index",
|
||||
"pages/logs/logs"
|
||||
],
|
||||
"window":{
|
||||
"backgroundTextStyle":"light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "Weixin",
|
||||
"navigationBarTextStyle":"black"
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"permission": {
|
||||
"scope.userLocation":{
|
||||
"desc": "点击确认"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 200rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<view class="flex-style">
|
||||
<view class="flex-item active" bindtouchstart="goToCar">驾车</view>
|
||||
<view class="flex-item" bindtouchstart="goToWalk">步行</view>
|
||||
<view class="flex-item" bindtouchstart="goToBus">公交</view>
|
||||
<view class="flex-item" bindtouchstart="goToRide">骑行</view>
|
||||
</view>
|
||||
<view class="map_box">
|
||||
<map id="navi_map" longitude="116.451028" latitude="39.949643" scale="12" markers="{{markers}}" polyline="{{polyline}}"></map>
|
||||
</view>
|
||||
|
||||
<view class="text_box">
|
||||
<view class="text">{{distance}}</view>
|
||||
<view class="text">{{cost}}</view>
|
||||
<view class="detail_button" bindtouchstart="goDetail">详情</view>
|
||||
</view>
|
@ -1,48 +0,0 @@
|
||||
.flex-style{
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
}
|
||||
.flex-item{
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
text-align: center;
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1;
|
||||
flex: 1
|
||||
}
|
||||
.flex-item.active{
|
||||
color:#0091ff;
|
||||
}
|
||||
.map_box{
|
||||
position:absolute;
|
||||
top: 35px;
|
||||
bottom: 90px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
}
|
||||
#navi_map{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.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;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
// logs.js
|
||||
const util = require('../../utils/util.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
logs: []
|
||||
},
|
||||
onLoad() {
|
||||
this.setData({
|
||||
logs: (wx.getStorageSync('logs') || []).map(log => {
|
||||
return {
|
||||
date: util.formatTime(new Date(log)),
|
||||
timeStamp: log
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "查看启动日志",
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<!--logs.wxml-->
|
||||
<view class="container log-list">
|
||||
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
|
||||
<text class="log-item">{{index + 1}}. {{log.date}}</text>
|
||||
</block>
|
||||
</view>
|
@ -1,19 +0,0 @@
|
||||
const formatTime = date => {
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
|
||||
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
|
||||
}
|
||||
|
||||
const formatNumber = n => {
|
||||
n = n.toString()
|
||||
return n[1] ? n : `0${n}`
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# Build and Release Folders
|
||||
bin/
|
||||
bin-debug/
|
||||
bin-release/
|
||||
[Oo]bj/ # FlashDevelop obj
|
||||
[Bb]in/ # FlashDevelop bin
|
||||
|
||||
# Other files and folders
|
||||
.settings/
|
||||
|
||||
# Executables
|
||||
*.swf
|
||||
*.air
|
||||
*.ipa
|
||||
*.apk
|
||||
|
||||
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
|
||||
# should NOT be excluded as they contain compiler settings and other important
|
||||
# information for Eclipse / Flash Builder.
|
@ -1,30 +0,0 @@
|
||||
//app.js
|
||||
App({
|
||||
onLaunch: function () {
|
||||
//调用API从本地缓存中获取数据
|
||||
var logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
},
|
||||
getUserInfo:function(cb){
|
||||
var that = this;
|
||||
if(this.globalData.userInfo){
|
||||
typeof cb == "function" && cb(this.globalData.userInfo)
|
||||
}else{
|
||||
//调用登录接口
|
||||
wx.login({
|
||||
success: function () {
|
||||
wx.getUserInfo({
|
||||
success: function (res) {
|
||||
that.globalData.userInfo = res.userInfo;
|
||||
typeof cb == "function" && cb(that.globalData.userInfo)
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
globalData:{
|
||||
userInfo:null
|
||||
}
|
||||
})
|
@ -1,42 +0,0 @@
|
||||
{
|
||||
"pages":[
|
||||
"pages/login/login",
|
||||
"pages/location/location",
|
||||
"pages/Find directions/Find directions",
|
||||
"pages/text/text",
|
||||
"pages/ModifyMap/ModifyMap",
|
||||
"pages/ModifyInformation/ModifyInformation",
|
||||
"pages/ManageAccount/ManageAccount"
|
||||
],
|
||||
"window":{
|
||||
"backgroundTextStyle":"light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "login",
|
||||
"navigationBarTextStyle":"black"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#dddddd",
|
||||
"selectedColor": "#3cc51f",
|
||||
"borderStyle": "black",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [{
|
||||
"pagePath": "pages/location/location",
|
||||
"iconPath": "image/wechat.png",
|
||||
"selectedIconPath": "image/locate.png",
|
||||
"text": "导航"
|
||||
},{
|
||||
"pagePath": "pages/Find directions/Find directions",
|
||||
"iconPath": "image/map.png",
|
||||
"selectedIconPath": "image/map_active.png",
|
||||
"text": "查询路线"
|
||||
},{
|
||||
"pagePath": "pages/text/text",
|
||||
"iconPath": "image/locate.png",
|
||||
"selectedIconPath": "image/locateHL.png",
|
||||
"text": "信息栏"
|
||||
}
|
||||
]
|
||||
},
|
||||
"debug": true
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 200rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "wechat-weapp-mapdemo",
|
||||
"version": "1.0.0",
|
||||
"description": "微信小程序demo,地图",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/giscafer/wechat-weapp-mapdemo.git"
|
||||
},
|
||||
"keywords": [
|
||||
"微信小程序demo"
|
||||
],
|
||||
"author": "giscafer",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/giscafer/wechat-weapp-mapdemo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/giscafer/wechat-weapp-mapdemo#readme",
|
||||
"dependencies": {
|
||||
"mapbox-gl": "^0.24.0"
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
{
|
||||
"compileType": "miniprogram",
|
||||
"setting": {
|
||||
"coverView": true,
|
||||
"es6": false,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"enhance": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"packNpmRelationList": [],
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"ignoreUploadUnusedFiles": true
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
},
|
||||
"libVersion": "2.27.0",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"appid": "wx5e77d1bb9e24f179"
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
function formatTime(date) {
|
||||
var year = date.getFullYear()
|
||||
var month = date.getMonth() + 1
|
||||
var day = date.getDate()
|
||||
|
||||
var hour = date.getHours()
|
||||
var minute = date.getMinutes()
|
||||
var second = date.getSeconds();
|
||||
|
||||
|
||||
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
||||
}
|
||||
|
||||
function formatNumber(n) {
|
||||
n = n.toString()
|
||||
return n[1] ? n : '0' + n
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime: formatTime
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
# 云开发 quickstart
|
||||
|
||||
这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力:
|
||||
|
||||
- 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库
|
||||
- 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理
|
||||
- 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码
|
||||
|
||||
## 参考文档
|
||||
|
||||
- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)
|
||||
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"permissions": {
|
||||
"openapi": [
|
||||
]
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/login/login",
|
||||
"pages/location/location",
|
||||
"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"
|
||||
],
|
||||
"window": {
|
||||
"backgroundColor": "#F6F6F6",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#F6F6F6",
|
||||
"navigationBarTitleText": "管理用户",
|
||||
"navigationBarTextStyle": "black"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#dddddd",
|
||||
"selectedColor": "#3cc51f",
|
||||
"borderStyle": "black",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [{
|
||||
"pagePath": "pages/location/location",
|
||||
"iconPath": "image/wechat.png",
|
||||
"selectedIconPath": "image/locate.png",
|
||||
"text": "导航"
|
||||
},{
|
||||
"pagePath": "pages/Find directions/Find directions",
|
||||
"iconPath": "image/map.png",
|
||||
"selectedIconPath": "image/map_active.png",
|
||||
"text": "查询路线"
|
||||
},{
|
||||
"pagePath": "pages/text/text",
|
||||
"iconPath": "image/locate.png",
|
||||
"selectedIconPath": "image/locateHL.png",
|
||||
"text": "信息栏"
|
||||
}
|
||||
]
|
||||
},
|
||||
"debug": true,
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"style": "v2"
|
||||
}
|
@ -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;
|
||||
}
|
@ -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,
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"component": true
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<!--miniprogram/components/cloudTipModal/index.wxml-->
|
||||
<view class="install_tip" wx:if="{{showUploadTip}}">
|
||||
<view class="install_tip_back"></view>
|
||||
<view class="install_tip_detail">
|
||||
<view class="install_tip_detail_title">体验前需部署云资源</view>
|
||||
<view class="install_tip_detail_tip">请开启调试器进入终端窗口,复制并运行以下命令</view>
|
||||
<view class="install_tip_detail_shell">
|
||||
{{tipText}}
|
||||
<view bindtap="copyShell" class="install_tip_detail_copy">复制</view>
|
||||
</view>
|
||||
<view bindtap="onChangeShowUploadTip" class="install_tip_detail_button">已执行命令</view>
|
||||
</view>
|
||||
</view>
|
@ -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;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
const envList = [{"envId":"cloud1-7gnkwzfv6ba72e50","alias":"cloud1"}]
|
||||
const isMac = false
|
||||
module.exports = {
|
||||
envList,
|
||||
isMac
|
||||
}
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 173 KiB After Width: | Height: | Size: 173 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 906 B |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 328 KiB |
After Width: | Height: | Size: 181 KiB |
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 139 KiB |
@ -1,5 +1,5 @@
|
||||
<view class="ModifyMap">
|
||||
<button class="map" type="primary" bindtap="map" style="position: relative; left: -244rpx; top: 1081rpx; width: 263rpx; height: 108rpx; display: block; box-sizing: border-box">修改地图</button>
|
||||
<button class="information" type="primary" bindtap="information" style="width: 263rpx; height: 108rpx; display: block; box-sizing: border-box; left: 19rpx; top: 973rpx; position: relative">修改信息</button>
|
||||
<button class="account" type="primary" bindtap="account" style="width: 263rpx; height: 108rpx; display: block; box-sizing: border-box; left: 282rpx; top: 865rpx; position: relative">管理账户</button>
|
||||
<button class="map" type="primary" bindtap="map" style="position: relative; left: -272rpx; top: 1081rpx; width: 291rpx; height: 108rpx; display: block; box-sizing: border-box">修改地图</button>
|
||||
<button class="information" type="primary" bindtap="information" style="width: 291rpx; height: 108rpx; display: block; box-sizing: border-box; left: -10rpx; top: 973rpx; position: relative">修改信息</button>
|
||||
<button class="account" type="primary" bindtap="account" style="width: 291rpx; height: 108rpx; display: block; box-sizing: border-box; left: 282rpx; top: 865rpx; position: relative">管理账户</button>
|
||||
</view>
|
@ -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,
|
||||
})
|
||||
}
|
||||
})
|
@ -0,0 +1,35 @@
|
||||
<!--pages/addusers/index.wxml-->
|
||||
<view class="add">
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_ID}}"
|
||||
placeholder="请输入学号"
|
||||
bindblur="inputID"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_College}}"
|
||||
bindblur="inputCollege"
|
||||
placeholder="请输入用户院系"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_Class}}"
|
||||
bindblur="inputClass"
|
||||
placeholder="请输入用户班级"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_Grade}}"
|
||||
bindblur="inputGrade"
|
||||
placeholder="请输入用户年级"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_Key}}"
|
||||
bindblur="inputKey"
|
||||
placeholder="请输入用户密码"
|
||||
/>
|
||||
<button class="button" bindtap="add" type="primary">增加</button>
|
||||
</view>
|
||||
<button class="button" type="primary" bindtap="getback">返回</button>
|
@ -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%;
|
||||
}
|
@ -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,
|
||||
})
|
||||
}
|
||||
})
|
@ -0,0 +1,36 @@
|
||||
<!--pages/addusers/index.wxml-->
|
||||
<!--pages/addusers/index.wxml-->
|
||||
<view class="add">
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_ID}}"
|
||||
placeholder="请输入学号"
|
||||
bindblur="inputID"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_College}}"
|
||||
bindblur="inputCollege"
|
||||
placeholder="请输入用户院系"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_Class}}"
|
||||
bindblur="inputClass"
|
||||
placeholder="请输入用户班级"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_Grade}}"
|
||||
bindblur="inputGrade"
|
||||
placeholder="请输入用户年级"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value="{{User_Key}}"
|
||||
bindblur="inputKey"
|
||||
placeholder="请输入用户密码"
|
||||
/>
|
||||
<button class="button" bindtap="add" type="primary">增加</button>
|
||||
</view>
|
||||
<button class="button" type="primary" bindtap="getback">返回</button>
|
@ -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%;
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
// pages/adduserssuccess/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,2 @@
|
||||
<!--pages/adduserssuccess/index.wxml-->
|
||||
<text>pages/adduserssuccess/index.wxml</text>
|
@ -0,0 +1 @@
|
||||
/* pages/adduserssuccess/index.wxss */
|
@ -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: '../ModifyMap/ModifyMap',
|
||||
})
|
||||
//保存管理员登陆状态
|
||||
wx.setStorageSync('manager', manager)
|
||||
} else {
|
||||
console.log('登陆失败')
|
||||
wx.showToast({
|
||||
icon: 'none',
|
||||
title: '账号或密码不正确',
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
console.log("获取数据失败", res)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
输入管理员账号
|
||||
<input class="input" bindinput="getAccount"></input>
|
||||
输入管理员密码
|
||||
<input class="input" bindinput="getPassword"></input>
|
||||
<button bindtap="guanliyuanlogin" type="primary">登录</button>
|
@ -0,0 +1,5 @@
|
||||
/* pages/adlogin/adlogin.wxss */
|
||||
.input{
|
||||
border: 1px solid gainsboro;
|
||||
margin: 20rpx;
|
||||
}
|
@ -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',
|
||||
})
|
||||
},
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|