diff --git a/README.md b/README.md index f135a8e..1cc3d02 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ # 简介 -educoder微信小程序,帮助使用[educoder平台](https://www.educoder.net)的应用,方便在手机上使用。利用educoder网站的API搭建 +educoder微信小程序,帮助使用[educoder平台](https://www.educoder.net)的应用,方便在手机上使用。 ## 源码 -[https://github/jinke18/smart_class](https://github.com/jinke18/smart_class) ## 小程序码 -![小程序码](/images/weapp_code_smart_class.png) +![小程序码](/images/weacode.jpg) # 功能介绍 @@ -38,27 +37,3 @@ educoder微信小程序,帮助使用[educoder平台](https://www.educoder.net) ## 其他 账号的注册、登陆、找回密码、头像更改等 - -# 实现 -## educoder平台接入 -使用HTTP与平台的api接口交互 - -接口列表如下 -- 搜索课堂https://www.educoder.net/api/courses.json - -- 查询用户的课堂https://www.educoder.net/api/users//courses.json - -- 查询学校https://www.educoder.net/api/schools/school_list.json - -- 新建课堂https://www.educoder.net/api/courses.json - -- 加入课堂https://www.educoder.net/api/courses/apply_to_join_course.json - -- 新建试卷https://www.educoder.net/api/courses//exercises/new.json - -- 查询试卷https://www.educoder.net/api/courses//exercises.json - -- 班级文件资源https://www.educoder.net/api/files.json - -# 教室学员在位情况及分数的同步实现 -使用了[leancloud](https://www.leancloud.cn/)提供的javascript开发包实现数据同步功能, 如学员在位情况、分数的同步, 其底部技术为websocket \ No newline at end of file diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..89db596 --- /dev/null +++ b/changelog.txt @@ -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 隐藏发现页入口 \ No newline at end of file diff --git a/images/wxacode.jpg b/images/wxacode.jpg new file mode 100644 index 0000000..62e4c35 Binary files /dev/null and b/images/wxacode.jpg differ diff --git a/miniprogram/account/pages/change_password/change_password.js b/miniprogram/account/pages/change_password/change_password.js new file mode 100644 index 0000000..135d068 --- /dev/null +++ b/miniprogram/account/pages/change_password/change_password.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/miniprogram/account/pages/change_password/change_password.json b/miniprogram/account/pages/change_password/change_password.json new file mode 100644 index 0000000..7c6e72b --- /dev/null +++ b/miniprogram/account/pages/change_password/change_password.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "修改密码" +} \ No newline at end of file diff --git a/miniprogram/account/pages/change_password/change_password.wxml b/miniprogram/account/pages/change_password/change_password.wxml new file mode 100644 index 0000000..b9a8e61 --- /dev/null +++ b/miniprogram/account/pages/change_password/change_password.wxml @@ -0,0 +1,17 @@ + +
+ + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/miniprogram/account/pages/change_password/change_password.wxss b/miniprogram/account/pages/change_password/change_password.wxss new file mode 100644 index 0000000..0f3b7ca --- /dev/null +++ b/miniprogram/account/pages/change_password/change_password.wxss @@ -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); +} \ No newline at end of file diff --git a/miniprogram/account/pages/login/login.json b/miniprogram/account/pages/login/login.json index bece5b9..e301e43 100644 --- a/miniprogram/account/pages/login/login.json +++ b/miniprogram/account/pages/login/login.json @@ -1,4 +1,4 @@ { - "navigationBarTitleText": "登陆", + "navigationBarTitleText": "登录", "usingComponents": {} } \ No newline at end of file diff --git a/miniprogram/account/pages/login/login.wxml b/miniprogram/account/pages/login/login.wxml index 22afe83..52eedfd 100644 --- a/miniprogram/account/pages/login/login.wxml +++ b/miniprogram/account/pages/login/login.wxml @@ -24,7 +24,7 @@ bindconfirm="login"> - + 注册 diff --git a/miniprogram/account/pages/register/register.wxml b/miniprogram/account/pages/register/register.wxml index df5bd66..7e321fe 100644 --- a/miniprogram/account/pages/register/register.wxml +++ b/miniprogram/account/pages/register/register.wxml @@ -26,7 +26,7 @@ placeholder="输入8-16位密码"> - + - + diff --git a/miniprogram/account/pages/reset_password/reset_password.wxml b/miniprogram/account/pages/reset_password/reset_password.wxml index 4284fa7..543e792 100644 --- a/miniprogram/account/pages/reset_password/reset_password.wxml +++ b/miniprogram/account/pages/reset_password/reset_password.wxml @@ -33,8 +33,8 @@ - 重置后自动登陆 - + 重置后自动登录 + - + diff --git a/miniprogram/account/pages/test/test.js b/miniprogram/account/pages/test/test.js new file mode 100644 index 0000000..4981ae4 --- /dev/null +++ b/miniprogram/account/pages/test/test.js @@ -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) { + + } + + +}) \ No newline at end of file diff --git a/miniprogram/challenge/pages/challenge/challenge.json b/miniprogram/account/pages/test/test.json similarity index 100% rename from miniprogram/challenge/pages/challenge/challenge.json rename to miniprogram/account/pages/test/test.json diff --git a/miniprogram/account/pages/test/test.wxml b/miniprogram/account/pages/test/test.wxml new file mode 100644 index 0000000..876b3a5 --- /dev/null +++ b/miniprogram/account/pages/test/test.wxml @@ -0,0 +1,15 @@ + + + + + + + + + + {{word.value}} + + + \ No newline at end of file diff --git a/miniprogram/account/pages/test/test.wxss b/miniprogram/account/pages/test/test.wxss new file mode 100644 index 0000000..3ef1072 --- /dev/null +++ b/miniprogram/account/pages/test/test.wxss @@ -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; +} \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index 7a73efe..c0d0d6c 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -17,7 +17,6 @@ App({ user(){ return client.user}, syncUser(options){return client.syncUser(options)}, onLaunch: function (options) { - console.log("applaunch",options); if(Object.keys(options.referrerInfo).length>0){ let { appId, extraData } = options.referrerInfo const db = wx.cloud.database(); @@ -32,25 +31,21 @@ App({ } }, onShow(){ - this.api("users.unread_message_info")().then(res=>{ - if(res.unread_message_count) - wx.setTabBarBadge({index:1,text:res.unread_message_count.toString()}); - else if(res.unread_tiding_count) - wx.showTabBarRedDot({index:1}) - }) + client.getTidingInfo(); }, onPageNotFound(res) { this.redirectTo({url:"{my_courses}"}); }, - showError(e){ + showError(e,duration){ wx.showToast({ title: e.message, - icon:"none" + icon:"none", + duration }) }, - showMsg(res){ + showMsg(res, duration){ wx.showToast({ - title: res.message, + title: res.message,duration }) }, getPageUrl(url,root="/"){ diff --git a/miniprogram/app.json b/miniprogram/app.json index d6713f3..8164e07 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,9 +1,16 @@ { + "window": { + "backgroundTextStyle": "dark", + "navigationBarBackgroundColor": "#fbfbfb", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "EduCoder", + "backgroundColor": "#f5f5f5" + }, "pages": [ - "pages/my_courses/my_courses", + "pages/main/main", "pages/findmore/findmore", "pages/courses/courses", - "pages/my/my", + "pages/profile/profile", "pages/tidings/tidings", "path/pages/path/path" ], @@ -15,7 +22,9 @@ "pages/reset_password/reset_password", "pages/register/register", "pages/agreement/agreement", - "pages/about/about" + "pages/about/about", + "pages/test/test", + "pages/change_password/change_password" ] }, { @@ -54,21 +63,27 @@ ] }, { - "root": "challenge", + "root": "task", + "pages": [ + "pages/task/task" + ] + }, + { + "root": "pages/search", "pages": [ - "pages/challenge/challenge" + "search" ] } ], "preloadRule": { - "pages/my/my": { + "pages/profile/profile": { "network": "all", "packages": [ "avatar", "account" ] }, - "pages/my_courses/my_courses": { + "pages/main/main": { "network": "all", "packages": [ "course", @@ -83,20 +98,14 @@ ] } }, - "window": { - "backgroundTextStyle": "dark", - "navigationBarBackgroundColor": "#fbfbfb", - "navigationBarTextStyle": "black", - "navigationBarTitleText": "EduCoder", - "backgroundColor": "#f5f5f5" - }, + "tabBar": { "selectedColor": "#1890ff", "color": "#8a8a8a", "list": [ { - "pagePath": "pages/my_courses/my_courses", - "text": "我的课堂", + "pagePath": "pages/main/main", + "text": "我的", "iconPath": "images/tab_study_default.png", "selectedIconPath": "images/tab_study_pressed.png" }, @@ -107,12 +116,13 @@ "selectedIconPath": "images/tab_tiding_pressed.png" }, { - "pagePath": "pages/my/my", + "pagePath": "pages/profile/profile", "iconPath": "images/tab_my_default.png", "selectedIconPath": "images/tab_my_pressed.png", - "text": "我的" + "text": "个人中心" } ] }, + "navigateToMiniProgramAppIdList":["wx2402d86a6b534f77"], "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss index 79cc539..cf25c3b 100644 --- a/miniprogram/app.wxss +++ b/miniprogram/app.wxss @@ -17,7 +17,7 @@ page { opacity: .6; } .container { - padding: 4px 12px; + padding: 0 12px; } .hint, .error @@ -53,4 +53,17 @@ radio .wx-radio-input.wx-radio-input-checked{ } checkbox .wx-checkbox-input.wx-checkbox-input-checked { color: #00b0f0; +} + +button[type=main][plain],button[type=cap][plain]{ + color: #00b0f0; + border: 1px solid #00b0f0; + background-color: transparent; +} +button[type=cap],button[type=main]{ + background: #00b0f0; + color: white; +} +button[type=cap]{ + border-radius: 30px; } \ No newline at end of file diff --git a/miniprogram/challenge/pages/challenge/challenge.js b/miniprogram/challenge/pages/challenge/challenge.js deleted file mode 100644 index cb17974..0000000 --- a/miniprogram/challenge/pages/challenge/challenge.js +++ /dev/null @@ -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 () { - - } -}) \ No newline at end of file diff --git a/miniprogram/challenge/pages/challenge/challenge.wxml b/miniprogram/challenge/pages/challenge/challenge.wxml deleted file mode 100644 index 143f973..0000000 --- a/miniprogram/challenge/pages/challenge/challenge.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -miniprogram/challenge/pages/challenge/challenge.wxml diff --git a/miniprogram/challenge/pages/challenge/challenge.wxss b/miniprogram/challenge/pages/challenge/challenge.wxss deleted file mode 100644 index 853d600..0000000 --- a/miniprogram/challenge/pages/challenge/challenge.wxss +++ /dev/null @@ -1 +0,0 @@ -/* miniprogram/challenge/pages/challenge/challenge.wxss */ \ No newline at end of file diff --git a/miniprogram/components/add-tips/add-tips.js b/miniprogram/components/add-tips/add-tips.js index fb6ffd6..8724c80 100644 --- a/miniprogram/components/add-tips/add-tips.js +++ b/miniprogram/components/add-tips/add-tips.js @@ -13,39 +13,37 @@ Component({ // 多少秒后关闭 duration: { type: Number, - value: 3.2 + value: 3 } }, - - /** - * 组件的初始数据 - */ data: { - SHOW_TOP: false, - SHOW_MODAL: false + SHOW:false, + SHOW_TOP: true, + SHOW_MODAL: false, + statusBarHeight:20 }, ready: function () { - // 判断是否已经显示过 let cache = wx.getStorageSync(STORAGE_KEY); if (cache) return; - // 没显示过,则进行展示 this.setData({ - SHOW_TOP: true + SHOW:true }); - // 关闭时间 setTimeout(() => { this.setData({ SHOW_TOP: false }) }, this.data.duration * 1000); }, - - /** - * 组件的方法列表 - */ + attached(){ + wx.getSystemInfo({ + success: res=> { + let {statusBarHeight} = res; + this.setData({statusBarHeight}); + } + }) + }, methods: { - // 显示全屏添加说明 showModal: function () { this.setData({ SHOW_TOP: false, @@ -55,7 +53,7 @@ Component({ okHandler: function () { this.setData({ - SHOW_MODAL: false + SHOW: false }); wx.setStorage({ key: STORAGE_KEY, diff --git a/miniprogram/components/add-tips/add-tips.wxml b/miniprogram/components/add-tips/add-tips.wxml index b773bf2..3258eff 100644 --- a/miniprogram/components/add-tips/add-tips.wxml +++ b/miniprogram/components/add-tips/add-tips.wxml @@ -1,24 +1,25 @@ - - - - {{text}} + + + + + {{text}} + - - - + 修改密码 加入课程 创建课程 @@ -14,8 +15,8 @@ 关于 - - + +