需求合并beta #3

Closed
pha28yle4 wants to merge 11 commits from zgt_branch into mjx_develop

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

@ -0,0 +1,270 @@
// pages/course/course.js
/*Page({
/**
* 页面的初始数据
data: {
},
/**
* 生命周期函数--监听页面加载
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
onReady() {
},
/**
* 生命周期函数--监听页面显示
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
onHide() {
},
/**
* 生命周期函数--监听页面卸载
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
onReachBottom() {
},
/**
* 用户点击右上角分享
onShareAppMessage() {
}
})*/
// pages/index/index.js
Page({
data: {
mounth:"11", // 显示月份
// 头部数据 (数据也可以存储在数据库中读取出来,这样代码可以减少许多)
allOver:[{
id:0, // ID
week:"日", // 周
date:"23" // 日
},{
id:1,
week:"一",
date:"24"
},{
id:2,
week:"二",
date:"25"
},{
id:3,
week:"三",
date:"26"
},{
id:4,
week:"四",
date:"27"
},{
id:5,
week:"五",
date:"28"
},{
id:6,
week:"六",
date:"29"
}],
// 课程数据 (如果要从数据库取数据,需要进行排序)
courseInfo:[{
id:0,
week:"星期日",
// 代表当天拥有的课程
courseList:[
// 同理也需要排序可以根据position来进行定位
{
id:0,
position:1,
ifexist:false,
},{
id:1,
position:2,
ifexist:true, // 存在与否属性
courseName:"高等数学", // 课程名称
courseRoom:"A-201" // 课程教室
},{
id:2,
position:3,
ifexist:false,
},{
id:3,
position:4,
ifexist:false,
}]
},{
id:1,
week:"星期一",
courseList:[{
id:0,
position:1,
ifexist:true,
courseName:"线性代数",
courseRoom:"B-301",
},{
id:1,
position:2,
ifexist:true,
courseName:"计算机导论",
courseRoom:"N25-101"
},{
id:2,
position:3,
ifexist:false,
},{
id:3,
position:4,
ifexist:false,
}]
},{
id:2,
week:"星期二",
courseList:[{
id:0,
position:1,
ifexist:false
},{
id:1,
position:2,
ifexist:true,
courseName:"数据结构",
courseRoom:"S3-201"
},{
id:2,
position:3,
ifexist:false,
},{
id:3,
position:4,
ifexist:false,
}]
},{
id:3,
week:"星期三",
courseList:[{
id:0,
position:1,
ifexist:false,
},{
id:1,
position:2,
ifexist:false,
},{
id:2,
position:3,
ifexist:true,
courseName:"互联网开发",
courseRoom:"N18-214"
},{
id:3,
position:4,
ifexist:false,
}]
},{
id:4,
week:"星期四",
courseList:[{
id:0,
position:1,
ifexist:true,
courseName:"程序设计基础",
courseRoom:"N25-333"
},{
id:1,
position:2,
ifexist:false,
},{
id:2,
position:3,
ifexist:false,
},{
id:3,
position:4,
ifexist:false,
}]
},{
id:5,
week:"星期五",
courseList:[{
id:0,
position:1,
ifexist:true,
courseName:"接口技术",
courseRoom:"N25-331"
},{
id:1,
position:2,
ifexist:false,
},{
id:2,
position:3,
ifexist:false,
},{
id:3,
position:4,
ifexist:false,
}]
},{
id:6,
week:"星期六",
courseList:[{
id:0,
position:1,
ifexist:true,
courseName:"Java程序设计",
courseRoom:"S5-101"
},{
id:1,
position:2,
ifexist:false,
},{
id:2,
position:3,
ifexist:false,
},{
id:3,
position:4,
ifexist:false,
}]
}]
},
onLoad(options) {
},
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,64 @@
<!--pages/course/course.wxml-->
<text>pages/course/course.wxml</text>
<!--pages/index/index.wxml-->
<view class="farther_box">
<!-- 头部 -->
<view class="header_box">
<view class="header_item" style="font-weight: bold;font-size: 29rpx;margin-top: 10rpx;">
<view>10</view>
<view>月</view>
</view>
<block wx:for="{{allOver}}" wx:key="id">
<view class="header_item">
<view style="font-weight: bold;margin-bottom: 15rpx;">{{item.week}}</view>
<view style="color: #b2b2b2;">{{item.date}}</view>
</view>
</block>
</view>
<!-- 下划线 -->
<view style="width: 100%;height: 1rpx;background-color:#ccc ;margin: 8rpx 0;"></view>
<!-- 表体 -->
<view class="content_box">
<!-- 左 -->
<view class="content_left">
<view class="content_left_item" wx:for="{{8}}" wx:key="*this">
{{index+1}}
</view>
</view>
<!-- 右 -->
<view class="content_right">
<!-- 课表内容 -->
<view class="content_right_week_item" wx:for="{{courseInfo}}" wx:for-item="item1" wx:for-index="index1" wx:key="id">
<view class="content_right_course_item">
<view class="course_box" wx:for="{{4}}" wx:for-item="item2" wx:for-index="index2" wx:key="*this">
<!-- 根据每个课表的存在属性来判断是否显示 -->
<block wx:if="{{item1.courseList[index2].ifexist}}">
<view class="course_item">
<view style="font-size: small;text-align: center;padding: 5rpx;">
{{item1.courseList[index2].courseRoom}}
</view>
<view style="padding-top: 5rpx;">
{{item1.courseList[index2].courseName}}
</view>
</view>
</block>
</view>
</view>
</view>
<!-- 背景网格线 -->
<view style="position: absolute;width: 100%;height: 100%;z-index: 1;" >
<view class="gildLines">
<view style="flex: 1;border-bottom: 1rpx dashed #ccc;"wx:for="{{8}}" wx:key="*this"></view>
</view>
</view>
</view>
</view>
</view>

@ -0,0 +1,77 @@
/* pages/course/course.wxss */
page{
width: 100%;
height: 100%;
}
.farther_box{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
/* 头部样式 */
.header_box{
width: 100%;
display: flex;
}
.header_item{
flex: 5;
text-align: center;
/*border: 1rpx solid black;*/
margin-left: 10rpx;
margin-right: 10rpx;
}
/* 表体样式 */
.content_box{
display: flex;
height: 100%;
}
/* 左边 */
.content_left{
flex: 1;
text-align: center;
display: flex;
padding-top: 50rpx;
flex-direction: column;
}
.content_left_item{
flex: 1;
}
/* 右边 */
.content_right{
flex: 8;
display: flex;
position: relative;
}
.content_right_week_item{
height: 100%;
flex: 1;
z-index: 99;
}
.content_right_course_item{
display: flex;
flex-direction: column;
height: 100%;
}
.course_box{
flex: 1;
margin:8rpx 2rpx;
}
.course_item{
width: 100%;
height: 100%;
background-color: #9afffa;
border-radius: 15rpx;
}
.block{
flex: 1;
}
.gildLines{
display: flex;
height: 100%;
flex-direction: column;
}

@ -0,0 +1,48 @@
// index.js
// 获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
canIUseGetUserProfile: false,
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
},
// 事件处理函数
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad() {
if (wx.getUserProfile) {
this.setData({
canIUseGetUserProfile: true
})
}
},
getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息开发者每次通过该接口获取用户个人信息均需用户确认开发者妥善保管用户快速填写的头像昵称避免重复弹窗
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(res)
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
},
getUserInfo(e) {
// 不推荐使用getUserInfo获取用户信息预计自2021年4月13日起getUserInfo将不再弹出弹窗并直接返回匿名的用户个人信息
console.log(e)
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,23 @@
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<block wx:if="{{canIUseOpenData}}">
<view class="userinfo-avatar" bindtap="bindViewTap">
<open-data type="userAvatarUrl"></open-data>
</view>
<open-data type="userNickName"></open-data>
</block>
<block wx:elif="{{!hasUserInfo}}">
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<button wx:elif="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<view wx:else> 请使用1.4.4及以上版本基础库 </view>
</block>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>

@ -0,0 +1,19 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
color: #aaa;
}
.userinfo-avatar {
overflow: hidden;
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.usermotto {
margin-top: 200px;
}

@ -0,0 +1,45 @@
// pages/login/index.js
Page({
/**
* 页面的初始数据
*/
data: {
stuId: '', //学号
password: '' //密码
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
login(){
const postData = {
stuId: this.data.stuId,
password: this.data.password
}
wx.request({
url: 'http://localhost:3000/login',
data:postData,
method: 'POST',
success(res){
console.log(res)
if (res.data.code == -1){
wx.showToast({
title: res.data.msg,
icon: 'none'
})
return
}
wx.setStorageSync('token',res.data.data.cookie)
wx.showToast({
title: '登录成功',
icon: 'success'
})
}
})
}
})

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBartitleText": "登录"
}

@ -0,0 +1,16 @@
<view class="container">
<view class="header">
<image src="/asset/imgs/登录界面1.jpg" mode="aspectFill"></image>
</view>
<view class="login">
<view class="form-item">
<image src="/asset/imgs/登录1.jpg" mode="aspectFill"></image>
<input type="text" model:value="{{stuId}}" placeholder="请输入学号" />
</view>
<view class="form-item">
<image src="/asset/imgs/登录2.jpg" mode="aspectFill"></image>
<input type="password" model:value="{{password}}" placeholder="请输入密码"/>
</view>
<button bindtap="login">登录</button>
</view>
</view>

@ -0,0 +1,53 @@
page{
background: rgba(250,250,250,1)
}
.login {
padding:30rpx;
margin-top:60rpx;
}
.form-item input {
}
.form-item image {
width: 32rpx;
height: 32rpx;
margin-right: 32rpx;
}
.login button{
width: 100%;
border-radius: 60rpx;
background: linear-gradient(
90deg,
rgba(193,239,245,0.9) 0%,
rgba(10,232,240,1) 1%,
rgba(136,242,223,1) 100%
);
box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(0,0,0,0.1);
color: #fff;
margin-top: 100rpx;
}
.header {
display: flex;
justify-content: center;
margin-top: 106rpx;
}
.header image {
width: 600rpx;
height: 300rpx;
}
.form-item {
height: 98rpx;
border-radius: 60rpx;
background: rgba(255,255,255,1);
border: 1rpx solid rgba(232,232,232,0.86);
box-shadow: 0rpx 0rpx 2rpx -4rpx rgba(0,0,0,0.1);
display: flex;
align-items: center;
padding: 0 30rpx;
margin-bottom: 40rpx;
}

@ -0,0 +1,18 @@
// 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
}
})
})
}
})

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}

@ -0,0 +1,6 @@
<!--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>

@ -0,0 +1,8 @@
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}

@ -0,0 +1,19 @@
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
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Loading…
Cancel
Save