commit again

main
lxy 1 month ago
parent 6758604fe2
commit 29edc38db9

@ -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: {},
}

@ -0,0 +1,45 @@
// 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: {
students: [
{ name: '张三', avatar: '/assets/img/Fairy/fairy (1).png', score:19, id:1000, index:1 },
{ name: '李四', avatar: '/assets/img/Fairy/fairy (2).png', score:17, id:1001, index:2 },
{ name: '王五', avatar: '/assets/img/Fairy/fairy (3).png', score:14, id:1002, index:3 },
{ name: '赵六', avatar: '/assets/img/Fairy/fairy (4).png', score:12, id:1003, index:4 },
{ name: '周无', avatar: '/assets/img/Fairy/fairy (5).png', score:12, id:1004, index:5 },
{ name: '程七', avatar: '/assets/img/Fairy/fairy (6).png', score:9, id:1005, index:6 },
{ name: '刘大大', avatar: '/assets/img/Fairy/fairy (7).png', score:9, id:1006, index:7 },
{ name: '王乐康', avatar: '/assets/img/Fairy/fairy (8).png', score:8, id:1007, index:8 },
{ name: '段问蕾', avatar: '/assets/img/Fairy/fairy (9).png', score:7, id:1008, index:9 },
{ name: '贾伦', avatar: '/assets/img/Fairy/fairy (10).png', score:4, id:1009, index:10 },
{ name: '李书易', avatar: '/assets/img/Fairy/fairy (11).png', score:3, id:1010, index:11 },
{ name: '胡心', avatar: '/assets/img/Fairy/fairy (12).png', score:1, id:1011, index:12 },
{ name: '李天泽', avatar: '/assets/img/Fairy/fairy (13).png', score:-1, id:1012, index:13 },
{ name: '列亿枫', avatar: '/assets/img/Fairy/fairy (14).png', score:0, id:1013, index:14 },
{ name: '周乐心', avatar: '/assets/img/Fairy/fairy (15).png', score:-2, id:1014, index:15 },
{ name: '胡小小', avatar: '/assets/img/Fairy/fairy (16).png', score:2, id:1015, index:16 },
{ name: '王滢', avatar: '/assets/img/Fairy/fairy (17).png', score:1, id:1016, index:17 },
{ name: "傅彭", avatar: '/assets/img/Fairy/fairy (18).png', score:21, id:1017, index:18 },
{ name: "丁璧容", avatar: '/assets/img/Fairy/fairy (19).png', score:3, id:1018, index:19 },
{ name: "赵丽", avatar: '/assets/img/Fairy/fairy (20).png', score:25, id:1019, index:20 },
{ name: "李恺", avatar: '/assets/img/Fairy/fairy (21).png', score:9, id:1020, index:21 },
{ name: "王笑天", avatar: '/assets/img/Fairy/fairy (22).png', score:8, id:1021, index:22 },
{ name: "庞蕊", avatar: '/assets/img/Fairy/fairy (23).png', score:0, id:1022, index:23 },
{ name: "李四", avatar: '/assets/img/Fairy/fairy (24).png', score:0, id:1023, index:24 },
{ name: "吴无五", avatar: '/assets/img/Fairy/fairy (25).png', score:0, id:1024, index:25 }
]
}
})

@ -0,0 +1,49 @@
{
"entryPagePath": "pages/lodding/lodding",
"pages": [
"pages/lodding/lodding",
"pages/AddClass/AddClass",
"pages/RollClass/RollClass",
"pages/setting/setting",
"pages/studentList/studentList",
"pages/studentRanking/studentRanking",
"pages/startNaming/startNaming"
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "学生点名系统",
"navigationBarBackgroundColor": "#ffffff"
},
"tabBar": {
"color": "#000000",
"selectedColor": "#0F40F5",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/AddClass/AddClass",
"text": "班级",
"iconPath": "/assets/img/nav/nav1-1.png",
"selectedIconPath": "/assets/img/nav/nav1-2.png"
},
{
"pagePath": "pages/RollClass/RollClass",
"text": "课堂",
"iconPath": "/assets/img/nav/nav2-1.png",
"selectedIconPath": "/assets/img/nav/nav2-2.png"
},
{
"pagePath": "pages/setting/setting",
"text": "设置",
"iconPath": "/assets/img/nav/nav3-1.png",
"selectedIconPath": "/assets/img/nav/nav3-2.png"
}
]
},
"style": "v2",
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}

@ -0,0 +1,10 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,136 @@
Page({
onCardTap: function() {
wx.switchTab({
url: '/pages/RollClass/RollClass',
})
},
data: {
cards: [], // 班级数据数组,存储当前已有的班级
modalVisible1: false, // 控制浮窗1的显隐状态
modalVisible2: false, // 控制浮窗2的显隐状态
modalVisible3: false, // 控制浮窗3的显隐状态
modalVisible4: false, // 控制浮窗4的显隐状态
className: '', // 存储输入的班级名称(浮窗1)
fileName: '' // 存储选择的文件名(浮窗2)
},
// 点击加号按钮后触发,显示浮窗
onAddCard() {
this.setData({
modalVisible1: true // 设置浮窗可见
});
},
// 处理输入框的输入事件,更新班级名称
onInput(e) {
this.setData({
className: e.detail.value // 更新输入的班级名称为用户输入
});
},
// 浮窗1确认按钮的点击事件处理
onConfirm1() {
this.setData({
modalVisible1: false, // 隐藏浮窗
modalVisible2: true //显示浮窗2
});
},
// 浮窗1取消按钮的点击事件处理
onCancel1() {
this.setData({
modalVisible1: false, // 隐藏浮窗
className: null // 重置输入框内容
});
},
// 浮窗2选择文件的处理函数
onSelectFile() {
wx.chooseMessageFile({
count: 1,
type: 'file',
success: (res) => {
const filePath = res.tempFiles[0].path; // 依然使用相对路径
this.setData({
fileName: filePath.split('/').pop() // 取文件名部分
});
console.log("选中的文件路径:", filePath); // 可以在这里使用相对路径进行后续处理
},
fail: (err) => {
console.error("选择文件失败:", err);
}
});
},
// 浮窗2确认按钮的点击事件处理
onConfirm2() {
// 处理确认逻辑
console.log('确认导入文件:', this.data.fileName);
this.setData({
modalVisible2: false, // 隐藏浮窗
fileName:null,
modalVisible3: true //显示浮窗3
});
},
// 浮窗2取消按钮的点击事件处理
onCancel2() {
this.setData({
modalVisible2: false, // 隐藏浮窗
className:null,
fileName: null // 清空选择的文件
});
},
// 浮窗3确认按钮的点击事件处理
onConfirm3() {
const { className, cards } = this.data;
// 检查班级名是否已存在
const classExists = cards.some(card => card.name === className);
if (classExists) {
// 如果班级名已经存在,弹出错误提示或进行其他处理
this.setData({
modalVisible3:false,
modalVisible4:true,
className:null,
fileName: null
});
return; // 结束函数执行
}
// 创建新班级对象
const newCard = {
name: className || '新课程', // 使用用户输入的班级名,如果为空则默认
studentCount: 30,
creationDate: new Date().toLocaleDateString() // 当前日期
};
// 更新数据状态
this.setData({
cards: [...cards, newCard], // 将新卡片加入数组
modalVisible3: false, // 隐藏浮窗
className:null,
fileName: null
});
},
// 浮窗3取消按钮的点击事件处理
onCancel3(){
this.setData({
modalVisible3:false,
className:null,
fileName: null
});
},
onCancel4(){
this.setData({
modalVisible4:false,
className:null,
fileName: null
});
}
});

@ -0,0 +1,7 @@
{
"navigationBarTitleText": "班级列表",
"navigationBarBackgroundColor": "#F5F8F9",
"backgroundColor": "#eeeeee",
"navigationBarTextStyle": "black",
"usingComponents": {}
}

@ -0,0 +1,110 @@
<view class="container">
<!-- 并绑定一个函数 -->
<view class="class-card" bindtap="onCardTap">
<image class="class-image" src="/assets/img/AddClass/img1_1.jpg" mode="aspectFill"/>
<view class="class-info">
<text class="class-name">人工智能</text>
<view class="class-details">
<text>班级人数100</text>
<text>创建日期2024/10/1</text>
</view>
</view>
<image class="arrow" src="/assets/img/AddClass/icon1_2.png" />
</view>
<view class="class-card" bindtap="onCardTap">
<image class="class-image" src="/assets/img/AddClass/img1_2.jpg" mode="aspectFill"/>
<view class="class-info">
<text class="class-name">Linux实践</text>
<view class="class-details">
<text>班级人数100</text>
<text>创建日期2024/10/1</text>
</view>
</view>
<image class="arrow" src="/assets/img/AddClass/icon1_2.png" />
</view>
<view class="class-card" bindtap="onCardTap">
<image class="class-image" src="/assets/img/AddClass/img1_3.jpg" mode="aspectFill"/>
<view class="class-info">
<text class="class-name">操作系统</text>
<view class="class-details">
<text>班级人数100</text>
<text>创建日期2024/10/1</text>
</view>
</view>
<image class="arrow" src="/assets/img/AddClass/icon1_2.png" />
</view>
<!-- 班级卡片列表 -->
<block wx:for="{{cards}}" wx:key="index" bindtap="addScore">
<view class="class-card" bindtap="onCardTap">
<image class="class-image" src="/assets/img/AddClass/img1_4.jpg" mode="aspectFill" />
<view class="class-info">
<text class="class-name">{{item.name}}</text>
<view class="class-details">
<text>班级人数:{{item.studentCount}}</text>
<text>创建日期:{{item.creationDate}}</text>
</view>
</view>
<image class="arrow" src="/assets/img/AddClass/icon1_2.png" />
</view>
</block>
<!-- 加号按钮,点击后显示浮窗 -->
<button class="add-button" bindtap="onAddCard" style="width: 100rpx">
<image class="add-image" src="/assets/img/AddClass/icon1_1.png" mode="aspectFit" />
</button>
<!-- 浮窗1 -->
<view class="modal" hidden="{{!modalVisible1}}">
<view class="modal-content">
<text class="modal-title">请输入班级名称:</text>
<input class="input-box" placeholder="班级名称" bindinput="onInput" value="{{className}}" />
<view class="modal-buttons">
<button class="confirm-button" bindtap="onConfirm1">确认</button>
<button class="cancel-button" bindtap="onCancel1">取消</button>
</view>
</view>
</view>
<!-- 浮窗2 -->
<view class="modal" hidden="{{!modalVisible2}}">
<view class="modal-content">
<text class="modal-title">导入 Excel 表:</text>
<!-- 文件选择部分 -->
<view class="file-selection">
<view>
<button class="select-file-button" bindtap="onSelectFile" style="width: 154rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx">选择文件</button>
</view>
<view>
<text class="file-name" style="position: relative; left: 22rpx; top: 0rpx">{{fileName || '未选择任何文件'}}</text>
</view>
</view>
<view class="divider"></view>
<view class="modal-buttons">
<button class="confirm-button" bindtap="onConfirm2">确认</button>
<button class="cancel-button" bindtap="onCancel2">取消</button>
</view>
</view>
</view>
<!-- 浮窗3 -->
<view class="modal" hidden="{{!modalVisible3}}">
<view class="modal-content" style="padding:20rpx">
<view class="modal-buttons">
<button class="confirm-button" bindtap="onConfirm3">确认</button>
<button class="cancel-button" bindtap="onCancel3">取消</button>
</view>
</view>
</view>
<!-- 浮窗4 -->
<view class="modal" hidden="{{!modalVisible4}}" bindtap="onCancel4">
<view class="modal-content">
<text class="modal-title">该课程名已存在!</text>
</view>
</view>
</view>

@ -0,0 +1,180 @@
.container {
display: flex;
flex-direction: column;
justify-content: flex-start; /* 让元素从容器的顶部开始对齐 */
align-items: center;
height: 100vh;
background-color: #f5f8f9;
padding-top:20rpx;
}
.class-card {
background-color: #f5f8f9;
padding: 20rpx;
margin-top: 20rpx; /* 每个卡片上方的间距 */
border-radius: 20rpx;
box-shadow: 4rpx 4rpx 6rpx rgba(64, 149, 229, 0.85);
display: flex;
justify-content: space-between;
align-items: center;
border: 2rpx solid rgba(29,70,157,1);
width: 600rpx;
height: 100rpx;
}
.class-image{
width:80rpx;
height: 80rpx;
border-radius: 10rpx;
margin-right: 20rpx;
}
.class-info{
white-space: pre;
flex:1; /* 意味着该元素可以占用容器中所有可用的空间。 */
}
.class-name {
font-size: 36rpx;
font-weight: bold;
}
.class-details {
font-size: 24rpx;
color: #888888;
display: flex; /* 使子元素以行内显示 */
gap:20rpx;
}
.arrow {
width: 16px;
height: 16px;
}
.add-button {
padding:0;
margin: 0;
flex:none;
position: fixed; /* 固定在视口 */
bottom: 75rpx; /* 距离底部20rpx */
right: 75rpx; /* 距离右侧20rpx */
width: 100rpx; /* 按钮宽度 */
height: 100rpx; /* 按钮高度 */
background-color: #f5f8f9; /*按钮颜色*/
border: none; /* 去掉默认边框 */
display:flex;
justify-content: center; /* 图片在按钮内部水平居中 */
align-items: center; /* 图片在按钮内部垂直居中 */
box-sizing: border-box;
}
/* 图片样式 */
.add-image {
width: 100rpx; /* 图片宽度 */
height: 100rpx; /* 图片高度 */
}
/* 浮窗的覆盖层 通用 */
.modal {
position: fixed; /* 绝对定位以覆盖整个视口 */
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5); /* 背景为半透明黑色 */
display: flex; /* 使用flex布局 */
justify-content: center; /* 居中对齐内容 */
align-items: center; /* 垂直居中对齐 */
}
/* 浮窗内容 通用 */
.modal-content {
background-color: #4095e5; /* 浮窗的背景颜色 */
padding: 40rpx 20rpx; /* 内边距 */
border-radius: 20rpx; /* 圆角 */
width: 80%; /* 浮窗宽度为视口的80% */
max-width: 500rpx; /* 最大宽度为500rpx */
}
/* 浮窗标题 通用 */
.modal-title {
color: white;
font-weight: bold;
font-size: 46rpx; /* 字体大小 */
margin-top: 30rpx;
margin-bottom: 30rpx;
text-shadow: 4rpx 4rpx 6rpx rgba(0, 0, 0, 0.4);
}
/* 输入框样式 */
.input-box {
width: 90%; /* 输入框宽度占满父容器 */
margin-top: 10rpx; /* 上方留出间隙 */
padding: 25rpx; /* 内边距 */
border: none; /* 去掉边框 */
border-bottom: 2rpx solid #fff; /* 底部边框 */
border-radius: 20rpx; /* 圆角 */
background-color: #fff; /* 背景颜色 */
color: black; /* 字体颜色 */
box-shadow: 4rpx 4rpx 6rpx rgba(0, 0, 0, 0.4);
}
/* 设置 placeholder 的颜色 */
.input-box::-webkit-input-placeholder {
color: #888888; /* 输入框班级名称的颜色 */
}
/* 浮窗按钮容器 通用 */
.modal-buttons {
display: flex; /* 使用flex布局 */
justify-content: space-between; /* 按钮间隔均匀 */
margin-top: 20rpx; /* 上方留出空间 */
gap:50rpx; /* 设置按钮之间的间距 */
margin-left: 50rpx;
margin-right: 50rpx;
}
/* 确认、取消按钮样式 通用 */
.confirm-button, .cancel-button {
background-color: white; /* 按钮背景颜色 */
color: #0014b7; /* 按钮文字颜色 */
flex: 1; /* 等宽 */
padding: 10rpx; /* 内边距 */
border: none; /* 去掉默认边框 */
border-radius: 20rpx; /* 圆角 */
margin-left: 10rpx; /* 按钮间距 */
box-shadow: 4rpx 4rpx 6rpx rgba(0, 0, 0, 0.4);
}
/* 文件选择部分 */
.file-selection {
display: flex; /* 使用flex布局 */
align-items: center; /* 垂直居中 */
margin-bottom: 10rpx; /* 底部留出一些间距 */
}
/* 选择文件按钮样式 */
.select-file-button {
background-color: white; /* 按钮背景颜色 */
color: #0014b7; /* 按钮文字颜色 */
padding: 15rpx; /* 内边距 */
border: none; /* 去掉默认边框 */
font-size: 30rpx;
width: 200rpx;
border-radius: 20rpx; /* 圆角 */
margin-right: 20rpx; /* 按钮与文件名之间的间距 */
box-shadow: 4rpx 4rpx 6rpx rgba(0, 0, 0, 0.4);
box-sizing: border-box; /* 包含边距和内边距 */
}
/* 文件名的显示样式 */
.file-name {
color: white; /* 文字颜色 */
}
/* 分隔线样式 */
.divider {
height: 4rpx; /* 分隔线高度 */
background-color: #0014b7; /* 分隔线颜色 */
margin: 10rpx 0; /* 上下留出一些间距 */
}

@ -0,0 +1,19 @@
Page({
onStudentList() {
wx.navigateTo({
url: '/pages/studentList/studentList',
});
},
onStudentRanking() {
wx.navigateTo({
url: '/pages/studentRanking/studentRanking',
});
},
onStartNaming() {
wx.navigateTo({
url: '/pages/startNaming/startNaming',
});
}
});

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "#F5F8F9",
"navigationBarTitleText": "学生点名",
"usingComponents": {}
}

@ -0,0 +1,23 @@
<view class="container">
<view class="menu-item" bindtap="onStudentList">
<image class="icon" src="/assets/img/RollClass/RollClass1_4.png" mode="aspectFill" />
<text class="menu-text">学生名单</text>
<image class="additional-icon" src="/assets/img/RollClass/RollClass1_1.png" mode="aspectFill" />
<image class="arrow" src="/assets/img/setting/setting4.png" mode="aspectFill" />
</view>
<view class="menu-item" bindtap="onStudentRanking">
<image class="icon" src="/assets/img/RollClass/RollClass1_5.png" mode="aspectFill" />
<text class="menu-text">学生排名</text>
<image class="additional-icon" src="/assets/img/RollClass/RollClass1_2.png" mode="aspectFill" />
<image class="arrow" src="/assets/img/setting/setting4.png" mode="aspectFill" />
</view>
<view class="menu-item" bindtap="onStartNaming">
<image class="icon" src="/assets/img/RollClass/RollClass1_6.png" mode="aspectFill" />
<text class="menu-text">开始点名</text>
<image class="additional-icon" src="/assets/img/RollClass/RollClass1_3.png" mode="aspectFill" />
<image class="arrow" src="/assets/img/setting/setting4.png" mode="aspectFill" />
</view>
</view>

@ -0,0 +1,47 @@
.container {
display: flex;
flex-direction: column;
justify-content: flex-start; /* 让元素从容器的顶部开始对齐 */
align-items: center;
height: 100vh;
background-color: #f5f8f9;
padding-top:20rpx;
}
.menu-item {
cursor: pointer; /* 鼠标悬停时显示为指针 */
background-color: #f5f8f9;
padding: 20rpx;
margin-top: 20rpx; /* 每个卡片上方的间距 */
border-radius: 20rpx;
box-shadow: 4rpx 4rpx 6rpx rgba(64, 149, 229, 0.85);
display: flex;
justify-content: space-between;
align-items: center;
border: 1px solid rgba(29,70,157,1);
width: 600rpx;
height: 100rpx;
}
.icon {
width: 75rpx; /* 图标大小 */
height: 75rpx; /* 图标大小 */
margin-right: 10rpx; /* 图标与文本之间的间距 */
}
.menu-text {
font-size: 32rpx; /* 文本字体大小 */
font-weight: bold;
flex: 1; /* 使文本占据剩余空间 */
}
.additional-icon {
width: 120rpx; /* 调整大小 */
height: 120rpx; /* 调整大小 */
margin-left: 20rpx; /* 添加间距 */
}
.arrow {
width: 48rpx; /* 箭头图标大小 */
height: 48rpx; /* 箭头图标大小 */
}

@ -0,0 +1,49 @@
// index.js
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
Page({
data: {
motto: 'Hello World',
userInfo: {
avatarUrl: defaultAvatarUrl,
nickName: '',
},
hasUserInfo: false,
canIUseGetUserProfile: wx.canIUse('getUserProfile'),
canIUseNicknameComp: wx.canIUse('input.type.nickname'),
},
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
},
onChooseAvatar(e) {
const { avatarUrl } = e.detail
const { nickName } = this.data.userInfo
this.setData({
"userInfo.avatarUrl": avatarUrl,
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
})
},
onInputChange(e) {
const nickName = e.detail.value
const { avatarUrl } = this.data.userInfo
this.setData({
"userInfo.nickName": nickName,
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
})
},
getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息开发者每次通过该接口获取用户个人信息均需用户确认开发者妥善保管用户快速填写的头像昵称避免重复弹窗
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(res)
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
},
})

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

@ -0,0 +1,27 @@
<!--index.wxml-->
<scroll-view class="scrollarea" scroll-y type="list">
<view class="container">
<view class="userinfo">
<block wx:if="{{canIUseNicknameComp && !hasUserInfo}}">
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
<image class="avatar" src="{{userInfo.avatarUrl}}"></image>
</button>
<view class="nickname-wrapper">
<text class="nickname-label">昵称</text>
<input type="nickname" class="nickname-input" placeholder="请输入昵称" bind:change="onInputChange" />
</view>
</block>
<block wx:elif="{{!hasUserInfo}}">
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<view wx:else> 请使用2.10.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>
</scroll-view>

@ -0,0 +1,62 @@
/**index.wxss**/
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
color: #aaa;
width: 80%;
}
.userinfo-avatar {
overflow: hidden;
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.usermotto {
margin-top: 200px;
}
.avatar-wrapper {
padding: 0;
width: 56px !important;
border-radius: 8px;
margin-top: 40px;
margin-bottom: 40px;
}
.avatar {
display: block;
width: 56px;
height: 56px;
}
.nickname-wrapper {
display: flex;
width: 100%;
padding: 16px;
box-sizing: border-box;
border-top: .5px solid rgba(0, 0, 0, 0.1);
border-bottom: .5px solid rgba(0, 0, 0, 0.1);
color: black;
}
.nickname-label {
width: 105px;
}
.nickname-input {
flex: 1;
}

@ -0,0 +1,8 @@
Page({
startApp() {
// 页面跳转到首页或其他功能页
wx.switchTab({
url: '/pages/AddClass/AddClass',
});
}
});

@ -0,0 +1,6 @@
{
"navigationBarTextStyle": "black",
"navigationBarTitleText": "学生点名系统",
"navigationBarBackgroundColor": "#ffffff",
"usingComponents": {}
}

@ -0,0 +1,22 @@
<view class="container">
<!-- 图片容器,包含背景图片和文字 -->
<view class="image-container" style="position: relative; left: 0rpx; top: -46rpx">
<!-- 背景图片 -->
<image class="background-image" src="/assets/img/lodding/lodding1.png" mode="widthFix"></image>
<!-- 文字 -->
<view class="overlay-text">
<text style="position: relative; left: -91rpx; top: 159rpx">学生点</text>
<text style="position: relative; left: 67rpx; top: -69rpx">名系统</text>
</view>
</view>
<view class="image-container2" style="position: relative; left: 0rpx; top: -15rpx">
<!-- 背景图片 -->
<image class="background-image2" src="/assets/img/lodding/lodding2.png" mode="widthFix"></image>
<!-- 按钮,使用绝对定位居中 -->
<view class='image-button'>
<button class='start-button' bindtap="startApp" style="width: 436rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx">开始使用</button>
</view>
</view>
</view>

@ -0,0 +1,100 @@
/* 页面整体布局 */
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #93d2f3;
}
/* 图片容器,使用相对定位 */
.image-container {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 100%;
}
/* 背景图片 */
.background-image {
width: 597.3rpx;
height: 320rpx;
opacity: 0;
animation: fadeIn 200ms ease-in forwards;
animation-delay: 400ms;
}
/* 文字样式,竖向排列 */
.overlay-text {
white-space: pre; /* 保留文本中的空格 */
writing-mode: vertical-lr; /* 让文字竖向排列 */
text-orientation: upright; /* 保持文字正方向 */
font-size: 137.4rpx; /* 设定文字大小 */
line-height: 1.5; /* 调整行高,使文字之间有间距 */
color: white; /* 文字颜色 */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%); /* 让文字垂直水平居中 */
text-shadow: 3.8rpx 7.6rpx 11.5rpx #1d469d;
font-weight: bold;
opacity: 0; /*初始透明读*/
animation: fadeIn 400ms ease-in forwards;
}
/* 页面整体布局 */
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh; /* 使容器高度为视口高度 */
background-color: #93d2f3; /* 背景颜色 */
}
/* 图片容器,使用相对定位 */
.image-container2 {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative; /* 为绝对定位的子元素提供相对定位 */
width: 100%;
}
/* 背景图片 */
.background-image2 {
width: 597.3rpx;
height: 862.6rpx;
opacity: 0;
animation: fadeIn 200ms ease-in forwards;
animation-delay: 600ms;
}
/* 按钮样式 */
.image-button {
position: absolute; /* 使按钮相对于父容器绝对定位 */
top: 50%; /* 使按钮垂直居中 */
left: 50%; /* 使按钮水平居中 */
transform: translate(-50%, -50%); /* 精确居中 */
}
/* 按钮样式 */
.start-button {
background-color: #4095e5;
color: white;
font-size: 76.3rpx;
border-radius: 40rpx;
box-shadow: 6rpx 4rpx 6rpx #0f40f5;
opacity: 0;
animation: fadeIn 200ms ease-in forwards;
animation-delay: 600ms;
}
@keyframes fadeIn{
to{
opacity: 1; /*最终透明度*/
}
}

@ -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 @@
{
"usingComponents": {
}
}

@ -0,0 +1,6 @@
<!--logs.wxml-->
<scroll-view class="scrollarea" scroll-y type="list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<view class="log-item">{{index + 1}}. {{log.date}}</view>
</block>
</scroll-view>

@ -0,0 +1,16 @@
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.log-item {
margin-top: 20rpx;
text-align: center;
}
.log-item:last-child {
padding-bottom: env(safe-area-inset-bottom);
}

@ -0,0 +1,3 @@
// pages/setting/setting.js
Page({
})

@ -0,0 +1,7 @@
{
"navigationBarTitleText": "设置",
"navigationBarBackgroundColor": "#F5F8F9",
"backgroundColor": "#eeeeee",
"navigationBarTextStyle": "black",
"usingComponents": {}
}

@ -0,0 +1,24 @@
<view class="container">
<view class="profile">
<image class="profile-image" src="/assets/img/Fairy/fairy (1).png" mode="aspectFill" />
<text class="nickname">昵称</text>
</view>
<view class="menu-item" bindtap="onPersonalInfo">
<image class="icon" src="/assets/img/setting/setting1.png" />
<text class="menu-text">个人信息</text>
<image class="arrow" src="/assets/img/setting/setting4.png" mode="aspectFill" />
</view>
<view class="menu-item" bindtap="onFeedback">
<image class="icon" src="/assets/img/setting/setting2.png" />
<text class="menu-text">意见反馈</text>
<image class="arrow" src="/assets/img/setting/setting4.png" mode="aspectFill" />
</view>
<view class="menu-item" bindtap="onAboutUs">
<image class="icon" src="/assets/img/setting/setting3.png" />
<text class="menu-text">关于我们</text>
<image class="arrow" src="/assets/img/setting/setting4.png" mode="aspectFill" />
</view>
</view>

@ -0,0 +1,60 @@
.container {
display: flex;
flex-direction: column; /* 列布局 */
justify-content: flex-start; /* 从顶部开始对齐 */
align-items: center; /* 水平居中 */
height: 100vh;
background-color: #f5f8f9; /* 背景颜色 */
padding-top: 0;
}
.profile {
display: flex; /* 横向布局 */
align-items: center; /* 垂直居中 */
border-bottom: 1rpx solid #3480FF; /* 下边框 */
width: 80%;
}
.profile-image {
width: 136rpx; /* 头像大小 */
height: 136rpx; /* 头像大小 */
border-radius: 50%; /* 圆形头像 */
margin-right: 15rpx; /* 头像与昵称之间的间距 */
}
.nickname {
margin-top: 30rpx;
font-size: 36rpx; /* 昵称字 */
font-weight: bold; /* 加粗 */
}
.menu-item {
display: flex; /* 横向布局 */
align-items: center; /* 垂直居中 */
padding: 20rpx; /* 内边距 */
border-bottom: 1rpx solid #3480FF; /* 下边框 */
width: 80%; /* 宽度 80% 填满容器 */
cursor: pointer; /* 鼠标悬停时显示为指针 */
justify-content: space-between; /* 让文本与箭头两端对齐 */
margin: 8rpx;
}
.icon {
color:#f5f8f9;
width: 48rpx;
height: 48rpx;
margin-right: 10rpx; /* 图标与文本之间的间距 */
margin-bottom: 8rpx;
}
.menu-text {
margin-left: 20rpx;
flex: 1; /* 使文本占据剩余空间 */
font-size: 28rpx; /* 文本字体大小 */
}
.arrow {
color:#f5f8f9;
width: 36rpx; /* 箭头图标大小 */
height: 36rpx;
}

@ -0,0 +1,233 @@
Page({
data:{
modalVisible1:false,
modalVisible2:false,
modalVisible3:false,
modalVisible4:false,
modalVisible5:false,
modalVisible6:false,
scoreModalVisible: false,
name:'',
score:'',
studentCount: "", // 存储输入的学生人数
dice:0, // 默认模式
diceImage:'/assets/img/RollClass/RollClass5_1.png', // 初始骰子图像
roll_or_request:0,
selectedStudents: [], // 用于存储随机选择的学生
currentStudentIndex: null, // 当前选中学生的索引
query: '',
foundStudent: null, // 存储找到的学生
students: []
},
onLoad() {
const app = getApp();
this.setData({
students: app.globalData.students // 设置全局数据
});
// console.log(this.data.students); // 检查此时的学生数据
},
onAbout(){
this.setData({
modalVisible1:true,
})
},
onAdd(){
this.setData({
modalVisible2:true,
});
},
onRank(){
wx.navigateTo({
url: '/pages/studentRanking/studentRanking',
});
},
onRoll(){
this.setData({
modalVisible4:true
});
},
onRollCall() {
this.setData({
modalVisible3:true,
roll_or_request:0
});
},
onRequest() {
this.setData({
modalVisible3:true,
roll_or_request:1
});
},
// 加分
addScore(event){
const index = event.currentTarget.dataset.index; // 获取点击的学生索引
this.setData({
currentStudentIndex: index, // 保存当前学生索引
modalVisible5:true
})
},
// 浮窗
closeModal(){
this.setData({
modalVisible1:false,
modalVisible2:false,
modalVisible3:false,
modalVisible4:false,
modalVisible5:false,
modalVisible6:false,
name:'',
score:'',
studentCount:""
})
},
// 浮窗2
onInputName(event) {
this.setData({
name: event.detail.value
});
},
onInputScore(event) {
this.setData({
score: parseInt(event.detail.value) || 0 // 确保总是为数字
});
},
// 查询加分
onConfirm2() {
const { name, score, students } = this.data;
// 判断输入是否为数字
const isNumeric = !isNaN(name) && name.trim() !== '';
// 查找学生
const foundStudent = students.find(student => {
return isNumeric ? student.id === parseInt(name) : student.name === name;
});
if (foundStudent) {
foundStudent.score += score; // 修改找到的学生的分数
this.setData({
students: [...students], // 更新页面的学生数据
scoreInfo: { // 设置要显示的分数信息
name: foundStudent.name,
id: foundStudent.id,
score: foundStudent.score
},
scoreModalVisible: true // 显示分数弹窗
});
console.log("更新后的学生数据:", foundStudent);
// 获取全局变量并更新
const app = getApp();
app.globalData.students = [...students]; // 将修改后的数据同步到全局
}
else {
// 没有找到学生时显示错误弹窗
this.setData({
modalVisible6: true
});
}
// console.log("姓名:", this.data.name);
// console.log("得分:", this.data.score);
// 重置输入框和隐藏弹窗
this.setData({
name: '',
score: '',
modalVisible2: false
});
},
// 浮窗3
onInputNum(event){
this.setData({
studentCount:event.detail.value
});
},
onConfirm3() {
const { studentCount, students } = this.data;
if (studentCount > students.length) {
wx.showToast({ title: '人数超出范围', icon: 'none' });
return;
}
// 随机选择学生
const selectedStudents = this.getRandomStudents(students, studentCount);
this.setData({
selectedStudents,studentCount: '', // 清空输入框
modalVisible3: false // 关闭弹窗
});
console.log("随机选择的学生:", selectedStudents); // 打印随机选择的学生
},
// 随机选择学生函数
getRandomStudents(students, count) {
const shuffled = students.sort(() => 0.5 - Math.random()); // 打乱数组
return shuffled.slice(0, count); // 选择前 count 个学生
},
// 浮窗4 投掷骰子
onRollDice() {
console.log("投掷骰子按钮被点击");
// 生成1-6随机数
const rolledValue = Math.floor(Math.random()*6)+1;
this.setData({
dice: rolledValue,
diceImage: `/assets/img/RollClass/RollClass5_${rolledValue}.png`, // 更新图像
});
},
// 浮窗5 加分 处理分数按钮点击
onScoreChange(event) {
const scoreChange = parseFloat(event.currentTarget.dataset.score);
const { currentStudentIndex, selectedStudents } = this.data;
if (currentStudentIndex != null) {
selectedStudents[currentStudentIndex].score += scoreChange; // 增加分数
// 获取全局变量
const app = getApp();
const students = app.globalData.students;
students[currentStudentIndex].score = selectedStudents[currentStudentIndex].score; // 更新全局数据
this.setData({
selectedStudents,
modalVisible5: false, // 关闭加分弹窗
scoreInfo: {
name: selectedStudents[currentStudentIndex].name,
id: selectedStudents[currentStudentIndex].id,
score: selectedStudents[currentStudentIndex].score
},
scoreModalVisible: true // 显示得分弹窗
});
console.log("更新后的分数:", selectedStudents[currentStudentIndex].score);
}
},
// 浮窗7 得分信息
closeScoreModal() {
this.setData({
scoreModalVisible: false // 隐藏得分弹窗
});
}
});

@ -0,0 +1,5 @@
{
"navigationBarBackgroundColor": "#F5F8F9",
"navigationBarTitleText": "开始点名",
"usingComponents": {}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save