迁移暂提交

master
educoder_weapp 5 years ago
parent b686679013
commit d99d73f1a1

@ -0,0 +1,38 @@
const app = getApp();
Page({
data: {
imgDir: global.config.imgDir,
action:"login"
},
log(e){
console.log(e);
},
onLoad: function (options) {
let {action="login"} = options;
this.setData({action});
},
onShow: function () {
},
onHide: function () {
},
onUnload: function () {
},
onPullDownRefresh: function () {
},
onReachBottom: function () {
},
onShareAppMessage: function () {
}
})

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

@ -0,0 +1,41 @@
<page-meta>
<navigation-bar title=""/>
</page-meta>
<view class="container">
<image class="login" src="{{imgDir}}educoder.png" mode="aspectFit"></image>
<form class="account-form" bindsubmit="log">
<view class="inputs">
<view class="input-wrap">
<input placeholder="邮箱或手机号">
</input>
</view>
<view class="input-wrap {{action!='login'?'':'hidden'}}">
<input placeholder="验证码">
</input>
<button class="obtain-code">
获取验证码
</button>
</view>
<view class="input-wrap">
<input placeholder="请输入密码">
</input>
</view>
<view class="input-wrap {{action!='login'?'':'hidden'}}">
<input placeholder="请再次输入密码">
</input>
</view>
</view>
<view class="actions">
<button id="reset" bindtap="onTapReset" form-type="submit">重置密码</button>
<button id="login" bindtap="onTapLogin" form-type="submit">登录</button>
<button id="register" bindtap="onTapRegister">注册</button>
</view>
</form>
</view>

@ -0,0 +1,16 @@
.input-wrap{
transition: 1s all ease;
max-height: 50px;
display: flex;
margin: 0 24px;
overflow: hidden;
}
.input-wrap>input{
padding: 4px 10px;
border-radius: 4px;
border: 1px lightblue
}
.hidden{
max-height: 0px;
}

@ -12,6 +12,5 @@
} }
.buttons>button{ .buttons>button{
margin: 0 10px; margin-top: 10px;
transform: scale(0.72);
} }

@ -72,20 +72,6 @@ Page({
this.setData({login,password}); this.setData({login,password});
this.login(); this.login();
}, },
pull_test: function(){
// let query = new AV.Query("MetaData");
// query.find().then(metadatas=>{
// this.setData({metadata: metadatas[0].toJSON()})
// });
// let test_query = new AV.Query("TestAccount")
// test_query.find()
// .then(accounts=>{
// this.setData(jsonify({accounts}));
// })
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) { onLoad: function (options) {
if(options.login){ if(options.login){
this.setData({login: options.login}) this.setData({login: options.login})

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

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

@ -0,0 +1,2 @@
<!--miniprogram/account/pages/profile/profile.wxml-->
<text>miniprogram/account/pages/profile/profile.wxml</text>

@ -0,0 +1 @@
/* miniprogram/account/pages/profile/profile.wxss */

@ -33,7 +33,8 @@ App({
wx.getSystemInfo({ wx.getSystemInfo({
success: res=> { success: res=> {
let { platform, system} = res; let { platform, system} = res;
if(platform=="ios"&&platform!="devtools"||system&&system.toLowerCase().indexOf("ios")!=-1){ if(platform=="ios"||system&&system.toLowerCase().indexOf("ios")!=-1){
if (platform == "devtools") return;
wx.request({ wx.request({
url:"https://www.educoder.net/api/accounts/login.json?randomcode=1584017867&client_key=09478441ace530a43e99187a4c9b6d8c", url:"https://www.educoder.net/api/accounts/login.json?randomcode=1584017867&client_key=09478441ace530a43e99187a4c9b6d8c",
method:"POST", method:"POST",
@ -55,7 +56,8 @@ App({
}) })
}, },
onShow(){ onShow(){
client.getTidingInfo(); if(client.user_id&&client.user_id!=2)
client.getTidingInfo();
}, },
onPageNotFound(res) { onPageNotFound(res) {
console.log("page not find!! redirect",res); console.log("page not find!! redirect",res);

@ -9,10 +9,8 @@
"pages": [ "pages": [
"pages/main/main", "pages/main/main",
"pages/findmore/findmore", "pages/findmore/findmore",
"pages/courses/courses", "pages/home/home",
"pages/profile/profile",
"pages/tidings/tidings", "pages/tidings/tidings",
"path/pages/path/path",
"components/rich-md/rich-md" "components/rich-md/rich-md"
], ],
"subpackages": [ "subpackages": [
@ -25,7 +23,9 @@
"pages/agreement/agreement", "pages/agreement/agreement",
"pages/about/about", "pages/about/about",
"pages/test/test", "pages/test/test",
"pages/change_password/change_password" "pages/change_password/change_password",
"pages/profile/profile",
"pages/account/account"
] ]
}, },
{ {
@ -70,7 +70,13 @@
] ]
}, },
{ {
"name":"search", "root": "path",
"pages": [
"pages/path/path"
]
},
{
"name": "search",
"root": "pages/search", "root": "pages/search",
"pages": [ "pages": [
"search" "search"
@ -78,7 +84,7 @@
} }
], ],
"preloadRule": { "preloadRule": {
"pages/profile/profile": { "pages/home/home": {
"network": "all", "network": "all",
"packages": [ "packages": [
"avatar", "avatar",
@ -101,14 +107,13 @@
"account" "account"
] ]
}, },
"shixun/pages/shixun/shixun":{ "shixun/pages/shixun/shixun": {
"network":"all", "network": "all",
"packages":[ "packages": [
"task" "task"
] ]
} }
}, },
"tabBar": { "tabBar": {
"selectedColor": "#1890ff", "selectedColor": "#1890ff",
"color": "#8a8a8a", "color": "#8a8a8a",
@ -126,13 +131,22 @@
"selectedIconPath": "images/tab_tiding_pressed.png" "selectedIconPath": "images/tab_tiding_pressed.png"
}, },
{ {
"pagePath": "pages/profile/profile", "pagePath": "pages/findmore/findmore",
"text": "发现",
"iconPath": "images/tab_findmore_default.png",
"selectedIconPath": "images/tab_findmore_pressed.png"
},
{
"pagePath": "pages/home/home",
"iconPath": "images/tab_my_default.png", "iconPath": "images/tab_my_default.png",
"selectedIconPath": "images/tab_my_pressed.png", "selectedIconPath": "images/tab_my_pressed.png",
"text": "个人中心" "text": "个人中心"
} }
] ]
}, },
"navigateToMiniProgramAppIdList":["wx2402d86a6b534f77"], "navigateToMiniProgramAppIdList": [
"sitemapLocation": "sitemap.json" "wx2402d86a6b534f77"
],
"sitemapLocation": "sitemap.json",
"style": "v2"
} }

@ -35,7 +35,15 @@ button.button-main{background:#00b0f0}
.border-main{border-color:#00b0f0} .border-main{border-color:#00b0f0}
.flex-col,.flex-row{display: flex} .flex-col,.flex-row{display: flex}
.flex-col{flex-direction: column} .flex-col{flex-direction: column}
.fl{float:left}
.fr{float:right}
.p4{padding:4px}
.p8{padding:8px}
.p12{padding:12px}
.m4{margin:4px}
.m8{margin:8px}
.m12{margin:12px}
.color-white{color: white}
.single-line{ .single-line{
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow:ellipsis;

@ -5,6 +5,19 @@ Component({
hidden:{ hidden:{
type:Boolean, type:Boolean,
value: true, value: true,
observer:function(hidden){
if(!hidden){
wx.getClipboardData({
success:res=>{
if(!res.data||res.data==this.clipboardData) return;
this.clipboardData = res.data;
var match = res.data.match(/[A-Z0-9]{5,6}/);
if(match)
this.setData({invite_code: match[0]});
}
})
}
}
}, },
show_code:{ show_code:{
type:Number, type:Number,

@ -1,10 +1,13 @@
const cloudDir = "cloud://educoder.6564-educoder-1300855313/"; const cloudDir = "cloud://educoder.6564-educoder-1300855313/";
const eduUrl = "https://www.educoder.net"; const eduUrl = "https://www.educoder.net";
/** /**
* * A 剪切板邀请码自动读取
* A 首页点击搜索自动进入所在模块相应类目
* F 进入搜索页面nav标题错误
* F 登录后我的实训不自动刷新
*/ */
module.exports = global.config = { module.exports = global.config = {
version:"0.12.1", version:"0.12.2",
apiRoot:eduUrl+"/api/", apiRoot:eduUrl+"/api/",
cloudDir, cloudDir,
eduUrl, eduUrl,

@ -38,9 +38,9 @@
</view> </view>
</view> </view>
<view class="course-buttons color-main" bindtap="switchRole"> <view class="course-buttons color-main" bindtap="switchRole">
<button wx:if="{{course.switch_to_student}}" data-role="student">切换为学生</button> <button wx:if="{{course.switch_to_student}}" size="mini" data-role="student">切换为学生</button>
<button wx:if="{{course.switch_to_assistant}}" data-role="assistant">切换为助教</button> <button wx:if="{{course.switch_to_assistant}}" size="mini" data-role="assistant">切换为助教</button>
<button wx:if="{{course.switch_to_teacher}}" data-role="teacher">切换为老师</button> <button wx:if="{{course.switch_to_teacher}}" size="mini" data-role="teacher">切换为老师</button>
</view> </view>
</view> </view>
<view wx:if="{{course.is_admin}}" class="course-footer"> <view wx:if="{{course.is_admin}}" class="course-footer">
@ -61,7 +61,7 @@
<view bindtouchstart="{{handler.touchsHeader}}" bindtouchmove="{{handler.touchmBody}}" bindtouchend="{{handler.toucheBody}}" class="module-container"> <view bindtouchstart="{{handler.touchsHeader}}" bindtouchmove="{{handler.touchmBody}}" bindtouchend="{{handler.toucheBody}}" class="module-container">
<attachment wx:if="{{module.type=='attachment'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/> <attachment wx:if="{{module.type=='attachment'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/>
<exercise wx:elif="{{module.type=='exercise'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/> <exercise wx:elif="{{module.type=='exercise'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/>
<!--common-homework wx:elif="{{module.type=='common_homework'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/--> <common-homework wx:elif="{{module.type=='common_homework'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/>
<view wx:else class="empty"> <view wx:else class="empty">
由于技术限制<br></br>小程序端暂不提供[{{module.name}}]模块,请进入官方网站操作 由于技术限制<br></br>小程序端暂不提供[{{module.name}}]模块,请进入官方网站操作
</view> </view>

@ -127,15 +127,14 @@ users:{
avatar:{url:"{login}/*",query, form:{image:null} ,config:{method:"PUT"}}, avatar:{url:"{login}/*",query, form:{image:null} ,config:{method:"PUT"}},
password: { url: "{login}/*", query, form:{old_password:null, password:null} ,config:{method:"PUT"}}, password: { url: "{login}/*", query, form:{old_password:null, password:null} ,config:{method:"PUT"}},
}, },
attendance: {query}, attendance: {query, config},
courses:{url:"{login}/*", query, form:{page:1, sort_by:"updated_at",sort_direction:"desc", per_page:10, category:void 0, status:void 0},category:["study","manage"],status:["processing","end"]}, courses:{url:"{login}/*", query, form:{page:1, sort_by:"updated_at",sort_direction:"desc", per_page:10, category:void 0, status:void 0},category:["study","manage"],status:["processing","end"]},
get_user_info:{query,form:{school:1}}, get_user_info:{query,form:{school:1}},
homepage_info:{url:"{login}/*",query}, homepage_info:{url:"{login}/*",query},
shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at" ,page:1, sort_direction:"desc",per_page:16}}, shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at" ,page:1, sort_direction:"desc",per_page:16}},
system_update:{query:query}, system_update:{query:query},
tidings: {query, form:{type:"",page:1,per_page:10}, data:"type:course,project,interaction,apply,notice"}, tidings: {query, form:{type:"",page:1,per_page:10}, data:"type:course,project,interaction,apply,notice"},
unread_message_info:{url:"{login}/*", query}, unread_message_info:{url:"{login}/*", query}
home_page:{},
}, },
weapps:{ weapps:{

@ -37,7 +37,6 @@ export default class Client{
this.on("before", "users.accounts.password", getLogin); this.on("before", "users.accounts.password", getLogin);
this.on("before","users.courses", getLogin); this.on("before","users.courses", getLogin);
this.on("before","users.homepage_info", getLogin); this.on("before","users.homepage_info", getLogin);
this.on("before","homepage_info", getLogin)
this.on("before","users.accounts.avatar",getLogin); this.on("before","users.accounts.avatar",getLogin);
this.on("before","users.unread_message_info", getLogin); this.on("before","users.unread_message_info", getLogin);
this.on("before","users.shixuns",getLogin); this.on("before","users.shixuns",getLogin);
@ -54,7 +53,7 @@ export default class Client{
this.save_cookies(); this.save_cookies();
}); });
this.on("success","accounts.login", res=>{ this.on("success","accounts.login", res=>{
this.synch=0 this.synch=0;
this.save_cookies(); this.save_cookies();
this.getTidingInfo({login:res.login}); this.getTidingInfo({login:res.login});
}); });
@ -63,8 +62,8 @@ export default class Client{
this.client_key = key(this.randomcode); this.client_key = key(this.randomcode);
}) })
} }
getTidingInfo(){ getTidingInfo({login}={}){
return this.api("users.unread_message_info")().then(res => { return this.api("users.unread_message_info")({login}).then(res => {
if (res.unread_message_count) if (res.unread_message_count)
wx.setTabBarBadge({ index: 1, text: res.unread_message_count.toString() }); wx.setTabBarBadge({ index: 1, text: res.unread_message_count.toString() });
else if (res.unread_tiding_count) else if (res.unread_tiding_count)
@ -126,6 +125,7 @@ export default class Client{
load_user() { load_user() {
let value = wx.getStorageSync('user') || {}; let value = wx.getStorageSync('user') || {};
this.user = value; this.user = value;
this.synch = 1;
} }
save_user() { save_user() {
wx.setStorage({ key: "user", data: this.user }); wx.setStorage({ key: "user", data: this.user });
@ -142,5 +142,5 @@ export default class Client{
} }
const client = global.client = new Client(); const client = global.client = new Client();
client.syncUser(); client.syncUser({refresh:1});
module.exports = {client}; module.exports = {client};

@ -1,71 +0,0 @@
// pages/courses/courses.js
const app = getApp();
Page({
options: {},
data: {
courses: [],
loading: true,
page: 1,
show_join_course_modal:false,
loaded_all: false,
},
search_courses: function({detail: {value}}){
this.setData({ loaded_all: false });
this.options.search = value;
this.fetch_courses(this.options).then(res => {
console.log(res);
this.set_courses(res.courses);
if (res.courses.length<=10) {
this.setData({ loaded_all: true })
}
})
},
show_join_course_modal: function(event){
this.setData({show_join_course_modal: true});
},
cancel_join_course_modal: function(event){
this.setData({show_join_course_modal: false});
},
fetch_courses: function(options){
return app.api("courses")(options)
},
set_courses: function(courses){
this.setData({courses: courses});
},
add_courses: function(courses){
this.setData({
courses:[...this.data.courses, ...courses],
})
},
onLoad: function (options) {
this.fetch_courses().then(res=>{
console.log(res);
this.set_courses(res.courses);
})
},
onShow: function () {
},
onReachBottom: function () {
if(!this.data.loaded_all){
wx.pageScrollTo({
selector: ".loading"
})
this.fetch_courses({ page: this.data.page + 1 ,...this.options})
.then(res => {
this.setData({ page: this.data.page + 1});
if(res.courses.length==0){
this.setData({loaded_all: true})
}else{
this.add_courses(res.courses);
}
})
}
}
})

@ -1,6 +0,0 @@
{
"usingComponents": {
"join-course-modal": "/components/modal/join-course/join-course"
}
}

@ -1,19 +0,0 @@
<!--pages/addclass/addclass.wxml-->
<view class="container">
<view class="course-list form-wrap">
<view>
<image hidden="{{courses.length==0 || loading}}" src="cloud://educoder.6564-educoder-1300855313/images/blank2.png" class="none-content"></image>
<text hidden="{{courses.length==0 || loading}}" class="none-content">没有可以加入的课程了</text>
</view>
<block wx:for="{{courses}}" wx:for-item="course" wx:key="id">
<view hidden="{{course.present}}" bindtap="show_join_course_modal" class="course-item flex-wrap" data-id="{{course.id}}" data-name="{{course.name}}">
<myicon class="course-icon" type="internet_class" size="26" color="#00b0f0"></myicon>
<text class="course-name">{{course.name}}</text>
</view>
</block>
</view>
<view class="loading" hidden="{{loaded_all}}">
<image src="cloud://educoder.6564-educoder-1300855313/images/loading_min.gif" style="width:20px;height:20px"></image>
</view>
</view>
<join-course-modal hidden="{{!show_join_course_modal}}"/>

@ -1,68 +0,0 @@
/* pages/addclass/addclass.wxss */
.course-icon{
margin-left: 2px;
margin-right: 12px;
}
.course-list{
display: flex;
flex-direction: column;
margin: 0 -12px
}
.course-item{
align-items: center;
background: white;
padding: 30rpx 12px;
border-bottom: 1rpx solid #EEE;
position: relative;
}
.course-item:after {
content: '加入>';
display: block;
position: absolute;
right: 2rpx;
top: 50%;
height: 40rpx;
line-height: 40rpx;
margin-top: -20rpx;
margin-right: 20rpx;
color: #999;
}
.course-name{
vertical-align: middle;
margin-right: 80rpx;
}
.none-content{
align-self: center;
}
view.none-content{
direction: flex;
flex-direction: column;
}
text.none-content{
font-size: 16px;
margin-top: 32rpx;
}
image.none-content{
margin-top: 120rpx;
height: 160rpx;
width: 180rpx;
}
.code-input{
border-radius: 10rpx;
border: 1rpx solid;
height: 36px;
margin-bottom: 24rpx;
padding-left: 16rpx;
}
lable.identity{
margin-right: 16rpx;
}
.loading{
padding-top: 16rpx;
text-align: center;
}

@ -1,75 +1,38 @@
const app = getApp(); const app = getApp();
Page({ Page({
/**
* 页面的初始数据
*/
data: { data: {
base_url: "https://www.educoder.net", statusBarHeight: 20,
page_info: {}, current: 0,
page_status: 0 show: [1],
list: [
{ text: "实训" ,type:"shixun"},
{ text: "课堂" , type:"course"},
//{text:"课程"}
]
},
enterSearch() {
let type = this.data.list[this.data.current].type || '';
app.navigateTo({ url: `{search}?type=${type}`});
}, },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) { onLoad: function (options) {
app.callApi({name:"home.index"}) wx.getSystemInfo({
.then(res => { success: res => {
console.info(res); let { statusBarHeight } = res;
this.setData({ page_info: res, page_status: 1 }); this.setData({ statusBarHeight });
}).catch(error => { },
this.setData({ page_status: 2 }); })
}) },
}, switchNav({ target: { dataset: { current } } }) {
this.setData({ current });
/** this.setData({ ['show[' + current + ']']: 1 })
* 生命周期函数--监听页面初次渲染完成 },
*/ switchTab({ detail: { current, source, value } }) {
onReady: function () { console.log(current, source, value);
if (source == "touch") {
}, this.setData({ current });
this.setData({ ['show[' + current + ']']: 1 })
/** }
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
}, },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.onLoad();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () { onShareAppMessage: function () {
} }

@ -1,5 +1,5 @@
{ {
"usingComponents": {}, "usingComponents": {},
"enablePullDownRefresh": true, "navigationBarTitleText": "发现",
"navigationBarTitleText": "发现" "navigationStyle": "custom"
} }

@ -1,48 +1,22 @@
<view class="container"> <view class="navigation">
<view class="swiper-images"> <view style="height:{{statusBarHeight}}px"></view>
<swiper class="swiper-images" indicator-dots="1" autoplay="1"> <view class="navigation-bar">
<swiper-item class="swiper-image" wx:for="{{page_info.images_url}}" wx:for-item="image"> <view class="navigation-left">
<image class="swiper-image" mode="widthFix" src="{{base_url+image.image_url}}"></image> <icon class="search" type="search" size="26" color="white" bindtap="enterSearch"/>
</swiper-item> <text class="title">发现</text>
</swiper>
</view>
<view class="subjects">
<view class="title">
<text>实践课程</text>
<text class="hint">TRAINING COURSE</text>
</view>
<view class="loading" wx:if="{{page_status==0}}">
<image src="cloud://educoder.6564-educoder-1300855313/images/loading_big.gif" style="width:50px;height:50px"></image>
</view>
<view class="grid-view">
<view class="grid-item" wx:for="{{page_info.subjects}}" wx:for-item="subject">
<view class="item">
<image src="{{base_url+'/'+subject.image_url}}" mode="widthFix"></image>
<view class="detail">
<text class="name">{{subject.name}}</text>
</view>
</view>
</view>
</view>
</view>
<view class="pratices">
<view class="title">
<text>实训项目</text>
<text class="hint">DEVELOPMENT COMMUNITY</text>
</view>
<view class="loading" wx:if="{{page_status==0}}">
<!---->
<image src="cloud://educoder.6564-educoder-1300855313/images/loading_big.gif" style="width:50px;height:50px"></image>
</view> </view>
<view class="grid-view"> <view class="navbar" bindtap="switchNav">
<view class="grid-item" wx:for="{{page_info.shixuns}}" wx:for-item="practice"> <view class="navitem {{current==index?'active':''}}" wx:for="{{list}}" data-current="{{index}}">
<view class="item"> {{item.text}}
<image src="{{base_url+'/'+practice.pic}}" mode="widthFix"></image>
<view class="detail">
<text class="name">{{practice.name}}</text>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<swiper class="body" current="{{current}}" bindchange="switchTab" circular="1">
<swiper-item>
<courses wx:if="{{show[0]}}"/>
</swiper-item>
<swiper-item>
<shixuns wx:if="{{show[1]}}"/>
</swiper-item>
</swiper>

@ -1,68 +1,49 @@
view.swiper-images{ page{
margin: 0 -12px; display: flex;
} flex-direction: column;
swiper.swiper-images{ height: 100%;
height: 220rpx;
}
image.swiper-image{
width: 100%;
}
.title{
margin-top: 2px;
text-align: center;
} }
.navigation{
.title .hint{ background: #00b0f0;
font-size: 8px; flex: none;
margin: 5px 0;
} }
.navigation-bar{
.subjects{ height: 44px;
margin: 0 -8px; padding-right: 100px;
}
.grid-view{
display: -webkit-flex;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
flex-wrap: wrap;
width: 100%;
} }
.navigation-left{
.grid-item{ width: 100px;
flex: 0 0 auto; display: flex;
width: 50%; align-items: center;
color: white;
} }
.search{
.item{ padding:0 8px;
overflow: hidden;
border-radius: 12rpx;
box-shadow: 1px 1px 8px #909090;
margin: 12rpx 10rpx 16rpx 10rpx;
} }
.item:hover{ .navbar{
box-shadow: 2px 2px 14px #707070; flex: 1 1 1px;
margin: 8rpx 10rpx 20rpx 10rpx; width: 1px;
border-radius: 7px;
display: flex;
text-align: center;
white-space: nowrap;
overflow-x: scroll;
} }
.item image{ .navitem{
width: 100%; flex: auto;
height:261rpx; background: #00d0f0;
color: white;
padding: 5px 1px;
transition: all ease 0.6s;
} }
.item .detail{ .navitem.active{
padding: 2rpx 16rpx 14rpx 16rpx; color: #00b0f0;
background: white;
} }
text.name{ .body{
display: block; flex: 1 1 1px;
overflow: hidden; height: 1px;
font-size: 10px;
text-overflow: ellipsis;
white-space: nowrap;
} }
.loading{
text-align:center;
padding: 12px 0;
}

@ -0,0 +1,23 @@
// pages/findmore/shixuns/shixuns.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

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

@ -0,0 +1,2 @@
<!--pages/findmore/shixuns/shixuns.wxml-->
<text>pages/findmore/shixuns/shixuns.wxml</text>

@ -0,0 +1 @@
/* pages/findmore/shixuns/shixuns.wxss */

@ -0,0 +1,130 @@
const app = getApp();
Page({
data: {
version: global.config.version,
imgDir: global.config.imgDir,
eduImgDir: global.config.eduImgDir,
user: {},
show_join_course_modal: false,
auto_attendance:false
},
update() {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
if (!res.hasUpdate) {
wx.showToast({
title: '你用的是最新版本哦', icon: "none"
})
}
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: "(●'◡'●)\n新版本已经准备好了是否重启应用呢",
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
},
onTapAvatar: function ({ currentTarget: { dataset } }) {
wx.showActionSheet({
itemList: ["查看图片", "更改头像"],
success: res => {
switch (res.tapIndex) {
case 0:
wx.previewImage({
urls: [global.eduImgDir+dataset.src],
});
break;
case 1:
wx.chooseImage({
count: 1,
success: function (res) {
console.log("choose image")
console.log(res);
const src = res.tempFilePaths[0]
wx.navigateTo({
url: '/avatar/pages/image_crop/image_crop?src=' + src, fail: console.error
})
},
})
break;
}
}
})
},
logout: function () {
app.callApi({
name: "accounts.logout", success: res => {
console.log("注销成功");
console.log(res);
this.onShow();
},
fail: error => {
console.error("注销失败");
console.error(error);
}
})
},
enter_login: function (event) {
wx.navigateTo({
url: '/account/pages/login/login', fail: console.error
})
},
show_join_course_modal: function (event) {
this.setData({ show_join_course_modal: true });
},
onLoad(){
let data = wx.getStorageSync("auto-attendence");
if(data)
this.setData({auto_attendance:true});
},
onShow(){
app.syncUser().then(res => {
if(res.user.user_id!=2)
this.refresh();
else
this.setData({user:{}})
});
},
refresh: function () {
app.api("users.homepage_info")()
.then(res => {
console.log("get_homepage_info");
console.log(res)
this.setData({ user: res })
if (!res.attendance_signed && this.data.auto_attendance)
this.attendance({ show: 0 })
});
},
tapAutoAttendence(){
this.setData({auto_attendance:!this.data.auto_attendance});
if (!this.data.user.attendance_signed && this.data.auto_attendance)
this.attendance({ show: 1 })
wx.setStorage({
key: 'auto-attendence',
data: this.data.auto_attendance,
});
},
attendance({show=1}){
app.api("users.attendance")()
.then(res=>{
this.refresh();
res.message = "签到成功";
if(show)
app.showMsg(res);
})
},
onShareAppMessage: function () {
}
})

@ -0,0 +1,44 @@
<view class="user-display">
<navigator wx:if="{{!user.id}}" class="user-info no-login" style="display: flex;align-items: center;" url="/account/pages/login/login">
<image src="{{imgDir}}blank_info_bg.png" style="width: 50px; height:50px; padding:12px"></image>
<text class="color-grey ft14 m12">点击登陆,获取更多内容</text>
</navigator>
<block wx:else>
<navigator hover-class="none" class="user-info p4" url="/account/pages/profile/profile">
<image src="{{eduImgDir}}{{user.avatar_url}}" class="avatar fl m4" catchtap="onTapAvatar" data-url="{{user.avatar_url}}"></image>
<view class="user-detail fl">
<text>{{user.name}}</text>
</view>
</navigator>
<view class="relation-info">
<view class="relation-detail">
<text>经验值</text>
<text>{{user.experience}}</text>
</view>
<view class="relation-detail">
<text>金币</text>
<text>{{user.grade}}</text>
</view>
<view class="relation-detail attendance">
<button class="attendance" type="cap" plain="{{user.attendance_signed}}" size="mini" disabled="{{user.attendance_signed}}" bindtap="attendance">{{user.attendance_signed?'已签到':'签到'}}</button>
<radio class="auto-attendance" checked="{{auto_attendance}}" bindtap="tapAutoAttendence">自动签到</radio>
</view>
</view>
</block>
</view>
<view class="nav-list">
<navigator class="nav" url="/account/pages/change_password/change_password">修改密码</navigator>
<view class="nav addclass" bindtap="show_join_course_modal">加入课程</view>
<navigator url="/course/pages/course_setting/course_setting?intent=create" class="nav createclass">创建课程</navigator>
<button open-type="feedback" class="nav" style="width:auto">小程序反馈</button>
<button open-type="contact" class="nav" style="width:auto">小程序客服</button>
<view class="nav" bindtap="update">当前版本:{{version}}</view>
<navigator url="/account/pages/about/about" class="nav about">关于</navigator>
</view>
<view>
<button class="login" type="main" wx:if="{{!user.id||user.id==2}}" bindtap="enter_login">登录</button>
<button class="logout" wx:elif="{{user.id!=2}}" bindtap="logout">退出登录</button>
</view>
<join-course-modal hidden="{{!show_join_course_modal}}" />

@ -0,0 +1,103 @@
.nav-list{
margin-top: 4px;
}
.nav {
font-size: 16px;
background: white;
border-bottom: 1px solid #eee;
padding: 0 14px;
height: 42px;
line-height: 42px;
text-align: left;
font-weight: normal;
}
button.nav::after{
border: none;
}
.login{
margin: 16rpx 70rpx;
}
.logout{
background: red;
color: white;
margin-top: 16rpx;
}
.user-display{
background: white;
}
.no-login{
color: #0080f0;
}
.user-info{
padding: 4px 12px;
height: 50px;
display: flex;
align-items: center;
}
.user-detail{
margin-left: 20px;
}
.user-detail>text{
display: block;
}
.relation-info{
margin-bottom: 1px;
display: flex;
}
.relation-detail{
width:33.33%;
display: inline-block;
text-align: center;
font-size: 14px;
}
.relation-detail>text{
display: block;
padding-top: 4px;
}
.my-display{
margin-top: 1px;
padding: 16px 8px;
}
.my-detail{
display: inline-block;
width:33%;
text-align: center;
font-size: 14px;
}
.my-detail>image{
width: 24px;
height: 24px;
}
.my-detail>text{
display: block;
}
.contact{
position: fixed;
bottom: 0;
background: transparent;
font-size: 12px;
text-decoration: underline;
color: grey;
font-weight: normal;
left:0;
right: 0;
margin: auto;
}
.avatar{
border-radius: 50%;
width: 42px;
height: 42px;
}
.auto-attendance{
transform: scale(0.64);
}
button.attendance{
font-size: 13px!important;
font-weight: normal;
}

@ -6,8 +6,8 @@ Page({
current:0, current:0,
show:[1], show:[1],
list:[ list:[
{text:"课堂"}, {text:"课堂", type:"course"},
{text:"实训"}, {text:"实训", type:"shixun"},
//{text:"课程"} //{text:"课程"}
] ]
}, },
@ -20,7 +20,8 @@ Page({
}) })
}, },
enterSearch(){ enterSearch(){
app.navigateTo({url:"{search}"}); let type = this.data.list[this.data.current].type||'';
app.navigateTo({url:`{search}?type=${type}`});
}, },
switchNav({target:{dataset:{current}}}){ switchNav({target:{dataset:{current}}}){
this.setData({current}); this.setData({current});
@ -32,5 +33,8 @@ Page({
this.setData({ current }); this.setData({ current });
this.setData({ ['show[' + current + ']']: 1 }) this.setData({ ['show[' + current + ']']: 1 })
} }
},
onShareAppMessage(){
} }
}) })

@ -2,7 +2,7 @@
<view style="height:{{statusBarHeight}}px"></view> <view style="height:{{statusBarHeight}}px"></view>
<view class="navigation-bar"> <view class="navigation-bar">
<view class="navigation-left"> <view class="navigation-left">
<icon class="search" type="search" size="20" color="white" bindtap="enterSearch"/> <icon class="search" type="search" size="26" color="white" bindtap="enterSearch"/>
<text class="title">我的</text> <text class="title">我的</text>
</view> </view>
<view class="navbar" bindtap="switchNav"> <view class="navbar" bindtap="switchNav">
@ -20,4 +20,5 @@
<my-shixun wx:if="{{show[1]}}"/> <my-shixun wx:if="{{show[1]}}"/>
</swiper-item> </swiper-item>
</swiper> </swiper>
<add-tips/>
<add-tips/>

@ -20,7 +20,7 @@ page{
color: white; color: white;
} }
.search{ .search{
padding:0 12px; padding:0 8px;
} }
.navbar{ .navbar{
flex: 1 1 1px; flex: 1 1 1px;

@ -20,7 +20,11 @@ Component({
}, },
attached() { attached() {
this.options = {page:1, limit:15}; this.options = {page:1, limit:15};
this.onLoad(); if (app.user().is_teacher)
var current_cate = 1;
else
var current_cate = 0;
this.setData({ current_cate });
}, },
pageLifetimes: { pageLifetimes: {
show: function () { show: function () {
@ -86,14 +90,6 @@ Component({
this.setData({ courses: [] }); 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(){ onReachBottom(){
this.pullCourses(); this.pullCourses();
}, },

@ -7,10 +7,26 @@ Component({
data: { data: {
shixuns:[] shixuns:[]
}, },
pageLifetimes: {
show(){
app.syncUser()
.then(res=>{
if(res.user.user_id!=this.user_id){
this.pullShixuns({refresh:1});
this.user_id = res.user.user_id;
}
})
}
},
attached(){ attached(){
this.options = {page:0, per_page:16}; this.options = {page:1, per_page:16};
this.pullShixuns(); app.syncUser()
//console.log(this.options) .then(res => {
if (res.user.user_id != this.user_id) {
this.pullShixuns({ refresh: 1 });
this.user_id = res.user.user_id;
}
});
}, },
methods: { methods: {
async pullShixuns({refresh=0}={}){ async pullShixuns({refresh=0}={}){

@ -1,97 +0,0 @@
const app = getApp();
Page({
data:{
version:global.config.version,
imgDir: global.config.imgDir,
eduImgDir: global.config.eduImgDir,
user: {},
show_join_course_modal: false
},
update(){
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
if(!res.hasUpdate){
wx.showToast({
title: '你用的是最新版本哦',icon:"none"
})
}
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: "(●'◡'●)\n新版本已经准备好了是否重启应用呢",
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
},
onTapAvatar: function({currentTarget:{dataset}}){
wx.showActionSheet({
itemList: ["查看图片","更改头像"],
success:res=>{
switch(res.tapIndex){
case 0:
wx.previewImage({
urls: [dataset.src],
});
break;
case 1:
console.log("点击更改头像");
wx.chooseImage({
count:1,
success: function(res) {
console.log("choose image")
console.log(res);
const src = res.tempFilePaths[0]
wx.navigateTo({
url: '/avatar/pages/image_crop/image_crop?src='+src,fail:console.error
})
},
})
break;
}
}
})
},
logout: function(){
app.callApi({name:"accounts.logout",success:res=>{
console.log("注销成功");
console.log(res);
this.onShow();
},
fail:error=>{
console.error("注销失败");
console.error(error);
}
})
},
enter_login: function(event){
wx.navigateTo({
url: '/account/pages/login/login',fail:console.error
})
},
show_join_course_modal: function(event){
this.setData({show_join_course_modal: true});
},
onShow: function(){
app.api("users.get_user_info")()
.then(user=>{
console.log("get_user_info");
console.log(user)
this.setData({user})
})
},
onShareAppMessage: function(){
}
})

@ -1,22 +0,0 @@
<view class="setting">
<image class="user-bg" mode="scaleToFill" src="cloud://educoder.6564-educoder-1300855313/images/bg.png"></image>
<view class="user-view">
<image wx:if="{{user.user_id&&user.user_id!=2}}" class="avatar" bindtap="onTapAvatar" data-src="{{eduImgDir}}{{user.image_url}}" src="{{eduImgDir}}{{user.image_url}}"></image>
<image wx:else class="avatar" src="{{imgDir}}avatar.png"></image>
<text class="user-text" bindtap="enter_usersetting">{{user.real_name}} | {{user.user_school}}</text>
</view>
<view class="nav-list">
<navigator class="nav" url="/account/pages/change_password/change_password">修改密码</navigator>
<view class="nav addclass" bindtap="show_join_course_modal">加入课程</view>
<navigator url="/course/pages/course_setting/course_setting?intent=create" class="nav createclass">创建课程</navigator>
<button open-type="feedback" class="nav">小程序反馈</button>
<button open-type="contact" class="nav">小程序客服</button>
<view class="nav" bindtap="update">当前版本:{{version}}</view>
<navigator url="/account/pages/about/about" class="nav about">关于</navigator>
</view>
<view>
<button class="login" type="main" wx:if="{{user.user_id==2}}" bindtap="enter_login">登录</button>
<button class="logout" wx:else bindtap="logout">退出登录</button>
</view>
</view>
<join-course-modal hidden="{{!show_join_course_modal}}"/>

@ -1,68 +0,0 @@
.nav {
font-size: 16px;
background: white;
border-bottom: 1px solid #eee;
padding: 0 14px;
height: 46px;
line-height: 46px;
text-align: left;
}
button.nav::after{
border: none;
}
.user-text{
font-size: 16px;
color: white;
align-self: center;
}
.avatar{
width: 136rpx;
height: 136rpx;
margin-top: 88rpx;
margin-bottom: 24rpx;
border-radius: 50%;
align-self: center;
overflow: hidden;
}
.user-view{
display: flex;
flex-direction: column;
width: 750rpx;
height: 341rpx;
margin-bottom: 6rpx;
}
.user-bg{
top:0;
position: fixed;
z-index: -1;
left:0;
right:0;
height: 341rpx;
width: 100%;
}
.login{
margin: 16rpx 70rpx;
}
.logout{
background: red;
border-radius: 26rpx;
color: white;
margin: 16rpx 70rpx;
}
/* .nav-list{
margin-bottom: 40px;
}
view.foot{
position: fixed;
bottom: 0;
width:100%;
height: 40px;
background-color: #f2f2f2;
}
.foot button{
height: 38px;
} */

@ -2,7 +2,6 @@ const app = getApp();
Page({ Page({
data: { data: {
keyword:"", keyword:"",
type_text:"实训项目",
list:[ list:[
{text:"实训项目", type:"shixun"}, {text:"实训项目", type:"shixun"},
{text:"教学课堂", type:"course"} {text:"教学课堂", type:"course"}
@ -11,7 +10,6 @@ Page({
onTapNav({detail:{current, source , value}}){ onTapNav({detail:{current, source , value}}){
if(source!='touch') return; if(source!='touch') return;
this.options.type = value.type; this.options.type = value.type;
this.setData({type_text: value.text});
this.search({refresh:1}) this.search({refresh:1})
.then(()=>{ .then(()=>{
this.setData({scrollTop:0}); this.setData({scrollTop:0});

@ -1,5 +1,5 @@
<page-meta> <page-meta>
<navigation-bar title="搜索{{type_text}}" loading="{{loading}}"/> <navigation-bar title="搜索{{list[current].text}}" loading="{{loading}}"/>
</page-meta> </page-meta>
<form class="header" bindsubmit="onSubmit"> <form class="header" bindsubmit="onSubmit">
<view class="search"> <view class="search">

@ -59,8 +59,8 @@
padding: 0 10px; padding: 0 10px;
} }
.body{ .body{
height: calc(100vh - 80px); height: calc(100vh - 74px);
margin-bottom: 46px; margin-bottom: 40px;
} }
.scroll-body{ .scroll-body{
height: 100%; height: 100%;
@ -72,3 +72,6 @@
left:0; left:0;
right:0; right:0;
} }
.operations>button{
width: auto!important;
}

@ -131,6 +131,25 @@
"pathName": "account/pages/about/about", "pathName": "account/pages/about/about",
"query": "identifier=i6qlxhw8a74m", "query": "identifier=i6qlxhw8a74m",
"scene": null "scene": null
},
{
"id": -1,
"name": "profile",
"pathName": "pages/profile/profile",
"query": "",
"scene": null
},
{
"id": -1,
"name": "home",
"pathName": "pages/home/home",
"scene": null
},
{
"id": -1,
"name": "account",
"pathName": "account/pages/account/account",
"scene": null
} }
] ]
} }

Loading…
Cancel
Save