@ -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 |
@ -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("取消");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
@ -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("取消");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
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 |