* A 实训模块 * A 我参与的实训 * A 搜索模块 * A 修改密码模块 * A 消息中心分类 * A 加入课堂对话框增加扫码功能 * U 部分按钮样式更新 * U 我的课堂上拉加载更多 * F 加入课堂后Toast提示不消失 * F 进入app未登录时获取消息通知报错master
parent
62e5403be7
commit
ef84c44d00
@ -0,0 +1,30 @@
|
||||
## v0.12.0
|
||||
* A 实训模块
|
||||
* A 我参与的实训
|
||||
* A 搜索模块
|
||||
* A 修改密码模块
|
||||
* A 消息中心分类
|
||||
* A 加入课堂对话框增加扫码功能
|
||||
* U 部分按钮样式更新
|
||||
* U 我的课堂上拉加载更多
|
||||
* F 加入课堂后Toast提示不消失
|
||||
* F 进入app未登录时获取消息通知报错
|
||||
|
||||
## v0.11.1
|
||||
* U error-page多按钮操作
|
||||
* U 课堂错误处理界面返回主页操作
|
||||
* F 非课程成员进入时弹出弹窗
|
||||
* F 试卷填空题答题bug修补
|
||||
|
||||
## v0.11.0
|
||||
* A 课程-普通作业模块
|
||||
* A 页面不存在时进入主页
|
||||
* A referrerInfo 分析
|
||||
* A 主页课堂菜单操作
|
||||
* A error-page组件错误处理界面
|
||||
* U 加入课堂对话框功能升级
|
||||
* U 课堂页面错误处理
|
||||
* U 课程邀请界面改进,增加已停用时的图标
|
||||
* U 改变小程序码生成接口为getWXACodeUnlimited
|
||||
* F 试卷题目富文本显示异常
|
||||
* D 隐藏发现页入口
|
After Width: | Height: | Size: 74 KiB |
@ -0,0 +1,60 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
user:{}
|
||||
},
|
||||
|
||||
onFormReset(){
|
||||
wx.navigateBack({
|
||||
delta:1
|
||||
});
|
||||
},
|
||||
changePassword({detail:{value}}){
|
||||
if(app.user().user_id==2)
|
||||
return wx.showToast({
|
||||
title: '请登陆后操作哦', icon: "none"
|
||||
});
|
||||
if(!value.password||!value.old_password||!value.password_confirmation)
|
||||
return wx.showToast({
|
||||
title: '请输入完整哦', icon: "none"
|
||||
});
|
||||
if(value.password_confirmation!=value.password)
|
||||
return wx.showToast({
|
||||
title: '两次输入的新密码不一致哦',icon:"none"
|
||||
});
|
||||
if(value.old_password==value.password)
|
||||
return wx.showToast({
|
||||
title: '输入的新旧密码是一样的哦', icon: "none"
|
||||
});
|
||||
app.api("users.accounts.password")(value)
|
||||
.then(res=>{
|
||||
if(res.status==0)
|
||||
res.message="修改成功";
|
||||
app.showMsg(res);
|
||||
setTimeout(()=>{
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},1000);
|
||||
|
||||
})
|
||||
.catch(e=>{
|
||||
console.error(e);
|
||||
app.showError(e);
|
||||
})
|
||||
},
|
||||
onLoad: function (options) {
|
||||
app.syncUser()
|
||||
.then(res=>{
|
||||
this.setData({})
|
||||
})
|
||||
},
|
||||
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "修改密码"
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<view class="container">
|
||||
<form bindsubmit="changePassword" bindreset="onFormReset">
|
||||
<view class="input-wrap">
|
||||
<input password name="old_password" placeholder="原密码"/>
|
||||
</view>
|
||||
<view class="input-wrap">
|
||||
<input password name="password" placeholder="新密码"/>
|
||||
</view>
|
||||
<view class="input-wrap">
|
||||
<input password name="password_confirmation" placeholder="请再次输入新密码"/>
|
||||
</view>
|
||||
<view class="buttons">
|
||||
<button form-type="submit" type="main">确认</button>
|
||||
<button form-type="reset" type="main" plain>返回</button>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
@ -0,0 +1,17 @@
|
||||
.container{
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.input-wrap{
|
||||
border-radius: 4px;
|
||||
border: 1px solid grey;
|
||||
margin: 16px 18px;
|
||||
}
|
||||
.input-wrap>input{
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.buttons>button{
|
||||
margin: 0 10px;
|
||||
transform: scale(0.72);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "登陆",
|
||||
"navigationBarTitleText": "登录",
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
//miniprogram/account/pages/test/test.js
|
||||
//我我我等等是顶顶顶
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
code: `.we-editor{
|
||||
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
overflow: scroll;
|
||||
white-space: pre;
|
||||
cursor: text;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
}
|
||||
.ta{
|
||||
width: auto;
|
||||
background: #002B36;
|
||||
color: #93A1A1;
|
||||
font: 14px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
white-space: pre;
|
||||
padding: 12px;
|
||||
}
|
||||
.we-cursor{
|
||||
height: 14px;
|
||||
min-height: 14px;
|
||||
width: 1px;
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
color: white;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.theme-dark{
|
||||
background-color: #002B36;
|
||||
color: #93A1A1;
|
||||
}
|
||||
.we-line{
|
||||
position: absolute;
|
||||
}
|
||||
.we-word{
|
||||
|
||||
}
|
||||
.theme-dark .we-comment{
|
||||
font-style: italic;
|
||||
color: #657B83;
|
||||
}
|
||||
.theme-dark .we-keyword{
|
||||
color: #859900;
|
||||
}
|
||||
.theme-dark .we-number{
|
||||
color: #D33682;
|
||||
}
|
||||
.theme-dark .we-string{
|
||||
color: #2AA198;
|
||||
}
|
||||
.we-chinese{
|
||||
width: 13.1953px;
|
||||
display: inline-block;
|
||||
}`,
|
||||
lines: [[]],
|
||||
wordWidth: 6.59765,
|
||||
cursor: {
|
||||
row: 0,
|
||||
col: 0,
|
||||
cursor: 0,
|
||||
value: ""
|
||||
}
|
||||
},
|
||||
lines: [""],
|
||||
indent: 0,
|
||||
cursor: 0,
|
||||
getColByValue(value, cursor) {
|
||||
console.log(value, cursor);
|
||||
return value.slice(0, cursor).length * 2 - value.slice(0, cursor).replace(/[\u4e00-\u9fa5]/g, "").length;
|
||||
},
|
||||
|
||||
getCursor(value, col) {
|
||||
var cursor = col;
|
||||
var newCol = this.getColByValue(value, cursor);
|
||||
while (newCol != col) {
|
||||
cursor = cursor - 1;
|
||||
newCol = this.getColByValue(value, cursor);
|
||||
}
|
||||
return cursor;
|
||||
},
|
||||
parseLine(value) {
|
||||
var line = [];
|
||||
for (var word of value.split(/([\u4e00-\u9fa5]+)/)) {
|
||||
var match = word.match(/[\u4e00-\u9fa5]+/)
|
||||
;
|
||||
if (match) {
|
||||
for (var i of word)
|
||||
line.push({ class: "we-chinese", value: i });
|
||||
} else {
|
||||
line.push({ class: "", value: word });
|
||||
}
|
||||
}
|
||||
return line;
|
||||
},
|
||||
onInput(e) {
|
||||
console.log(e);
|
||||
let { keyCodevalue, cursor, value } = e.detail;
|
||||
console.log(e.detail)
|
||||
var row = this.data.cursor.row;
|
||||
if (value.length == 0 && this.data.cursor.row != 0) {
|
||||
var { lines } = this.data;
|
||||
lines.splice(row, 1);
|
||||
var newValue = this.lines[row - 1];
|
||||
this.setData({ lines, "cursor.row": row - 1, "cursor.col": this.getColByValue(newValue), "cursor.value": "" + newValue });
|
||||
this.lines.splice(row, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setData({ "cursor.col": this.getColByValue(value, cursor) });
|
||||
var line = this.parseLine(value);
|
||||
this.setData({ ['lines[' + this.data.cursor.row + "]"]: line });
|
||||
this.lines[row] = value;
|
||||
var indentMatch = value.match(/(^ *)/)
|
||||
if (indentMatch)
|
||||
this.indent = indentMatch[1].length
|
||||
else
|
||||
this.indent = 0;
|
||||
this.cursor = cursor;
|
||||
//return "";
|
||||
},
|
||||
onTapEditor({ detail: { x, y } }) {
|
||||
//console.log(e);
|
||||
var row = Math.min(Math.round(y / 14), this.data.lines.length - 1);
|
||||
var value = this.lines[row];
|
||||
var col = Math.min(Math.round(x / this.data.wordWidth), this.getColByValue(value));
|
||||
this.cursor = this.getCursor(value, col);
|
||||
this.setData({ "cursor.row": row, "cursor.col": col, "cursor.focus": 1, "cursor.cursor": this.cursor, "cursor.value": value });
|
||||
},
|
||||
onInputConfirm(e) {
|
||||
//console.log(e);
|
||||
var row = this.data.cursor.row;
|
||||
var value = this.lines[row];
|
||||
var rightValue = " ".repeat(this.indent) + value.slice(this.cursor);
|
||||
var leftValue = value.slice(0, this.cursor);
|
||||
var { lines } = this.data;
|
||||
lines.splice(row + 1, 0, this.parseLine(rightValue));
|
||||
lines[row] = this.parseLine(leftValue);
|
||||
this.setData({ lines, "cursor.value": rightValue });
|
||||
this.lines.splice(row + 1, 0, rightValue);
|
||||
this.lines[row] = leftValue;
|
||||
this.setData({ "cursor.cursor": this.indent, "cursor.focus": 2, "cursor.row": row + 1, "cursor.col": this.indent });
|
||||
},
|
||||
onLoad: function (options) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
@ -0,0 +1,15 @@
|
||||
<!--miniprogram/account/pages/test/test.wxml-->
|
||||
|
||||
<textarea class="ta" maxlength="-1" value="{{code}}">
|
||||
|
||||
</textarea>
|
||||
|
||||
|
||||
<view wx:if="{{false}}" class="we-editor theme-dark" bindtap="onTapEditor">
|
||||
<input class="we-cursor" bindinput="onInput" style="top:{{cursor.row*14}}px;left:{{cursor.col*wordWidth}}px" maxlength="-1" value="{{cursor.value}}" cursor="{{cursor.cursor}}" focus="{{cursor.focus}}" confirm-hold="1" bindconfirm="onInputConfirm"></input>
|
||||
<view class="we-line" style="top:{{index*14}}px" wx:for="{{lines}}" wx:for-item="line" wx:key="index">
|
||||
<block wx:for="{{line}}" wx:for-item="word">
|
||||
<text class="we-word {{word.class}}">{{word.value}}</text>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,55 @@
|
||||
.we-editor{
|
||||
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
overflow: scroll;
|
||||
white-space: pre;
|
||||
cursor: text;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.ta{
|
||||
width: auto;
|
||||
background: #002B36;
|
||||
color: #93A1A1;
|
||||
font: 14px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
white-space: pre;
|
||||
padding: 12px;
|
||||
height: 100vh;
|
||||
}
|
||||
.we-cursor{
|
||||
height: 14px;
|
||||
min-height: 14px;
|
||||
width: 1px;
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
color: white;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.theme-dark{
|
||||
background-color: #002B36;
|
||||
color: #93A1A1;
|
||||
}
|
||||
.we-line{
|
||||
position: absolute;
|
||||
}
|
||||
.we-word{
|
||||
|
||||
}
|
||||
.theme-dark .we-comment{
|
||||
font-style: italic;
|
||||
color: #657B83;
|
||||
}
|
||||
.theme-dark .we-keyword{
|
||||
color: #859900;
|
||||
}
|
||||
.theme-dark .we-number{
|
||||
color: #D33682;
|
||||
}
|
||||
.theme-dark .we-string{
|
||||
color: #2AA198;
|
||||
}
|
||||
.we-chinese{
|
||||
width: 13.1953px;
|
||||
display: inline-block;
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
// miniprogram/challenge/pages/challenge/challenge.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,2 +0,0 @@
|
||||
<!--miniprogram/challenge/pages/challenge/challenge.wxml-->
|
||||
<text>miniprogram/challenge/pages/challenge/challenge.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* miniprogram/challenge/pages/challenge/challenge.wxss */
|
@ -1,24 +1,25 @@
|
||||
<view class="box" wx:if="{{SHOW_TOP}}">
|
||||
<view class='arrow'></view>
|
||||
<view class='body' bindtap='showModal'>
|
||||
<text>{{text}}</text>
|
||||
<block wx:if="{{SHOW}}">
|
||||
<view class="box" wx:if="{{SHOW_TOP}}" style="top:{{statusBarHeight+23.3}}px">
|
||||
<view class='arrow'></view>
|
||||
<view class='body' bindtap='showModal'>
|
||||
<text>{{text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- modal -->
|
||||
<view class='modal' catchtap hidden="{{!SHOW_MODAL}}">
|
||||
<view style='flex-direction: row;align-items:center;'>
|
||||
<text>1. 点击右上角按钮</text>
|
||||
<image src='cloud://educoder.6564-educoder-1300855313/images/add-tip1.png' style='width:100px;height:40px;'></image>
|
||||
</view>
|
||||
<view>
|
||||
<text>2. 点击「添加到我的小程序」</text>
|
||||
<image src='cloud://educoder.6564-educoder-1300855313/images/add-tip2.png' style='width:100%;' mode="widthFix"></image>
|
||||
</view>
|
||||
<!-- 知道了 -->
|
||||
<view class='ok-btn' hover-class='btn-hover' bindtap='okHandler'>
|
||||
<view class='modal' catchtap hidden="{{!SHOW_MODAL}}">
|
||||
<view style='flex-direction: row;align-items:center;'>
|
||||
<text>1. 点击右上角按钮</text>
|
||||
<image src='cloud://educoder.6564-educoder-1300855313/images/add-tip1.png' style='width:100px;height:40px;' mode="aspectFit"></image>
|
||||
</view>
|
||||
<view>
|
||||
<text>我知道了!</text>
|
||||
<text>2. 点击「添加到我的小程序」</text>
|
||||
<image src='cloud://educoder.6564-educoder-1300855313/images/add-tip2.png' style='width:100%;' mode="widthFix"></image>
|
||||
</view>
|
||||
|
||||
<view class='ok-btn' hover-class='btn-hover' bindtap='okHandler'>
|
||||
<view>
|
||||
<text>我知道了!</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
@ -1,4 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
"usingComponents": {},
|
||||
"navigationBarBackgroundColor": "#00b0f0",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
<view wx:if="{{message}}" class="body" style="background:{{bg}}" bindtap="onTapBody">
|
||||
<view wx:if="{{message}}" class="body" style="background:{{bg}};position:{{position}}" bindtap="onTapBody">
|
||||
<view class="info">
|
||||
<image class="image" mode="aspectFit" src="{{imgUrl}}"/>
|
||||
<view class="message">{{message||'请先登陆哦'}}</view>
|
||||
<button wx:if="{{btnText}}" class="button" catchtap="onTapButton" size="mini">{{btnText}}</button>
|
||||
<view class="message">{{message}}</view>
|
||||
<view class="buttons">
|
||||
<button wx:for="{{buttons}}" class="button" data-current="{{index}}" catchtap="onTapButton" size="mini">{{item}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
After Width: | Height: | Size: 379 B |
@ -1,5 +1,5 @@
|
||||
<scroll-view wx:if="{{list.length>1}}" scroll-x="1" class="c-container" scroll-left="{{scrollLeft}}rpx" scroll-with-animation="1" style="width:{{width}}rpx;background:{{bg}}">
|
||||
<view wx:for="{{list}}" wx:key="index" class="view common c-{{type}} {{current == index ?'active':''}}" data-current="{{index}}" bindtap="switchNav" style="margin:0 {{mg}}rpx;{{_itemWidth>0?'width:'+_itemWidth+'rpx':''}} ">
|
||||
<text class="text common c-{{type}} {{current == index ?'active':''}}">{{item.text}}</text>
|
||||
<scroll-view wx:if="{{list.length>1}}" scroll-x="1" class="navbar {{type}} bar-class" scroll-left="{{scrollLeft}}rpx" scroll-with-animation="1" style="width:{{width}}rpx;background:{{bg}}">
|
||||
<view wx:for="{{list}}" wx:key="index" class="view common {{type}} item-class {{cur == index ?'active':''}}" data-current="{{index}}" bindtap="switchNav" style="margin-right:{{mg}}rpx;{{_itemWidth>0?'width:'+_itemWidth+'rpx':''}} ">
|
||||
<text class="text common {{type}} item-class {{current == index ?'active':''}}">{{item.text}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
@ -1,3 +1,3 @@
|
||||
<navigator wx:if="{{user_id==2}}" class="nav" style="background:{{bg}}" url="/account/pages/login/login?type=login">
|
||||
点击登陆,获取更多内容
|
||||
点击登录,获取更多内容
|
||||
</navigator>
|
@ -0,0 +1,23 @@
|
||||
const app = getApp();
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
data:{
|
||||
type:Object,
|
||||
observer:function(data){
|
||||
//name, image_url
|
||||
this.setData({shixun:data});
|
||||
}
|
||||
},
|
||||
origin:String
|
||||
},
|
||||
data: {
|
||||
eduUrl:global.config.eduUrl
|
||||
},
|
||||
|
||||
methods: {
|
||||
onTap(){
|
||||
app.navigateTo({url:"{shixun}?identifier="+this.data.shixun.identifier})
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<view class="shixun" bindtap="onTap">
|
||||
<image class="shixun-img" mode="aspectFill" src="{{eduUrl}}/{{shixun.image_url}}"></image>
|
||||
<view class="detail">
|
||||
{{shixun.name}}
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,20 @@
|
||||
.shixun{
|
||||
background: white;
|
||||
padding: 10px 8px;
|
||||
overflow: hidden;
|
||||
word-wrap: break-word;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.shixun-img{
|
||||
flex:none;
|
||||
width: 250rpx;
|
||||
height: 170rpx;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.detail{
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
flex: auto;
|
||||
width: 1px;
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
<view class="question">
|
||||
<view class="hint">第{{data.q_position}}题</view>
|
||||
<rich-md c-class="title" nodes="{{data.question_title}}"/>
|
||||
<text class="hint">对不起,暂时不支持实训题 ╥﹏╥ </text>
|
||||
<view class="shixun-detail">
|
||||
<button class="button-shixun" size="mini" type="main" plain bindtap="enterShixun">进入该实训</button>
|
||||
<view>{{data.shixun_name}}</view>
|
||||
</view>
|
||||
</view>
|
@ -1 +1,14 @@
|
||||
@import "../question-common.wxss";
|
||||
@import "../question-common.wxss";
|
||||
|
||||
.shixun-detail{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.button-shixun{
|
||||
flex:none;
|
||||
}
|
||||
.shixun-name{
|
||||
padding: 0 10px;
|
||||
font-weight: bold;
|
||||
flex: auto;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data:{
|
||||
statusBarHeight:20,
|
||||
current:0,
|
||||
show:[1],
|
||||
list:[
|
||||
{text:"课堂"},
|
||||
{text:"实训"},
|
||||
//{text:"课程"}
|
||||
]
|
||||
},
|
||||
onLoad(){
|
||||
wx.getSystemInfo({
|
||||
success: res=>{
|
||||
let {statusBarHeight} = res;
|
||||
this.setData({statusBarHeight});
|
||||
},
|
||||
})
|
||||
},
|
||||
enterSearch(){
|
||||
app.navigateTo({url:"{search}"});
|
||||
},
|
||||
switchNav({target:{dataset:{current}}}){
|
||||
this.setData({current});
|
||||
this.setData({['show['+current+']']:1})
|
||||
},
|
||||
switchTab({detail:{current, source, value}}){
|
||||
console.log(current, source, value);
|
||||
if(source=="touch"){
|
||||
this.setData({ current });
|
||||
this.setData({ ['show[' + current + ']']: 1 })
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"navigationStyle":"custom",
|
||||
"usingComponents": {
|
||||
"add-tips": "/components/add-tips/add-tips",
|
||||
"my-course":"./my_course/my_course",
|
||||
"my-shixun":"./my_shixun/my_shixun"
|
||||
},
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<view class="navigation">
|
||||
<view style="height:{{statusBarHeight}}px"></view>
|
||||
<view class="navigation-bar">
|
||||
<view class="navigation-left">
|
||||
<icon class="search" type="search" size="20" color="white" bindtap="enterSearch"/>
|
||||
<text class="title">我的</text>
|
||||
</view>
|
||||
<view class="navbar" bindtap="switchNav">
|
||||
<view class="navitem {{current==index?'active':''}}" wx:for="{{list}}" data-current="{{index}}">
|
||||
{{item.text}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<swiper class="body" current="{{current}}" bindchange="switchTab" circular="1">
|
||||
<swiper-item>
|
||||
<my-course wx:if="{{show[0]}}"/>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<my-shixun wx:if="{{show[1]}}"/>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<add-tips/>
|
@ -0,0 +1,49 @@
|
||||
page{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
.navigation{
|
||||
background: #00b0f0;
|
||||
flex: none;
|
||||
}
|
||||
.navigation-bar{
|
||||
height: 44px;
|
||||
padding-right: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.navigation-left{
|
||||
width: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: white;
|
||||
}
|
||||
.search{
|
||||
padding:0 12px;
|
||||
}
|
||||
.navbar{
|
||||
flex: 1 1 1px;
|
||||
width: 1px;
|
||||
border-radius: 7px;
|
||||
display: flex;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.navitem{
|
||||
flex: auto;
|
||||
background: #00d0f0;
|
||||
color: white;
|
||||
padding: 5px 1px;
|
||||
transition: all ease 0.6s;
|
||||
}
|
||||
.navitem.active{
|
||||
color: #00b0f0;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.body{
|
||||
flex: 1 1 1px;
|
||||
height: 1px;
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
const app = getApp();
|
||||
/*
|
||||
statuses:[]
|
||||
*/
|
||||
|
||||
const getDataForRender = class_ => ({
|
||||
name: class_.get('name'),
|
||||
objectId: class_.get('objectId')
|
||||
});
|
||||
const categories = [{ text: "我学习的", value: "study" }, { text: "我管理的", value: "manage" }];
|
||||
Component({
|
||||
data: {
|
||||
imgDir: global.config.imgDir,
|
||||
categories,
|
||||
statuses: [{ text: "正在进行", value: "processing" }, { text: "已结束", value: "end" }],
|
||||
courses: [],
|
||||
status: 0,
|
||||
user: {},
|
||||
current_cate: -1
|
||||
},
|
||||
attached() {
|
||||
this.options = {page:1, limit:15};
|
||||
this.onLoad();
|
||||
},
|
||||
pageLifetimes: {
|
||||
show: function () {
|
||||
app.syncUser().then(r => {
|
||||
this.setData({ user: r.user })
|
||||
});
|
||||
if (this.data.current_cate >= 0) {
|
||||
this.pullCourses({refresh:2});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCategoryChange: function ({ detail: { current, value } }) {
|
||||
console.log("category change", current);
|
||||
this.options["category"] = value.value;
|
||||
this.pullCourses({refresh:2});
|
||||
this.setData({ category: value.value });
|
||||
},
|
||||
onStatusChange: function ({ detail: { value } }) {
|
||||
this.options["status"] = value.value;
|
||||
this.pullCourses({refresh:2});
|
||||
},
|
||||
show_join_course_modal: function (event) {
|
||||
this.setData({ show_join_course_modal: true });
|
||||
},
|
||||
|
||||
enter_course: function (event) {
|
||||
console.log(event);
|
||||
let { id, course_name } = event.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
url: "/course/pages/course/course?course_id=" + id + "&course_name=" + course_name,
|
||||
})
|
||||
},
|
||||
|
||||
pullCourses: function ({ refresh=0} = {}) {
|
||||
if(refresh){
|
||||
if(refresh==1){
|
||||
this.options.page=1;
|
||||
var {options:data}=this;
|
||||
}else if(refresh==2){
|
||||
var {limit, page, status, category}=this.options;
|
||||
var data = {limit: page*limit, page:1, status, category};
|
||||
}
|
||||
}else{
|
||||
this.options.page++;
|
||||
var {options:data}=this;
|
||||
}
|
||||
return app.callApi({
|
||||
name: "weapps.home", data,
|
||||
complete: () => { this.setData({ loading: false }) }
|
||||
})
|
||||
.then(res => {
|
||||
let { courses } = res;
|
||||
if (data.status)
|
||||
courses = courses.filter(i => {
|
||||
return i.is_end == (status == "end")
|
||||
});
|
||||
console.log(courses);
|
||||
if(!refresh)
|
||||
courses = this.data.courses.concat(courses);
|
||||
this.setData({ courses });
|
||||
}).catch(e => {
|
||||
this.setData({ courses: [] });
|
||||
});
|
||||
},
|
||||
onLoad: function (options) {
|
||||
console.log(app.user());
|
||||
if (app.user().is_teacher)
|
||||
var current_cate = 1;
|
||||
else
|
||||
var current_cate = 0;
|
||||
this.setData({ current_cate });
|
||||
},
|
||||
onReachBottom(){
|
||||
this.pullCourses();
|
||||
},
|
||||
onPullDownRefresh: function () {
|
||||
//console.log("pulldownrefresh");
|
||||
this.pullCourses({refresh:2});
|
||||
},
|
||||
}
|
||||
})
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"join-course-modal": "/components/modal/join-course/join-course",
|
||||
"require-login": "/components/require-login/require-login",
|
||||
"nav-bar": "/components/nav-bar/nav-bar",
|
||||
"course-item": "/components/course-item/course-item"
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<view class="my-course">
|
||||
<require-login user_id="{{user.user_id}}"/>
|
||||
<nav-bar list="{{categories}}" current="{{current_cate}}" bindchange="onCategoryChange"/>
|
||||
<view class="nav-wrap">
|
||||
<nav-bar list="{{statuses}}" width="300" itemWidth="140" cancellable="1" current="-1" type="plain" bg='' bindchange="onStatusChange"/>
|
||||
</view>
|
||||
<scroll-view scroll-y="1" refresher-enabled="1" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom" lower-threshold="120" bindrefresh="onPullDownRefresh" class="body">
|
||||
<view hidden="{{courses.length!=0 || loading}}" class="none-content">
|
||||
<image class="none-content" src="{{imgDir}}blank1.png" mode="aspectFit"></image>
|
||||
<text class="none-content hint">空空如也!</text>
|
||||
</view>
|
||||
<view wx:for="{{courses}}" wx:key="id" class="course-wrap">
|
||||
<course-item data="{{item}}" category="{{category}}"/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- {{imgDir}}add.png -->
|
||||
<image class="add-course" src="{{imgDir}}add.png" bindtap="show_join_course_modal"></image>
|
||||
<join-course-modal hidden="{{!show_join_course_modal}}"/>
|
||||
</view>
|
@ -0,0 +1,41 @@
|
||||
const app = getApp();
|
||||
Component({
|
||||
properties: {
|
||||
|
||||
},
|
||||
|
||||
data: {
|
||||
shixuns:[]
|
||||
},
|
||||
attached(){
|
||||
this.options = {page:0, per_page:16};
|
||||
this.pullShixuns();
|
||||
//console.log(this.options)
|
||||
},
|
||||
methods: {
|
||||
async pullShixuns({refresh=0}={}){
|
||||
if(refresh){
|
||||
if(refresh==1){
|
||||
this.options.page = 1;
|
||||
var { options } = this;
|
||||
}else if(refresh==2){
|
||||
var {page, per_page} = this.options;
|
||||
var options = {page:1, per_page: page*per_page};
|
||||
}
|
||||
}else{
|
||||
this.options.page++;
|
||||
var {options} = this;
|
||||
}let {shixuns} = await app.api("users.shixuns")(options);
|
||||
if(!refresh)
|
||||
shixuns = this.data.shixuns.concat(shixuns);
|
||||
this.setData({shixuns});
|
||||
return shixuns;
|
||||
},
|
||||
onPullDownRefresh(){
|
||||
this.pullShixuns({refresh:2});
|
||||
},
|
||||
onReachBottom(){
|
||||
this.pullShixuns({refresh:0});
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"nav-bar": "/components/nav-bar/nav-bar",
|
||||
"shixun-item":"/components/shixun-item/shixun-item"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<view class="my-shixun">
|
||||
<scroll-view class="body" scroll-y="!" refresher-enabled="1" lower-threshold="120" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom">
|
||||
<view class="shixun-wrap" wx:for="{{shixuns}}" wx:key="id">
|
||||
<shixun-item data="{{item}}"/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
@ -0,0 +1,14 @@
|
||||
.my-shixun{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.shixun-wrap{
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
.body{
|
||||
flex:1 1 1px;
|
||||
height: 1px;
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
const app = getApp();
|
||||
/*
|
||||
statuses:[]
|
||||
*/
|
||||
|
||||
const getDataForRender = class_ => ({
|
||||
name: class_.get('name'),
|
||||
objectId: class_.get('objectId')
|
||||
});
|
||||
const categories= [{ text: "我学习的", value: "study" }, { text: "我管理的", value: "manage" }];
|
||||
Page({
|
||||
options:{},
|
||||
data: {
|
||||
imgDir:global.config.imgDir,
|
||||
categories,
|
||||
statuses: [{ text:"正在进行", value:"processing"},{text:"已结束",value:"end"}],
|
||||
courses: [],
|
||||
status:0,
|
||||
user:{},
|
||||
current_cate:-1
|
||||
},
|
||||
presences: [],
|
||||
classes: [],
|
||||
|
||||
onCategoryChange: function({detail:{current,value}}){
|
||||
this.options["category"] = value.value;
|
||||
if(current>=0)
|
||||
this.pull_courses(this.options);
|
||||
this.setData({ category: value.value });
|
||||
},
|
||||
onStatusChange: function ({detail: {value} }){
|
||||
this.options["status"] = value.value;
|
||||
this.pull_courses(this.options);
|
||||
},
|
||||
show_join_course_modal: function (event) {
|
||||
this.setData({ show_join_course_modal: true });
|
||||
},
|
||||
|
||||
enter_course: function(event){
|
||||
console.log(event);
|
||||
let {id, course_name} = event.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
url: "/course/pages/course/course?course_id="+id+"&course_name="+course_name,
|
||||
})
|
||||
},
|
||||
|
||||
pull_courses: function({category="",status=""}={}){
|
||||
app.callApi({name:"weapps.home",data:{
|
||||
category: category,
|
||||
status: status},
|
||||
complete:()=>{this.setData({loading:false})}
|
||||
})
|
||||
.then(res=>{
|
||||
//console.log(res);
|
||||
let {courses} = res;
|
||||
if(status)
|
||||
courses = courses.filter(i=>{
|
||||
return i.is_end==(status=="end")
|
||||
})
|
||||
this.setData({courses});
|
||||
}).catch(e=>{
|
||||
this.setData({courses:[]});
|
||||
console.error
|
||||
});
|
||||
//console.log(this.data);
|
||||
},
|
||||
onLoad: function (options) {
|
||||
console.log(app.user());
|
||||
if(app.user().is_teacher)
|
||||
var current_cate = 1;
|
||||
else
|
||||
var current_cate = 0;
|
||||
this.setData({current_cate});
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
app.syncUser().then(r => {
|
||||
this.setData({ user: r.user })
|
||||
});
|
||||
if(this.data.current_cate>=0){
|
||||
this.pull_courses(this.options);
|
||||
}
|
||||
},
|
||||
|
||||
onPullDownRefresh: function () {
|
||||
this.pull_courses(this.options);
|
||||
},
|
||||
onShareAppMessage: function () {
|
||||
return app.shareApp();
|
||||
}
|
||||
})
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的课程",
|
||||
"usingComponents": {
|
||||
"add-tips":"/components/add-tips/add-tips",
|
||||
"join-course-modal":"/components/modal/join-course/join-course",
|
||||
"require-login":"/components/require-login/require-login",
|
||||
"nav-bar":"/components/nav-bar/nav-bar",
|
||||
"course-item":"/components/course-item/course-item"
|
||||
},
|
||||
"enablePullDownRefresh": true
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<require-login user_id="{{user.user_id}}"/>
|
||||
<nav-bar list="{{categories}}" current="{{current_cate}}" bindchange="onCategoryChange"/>
|
||||
<view class="nav-wrap">
|
||||
<nav-bar list="{{statuses}}" width="300" itemWidth="140" cancellable="1" current="-1" type="plain" bg='' bindchange="onStatusChange"/>
|
||||
</view>
|
||||
<scroll-view scroll-y="1" refresher-enabled="1" bindrefresherrefresh="onPullDownRefresh" class="body">
|
||||
<view class="container" bindrefresh="onPullDownRefresh">
|
||||
<view hidden="{{courses.length!=0 || loading}}" class="none-content">
|
||||
<image class="none-content" src="{{imgDir}}blank1.png" mode="aspectFit"></image>
|
||||
<text class="none-content hint">空空如也!</text>
|
||||
</view>
|
||||
<view wx:for="{{courses}}" wx:key="id" class="course-wrap">
|
||||
<course-item data="{{item}}" category="{{category}}"/>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- {{imgDir}}add.png -->
|
||||
<image class="add-course" src="{{imgDir}}add.png" bindtap="show_join_course_modal"></image>
|
||||
|
||||
<add-tips/>
|
||||
<join-course-modal hidden="{{!show_join_course_modal}}"/>
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的",
|
||||
"navigationBarTitleText": "个人中心",
|
||||
"enablePullDownRefresh": false,
|
||||
"usingComponents": {
|
||||
"join-course-modal": "/components/modal/join-course/join-course"
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
.nav {
|
||||
font-size: 16px;
|
||||
background: white;
|
@ -0,0 +1,22 @@
|
||||
const app = getApp();
|
||||
Component({
|
||||
properties: {
|
||||
data:Object
|
||||
},
|
||||
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
enterPage(){
|
||||
let {type} = this.data.data;
|
||||
switch(type){
|
||||
case 'shixun':
|
||||
return app.navigateTo({ url: "{shixun}?identifier=" + this.data.data.identifier});
|
||||
case "course":
|
||||
return app.navigateTo({url:"{course}?course_id="+this.data.data.id});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"rich-md":"/components/rich-md/rich-md"
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<view class="search-item" bindtap="enterPage">
|
||||
<view class="title-wrap">
|
||||
<rich-text class="title" nodes="{{data.title}}"></rich-text>
|
||||
</view>
|
||||
<view wx:for="{{data.content}}" class="content-wrap">
|
||||
<rich-text class="content" nodes="{{item[0]}}"></rich-text>
|
||||
</view>
|
||||
<view class="detail">
|
||||
<text>{{data.author_name}}</text>
|
||||
<text>{{data.author_school_name}}</text>
|
||||
<text wx:if="{{data.type=='course'}}">成员数:{{data.members_count}}</text>
|
||||
<text wx:if="{{data.type=='shixun'}}">学习人数:{{data.study_count}}</text>
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,26 @@
|
||||
.highlight{
|
||||
color: #00a0f0;
|
||||
}
|
||||
.search-item{
|
||||
background: white;
|
||||
padding: 10px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.title-wrap{
|
||||
font-weight: bolder;
|
||||
font-size: 20px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
.content-wrap{
|
||||
margin: 4px 0;
|
||||
}
|
||||
.detail{
|
||||
padding: 8px 0 4px 0;
|
||||
display: flex;
|
||||
font-size: 13px;
|
||||
color: dimgray;
|
||||
}
|
||||
.detail>text{
|
||||
margin-right: 12px;
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
type_text:"实训项目",
|
||||
list:[
|
||||
{text:"实训项目", type:"shixun"},
|
||||
{text:"教学课堂", type:"course"}
|
||||
]
|
||||
},
|
||||
onTypeChange({detail:{current, value}}){
|
||||
this.options.type = value.type;
|
||||
this.setData({type_text: value.text});
|
||||
this.search({refresh:1});
|
||||
},
|
||||
onSubmit({detail:{value}}){
|
||||
this.options.keyword = value.keyword;
|
||||
this.search({refresh:1});
|
||||
},
|
||||
onConfirm({detail:{value}}){
|
||||
this.options.keyword = value;
|
||||
this.search({refresh:1});
|
||||
},
|
||||
search({refresh=0}={}){
|
||||
if(refresh==1)
|
||||
this.setData({loading:1});
|
||||
if(refresh){
|
||||
if(refresh==1){
|
||||
this.options.page = 1;
|
||||
var {options} = this;
|
||||
}else if(refresh==2){
|
||||
var {page,per_page,type, keyword} = this.options;
|
||||
var options = {page:1, per_page:page*per_page, type, keyword};
|
||||
}
|
||||
}else{
|
||||
this.options.page++;
|
||||
var {options} = this;
|
||||
}
|
||||
return app.api("search")(options)
|
||||
.then(res=>{
|
||||
let {results,count} = res;
|
||||
if(refresh==1&&results.length==0)
|
||||
wx.showToast({
|
||||
title: '没有找到相关内容',icon:"none"
|
||||
});
|
||||
if(!refresh)
|
||||
results = this.data.results.concat(results);
|
||||
this.setData({count, results, loading:0});
|
||||
})
|
||||
.catch(e=>{
|
||||
console.error(e);
|
||||
this.setData({loading:0});
|
||||
})
|
||||
},
|
||||
onLoad: function (options) {
|
||||
this.options = {page:1, per_page:20, type:"shixun"};
|
||||
this.search({refresh:1});
|
||||
},
|
||||
|
||||
|
||||
_onReachBottom: function () {
|
||||
this.search({refresh:0});
|
||||
},
|
||||
|
||||
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"nav-bar":"/components/nav-bar/nav-bar",
|
||||
"search-item":"./search-item/search-item"
|
||||
},
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#0080f0",
|
||||
"navigationBarTitleText": "搜索"
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<page-meta>
|
||||
<navigation-bar title="搜索{{type_text}}" loading="{{loading}}"/>
|
||||
</page-meta>
|
||||
<form class="header" bindsubmit="onSubmit">
|
||||
<view class="search">
|
||||
<input name="keyword" auto-focus="1" bindconfirm="onConfirm" confirm-type="search"/>
|
||||
<button form-type="submit" type="main" size="mini">
|
||||
<view class="button-inner">
|
||||
<icon type="search" color="white" size="17"/>
|
||||
搜索
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
</form>
|
||||
<nav-bar list="{{list}}" bindchange="onTypeChange"/>
|
||||
<scroll-view class="body" scroll-y="1" lower-threshold="160" bindscrolltolower="_onReachBottom">
|
||||
<view wx:for="{{results}}" class="search-item-wrap">
|
||||
<search-item data="{{item}}"/>
|
||||
</view>
|
||||
</scroll-view>
|
@ -0,0 +1,43 @@
|
||||
page{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
.body{
|
||||
flex: 1 1 1px;
|
||||
height: 1px;
|
||||
}
|
||||
.header{
|
||||
background: #0080f0;
|
||||
}
|
||||
.search{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #0080f0;
|
||||
margin: 6px 20px;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
.search>input{
|
||||
flex: auto;
|
||||
padding: 2px 8px;
|
||||
background: white;
|
||||
|
||||
}
|
||||
.search>button{
|
||||
flex: none;
|
||||
border:none;
|
||||
}
|
||||
.button-inner{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.button-inner>icon{
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
.search-item-wrap{
|
||||
margin: 6px 8px;
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"tiding-item":"/components/tiding-item/tiding-item"
|
||||
"tiding-item":"/components/tiding-item/tiding-item",
|
||||
"nav-bar":"/components/nav-bar/nav-bar",
|
||||
"error-page":"/components/error-page/error-page"
|
||||
},
|
||||
"navigationBarTitleText": "消息中心"
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
<view class="tiding-wrap" wx:for="{{tidings}}" wx:key="id">
|
||||
<tiding-item data="{{item}}"/>
|
||||
</view>
|
||||
<nav-bar bar-class="navbar" current="-1" list="{{list}}" cancellable="1" itemWidth="0" type="cap" bg="transparent" mg="8" bindchange="changeType"/>
|
||||
<scroll-view class="tidings" refresher-enabled="1" scroll-y="1" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="_onReachBottom" lower-threshold="120">
|
||||
<view class="tiding-wrap" wx:for="{{tidings}}" wx:key="id">
|
||||
<tiding-item data="{{item}}"/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
|
@ -1,3 +1,16 @@
|
||||
.navbar{
|
||||
margin-top: 4px;
|
||||
flex: none;
|
||||
}
|
||||
.tiding-wrap{
|
||||
margin: 4px 0;
|
||||
margin-top: 6px;
|
||||
}
|
||||
page{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
.tidings{
|
||||
flex: 1 1 1px;
|
||||
height: 1px;
|
||||
}
|
@ -1,23 +1,14 @@
|
||||
// shixun/components/challenge-item/challenge-item.js
|
||||
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
|
||||
data:Object
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -1,2 +1,13 @@
|
||||
<!--shixun/components/challenge-item/challenge-item.wxml-->
|
||||
<text>shixun/components/challenge-item/challenge-item.wxml</text>
|
||||
<view class="challenge">
|
||||
<view class="header">
|
||||
<text class="position">第{{data.position}}关</text>
|
||||
</view>
|
||||
<view class="name">
|
||||
<text>{{data.name}}</text>
|
||||
</view>
|
||||
<view class="detail">
|
||||
<text>{{data.playing_count}}人正在挑战</text>
|
||||
<text>{{data.passed_count}}人完成挑战</text>
|
||||
<text></text>
|
||||
</view>
|
||||
</view>
|
@ -1 +1,18 @@
|
||||
/* shixun/components/challenge-item/challenge-item.wxss */
|
||||
.challenge{
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid lightgrey;
|
||||
}
|
||||
.position{
|
||||
font-size: 12px;
|
||||
color: dimgray;
|
||||
}
|
||||
.detail{
|
||||
padding-top: 6px;
|
||||
font-size: 13px;
|
||||
color: dimgrey
|
||||
}
|
||||
.detail>text{
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,11 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {
|
||||
"rich-md":"/components/rich-md/rich-md",
|
||||
"require-login":"/components/require-login/require-login",
|
||||
"challenge-item":"/shixun/components/challenge-item/challenge-item",
|
||||
"nav-bar":"/components/nav-bar/nav-bar"
|
||||
},
|
||||
"navigationBarBackgroundColor": "#0080f0",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarTitleText": "实训详情"
|
||||
}
|
@ -1,2 +1,48 @@
|
||||
<!--miniprogram/shixun/pages/shixun/shixun.wxml-->
|
||||
<text>miniprogram/shixun/pages/shixun/shixun.wxml</text>
|
||||
<page-meta>
|
||||
<navigation-bar title="{{shixun.name}}"/>
|
||||
</page-meta>
|
||||
<wxs src="./shixun.wxs" module="handler"/>
|
||||
<require-login bg="#0080f0" user_id="{{user.user_id}}"/>
|
||||
<view class="header">
|
||||
<view class="shixun-title">{{shixun.name}}</view>
|
||||
<view class="shixun-detail">
|
||||
<view>
|
||||
<view class="detail-key">学习人数</view>
|
||||
<view class="detail-value">{{shixun.stu_num}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="detail-key">难度级别</view>
|
||||
<view class="detail-value">{{shixun.diffcult}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="detail-key">经验值</view>
|
||||
<view class="detail-value">{{shixun.experience}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nav-bar list="{{list}}" current="{{current}}" type="line" bindchange="switchNav"/>
|
||||
<swiper class="body" current="{{current}}" bindchange="switchNav" circular="1">
|
||||
<swiper-item>
|
||||
<scroll-view class="scroll-body" scroll-y="{{1}}" bindscroll="{{handler.scroll}}">
|
||||
<rich-md my-class="desp" nodes="{{description}}" type="markdown"/>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<scroll-view class="scroll-body" scroll-y="1" bindscroll="{{handler.scroll}}">
|
||||
<view class="cate">
|
||||
<view class="cate-header">
|
||||
<text class="square"/>
|
||||
<text class="cate-name">全部任务</text>
|
||||
</view>
|
||||
<view class="challenges">
|
||||
<view class="challenge-wrap" wx:for="{{challenges}}" wx:key="challenge_id">
|
||||
<challenge-item data="{{item}}"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="operations">
|
||||
<button bindtap="enterChallenge" type="main">{{shixun.task_operation[0]}}</button>
|
||||
</view>
|
@ -0,0 +1,15 @@
|
||||
var top = 126;
|
||||
function scroll(e, ins){
|
||||
var scrollTop = e.detail.scrollTop;
|
||||
var deltaY = e.detail.deltaY;
|
||||
//console.log(scrollTop);
|
||||
//console.log(show,scrollTop<122);
|
||||
console.log(top,scrollTop, deltaY);
|
||||
if(deltaY<0){
|
||||
ins.callMethod("scrollTo", { scrollTop: top });
|
||||
}
|
||||
}
|
||||
|
||||
module.exports={
|
||||
scroll: scroll
|
||||
}
|
@ -1 +1,77 @@
|
||||
/* miniprogram/shixun/pages/shixun/shixun.wxss */
|
||||
.header{
|
||||
text-align: center;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
height: 120px;
|
||||
background: white;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.shixun-title{
|
||||
background: #0080f0;
|
||||
font-weight: bolder;
|
||||
padding-top: 6px;
|
||||
font-size: 20px;
|
||||
color: white;
|
||||
height: 80px;
|
||||
width: 100%;
|
||||
}
|
||||
.shixun-detail{
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
height: 70px;
|
||||
background:white;
|
||||
box-shadow: 3px 3px 10px #e7e7e7;
|
||||
display: flex;
|
||||
border-radius: 6px;
|
||||
width: 600rpx;
|
||||
}
|
||||
.shixun-detail>view{
|
||||
flex:auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.shixun-detail>view>view{
|
||||
flex: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.detail-key{
|
||||
color: dimgrey;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.cate{
|
||||
margin-top: 3px;
|
||||
background: white;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cate-header{
|
||||
padding: 8px 8px 0px 8px;
|
||||
}
|
||||
.square{
|
||||
width: 0;
|
||||
height: 0px;
|
||||
border-radius: 10px;
|
||||
border-left: 5px solid #00b0f0;
|
||||
}
|
||||
.cate-name{
|
||||
padding: 0 10px;
|
||||
}
|
||||
.body{
|
||||
height: calc(100vh - 80px);
|
||||
margin-top: 2px;
|
||||
margin-bottom: 46px;
|
||||
}
|
||||
.scroll-body{
|
||||
height: 100%;
|
||||
background: white;
|
||||
}
|
||||
.operations{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left:0;
|
||||
right:0;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
data:{
|
||||
type:Object,
|
||||
observer:function(){
|
||||
this.analyse();
|
||||
}
|
||||
},
|
||||
index: Number
|
||||
},
|
||||
data: {
|
||||
hidden:true,
|
||||
scrollTop1:0,
|
||||
scrollTop2:0
|
||||
},
|
||||
methods: {
|
||||
analyse(){
|
||||
//console.log(this.data);
|
||||
var outputs = this.data.data.output.split(/\n/).map(i=>({text:i}));
|
||||
var actual_outputs = this.data.data.actual_output.split(/\n/).map(i=>({text:i}));
|
||||
var lines = Math.min(outputs.length, actual_outputs.length);
|
||||
for(var i=0;i<lines;i++){
|
||||
if(outputs[i].text!=actual_outputs[i].text){
|
||||
actual_outputs[i].class = outputs[i].class = "different";
|
||||
}
|
||||
}
|
||||
this.setData({outputs, actual_outputs});
|
||||
//console.log(outputs);
|
||||
},
|
||||
scroll1({scrollTop1}){
|
||||
this.setData({scrollTop1});
|
||||
},
|
||||
scroll2({scrollTop2}){
|
||||
this.setData({scrollTop2});
|
||||
},
|
||||
onTapHeader(){
|
||||
var {hidden} = this.data;
|
||||
hidden = !this.data.data.is_public||!hidden;
|
||||
this.setData({hidden});
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<wxs module="handler" src="./test_set.wxs"/>
|
||||
<view class="test-set">
|
||||
<view class="header" bindtap="onTapHeader">
|
||||
<view class="triangle {{!hidden?'rotate':''}}"></view>
|
||||
<text>测试集 {{index+1}}</text>
|
||||
<text class="warn" wx:if="{{!data.is_public}}">(隐藏)</text>
|
||||
<text class="error" wx:if="{{!data.result}}">未通过</text>
|
||||
</view>
|
||||
<view class="detail {{hidden?'hidden':''}}">
|
||||
<view class="input">
|
||||
<view>测试输入: <text class="tip">{{data.input}}</text></view>
|
||||
</view>
|
||||
<view class="output">
|
||||
<view class="subtitle">预期输出</view>
|
||||
<scroll-view class="output-info" scroll-y="1" bindscroll="{{handler.scroll1}}" scroll-top="{{scrollTop1}}">
|
||||
<view bindtouchstart="{{handler.touch1}}">
|
||||
<view wx:for="{{outputs}}" class="output-line {{item.class}}">{{item.text}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="actual-output">
|
||||
<view class="subtitle">实际输出</view>
|
||||
<scroll-view class="output-info" scroll-y="1" bindscroll="{{handler.scroll2}}" scroll-top="{{scrollTop2}}">
|
||||
<view bindtouchstart="{{handler.touch2}}">
|
||||
<view wx:for="{{actual_outputs}}" class="output-line {{item.class}}">{{item.text}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,32 @@
|
||||
var touch = 0;
|
||||
function scroll1(e,ins){
|
||||
if(touch==1){
|
||||
var scrollTop = e.detail.scrollTop;
|
||||
ins.callMethod("scroll2", { scrollTop2: scrollTop});
|
||||
//console.log("scroll2");
|
||||
}
|
||||
}
|
||||
function scroll2(e, ins) {
|
||||
if(touch==2){
|
||||
var scrollTop = e.detail.scrollTop;
|
||||
ins.callMethod("scroll1", { scrollTop1: scrollTop });
|
||||
//console.log("scroll1");
|
||||
}
|
||||
}
|
||||
function touch1(e,ins){
|
||||
//console.log("touch1");
|
||||
touch = 1;
|
||||
}
|
||||
function touch2(e, ins) {
|
||||
//console.log("touch2");
|
||||
touch = 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
scroll1: scroll1,
|
||||
scroll2: scroll2,
|
||||
touch1:touch1,
|
||||
touch2:touch2
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
.test-set{
|
||||
color: lightgray;
|
||||
background: #1f2f3b;
|
||||
border-radius: 3.6px;
|
||||
padding: 8px;
|
||||
}
|
||||
.header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.header>text{
|
||||
margin-right: 10px;
|
||||
}
|
||||
.triangle{
|
||||
height: 0px;
|
||||
width: 0px;
|
||||
border-top: solid 4px transparent;
|
||||
border-bottom: solid 4px transparent;
|
||||
border-left: solid 5px white;
|
||||
transition: 1s ease all;
|
||||
margin: 2px 6px 2px 4px;
|
||||
}
|
||||
.rotate{
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.input{
|
||||
padding: 2px 0px;
|
||||
color: #cecece;
|
||||
font-size: 15px;
|
||||
}
|
||||
.error{
|
||||
color: #FF4736
|
||||
}
|
||||
.warn{
|
||||
color: #ff6800;
|
||||
}
|
||||
.tip{
|
||||
color: #00b0f0;
|
||||
}
|
||||
.subtitle{
|
||||
text-align: center;
|
||||
padding: 2.6px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.detail{
|
||||
transition: 0.8s all ease;
|
||||
}
|
||||
.output-info{
|
||||
background: #111c24;
|
||||
max-height: 106px;
|
||||
margin: 4px 0;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.output-line{
|
||||
white-space: pre;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.hidden{
|
||||
height: 0px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.different{
|
||||
background: #9a6868;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue