@ -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: {},
|
||||
}
|
@ -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,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;
|
||||
}
|
@ -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,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,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,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,66 @@
|
||||
// pages/home/home.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,2 @@
|
||||
<!--pages/home/home.wxml-->
|
||||
<text>pages/home/home.wxml</text>
|
@ -0,0 +1 @@
|
||||
/* pages/home/home.wxss */
|
@ -0,0 +1,66 @@
|
||||
// pages/index/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,2 @@
|
||||
<!--pages/index/index.wxml-->
|
||||
<text>pages/index/index.wxml</text>
|
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
@ -0,0 +1,8 @@
|
||||
<!--index.wxml-->
|
||||
输入管理员用户名
|
||||
<input class="input" bindinput="getName"></input>
|
||||
输入管理员用户账号
|
||||
<input class="input" bindinput="getAccount"></input>
|
||||
输入管理员密码
|
||||
<input class="input" bindinput="getPassword"></input>
|
||||
<button bindtap="adzhuce" type="primary">管理员注册</button>
|
@ -0,0 +1,5 @@
|
||||
/**index.wxss**/
|
||||
.input{
|
||||
border: 1px solid gainsboro;
|
||||
margin: 15rpx;
|
||||
}
|
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<!--index.wxml-->
|
||||
输入用户名
|
||||
<input class="input" bindinput="getName"></input>
|
||||
输入用户账号
|
||||
<input class="input" bindinput="getZhangHao"></input>
|
||||
输入密码
|
||||
<input class="input" bindinput="getMiMa"></input>
|
||||
<button bindtap="zhuce" type="primary">注册</button>
|
@ -0,0 +1,5 @@
|
||||
/**index.wxss**/
|
||||
.input{
|
||||
border: 1px solid gainsboro;
|
||||
margin: 15rpx;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<!--<view class="page">
|
||||
<view class="page__bd">
|
||||
<view class="weui-toptips weui-toptips_warn" wx:if="{{showTopTips}}">错误提示</view>
|
||||
|
||||
<view class="weui-btn-area" bindtap="denglu" style="width: 750rpx; height: 190rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx">
|
||||
<button class="denglu" type="primary" style="width: 347rpx; height: 108rpx; display: block; box-sizing: border-box; left: -174rpx; top: 95rpx; position: relative">用户登陆</button>
|
||||
</view>
|
||||
<view class="weui-btn-area" bindtap="zhuce" style="width: 750rpx; height: 190rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx">
|
||||
<button class="zhuce" type="primary" style="width: 347rpx; height: 108rpx; display: block; box-sizing: border-box; left: -174rpx; top: 83rpx; position: relative">用户注册</button>
|
||||
</view>
|
||||
<view class="weui-btn-area" bindtap="guanliyuandenglu">
|
||||
<button class="weui-btn" type="primary" style="width: 331rpx; height: 108rpx; display: block; box-sizing: border-box; left: 210rpx; top: -108rpx; position: relative">管理员登陆</button>
|
||||
</view>
|
||||
<view class="weui-btn-area" bindtap="adzhuce" style="width: 750rpx; height: 190rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx">
|
||||
<button class="adzhuce" type="primary" style="width: 347rpx; height: 108rpx; display: block; box-sizing: border-box; left: -174rpx; top: -61rpx; position: relative">管理员注册</button>
|
||||
</view>
|
||||
<view class="weui-cells__title" style="position: relative; left: 0rpx; top: -79rpx">注册,忘记密码请联系qq:xx</view>
|
||||
</view>
|
||||
</view>-->
|
||||
<view class="login">
|
||||
<button class="denglu" type="primary" bindtap="denglu">登录</button>
|
||||
<button class="zhuce" type="primary" bindtap="zhuce">注册</button>
|
||||
<button class="guanliyuandenglu" type="primary" bindtap="guanliyuandenglu">管理员登录</button>
|
||||
<button class="adzhuce" type="primary" bindtap="adzhuce">管理员注册</button>
|
||||
</view>
|
@ -0,0 +1,18 @@
|
||||
/**index.wxss**/
|
||||
|
||||
.denglu{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.guanliyuandenglu{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.zhuce{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.adzhuce{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.login-ok{
|
||||
text-align: center;
|
||||
font-size: large;
|
||||
}
|
@ -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: '../Find directions/Find directions',
|
||||
})
|
||||
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)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<!--pages/login/login.wxml-->
|
||||
输入账号
|
||||
<input class="input" bindinput="getZhanghao"></input>
|
||||
输入密码
|
||||
<input class="input" bindinput="getMima"></input>
|
||||
<button bindtap="login" type="primary">登录</button>
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
/* pages/login/login.wxss */
|
||||
.input{
|
||||
border: 1px solid gainsboro;
|
||||
margin: 20rpx;
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
// pages/me/me.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|