Skip to content

Commit

Permalink
3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Liu-Vince committed Nov 13, 2020
1 parent 05aae50 commit 07976dd
Show file tree
Hide file tree
Showing 104 changed files with 5,833 additions and 0 deletions.
44 changes: 44 additions & 0 deletions app.js
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
}
})
48 changes: 48 additions & 0 deletions app.json
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"
}
11 changes: 11 additions & 0 deletions app.wxss
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;
}
9 changes: 9 additions & 0 deletions config/appConfig.js
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';
54 changes: 54 additions & 0 deletions pages/admin/admin.js
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)
}
})

}

})
3 changes: 3 additions & 0 deletions pages/admin/admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
3 changes: 3 additions & 0 deletions pages/admin/admin.wxml
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>
5 changes: 5 additions & 0 deletions pages/admin/admin.wxss
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;
}
Loading

0 comments on commit 07976dd

Please sign in to comment.