上传文件至 'pages/timetable'

This commit is contained in:
a 2022-05-09 15:41:46 +08:00
parent e135e918f9
commit aa3443f46a
4 changed files with 221 additions and 0 deletions

View File

@ -0,0 +1,132 @@
// pages/timetable/timetable.js
Page({
/**
* 页面的初始数据
*/
data: {
reallist:[],
wlist: [
{ "xqj": 1, "skjc": 1, "skcd": 3, "kcmc": "高等数学@教A-301" },
{ "xqj": 1, "skjc": 5, "skcd": 3, "kcmc": "高等数学@教A-301" },
{ "xqj": 2, "skjc": 1, "skcd": 2,"kcmc":"高等数学@教A-301"},
{ "xqj": 2, "skjc": 8, "skcd": 2, "kcmc": "高等数学@教A-301" },
{ "xqj": 3, "skjc": 4, "skcd": 1, "kcmc": "高等数学@教A-301" },
{ "xqj": 3, "skjc": 8, "skcd": 1, "kcmc": "高等数学@教A-301" },
{ "xqj": 3, "skjc": 5, "skcd": 2, "kcmc": "高等数学@教A-301" },
{ "xqj": 4, "skjc": 2, "skcd": 3, "kcmc": "高等数学@教A-301" },
{ "xqj": 5, "skjc": 1, "skcd": 2, "kcmc": "高等数学@教A-301" },
],
option1: [
// { text: '2020-2021学年1', value: 2 },
],
option2: [
{ text: '第1周', value: '1' },
{ text: '第2周', value: '2' },
{ text: '第3周', value: '3' },
{ text: '第4周', value: '4' },
{ text: '第5周', value: '5' },
{ text: '第6周', value: '6' },
{ text: '第7周', value: '7' },
{ text: '第8周', value: '8' },
{ text: '第9周', value: '9' },
{ text: '第10周', value: '10' },
],
value1: 0,
value2: 'a',
colorArrays: [ "#f8f8fc","#f8f8fc", "#f8f8fc", "#f8f8fc", "#f8f8fc", "#f8f8fc", "#f8f8fc", "#f8f8fc", "#f8f8fc"],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.getStorage({
key:"data",
success:(res)=>{
var uid = res.data.uid
wx.request({
url: 'http://10.0.100.100:8000/u/'+uid+'/sems',
method:"GET",
success:(res)=>{
this.setData({option1:res.data.data})
}
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
change: function (e) {
wx.request({
url: 'http://10.0.100.100:8000/u/201150235/schedule?sem_id='+e.detail,
method:"GET",
success:(res)=>{
this.setData({wlist:res.data.data})
}
})
},
change2: function (e) {
console.log(e.detail)
var list = []
var arr = this.data.wlist
for (var i in arr){
if (parseInt(e.detail) >= parseInt(arr[i].week_list[0].start_week) && parseInt(e.detail) <= parseInt(arr[i].week_list[0].end_week)){
list.push(arr[i])
}
}
this.setData({reallist:list})
console.log(this.data.reallist)
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"xiala":"../../components/dist/dropdown-menu/index",
"xiala-item":"../../components/dist/dropdown-item/index"
}
}

View File

@ -0,0 +1,25 @@
<xiala class="xiala" z-index="10000">
<xiala-item value="{{ value1 }}" options="{{ option1 }}" bind:change="change"></xiala-item>
<xiala-item value="{{ value2 }}" options="{{ option2 }}" bind:change="change2"></xiala-item>
</xiala>
<scroll-view scroll-y="true" class="scroll" style=" width: 750rpx; height: 1250rpx; display: block; box-sizing: border-box">
<view class="top">
<view wx:for="{{['一','二','三','四','五']}}" class="top-text">星期{{item}}</view>
</view>
<view>
<view wx:for="{{[1,2,3,4,5,6,7,8,9,10]}}" class="left">
{{item}}
</view>
</view>
<view wx:for="{{[1,2,3,4,5,6,7,8,9,10]}}">
<view style="width: 750rpx; margin-top: {{(index+1)*100}}rpx; position: absolute; border-bottom: 1rpx solid {{index==3?'black':'lightgray'}}; left: 0rpx; top: 50rpx">
</view>
</view>
<view wx:for="{{reallist}}">
<view class="flex-item kcb-item" bindtap="showCardView" data-statu="open" data-index="{{index}}" style="margin-left: {{(item.week-1)*140}}rpx; margin-top: {{(item.lesson_start-1)*100+5}}rpx; height: {{item.lesson_end*100-5}}rpx; position: absolute; left: 55rpx; top: 50rpx ">
<view class="smalltext">{{item.course_name}}</view>
</view>
</view>
</scroll-view>

View File

@ -0,0 +1,58 @@
/* pages/timetable/timetable.wxss */
.xiala{
/* margin-bottom: 100rpx; */
}
.top {
display: flex;
flex-direction: row;
margin-left: 50rpx;
background-color: #E6E6E6;
color: #000;
display: flex;
justify-content: space-around;
align-items: center;
}
.top-text {
width: 200rpx;
height: 50rpx;
font-size: 10pt;
justify-content: center;
display: flex;
align-items: center;
}
.left {
width: 50rpx;
height: 100rpx;
font-size: 10pt;
justify-content: center;
display: flex;
align-items: center;
}
.flex-item {
width: 95rpx;
height: 100px;
}
.kcb-item {
background-color: #EFD3A1;
position: absolute;
display: flex;
justify-content: space-around;
align-items: center;
border-radius: 5px;
box-shadow: -3px 0px 5px #EFB56F;
width: 140rpx;
}
.smalltext {
background-color: #EFD3A1;
font-size: 10pt;
color: #A1731D;
padding-left: 2px;
}
.scroll {
height: 1250rpx;
z-index: 101;
position: fixed;
}