diff --git a/miniprogram/account/pages/account/account.js b/miniprogram/account/pages/account/account.js new file mode 100644 index 0000000..7ebbb0e --- /dev/null +++ b/miniprogram/account/pages/account/account.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/miniprogram/account/pages/account/account.json b/miniprogram/account/pages/account/account.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/account/pages/account/account.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/account/pages/account/account.wxml b/miniprogram/account/pages/account/account.wxml new file mode 100644 index 0000000..a4849dc --- /dev/null +++ b/miniprogram/account/pages/account/account.wxml @@ -0,0 +1,41 @@ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/miniprogram/account/pages/account/account.wxss b/miniprogram/account/pages/account/account.wxss new file mode 100644 index 0000000..7c3527f --- /dev/null +++ b/miniprogram/account/pages/account/account.wxss @@ -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; +} + diff --git a/miniprogram/account/pages/change_password/change_password.wxss b/miniprogram/account/pages/change_password/change_password.wxss index 0f3b7ca..8f6173e 100644 --- a/miniprogram/account/pages/change_password/change_password.wxss +++ b/miniprogram/account/pages/change_password/change_password.wxss @@ -12,6 +12,5 @@ } .buttons>button{ - margin: 0 10px; - transform: scale(0.72); + margin-top: 10px; } \ No newline at end of file diff --git a/miniprogram/account/pages/login/login.js b/miniprogram/account/pages/login/login.js index d3b3e3d..382793f 100644 --- a/miniprogram/account/pages/login/login.js +++ b/miniprogram/account/pages/login/login.js @@ -72,20 +72,6 @@ Page({ this.setData({login,password}); 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) { if(options.login){ this.setData({login: options.login}) diff --git a/miniprogram/account/pages/profile/profile.js b/miniprogram/account/pages/profile/profile.js new file mode 100644 index 0000000..ce72c8c --- /dev/null +++ b/miniprogram/account/pages/profile/profile.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/miniprogram/account/pages/profile/profile.json b/miniprogram/account/pages/profile/profile.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/account/pages/profile/profile.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/account/pages/profile/profile.wxml b/miniprogram/account/pages/profile/profile.wxml new file mode 100644 index 0000000..7af57bf --- /dev/null +++ b/miniprogram/account/pages/profile/profile.wxml @@ -0,0 +1,2 @@ + +miniprogram/account/pages/profile/profile.wxml diff --git a/miniprogram/account/pages/profile/profile.wxss b/miniprogram/account/pages/profile/profile.wxss new file mode 100644 index 0000000..c03a7cd --- /dev/null +++ b/miniprogram/account/pages/profile/profile.wxss @@ -0,0 +1 @@ +/* miniprogram/account/pages/profile/profile.wxss */ \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index 2f5e461..ae5f89f 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -33,7 +33,8 @@ App({ wx.getSystemInfo({ success: 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({ url:"https://www.educoder.net/api/accounts/login.json?randomcode=1584017867&client_key=09478441ace530a43e99187a4c9b6d8c", method:"POST", @@ -55,7 +56,8 @@ App({ }) }, onShow(){ - client.getTidingInfo(); + if(client.user_id&&client.user_id!=2) + client.getTidingInfo(); }, onPageNotFound(res) { console.log("page not find!! redirect",res); diff --git a/miniprogram/app.json b/miniprogram/app.json index 87b31d1..849a97b 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -9,10 +9,8 @@ "pages": [ "pages/main/main", "pages/findmore/findmore", - "pages/courses/courses", - "pages/profile/profile", + "pages/home/home", "pages/tidings/tidings", - "path/pages/path/path", "components/rich-md/rich-md" ], "subpackages": [ @@ -25,7 +23,9 @@ "pages/agreement/agreement", "pages/about/about", "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", "pages": [ "search" @@ -78,7 +84,7 @@ } ], "preloadRule": { - "pages/profile/profile": { + "pages/home/home": { "network": "all", "packages": [ "avatar", @@ -101,14 +107,13 @@ "account" ] }, - "shixun/pages/shixun/shixun":{ - "network":"all", - "packages":[ + "shixun/pages/shixun/shixun": { + "network": "all", + "packages": [ "task" ] } }, - "tabBar": { "selectedColor": "#1890ff", "color": "#8a8a8a", @@ -126,13 +131,22 @@ "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", "selectedIconPath": "images/tab_my_pressed.png", "text": "个人中心" } ] }, - "navigateToMiniProgramAppIdList":["wx2402d86a6b534f77"], - "sitemapLocation": "sitemap.json" + "navigateToMiniProgramAppIdList": [ + "wx2402d86a6b534f77" + ], + "sitemapLocation": "sitemap.json", + "style": "v2" } \ No newline at end of file diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss index cf25c3b..deb0f57 100644 --- a/miniprogram/app.wxss +++ b/miniprogram/app.wxss @@ -35,7 +35,15 @@ button.button-main{background:#00b0f0} .border-main{border-color:#00b0f0} .flex-col,.flex-row{display: flex} .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{ overflow: hidden; text-overflow:ellipsis; diff --git a/miniprogram/components/modal/join-course/join-course.js b/miniprogram/components/modal/join-course/join-course.js index a94b415..f605111 100644 --- a/miniprogram/components/modal/join-course/join-course.js +++ b/miniprogram/components/modal/join-course/join-course.js @@ -5,6 +5,19 @@ Component({ hidden:{ type:Boolean, 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:{ type:Number, diff --git a/miniprogram/config.js b/miniprogram/config.js index 7629a34..13c0992 100644 --- a/miniprogram/config.js +++ b/miniprogram/config.js @@ -1,10 +1,13 @@ const cloudDir = "cloud://educoder.6564-educoder-1300855313/"; const eduUrl = "https://www.educoder.net"; /** - * + * A 剪切板邀请码自动读取 + * A 首页点击搜索自动进入所在模块相应类目 + * F 进入搜索页面nav标题错误 + * F 登录后我的实训不自动刷新 */ module.exports = global.config = { - version:"0.12.1", + version:"0.12.2", apiRoot:eduUrl+"/api/", cloudDir, eduUrl, diff --git a/miniprogram/course/pages/course/course.wxml b/miniprogram/course/pages/course/course.wxml index 7a08aa3..8591c2b 100644 --- a/miniprogram/course/pages/course/course.wxml +++ b/miniprogram/course/pages/course/course.wxml @@ -38,9 +38,9 @@ - - - + + + @@ -61,7 +61,7 @@ - + 由于技术限制

小程序端暂不提供[{{module.name}}]模块,请进入官方网站操作
diff --git a/miniprogram/js/apiConfig.js b/miniprogram/js/apiConfig.js index 9e6a8b5..0753e71 100644 --- a/miniprogram/js/apiConfig.js +++ b/miniprogram/js/apiConfig.js @@ -127,15 +127,14 @@ users:{ avatar:{url:"{login}/*",query, form:{image: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"]}, get_user_info:{query,form:{school:1}}, homepage_info:{url:"{login}/*",query}, shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at" ,page:1, sort_direction:"desc",per_page:16}}, system_update:{query:query}, tidings: {query, form:{type:"",page:1,per_page:10}, data:"type:course,project,interaction,apply,notice"}, - unread_message_info:{url:"{login}/*", query}, - home_page:{}, + unread_message_info:{url:"{login}/*", query} }, weapps:{ diff --git a/miniprogram/js/client.js b/miniprogram/js/client.js index 24c42de..fc85dff 100644 --- a/miniprogram/js/client.js +++ b/miniprogram/js/client.js @@ -37,7 +37,6 @@ export default class Client{ this.on("before", "users.accounts.password", getLogin); this.on("before","users.courses", 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.unread_message_info", getLogin); this.on("before","users.shixuns",getLogin); @@ -54,7 +53,7 @@ export default class Client{ this.save_cookies(); }); this.on("success","accounts.login", res=>{ - this.synch=0 + this.synch=0; this.save_cookies(); this.getTidingInfo({login:res.login}); }); @@ -63,8 +62,8 @@ export default class Client{ this.client_key = key(this.randomcode); }) } - getTidingInfo(){ - return this.api("users.unread_message_info")().then(res => { + getTidingInfo({login}={}){ + return this.api("users.unread_message_info")({login}).then(res => { if (res.unread_message_count) wx.setTabBarBadge({ index: 1, text: res.unread_message_count.toString() }); else if (res.unread_tiding_count) @@ -126,6 +125,7 @@ export default class Client{ load_user() { let value = wx.getStorageSync('user') || {}; this.user = value; + this.synch = 1; } save_user() { wx.setStorage({ key: "user", data: this.user }); @@ -142,5 +142,5 @@ export default class Client{ } const client = global.client = new Client(); -client.syncUser(); +client.syncUser({refresh:1}); module.exports = {client}; diff --git a/miniprogram/pages/courses/courses.js b/miniprogram/pages/courses/courses.js deleted file mode 100644 index 3d9bbf6..0000000 --- a/miniprogram/pages/courses/courses.js +++ /dev/null @@ -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); - } - }) - } - } -}) \ No newline at end of file diff --git a/miniprogram/pages/courses/courses.json b/miniprogram/pages/courses/courses.json deleted file mode 100644 index c7bca4f..0000000 --- a/miniprogram/pages/courses/courses.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "usingComponents": { - "join-course-modal": "/components/modal/join-course/join-course" - } - -} \ No newline at end of file diff --git a/miniprogram/pages/courses/courses.wxml b/miniprogram/pages/courses/courses.wxml deleted file mode 100644 index 1412030..0000000 --- a/miniprogram/pages/courses/courses.wxml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - -