diff --git a/miniprogram/account/pages/account/account.js b/miniprogram/account/pages/account/account.js index 82162ad..f436269 100644 --- a/miniprogram/account/pages/account/account.js +++ b/miniprogram/account/pages/account/account.js @@ -154,12 +154,12 @@ Page({ let tmp = pos[action]; pos[action] = pos[this.data.action]; pos[this.data.action] = tmp; - if(Math.random()>0.5){ + /*if(Math.random()>0.5){ for(var k in pos){ if(pos[k]!=1) pos[k] = pos[k]==2?3:2; } - } + }*/ this.setData({pos, action}); }, onLoad: function (options) { diff --git a/miniprogram/account/pages/accounts/accounts.js b/miniprogram/account/pages/accounts/accounts.js index 43f27d8..2507b36 100644 --- a/miniprogram/account/pages/accounts/accounts.js +++ b/miniprogram/account/pages/accounts/accounts.js @@ -7,10 +7,16 @@ Page({ buttons:[{text:"删除",type:"warn"}] }, onLoad: function (options) { - + console.log("Load", Date.now()); + this.refresh() + .then(res=>{ + this.loaded = 1; + }) }, onShow(){ - this.refresh(); + console.log("show", Date.now()); + if(this.loaded) + this.refresh(); }, navBack(){ wx.navigateBack({ @@ -18,12 +24,13 @@ Page({ }); }, refresh(){ + console.log("start", Date.now()); this.setData({loading:1}); - app.syncUser() + return app.syncUser() .then(res=>{ - if (this.oldNum!=null && accountManager.getAccounts().length>this.oldNum && !this.data.currentAccountSaved && this.data.currentAccount) { + if (this.oldNum!=null && accountManager.getAccounts().length>this.oldNum && !this.data.currentAccountSaved && this.currentAccount) { // 增加了新账号,将未保存的老账号信息保存 - accountManager.addAccount(this.data.currentAccount); + accountManager.addAccount(this.currentAccount); this.setData({ currentAccountSaved: 1 }); } // 更新当前账号信息, 如果更改了信息,可以显示最新的信息 @todo 完善 @@ -53,7 +60,17 @@ Page({ }else{ var accounts = addedAccounts; } - this.setData({ accounts, user: res.user, currentAccountSaved, currentAccount,loading:0}); + this.accounts = accounts; + accounts = accounts.map(i=>{ + return {user_id:i.user_id,name: i.name,login: i.login, image_url:i.image_url}; + }) + this.currentAccount = currentAccount; + this.setData({ accounts, user: {user_id }, currentAccountSaved,loading:0},()=>{ + console.log("渲染完成", Date.now()); + }); + console.log("end", Date.now()); + }).catch(e=>{ + }) }, deleteAccount({user_id}){ @@ -88,11 +105,11 @@ Page({ switchAccount(e){ let { currentTarget: {dataset: {id: user_id}}} = e; if (user_id==this.data.user.user_id) return; - if (accountManager.getAccounts().length<5&&!this.data.currentAccountSaved&&this.data.currentAccount){ - accountManager.addAccount(this.data.currentAccount); + if (accountManager.getAccounts().length<5&&!this.data.currentAccountSaved&&this.currentAccount){ + accountManager.addAccount(this.currentAccount); this.setData({currentAccountSaved:1}); } - let account = this.data.accounts.filter(i=>i.user_id == user_id) [0]; + let account = this.accounts.filter(i=>i.user_id == user_id) [0]; if(!account.save_password){ wx.navigateTo({ url: "../account/account?nostorage=1&error=账号过期,需重新登录; 密码将加密保存至本地&save_password=1&addaccount=1&login_disabled=1&login="+account.login}); }else{ diff --git a/miniprogram/account/pages/accounts/accounts.wxss b/miniprogram/account/pages/accounts/accounts.wxss index ad13822..e5c2207 100644 --- a/miniprogram/account/pages/accounts/accounts.wxss +++ b/miniprogram/account/pages/accounts/accounts.wxss @@ -35,7 +35,7 @@ .info{ flex: auto; } -.info>.login{ +.login{ font-size: 12px; color: dimgray; } diff --git a/miniprogram/account/pages/profile/profile.js b/miniprogram/account/pages/profile/profile.js index 3d1d785..5615ed2 100644 --- a/miniprogram/account/pages/profile/profile.js +++ b/miniprogram/account/pages/profile/profile.js @@ -88,17 +88,14 @@ Page({ this.setData({technical_index: value}); }, onDepartmentChange(e){ - ; let { detail: { value } } = e; this.setData({department_index:value}); }, refreshDepartments({detail}){ - ; this.setData({department_id: detail.id}); this.pullDepartments(); }, pullDepartments(){ - ; let {school_id, department_id} = this.data; app.api("schools.departments.for_option")({school_id}) .then(res=>{ diff --git a/miniprogram/app.js b/miniprogram/app.js index 4d6f4ed..9184b77 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -82,9 +82,9 @@ App({ duration }) }, - showMsg(res, duration = 1500) { + showMsg({message=""}, duration = 1500) { wx.showToast({ - title: res.message, duration + title: message, duration }) }, getPageUrl(url, root = "/") { diff --git a/miniprogram/app.json b/miniprogram/app.json index 9723449..287d4b2 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -33,9 +33,10 @@ ] }, { - "root": "avatar", + "root": "setting", "pages": [ - "pages/image_crop/image_crop" + "pages/image_crop/image_crop", + "pages/setting/setting" ] }, { @@ -109,7 +110,7 @@ "pages/home/home": { "network": "all", "packages": [ - "avatar", + "setting", "account" ] }, diff --git a/miniprogram/components/iconfont/iconfont.wxss b/miniprogram/components/iconfont/iconfont.wxss index f0eee03..4a1ad19 100644 --- a/miniprogram/components/iconfont/iconfont.wxss +++ b/miniprogram/components/iconfont/iconfont.wxss @@ -1,11 +1,11 @@ @font-face { font-family: 'iconfont'; /* project id 1656783 */ - src: url('//at.alicdn.com/t/font_1656783_wkdlw1gdzod.eot'); - src: url('//at.alicdn.com/t/font_1656783_wkdlw1gdzod.eot?#iefix') format('embedded-opentype'), - url('//at.alicdn.com/t/font_1656783_wkdlw1gdzod.woff2') format('woff2'), - url('//at.alicdn.com/t/font_1656783_wkdlw1gdzod.woff') format('woff'), - url('//at.alicdn.com/t/font_1656783_wkdlw1gdzod.ttf') format('truetype'), - url('//at.alicdn.com/t/font_1656783_wkdlw1gdzod.svg#iconfont') format('svg'); + src: url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.eot'); + src: url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.woff2') format('woff2'), + url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.woff') format('woff'), + url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.ttf') format('truetype'), + url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.svg#iconfont') format('svg'); } .iconfont { display: inline-block; @@ -118,4 +118,7 @@ .icon-filter:before { content: "\e6c7"; +} +.icon-shezhi:before{ + content: "\e625"; } \ No newline at end of file diff --git a/miniprogram/components/modal/join-course/join-course.js b/miniprogram/components/modal/join-course/join-course.js index 93b8ca2..c6f35ad 100644 --- a/miniprogram/components/modal/join-course/join-course.js +++ b/miniprogram/components/modal/join-course/join-course.js @@ -92,17 +92,16 @@ Component({ } }) }, - cancel() { - this.setData({ hidden: true,invite_code:'', assistant_professor:"", student:"", assistant_professor:"" }); + onCancel() { + this.setData({ hidden: true,invite_code:'', professor:"", student:"", assistant_professor:"" }); }, onTapButton({detail:{index}}){ if(index==0) - this.cancel(); + this.onCancel(); else if(index==1) this.join_course(); }, update_invite_code: function ({ detail: { value } }) { - ; this.setData({ invite_code: value }); }, update_identities: function ({ detail: { value } }) { @@ -129,7 +128,7 @@ Component({ },640); } this.triggerEvent("success"); - this.cancel(); + this.onCancel(); }) .catch(app.showError) diff --git a/miniprogram/components/modal/join-course/join-course.wxml b/miniprogram/components/modal/join-course/join-course.wxml index 3109f8c..1d6c4af 100644 --- a/miniprogram/components/modal/join-course/join-course.wxml +++ b/miniprogram/components/modal/join-course/join-course.wxml @@ -1,4 +1,4 @@ - + diff --git a/miniprogram/config.js b/miniprogram/config.js index 41d2332..7a47651 100644 --- a/miniprogram/config.js +++ b/miniprogram/config.js @@ -1,13 +1,15 @@ const cloudDir = "cloud://educoder.6564-educoder-1300855313/"; -let { miniProgram:{ envVersion, version}={}} = {}//wx.getAccountInfoSync(); +let { miniProgram:{ envVersion, version}={}} = wx.getAccountInfoSync(); const developUrl = "https://test-newweb.educoder.net"; const trialUrl = "https://pre-newweb.educoder.net"; const releaseUrl = "https://www.educoder.net"; -let _version = "0.16.1"; +let _version = "0.16.2"; var eduUrl = releaseUrl; /** + * A 支持选用实践课程 + * A 网络请求缓存 */ export function switchEnv(env) { @@ -37,14 +39,13 @@ const config = global.config = { cloudDir, get eduUrl(){return eduUrl}, imgDir: cloudDir + "images/", - get eduImgDir(){return eduUrl + "/images/"}, + get eduImgDir(){ return eduUrl + "/images/"}, switchEnv, pages:[ "exercise/pages/exercise_setting/exercise_setting", "common-homework/pages/common-homework/common-homework" ] }; - switchEnv("release"); //switchEnv(envVersion=="develop"?"trial":"release"); diff --git a/miniprogram/course/modules/activity/activity_item/activity_item.wxss b/miniprogram/course/modules/activity/activity_item/activity_item.wxss index 5ce8115..16a4e19 100644 --- a/miniprogram/course/modules/activity/activity_item/activity_item.wxss +++ b/miniprogram/course/modules/activity/activity_item/activity_item.wxss @@ -56,4 +56,5 @@ width: 20px; height: 20px; margin: 0 12px; + background: #eee; } \ No newline at end of file diff --git a/miniprogram/course/pages/course_invite/course_invite.wxss b/miniprogram/course/pages/course_invite/course_invite.wxss index 45eb8f4..63c1037 100644 --- a/miniprogram/course/pages/course_invite/course_invite.wxss +++ b/miniprogram/course/pages/course_invite/course_invite.wxss @@ -2,6 +2,7 @@ page{ display: flex; flex-direction: column; height: 100%; + background: #56A9EF; } .body{ flex: 1 1 10px; diff --git a/miniprogram/course/pages/teacher_apply/teacher_apply.js b/miniprogram/course/pages/teacher_apply/teacher_apply.js index 1505a17..205ac43 100644 --- a/miniprogram/course/pages/teacher_apply/teacher_apply.js +++ b/miniprogram/course/pages/teacher_apply/teacher_apply.js @@ -2,22 +2,39 @@ const app = getApp(); Page({ data: { - + apply_size:0 }, onLoad: function (options) { let {course_id} = options; this.setData({course_id}); this.refresh(); + this.pullCourse(); + }, + switchToTeacher(){ + let {course_id} = this.data; + app.api("courses.switch_to_teacher")({course_id}) + .then(res=>{ + console.log(res); + this.refresh(); + this.pullCourse(); + }) + }, + pullCourse(){ + let {course_id} = this.data; + app.api("courses.top_banner")({course_id}) + .then(res=>{ + console.log(res); + this.setData({course: res}); + }) }, refresh(){ let {course_id} = this.data; app.api("courses.apply_teachers")({course_id}) .then(res=>{ - ; this.setData(res); }).catch(e=>{ - app.showError(e); + app.showError(e, 2200); }) }, diff --git a/miniprogram/course/pages/teacher_apply/teacher_apply.wxml b/miniprogram/course/pages/teacher_apply/teacher_apply.wxml index 5ff2c88..5d9608e 100644 --- a/miniprogram/course/pages/teacher_apply/teacher_apply.wxml +++ b/miniprogram/course/pages/teacher_apply/teacher_apply.wxml @@ -1,8 +1,22 @@ + + {{course.name}} + - 待审批:{{apply_size}}人 + + + 待审批:{{apply_size}}人 + + 您目前不是教师身份 + + + + - + + + 暂无待审批 + \ No newline at end of file diff --git a/miniprogram/course/pages/teacher_apply/teacher_apply.wxss b/miniprogram/course/pages/teacher_apply/teacher_apply.wxss index 6eb68f2..f551940 100644 --- a/miniprogram/course/pages/teacher_apply/teacher_apply.wxss +++ b/miniprogram/course/pages/teacher_apply/teacher_apply.wxss @@ -1,14 +1,38 @@ page{ background: white; } +.course-name{ + text-align: center; + font-size: 20px; + line-height: 36px; + height: 36px; + padding: 0 12px; + width: 100%; +} +.switch{ + transform: scale(0.85); +} .header{ - padding: 12px; + padding: 12px 8px; background: white; border-bottom: #dddddd 1.5px solid; + display: flex; + align-items: center; + justify-content: space-between; } .count{ font-size: 14px; - margin-left: 12px; + margin-left: 10px; +} + +.empty, +.tip{ + font-size: 12px; + color: dimgray; } +.empty{ + text-align: center; + padding-top: 26px; +} \ No newline at end of file diff --git a/miniprogram/js/client.js b/miniprogram/js/client.js index ce013b6..c6377e3 100644 --- a/miniprogram/js/client.js +++ b/miniprogram/js/client.js @@ -147,13 +147,12 @@ export default class Client{ success:res=>{ this.trigger("success",name,res); success&&success(res); - }, fail:e=>{ - this.trigger("fail",name,e); - fail&&fail(e); - }, complete:res=>{ - global.realTimeLog.debug(name+" api was called"); - complete&&complete(res); - }, + }, fail:(e,res)=>{ + this.trigger("fail", name, e); + fail&&fail(e, res); + // for trace error + global.realTimeLog.warn(`api [${name}] called fail: `, e.toString(), res, data); + },complete }); } load_user() { diff --git a/miniprogram/js/edu.js b/miniprogram/js/edu.js index 70f8104..af8c2bd 100644 --- a/miniprogram/js/edu.js +++ b/miniprogram/js/edu.js @@ -1,6 +1,6 @@ import apiConfig from "./apiConfig"; -function handler({success, fail, resolve, reject}){ +function handler({success, fail, complete, resolve, reject}){ return { success: res => { if (res.data.status && res.data.status > 100 || res.data.status<0) { @@ -15,20 +15,22 @@ function handler({success, fail, resolve, reject}){ } let e = new Error(message); e.code = code; - if (fail) fail(e); - return reject(e); + if (fail) fail(e, res.data); + reject(e, res.data); + return complete&&complete(e, res.data); } - if (success) success(res.data); + success&&success(res.data); resolve(res.data); + complete&&complete(res.data); }, fail: e => { - global.realTimeLog.warn(e); if ("errMsg" in e) - (e = new Error("(⋟﹏⋞)\n网络连接出错了呢")).code = -2; + (e = new Error("(⋟﹏⋞)\n网络连接失败了")).code = -2; if (!("message" in e)) - (e = new Error("(>_<)\n出现了未知错误")).code = -1; - if (fail) { fail(e); } - reject(e); + (e = new Error("哎呀,出错了\n(>_<)")).code = -1; + fail&& fail(e, {}); + reject(e, {}); + complete&&complete(e, {}); } } } @@ -87,10 +89,9 @@ export default function ({ name, data:_data = {}, session, success, fail, comple _name = Object.keys(formData)[0]; var filePath = formData[_name]; delete formData[_name]; - ; return new Promise((resolve, reject)=>{ session.uploadFile({ - url, filePath, name:_name, header, timeout, formData,complete, ...handler({success, fail, resolve, reject}) + url, filePath, name:_name, header, timeout, formData, ...handler({success, fail, complete, resolve, reject}) }) }); }else if(method=="downloadFile"){ @@ -108,7 +109,7 @@ export default function ({ name, data:_data = {}, session, success, fail, comple }else return new Promise((resolve, reject) => { session.request({ - url, method, data, header,complete,...handler({success, fail, resolve, reject}) + url, method, data, header,...handler({success, fail, complete, resolve, reject}) }); }) } diff --git a/miniprogram/js/utils.js b/miniprogram/js/utils.js index 3bd68d0..0827c01 100644 --- a/miniprogram/js/utils.js +++ b/miniprogram/js/utils.js @@ -231,7 +231,6 @@ export function parseUrl({url}){ export function navigateToUrl({url,open_type='navigateTo'}){ url = parseUrl({url}); - ; const app = getApp(); if(url){ app.navigateTo({url}); @@ -275,21 +274,25 @@ export function throttle(func, wait, options) { export function RealTimeLogManager(){ const log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null; return { - debug() { + debug(...args) { + console.debug.apply(null, arguments); if (!log) return - log.debug.apply(log, arguments) + log.debug( "v"+ global.config.version ,...args) }, - info() { + info(...args) { + console.info.apply(null, arguments); if (!log) return - log.info.apply(log, arguments) + log.info( "v"+ global.config.version ,...args) }, - warn() { + warn(...args) { + console.warn.apply(null, arguments); if (!log) return - log.warn.apply(log, arguments) + log.warn( "v"+ global.config.version ,...args); }, - error() { + error(...args) { + console.error.apply(null, arguments); if (!log) return - log.error.apply(log, arguments) + log.error( "v"+ global.config.version ,...args); }, setFilterMsg(msg) { // 从基础库2.7.3开始支持 if (!log || !log.setFilterMsg) return diff --git a/miniprogram/pages/findmore/findmore.js b/miniprogram/pages/findmore/findmore.js index f37aa5d..f01fbdd 100644 --- a/miniprogram/pages/findmore/findmore.js +++ b/miniprogram/pages/findmore/findmore.js @@ -38,7 +38,6 @@ Page({ this.switch({current}); }, switchTab({ detail: { current, source, value } }) { - ; if (source == "touch") { this.switch({current}); } diff --git a/miniprogram/pages/findmore/shixuns/shixuns.js b/miniprogram/pages/findmore/shixuns/shixuns.js index 53663fa..b99efdd 100644 --- a/miniprogram/pages/findmore/shixuns/shixuns.js +++ b/miniprogram/pages/findmore/shixuns/shixuns.js @@ -8,16 +8,37 @@ Component({ data: { shixun_list:[] }, + pageLifetimes:{ + show(){ + /* + let {status} = this.data; + console.log("show",status); + if(status<0) + this.pullShixuns({refresh:2 ,showError:0}); + //limit param somehow don't work! + */ + } + }, attached(){ this.options = {page:1, limit: 10}; - this.pullShixuns({refresh:1}); + let key = "cache-shixun_list" + let cache_shixun_list = wx.getStorageSync(key); + if(cache_shixun_list) + this.setData({shixun_list: cache_shixun_list}); + else + wx.showLoading({title: '努力加载中'}); + this.pullShixuns({refresh:1, showError: !cache_shixun_list}) + .then(res=>{ + if(res.shixun_list) + wx.setStorageSync(key, res.shixun_list); + }) this.selects = {}; }, methods: { clear(){ this.setData({keyword:"", showClear:0}); this.options.keyword = ""; - this.pullShixuns({refresh:1}); + this.pullShixuns({refresh:1, showError: 0}); }, onInput(e){ let {detail:{value}} = e; @@ -26,7 +47,6 @@ Component({ }else if(!this.data.showClear&&value){ this.setData({showClear:1}); } - }, onSelect(e){ let {detail} = e; @@ -67,14 +87,11 @@ Component({ }) }else{ this.setData({shixun_ids}); - console.info(shixun_ids); this.setData({showSendDialog: true}); } - } }, - search(e){ - + search(e){ let {detail:{value}} = e; if(this.options.keyword!=value){ this.options.keyword = value; @@ -85,24 +102,26 @@ Component({ this.pullShixuns({refresh:1}); }, onReachBottom(){ - if(this.data.status==200) + let {status} = this.data; + if(status!=205&&status!=204) this.pullShixuns(); }, - pullShixuns({refresh=0}={}){ + pullShixuns({refresh=0, showError=1}={}){ if(refresh){ if(refresh==1){ this.options.page = 1; var { options } = this; }else if(refresh==2){ - var {page, per_page} = this.options; - var options = {...this.options,page:1, per_page: page*per_page}; + var {page, limit} = this.options; + var options = {...this.options,page:1, limit: page*limit}; } }else{ this.options.page++; var {options} = this; } wx.showNavigationBarLoading(); - return app.api("shixun_lists")(options).then(({shixun_list})=>{ + return app.api("shixun_lists")(options).then(res=>{ + let {shixun_list} = res; let length = shixun_list.length; if (!refresh){ shixun_list = this.data.shixun_list.concat(shixun_list); @@ -113,11 +132,15 @@ Component({ var status = length>0?200:205; } this.setData({ shixun_list, status}, wx.hideNavigationBarLoading); + wx.hideLoading(); + return res; }).catch(e=>{ - if(refresh) - this.setData({ shixun_list:[], status:e.code}, wx.hideNavigationBarLoading); - else - this.setData({status:e.code}, wx.hideNavigationBarLoading); + console.log("error!!!!",e, showError) + this.setData({status:e.code}, wx.hideNavigationBarLoading); + wx.hideLoading(); + if(showError) + app.showError(e); + return e; }) } } diff --git a/miniprogram/pages/home/home.js b/miniprogram/pages/home/home.js index 0d30cc5..84fd354 100644 --- a/miniprogram/pages/home/home.js +++ b/miniprogram/pages/home/home.js @@ -11,9 +11,6 @@ Page({ showModal: false, auto_attendance: false }, - log(e){ - ; - }, enterPage({ target: { dataset: { path } } }) { if (!path) return; let { id } = this.data.user; @@ -86,7 +83,7 @@ Page({ break; case 1: wx.navigateTo({ - url: '/avatar/pages/image_crop/image_crop' + url: '/setting/pages/image_crop/image_crop' }); break; } @@ -102,7 +99,7 @@ Page({ app.showMsg(res); this.onShow(); }, - fail: error => { + fail: e=> { if (showToast) app.showError(e); } @@ -120,6 +117,13 @@ Page({ this.setData({ showModal: true }); }, onLoad() { + let user_id = app.user().user_id; + if(user_id!=2&&user_id){ + let key = `cache-users.homepage_info-${app.user().user_id}`; + let cache_homepage = wx.getStorageSync(key); + if(cache_homepage) + this.setData({user: cache_homepage}); + } let data = wx.getStorageSync("auto-attendence"); if (data) this.setData({ auto_attendance: true }); @@ -138,9 +142,12 @@ Page({ let { name: show_name, avatar_url: image_url} = res; if(show_name&&image_url) app.updateUserInfo({ show_name, image_url}); - ; - - this.setData({ user: res }) + this.setData({ user: res }); + let key = `cache-users.homepage_info-${app.user().user_id}`; + wx.setStorage({ + data: res, + key + }) if (!res.attendance_signed && this.data.auto_attendance) this.attendance({ show: 0 }) }); @@ -179,6 +186,5 @@ Page({ app.navigateTo({url:"{user_info}"}); }, onShareAppMessage: function () { - ; } }) \ No newline at end of file diff --git a/miniprogram/pages/home/home.json b/miniprogram/pages/home/home.json index 86f41c3..1b779c6 100644 --- a/miniprogram/pages/home/home.json +++ b/miniprogram/pages/home/home.json @@ -2,6 +2,7 @@ "navigationBarTitleText": "个人中心", "enablePullDownRefresh": false, "usingComponents": { - "iconfont":"/components/iconfont/iconfont" + "iconfont":"/components/iconfont/iconfont", + "mp-icon":"/weui-miniprogram/icon/icon" } } diff --git a/miniprogram/pages/home/home.wxml b/miniprogram/pages/home/home.wxml index bb02ff6..90d0b12 100644 --- a/miniprogram/pages/home/home.wxml +++ b/miniprogram/pages/home/home.wxml @@ -59,6 +59,10 @@ 小程序客服 + + 设置 + + 关于 diff --git a/miniprogram/pages/home/home.wxss b/miniprogram/pages/home/home.wxss index aa81d32..4be4b9b 100644 --- a/miniprogram/pages/home/home.wxss +++ b/miniprogram/pages/home/home.wxss @@ -12,7 +12,7 @@ background: white; border-bottom: 1px solid #eee; padding: 0 14px; - height: 42px; + height: 41px; font-weight: normal; display: flex; align-items: center; @@ -149,6 +149,7 @@ navigator[hidden] { border-radius: 50%; width: 42px; height: 42px; + background: #eee; } .auto-attendance{ transform: scale(0.60); diff --git a/miniprogram/pages/main/main.js b/miniprogram/pages/main/main.js index 3f37eb1..2b9fd8e 100644 --- a/miniprogram/pages/main/main.js +++ b/miniprogram/pages/main/main.js @@ -10,7 +10,6 @@ const titleMap = { shixun:"实训项目", path:"实践课程" } - Page({ data:{ statusBarHeight:20, @@ -48,7 +47,6 @@ Page({ this.switch({current}); }, switchTab({detail:{current, source, value}}){ - ; if(source=="touch"){ this.switch({current}); } diff --git a/miniprogram/pages/main/my_course/course-item/course-item.wxss b/miniprogram/pages/main/my_course/course-item/course-item.wxss index 165382e..95a7cdc 100644 --- a/miniprogram/pages/main/my_course/course-item/course-item.wxss +++ b/miniprogram/pages/main/my_course/course-item/course-item.wxss @@ -57,6 +57,7 @@ overflow: hidden; flex: none; margin: 0 16px 0 8px; + background: #eee; /*for out of network*/ } .course-info{ flex: auto; diff --git a/miniprogram/pages/main/my_course/my_course.js b/miniprogram/pages/main/my_course/my_course.js index 3ddbd60..046fa16 100644 --- a/miniprogram/pages/main/my_course/my_course.js +++ b/miniprogram/pages/main/my_course/my_course.js @@ -3,16 +3,11 @@ 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, attachDir: global.config.attachDir, - categories, + categories: [{ text: "我学习的", value: "study" }, { text: "我管理的", value: "manage" }], statuses: [{ text: "正在进行", value: "processing" }, { text: "已结束", value: "end" }], courses: [], status: 0, @@ -21,26 +16,38 @@ Component({ current_cate: -1 }, attached() { + let user = app.user(); + let key = `cache-weapps.home-${user.user_id}-${user.is_teacher}` + let cache_courses = wx.getStorageSync(key); + if(cache_courses) + this.setData({courses:cache_courses}); // set local cache; this.options = { page: 1, limit: 15 }; - if (app.user().is_teacher) + if (user.is_teacher) var current_cate = 1; else var current_cate = 0; - this.setData({ current_cate }); + this.options["category"] = this.data.categories[current_cate].value; + this.pullCourses({refresh:1}) + .then(res=>{ + if(res.courses){ + var user = app.user(); + wx.setStorageSync(key, res.courses); + } + }); + this.setData({current_cate}); }, pageLifetimes: { show: function () { if (this.data.current_cate >= 0) { - this.pullCourses({ refresh: 2 }); + this.pullCourses({ refresh: 2, showError:0 }); } } }, methods: { - onCategoryChange: function ({ detail: { current, value } }) { - ; + onCategoryChange: function ({ detail: { current, value, source } }) { + if(source!='touch') return; this.options["category"] = value.value; this.pullCourses({ refresh: 1 }); - this.setData({ category: value.value }); }, onStatusChange: function ({ detail: { value } }) { this.options["status"] = value.value; @@ -66,14 +73,12 @@ Component({ */ }, enter_course: function (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 } = {}) { + pullCourses: function ({ refresh = 0, showError=1} = {}) { if (refresh) { if (refresh == 1) { this.options.page = 1; @@ -88,7 +93,7 @@ Component({ } return app.callApi({ name: "weapps.home", data - }) + }) .then(res => { let { courses } = res; if (data.status) @@ -98,15 +103,18 @@ Component({ if (!refresh) courses = this.data.courses.concat(courses); this.setData({ courses, loading: false }); + return res; }).catch(e => { - this.setData({ courses: [], loading: false }); + if(showError) + app.showError(e); + this.setData({loading: false }); + return e; }); }, onReachBottom() { this.pullCourses(); }, onPullDownRefresh: function () { - ; this.pullCourses({ refresh: 2 }); }, } diff --git a/miniprogram/pages/main/my_course/my_course.wxml b/miniprogram/pages/main/my_course/my_course.wxml index c613710..5d5b398 100644 --- a/miniprogram/pages/main/my_course/my_course.wxml +++ b/miniprogram/pages/main/my_course/my_course.wxml @@ -10,7 +10,7 @@ 空空如也! - + diff --git a/miniprogram/pages/main/my_shixun/my_shixun.js b/miniprogram/pages/main/my_shixun/my_shixun.js index 2519a7c..76d68b2 100644 --- a/miniprogram/pages/main/my_shixun/my_shixun.js +++ b/miniprogram/pages/main/my_shixun/my_shixun.js @@ -22,32 +22,34 @@ Component({ }, attached(){ this.options = {page:1, per_page:16}; - this.refresh(); + this.refresh({showError: 1}); }, methods: { onCateChange({detail:{value}}){ - ; this.options.category = value.value - this.pullShixuns({refresh:1}); + this.pullShixuns({refresh:1,showError:1}); }, - refresh(){ + refresh({showError=0}={}){ app.syncUser() .then(res => { if (res.user.user_id != this.user_id) { if(res.user_id==2) this.setData({shixuns:[]}) else - this.pullShixuns({ refresh: 1 }) + this.pullShixuns({ refresh: 1, showError }) this.user_id = res.user.user_id; }else if(this.data.status==200){ - this.pullShixuns({refresh:2}); + this.pullShixuns({refresh:2, showError}); } + }).catch(e=>{ + if(showError) + app.showError(e); }) }, setStatus(status){ this.setData({status}); }, - pullShixuns({refresh=0}={}){ + pullShixuns({refresh=0, showError= 0}={}){ if(refresh){ if(refresh==1){ this.options.page = 1; @@ -72,16 +74,17 @@ Component({ } this.setData({ shixuns, status}); }).catch(e=>{ + if(showError) + app.showError(e); this.setData({shixuns:[], status:e.code}); }) }, onPullDownRefresh(){ - this.pullShixuns({refresh:2}); + this.pullShixuns({refresh:2, showError: 1}); }, onReachBottom(){ - if(this.data.status==200) - this.pullShixuns({refresh:0}); + this.pullShixuns({refresh:0, showError:1}); } } }) diff --git a/miniprogram/pages/tidings/tiding-item/tiding-item.js b/miniprogram/pages/tidings/tiding-item/tiding-item.js index e1688cc..a2671cf 100644 --- a/miniprogram/pages/tidings/tiding-item/tiding-item.js +++ b/miniprogram/pages/tidings/tiding-item/tiding-item.js @@ -37,10 +37,8 @@ Component({ let route = get(ROUTE,data.belong_container_type,{}); route = get(route, data.container_type,{}); route = get(route, data.homework_type); - ; if(!route) return; let url = format(route, data); - ; app.navigateTo({url}); } } diff --git a/miniprogram/pages/tidings/tiding-item/tiding-item.wxml b/miniprogram/pages/tidings/tiding-item/tiding-item.wxml index f7e06b8..99a9e05 100644 --- a/miniprogram/pages/tidings/tiding-item/tiding-item.wxml +++ b/miniprogram/pages/tidings/tiding-item/tiding-item.wxml @@ -2,8 +2,8 @@ - {{data.trigger_user.name}} {{data.time}} - + {{data.trigger_user.name}} {{data.time}}{{data.status?'已处理':'待审批'}} + {{data.content}} diff --git a/miniprogram/pages/tidings/tiding-item/tiding-item.wxss b/miniprogram/pages/tidings/tiding-item/tiding-item.wxss index c37da71..4c43bef 100644 --- a/miniprogram/pages/tidings/tiding-item/tiding-item.wxss +++ b/miniprogram/pages/tidings/tiding-item/tiding-item.wxss @@ -7,6 +7,7 @@ border-radius: 50px; width: 50px; height: 50px; + background: #eee; } .tiding-info{ margin-left: 12px; @@ -17,10 +18,23 @@ color: dimgray; font-size: 14px; } +.todo-tip{ + border-radius: 5px; + padding: 3px; + border: #DD1717 1px solid; + color: #DD1717; + font-size: 10px; + margin-left: 8px; + white-space: nowrap; +} +.todo-tip.finish{ + border-color: #29BD8B; + color: #29BD8B; +} .content{ margin: 8px 0; } -.red-dot{ +.blue-dot{ display: inline-block; height: 7px; width: 7px; diff --git a/miniprogram/pages/tidings/tidings.js b/miniprogram/pages/tidings/tidings.js index 0b34d02..3a06151 100644 --- a/miniprogram/pages/tidings/tidings.js +++ b/miniprogram/pages/tidings/tidings.js @@ -2,10 +2,35 @@ const app = getApp(); Page({ data: { tidings:[], + current: 0, list:[ - {text:"全部", type:""},{text:"课堂提醒",type:"course"},{text:"互动提醒", type:"interaction"},{text:"审核",type:"apply"},{text:"通知", type:"notice"} + {text:"全部", type:""}, + {text:"课堂提醒",type:"course"}, + {text:"审核",type:"apply"}, + {text:"通知", type:"notice"}, + {text:"互动提醒", type:"interaction"}, ] }, + onTapMessage(){ + let tidings = this.data.tidings.filter(i=>{ + return i.tiding_type =='Apply'&&i.status==0 + }); + if(this.data.course_apply_count==tidings.length){ + var flag = true; + var course_id = tidings[0].belong_container_id; + for(var k=1;k { - let {tidings} = res; + let {tidings, course_apply_count} = res; if(!refresh) tidings = this.data.tidings.concat(tidings); - this.setData({ tidings ,loading:0}); + this.setData({ tidings,course_apply_count ,loading:0}); + return res; }).catch(e=>{ - //app.showError(e); + if(showError) + app.showError(e); this.setData({loading:0}); + return e; }) }, onLoad: function (options) { + let key = `cache-users.tidings-${app.user().user_id}`; + let cache_tidings = wx.getStorageSync(key); + if(cache_tidings) + this.setData({tidings: cache_tidings}); this.options = { page: 1, per_page: 10 }; - ; + this.refresh({refresh:1}).then(res=>{ + console.log("pull", res); + this.loaded = 1; + if(res.tidings) + wx.setStorageSync(key, res.tidings); + }) }, _onReachBottom(){ this.refresh(); }, onShow: function () { let index = 2; - this.refresh({refresh:2}) + if(this.loaded) + this.refresh({refresh:2, showError:0}) wx.hideTabBarRedDot({index}); wx.removeTabBarBadge({index}); }, diff --git a/miniprogram/pages/tidings/tidings.wxml b/miniprogram/pages/tidings/tidings.wxml index 2e5bbee..3f7e04f 100644 --- a/miniprogram/pages/tidings/tidings.wxml +++ b/miniprogram/pages/tidings/tidings.wxml @@ -1,8 +1,11 @@ - + + + 您有{{course_apply_count}}条课堂申请待审批 + diff --git a/miniprogram/pages/tidings/tidings.wxss b/miniprogram/pages/tidings/tidings.wxss index ae8c653..4936174 100644 --- a/miniprogram/pages/tidings/tidings.wxss +++ b/miniprogram/pages/tidings/tidings.wxss @@ -3,7 +3,7 @@ flex: none; } .tiding-wrap{ - margin-top: 6px; + margin-top: 3px; } page{ display: flex; @@ -13,4 +13,12 @@ page{ .tidings{ flex: 1 1 1px; height: 1px; +} +.message{ + background: #fa5151; + color: white; + padding: 6px 12px; + border-radius: 8px; + text-align: center; + margin: 4px 16px; } \ No newline at end of file diff --git a/miniprogram/path/pages/path/path.wxss b/miniprogram/path/pages/path/path.wxss index 3849224..7cdbddb 100644 --- a/miniprogram/path/pages/path/path.wxss +++ b/miniprogram/path/pages/path/path.wxss @@ -104,4 +104,5 @@ } .operations>button{ flex: 1; + border-radius: 0; } \ No newline at end of file diff --git a/miniprogram/avatar/.gitignore b/miniprogram/setting/.gitignore similarity index 100% rename from miniprogram/avatar/.gitignore rename to miniprogram/setting/.gitignore diff --git a/miniprogram/avatar/pages/image_crop/image_crop.js b/miniprogram/setting/pages/image_crop/image_crop.js similarity index 100% rename from miniprogram/avatar/pages/image_crop/image_crop.js rename to miniprogram/setting/pages/image_crop/image_crop.js diff --git a/miniprogram/avatar/pages/image_crop/image_crop.json b/miniprogram/setting/pages/image_crop/image_crop.json similarity index 100% rename from miniprogram/avatar/pages/image_crop/image_crop.json rename to miniprogram/setting/pages/image_crop/image_crop.json diff --git a/miniprogram/avatar/pages/image_crop/image_crop.wxml b/miniprogram/setting/pages/image_crop/image_crop.wxml similarity index 100% rename from miniprogram/avatar/pages/image_crop/image_crop.wxml rename to miniprogram/setting/pages/image_crop/image_crop.wxml diff --git a/miniprogram/avatar/pages/image_crop/image_crop.wxss b/miniprogram/setting/pages/image_crop/image_crop.wxss similarity index 100% rename from miniprogram/avatar/pages/image_crop/image_crop.wxss rename to miniprogram/setting/pages/image_crop/image_crop.wxss diff --git a/miniprogram/setting/pages/setting/setting.js b/miniprogram/setting/pages/setting/setting.js new file mode 100644 index 0000000..c62fd5e --- /dev/null +++ b/miniprogram/setting/pages/setting/setting.js @@ -0,0 +1,66 @@ +// miniprogram/setting/pages/setting/setting.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/setting/pages/setting/setting.json b/miniprogram/setting/pages/setting/setting.json new file mode 100644 index 0000000..e8c2c06 --- /dev/null +++ b/miniprogram/setting/pages/setting/setting.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "设置" +} \ No newline at end of file diff --git a/miniprogram/setting/pages/setting/setting.wxml b/miniprogram/setting/pages/setting/setting.wxml new file mode 100644 index 0000000..05ef064 --- /dev/null +++ b/miniprogram/setting/pages/setting/setting.wxml @@ -0,0 +1,2 @@ + +miniprogram/setting/pages/setting/setting.wxml diff --git a/miniprogram/setting/pages/setting/setting.wxss b/miniprogram/setting/pages/setting/setting.wxss new file mode 100644 index 0000000..3f80663 --- /dev/null +++ b/miniprogram/setting/pages/setting/setting.wxss @@ -0,0 +1 @@ +/* miniprogram/setting/pages/setting/setting.wxss */ \ No newline at end of file diff --git a/miniprogram/avatar/we-cropper/dist/we-cropper.min.js b/miniprogram/setting/we-cropper/dist/we-cropper.min.js similarity index 100% rename from miniprogram/avatar/we-cropper/dist/we-cropper.min.js rename to miniprogram/setting/we-cropper/dist/we-cropper.min.js diff --git a/miniprogram/avatar/we-cropper/dist/we-cropper.wxml b/miniprogram/setting/we-cropper/dist/we-cropper.wxml similarity index 100% rename from miniprogram/avatar/we-cropper/dist/we-cropper.wxml rename to miniprogram/setting/we-cropper/dist/we-cropper.wxml diff --git a/miniprogram/shixun/pages/shixun/shixun.wxss b/miniprogram/shixun/pages/shixun/shixun.wxss index 6e05f1c..10e5a22 100644 --- a/miniprogram/shixun/pages/shixun/shixun.wxss +++ b/miniprogram/shixun/pages/shixun/shixun.wxss @@ -78,6 +78,7 @@ justify-content: center; align-content: center; white-space: nowrap; + border-radius: 0; } button.collect, button.send{ background: white!important; diff --git a/miniprogram/task/pages/task/task.wxss b/miniprogram/task/pages/task/task.wxss index 8fa1ad0..093372a 100644 --- a/miniprogram/task/pages/task/task.wxss +++ b/miniprogram/task/pages/task/task.wxss @@ -55,7 +55,7 @@ font: 14px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; white-space: pre; padding: 0px 10px; - height: calc(100vh - 43px); + height: calc(100vh - 42px); flex: auto; } .operations{ @@ -64,6 +64,7 @@ } .operations>button{ flex: auto; + border-radius: 0; } .outcome-swiper{ display: flex; diff --git a/project.config.json b/project.config.json index 8bdfbf1..f09f100 100644 --- a/project.config.json +++ b/project.config.json @@ -163,6 +163,40 @@ "pathName": "path/pages/path_send/path_send", "query": "subject_id=475", "scene": null + }, + { + "id": -1, + "name": "pages/tidings/tidings", + "pathName": "pages/tidings/tidings", + "query": "", + "scene": null + }, + { + "id": -1, + "name": "course/pages/teacher_apply/teacher_apply", + "pathName": "course/pages/teacher_apply/teacher_apply", + "query": "course_id=7582", + "scene": null + }, + { + "id": -1, + "name": "pages/home/home", + "pathName": "pages/home/home", + "query": "", + "scene": null + }, + { + "id": -1, + "name": "pages/tidings/tidings", + "pathName": "pages/tidings/tidings", + "query": "", + "scene": null + }, + { + "id": -1, + "name": "account/pages/accounts/accounts", + "pathName": "account/pages/accounts/accounts", + "scene": null } ] }