陈建宇 1 month ago
parent 4d7919a75f
commit 615c441c87

@ -1,114 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
courseList: [],
isAdmin: true
},
enterCourse : function(event) {
const courseId = event.currentTarget.dataset.id;
const description = event.currentTarget.dataset.description;
wx.setStorageSync('courseId', courseId);
wx.setStorageSync('description', description);
console.log('courseId', courseId);
console.log('description', description);
if (this.data.isAdmin) {
wx.navigateTo({url: '/pages/course_detail/course_detail'});
} else {
wx.navigateTo({url: '/pages/course_detail(2)/course_detail(2)'});
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const that = this;
that.setData ({
isAdmin: wx.getStorageSync("isAdmin")
});
if (that.data.isAdmin) {
wx.request({
url: 'http://10.133.15.50:8888/admin/ownCourseList',
method: 'GET',
header: {
admin_token: wx.getStorageSync('token') // 携带token
},
success(res) {
if (res.statusCode === 200) {
console.log(res.data.data);
that.setData({
courseList: res.data.data
});
}
},
fail(error) {
console.error(err);
}
});
} else {
wx.request({
url: 'http://10.133.15.50:8888/student/ownCourseList',
method: 'GET',
header: {
student_token: wx.getStorageSync('token') // 携带token
},
success(res) {
if (res.statusCode === 200) {
console.log(res.data.data);
that.setData({
courseList: res.data.data
});
}
},
fail(error) {
console.error(err);
}
});
}
},
util: function (currentStatu) {
/* 动画部分 */
// 第1步创建动画实例
var animation = wx.createAnimation({
duration: 200, //动画时长
timingFunction: "linear", //线性
delay: 0 //0则不延迟
});
// 第2步这个动画实例赋给当前的动画实例
this.animation = animation;
// 第3步执行第一组动画
animation.opacity(0).rotateX(-100).step();
// 第4步导出动画对象赋给数据对象储存
this.setData({
animationData: animation.export()
})
// 第5步设置定时器到指定时候后执行第二组动画
setTimeout(function () {
// 执行第二组动画
animation.opacity(1).rotateX(0).step();
// 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象
this.setData({
animationData: animation
})
//关闭
if (currentStatu == "close") {
this.setData({
showModalStatus: false
});
}
}.bind(this), 200)
// 显示
if (currentStatu == "open") {
this.setData({
showModalStatus: true
});
}
},
})

@ -1,20 +0,0 @@
<view class="container">
<view class="course_name">{{description}}</view>
<view class="combition">
<navigator class="option" navigator url="/pages/student_info/student_info">查看学生信息</navigator>
<image class="right_image" src="/素材/海豚,卡通动物.png"/>
</view>
<view class="combition">
<navigator class="option" navigator url="/pages/choose_name/choose_name">点名</navigator>
<image class="right_image" src="/素材/bird动物卡通.png"/>
</view>
<view class="combition">
<view class="option" bindtap="update" data-statu="open">添加学生</view>
<image class="right_image" src="/素材/章鱼,卡通动物.png"/>
</view>
<view class="combition">
<view class="option" bindtap="chooseMessageFile">导入学生名单</view>
<image class="right_image" src="/素材/猴子,卡通动物.png"/>
</view>
<image class="bottom_image" src="/素材/任务完成.png"/>
</view>

@ -1,66 +0,0 @@
// pages/my/my.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -13,6 +13,7 @@ Page({
this.call_the_name(); this.call_the_name();
}, },
addScore2: function() { addScore2: function() {
this.addScore(0);
this.call_the_name(); this.call_the_name();
}, },
addScore3: function() { addScore3: function() {

@ -0,0 +1,137 @@
Page({
/**
* 页面的初始数据
*/
data: {
courseList: [],
isAdmin: true
},
enterCourse : function(event) {
const courseId = event.currentTarget.dataset.id;
const description = event.currentTarget.dataset.description;
wx.setStorageSync('courseId', courseId);
wx.setStorageSync('description', description);
console.log('courseId', courseId);
console.log('description', description);
if (this.data.isAdmin) {
wx.navigateTo({url: '/pages/course_detail/course_detail'});
} else {
wx.navigateTo({url: '/pages/course_detail(2)/course_detail(2)'});
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getCourse();
},
getCourse: function() {
const that = this;
that.setData ({
isAdmin: wx.getStorageSync("isAdmin")
});
if (that.data.isAdmin) {
wx.request({
url: 'http://10.133.15.50:8888/admin/ownCourseList',
method: 'GET',
header: {
admin_token: wx.getStorageSync('token') // 携带token
},
success(res) {
if (res.statusCode === 200) {
console.log(res.data.data);
that.setData({
courseList: res.data.data
});
}
},
fail(error) {
console.error(err);
}
});
} else {
wx.request({
url: 'http://10.133.15.50:8888/student/ownCourseList',
method: 'GET',
header: {
student_token: wx.getStorageSync('token') // 携带token
},
success(res) {
if (res.statusCode === 200) {
console.log(res.data.data);
that.setData({
courseList: res.data.data
});
}
},
fail(error) {
console.error(err);
}
});
}
},
update: function(event) {
const that = this;
if (wx.getStorageSync('isAdmin') == true) {
wx.showModal({
title:'创建新课程',
editable:true,//显示输入框
placeholderText:'输入课程名',//显示输入框提示信息
success: res => {
if (res.confirm) { //点击了确认
console.log(res.content)//用户输入的值
wx.request({
url: 'http://10.133.15.50:8888/admin/createCourse?courseDescription=' + res.content,
method: 'POST',
header: {
'admin_token': wx.getStorageSync('token') // 携带token
},
success(res) {
if (res.statusCode === 200) {
console.log("yes");
}
that.getCourse();
},
fail(error) {
console.error(error);
}
})
} else {
console.log("取消");
}
}
})
} else {
wx.showModal({
title:'加入课程',
editable:true,//显示输入框
placeholderText:'输入课程名',//显示输入框提示信息
success: res => {
if (res.confirm) { //点击了确认
console.log(res.content)//用户输入的值
wx.request({
url: 'http://10.133.15.50:8888/student/joinCourse?courseDescription=' + res.content,
method: 'POST',
header: {
'student_token': wx.getStorageSync('token') // 携带token
},
success(res) {
if (res.statusCode === 200) {
console.log("yes");
}
that.getCourse();
},
fail(error) {
console.error(error);
}
})
} else {
console.log("取消");
}
}
})
}
}
})

@ -7,7 +7,7 @@
</view> </view>
<view bindtap='adddetial'> <view bindtap='adddetial'>
<image class="add_icon" src="/素材/circle-plus-outline.png" bindtap="update" data-statu="open"></image> <image class="add_icon" src="/素材/circle-plus-outline.png" bindtap="update"></image>
</view> </view>

@ -114,21 +114,30 @@ Page({
var that = this; var that = this;
wx.chooseMessageFile({ wx.chooseMessageFile({
count: 1, count: 1,
type: 'file', type: 'all',
success(res) { success(res) {
var filename = res.tempFiles[0].name var filename = res.tempFiles[0].name
console.info(filename);
that.setData({filename:filename}); that.setData({filename:filename});
console.info(filename);
console.log(res.tempFiles[0].path);
wx.uploadFile({ wx.uploadFile({
url: 'http://10.133.15.50:8888/admin/', url: 'http://10.133.15.50:8888/admin/batchAddStudents?courseId=' + wx.getStorageSync('courseId') + '&file=' + res.tempFiles[0].path,
filePath: res.tempFiles[0].path,
name: 'uploadFile',
header: { header: {
admin_token: wx.getStorageSync('token') // 携带token admin_token: wx.getStorageSync('token') // 携带token
}, },
name: filename,
method: 'POST', method: 'POST',
success(res) { success(res) {
//json字符串 需用JSON.parse 转 var data = JSON.parse(res.data)
if (data.code == 200) {
console.log('上传成功');
} else{
console.log('上传失败');
wx.showToast({
title: res.message,
icon: 'none'
})
}
} }
}) })
} }

@ -0,0 +1,45 @@
<view class="container">
<view class="course_name">{{description}}</view>
<view class="combition">
<navigator class="option" navigator url="/pages/student_info/student_info">查看学生信息</navigator>
<image class="right_image" src="/素材/海豚,卡通动物.png"/>
</view>
<view class="combition">
<navigator class="option" navigator url="/pages/choose_name/choose_name">点名</navigator>
<image class="right_image" src="/素材/bird动物卡通.png"/>
</view>
<view class="combition">
<view class="option" bindtap="update" data-statu="open">添加学生</view>
<image class="right_image" src="/素材/章鱼,卡通动物.png"/>
</view>
<view class="combition">
<view class="option" bindtap="chooseMessageFile">导入学生名单</view>
<image class="right_image" src="/素材/猴子,卡通动物.png"/>
</view>
<image class="bottom_image" src="/素材/任务完成.png"/>
</view>
<!--弹出框-->
<view class="drawer_screen" bindtap="update" data-statu="close" wx:if="{{showModalStatus}}"></view>
<!--content-->
<!--使用animation属性指定需要执行的动画-->
<view class="animation_position">
<view animation="{{animationData}}" class="drawer_box" wx:if="{{showModalStatus}}">
<!--drawer content-->
<view class="drawer_title">添加学生</view>
<view class="drawer_content">
<view class="input_group">
<view class="label">学生学号:</view>
<input class="input" bindblur="studentId" placeholder="请输入学生学号"></input>
</view>
<view class="input_group">
<view class="label">学生姓名:</view>
<input class="input" bindblur="name" placeholder="请输入学生姓名"></input>
</view>
</view>
<view class="btn">
<view class="btn_no" bindtap="cancel" data-statu="close">取消</view>
<view class="btn_yes" bindtap="update" data-statu="close">确定</view>
</view>
</view>
</view>

@ -55,7 +55,7 @@ Page({
console.log(res.data); console.log(res.data);
if (res.statusCode === 200) { if (res.statusCode === 200) {
// 处理登录成功 // 处理登录成功
wx.setStorageSync('adminId', res.data.data.studentId); wx.setStorageSync('studentId', res.data.data.studentId);
wx.setStorageSync('name', res.data.data.name); wx.setStorageSync('name', res.data.data.name);
wx.setStorageSync('token', res.data.data.token); wx.setStorageSync('token', res.data.data.token);
wx.setStorageSync('isAdmin', false); wx.setStorageSync('isAdmin', false);

@ -0,0 +1,68 @@
// pages/my/my.js
Page({
/**
* 页面的初始数据
*/
data: {
},
change: function(event) {
wx.showModal({
title:'修改密码',
editable:true,//显示输入框
placeholderText:'输入新密码',//显示输入框提示信息
success: res => {
if (res.confirm) { //点击了确认
console.log(res.content)//用户输入的值
if (wx.getStorageSync('isAdmin') == true) {
wx.request({
url: 'http://10.133.15.50:8888/admin/changePassword',
method: 'PUT',
header: {
'admin_token': wx.getStorageSync('token') // 携带token
},
data: {
name: wx.getStorageSync('name'),
adminId: wx.getStorageSync('adminId'),
password: res.content
},
success(res) {
if (res.statusCode === 200) {
console.log("yes");
}
},
fail(error) {
console.error(error);
}
})
} else {
wx.request({
url: 'http://10.133.15.50:8888/student/changePassword',
method: 'PUT',
header: {
'student_token': wx.getStorageSync('token') // 携带token
},
data: {
name: wx.getStorageSync('name'),
adminId: wx.getStorageSync('studentId'),
password: res.content
},
success(res) {
if (res.statusCode === 200) {
console.log("yes");
}
},
fail(error) {
console.error(error);
}
})
}
} else {
console.log("取消");
}
}
})
}
})

@ -4,10 +4,10 @@
<text>个人信息</text> <text>个人信息</text>
<image class="icon2" src="/assets/course/arrow-right.png" mode="aspectFit"/> <image class="icon2" src="/assets/course/arrow-right.png" mode="aspectFit"/>
</navigator> </navigator>
<navigator class="option" navigator url=""> <view class="option" bindtap='change'>
<image class="icon1" src="/assets/my/修改密码.png" mode="aspectFit"/> <image class="icon1" src="/assets/my/修改密码.png" mode="aspectFit"/>
<text>修改密码</text> <text>修改密码</text>
<image class="icon2" src="/assets/course/arrow-right.png" mode="aspectFit"/> <image class="icon2" src="/assets/course/arrow-right.png" mode="aspectFit"/>
</navigator> </view>
<image class="bottom_image" src="/素材/各司其职.png"/> <image class="bottom_image" src="/素材/各司其职.png"/>
</view> </view>

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 168 KiB

Before

Width:  |  Height:  |  Size: 269 KiB

After

Width:  |  Height:  |  Size: 269 KiB

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 99 KiB

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 188 KiB

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Before

Width:  |  Height:  |  Size: 266 KiB

After

Width:  |  Height:  |  Size: 266 KiB

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 175 KiB

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 175 KiB

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Before

Width:  |  Height:  |  Size: 217 KiB

After

Width:  |  Height:  |  Size: 217 KiB

Before

Width:  |  Height:  |  Size: 199 KiB

After

Width:  |  Height:  |  Size: 199 KiB

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Before

Width:  |  Height:  |  Size: 165 KiB

After

Width:  |  Height:  |  Size: 165 KiB

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Before

Width:  |  Height:  |  Size: 177 KiB

After

Width:  |  Height:  |  Size: 177 KiB

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Before

Width:  |  Height:  |  Size: 161 KiB

After

Width:  |  Height:  |  Size: 161 KiB

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

Loading…
Cancel
Save