-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
104 changed files
with
5,833 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//app.js | ||
App({ | ||
onLaunch: function () { | ||
wx.cloud.init( | ||
{ | ||
env:"lwcsjzz-5ggmp946d4da554c" | ||
} | ||
) | ||
// 展示本地存储能力 | ||
var logs = wx.getStorageSync('logs') || [] | ||
logs.unshift(Date.now()) | ||
wx.setStorageSync('logs', logs) | ||
|
||
// 登录 | ||
wx.login({ | ||
success: res => { | ||
// 发送 res.code 到后台换取 openId, sessionKey, unionId | ||
} | ||
}) | ||
// 获取用户信息 | ||
wx.getSetting({ | ||
success: res => { | ||
if (res.authSetting['scope.userInfo']) { | ||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | ||
wx.getUserInfo({ | ||
success: res => { | ||
// 可以将 res 发送给后台解码出 unionId | ||
this.globalData.userInfo = res.userInfo | ||
|
||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | ||
// 所以此处加入 callback 以防止这种情况 | ||
if (this.userInfoReadyCallback) { | ||
this.userInfoReadyCallback(res) | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
}) | ||
}, | ||
globalData: { | ||
userInfo: null | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"pages":[ | ||
"pages/me/me", | ||
"pages/map/map", | ||
"pages/index/index", | ||
"pages/logs/logs", | ||
"pages/login/login", | ||
"pages/zhuce/zhuce", | ||
"pages/admin/admin", | ||
"pages/home/home", | ||
"pages/setting/setting", | ||
"pages/mima/mima" | ||
|
||
|
||
], | ||
|
||
"permission":{ | ||
"scope.userLocation":{ | ||
"desc": "你的位置信息将用于小程序位置接口的效果展示" | ||
} | ||
}, | ||
|
||
"window":{ | ||
"backgroundTextStyle":"light", | ||
"navigationBarBackgroundColor": "#fff", | ||
"navigationBarTitleText": "云大人脸门禁", | ||
"navigationBarTextStyle":"black" | ||
}, | ||
"tabBar": { | ||
"list": [ | ||
{ | ||
"pagePath": "pages/me/me", | ||
"text": "主页", | ||
"iconPath": "photo/home_.png", | ||
"selectedIconPath": "photo/home.png" | ||
}, | ||
{ | ||
"pagePath": "pages/map/map", | ||
"text": "地图", | ||
"iconPath": "photo/map_.png", | ||
"selectedIconPath": "photo/map.png" | ||
} | ||
], | ||
"color":"#0094ff" | ||
}, | ||
"style": "v2", | ||
"sitemapLocation": "sitemap.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/**app.wxss**/ | ||
@import 'style/weui.wxss'; | ||
.container { | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 200rpx 0; | ||
box-sizing: border-box; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const CDN_PATH = 'https://3gimg.qq.com/lightmap/xcx/demoCenter/images'; | ||
export const PLUGIN_KEY = 'your key'; | ||
export const MOYUAN_KEY = 'your key'; | ||
export const BAIQIAN_KEY = 'your key'; | ||
export const YULU_KEY = 'your key'; | ||
export const DIFUNI_KEY = 'your key'; | ||
export const INDOOR_KEY = 'your key'; | ||
export const REFERER = '腾讯位置服务示例中心小程序'; | ||
export const WEBSERVICE_APPID = 'wxc1c68623b7bdea7b'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// pages/admin/admin.js | ||
const app=getApp(); | ||
const db=wx.cloud.database(); | ||
const _=db.command; | ||
Page({ | ||
//获取学号 | ||
getName(event) { | ||
console.log('获取输入的学号', event.detail.value) | ||
this.setData({ | ||
xuehao: event.detail.value | ||
}) | ||
}, | ||
tijiao() { | ||
let xuehao = this.data.xuehao | ||
console.log("点击了提交") | ||
console.log("xuehao", xuehao) | ||
//校验学号 | ||
if (xuehao.length < 11) { | ||
wx.showToast({ | ||
icon: 'none', | ||
title: '学号只能11位', | ||
}) | ||
return | ||
} | ||
if (xuehao.length > 11) { | ||
wx.showToast({ | ||
icon: 'none', | ||
title: '学号只能11位', | ||
}) | ||
return | ||
} | ||
|
||
|
||
db.collection('user').where({ | ||
xuehao: xuehao | ||
}).get({ | ||
success(res) { | ||
console.log("获取数据成功", res) | ||
let user = res.data[0] | ||
console.log("user", user) | ||
db.collection('user').doc(user._id).update({ | ||
data:{ | ||
admin:1 | ||
} | ||
}) | ||
}, | ||
fail(res) { | ||
console.log("获取数据失败", res) | ||
} | ||
}) | ||
|
||
} | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"usingComponents": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
输入要赋予开门权限的学生学号 | ||
<input class="input" bindinput="getName"></input> | ||
<button type="primary" bindtap="tijiao">提交</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* pages/admin/admin.wxss */ | ||
.input{ | ||
border: 1px solid gainsboro; | ||
margin: 15rpx; | ||
} |
Oops, something went wrong.