commit 1230ba322ae7c972099b99a11599f946af57664b Author: well <347471159@qq.com> Date: Fri Mar 27 10:41:46 2026 +0800 first commit diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3b66410 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "git.ignoreLimitWarning": true +} \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..e3d4470 --- /dev/null +++ b/app.js @@ -0,0 +1,28 @@ +// app.js +App({ + onLaunch() { + + }, + globalData: { + userInfo: null, + usersaveinfo: null, + baseimgurl: 'https://ndnd.duiduiedu.com/', + // baseimgurl:'http://127.0.0.1:8081', + // baseUrl: 'http://127.0.0.1:8006/addons/unishop', + baseUrl: 'https://ndnd.duiduiedu.com/addons/unishop', + wxopenid: '', + session_key: '', + currentuserinfo: null, + wxuserid: 1, + picspaht: 'https://ndnd.duiduiedu.com/uploads/pics' + }, + islogin: function () { + const userinfo = wx.getStorageSync('userinfo'); + if (userinfo == null || userinfo.length == 0) { + wx.redirectTo({ + url: '/pages/userlogin/userlogin', + }) + } + + } +}) \ No newline at end of file diff --git a/app.json b/app.json new file mode 100644 index 0000000..d70067b --- /dev/null +++ b/app.json @@ -0,0 +1,140 @@ +{ + "pages": [ + "pages/index/index", + "pages/indexlives/indexlives", + "pages/leftright/leftright", + "pages/mine/mine", + "pages/tarbar/tarbar", + "pages/grid/grid", + "pages/picsdisplay/picsdisplay", + "pages/swipecell/swipecell", + "pages/main/main", + "pages/livelist/livelist", + "pages/courselearning/courselearning", + "pages/messageencyclopedias/messageencyclopedias", + "pages/messagelist/messagelist", + "pages/communityinfo/communityinfo", + "pages/allpapers/allpapers", + "pages/examlist/examlist", + "pages/caogaozhi/caogaozhi", + "pages/examing/examing", + "pages/singledouble/singledouble", + "pages/exampaper/exampaper", + "pages/exampaper2/exampaper2", + "pages/examanalysis/examanalysis", + "pages/explainnote/explainnote", + "pages/exammakings/exammakings", + "pages/examproblem/examproblem", + "pages/userlogin/userlogin", + "pages/communitylist/communitylist", + "pages/communityitemlist/communityitemlist", + "pages/viprecharge/viprecharge", + "pages/vipquanyi/vipquanyi", + "pages/chargeshop/chargeshop", + "pages/goodsinfo/goodsinfo", + "pages/collectionsub/collectionsub", + "pages/collectioncourse/collectioncourse", + "pages/myaddress/myaddress", + "pages/myorder/myorder", + "pages/livetest/livetest", + "pages/mycommunityinfo/mycommunityinfo", + "pages/myexamanalysis/myexamanalysis", + "pages/newtest/newtest", + "pages/vipmonth/vipmonth", + "pages/createwords/createwords", + "pages/communityinfocomment/communityinfocomment", + "pages/knowledge/knowledge", + "pages/daitika/daitika", + "pages/newmine/newmine", + "pages/indexcourselearning/indexcourselearning", + "pages/indexreslists/indexreslists", + "pages/indexrespage/indexrespage", + "pages/indexlivesvoid/indexlivesvoid", + "pages/indexsq/indexsq", + "pages/indexclass/indexclass", + "pages/indexclassintro/indexclassintro", + "pages/indexclasszx/indexclasszx", + "pages/indexjobtask/indexjobtask", + "pages/indexcreatewords/indexcreatewords", + "pages/indexclassres/indexclassres", + "pages/mytest/mytest", + "pages/indexclasssubwork/indexclasssubwork", + "pages/indexcreatewordssubwork/indexcreatewordssubwork", + "pages/indexobjectivework/indexobjectivework", + "pages/indexobjectactivelist/indexobjectactivelist", + "pages/indexobjectactiveworkok/indexobjectactiveworkok", + "pages/indexreslistsnew/indexreslistsnew", + "pages/classindex/classindex", + "pages/classcommunityitemlist/classcommunityitemlist", + "pages/classcourselearning/classcourselearning", + "pages/camp_list/index", + "pages/camp_detail/index", + "pages/camp_task_text_image/index", + "pages/camp_task_subjective_question/index", + "pages/camp_task_essay_question/index", + "pages/camp_task_objective_questions/index", + "pages/camp_task_objective_questions_result/index" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "Weixin", + "navigationBarTextStyle": "black" + }, + "usingComponents": { + "van-button": "@vant/weapp/button/index", + "van-tab": "@vant/weapp/tab/index", + "van-tabs": "@vant/weapp/tabs/index", + "van-cell": "@vant/weapp/cell/index", + "van-cell-group": "@vant/weapp/cell-group/index", + "van-tabbar": "@vant/weapp/tabbar/index", + "van-tabbar-item": "@vant/weapp/tabbar-item/index", + "van-grid": "@vant/weapp/grid/index", + "van-grid-item": "@vant/weapp/grid-item/index", + "van-image": "@vant/weapp/image/index", + "van-swipe-cell": "@vant/weapp/swipe-cell/index", + "van-divider": "@vant/weapp/divider/index", + "van-progress": "@vant/weapp/progress/index", + "van-count-down": "@vant/weapp/count-down/index", + "van-circle": "@vant/weapp/circle/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-overlay": "@vant/weapp/overlay/index", + "van-field": "@vant/weapp/field/index", + "van-switch": "@vant/weapp/switch/index", + "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", + "van-dropdown-item": "@vant/weapp/dropdown-item/index", + "van-popup": "@vant/weapp/popup/index", + "van-action-sheet": "@vant/weapp/action-sheet/index", + "van-toast": "@vant/weapp/toast/index", + "van-calendar": "@vant/weapp/calendar/index", + "calendar": "/components/calendar/calendar", + "van-checkbox": "@vant/weapp/checkbox/index", + "van-checkbox-group": "@vant/weapp/checkbox-group/index", + "pause-mask": "/components/pause-mask/index" + }, + "sitemapLocation": "sitemap.json", + "tabBar": { + "color": "#66666", + "selectedColor": "#f10b2e", + "list": [ + { + "pagePath": "pages/index/index", + "text": "怼学习", + "iconPath": "./img/footerpic.png", + "selectedIconPath": "./img/footerpic1.png" + }, + { + "pagePath": "pages/indexsq/indexsq", + "text": "怼社区", + "iconPath": "./img/footerpic.png", + "selectedIconPath": "./img/footerpic2.png" + }, + { + "pagePath": "pages/mine/mine", + "text": "怼自己", + "iconPath": "./img/footerpic.png", + "selectedIconPath": "./img/footerpic3.png" + } + ] + } +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..08a83e9 --- /dev/null +++ b/app.wxss @@ -0,0 +1,11 @@ +@import './miniprogram_npm/@vant/weapp/common/index.wxss'; +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content:space-between; + padding: 20rpx 10rpx; + box-sizing: border-box; + overflow-x: hidden !important; +} diff --git a/assets/icons/1.png b/assets/icons/1.png new file mode 100644 index 0000000..e086c10 Binary files /dev/null and b/assets/icons/1.png differ diff --git a/assets/icons/2.png b/assets/icons/2.png new file mode 100644 index 0000000..0ff49f7 Binary files /dev/null and b/assets/icons/2.png differ diff --git a/assets/icons/3.png b/assets/icons/3.png new file mode 100644 index 0000000..ac97344 Binary files /dev/null and b/assets/icons/3.png differ diff --git a/assets/icons/add-comment.png b/assets/icons/add-comment.png new file mode 100644 index 0000000..2e15f2b Binary files /dev/null and b/assets/icons/add-comment.png differ diff --git a/assets/icons/close.png b/assets/icons/close.png new file mode 100644 index 0000000..525b98b Binary files /dev/null and b/assets/icons/close.png differ diff --git a/assets/icons/courses.png b/assets/icons/courses.png new file mode 100644 index 0000000..192ec4e Binary files /dev/null and b/assets/icons/courses.png differ diff --git a/assets/icons/default.png b/assets/icons/default.png new file mode 100644 index 0000000..745e343 Binary files /dev/null and b/assets/icons/default.png differ diff --git a/assets/icons/notpurchased.png b/assets/icons/notpurchased.png new file mode 100644 index 0000000..4714637 Binary files /dev/null and b/assets/icons/notpurchased.png differ diff --git a/assets/icons/pause.png b/assets/icons/pause.png new file mode 100644 index 0000000..a1b65c0 Binary files /dev/null and b/assets/icons/pause.png differ diff --git a/assets/icons/play.png b/assets/icons/play.png new file mode 100644 index 0000000..d08676d Binary files /dev/null and b/assets/icons/play.png differ diff --git a/assets/icons/unlock.png b/assets/icons/unlock.png new file mode 100644 index 0000000..1a2ca19 Binary files /dev/null and b/assets/icons/unlock.png differ diff --git a/assets/images/背景.png b/assets/images/背景.png new file mode 100644 index 0000000..8e70347 Binary files /dev/null and b/assets/images/背景.png differ diff --git a/components/calendar/calendar.js b/components/calendar/calendar.js new file mode 100644 index 0000000..1296978 --- /dev/null +++ b/components/calendar/calendar.js @@ -0,0 +1,149 @@ +// components/calendar/calendar.js +const dayjs = require("./dayjs") +Component({ + /** + * 组件的属性列表 + */ + properties: { + //底下需要展示小圆点的日期数组 + spot: { + type: Array, + value: [] + }, + //组件渲染时默认选中的时间 + defaultDate: { + type: String, + optionalTypes: [Date, Number], + value: '' + } + }, + + /** + * 组件的初始数据 + */ + data: { + dateList: [], //日历主体渲染数组 + selectDay: {}, //选中时间 + open: true, //日历是否展开 + transform: 0 //收起时日历高度偏移倍数 + }, + + /** + * 组件的方法列表 + */ + methods: { + //picker设置月份 + editMonth(e) { + const arr = e.detail.value.split("-") + this.setDate(parseInt(arr[0]), parseInt(arr[1]) - 1) + }, + //上月切换按钮点击 + lastMonth() { + const lastMonth = dayjs(new Date(this.data.selectDay.year, this.data.selectDay.month - 1)) + this.setDate(lastMonth.year(), lastMonth.month()) + }, + //下月切换按钮点击 + nextMonth() { + const nextMonth = dayjs(new Date(this.data.selectDay.year, this.data.selectDay.month + 1)) + this.setDate(nextMonth.year(), nextMonth.month()) + }, + //设置选中日期 + setDate(paramYear, paramMonth, paramDate) { + const date = Math.min(dayjs(`${paramYear}-${paramMonth + 1}`).daysInMonth(), this.data.selectDay.date) + const time = dayjs(`${paramYear}-${paramMonth + 1}-${paramDate || date}`) + const selectDay = { + year: paramYear, + month: paramMonth, + date: paramDate || date, + dateString: time.format("YYYY-MM-DD"), + } + //设置收起时的日历主体偏移量 + let dateListStart = dayjs(`${paramYear}-${paramMonth + 1}`).day(0) + this.setData({ + transform: dayjs(`${paramYear}-${paramMonth + 1}-${paramDate || date}`).day(0).diff(dateListStart, 'week') + }) + if (paramYear !== this.data.selectDay.year) { + this.setData({ + selectDay, + open: true + }) + this.dateListInit(paramYear, paramMonth) + this.triggerEvent("dateChange", this.data.selectDay) + this.triggerEvent("monthChange", this.data.selectDay) + this.triggerEvent("yearChange", this.data.selectDay) + return + } + if (paramMonth !== this.data.selectDay.month) { + this.setData({ + selectDay, + open: true + }) + this.dateListInit(paramYear, paramMonth) + this.triggerEvent("dateChange", this.data.selectDay) + this.triggerEvent("monthChange", this.data.selectDay) + return + } + if (paramDate && paramDate !== this.data.selectDay.date) { + this.setData({ + selectDay + }) + this.triggerEvent("dateChange", this.data.selectDay) + } + + }, + + //展开收起 + openChange() { + this.setData({ + open: !this.data.open + }) + }, + + //日历主体的渲染方法 + dateListInit(paramYear = this.data.selectDay.year, paramMonth = this.data.selectDay.month) { + let dateList = []; //需要遍历的日历数组数据 + let startDate = dayjs(`${paramYear}-${paramMonth + 1}`).day(0) //日历渲染开始日期 + let endDate = dayjs(`${paramYear}-${paramMonth + 1}`).endOf('month').day(6) //日历主体渲染结束日期 + const timeArr = this.data.spot.map(item => { + return dayjs(item).format('YYYY-MM-DD') + }) //底部小圆点需要展示的数组 + while (startDate < endDate) { + const dateString = startDate.format("YYYY-MM-DD") + dateList.push({ + date: startDate.date(), + month: startDate.month(), + year: startDate.year(), + dateString, + spot: timeArr.indexOf(dateString) !== -1 + }) + startDate = startDate.add(1, 'day') + } + this.setData({ + dateList: dateList + }) + }, + + //某一天被点击时 + selectChange(e) { + const year = e.currentTarget.dataset.year + const month = e.currentTarget.dataset.month + const date = e.currentTarget.dataset.date + this.setDate(year, month, date) + } + }, + //组件生命周期 + lifetimes: { + attached() { + let now = this.data.defaultDate ? dayjs(this.data.defaultDate) : dayjs() + this.setDate(now.year(), now.month(), now.date()) + } + }, + //监听参数变化 + observers: { + spot: function (spot) { + console.log("==========") + console.log(spot); + this.dateListInit() + } + } +}) \ No newline at end of file diff --git a/components/calendar/calendar.json b/components/calendar/calendar.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/calendar/calendar.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/calendar/calendar.wxml b/components/calendar/calendar.wxml new file mode 100644 index 0000000..8da6ba6 --- /dev/null +++ b/components/calendar/calendar.wxml @@ -0,0 +1,38 @@ + + + + + {{selectDay.year}}.{{selectDay.month>8?selectDay.month+1:"0"+(selectDay.month+1)}} + + + + + {{open?"收起":"展开"}} + + + + + + + + + + + + + + + + + + + + + {{item.date}} + + + + + + + \ No newline at end of file diff --git a/components/calendar/calendar.wxss b/components/calendar/calendar.wxss new file mode 100644 index 0000000..a1d0213 --- /dev/null +++ b/components/calendar/calendar.wxss @@ -0,0 +1,157 @@ +/* components/calendar/calendar.wxss */ +.flex { + display: flex; + justify-content: space-between; + align-items: center; +} + +.flex-start { + display: flex; + justify-content: flex-start; + align-items: center; +} + +.flex-center { + display: flex; + justify-content: center; + align-items: center; +} + +.flex-end { + display: flex; + justify-content: flex-end; + align-items: center; +} + +.flex-around { + display: flex; + justify-content: space-around; + align-items: center; +} + +.flex1 { + flex: 1; +} + +.flex-wrap { + flex-wrap: wrap; +} + +.align-start { + align-items: flex-start; +} + +.align-end { + align-items: flex-end; +} + +.align-stretch { + align-items: stretch; +} + +.calendar { + background-color: #fff; +} + +.calendar .title { + font-size: 40rpx; + color: #333; + padding: 30rpx; + line-height: 60rpx; +} + +.calendar .title .year-month { + margin-right: 20rpx; +} + +.calendar .title .last-icon { + width: 0; + height: 0; + border-right: 24rpx solid #999; + border-top: 12rpx solid transparent; + border-bottom: 12rpx solid transparent; + margin-left: 10rpx; + +} + +.calendar .title .next-icon { + width: 0; + height: 0; + border-left: 24rpx solid #999; + border-top: 12rpx solid transparent; + border-bottom: 12rpx solid transparent; + margin-left: 40rpx; +} + +.calendar .title .open { + background-color: #f6f6f6; + color: #999; + font-size: 22rpx; + line-height: 36rpx; + border-radius: 18rpx; + padding: 0 14rpx; +} + +.calendar .calendar-week { + line-height: 40rpx; + padding: 0 25rpx; + font-size: 28rpx; + color: #999; +} + +.calendar .calendar-week .view { + width: 100rpx; + text-align: center; +} + +.calendar .calendar-main { + padding: 30rpx 25rpx; +} + +.calendar .calendar-main .date-group { + transition: all 0.3s; + overflow: hidden; + +} + +.calendar .calendar-main .date-transform { + transition: all 0.3s; + +} + +.calendar .calendar-main .day { + position: relative; + width: 100rpx; + color: #666; + text-align: center; + height: 72rpx; +} + +.calendar .calendar-main .day .bg { + height: 56rpx; + line-height: 56rpx; + font-size: 28rpx; + color: #333; + font-weight: bold; +} + +.calendar .calendar-main .day .select { + width: 56rpx; + border-radius: 50%; + text-align: center; + color: #fff; + background: #409eff; + margin: 0 auto; +} + +.calendar .calendar-main .day .other-month { + color: #ccc; +} + +.calendar .calendar-main .day .spot { + width: 8rpx; + height: 8rpx; + background-color: #409eff; + border-radius: 50%; + margin: 6rpx auto 0; +} \ No newline at end of file diff --git a/components/calendar/dayjs.js b/components/calendar/dayjs.js new file mode 100644 index 0000000..4acc24c --- /dev/null +++ b/components/calendar/dayjs.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(v=i),i||!r&&v},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t)}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return O},m.isValid=function(){return!(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t) + + + {{timerText}} + 点击继续答题 + + \ No newline at end of file diff --git a/components/pause-mask/index.wxss b/components/pause-mask/index.wxss new file mode 100644 index 0000000..d990253 --- /dev/null +++ b/components/pause-mask/index.wxss @@ -0,0 +1,65 @@ +.pause-mask { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.85); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + z-index: 1500; + display: flex; + align-items: center; + justify-content: center; + opacity: 0; + visibility: hidden; + pointer-events: none; + transition: all 0.3s ease; +} + +.pause-mask.show { + opacity: 1; + visibility: visible; + pointer-events: auto; +} + +.pause-content { + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + transform: translateY(20rpx); + opacity: 0; + transition: all 0.3s ease; + color: #fff; +} + +.pause-mask.show .pause-content { + transform: translateY(0); + opacity: 1; +} + +.pause-icon { + /* width: 120rpx; + height: 120rpx; */ + margin-bottom: 40rpx; +} + +.pause-title { + font-size: 40rpx; + font-weight: bold; + color: #333; + margin-bottom: 20rpx; +} + +.timer-text { + font-size: 48rpx; + font-weight: bold; + margin-bottom: 20rpx; + color: #fff; +} + +.tip-text { + font-size: 28rpx; + color: rgba(255, 255, 255, 0.8); +} \ No newline at end of file diff --git a/components/question-display/index.js b/components/question-display/index.js new file mode 100644 index 0000000..13d65ec --- /dev/null +++ b/components/question-display/index.js @@ -0,0 +1,93 @@ +Component({ + properties: { + // 题目对象 + question: { + type: Object, + value: {} + }, + // 题目索引 + questionIndex: { + type: Number, + value: 0 + }, + // 用户答案数组(用于显示选中状态) + answers: { + type: Array, + value: [] + }, + // 选项标记数组 + optionMarkers: { + type: Array, + value: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] + }, + // 是否显示答案解析 + showAnalysis: { + type: Boolean, + value: false + }, + // 是否显示答案图标(正确/错误标记) + showAnswerIcon: { + type: Boolean, + value: false + }, + // 是否可点击选项 + clickable: { + type: Boolean, + value: true + } + }, + + data: { + // 组件内部数据 + }, + + attached() { + // 组件挂载时,检查数据 + + }, + + observers: { + // 监听 question 属性变化 + 'question': function(question) { + console.log('question-display 组件 question 属性变化:', question); + } + }, + + methods: { + // 选项点击事件 + onOptionClick(e) { + if (!this.data.clickable) { + return; + } + const index = e.currentTarget.dataset.index; + this.triggerEvent('optionclick', { + optionIndex: index, + questionIndex: this.data.questionIndex + }); + }, + + // 题目容器内触摸:catch 阻止冒泡到问题面板;横向滑动时通知页面切换题目(因 swiper 收不到被 catch 的触摸) + onQuestionTouchStart(e) { + if (e.touches && e.touches[0]) { + this._touchStartX = e.touches[0].clientX; + this._touchStartY = e.touches[0].clientY; + this._swipeHorizontalEmitted = false; + } + }, + onQuestionTouchMove(e) { + if (this._swipeHorizontalEmitted || !e.touches || !e.touches[0]) return; + const dx = e.touches[0].clientX - this._touchStartX; + const dy = e.touches[0].clientY - this._touchStartY; + const threshold = 40; + if (Math.abs(dx) > threshold && Math.abs(dx) > Math.abs(dy)) { + this._swipeHorizontalEmitted = true; + this.triggerEvent('swipehorizontal', { direction: dx > 0 ? 'right' : 'left' }); + } + }, + onQuestionTouchEnd() { + this._swipeHorizontalEmitted = false; + }, + }, + +}); + diff --git a/components/question-display/index.json b/components/question-display/index.json new file mode 100644 index 0000000..a7a3e7a --- /dev/null +++ b/components/question-display/index.json @@ -0,0 +1,5 @@ +{ + "component": true, + "usingComponents": {} +} + diff --git a/components/question-display/index.wxml b/components/question-display/index.wxml new file mode 100644 index 0000000..912c43a --- /dev/null +++ b/components/question-display/index.wxml @@ -0,0 +1,79 @@ + + + + + + {{questionIndex + 1}}. {{question.type === 'single_choice' || question.type === 1 || question.type === 2 ? '单选题' : '多选题'}} + + + + + + + + + + + + {{optionMarkers && optionMarkers[optIndex] ? optionMarkers[optIndex] : String.fromCharCode(65 + optIndex)}} + | + + + + + + + + + ⚠️ 题目没有选项数据 + question: {{question ? '存在' : '不存在'}} + options: {{question && question.options ? question.options.length : '无'}} + + + + + + 你的答案 + {{question.user_answer}} + + + 答案解析 + 正确答案:{{question.correct_answer}} + + + + + + 暂无解析 + + + + + + + + diff --git a/components/question-display/index.wxss b/components/question-display/index.wxss new file mode 100644 index 0000000..9c02736 --- /dev/null +++ b/components/question-display/index.wxss @@ -0,0 +1,155 @@ +.question-page { + display: flex; + flex-direction: column; + width: 100% !important; + height: 100% !important; + box-sizing: border-box; + min-width: 0; + position: relative; + /* padding-top: 20rpx; */ + padding-bottom: 20rpx; +} + +.question-content { + flex: 1; + width: 100% !important; + height: 100% !important; + box-sizing: border-box; + min-width: 0; + display: flex; + flex-direction: column; +} + +.question-content.no-material { + /* 高度由父容器控制 */ +} + +.question-container { + background: #fff; + border-radius: 12rpx; + margin: 0 20rpx 30rpx 20rpx; + padding: 30rpx; + /* box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05); */ + width: calc(100% - 40rpx) !important; + box-sizing: border-box; + flex: 1; + min-width: 0; + min-height: 0; + overflow-y: auto; +} + +.question-header { + margin-bottom: 20rpx; +} + +.question-type { + color: #666; + font-size: 30rpx; +} + +.options-list { + margin-top: 30rpx; + width: 100%; +} + +.option-item { + margin: 20rpx 0; + display: flex; + align-items: center; + padding: 24rpx 30rpx; + background: #fff; + border-radius: 8rpx; + border: 2rpx solid #E5E5E5; + position: relative; + box-sizing: border-box; + width: 100%; + transition: all 0.2s ease; +} + +.option-selected { + background-color: #E3F0FF !important; + border-color: #1A7CFF !important; +} + +.option-selected .option-letter, +.option-selected .option-text, +.option-selected .separator { + color: #1A7CFF !important; +} + +.option-content { + flex: 1; + display: flex; + align-items: center; +} + +.option-letter { + font-size: 32rpx; + color: #333; + font-weight: 500; + min-width: 40rpx; +} + +.option-text { + flex: 1; + font-size: 32rpx; + color: #333; + margin-left: 20rpx; +} + +.separator { + color: #E5E5E5; + margin: 0 20rpx; +} + +.answer-icon { + width: 32rpx; + height: 32rpx; + position: absolute; + right: 30rpx; + top: 50%; + transform: translateY(-50%); +} + +.answer-analysis { + margin-top: 40rpx; + padding: 20rpx; + background: #F5F7FA; + border-radius: 8rpx; +} + +.analysis-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20rpx; +} + +.analysis-title { + font-size: 32rpx; + color: #333; + font-weight: 500; +} + +/* 你的答案:蓝色,与正确答案的绿色区分 */ +.analysis-header-user .user-answer { + font-size: 28rpx; + color: #1890ff; + font-weight: 500; +} + +.correct-answer { + font-size: 28rpx; + color: #52C41A; +} + +.analysis-content { + font-size: 28rpx; + color: #666; + line-height: 1.6; +} + +.bottom-spacing { + height: 40rpx; +} + diff --git a/components/resize-box/index.js b/components/resize-box/index.js new file mode 100644 index 0000000..9ef49c4 --- /dev/null +++ b/components/resize-box/index.js @@ -0,0 +1,105 @@ +Component({ + properties: { + // 当前高度 + height: { + type: Number, + value: 200 + }, + // 最小高度 + minHeight: { + type: Number, + value: 100 + }, + // 最大高度 + maxHeight: { + type: Number, + value: 400 + }, + // 预设高度点,用于自动吸附 + presetHeights: { + type: Array, + value: [100, 150, 200, 250, 300, 350, 400] + }, + showHandle: { + type: Boolean, + value: true + } + }, + + data: { + isResizing: false, + currentStyle: '', + currentHeight: 200 + }, + + observers: { + 'height': function (val) { + // 只有非拖动时才同步外部高度 + if (!this.data.isResizing) { + this.setData({ currentHeight: val }); + } + } + }, + + methods: { + startResize(e) { + const touch = e.touches[0]; + this.startY = touch.clientY; + this.startHeight = this.data.currentHeight; + + this.setData({ + isResizing: true, + currentStyle: 'transition: none;' + }); + + // 触发开始事件 + this.triggerEvent('resizestart', { + height: this.data.height + }); + }, + + onResize(e) { + if (!this.data.isResizing) return; + + const touch = e.touches[0]; + const deltaY = touch.clientY - this.startY; + let newHeight = this.startHeight + deltaY; + + // 限制高度范围 + newHeight = Math.max(this.properties.minHeight, + Math.min(newHeight, this.properties.maxHeight)); + + this.setData({ + currentHeight: newHeight + }); + + // 触发改变事件 + this.triggerEvent('resize', { + height: newHeight + }); + }, + + endResize() { + if (!this.data.isResizing) return; + + const targetHeight = this.calculateTargetHeight(this.data.currentHeight); + + this.setData({ + isResizing: false, + currentStyle: 'transition: height 0.3s cubic-bezier(.4,0,.2,1);', + currentHeight: targetHeight + }); + + // 触发结束事件 + this.triggerEvent('resizeend', { + height: targetHeight + }); + }, + + calculateTargetHeight(currentHeight) { + return this.properties.presetHeights.reduce((prev, curr) => + Math.abs(curr - currentHeight) < Math.abs(prev - currentHeight) ? curr : prev + ); + } + } +}); \ No newline at end of file diff --git a/components/resize-box/index.json b/components/resize-box/index.json new file mode 100644 index 0000000..2df5ba4 --- /dev/null +++ b/components/resize-box/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/resize-box/index.wxml b/components/resize-box/index.wxml new file mode 100644 index 0000000..7f8e596 --- /dev/null +++ b/components/resize-box/index.wxml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/components/resize-box/index.wxss b/components/resize-box/index.wxss new file mode 100644 index 0000000..8605da3 --- /dev/null +++ b/components/resize-box/index.wxss @@ -0,0 +1,48 @@ +.resize-box { + position: relative; + width: 100%; + /* background: #fff; // 由外层控制 */ + /* border-radius: 6px; // 由外层控制 */ + /* border: 1px solid #eee; // 可选 */ + will-change: height; + transform: translateZ(0); + -webkit-transform: translateZ(0); + overflow: hidden; /* 也可以加一层保险 */ +} + +.resize-box.resizing { + transition: none !important; +} + +.resize-handle { + position: absolute; + bottom: -10px; + left: 50%; + transform: translateX(-50%); + width: 60px; + height: 20px; + display: flex; + justify-content: center; + align-items: center; + background: transparent; + z-index: 100; + touch-action: none; +} + +.resize-line { + width: 20px; + height: 2px; + background: #D8D8D8; + border-radius: 1px; + position: relative; +} + +.resize-dots { + position: absolute; + top: -4px; + left: 50%; + transform: translateX(-50%); + width: 10px; + height: 10px; + background: radial-gradient(circle, #999 1px, transparent 1px) 0 0 / 3px 3px; +} \ No newline at end of file diff --git a/config/api.js b/config/api.js new file mode 100644 index 0000000..3aba005 --- /dev/null +++ b/config/api.js @@ -0,0 +1,6 @@ +//测试地址 +const ApiRootUrl = 'https://ndnd.duiduiedu.com/addons/unishop'; +module.exports={ + IndexBanner: ApiRootUrl + 'Banner/List', //获取列表 + IndexUrl: ApiRootUrl + 'News/GetNewsListByPageType', //首页数据接口 +}; diff --git a/config/api_config.js b/config/api_config.js new file mode 100644 index 0000000..df7dd08 --- /dev/null +++ b/config/api_config.js @@ -0,0 +1,62 @@ +// API 域名配置 +// 根据环境自动切换域名 + +// 判断是否为开发环境 +// 可以通过以下方式切换: +// 1. 直接修改下面的 isDevMode 变量 +// 2. 或者通过微信开发者工具的编译条件设置环境变量 +const isDevMode = false; // 改为 true 使用本地开发环境(127.0.0.1:8080) + +const isDev = () => { + return isDevMode; +}; + +// Fiber API 配置(新后端) +const FIBER_API_CONFIG = { + // 开发环境(本地调试) + dev: { + baseURL: 'http://127.0.0.1:8081/api/v1', + }, + // 生产环境(线上部署) + prod: { + baseURL: 'https://api.duiduiedu.com/api/v1', + } +}; + +// PHP API 配置(旧后端,逐步迁移) +const PHP_API_CONFIG = { + // 开发环境 + dev: { + baseURL: 'http://127.0.0.1:8006/addons/unishop', + }, + // 生产环境 + prod: { + baseURL: 'https://ndnd.duiduiedu.com/addons/unishop', + } +}; + +// 获取当前环境配置 +const getFiberApiBaseURL = () => { + return isDev() ? FIBER_API_CONFIG.dev.baseURL : FIBER_API_CONFIG.prod.baseURL; +}; + +const getPhpApiBaseURL = () => { + return isDev() ? PHP_API_CONFIG.dev.baseURL : PHP_API_CONFIG.prod.baseURL; +}; + +export default { + // Fiber API(新后端) + fiberApiBaseURL: getFiberApiBaseURL(), + + // PHP API(旧后端) + phpApiBaseURL: getPhpApiBaseURL(), + + // 图片资源域名 + imageBaseURL: 'https://ndnd.duiduiedu.com/', + + // 工具方法 + isDev, + getFiberApiBaseURL, + getPhpApiBaseURL, +}; + diff --git a/config/camp_api.js b/config/camp_api.js new file mode 100644 index 0000000..f7cc53f --- /dev/null +++ b/config/camp_api.js @@ -0,0 +1,544 @@ +import request from '../utils/request'; + +/** + * 打卡营相关 API 接口 + * 整合了打卡营、任务、订单、支付等所有相关接口 + */ +export const campApi = { + // ==================== 打卡营基础信息 ==================== + + /** + * 获取打卡营分类列表 + */ + getCampCategories: () => { + const url = `/camp/categories?keyword=&page=1&page_size=10`; + return request({ + url, + method: 'GET' + }); + }, + + /** + * 获取打卡营列表 + * @param {String} categoryId - 分类ID,如果为 undefined/null/-1 则返回推荐打卡营 + * @param {String} userId - 用户ID(可选,如果不传则从本地存储获取) + */ + getCamps: (categoryId, userId) => { + const user_id = String(userId || wx.getStorageSync('wxuserid') || ''); + // 已加入打卡营:只返回当前用户已加入的营 + if (categoryId === 'joined') { + return request({ + url: `/camp/camps?joined_only=1&page=1&page_size=50&user_id=${encodeURIComponent(user_id)}`, + method: 'GET' + }); + } + // 推荐打卡营(与后端 RecommendFilter 约定:only_true = 只返回推荐的) + if (!categoryId || categoryId === 'undefined' || categoryId === '-1') { + return request({ + url: `/camp/camps?recommend_filter=only_true&page=1&page_size=20&user_id=${encodeURIComponent(user_id)}`, + method: 'GET' + }); + } + // 按分类筛选 + const url = `/camp/camps?category_id=${categoryId}&page=1&page_size=20&user_id=${encodeURIComponent(user_id)}`; + return request({ + url, + method: 'GET' + }); + }, + + /** + * 获取打卡营详情 + * @param {String} campId - 打卡营ID + * @param {String} userId - 用户ID(可选,如果不传则从本地存储获取) + */ + getCampDetail: (campId, userId) => { + const user_id = String(userId || wx.getStorageSync('wxuserid') || ''); + // 根据 proto 定义,使用查询参数 id + return request({ + url: `/camp/camps/detail?id=${campId}&user_id=${encodeURIComponent(user_id)}`, + method: 'GET' + }); + }, + + /** + * 获取打卡营详情及状态(聚合接口,包含用户状态、小节、任务等完整信息) + * @param {String} campId - 打卡营ID + * @param {String} userId - 用户ID + */ + getCampDetailWithUserStatus: (campId, userId) => { + return request({ + url: `/camp/camp_detail_with_user_status`, + method: 'POST', + data: { + camp_id: String(campId), + user_id: String(userId || wx.getStorageSync('wxuserid') || '') + } + }); + }, + + // ==================== 用户打卡营操作 ==================== + + /** + * 加入打卡营 + * @param {String} campId - 打卡营ID + */ + joinCamp: (campId) => { + return request({ + url: `/camp/user_camp/join`, + method: 'POST', + data: { + user_id: String(wx.getStorageSync('wxuserid') || ''), // 从本地存储获取用户ID + camp_id: campId + } + }); + }, + + /** + * 检查用户是否加入打卡营 + * @param {String} campId - 打卡营ID + */ + checkUserCampStatus: (campId) => { + return request({ + url: `/camp/check_user_camp_status`, + method: 'POST', + data: { + user_id: String(wx.getStorageSync('wxuserid') || ''), // 从本地存储获取用户ID + camp_id: campId + } + }); + }, + + /** + * 重置打卡营进度(新接口) + * @param {String} campId - 打卡营ID + * @param {String} userId - 用户ID + * @param {Boolean} confirm - 是否确认 + */ + resetCampProgress: (campId, userId, confirm = true) => { + return request({ + url: `/camp/user_camp/reset_progress`, + method: 'POST', + data: { + user_id: String(userId || wx.getStorageSync('wxuserid') || ''), + camp_id: String(campId), + confirm: confirm + } + }); + }, + + /** + * 重启打卡营(旧接口,已废弃) + * @deprecated 请使用 resetCampProgress + */ + restartCamp: (campId) => { + return request({ + url: `/camp/${campId}/restart`, + method: 'POST' + }); + }, + + // ==================== 小节相关 ==================== + + /** + * 获取打卡营的小节列表(课程列表) + * @param {String} campId - 打卡营ID + * @param {String} userId - 用户ID(可选,如果不传则从本地存储获取) + */ + getCampCourses: (campId, userId) => { + const user_id = String(userId || wx.getStorageSync('wxuserid') || ''); + // 根据 proto 定义,使用 /camp/sections 接口,通过 camp_id 查询参数 + return request({ + url: `/camp/sections?camp_id=${campId}&page=1&page_size=10&user_id=${encodeURIComponent(user_id)}`, + method: 'GET' + }); + }, + + /** + * 检查是否可开启小节(后端查库:上一小节是否完成等) + * @param {String} campId - 打卡营ID + * @param {String} sectionId - 小节ID + * @returns {Promise<{ success: boolean, can_unlock: boolean, message: string }>} + */ + canUnlockSection: (campId, sectionId) => { + return request({ + url: `/camp/can_unlock_section`, + method: 'POST', + data: { + user_id: String(wx.getStorageSync('wxuserid') || ''), + camp_id: campId, + section_id: sectionId + } + }); + }, + + /** + * 检查任务是否可以开始(前置任务是否已完成) + * @param {String} taskId - 任务ID + * @returns {Promise<{ success: boolean, can_start: boolean, reason: string }>} + */ + canStartTask: (taskId) => { + return request({ + url: `/camp/can_start_task`, + method: 'POST', + data: { + user_id: String(wx.getStorageSync('wxuserid') || ''), + task_id: taskId + } + }); + }, + + /** + * 购买小节(开启第一小节) + * @param {String} campId - 打卡营ID + * @param {String} sectionId - 小节ID + */ + purchaseSection: (campId, sectionId) => { + return request({ + url: `/camp/purchase_section`, + method: 'POST', + data: { + user_id: String(wx.getStorageSync('wxuserid') || ''), + camp_id: campId, + section_id: sectionId + } + }); + }, + + /** + * 获取用户在某营的小节可访问/已购列表 + * @param {String} campId - 打卡营ID + * @param {Number} page - 页码 + * @param {Number} page_size - 每页数量 + */ + listUserSectionAccess: (campId, page = 1, page_size = 1000) => { + return request({ + url: `/camp/list_user_section_access`, + method: 'POST', + data: { + user_id: String(wx.getStorageSync('wxuserid') || ''), + camp_id: campId, + page, + page_size + } + }); + }, + + /** + * 获取每个小节的完成状态 + * @param {String} campId - 打卡营ID + * @param {String} userId - 用户ID + */ + getSectionUserStatus: (campId, userId) => { + return request({ + url: `/camp/section/user-status`, + method: 'POST', + data: { + camp_id: String(campId), + user_id: String(userId || wx.getStorageSync('wxuserid') || '') + } + }); + }, + + /** + * 根据课程小节ID获取用户与课程小节的关联关系 + * @param {String} courseIds - 课程ID列表(逗号分隔) + * @param {String} userId - 用户ID(可选,如果不传则从本地存储获取) + */ + getCourseUserRelations: (courseIds, userId) => { + const user_id = String(userId || wx.getStorageSync('wxuserid') || ''); + return request({ + url: `/camp/course/user-course-relations?course_ids=${courseIds}&user_id=${encodeURIComponent(user_id)}`, + method: 'GET', + }); + }, + + /** + * 获取课程完成状态 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + */ + getCourseCompleted: (campId, courseId) => { + return request({ + url: `/camp/${campId}/course/${courseId}/completed`, + method: 'GET' + }); + }, + + // ==================== 任务相关 ==================== + + /** + * 获取任务详情(需要 campId 和 courseId) + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + * @param {String} taskType - 任务类型 + */ + getTaskDetail: (campId, courseId, taskId, taskType) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}?task_type=${taskType.toUpperCase()}`, + method: 'GET', + }); + }, + + /** + * 按任务ID直接获取任务详情(无需 campId/courseId) + * @param {String} taskId - 任务ID + * @param {String} userId - 用户ID(可选,如果不传则从本地存储获取) + */ + getTaskDetailById: (taskId, userId) => { + const user_id = String(userId || wx.getStorageSync('wxuserid') || ''); + return request({ + url: `/camp/tasks/detail?id=${taskId}&user_id=${encodeURIComponent(user_id)}`, + method: 'GET', + }); + }, + + /** + * 根据任务ID获取任务与用户的关联关系 + * @param {String} taskIds - 任务ID列表(逗号分隔) + * @param {String} userId - 用户ID(可选,如果不传则从本地存储获取) + */ + getCampTaskUserRelations: (taskIds, userId) => { + const user_id = String(userId || wx.getStorageSync('wxuserid') || ''); + return request({ + url: `/camp/task/user_task?task_ids=${taskIds}&user_id=${encodeURIComponent(user_id)}`, + method: 'GET', + }); + }, + + // ==================== 任务进度相关 ==================== + + /** + * 获取用户任务进度详情 + * @param {String} userId - 用户ID + * @param {String} taskId - 任务ID + */ + getProgressDetail: (userId, taskId) => { + // GET 请求的参数作为 query 参数传递(兼容微信小程序,不使用 URLSearchParams) + const user_id = encodeURIComponent(String(userId)); + const task_id = encodeURIComponent(String(taskId)); + return request({ + url: `/camp/progress/info?user_id=${user_id}&task_id=${task_id}`, + method: 'GET' + }); + // 注意:request.js 已处理,当 success=false 时不会显示错误提示(没有进度是正常情况) + }, + + /** + * 更新任务通用进度 + * @param {Object} data - 进度数据 + */ + updateCampProgress: (data) => { + return request({ + url: `/camp/progress/update`, + method: 'POST', + data: data + }); + }, + + /** + * 重置任务进度(用户重新答题) + * @param {Object} data - 重置数据 + */ + resetTaskProgress: (data) => { + return request({ + url: `/camp/reset_task_progress`, + method: 'POST', + data: data + }); + }, + + // ==================== 任务类型特定接口 ==================== + + /** + * 更新视频任务进度 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + * @param {Object} data - 进度数据 + */ + updateVideoProgress: (campId, courseId, taskId, data) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/video`, + method: 'POST', + data: data + }); + }, + + /** + * 更新文本图片任务进度 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + * @param {Object} data - 进度数据 + */ + updateTextImageProgress: (campId, courseId, taskId, data) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/text-image`, + method: 'POST', + data: data + }); + }, + + /** + * 更新主观题任务进度 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + * @param {Object} data - 进度数据 + */ + updateSubjectiveQuestionProgress: (campId, courseId, taskId, data) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/subjective`, + method: 'POST', + data: data + }); + }, + + /** + * 更新申论任务进度 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + * @param {Object} data - 进度数据 + */ + updateEssayProgress: (campId, courseId, taskId, data) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/essay-question/essay`, + method: 'POST', + data: data + }); + }, + + /** + * 更新客观题任务进度 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + * @param {Object} data - 进度数据 + */ + updateObjectiveQuestionProgress: (campId, courseId, taskId, data) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/objective`, + method: 'POST', + data: data + }); + }, + + // ==================== 任务答案相关 ==================== + + /** + * 获取主观题任务的用户答案 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + */ + getSubjectiveTaskUserAnswer: (campId, courseId, taskId) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/subjective/user-answer`, + method: 'GET', + }); + }, + + /** + * 获取申论题任务所有问题的用户答案 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + */ + getEssayQuestionUserAnswer: (campId, courseId, taskId) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/essay-question/user-answer`, + method: 'GET', + }); + }, + + /** + * 获取申论题任务是否需要审核 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + */ + getEssayTaskReviewStatus: (campId, courseId, taskId) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/essay-question/need-audit`, + method: 'GET', + }); + }, + + /** + * 获取客观题答题结算结果 + * @param {String} campId - 打卡营ID + * @param {String} courseId - 课程ID + * @param {String} taskId - 任务ID + */ + getObjectiveQuestionSettlementResult: (campId, courseId, taskId) => { + return request({ + url: `/camp/${campId}/course/${courseId}/tasks/${taskId}/objective/settlement-result`, + method: 'GET', + }); + }, + + // ==================== 订单相关 ==================== + + /** + * 创建订单(打卡营小节) + * @param {Object} orderData - 订单数据 + */ + createOrder: (orderData) => { + return request({ + url: `/order/create`, + method: 'POST', + data: orderData + }); + }, + + /** + * 取消订单 + * @param {Object} orderData - 订单数据 + */ + cancelOrder: (orderData) => { + return request({ + url: `/order/cancel`, + method: 'POST', + data: orderData + }); + }, + + // ==================== 支付相关 ==================== + + /** + * 创建支付(获取预支付ID) + * @param {Object} paymentData - 支付数据 + */ + createPayment: (paymentData) => { + return request({ + url: `/pay/create`, + method: 'POST', + data: paymentData + }); + }, + + /** + * 创建打卡营小节支付请求订单(已废弃,使用 createOrder + createPayment) + * @deprecated 请使用 createOrder + createPayment + */ + createCampPayment: (campId, courseId) => { + return request({ + url: `/camp/${campId}/course/${courseId}/order`, + method: 'POST', + }); + }, + + /** + * 取消支付 + * @deprecated 请使用 cancelOrder + */ + cancelCampPayment: (campId, orderId) => { + return request({ + url: `/camp/${campId}/order/${orderId}/cancel`, + method: 'POST', + }); + }, +}; diff --git a/config/question_api.js b/config/question_api.js new file mode 100644 index 0000000..2ed2063 --- /dev/null +++ b/config/question_api.js @@ -0,0 +1,144 @@ +import apiConfig from './api_config.js'; +import request from '../utils/request.js'; + +// Fiber 后端请求函数 +// 注意:request 函数内部已经会拼接 baseURL,所以这里只需要传入相对路径 +function fiberRequest(options) { + return request({ + url: options.url, // 只传入相对路径,request 函数会拼接 baseURL + method: options.method || 'GET', + data: options.data, + header: options.header || {} + }); +} + +export const questionApi = { + /** + * 获取试卷详情(使用 Fiber 后端) + * @param {string} paperId 试卷ID + * @returns {Promise} 试卷数据 + */ + getPaperDetail: (paperId) => { + return fiberRequest({ + url: `/paper/detail?id=${paperId}`, + method: 'GET' + }).then(res => { + // 转换 Fiber 后端返回格式为前端期望的格式 + if (res.success && res.paper) { + return { + success: true, + code: 200, + data: res.paper, + paper: res.paper // 兼容旧格式 + }; + } + return res; + }); + }, + + /** + * 获取试卷(兼容旧接口,接受 paperId 和 taskId) + * @param {string} paperId 试卷ID + * @param {string} taskId 任务ID(可选) + * @returns {Promise} 试卷数据 + */ + getExamPaper: (paperId, taskId) => { + return questionApi.getPaperDetail(paperId); + }, + + /** + * 获取试卷详情(包含答案和解析,用于答题结果页面) + * @param {string} paperId 试卷ID + * @returns {Promise} 试卷数据(包含答案和解析) + */ + getPaperWithAnswers: (paperId) => { + return fiberRequest({ + url: `/paper/result?id=${paperId}`, + method: 'GET' + }).then(res => { + // 转换 Fiber 后端返回格式为前端期望的格式 + if (res.success && (res.paper || res.data)) { + const paper = res.paper || res.data; + return { + success: true, + code: 200, + data: paper, + paper: paper // 兼容旧格式 + }; + } + return res; + }); + }, + + /** + * 创建答题记录(使用 Fiber 后端) + * @param {object} data 答题记录数据 + * @param {string} data.user_id 用户ID + * @param {string} data.paper_id 试卷ID + * @param {number} data.start_time 开始时间(Unix时间戳,秒) + * @param {number} data.end_time 结束时间(Unix时间戳,秒) + * @param {array} data.answers 答案数组 + * @returns {Promise} 创建结果 + */ + createAnswerRecord: (data) => { + // 转换前端数据格式为 Fiber 后端期望的格式 + const fiberData = { + user_id: String(data.user_id), + paper_id: String(data.paper_id), + task_id: data.task_id ? String(data.task_id) : '', // 打卡营任务ID,用于不同打卡营的答题隔离 + start_time: data.start_time || Math.floor(Date.now() / 1000), + end_time: data.end_time || Math.floor(Date.now() / 1000), + answers: (data.answers || []).map(answer => ({ + question_id: String(answer.question_id), + user_answer: String(answer.user_answer || '') + })) + }; + + return fiberRequest({ + url: `/answer_record/create`, + method: 'POST', + data: fiberData + }).then(res => { + // 转换 Fiber 后端返回格式为前端期望的格式 + if (res.success) { + return { + success: true, + code: 200, + ...res + }; + } + return res; + }); + }, + + /** + * 获取答题记录(使用 Fiber 后端) + * @param {string} userId 用户ID + * @param {string} paperId 试卷ID + * @param {number} page 页码 + * @param {number} pageSize 每页数量 + * @returns {Promise} 答题记录列表 + */ + getAnswerRecord: (userId, paperId, page = 1, pageSize = 100, taskId = '') => { + let url = `/answer_record/detail?user_id=${userId}&paper_id=${paperId}&page=${page}&page_size=${pageSize}`; + if (taskId) { + url += `&task_id=${taskId}`; + } + return fiberRequest({ + url: url, + method: 'GET' + }).then(res => { + // 转换 Fiber 后端返回格式为前端期望的格式 + if (res.success) { + return { + success: true, + code: 200, + ...res + }; + } + return res; + }); + } +}; + + diff --git a/config/util.js b/config/util.js new file mode 100644 index 0000000..3c79781 --- /dev/null +++ b/config/util.js @@ -0,0 +1,59 @@ +/** + * GET请求封装 + */ +function get(url, data = {}) { + return request(url, data, 'GET') +} + +/** + * POST请求封装 + */ +function post(url, data = {}) { + return request(url, data, 'POST') +} + +/** + * 微信的request + */ +function request(url, data = {}, method = "GET") { + var contentType = 'application/json' + return new Promise(function(resolve, reject) { + wx.request({ + url: url, + data: data, + method: method, + header: { + 'Content-Type': contentType + }, + success: function(res) { + console.log('===============================================================================================') + console.log('== 接口地址:' + url) + console.log('== 接口参数:' + JSON.stringify(data)) + console.log('== 请求类型:' + method) + console.log("== 接口状态:" + res.statusCode); + console.log('===============================================================================================') + if (res.statusCode == 200) { + resolve(res.data); + } else { + //请求失败 + reject("请求失败:" + res.statusCode) + } + }, + fail: function(err) { + //服务器连接异常 + console.log('===============================================================================================') + console.log('== 接口地址:' + url) + console.log('== 接口参数:' + JSON.stringify(data)) + console.log('== 请求类型:' + method) + console.log("== 服务器连接异常") + console.log('===============================================================================================') + reject("服务器连接异常,请检查网络再试") + } + }) + }); +} +module.exports = { + request, + get, + post +} diff --git a/img/cgz_03.png b/img/cgz_03.png new file mode 100644 index 0000000..cd485fb Binary files /dev/null and b/img/cgz_03.png differ diff --git a/img/cgz_05.png b/img/cgz_05.png new file mode 100644 index 0000000..35ebbbf Binary files /dev/null and b/img/cgz_05.png differ diff --git a/img/cgz_07.png b/img/cgz_07.png new file mode 100644 index 0000000..d3e257d Binary files /dev/null and b/img/cgz_07.png differ diff --git a/img/cgz_09.png b/img/cgz_09.png new file mode 100644 index 0000000..94cbf22 Binary files /dev/null and b/img/cgz_09.png differ diff --git a/img/footerpic.png b/img/footerpic.png new file mode 100644 index 0000000..59bfca1 Binary files /dev/null and b/img/footerpic.png differ diff --git a/img/footerpic1.png b/img/footerpic1.png new file mode 100644 index 0000000..284967b Binary files /dev/null and b/img/footerpic1.png differ diff --git a/img/footerpic2.png b/img/footerpic2.png new file mode 100644 index 0000000..0d3111a Binary files /dev/null and b/img/footerpic2.png differ diff --git a/img/footerpic3.png b/img/footerpic3.png new file mode 100644 index 0000000..b8cd6b0 Binary files /dev/null and b/img/footerpic3.png differ diff --git a/img/minemainback.png b/img/minemainback.png new file mode 100644 index 0000000..9036975 Binary files /dev/null and b/img/minemainback.png differ diff --git a/img/pause.png b/img/pause.png new file mode 100644 index 0000000..e910cfe Binary files /dev/null and b/img/pause.png differ diff --git a/img/play.png b/img/play.png new file mode 100644 index 0000000..e5884a3 Binary files /dev/null and b/img/play.png differ diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.js b/miniprogram_npm/@vant/weapp/action-sheet/index.js new file mode 100644 index 0000000..48e5a81 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.js @@ -0,0 +1,76 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var button_1 = require('../mixins/button'); +component_1.VantComponent({ + mixins: [button_1.button], + props: { + show: Boolean, + title: String, + cancelText: String, + description: String, + round: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 100, + }, + actions: { + type: Array, + value: [], + }, + overlay: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + closeOnClickAction: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + }, + methods: { + onSelect: function (event) { + var _this = this; + var index = event.currentTarget.dataset.index; + var _a = this.data, + actions = _a.actions, + closeOnClickAction = _a.closeOnClickAction, + canIUseGetUserProfile = _a.canIUseGetUserProfile; + var item = actions[index]; + if (item) { + this.$emit('select', item); + if (closeOnClickAction) { + this.onClose(); + } + if (item.openType === 'getUserInfo' && canIUseGetUserProfile) { + wx.getUserProfile({ + desc: item.getUserProfileDesc || ' ', + complete: function (userProfile) { + _this.$emit('getuserinfo', userProfile); + }, + }); + } + } + }, + onCancel: function () { + this.$emit('cancel'); + }, + onClose: function () { + this.$emit('close'); + }, + onClickOverlay: function () { + this.$emit('click-overlay'); + this.onClose(); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.json b/miniprogram_npm/@vant/weapp/action-sheet/index.json new file mode 100644 index 0000000..19bf989 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-popup": "../popup/index", + "van-loading": "../loading/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.wxml b/miniprogram_npm/@vant/weapp/action-sheet/index.wxml new file mode 100644 index 0000000..b04cc3a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.wxml @@ -0,0 +1,69 @@ + + + + + {{ title }} + + + + {{ description }} + + + + + + + + + + {{ cancelText }} + + + diff --git a/miniprogram_npm/@vant/weapp/action-sheet/index.wxss b/miniprogram_npm/@vant/weapp/action-sheet/index.wxss new file mode 100644 index 0000000..b48babc --- /dev/null +++ b/miniprogram_npm/@vant/weapp/action-sheet/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;max-height:var(--action-sheet-max-height,90%)!important;color:#323233;color:var(--action-sheet-item-text-color,#323233)}.van-action-sheet__cancel,.van-action-sheet__item{padding:14px 16px;text-align:center;font-size:16px;font-size:var(--action-sheet-item-font-size,16px);line-height:22px;line-height:var(--action-sheet-item-line-height,22px);background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:#646566;color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{display:block;height:8px;height:var(--action-sheet-cancel-padding-top,8px);background-color:#f7f8fa;background-color:var(--action-sheet-cancel-padding-color,#f7f8fa)}.van-action-sheet__item--disabled{color:#c8c9cc;color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{margin-top:8px;margin-top:var(--padding-xs,8px);font-size:12px;font-size:var(--action-sheet-subname-font-size,12px);color:#969799;color:var(--action-sheet-subname-color,#969799);line-height:20px;line-height:var(--action-sheet-subname-line-height,20px)}.van-action-sheet__header{text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--action-sheet-header-font-size,16px);line-height:48px;line-height:var(--action-sheet-header-height,48px)}.van-action-sheet__description{text-align:center;padding:20px 16px;padding:20px var(--padding-md,16px);color:#969799;color:var(--action-sheet-description-color,#969799);font-size:14px;font-size:var(--action-sheet-description-font-size,14px);line-height:20px;line-height:var(--action-sheet-description-line-height,20px)}.van-action-sheet__close{position:absolute!important;top:0;right:0;line-height:inherit!important;padding:0 16px;padding:var(--action-sheet-close-icon-padding,0 16px);font-size:22px!important;font-size:var(--action-sheet-close-icon-size,22px)!important;color:#c8c9cc;color:var(--action-sheet-close-icon-color,#c8c9cc)}.van-action-sheet__loading{display:flex!important} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/area/index.js b/miniprogram_npm/@vant/weapp/area/index.js new file mode 100644 index 0000000..6b17a07 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.js @@ -0,0 +1,266 @@ +'use strict'; +var __assign = + (this && this.__assign) || + function () { + __assign = + Object.assign || + function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var shared_1 = require('../picker/shared'); +var utils_1 = require('../common/utils'); +var EMPTY_CODE = '000000'; +component_1.VantComponent({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: __assign(__assign({}, shared_1.pickerProps), { + value: { + type: String, + observer: function (value) { + this.code = value; + this.setValues(); + }, + }, + areaList: { + type: Object, + value: {}, + observer: 'setValues', + }, + columnsNum: { + type: null, + value: 3, + }, + columnsPlaceholder: { + type: Array, + observer: function (val) { + this.setData({ + typeToColumnsPlaceholder: { + province: val[0] || '', + city: val[1] || '', + county: val[2] || '', + }, + }); + }, + }, + }), + data: { + columns: [{ values: [] }, { values: [] }, { values: [] }], + typeToColumnsPlaceholder: {}, + }, + mounted: function () { + var _this = this; + utils_1.requestAnimationFrame(function () { + _this.setValues(); + }); + }, + methods: { + getPicker: function () { + if (this.picker == null) { + this.picker = this.selectComponent('.van-area__picker'); + } + return this.picker; + }, + onCancel: function (event) { + this.emit('cancel', event.detail); + }, + onConfirm: function (event) { + var index = event.detail.index; + var value = event.detail.value; + value = this.parseValues(value); + this.emit('confirm', { value: value, index: index }); + }, + emit: function (type, detail) { + detail.values = detail.value; + delete detail.value; + this.$emit(type, detail); + }, + parseValues: function (values) { + var columnsPlaceholder = this.data.columnsPlaceholder; + return values.map(function (value, index) { + if ( + value && + (!value.code || value.name === columnsPlaceholder[index]) + ) { + return __assign(__assign({}, value), { code: '', name: '' }); + } + return value; + }); + }, + onChange: function (event) { + var _this = this; + var _a; + var _b = event.detail, + index = _b.index, + picker = _b.picker, + value = _b.value; + this.code = value[index].code; + (_a = this.setValues()) === null || _a === void 0 + ? void 0 + : _a.then(function () { + _this.$emit('change', { + picker: picker, + values: _this.parseValues(picker.getValues()), + index: index, + }); + }); + }, + getConfig: function (type) { + var areaList = this.data.areaList; + return (areaList && areaList[type + '_list']) || {}; + }, + getList: function (type, code) { + if (type !== 'province' && !code) { + return []; + } + var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder; + var list = this.getConfig(type); + var result = Object.keys(list).map(function (code) { + return { + code: code, + name: list[code], + }; + }); + if (code != null) { + // oversea code + if (code[0] === '9' && type === 'city') { + code = '9'; + } + result = result.filter(function (item) { + return item.code.indexOf(code) === 0; + }); + } + if (typeToColumnsPlaceholder[type] && result.length) { + // set columns placeholder + var codeFill = + type === 'province' + ? '' + : type === 'city' + ? EMPTY_CODE.slice(2, 4) + : EMPTY_CODE.slice(4, 6); + result.unshift({ + code: '' + code + codeFill, + name: typeToColumnsPlaceholder[type], + }); + } + return result; + }, + getIndex: function (type, code) { + var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6; + var list = this.getList(type, code.slice(0, compareNum - 2)); + // oversea code + if (code[0] === '9' && type === 'province') { + compareNum = 1; + } + code = code.slice(0, compareNum); + for (var i = 0; i < list.length; i++) { + if (list[i].code.slice(0, compareNum) === code) { + return i; + } + } + return 0; + }, + setValues: function () { + var picker = this.getPicker(); + if (!picker) { + return; + } + var code = this.code || this.getDefaultCode(); + var provinceList = this.getList('province'); + var cityList = this.getList('city', code.slice(0, 2)); + var stack = []; + var indexes = []; + var columnsNum = this.data.columnsNum; + if (columnsNum >= 1) { + stack.push(picker.setColumnValues(0, provinceList, false)); + indexes.push(this.getIndex('province', code)); + } + if (columnsNum >= 2) { + stack.push(picker.setColumnValues(1, cityList, false)); + indexes.push(this.getIndex('city', code)); + if (cityList.length && code.slice(2, 4) === '00') { + code = cityList[0].code; + } + } + if (columnsNum === 3) { + stack.push( + picker.setColumnValues( + 2, + this.getList('county', code.slice(0, 4)), + false + ) + ); + indexes.push(this.getIndex('county', code)); + } + return Promise.all(stack) + .catch(function () {}) + .then(function () { + return picker.setIndexes(indexes); + }) + .catch(function () {}); + }, + getDefaultCode: function () { + var columnsPlaceholder = this.data.columnsPlaceholder; + if (columnsPlaceholder.length) { + return EMPTY_CODE; + } + var countyCodes = Object.keys(this.getConfig('county')); + if (countyCodes[0]) { + return countyCodes[0]; + } + var cityCodes = Object.keys(this.getConfig('city')); + if (cityCodes[0]) { + return cityCodes[0]; + } + return ''; + }, + getValues: function () { + var picker = this.getPicker(); + if (!picker) { + return []; + } + return this.parseValues( + picker.getValues().filter(function (value) { + return !!value; + }) + ); + }, + getDetail: function () { + var values = this.getValues(); + var area = { + code: '', + country: '', + province: '', + city: '', + county: '', + }; + if (!values.length) { + return area; + } + var names = values.map(function (item) { + return item.name; + }); + area.code = values[values.length - 1].code; + if (area.code[0] === '9') { + area.country = names[1] || ''; + area.province = names[2] || ''; + } else { + area.province = names[0] || ''; + area.city = names[1] || ''; + area.county = names[2] || ''; + } + return area; + }, + reset: function (code) { + this.code = code || ''; + return this.setValues(); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/area/index.json b/miniprogram_npm/@vant/weapp/area/index.json new file mode 100644 index 0000000..a778e91 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/area/index.wxml b/miniprogram_npm/@vant/weapp/area/index.wxml new file mode 100644 index 0000000..f7dc51f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.wxml @@ -0,0 +1,20 @@ + + + diff --git a/miniprogram_npm/@vant/weapp/area/index.wxs b/miniprogram_npm/@vant/weapp/area/index.wxs new file mode 100644 index 0000000..07723c1 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.wxs @@ -0,0 +1,8 @@ +/* eslint-disable */ +function displayColumns(columns, columnsNum) { + return columns.slice(0, +columnsNum); +} + +module.exports = { + displayColumns: displayColumns, +}; diff --git a/miniprogram_npm/@vant/weapp/area/index.wxss b/miniprogram_npm/@vant/weapp/area/index.wxss new file mode 100644 index 0000000..99694d6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/area/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/button/index.js b/miniprogram_npm/@vant/weapp/button/index.js new file mode 100644 index 0000000..caff63c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.js @@ -0,0 +1,71 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var button_1 = require('../mixins/button'); +var version_1 = require('../common/version'); +var mixins = [button_1.button]; +if (version_1.canIUseFormFieldButton()) { + mixins.push('wx://form-field-button'); +} +component_1.VantComponent({ + mixins: mixins, + classes: ['hover-class', 'loading-class'], + data: { + baseStyle: '', + }, + props: { + formType: String, + icon: String, + classPrefix: { + type: String, + value: 'van-icon', + }, + plain: Boolean, + block: Boolean, + round: Boolean, + square: Boolean, + loading: Boolean, + hairline: Boolean, + disabled: Boolean, + loadingText: String, + customStyle: String, + loadingType: { + type: String, + value: 'circular', + }, + type: { + type: String, + value: 'default', + }, + dataset: null, + size: { + type: String, + value: 'normal', + }, + loadingSize: { + type: String, + value: '20px', + }, + color: String, + }, + methods: { + onClick: function (event) { + var _this = this; + this.$emit('click', event); + var _a = this.data, + canIUseGetUserProfile = _a.canIUseGetUserProfile, + openType = _a.openType, + getUserProfileDesc = _a.getUserProfileDesc, + lang = _a.lang; + if (openType === 'getUserInfo' && canIUseGetUserProfile) { + wx.getUserProfile({ + desc: getUserProfileDesc || ' ', + lang: lang || 'en', + complete: function (userProfile) { + _this.$emit('getuserinfo', userProfile); + }, + }); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/button/index.json b/miniprogram_npm/@vant/weapp/button/index.json new file mode 100644 index 0000000..e00a588 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/button/index.wxml b/miniprogram_npm/@vant/weapp/button/index.wxml new file mode 100644 index 0000000..8034845 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.wxml @@ -0,0 +1,53 @@ + + + + diff --git a/miniprogram_npm/@vant/weapp/button/index.wxs b/miniprogram_npm/@vant/weapp/button/index.wxs new file mode 100644 index 0000000..8b649fe --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.wxs @@ -0,0 +1,39 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function rootStyle(data) { + if (!data.color) { + return data.customStyle; + } + + var properties = { + color: data.plain ? data.color : '#fff', + background: data.plain ? null : data.color, + }; + + // hide border when color is linear-gradient + if (data.color.indexOf('gradient') !== -1) { + properties.border = 0; + } else { + properties['border-color'] = data.color; + } + + return style([properties, data.customStyle]); +} + +function loadingColor(data) { + if (data.plain) { + return data.color ? data.color : '#c9c9c9'; + } + + if (data.type === 'default') { + return '#c9c9c9'; + } + + return '#fff'; +} + +module.exports = { + rootStyle: rootStyle, + loadingColor: loadingColor, +}; diff --git a/miniprogram_npm/@vant/weapp/button/index.wxss b/miniprogram_npm/@vant/weapp/button/index.wxss new file mode 100644 index 0000000..357f27c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/button/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-button{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);line-height:20px;line-height:var(--button-line-height,20px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#323233;color:var(--button-default-color,#323233);background:#fff;background:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background:#07c160;background:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background:#1989fa;background:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background:#ee0a24;background:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background:#ff976a;background:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background:#fff;background:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/calendar/calendar.wxml b/miniprogram_npm/@vant/weapp/calendar/calendar.wxml new file mode 100644 index 0000000..808f739 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/calendar.wxml @@ -0,0 +1,68 @@ + +
+ +
+ + + + + + + + + + + + {{ + computed.getButtonDisabled(type, currentDate) + ? confirmDisabledText + : confirmText + }} + + +
diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.js b/miniprogram_npm/@vant/weapp/calendar/components/header/index.js new file mode 100644 index 0000000..08f230c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.js @@ -0,0 +1,46 @@ +'use strict'; +var __spreadArray = + (this && this.__spreadArray) || + function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; + }; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../../../common/component'); +component_1.VantComponent({ + props: { + title: { + type: String, + value: '日期选择', + }, + subtitle: String, + showTitle: Boolean, + showSubtitle: Boolean, + firstDayOfWeek: { + type: Number, + observer: 'initWeekDay', + }, + }, + data: { + weekdays: [], + }, + created: function () { + this.initWeekDay(); + }, + methods: { + initWeekDay: function () { + var defaultWeeks = ['日', '一', '二', '三', '四', '五', '六']; + var firstDayOfWeek = this.data.firstDayOfWeek || 0; + this.setData({ + weekdays: __spreadArray( + __spreadArray([], defaultWeeks.slice(firstDayOfWeek, 7)), + defaultWeeks.slice(0, firstDayOfWeek) + ), + }); + }, + onClickSubtitle: function (event) { + this.$emit('click-subtitle', event); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.json b/miniprogram_npm/@vant/weapp/calendar/components/header/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml b/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml new file mode 100644 index 0000000..7e56c83 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml @@ -0,0 +1,16 @@ + + + + {{ title }} + + + + {{ subtitle }} + + + + + {{ item }} + + + diff --git a/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss b/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss new file mode 100644 index 0000000..017e800 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss @@ -0,0 +1 @@ +@import '../../../common/index.wxss';.van-calendar__header{flex-shrink:0;box-shadow:0 2px 10px rgba(125,126,128,.16);box-shadow:var(--calendar-header-box-shadow,0 2px 10px rgba(125,126,128,.16))}.van-calendar__header-subtitle,.van-calendar__header-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__header-title+.van-calendar__header-title,.van-calendar__header-title:empty{display:none}.van-calendar__header-title:empty+.van-calendar__header-title{display:block!important}.van-calendar__weekdays{display:flex}.van-calendar__weekday{flex:1;text-align:center;font-size:12px;font-size:var(--calendar-weekdays-font-size,12px);line-height:30px;line-height:var(--calendar-weekdays-height,30px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.js b/miniprogram_npm/@vant/weapp/calendar/components/month/index.js new file mode 100644 index 0000000..1dcb49a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.js @@ -0,0 +1,173 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../../../common/component'); +var utils_1 = require('../../utils'); +component_1.VantComponent({ + props: { + date: { + type: null, + observer: 'setDays', + }, + type: { + type: String, + observer: 'setDays', + }, + color: String, + minDate: { + type: null, + observer: 'setDays', + }, + maxDate: { + type: null, + observer: 'setDays', + }, + showMark: Boolean, + rowHeight: null, + formatter: { + type: null, + observer: 'setDays', + }, + currentDate: { + type: null, + observer: 'setDays', + }, + firstDayOfWeek: { + type: Number, + observer: 'setDays', + }, + allowSameDay: Boolean, + showSubtitle: Boolean, + showMonthTitle: Boolean, + }, + data: { + visible: true, + days: [], + }, + methods: { + onClick: function (event) { + var index = event.currentTarget.dataset.index; + var item = this.data.days[index]; + if (item.type !== 'disabled') { + this.$emit('click', item); + } + }, + setDays: function () { + var days = []; + var startDate = new Date(this.data.date); + var year = startDate.getFullYear(); + var month = startDate.getMonth(); + var totalDay = utils_1.getMonthEndDay( + startDate.getFullYear(), + startDate.getMonth() + 1 + ); + for (var day = 1; day <= totalDay; day++) { + var date = new Date(year, month, day); + var type = this.getDayType(date); + var config = { + date: date, + type: type, + text: day, + bottomInfo: this.getBottomInfo(type), + }; + if (this.data.formatter) { + config = this.data.formatter(config); + } + days.push(config); + } + this.setData({ days: days }); + }, + getMultipleDayType: function (day) { + var currentDate = this.data.currentDate; + if (!Array.isArray(currentDate)) { + return ''; + } + var isSelected = function (date) { + return currentDate.some(function (item) { + return utils_1.compareDay(item, date) === 0; + }); + }; + if (isSelected(day)) { + var prevDay = utils_1.getPrevDay(day); + var nextDay = utils_1.getNextDay(day); + var prevSelected = isSelected(prevDay); + var nextSelected = isSelected(nextDay); + if (prevSelected && nextSelected) { + return 'multiple-middle'; + } + if (prevSelected) { + return 'end'; + } + return nextSelected ? 'start' : 'multiple-selected'; + } + return ''; + }, + getRangeDayType: function (day) { + var _a = this.data, + currentDate = _a.currentDate, + allowSameDay = _a.allowSameDay; + if (!Array.isArray(currentDate)) { + return ''; + } + var startDay = currentDate[0], + endDay = currentDate[1]; + if (!startDay) { + return ''; + } + var compareToStart = utils_1.compareDay(day, startDay); + if (!endDay) { + return compareToStart === 0 ? 'start' : ''; + } + var compareToEnd = utils_1.compareDay(day, endDay); + if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) { + return 'start-end'; + } + if (compareToStart === 0) { + return 'start'; + } + if (compareToEnd === 0) { + return 'end'; + } + if (compareToStart > 0 && compareToEnd < 0) { + return 'middle'; + } + return ''; + }, + getDayType: function (day) { + var _a = this.data, + type = _a.type, + minDate = _a.minDate, + maxDate = _a.maxDate, + currentDate = _a.currentDate; + if ( + utils_1.compareDay(day, minDate) < 0 || + utils_1.compareDay(day, maxDate) > 0 + ) { + return 'disabled'; + } + if (type === 'single') { + return utils_1.compareDay(day, currentDate) === 0 ? 'selected' : ''; + } + if (type === 'multiple') { + return this.getMultipleDayType(day); + } + /* istanbul ignore else */ + if (type === 'range') { + return this.getRangeDayType(day); + } + return ''; + }, + getBottomInfo: function (type) { + if (this.data.type === 'range') { + if (type === 'start') { + return '开始'; + } + if (type === 'end') { + return '结束'; + } + if (type === 'start-end') { + return '开始/结束'; + } + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.json b/miniprogram_npm/@vant/weapp/calendar/components/month/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml new file mode 100644 index 0000000..4a2c47c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml @@ -0,0 +1,39 @@ + + + + + + {{ computed.formatMonthTitle(date) }} + + + + + {{ computed.getMark(date) }} + + + + + {{ item.topInfo }} + {{ item.text }} + + {{ item.bottomInfo }} + + + + + {{ item.topInfo }} + {{ item.text }} + + {{ item.bottomInfo }} + + + + + diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs new file mode 100644 index 0000000..55e45a5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs @@ -0,0 +1,71 @@ +/* eslint-disable */ +var utils = require('../../utils.wxs'); + +function getMark(date) { + return getDate(date).getMonth() + 1; +} + +var ROW_HEIGHT = 64; + +function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) { + var style = []; + var current = getDate(date).getDay() || 7; + var offset = current < firstDayOfWeek ? (7 - firstDayOfWeek + current) : + current === 7 && firstDayOfWeek === 0 ? 0 : + (current - firstDayOfWeek); + + if (index === 0) { + style.push(['margin-left', (100 * offset) / 7 + '%']); + } + + if (rowHeight !== ROW_HEIGHT) { + style.push(['height', rowHeight + 'px']); + } + + if (color) { + if ( + type === 'start' || + type === 'end' || + type === 'start-end' || + type === 'multiple-selected' || + type === 'multiple-middle' + ) { + style.push(['background', color]); + } else if (type === 'middle') { + style.push(['color', color]); + } + } + + return style + .map(function(item) { + return item.join(':'); + }) + .join(';'); +} + +function formatMonthTitle(date) { + date = getDate(date); + return date.getFullYear() + '年' + (date.getMonth() + 1) + '月'; +} + +function getMonthStyle(visible, date, rowHeight) { + if (!visible) { + date = getDate(date); + + var totalDay = utils.getMonthEndDay( + date.getFullYear(), + date.getMonth() + 1 + ); + var offset = getDate(date).getDay(); + var padding = Math.ceil((totalDay + offset) / 7) * rowHeight; + + return 'padding-bottom:' + padding + 'px'; + } +} + +module.exports = { + getMark: getMark, + getDayStyle: getDayStyle, + formatMonthTitle: formatMonthTitle, + getMonthStyle: getMonthStyle +}; diff --git a/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss new file mode 100644 index 0000000..0a0805b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss @@ -0,0 +1 @@ +@import '../../../common/index.wxss';.van-calendar{display:flex;flex-direction:column;height:100%;background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__month-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:14px;font-size:var(--calendar-month-title-font-size,14px);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__days{position:relative;display:flex;flex-wrap:wrap;-webkit-user-select:none;user-select:none}.van-calendar__month-mark{position:absolute;top:50%;left:50%;z-index:0;transform:translate(-50%,-50%);pointer-events:none;color:rgba(242,243,245,.8);color:var(--calendar-month-mark-color,rgba(242,243,245,.8));font-size:160px;font-size:var(--calendar-month-mark-font-size,160px)}.van-calendar__day,.van-calendar__selected-day{display:flex;align-items:center;justify-content:center;text-align:center}.van-calendar__day{position:relative;width:14.285%;height:64px;height:var(--calendar-day-height,64px);font-size:16px;font-size:var(--calendar-day-font-size,16px)}.van-calendar__day--end,.van-calendar__day--multiple-middle,.van-calendar__day--multiple-selected,.van-calendar__day--start,.van-calendar__day--start-end{color:#fff;color:var(--calendar-range-edge-color,#fff);background-color:#ee0a24;background-color:var(--calendar-range-edge-background-color,#ee0a24)}.van-calendar__day--start{border-radius:4px 0 0 4px;border-radius:var(--border-radius-md,4px) 0 0 var(--border-radius-md,4px)}.van-calendar__day--end{border-radius:0 4px 4px 0;border-radius:0 var(--border-radius-md,4px) var(--border-radius-md,4px) 0}.van-calendar__day--multiple-selected,.van-calendar__day--start-end{border-radius:4px;border-radius:var(--border-radius-md,4px)}.van-calendar__day--middle{color:#ee0a24;color:var(--calendar-range-middle-color,#ee0a24)}.van-calendar__day--middle:after{position:absolute;top:0;right:0;bottom:0;left:0;background-color:currentColor;content:"";opacity:.1;opacity:var(--calendar-range-middle-background-opacity,.1)}.van-calendar__day--disabled{cursor:default;color:#c8c9cc;color:var(--calendar-day-disabled-color,#c8c9cc)}.van-calendar__bottom-info,.van-calendar__top-info{position:absolute;right:0;left:0;font-size:10px;font-size:var(--calendar-info-font-size,10px);line-height:14px;line-height:var(--calendar-info-line-height,14px)}@media (max-width:350px){.van-calendar__bottom-info,.van-calendar__top-info{font-size:9px}}.van-calendar__top-info{top:6px}.van-calendar__bottom-info{bottom:6px}.van-calendar__selected-day{width:54px;width:var(--calendar-selected-day-size,54px);height:54px;height:var(--calendar-selected-day-size,54px);color:#fff;color:var(--calendar-selected-day-color,#fff);background-color:#ee0a24;background-color:var(--calendar-selected-day-background-color,#ee0a24);border-radius:4px;border-radius:var(--border-radius-md,4px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/calendar/index.js b/miniprogram_npm/@vant/weapp/calendar/index.js new file mode 100644 index 0000000..2962b66 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.js @@ -0,0 +1,382 @@ +'use strict'; +var __spreadArray = + (this && this.__spreadArray) || + function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; + }; +var __importDefault = + (this && this.__importDefault) || + function (mod) { + return mod && mod.__esModule ? mod : { default: mod }; + }; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var utils_1 = require('./utils'); +var toast_1 = __importDefault(require('../toast/toast')); +var utils_2 = require('../common/utils'); +var initialMinDate = utils_1.getToday().getTime(); +var initialMaxDate = (function () { + var now = utils_1.getToday(); + return new Date( + now.getFullYear(), + now.getMonth() + 6, + now.getDate() + ).getTime(); +})(); +component_1.VantComponent({ + props: { + title: { + type: String, + value: '日期选择', + }, + color: String, + show: { + type: Boolean, + observer: function (val) { + if (val) { + this.initRect(); + this.scrollIntoView(); + } + }, + }, + formatter: null, + confirmText: { + type: String, + value: '确定', + }, + rangePrompt: String, + showRangePrompt: { + type: Boolean, + value: true, + }, + defaultDate: { + type: null, + observer: function (val) { + this.setData({ currentDate: val }); + this.scrollIntoView(); + }, + }, + allowSameDay: Boolean, + confirmDisabledText: String, + type: { + type: String, + value: 'single', + observer: 'reset', + }, + minDate: { + type: null, + value: initialMinDate, + }, + maxDate: { + type: null, + value: initialMaxDate, + }, + position: { + type: String, + value: 'bottom', + }, + rowHeight: { + type: null, + value: utils_1.ROW_HEIGHT, + }, + round: { + type: Boolean, + value: true, + }, + poppable: { + type: Boolean, + value: true, + }, + showMark: { + type: Boolean, + value: true, + }, + showTitle: { + type: Boolean, + value: true, + }, + showConfirm: { + type: Boolean, + value: true, + }, + showSubtitle: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + maxRange: { + type: null, + value: null, + }, + firstDayOfWeek: { + type: Number, + value: 0, + }, + }, + data: { + subtitle: '', + currentDate: null, + scrollIntoView: '', + }, + created: function () { + this.setData({ + currentDate: this.getInitialDate(), + }); + }, + mounted: function () { + if (this.data.show || !this.data.poppable) { + this.initRect(); + this.scrollIntoView(); + } + }, + methods: { + reset: function () { + this.setData({ currentDate: this.getInitialDate() }); + this.scrollIntoView(); + }, + initRect: function () { + var _this = this; + if (this.contentObserver != null) { + this.contentObserver.disconnect(); + } + var contentObserver = this.createIntersectionObserver({ + thresholds: [0, 0.1, 0.9, 1], + observeAll: true, + }); + this.contentObserver = contentObserver; + contentObserver.relativeTo('.van-calendar__body'); + contentObserver.observe('.month', function (res) { + if (res.boundingClientRect.top <= res.relativeRect.top) { + // @ts-ignore + _this.setData({ + subtitle: utils_1.formatMonthTitle(res.dataset.date), + }); + } + }); + }, + limitDateRange: function (date, minDate, maxDate) { + if (minDate === void 0) { + minDate = null; + } + if (maxDate === void 0) { + maxDate = null; + } + minDate = minDate || this.data.minDate; + maxDate = maxDate || this.data.maxDate; + if (utils_1.compareDay(date, minDate) === -1) { + return minDate; + } + if (utils_1.compareDay(date, maxDate) === 1) { + return maxDate; + } + return date; + }, + getInitialDate: function (defaultDate) { + var _this = this; + if (defaultDate === void 0) { + defaultDate = null; + } + var _a = this.data, + type = _a.type, + minDate = _a.minDate, + maxDate = _a.maxDate; + var now = utils_1.getToday().getTime(); + if (type === 'range') { + if (!Array.isArray(defaultDate)) { + defaultDate = []; + } + var _b = defaultDate || [], + startDay = _b[0], + endDay = _b[1]; + var start = this.limitDateRange( + startDay || now, + minDate, + utils_1.getPrevDay(maxDate).getTime() + ); + var end = this.limitDateRange( + endDay || now, + utils_1.getNextDay(minDate).getTime() + ); + return [start, end]; + } + if (type === 'multiple') { + if (Array.isArray(defaultDate)) { + return defaultDate.map(function (date) { + return _this.limitDateRange(date); + }); + } + return [this.limitDateRange(now)]; + } + if (!defaultDate || Array.isArray(defaultDate)) { + defaultDate = now; + } + return this.limitDateRange(defaultDate); + }, + scrollIntoView: function () { + var _this = this; + utils_2.requestAnimationFrame(function () { + var _a = _this.data, + currentDate = _a.currentDate, + type = _a.type, + show = _a.show, + poppable = _a.poppable, + minDate = _a.minDate, + maxDate = _a.maxDate; + // @ts-ignore + var targetDate = type === 'single' ? currentDate : currentDate[0]; + var displayed = show || !poppable; + if (!targetDate || !displayed) { + return; + } + var months = utils_1.getMonths(minDate, maxDate); + months.some(function (month, index) { + if (utils_1.compareMonth(month, targetDate) === 0) { + _this.setData({ scrollIntoView: 'month' + index }); + return true; + } + return false; + }); + }); + }, + onOpen: function () { + this.$emit('open'); + }, + onOpened: function () { + this.$emit('opened'); + }, + onClose: function () { + this.$emit('close'); + }, + onClosed: function () { + this.$emit('closed'); + }, + onClickDay: function (event) { + var date = event.detail.date; + var _a = this.data, + type = _a.type, + currentDate = _a.currentDate, + allowSameDay = _a.allowSameDay; + if (type === 'range') { + // @ts-ignore + var startDay = currentDate[0], + endDay = currentDate[1]; + if (startDay && !endDay) { + var compareToStart = utils_1.compareDay(date, startDay); + if (compareToStart === 1) { + this.select([startDay, date], true); + } else if (compareToStart === -1) { + this.select([date, null]); + } else if (allowSameDay) { + this.select([date, date]); + } + } else { + this.select([date, null]); + } + } else if (type === 'multiple') { + var selectedIndex_1; + // @ts-ignore + var selected = currentDate.some(function (dateItem, index) { + var equal = utils_1.compareDay(dateItem, date) === 0; + if (equal) { + selectedIndex_1 = index; + } + return equal; + }); + if (selected) { + // @ts-ignore + var cancelDate = currentDate.splice(selectedIndex_1, 1); + this.setData({ currentDate: currentDate }); + this.unselect(cancelDate); + } else { + // @ts-ignore + this.select(__spreadArray(__spreadArray([], currentDate), [date])); + } + } else { + this.select(date, true); + } + }, + unselect: function (dateArray) { + var date = dateArray[0]; + if (date) { + this.$emit('unselect', utils_1.copyDates(date)); + } + }, + select: function (date, complete) { + if (complete && this.data.type === 'range') { + var valid = this.checkRange(date); + if (!valid) { + // auto selected to max range if showConfirm + if (this.data.showConfirm) { + this.emit([ + date[0], + utils_1.getDayByOffset(date[0], this.data.maxRange - 1), + ]); + } else { + this.emit(date); + } + return; + } + } + this.emit(date); + if (complete && !this.data.showConfirm) { + this.onConfirm(); + } + }, + emit: function (date) { + var getTime = function (date) { + return date instanceof Date ? date.getTime() : date; + }; + this.setData({ + currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date), + }); + this.$emit('select', utils_1.copyDates(date)); + }, + checkRange: function (date) { + var _a = this.data, + maxRange = _a.maxRange, + rangePrompt = _a.rangePrompt, + showRangePrompt = _a.showRangePrompt; + if (maxRange && utils_1.calcDateNum(date) > maxRange) { + if (showRangePrompt) { + toast_1.default({ + duration: 0, + context: this, + message: + rangePrompt || + '\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ' + + maxRange + + ' \u5929', + }); + } + this.$emit('over-range'); + return false; + } + return true; + }, + onConfirm: function () { + var _this = this; + if ( + this.data.type === 'range' && + !this.checkRange(this.data.currentDate) + ) { + return; + } + wx.nextTick(function () { + // @ts-ignore + _this.$emit('confirm', utils_1.copyDates(_this.data.currentDate)); + }); + }, + onClickSubtitle: function (event) { + this.$emit('click-subtitle', event); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/calendar/index.json b/miniprogram_npm/@vant/weapp/calendar/index.json new file mode 100644 index 0000000..397d5ae --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.json @@ -0,0 +1,10 @@ +{ + "component": true, + "usingComponents": { + "header": "./components/header/index", + "month": "./components/month/index", + "van-button": "../button/index", + "van-popup": "../popup/index", + "van-toast": "../toast/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/calendar/index.wxml b/miniprogram_npm/@vant/weapp/calendar/index.wxml new file mode 100644 index 0000000..bc8bcfd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.wxml @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/miniprogram_npm/@vant/weapp/calendar/index.wxs b/miniprogram_npm/@vant/weapp/calendar/index.wxs new file mode 100644 index 0000000..2c04be1 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.wxs @@ -0,0 +1,37 @@ +/* eslint-disable */ +var utils = require('./utils.wxs'); + +function getMonths(minDate, maxDate) { + var months = []; + var cursor = getDate(minDate); + + cursor.setDate(1); + + do { + months.push(cursor.getTime()); + cursor.setMonth(cursor.getMonth() + 1); + } while (utils.compareMonth(cursor, getDate(maxDate)) !== 1); + + return months; +} + +function getButtonDisabled(type, currentDate) { + if (currentDate == null) { + return true; + } + + if (type === 'range') { + return !currentDate[0] || !currentDate[1]; + } + + if (type === 'multiple') { + return !currentDate.length; + } + + return !currentDate; +} + +module.exports = { + getMonths: getMonths, + getButtonDisabled: getButtonDisabled +}; diff --git a/miniprogram_npm/@vant/weapp/calendar/index.wxss b/miniprogram_npm/@vant/weapp/calendar/index.wxss new file mode 100644 index 0000000..58bd80b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-calendar{display:flex;flex-direction:column;height:100%;height:var(--calendar-height,100%);background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:80%;height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{flex:1;overflow:auto;-webkit-overflow-scrolling:touch}.van-calendar__footer{flex-shrink:0;padding:0 16px;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:36px!important;height:var(--calendar-confirm-button-height,36px)!important;margin:7px 0!important;margin:var(--calendar-confirm-button-margin,7px 0)!important;line-height:34px!important;line-height:var(--calendar-confirm-button-line-height,34px)!important} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/calendar/utils.js b/miniprogram_npm/@vant/weapp/calendar/utils.js new file mode 100644 index 0000000..37e14c2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/utils.js @@ -0,0 +1,97 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0; +exports.ROW_HEIGHT = 64; +function formatMonthTitle(date) { + if (!(date instanceof Date)) { + date = new Date(date); + } + return date.getFullYear() + '\u5E74' + (date.getMonth() + 1) + '\u6708'; +} +exports.formatMonthTitle = formatMonthTitle; +function compareMonth(date1, date2) { + if (!(date1 instanceof Date)) { + date1 = new Date(date1); + } + if (!(date2 instanceof Date)) { + date2 = new Date(date2); + } + var year1 = date1.getFullYear(); + var year2 = date2.getFullYear(); + var month1 = date1.getMonth(); + var month2 = date2.getMonth(); + if (year1 === year2) { + return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; + } + return year1 > year2 ? 1 : -1; +} +exports.compareMonth = compareMonth; +function compareDay(day1, day2) { + if (!(day1 instanceof Date)) { + day1 = new Date(day1); + } + if (!(day2 instanceof Date)) { + day2 = new Date(day2); + } + var compareMonthResult = compareMonth(day1, day2); + if (compareMonthResult === 0) { + var date1 = day1.getDate(); + var date2 = day2.getDate(); + return date1 === date2 ? 0 : date1 > date2 ? 1 : -1; + } + return compareMonthResult; +} +exports.compareDay = compareDay; +function getDayByOffset(date, offset) { + date = new Date(date); + date.setDate(date.getDate() + offset); + return date; +} +exports.getDayByOffset = getDayByOffset; +function getPrevDay(date) { + return getDayByOffset(date, -1); +} +exports.getPrevDay = getPrevDay; +function getNextDay(date) { + return getDayByOffset(date, 1); +} +exports.getNextDay = getNextDay; +function getToday() { + var today = new Date(); + today.setHours(0, 0, 0, 0); + return today; +} +exports.getToday = getToday; +function calcDateNum(date) { + var day1 = new Date(date[0]).getTime(); + var day2 = new Date(date[1]).getTime(); + return (day2 - day1) / (1000 * 60 * 60 * 24) + 1; +} +exports.calcDateNum = calcDateNum; +function copyDates(dates) { + if (Array.isArray(dates)) { + return dates.map(function (date) { + if (date === null) { + return date; + } + return new Date(date); + }); + } + return new Date(dates); +} +exports.copyDates = copyDates; +function getMonthEndDay(year, month) { + return 32 - new Date(year, month - 1, 32).getDate(); +} +exports.getMonthEndDay = getMonthEndDay; +function getMonths(minDate, maxDate) { + var months = []; + var cursor = new Date(minDate); + cursor.setDate(1); + do { + months.push(cursor.getTime()); + cursor.setMonth(cursor.getMonth() + 1); + } while (compareMonth(cursor, maxDate) !== 1); + return months; +} +exports.getMonths = getMonths; diff --git a/miniprogram_npm/@vant/weapp/calendar/utils.wxs b/miniprogram_npm/@vant/weapp/calendar/utils.wxs new file mode 100644 index 0000000..e57f6b3 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/calendar/utils.wxs @@ -0,0 +1,25 @@ +/* eslint-disable */ +function getMonthEndDay(year, month) { + return 32 - getDate(year, month - 1, 32).getDate(); +} + +function compareMonth(date1, date2) { + date1 = getDate(date1); + date2 = getDate(date2); + + var year1 = date1.getFullYear(); + var year2 = date2.getFullYear(); + var month1 = date1.getMonth(); + var month2 = date2.getMonth(); + + if (year1 === year2) { + return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; + } + + return year1 > year2 ? 1 : -1; +} + +module.exports = { + getMonthEndDay: getMonthEndDay, + compareMonth: compareMonth +}; diff --git a/miniprogram_npm/@vant/weapp/card/index.js b/miniprogram_npm/@vant/weapp/card/index.js new file mode 100644 index 0000000..cb0f982 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.js @@ -0,0 +1,51 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var link_1 = require('../mixins/link'); +var component_1 = require('../common/component'); +component_1.VantComponent({ + classes: [ + 'num-class', + 'desc-class', + 'thumb-class', + 'title-class', + 'price-class', + 'origin-price-class', + ], + mixins: [link_1.link], + props: { + tag: String, + num: String, + desc: String, + thumb: String, + title: String, + price: { + type: String, + observer: 'updatePrice', + }, + centered: Boolean, + lazyLoad: Boolean, + thumbLink: String, + originPrice: String, + thumbMode: { + type: String, + value: 'aspectFit', + }, + currency: { + type: String, + value: '¥', + }, + }, + methods: { + updatePrice: function () { + var price = this.data.price; + var priceArr = price.toString().split('.'); + this.setData({ + integerStr: priceArr[0], + decimalStr: priceArr[1] ? '.' + priceArr[1] : '', + }); + }, + onClickThumb: function () { + this.jumpLink('thumbLink'); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/card/index.json b/miniprogram_npm/@vant/weapp/card/index.json new file mode 100644 index 0000000..e917407 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-tag": "../tag/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/card/index.wxml b/miniprogram_npm/@vant/weapp/card/index.wxml new file mode 100644 index 0000000..62173e4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.wxml @@ -0,0 +1,56 @@ + + + + + + + + + {{ tag }} + + + + + + + {{ title }} + + + {{ desc }} + + + + + + + + + {{ currency }} + {{ integerStr }} + {{ decimalStr }} + + + {{ currency }} {{ originPrice }} + + x {{ num }} + + + + + + + + + + diff --git a/miniprogram_npm/@vant/weapp/card/index.wxss b/miniprogram_npm/@vant/weapp/card/index.wxss new file mode 100644 index 0000000..14a2938 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/card/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:flex}.van-card__header--center{align-items:center;justify-content:center}.van-card__thumb{position:relative;flex:none;width:88px;width:var(--card-thumb-size,88px);height:88px;height:var(--card-thumb-size,88px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%;border-radius:8px;border-radius:var(--border-radius-lg,8px)}.van-card__content{position:relative;display:flex;flex:1;flex-direction:column;justify-content:space-between;min-width:0;min-height:88px;min-height:var(--card-thumb-size,88px)}.van-card__content--center{justify-content:center}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24);font-size:12px;font-size:var(--card-price-font-size,12px)}.van-card__price-integer{font-size:16px;font-size:var(--card-price-integer-font-size,16px)}.van-card__price-decimal,.van-card__price-integer{font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-family:var(--card-price-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute!important;top:2px;left:0}.van-card__footer{flex:none;width:100%;text-align:right} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.js b/miniprogram_npm/@vant/weapp/cell-group/index.js new file mode 100644 index 0000000..fc0f664 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.js @@ -0,0 +1,13 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +component_1.VantComponent({ + props: { + title: String, + border: { + type: Boolean, + value: true, + }, + inset: Boolean, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.json b/miniprogram_npm/@vant/weapp/cell-group/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.wxml b/miniprogram_npm/@vant/weapp/cell-group/index.wxml new file mode 100644 index 0000000..311e064 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.wxml @@ -0,0 +1,11 @@ + + + + {{ title }} + + + + diff --git a/miniprogram_npm/@vant/weapp/cell-group/index.wxss b/miniprogram_npm/@vant/weapp/cell-group/index.wxss new file mode 100644 index 0000000..5bc5d0f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-cell-group--inset{margin:0 16px;margin:var(--cell-group-inset-padding,0 16px);border-radius:8px;border-radius:var(--cell-group-inset-border-radius,8px);overflow:hidden}.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}.van-cell-group__title--inset{padding:16px 16px 8px 32px;padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/cell/index.js b/miniprogram_npm/@vant/weapp/cell/index.js new file mode 100644 index 0000000..7a18c9f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.js @@ -0,0 +1,40 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var link_1 = require('../mixins/link'); +var component_1 = require('../common/component'); +component_1.VantComponent({ + classes: [ + 'title-class', + 'label-class', + 'value-class', + 'right-icon-class', + 'hover-class', + ], + mixins: [link_1.link], + props: { + title: null, + value: null, + icon: String, + size: String, + label: String, + center: Boolean, + isLink: Boolean, + required: Boolean, + clickable: Boolean, + titleWidth: String, + customStyle: String, + arrowDirection: String, + useLabelSlot: Boolean, + border: { + type: Boolean, + value: true, + }, + titleStyle: String, + }, + methods: { + onClick: function (event) { + this.$emit('click', event.detail); + this.jumpLink(); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/cell/index.json b/miniprogram_npm/@vant/weapp/cell/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/cell/index.wxml b/miniprogram_npm/@vant/weapp/cell/index.wxml new file mode 100644 index 0000000..8387c3c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.wxml @@ -0,0 +1,47 @@ + + + + + + + + + + {{ title }} + + + + + {{ label }} + + + + + {{ value }} + + + + + + + + diff --git a/miniprogram_npm/@vant/weapp/cell/index.wxs b/miniprogram_npm/@vant/weapp/cell/index.wxs new file mode 100644 index 0000000..e3500c4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.wxs @@ -0,0 +1,17 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function titleStyle(data) { + return style([ + { + 'max-width': addUnit(data.titleWidth), + 'min-width': addUnit(data.titleWidth), + }, + data.titleStyle, + ]); +} + +module.exports = { + titleStyle: titleStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/cell/index.wxss b/miniprogram_npm/@vant/weapp/cell/index.wxss new file mode 100644 index 0000000..20f24ce --- /dev/null +++ b/miniprogram_npm/@vant/weapp/cell/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-cell{position:relative;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;transform-origin:center;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:flex;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:4px;margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{margin-left:4px;margin-left:var(--padding-base,4px);color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.js b/miniprogram_npm/@vant/weapp/checkbox-group/index.js new file mode 100644 index 0000000..96aec51 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.js @@ -0,0 +1,44 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var relation_1 = require('../common/relation'); +var component_1 = require('../common/component'); +component_1.VantComponent({ + field: true, + relation: relation_1.useChildren('checkbox', function (target) { + this.updateChild(target); + }), + props: { + max: Number, + value: { + type: Array, + observer: 'updateChildren', + }, + disabled: { + type: Boolean, + observer: 'updateChildren', + }, + direction: { + type: String, + value: 'vertical', + }, + }, + methods: { + updateChildren: function () { + var _this = this; + this.children.forEach(function (child) { + return _this.updateChild(child); + }); + }, + updateChild: function (child) { + var _a = this.data, + value = _a.value, + disabled = _a.disabled, + direction = _a.direction; + child.setData({ + value: value.indexOf(child.data.name) !== -1, + parentDisabled: disabled, + direction: direction, + }); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.json b/miniprogram_npm/@vant/weapp/checkbox-group/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.wxml b/miniprogram_npm/@vant/weapp/checkbox-group/index.wxml new file mode 100644 index 0000000..638bf9d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.wxml @@ -0,0 +1,5 @@ + + + + + diff --git a/miniprogram_npm/@vant/weapp/checkbox-group/index.wxss b/miniprogram_npm/@vant/weapp/checkbox-group/index.wxss new file mode 100644 index 0000000..c5666d7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-checkbox-group--horizontal{display:flex;flex-wrap:wrap} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.js b/miniprogram_npm/@vant/weapp/checkbox/index.js new file mode 100644 index 0000000..c607f29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.js @@ -0,0 +1,84 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var relation_1 = require('../common/relation'); +var component_1 = require('../common/component'); +function emit(target, value) { + target.$emit('input', value); + target.$emit('change', value); +} +component_1.VantComponent({ + field: true, + relation: relation_1.useParent('checkbox-group'), + classes: ['icon-class', 'label-class'], + props: { + value: Boolean, + disabled: Boolean, + useIconSlot: Boolean, + checkedColor: String, + labelPosition: { + type: String, + value: 'right', + }, + labelDisabled: Boolean, + shape: { + type: String, + value: 'round', + }, + iconSize: { + type: null, + value: 20, + }, + }, + data: { + parentDisabled: false, + direction: 'vertical', + }, + methods: { + emitChange: function (value) { + if (this.parent) { + this.setParentValue(this.parent, value); + } else { + emit(this, value); + } + }, + toggle: function () { + var _a = this.data, + parentDisabled = _a.parentDisabled, + disabled = _a.disabled, + value = _a.value; + if (!disabled && !parentDisabled) { + this.emitChange(!value); + } + }, + onClickLabel: function () { + var _a = this.data, + labelDisabled = _a.labelDisabled, + parentDisabled = _a.parentDisabled, + disabled = _a.disabled, + value = _a.value; + if (!disabled && !labelDisabled && !parentDisabled) { + this.emitChange(!value); + } + }, + setParentValue: function (parent, value) { + var parentValue = parent.data.value.slice(); + var name = this.data.name; + var max = parent.data.max; + if (value) { + if (max && parentValue.length >= max) { + return; + } + if (parentValue.indexOf(name) === -1) { + parentValue.push(name); + emit(parent, parentValue); + } + } else { + var index = parentValue.indexOf(name); + if (index !== -1) { + parentValue.splice(index, 1); + emit(parent, parentValue); + } + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.json b/miniprogram_npm/@vant/weapp/checkbox/index.json new file mode 100644 index 0000000..0a336c0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.wxml b/miniprogram_npm/@vant/weapp/checkbox/index.wxml new file mode 100644 index 0000000..39a7bb0 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.wxml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.wxs b/miniprogram_npm/@vant/weapp/checkbox/index.wxs new file mode 100644 index 0000000..eb9c772 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.wxs @@ -0,0 +1,20 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) { + var styles = { + 'font-size': addUnit(iconSize), + }; + + if (checkedColor && value && !disabled && !parentDisabled) { + styles['border-color'] = checkedColor; + styles['background-color'] = checkedColor; + } + + return style(styles); +} + +module.exports = { + iconStyle: iconStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/checkbox/index.wxss b/miniprogram_npm/@vant/weapp/checkbox/index.wxss new file mode 100644 index 0000000..62f37d4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/checkbox/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-checkbox{display:flex;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox--horizontal{margin-right:12px}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{flex:none}.van-checkbox__icon{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/circle/canvas.js b/miniprogram_npm/@vant/weapp/circle/canvas.js new file mode 100644 index 0000000..dbee1d7 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/canvas.js @@ -0,0 +1,47 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.adaptor = void 0; +function adaptor(ctx) { + // @ts-ignore + return Object.assign(ctx, { + setStrokeStyle: function (val) { + ctx.strokeStyle = val; + }, + setLineWidth: function (val) { + ctx.lineWidth = val; + }, + setLineCap: function (val) { + ctx.lineCap = val; + }, + setFillStyle: function (val) { + ctx.fillStyle = val; + }, + setFontSize: function (val) { + ctx.font = String(val); + }, + setGlobalAlpha: function (val) { + ctx.globalAlpha = val; + }, + setLineJoin: function (val) { + ctx.lineJoin = val; + }, + setTextAlign: function (val) { + ctx.textAlign = val; + }, + setMiterLimit: function (val) { + ctx.miterLimit = val; + }, + setShadow: function (offsetX, offsetY, blur, color) { + ctx.shadowOffsetX = offsetX; + ctx.shadowOffsetY = offsetY; + ctx.shadowBlur = blur; + ctx.shadowColor = color; + }, + setTextBaseline: function (val) { + ctx.textBaseline = val; + }, + createCircularGradient: function () {}, + draw: function () {}, + }); +} +exports.adaptor = adaptor; diff --git a/miniprogram_npm/@vant/weapp/circle/index.js b/miniprogram_npm/@vant/weapp/circle/index.js new file mode 100644 index 0000000..416c0bd --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.js @@ -0,0 +1,217 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var color_1 = require('../common/color'); +var component_1 = require('../common/component'); +var utils_1 = require('../common/utils'); +var validator_1 = require('../common/validator'); +var version_1 = require('../common/version'); +var canvas_1 = require('./canvas'); +function format(rate) { + return Math.min(Math.max(rate, 0), 100); +} +var PERIMETER = 2 * Math.PI; +var BEGIN_ANGLE = -Math.PI / 2; +var STEP = 1; +component_1.VantComponent({ + props: { + text: String, + lineCap: { + type: String, + value: 'round', + }, + value: { + type: Number, + value: 0, + observer: 'reRender', + }, + speed: { + type: Number, + value: 50, + }, + size: { + type: Number, + value: 100, + observer: function () { + this.drawCircle(this.currentValue); + }, + }, + fill: String, + layerColor: { + type: String, + value: color_1.WHITE, + }, + color: { + type: null, + value: color_1.BLUE, + observer: function () { + var _this = this; + this.setHoverColor().then(function () { + _this.drawCircle(_this.currentValue); + }); + }, + }, + type: { + type: String, + value: '', + }, + strokeWidth: { + type: Number, + value: 4, + }, + clockwise: { + type: Boolean, + value: true, + }, + }, + data: { + hoverColor: color_1.BLUE, + }, + methods: { + getContext: function () { + var _this = this; + var _a = this.data, + type = _a.type, + size = _a.size; + if (type === '' || !version_1.canIUseCanvas2d()) { + var ctx = wx.createCanvasContext('van-circle', this); + return Promise.resolve(ctx); + } + var dpr = utils_1.getSystemInfoSync().pixelRatio; + return new Promise(function (resolve) { + wx.createSelectorQuery() + .in(_this) + .select('#van-circle') + .node() + .exec(function (res) { + var canvas = res[0].node; + var ctx = canvas.getContext(type); + if (!_this.inited) { + _this.inited = true; + canvas.width = size * dpr; + canvas.height = size * dpr; + ctx.scale(dpr, dpr); + } + resolve(canvas_1.adaptor(ctx)); + }); + }); + }, + setHoverColor: function () { + var _this = this; + var _a = this.data, + color = _a.color, + size = _a.size; + if (validator_1.isObj(color)) { + return this.getContext().then(function (context) { + var LinearColor = context.createLinearGradient(size, 0, 0, 0); + Object.keys(color) + .sort(function (a, b) { + return parseFloat(a) - parseFloat(b); + }) + .map(function (key) { + return LinearColor.addColorStop( + parseFloat(key) / 100, + color[key] + ); + }); + _this.hoverColor = LinearColor; + }); + } + this.hoverColor = color; + return Promise.resolve(); + }, + presetCanvas: function (context, strokeStyle, beginAngle, endAngle, fill) { + var _a = this.data, + strokeWidth = _a.strokeWidth, + lineCap = _a.lineCap, + clockwise = _a.clockwise, + size = _a.size; + var position = size / 2; + var radius = position - strokeWidth / 2; + context.setStrokeStyle(strokeStyle); + context.setLineWidth(strokeWidth); + context.setLineCap(lineCap); + context.beginPath(); + context.arc(position, position, radius, beginAngle, endAngle, !clockwise); + context.stroke(); + if (fill) { + context.setFillStyle(fill); + context.fill(); + } + }, + renderLayerCircle: function (context) { + var _a = this.data, + layerColor = _a.layerColor, + fill = _a.fill; + this.presetCanvas(context, layerColor, 0, PERIMETER, fill); + }, + renderHoverCircle: function (context, formatValue) { + var clockwise = this.data.clockwise; + // 结束角度 + var progress = PERIMETER * (formatValue / 100); + var endAngle = clockwise + ? BEGIN_ANGLE + progress + : 3 * Math.PI - (BEGIN_ANGLE + progress); + this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle); + }, + drawCircle: function (currentValue) { + var _this = this; + var size = this.data.size; + this.getContext().then(function (context) { + context.clearRect(0, 0, size, size); + _this.renderLayerCircle(context); + var formatValue = format(currentValue); + if (formatValue !== 0) { + _this.renderHoverCircle(context, formatValue); + } + context.draw(); + }); + }, + reRender: function () { + var _this = this; + // tofector 动画暂时没有想到好的解决方案 + var _a = this.data, + value = _a.value, + speed = _a.speed; + if (speed <= 0 || speed > 1000) { + this.drawCircle(value); + return; + } + this.clearMockInterval(); + this.currentValue = this.currentValue || 0; + var run = function () { + _this.interval = setTimeout(function () { + if (_this.currentValue !== value) { + if (Math.abs(_this.currentValue - value) < STEP) { + _this.currentValue = value; + } else if (_this.currentValue < value) { + _this.currentValue += STEP; + } else { + _this.currentValue -= STEP; + } + _this.drawCircle(_this.currentValue); + run(); + } else { + _this.clearMockInterval(); + } + }, 1000 / speed); + }; + run(); + }, + clearMockInterval: function () { + if (this.interval) { + clearTimeout(this.interval); + this.interval = null; + } + }, + }, + mounted: function () { + var _this = this; + this.currentValue = this.data.value; + this.setHoverColor().then(function () { + _this.drawCircle(_this.currentValue); + }); + }, + destroyed: function () { + this.clearMockInterval(); + }, +}); diff --git a/miniprogram_npm/@vant/weapp/circle/index.json b/miniprogram_npm/@vant/weapp/circle/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/circle/index.wxml b/miniprogram_npm/@vant/weapp/circle/index.wxml new file mode 100644 index 0000000..52bc59f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.wxml @@ -0,0 +1,9 @@ + + + + + + + + {{ text }} + diff --git a/miniprogram_npm/@vant/weapp/circle/index.wxss b/miniprogram_npm/@vant/weapp/circle/index.wxss new file mode 100644 index 0000000..5b5ad00 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/circle/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-circle{position:relative;display:inline-block;text-align:center}.van-circle__text{position:absolute;top:50%;left:0;width:100%;transform:translateY(-50%);color:#323233;color:var(--circle-text-color,#323233)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/col/index.js b/miniprogram_npm/@vant/weapp/col/index.js new file mode 100644 index 0000000..a33c44b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.js @@ -0,0 +1,11 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var relation_1 = require('../common/relation'); +var component_1 = require('../common/component'); +component_1.VantComponent({ + relation: relation_1.useParent('row'), + props: { + span: Number, + offset: Number, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/col/index.json b/miniprogram_npm/@vant/weapp/col/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/col/index.wxml b/miniprogram_npm/@vant/weapp/col/index.wxml new file mode 100644 index 0000000..975348b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.wxml @@ -0,0 +1,9 @@ + + + + + + diff --git a/miniprogram_npm/@vant/weapp/col/index.wxs b/miniprogram_npm/@vant/weapp/col/index.wxs new file mode 100644 index 0000000..507c1cb --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + if (!data.gutter) { + return ''; + } + + return style({ + 'padding-right': addUnit(data.gutter / 2), + 'padding-left': addUnit(data.gutter / 2), + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/col/index.wxss b/miniprogram_npm/@vant/weapp/col/index.wxss new file mode 100644 index 0000000..44c896a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/col/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-col{float:left;box-sizing:border-box}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/collapse-item/animate.js b/miniprogram_npm/@vant/weapp/collapse-item/animate.js new file mode 100644 index 0000000..4317383 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/animate.js @@ -0,0 +1,77 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.setContentAnimate = void 0; +var version_1 = require('../common/version'); +var utils_1 = require('../common/utils'); +function useAnimate(context, expanded, mounted, height) { + var selector = '.van-collapse-item__wrapper'; + if (expanded) { + context.animate( + selector, + [ + { height: 0, ease: 'ease-in-out', offset: 0 }, + { height: height + 'px', ease: 'ease-in-out', offset: 1 }, + { height: 'auto', ease: 'ease-in-out', offset: 1 }, + ], + mounted ? 300 : 0, + function () { + context.clearAnimation(selector); + } + ); + return; + } + context.animate( + selector, + [ + { height: height + 'px', ease: 'ease-in-out', offset: 0 }, + { height: 0, ease: 'ease-in-out', offset: 1 }, + ], + 300, + function () { + context.clearAnimation(selector); + } + ); +} +function useAnimation(context, expanded, mounted, height) { + var animation = wx.createAnimation({ + duration: 0, + timingFunction: 'ease-in-out', + }); + if (expanded) { + if (height === 0) { + animation.height('auto').top(1).step(); + } else { + animation + .height(height) + .top(1) + .step({ + duration: mounted ? 300 : 1, + }) + .height('auto') + .step(); + } + context.setData({ + animation: animation.export(), + }); + return; + } + animation.height(height).top(0).step({ duration: 1 }).height(0).step({ + duration: 300, + }); + context.setData({ + animation: animation.export(), + }); +} +function setContentAnimate(context, expanded, mounted) { + utils_1 + .getRect(context, '.van-collapse-item__content') + .then(function (rect) { + return rect.height; + }) + .then(function (height) { + version_1.canIUseAnimate() + ? useAnimate(context, expanded, mounted, height) + : useAnimation(context, expanded, mounted, height); + }); +} +exports.setContentAnimate = setContentAnimate; diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.js b/miniprogram_npm/@vant/weapp/collapse-item/index.js new file mode 100644 index 0000000..b30315c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.js @@ -0,0 +1,68 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var relation_1 = require('../common/relation'); +var animate_1 = require('./animate'); +component_1.VantComponent({ + classes: ['title-class', 'content-class'], + relation: relation_1.useParent('collapse'), + props: { + name: null, + title: null, + value: null, + icon: String, + label: String, + disabled: Boolean, + clickable: Boolean, + border: { + type: Boolean, + value: true, + }, + isLink: { + type: Boolean, + value: true, + }, + }, + data: { + expanded: false, + }, + mounted: function () { + this.updateExpanded(); + this.mounted = true; + }, + methods: { + updateExpanded: function () { + if (!this.parent) { + return; + } + var _a = this.parent.data, + value = _a.value, + accordion = _a.accordion; + var _b = this.parent.children, + children = _b === void 0 ? [] : _b; + var name = this.data.name; + var index = children.indexOf(this); + var currentName = name == null ? index : name; + var expanded = accordion + ? value === currentName + : (value || []).some(function (name) { + return name === currentName; + }); + if (expanded !== this.data.expanded) { + animate_1.setContentAnimate(this, expanded, this.mounted); + } + this.setData({ index: index, expanded: expanded }); + }, + onClick: function () { + if (this.data.disabled) { + return; + } + var _a = this.data, + name = _a.name, + expanded = _a.expanded; + var index = this.parent.children.indexOf(this); + var currentName = name == null ? index : name; + this.parent.switch(currentName, !expanded); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.json b/miniprogram_npm/@vant/weapp/collapse-item/index.json new file mode 100644 index 0000000..0e5425c --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.wxml b/miniprogram_npm/@vant/weapp/collapse-item/index.wxml new file mode 100644 index 0000000..ae4cc83 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.wxml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + diff --git a/miniprogram_npm/@vant/weapp/collapse-item/index.wxss b/miniprogram_npm/@vant/weapp/collapse-item/index.wxss new file mode 100644 index 0000000..ef91986 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{transform:rotate(90deg);transition:transform .3s;transition:transform var(--collapse-item-transition-duration,.3s)}.van-collapse-item__title--expanded .van-cell__right-icon{transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:#c8c9cc!important;color:var(--collapse-item-title-disabled-color,#c8c9cc)!important}.van-collapse-item__title--disabled .van-cell--hover{background-color:#fff!important;background-color:var(--white,#fff)!important}.van-collapse-item__wrapper{overflow:hidden}.van-collapse-item__content{padding:15px;padding:var(--collapse-item-content-padding,15px);color:#969799;color:var(--collapse-item-content-text-color,#969799);font-size:13px;font-size:var(--collapse-item-content-font-size,13px);line-height:1.5;line-height:var(--collapse-item-content-line-height,1.5);background-color:#fff;background-color:var(--collapse-item-content-background-color,#fff)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/collapse/index.js b/miniprogram_npm/@vant/weapp/collapse/index.js new file mode 100644 index 0000000..4e2c097 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.js @@ -0,0 +1,50 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var relation_1 = require('../common/relation'); +component_1.VantComponent({ + relation: relation_1.useChildren('collapse-item'), + props: { + value: { + type: null, + observer: 'updateExpanded', + }, + accordion: { + type: Boolean, + observer: 'updateExpanded', + }, + border: { + type: Boolean, + value: true, + }, + }, + methods: { + updateExpanded: function () { + this.children.forEach(function (child) { + child.updateExpanded(); + }); + }, + switch: function (name, expanded) { + var _a = this.data, + accordion = _a.accordion, + value = _a.value; + var changeItem = name; + if (!accordion) { + name = expanded + ? (value || []).concat(name) + : (value || []).filter(function (activeName) { + return activeName !== name; + }); + } else { + name = expanded ? name : ''; + } + if (expanded) { + this.$emit('open', changeItem); + } else { + this.$emit('close', changeItem); + } + this.$emit('change', name); + this.$emit('input', name); + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/collapse/index.json b/miniprogram_npm/@vant/weapp/collapse/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/collapse/index.wxml b/miniprogram_npm/@vant/weapp/collapse/index.wxml new file mode 100644 index 0000000..fd4e171 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.wxml @@ -0,0 +1,3 @@ + + + diff --git a/miniprogram_npm/@vant/weapp/collapse/index.wxss b/miniprogram_npm/@vant/weapp/collapse/index.wxss new file mode 100644 index 0000000..99694d6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/collapse/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/color.js b/miniprogram_npm/@vant/weapp/common/color.js new file mode 100644 index 0000000..885acaa --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/color.js @@ -0,0 +1,10 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.GRAY_DARK = exports.GRAY = exports.ORANGE = exports.GREEN = exports.WHITE = exports.BLUE = exports.RED = void 0; +exports.RED = '#ee0a24'; +exports.BLUE = '#1989fa'; +exports.WHITE = '#fff'; +exports.GREEN = '#07c160'; +exports.ORANGE = '#ff976a'; +exports.GRAY = '#323233'; +exports.GRAY_DARK = '#969799'; diff --git a/miniprogram_npm/@vant/weapp/common/component.js b/miniprogram_npm/@vant/weapp/common/component.js new file mode 100644 index 0000000..2274506 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/component.js @@ -0,0 +1,48 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.VantComponent = void 0; +var basic_1 = require('../mixins/basic'); +function mapKeys(source, target, map) { + Object.keys(map).forEach(function (key) { + if (source[key]) { + target[map[key]] = source[key]; + } + }); +} +function VantComponent(vantOptions) { + var options = {}; + mapKeys(vantOptions, options, { + data: 'data', + props: 'properties', + mixins: 'behaviors', + methods: 'methods', + beforeCreate: 'created', + created: 'attached', + mounted: 'ready', + destroyed: 'detached', + classes: 'externalClasses', + }); + // add default externalClasses + options.externalClasses = options.externalClasses || []; + options.externalClasses.push('custom-class'); + // add default behaviors + options.behaviors = options.behaviors || []; + options.behaviors.push(basic_1.basic); + // add relations + var relation = vantOptions.relation; + if (relation) { + options.relations = relation.relations; + options.behaviors.push(relation.mixin); + } + // map field to form-field behavior + if (vantOptions.field) { + options.behaviors.push('wx://form-field'); + } + // add default options + options.options = { + multipleSlots: true, + addGlobalClass: true, + }; + Component(options); +} +exports.VantComponent = VantComponent; diff --git a/miniprogram_npm/@vant/weapp/common/index.wxss b/miniprogram_npm/@vant/weapp/common/index.wxss new file mode 100644 index 0000000..7a896a6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/index.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/relation.js b/miniprogram_npm/@vant/weapp/common/relation.js new file mode 100644 index 0000000..fcf9824 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/relation.js @@ -0,0 +1,79 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.useChildren = exports.useParent = void 0; +function useParent(name, onEffect) { + var _a; + var path = '../' + name + '/index'; + return { + relations: + ((_a = {}), + (_a[path] = { + type: 'ancestor', + linked: function () { + onEffect && onEffect.call(this); + }, + linkChanged: function () { + onEffect && onEffect.call(this); + }, + unlinked: function () { + onEffect && onEffect.call(this); + }, + }), + _a), + mixin: Behavior({ + created: function () { + var _this = this; + Object.defineProperty(this, 'parent', { + get: function () { + return _this.getRelationNodes(path)[0]; + }, + }); + Object.defineProperty(this, 'index', { + // @ts-ignore + get: function () { + var _a, _b; + return (_b = + (_a = _this.parent) === null || _a === void 0 + ? void 0 + : _a.children) === null || _b === void 0 + ? void 0 + : _b.indexOf(_this); + }, + }); + }, + }), + }; +} +exports.useParent = useParent; +function useChildren(name, onEffect) { + var _a; + var path = '../' + name + '/index'; + return { + relations: + ((_a = {}), + (_a[path] = { + type: 'descendant', + linked: function (target) { + onEffect && onEffect.call(this, target); + }, + linkChanged: function (target) { + onEffect && onEffect.call(this, target); + }, + unlinked: function (target) { + onEffect && onEffect.call(this, target); + }, + }), + _a), + mixin: Behavior({ + created: function () { + var _this = this; + Object.defineProperty(this, 'children', { + get: function () { + return _this.getRelationNodes(path) || []; + }, + }); + }, + }), + }; +} +exports.useChildren = useChildren; diff --git a/miniprogram_npm/@vant/weapp/common/style/clearfix.wxss b/miniprogram_npm/@vant/weapp/common/style/clearfix.wxss new file mode 100644 index 0000000..a0ca838 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/clearfix.wxss @@ -0,0 +1 @@ +.van-clearfix:after{display:table;clear:both;content:""} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss b/miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss new file mode 100644 index 0000000..1e9dbc9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/style/hairline.wxss b/miniprogram_npm/@vant/weapp/common/style/hairline.wxss new file mode 100644 index 0000000..cebc4aa --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/style/hairline.wxss @@ -0,0 +1 @@ +.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/common/style/mixins/clearfix.wxss b/miniprogram_npm/@vant/weapp/common/style/mixins/clearfix.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram_npm/@vant/weapp/common/style/mixins/ellipsis.wxss b/miniprogram_npm/@vant/weapp/common/style/mixins/ellipsis.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram_npm/@vant/weapp/common/style/mixins/hairline.wxss b/miniprogram_npm/@vant/weapp/common/style/mixins/hairline.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram_npm/@vant/weapp/common/style/theme.wxss b/miniprogram_npm/@vant/weapp/common/style/theme.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram_npm/@vant/weapp/common/style/var.wxss b/miniprogram_npm/@vant/weapp/common/style/var.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram_npm/@vant/weapp/common/utils.js b/miniprogram_npm/@vant/weapp/common/utils.js new file mode 100644 index 0000000..e37fb2e --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/utils.js @@ -0,0 +1,120 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.getCurrentPage = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.getSystemInfoSync = exports.nextTick = exports.range = exports.isDef = void 0; +var validator_1 = require('./validator'); +var version_1 = require('./version'); +var validator_2 = require('./validator'); +Object.defineProperty(exports, 'isDef', { + enumerable: true, + get: function () { + return validator_2.isDef; + }, +}); +function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +exports.range = range; +function nextTick(cb) { + if (version_1.canIUseNextTick()) { + wx.nextTick(cb); + } else { + setTimeout(function () { + cb(); + }, 1000 / 30); + } +} +exports.nextTick = nextTick; +var systemInfo; +function getSystemInfoSync() { + if (systemInfo == null) { + systemInfo = wx.getSystemInfoSync(); + } + return systemInfo; +} +exports.getSystemInfoSync = getSystemInfoSync; +function addUnit(value) { + if (!validator_1.isDef(value)) { + return undefined; + } + value = String(value); + return validator_1.isNumber(value) ? value + 'px' : value; +} +exports.addUnit = addUnit; +function requestAnimationFrame(cb) { + var systemInfo = getSystemInfoSync(); + if (systemInfo.platform === 'devtools') { + return setTimeout(function () { + cb(); + }, 1000 / 30); + } + return wx + .createSelectorQuery() + .selectViewport() + .boundingClientRect() + .exec(function () { + cb(); + }); +} +exports.requestAnimationFrame = requestAnimationFrame; +function pickExclude(obj, keys) { + if (!validator_1.isPlainObject(obj)) { + return {}; + } + return Object.keys(obj).reduce(function (prev, key) { + if (!keys.includes(key)) { + prev[key] = obj[key]; + } + return prev; + }, {}); +} +exports.pickExclude = pickExclude; +function getRect(context, selector) { + return new Promise(function (resolve) { + wx.createSelectorQuery() + .in(context) + .select(selector) + .boundingClientRect() + .exec(function (rect) { + if (rect === void 0) { + rect = []; + } + return resolve(rect[0]); + }); + }); +} +exports.getRect = getRect; +function getAllRect(context, selector) { + return new Promise(function (resolve) { + wx.createSelectorQuery() + .in(context) + .selectAll(selector) + .boundingClientRect() + .exec(function (rect) { + if (rect === void 0) { + rect = []; + } + return resolve(rect[0]); + }); + }); +} +exports.getAllRect = getAllRect; +function groupSetData(context, cb) { + if (version_1.canIUseGroupSetData()) { + context.groupSetData(cb); + } else { + cb(); + } +} +exports.groupSetData = groupSetData; +function toPromise(promiseLike) { + if (validator_1.isPromise(promiseLike)) { + return promiseLike; + } + return Promise.resolve(promiseLike); +} +exports.toPromise = toPromise; +function getCurrentPage() { + var pages = getCurrentPages(); + return pages[pages.length - 1]; +} +exports.getCurrentPage = getCurrentPage; diff --git a/miniprogram_npm/@vant/weapp/common/validator.js b/miniprogram_npm/@vant/weapp/common/validator.js new file mode 100644 index 0000000..798f054 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/validator.js @@ -0,0 +1,43 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.isVideoUrl = exports.isImageUrl = exports.isBoolean = exports.isNumber = exports.isObj = exports.isDef = exports.isPromise = exports.isPlainObject = exports.isFunction = void 0; +// eslint-disable-next-line @typescript-eslint/ban-types +function isFunction(val) { + return typeof val === 'function'; +} +exports.isFunction = isFunction; +function isPlainObject(val) { + return val !== null && typeof val === 'object' && !Array.isArray(val); +} +exports.isPlainObject = isPlainObject; +function isPromise(val) { + return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch); +} +exports.isPromise = isPromise; +function isDef(value) { + return value !== undefined && value !== null; +} +exports.isDef = isDef; +function isObj(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} +exports.isObj = isObj; +function isNumber(value) { + return /^\d+(\.\d+)?$/.test(value); +} +exports.isNumber = isNumber; +function isBoolean(value) { + return typeof value === 'boolean'; +} +exports.isBoolean = isBoolean; +var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i; +var VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i; +function isImageUrl(url) { + return IMAGE_REGEXP.test(url); +} +exports.isImageUrl = isImageUrl; +function isVideoUrl(url) { + return VIDEO_REGEXP.test(url); +} +exports.isVideoUrl = isVideoUrl; diff --git a/miniprogram_npm/@vant/weapp/common/version.js b/miniprogram_npm/@vant/weapp/common/version.js new file mode 100644 index 0000000..c7dc5db --- /dev/null +++ b/miniprogram_npm/@vant/weapp/common/version.js @@ -0,0 +1,58 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.canIUseGetUserProfile = exports.canIUseCanvas2d = exports.canIUseNextTick = exports.canIUseGroupSetData = exports.canIUseAnimate = exports.canIUseFormFieldButton = exports.canIUseModel = void 0; +var utils_1 = require('./utils'); +function compareVersion(v1, v2) { + v1 = v1.split('.'); + v2 = v2.split('.'); + var len = Math.max(v1.length, v2.length); + while (v1.length < len) { + v1.push('0'); + } + while (v2.length < len) { + v2.push('0'); + } + for (var i = 0; i < len; i++) { + var num1 = parseInt(v1[i], 10); + var num2 = parseInt(v2[i], 10); + if (num1 > num2) { + return 1; + } + if (num1 < num2) { + return -1; + } + } + return 0; +} +function gte(version) { + var system = utils_1.getSystemInfoSync(); + return compareVersion(system.SDKVersion, version) >= 0; +} +function canIUseModel() { + return gte('2.9.3'); +} +exports.canIUseModel = canIUseModel; +function canIUseFormFieldButton() { + return gte('2.10.3'); +} +exports.canIUseFormFieldButton = canIUseFormFieldButton; +function canIUseAnimate() { + return gte('2.9.0'); +} +exports.canIUseAnimate = canIUseAnimate; +function canIUseGroupSetData() { + return gte('2.4.0'); +} +exports.canIUseGroupSetData = canIUseGroupSetData; +function canIUseNextTick() { + return wx.canIUse('nextTick'); +} +exports.canIUseNextTick = canIUseNextTick; +function canIUseCanvas2d() { + return gte('2.9.0'); +} +exports.canIUseCanvas2d = canIUseCanvas2d; +function canIUseGetUserProfile() { + return !!wx.getUserProfile; +} +exports.canIUseGetUserProfile = canIUseGetUserProfile; diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.js b/miniprogram_npm/@vant/weapp/config-provider/index.js new file mode 100644 index 0000000..341d7d9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.js @@ -0,0 +1,11 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +component_1.VantComponent({ + props: { + themeVars: { + type: Object, + value: {}, + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.json b/miniprogram_npm/@vant/weapp/config-provider/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.wxml b/miniprogram_npm/@vant/weapp/config-provider/index.wxml new file mode 100644 index 0000000..3cfb461 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.wxml @@ -0,0 +1,5 @@ + + + + + diff --git a/miniprogram_npm/@vant/weapp/config-provider/index.wxs b/miniprogram_npm/@vant/weapp/config-provider/index.wxs new file mode 100644 index 0000000..7ca0203 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/config-provider/index.wxs @@ -0,0 +1,29 @@ +/* eslint-disable */ +var object = require('../wxs/object.wxs'); +var style = require('../wxs/style.wxs'); + +function kebabCase(word) { + var newWord = word + .replace(getRegExp("[A-Z]", 'g'), function (i) { + return '-' + i; + }) + .toLowerCase() + .replace(getRegExp("^-"), ''); + + return newWord; +} + +function mapThemeVarsToCSSVars(themeVars) { + var cssVars = {}; + object.keys(themeVars).forEach(function (key) { + var cssVarsKey = '--' + kebabCase(key); + cssVars[cssVarsKey] = themeVars[key]; + }); + + return style(cssVars); +} + +module.exports = { + kebabCase: kebabCase, + mapThemeVarsToCSSVars: mapThemeVarsToCSSVars, +}; diff --git a/miniprogram_npm/@vant/weapp/count-down/index.js b/miniprogram_npm/@vant/weapp/count-down/index.js new file mode 100644 index 0000000..348d489 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.js @@ -0,0 +1,103 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var utils_1 = require('./utils'); +function simpleTick(fn) { + return setTimeout(fn, 30); +} +component_1.VantComponent({ + props: { + useSlot: Boolean, + millisecond: Boolean, + time: { + type: Number, + observer: 'reset', + }, + format: { + type: String, + value: 'HH:mm:ss', + }, + autoStart: { + type: Boolean, + value: true, + }, + }, + data: { + timeData: utils_1.parseTimeData(0), + formattedTime: '0', + }, + destroyed: function () { + clearTimeout(this.tid); + this.tid = null; + }, + methods: { + // 开始 + start: function () { + if (this.counting) { + return; + } + this.counting = true; + this.endTime = Date.now() + this.remain; + this.tick(); + }, + // 暂停 + pause: function () { + this.counting = false; + clearTimeout(this.tid); + }, + // 重置 + reset: function () { + this.pause(); + this.remain = this.data.time; + this.setRemain(this.remain); + if (this.data.autoStart) { + this.start(); + } + }, + tick: function () { + if (this.data.millisecond) { + this.microTick(); + } else { + this.macroTick(); + } + }, + microTick: function () { + var _this = this; + this.tid = simpleTick(function () { + _this.setRemain(_this.getRemain()); + if (_this.remain !== 0) { + _this.microTick(); + } + }); + }, + macroTick: function () { + var _this = this; + this.tid = simpleTick(function () { + var remain = _this.getRemain(); + if (!utils_1.isSameSecond(remain, _this.remain) || remain === 0) { + _this.setRemain(remain); + } + if (_this.remain !== 0) { + _this.macroTick(); + } + }); + }, + getRemain: function () { + return Math.max(this.endTime - Date.now(), 0); + }, + setRemain: function (remain) { + this.remain = remain; + var timeData = utils_1.parseTimeData(remain); + if (this.data.useSlot) { + this.$emit('change', timeData); + } + this.setData({ + formattedTime: utils_1.parseFormat(this.data.format, timeData), + }); + if (remain === 0) { + this.pause(); + this.$emit('finish'); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/count-down/index.json b/miniprogram_npm/@vant/weapp/count-down/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/count-down/index.wxml b/miniprogram_npm/@vant/weapp/count-down/index.wxml new file mode 100644 index 0000000..e206e16 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.wxml @@ -0,0 +1,4 @@ + + + {{ formattedTime }} + diff --git a/miniprogram_npm/@vant/weapp/count-down/index.wxss b/miniprogram_npm/@vant/weapp/count-down/index.wxss new file mode 100644 index 0000000..bc33f5d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-count-down{color:#323233;color:var(--count-down-text-color,#323233);font-size:14px;font-size:var(--count-down-font-size,14px);line-height:20px;line-height:var(--count-down-line-height,20px)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/count-down/utils.js b/miniprogram_npm/@vant/weapp/count-down/utils.js new file mode 100644 index 0000000..10864a2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/count-down/utils.js @@ -0,0 +1,65 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.isSameSecond = exports.parseFormat = exports.parseTimeData = void 0; +function padZero(num, targetLength) { + if (targetLength === void 0) { + targetLength = 2; + } + var str = num + ''; + while (str.length < targetLength) { + str = '0' + str; + } + return str; +} +var SECOND = 1000; +var MINUTE = 60 * SECOND; +var HOUR = 60 * MINUTE; +var DAY = 24 * HOUR; +function parseTimeData(time) { + var days = Math.floor(time / DAY); + var hours = Math.floor((time % DAY) / HOUR); + var minutes = Math.floor((time % HOUR) / MINUTE); + var seconds = Math.floor((time % MINUTE) / SECOND); + var milliseconds = Math.floor(time % SECOND); + return { + days: days, + hours: hours, + minutes: minutes, + seconds: seconds, + milliseconds: milliseconds, + }; +} +exports.parseTimeData = parseTimeData; +function parseFormat(format, timeData) { + var days = timeData.days; + var hours = timeData.hours, + minutes = timeData.minutes, + seconds = timeData.seconds, + milliseconds = timeData.milliseconds; + if (format.indexOf('DD') === -1) { + hours += days * 24; + } else { + format = format.replace('DD', padZero(days)); + } + if (format.indexOf('HH') === -1) { + minutes += hours * 60; + } else { + format = format.replace('HH', padZero(hours)); + } + if (format.indexOf('mm') === -1) { + seconds += minutes * 60; + } else { + format = format.replace('mm', padZero(minutes)); + } + if (format.indexOf('ss') === -1) { + milliseconds += seconds * 1000; + } else { + format = format.replace('ss', padZero(seconds)); + } + return format.replace('SSS', padZero(milliseconds, 3)); +} +exports.parseFormat = parseFormat; +function isSameSecond(time1, time2) { + return Math.floor(time1 / 1000) === Math.floor(time2 / 1000); +} +exports.isSameSecond = isSameSecond; diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.js b/miniprogram_npm/@vant/weapp/datetime-picker/index.js new file mode 100644 index 0000000..6444056 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.js @@ -0,0 +1,375 @@ +'use strict'; +var __assign = + (this && this.__assign) || + function () { + __assign = + Object.assign || + function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; +var __spreadArray = + (this && this.__spreadArray) || + function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; + }; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var validator_1 = require('../common/validator'); +var shared_1 = require('../picker/shared'); +var currentYear = new Date().getFullYear(); +function isValidDate(date) { + return validator_1.isDef(date) && !isNaN(new Date(date).getTime()); +} +function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +function padZero(val) { + return ('00' + val).slice(-2); +} +function times(n, iteratee) { + var index = -1; + var result = Array(n < 0 ? 0 : n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} +function getTrueValue(formattedValue) { + if (formattedValue === undefined) { + formattedValue = '1'; + } + while (isNaN(parseInt(formattedValue, 10))) { + formattedValue = formattedValue.slice(1); + } + return parseInt(formattedValue, 10); +} +function getMonthEndDay(year, month) { + return 32 - new Date(year, month - 1, 32).getDate(); +} +var defaultFormatter = function (type, value) { + return value; +}; +component_1.VantComponent({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: __assign(__assign({}, shared_1.pickerProps), { + value: { + type: null, + observer: 'updateValue', + }, + filter: null, + type: { + type: String, + value: 'datetime', + observer: 'updateValue', + }, + showToolbar: { + type: Boolean, + value: true, + }, + formatter: { + type: null, + value: defaultFormatter, + }, + minDate: { + type: Number, + value: new Date(currentYear - 10, 0, 1).getTime(), + observer: 'updateValue', + }, + maxDate: { + type: Number, + value: new Date(currentYear + 10, 11, 31).getTime(), + observer: 'updateValue', + }, + minHour: { + type: Number, + value: 0, + observer: 'updateValue', + }, + maxHour: { + type: Number, + value: 23, + observer: 'updateValue', + }, + minMinute: { + type: Number, + value: 0, + observer: 'updateValue', + }, + maxMinute: { + type: Number, + value: 59, + observer: 'updateValue', + }, + }), + data: { + innerValue: Date.now(), + columns: [], + }, + methods: { + updateValue: function () { + var _this = this; + var data = this.data; + var val = this.correctValue(data.value); + var isEqual = val === data.innerValue; + this.updateColumnValue(val).then(function () { + if (!isEqual) { + _this.$emit('input', val); + } + }); + }, + getPicker: function () { + if (this.picker == null) { + this.picker = this.selectComponent('.van-datetime-picker'); + var picker_1 = this.picker; + var setColumnValues_1 = picker_1.setColumnValues; + picker_1.setColumnValues = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return setColumnValues_1.apply( + picker_1, + __spreadArray(__spreadArray([], args), [false]) + ); + }; + } + return this.picker; + }, + updateColumns: function () { + var _a = this.data.formatter, + formatter = _a === void 0 ? defaultFormatter : _a; + var results = this.getOriginColumns().map(function (column) { + return { + values: column.values.map(function (value) { + return formatter(column.type, value); + }), + }; + }); + return this.set({ columns: results }); + }, + getOriginColumns: function () { + var filter = this.data.filter; + var results = this.getRanges().map(function (_a) { + var type = _a.type, + range = _a.range; + var values = times(range[1] - range[0] + 1, function (index) { + var value = range[0] + index; + return type === 'year' ? '' + value : padZero(value); + }); + if (filter) { + values = filter(type, values); + } + return { type: type, values: values }; + }); + return results; + }, + getRanges: function () { + var data = this.data; + if (data.type === 'time') { + return [ + { + type: 'hour', + range: [data.minHour, data.maxHour], + }, + { + type: 'minute', + range: [data.minMinute, data.maxMinute], + }, + ]; + } + var _a = this.getBoundary('max', data.innerValue), + maxYear = _a.maxYear, + maxDate = _a.maxDate, + maxMonth = _a.maxMonth, + maxHour = _a.maxHour, + maxMinute = _a.maxMinute; + var _b = this.getBoundary('min', data.innerValue), + minYear = _b.minYear, + minDate = _b.minDate, + minMonth = _b.minMonth, + minHour = _b.minHour, + minMinute = _b.minMinute; + var result = [ + { + type: 'year', + range: [minYear, maxYear], + }, + { + type: 'month', + range: [minMonth, maxMonth], + }, + { + type: 'day', + range: [minDate, maxDate], + }, + { + type: 'hour', + range: [minHour, maxHour], + }, + { + type: 'minute', + range: [minMinute, maxMinute], + }, + ]; + if (data.type === 'date') result.splice(3, 2); + if (data.type === 'year-month') result.splice(2, 3); + return result; + }, + correctValue: function (value) { + var data = this.data; + // validate value + var isDateType = data.type !== 'time'; + if (isDateType && !isValidDate(value)) { + value = data.minDate; + } else if (!isDateType && !value) { + var minHour = data.minHour; + value = padZero(minHour) + ':00'; + } + // time type + if (!isDateType) { + var _a = value.split(':'), + hour = _a[0], + minute = _a[1]; + hour = padZero(range(hour, data.minHour, data.maxHour)); + minute = padZero(range(minute, data.minMinute, data.maxMinute)); + return hour + ':' + minute; + } + // date type + value = Math.max(value, data.minDate); + value = Math.min(value, data.maxDate); + return value; + }, + getBoundary: function (type, innerValue) { + var _a; + var value = new Date(innerValue); + var boundary = new Date(this.data[type + 'Date']); + var year = boundary.getFullYear(); + var month = 1; + var date = 1; + var hour = 0; + var minute = 0; + if (type === 'max') { + month = 12; + date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1); + hour = 23; + minute = 59; + } + if (value.getFullYear() === year) { + month = boundary.getMonth() + 1; + if (value.getMonth() + 1 === month) { + date = boundary.getDate(); + if (value.getDate() === date) { + hour = boundary.getHours(); + if (value.getHours() === hour) { + minute = boundary.getMinutes(); + } + } + } + } + return ( + (_a = {}), + (_a[type + 'Year'] = year), + (_a[type + 'Month'] = month), + (_a[type + 'Date'] = date), + (_a[type + 'Hour'] = hour), + (_a[type + 'Minute'] = minute), + _a + ); + }, + onCancel: function () { + this.$emit('cancel'); + }, + onConfirm: function () { + this.$emit('confirm', this.data.innerValue); + }, + onChange: function () { + var _this = this; + var data = this.data; + var value; + var picker = this.getPicker(); + var originColumns = this.getOriginColumns(); + if (data.type === 'time') { + var indexes = picker.getIndexes(); + value = + +originColumns[0].values[indexes[0]] + + ':' + + +originColumns[1].values[indexes[1]]; + } else { + var indexes = picker.getIndexes(); + var values = indexes.map(function (value, index) { + return originColumns[index].values[value]; + }); + var year = getTrueValue(values[0]); + var month = getTrueValue(values[1]); + var maxDate = getMonthEndDay(year, month); + var date = getTrueValue(values[2]); + if (data.type === 'year-month') { + date = 1; + } + date = date > maxDate ? maxDate : date; + var hour = 0; + var minute = 0; + if (data.type === 'datetime') { + hour = getTrueValue(values[3]); + minute = getTrueValue(values[4]); + } + value = new Date(year, month - 1, date, hour, minute); + } + value = this.correctValue(value); + this.updateColumnValue(value).then(function () { + _this.$emit('input', value); + _this.$emit('change', picker); + }); + }, + updateColumnValue: function (value) { + var _this = this; + var values = []; + var type = this.data.type; + var formatter = this.data.formatter || defaultFormatter; + var picker = this.getPicker(); + if (type === 'time') { + var pair = value.split(':'); + values = [formatter('hour', pair[0]), formatter('minute', pair[1])]; + } else { + var date = new Date(value); + values = [ + formatter('year', '' + date.getFullYear()), + formatter('month', padZero(date.getMonth() + 1)), + ]; + if (type === 'date') { + values.push(formatter('day', padZero(date.getDate()))); + } + if (type === 'datetime') { + values.push( + formatter('day', padZero(date.getDate())), + formatter('hour', padZero(date.getHours())), + formatter('minute', padZero(date.getMinutes())) + ); + } + } + return this.set({ innerValue: value }) + .then(function () { + return _this.updateColumns(); + }) + .then(function () { + return picker.setValues(values); + }); + }, + }, + created: function () { + var _this = this; + var innerValue = this.correctValue(this.data.value); + this.updateColumnValue(innerValue).then(function () { + _this.$emit('input', innerValue); + }); + }, +}); diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.json b/miniprogram_npm/@vant/weapp/datetime-picker/index.json new file mode 100644 index 0000000..a778e91 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.wxml b/miniprogram_npm/@vant/weapp/datetime-picker/index.wxml new file mode 100644 index 0000000..ade2202 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.wxml @@ -0,0 +1,16 @@ + diff --git a/miniprogram_npm/@vant/weapp/datetime-picker/index.wxss b/miniprogram_npm/@vant/weapp/datetime-picker/index.wxss new file mode 100644 index 0000000..99694d6 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/datetime-picker/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/definitions/index.js b/miniprogram_npm/@vant/weapp/definitions/index.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/definitions/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/miniprogram_npm/@vant/weapp/dialog/dialog.js b/miniprogram_npm/@vant/weapp/dialog/dialog.js new file mode 100644 index 0000000..d90d8ea --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/dialog.js @@ -0,0 +1,104 @@ +'use strict'; +var __assign = + (this && this.__assign) || + function () { + __assign = + Object.assign || + function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; +Object.defineProperty(exports, '__esModule', { value: true }); +var queue = []; +var defaultOptions = { + show: false, + title: '', + width: null, + theme: 'default', + message: '', + zIndex: 100, + overlay: true, + selector: '#van-dialog', + className: '', + asyncClose: false, + beforeClose: null, + transition: 'scale', + customStyle: '', + messageAlign: '', + overlayStyle: '', + confirmButtonText: '确认', + cancelButtonText: '取消', + showConfirmButton: true, + showCancelButton: false, + closeOnClickOverlay: false, + confirmButtonOpenType: '', +}; +var currentOptions = __assign({}, defaultOptions); +function getContext() { + var pages = getCurrentPages(); + return pages[pages.length - 1]; +} +var Dialog = function (options) { + options = __assign(__assign({}, currentOptions), options); + return new Promise(function (resolve, reject) { + var context = options.context || getContext(); + var dialog = context.selectComponent(options.selector); + delete options.context; + delete options.selector; + if (dialog) { + dialog.setData( + __assign( + { + callback: function (action, instance) { + action === 'confirm' ? resolve(instance) : reject(instance); + }, + }, + options + ) + ); + wx.nextTick(function () { + dialog.setData({ show: true }); + }); + queue.push(dialog); + } else { + console.warn( + '未找到 van-dialog 节点,请确认 selector 及 context 是否正确' + ); + } + }); +}; +Dialog.alert = function (options) { + return Dialog(options); +}; +Dialog.confirm = function (options) { + return Dialog(__assign({ showCancelButton: true }, options)); +}; +Dialog.close = function () { + queue.forEach(function (dialog) { + dialog.close(); + }); + queue = []; +}; +Dialog.stopLoading = function () { + queue.forEach(function (dialog) { + dialog.stopLoading(); + }); +}; +Dialog.currentOptions = currentOptions; +Dialog.defaultOptions = defaultOptions; +Dialog.setDefaultOptions = function (options) { + currentOptions = __assign(__assign({}, currentOptions), options); + Dialog.currentOptions = currentOptions; +}; +Dialog.resetDefaultOptions = function () { + currentOptions = __assign({}, defaultOptions); + Dialog.currentOptions = currentOptions; +}; +Dialog.resetDefaultOptions(); +exports.default = Dialog; diff --git a/miniprogram_npm/@vant/weapp/dialog/index.js b/miniprogram_npm/@vant/weapp/dialog/index.js new file mode 100644 index 0000000..135ce71 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.js @@ -0,0 +1,126 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var button_1 = require('../mixins/button'); +var color_1 = require('../common/color'); +var utils_1 = require('../common/utils'); +component_1.VantComponent({ + mixins: [button_1.button], + props: { + show: { + type: Boolean, + observer: function (show) { + !show && this.stopLoading(); + }, + }, + title: String, + message: String, + theme: { + type: String, + value: 'default', + }, + useSlot: Boolean, + className: String, + customStyle: String, + asyncClose: Boolean, + messageAlign: String, + beforeClose: null, + overlayStyle: String, + useTitleSlot: Boolean, + showCancelButton: Boolean, + closeOnClickOverlay: Boolean, + confirmButtonOpenType: String, + width: null, + zIndex: { + type: Number, + value: 2000, + }, + confirmButtonText: { + type: String, + value: '确认', + }, + cancelButtonText: { + type: String, + value: '取消', + }, + confirmButtonColor: { + type: String, + value: color_1.RED, + }, + cancelButtonColor: { + type: String, + value: color_1.GRAY, + }, + showConfirmButton: { + type: Boolean, + value: true, + }, + overlay: { + type: Boolean, + value: true, + }, + transition: { + type: String, + value: 'scale', + }, + }, + data: { + loading: { + confirm: false, + cancel: false, + }, + callback: function () {}, + }, + methods: { + onConfirm: function () { + this.handleAction('confirm'); + }, + onCancel: function () { + this.handleAction('cancel'); + }, + onClickOverlay: function () { + this.close('overlay'); + }, + close: function (action) { + var _this = this; + this.setData({ show: false }); + wx.nextTick(function () { + _this.$emit('close', action); + var callback = _this.data.callback; + if (callback) { + callback(action, _this); + } + }); + }, + stopLoading: function () { + this.setData({ + loading: { + confirm: false, + cancel: false, + }, + }); + }, + handleAction: function (action) { + var _a; + var _this = this; + this.$emit(action, { dialog: this }); + var _b = this.data, + asyncClose = _b.asyncClose, + beforeClose = _b.beforeClose; + if (!asyncClose && !beforeClose) { + this.close(action); + return; + } + this.setData(((_a = {}), (_a['loading.' + action] = true), _a)); + if (beforeClose) { + utils_1.toPromise(beforeClose(action)).then(function (value) { + if (value) { + _this.close(action); + } else { + _this.stopLoading(); + } + }); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/dialog/index.json b/miniprogram_npm/@vant/weapp/dialog/index.json new file mode 100644 index 0000000..43417fc --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "van-button": "../button/index", + "van-goods-action": "../goods-action/index", + "van-goods-action-button": "../goods-action-button/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/dialog/index.wxml b/miniprogram_npm/@vant/weapp/dialog/index.wxml new file mode 100644 index 0000000..f49dee4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.wxml @@ -0,0 +1,113 @@ + + + + + + {{ title }} + + + + + {{ message }} + + + + + {{ cancelButtonText }} + + + {{ confirmButtonText }} + + + + + + {{ cancelButtonText }} + + + {{ confirmButtonText }} + + + diff --git a/miniprogram_npm/@vant/weapp/dialog/index.wxss b/miniprogram_npm/@vant/weapp/dialog/index.wxss new file mode 100644 index 0000000..68b75c8 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dialog/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-dialog{top:45%!important;overflow:hidden;width:320px;width:var(--dialog-width,320px);font-size:16px;font-size:var(--dialog-font-size,16px);border-radius:16px;border-radius:var(--dialog-border-radius,16px);background-color:#fff;background-color:var(--dialog-background-color,#fff)}@media (max-width:321px){.van-dialog{width:90%;width:var(--dialog-small-screen-width,90%)}}.van-dialog__header{text-align:center;padding-top:24px;padding-top:var(--dialog-header-padding-top,24px);font-weight:500;font-weight:var(--dialog-header-font-weight,500);line-height:24px;line-height:var(--dialog-header-line-height,24px)}.van-dialog__header--isolated{padding:24px 0;padding:var(--dialog-header-isolated-padding,24px 0)}.van-dialog__message{overflow-y:auto;text-align:center;-webkit-overflow-scrolling:touch;font-size:14px;font-size:var(--dialog-message-font-size,14px);line-height:20px;line-height:var(--dialog-message-line-height,20px);max-height:60vh;max-height:var(--dialog-message-max-height,60vh);padding:24px;padding:var(--dialog-message-padding,24px)}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--hasTitle{padding-top:8px;padding-top:var(--dialog-has-title-message-padding-top,8px);color:#646566;color:var(--dialog-has-title-message-text-color,#646566)}.van-dialog__message--round-button{padding-bottom:16px;color:#323233}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.van-dialog__footer{display:flex}.van-dialog__footer--round-button{position:relative!important;padding:8px 24px 16px!important}.van-dialog__button{flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog-bounce-enter{transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-dialog-bounce-leave-active{transform:translate3d(-50%,-50%,0) scale(.9);opacity:0} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/divider/index.js b/miniprogram_npm/@vant/weapp/divider/index.js new file mode 100644 index 0000000..b643841 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.js @@ -0,0 +1,14 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +component_1.VantComponent({ + props: { + dashed: Boolean, + hairline: Boolean, + contentPosition: String, + fontSize: String, + borderColor: String, + textColor: String, + customStyle: String, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/divider/index.json b/miniprogram_npm/@vant/weapp/divider/index.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/miniprogram_npm/@vant/weapp/divider/index.wxml b/miniprogram_npm/@vant/weapp/divider/index.wxml new file mode 100644 index 0000000..f6a5a45 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.wxml @@ -0,0 +1,9 @@ + + + + + + diff --git a/miniprogram_npm/@vant/weapp/divider/index.wxs b/miniprogram_npm/@vant/weapp/divider/index.wxs new file mode 100644 index 0000000..215b14f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style([ + { + 'border-color': data.borderColor, + color: data.textColor, + 'font-size': addUnit(data.fontSize), + }, + data.customStyle, + ]); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/divider/index.wxss b/miniprogram_npm/@vant/weapp/divider/index.wxss new file mode 100644 index 0000000..8b245b8 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/divider/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-divider{display:flex;align-items:center;margin:16px 0;margin:var(--divider-margin,16px 0);color:#969799;color:var(--divider-text-color,#969799);font-size:14px;font-size:var(--divider-font-size,14px);line-height:24px;line-height:var(--divider-line-height,24px);border:0 solid #ebedf0;border-color:var(--divider-border-color,#ebedf0)}.van-divider:after,.van-divider:before{display:block;flex:1;box-sizing:border-box;height:1px;border-color:inherit;border-style:inherit;border-width:1px 0 0}.van-divider:before{content:""}.van-divider--hairline:after,.van-divider--hairline:before{transform:scaleY(.5)}.van-divider--dashed{border-style:dashed}.van-divider--center:before,.van-divider--left:before,.van-divider--right:before{margin-right:16px;margin-right:var(--divider-content-padding,16px)}.van-divider--center:after,.van-divider--left:after,.van-divider--right:after{content:"";margin-left:16px;margin-left:var(--divider-content-padding,16px)}.van-divider--left:before{max-width:10%;max-width:var(--divider-content-left-width,10%)}.van-divider--right:after{max-width:10%;max-width:var(--divider-content-right-width,10%)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.js b/miniprogram_npm/@vant/weapp/dropdown-item/index.js new file mode 100644 index 0000000..aac47c9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.js @@ -0,0 +1,117 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var relation_1 = require('../common/relation'); +var component_1 = require('../common/component'); +component_1.VantComponent({ + field: true, + relation: relation_1.useParent('dropdown-menu', function () { + this.updateDataFromParent(); + }), + props: { + value: { + type: null, + observer: 'rerender', + }, + title: { + type: String, + observer: 'rerender', + }, + disabled: Boolean, + titleClass: { + type: String, + observer: 'rerender', + }, + options: { + type: Array, + value: [], + observer: 'rerender', + }, + popupStyle: String, + }, + data: { + transition: true, + showPopup: false, + showWrapper: false, + displayTitle: '', + }, + methods: { + rerender: function () { + var _this = this; + wx.nextTick(function () { + var _a; + (_a = _this.parent) === null || _a === void 0 + ? void 0 + : _a.updateItemListData(); + }); + }, + updateDataFromParent: function () { + if (this.parent) { + var _a = this.parent.data, + overlay = _a.overlay, + duration = _a.duration, + activeColor = _a.activeColor, + closeOnClickOverlay = _a.closeOnClickOverlay, + direction = _a.direction; + this.setData({ + overlay: overlay, + duration: duration, + activeColor: activeColor, + closeOnClickOverlay: closeOnClickOverlay, + direction: direction, + }); + } + }, + onOpen: function () { + this.$emit('open'); + }, + onOpened: function () { + this.$emit('opened'); + }, + onClose: function () { + this.$emit('close'); + }, + onClosed: function () { + this.$emit('closed'); + this.setData({ showWrapper: false }); + }, + onOptionTap: function (event) { + var option = event.currentTarget.dataset.option; + var value = option.value; + var shouldEmitChange = this.data.value !== value; + this.setData({ showPopup: false, value: value }); + this.$emit('close'); + this.rerender(); + if (shouldEmitChange) { + this.$emit('change', value); + } + }, + toggle: function (show, options) { + var _this = this; + var _a; + if (options === void 0) { + options = {}; + } + var showPopup = this.data.showPopup; + if (typeof show !== 'boolean') { + show = !showPopup; + } + if (show === showPopup) { + return; + } + this.setData({ + transition: !options.immediate, + showPopup: show, + }); + if (show) { + (_a = this.parent) === null || _a === void 0 + ? void 0 + : _a.getChildWrapperStyle().then(function (wrapperStyle) { + _this.setData({ wrapperStyle: wrapperStyle, showWrapper: true }); + _this.rerender(); + }); + } else { + this.rerender(); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.json b/miniprogram_npm/@vant/weapp/dropdown-item/index.json new file mode 100644 index 0000000..88d5409 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.wxml b/miniprogram_npm/@vant/weapp/dropdown-item/index.wxml new file mode 100644 index 0000000..dd75292 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.wxml @@ -0,0 +1,48 @@ + + + + + + + {{ item.text }} + + + + + + + diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/index.wxss b/miniprogram_npm/@vant/weapp/dropdown-item/index.wxss new file mode 100644 index 0000000..7cab3f2 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-dropdown-item{position:fixed;right:0;left:0;overflow:hidden}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active .van-dropdown-item__icon,.van-dropdown-item__option--active .van-dropdown-item__title{color:#ee0a24;color:var(--dropdown-menu-option-active-color,#ee0a24)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__icon{display:block;line-height:inherit} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/dropdown-item/shared.js b/miniprogram_npm/@vant/weapp/dropdown-item/shared.js new file mode 100644 index 0000000..db8b17d --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-item/shared.js @@ -0,0 +1,2 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.js b/miniprogram_npm/@vant/weapp/dropdown-menu/index.js new file mode 100644 index 0000000..9c27c64 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.js @@ -0,0 +1,126 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var relation_1 = require('../common/relation'); +var utils_1 = require('../common/utils'); +var ARRAY = []; +component_1.VantComponent({ + field: true, + relation: relation_1.useChildren('dropdown-item', function () { + this.updateItemListData(); + }), + props: { + activeColor: { + type: String, + observer: 'updateChildrenData', + }, + overlay: { + type: Boolean, + value: true, + observer: 'updateChildrenData', + }, + zIndex: { + type: Number, + value: 10, + }, + duration: { + type: Number, + value: 200, + observer: 'updateChildrenData', + }, + direction: { + type: String, + value: 'down', + observer: 'updateChildrenData', + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + observer: 'updateChildrenData', + }, + closeOnClickOutside: { + type: Boolean, + value: true, + }, + }, + data: { + itemListData: [], + }, + beforeCreate: function () { + var windowHeight = utils_1.getSystemInfoSync().windowHeight; + this.windowHeight = windowHeight; + ARRAY.push(this); + }, + destroyed: function () { + var _this = this; + ARRAY = ARRAY.filter(function (item) { + return item !== _this; + }); + }, + methods: { + updateItemListData: function () { + this.setData({ + itemListData: this.children.map(function (child) { + return child.data; + }), + }); + }, + updateChildrenData: function () { + this.children.forEach(function (child) { + child.updateDataFromParent(); + }); + }, + toggleItem: function (active) { + this.children.forEach(function (item, index) { + var showPopup = item.data.showPopup; + if (index === active) { + item.toggle(); + } else if (showPopup) { + item.toggle(false, { immediate: true }); + } + }); + }, + close: function () { + this.children.forEach(function (child) { + child.toggle(false, { immediate: true }); + }); + }, + getChildWrapperStyle: function () { + var _this = this; + var _a = this.data, + zIndex = _a.zIndex, + direction = _a.direction; + return utils_1.getRect(this, '.van-dropdown-menu').then(function (rect) { + var _a = rect.top, + top = _a === void 0 ? 0 : _a, + _b = rect.bottom, + bottom = _b === void 0 ? 0 : _b; + var offset = direction === 'down' ? bottom : _this.windowHeight - top; + var wrapperStyle = 'z-index: ' + zIndex + ';'; + if (direction === 'down') { + wrapperStyle += 'top: ' + utils_1.addUnit(offset) + ';'; + } else { + wrapperStyle += 'bottom: ' + utils_1.addUnit(offset) + ';'; + } + return wrapperStyle; + }); + }, + onTitleTap: function (event) { + var _this = this; + var index = event.currentTarget.dataset.index; + var child = this.children[index]; + if (!child.data.disabled) { + ARRAY.forEach(function (menuItem) { + if ( + menuItem && + menuItem.data.closeOnClickOutside && + menuItem !== _this + ) { + menuItem.close(); + } + }); + this.toggleItem(index); + } + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.json b/miniprogram_npm/@vant/weapp/dropdown-menu/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxml b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxml new file mode 100644 index 0000000..037ac3b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxml @@ -0,0 +1,23 @@ + + + + + + + + {{ computed.displayTitle(item) }} + + + + + + diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxs b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxs new file mode 100644 index 0000000..6538854 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxs @@ -0,0 +1,16 @@ +/* eslint-disable */ +function displayTitle(item) { + if (item.title) { + return item.title; + } + + var match = item.options.filter(function(option) { + return option.value === item.value; + }); + var displayTitle = match.length ? match[0].text : ''; + return displayTitle; +} + +module.exports = { + displayTitle: displayTitle +}; diff --git a/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxss b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxss new file mode 100644 index 0000000..df0b22a --- /dev/null +++ b/miniprogram_npm/@vant/weapp/dropdown-menu/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-dropdown-menu{display:flex;box-shadow:0 2px 12px rgba(100,101,102,.12);-webkit-user-select:none;user-select:none;height:50px;height:var(--dropdown-menu-height,50px);background-color:#fff;background-color:var(--dropdown-menu-background-color,#fff)}.van-dropdown-menu__item{display:flex;flex:1;align-items:center;justify-content:center;min-width:0}.van-dropdown-menu__item:active{opacity:.7}.van-dropdown-menu__item--disabled:active{opacity:1}.van-dropdown-menu__item--disabled .van-dropdown-menu__title{color:#969799;color:var(--dropdown-menu-title-disabled-text-color,#969799)}.van-dropdown-menu__title{position:relative;box-sizing:border-box;max-width:100%;padding:0 8px;padding:var(--dropdown-menu-title-padding,0 8px);color:#323233;color:var(--dropdown-menu-title-text-color,#323233);font-size:15px;font-size:var(--dropdown-menu-title-font-size,15px);line-height:18px;line-height:var(--dropdown-menu-title-line-height,18px)}.van-dropdown-menu__title:after{position:absolute;top:50%;right:-4px;margin-top:-5px;border-color:transparent transparent currentcolor currentcolor;border-style:solid;border-width:3px;transform:rotate(-45deg);opacity:.8;content:""}.van-dropdown-menu__title--active{color:#ee0a24;color:var(--dropdown-menu-title-active-text-color,#ee0a24)}.van-dropdown-menu__title--down:after{margin-top:-1px;transform:rotate(135deg)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/empty/index.js b/miniprogram_npm/@vant/weapp/empty/index.js new file mode 100644 index 0000000..d5b2025 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.js @@ -0,0 +1,12 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +component_1.VantComponent({ + props: { + description: String, + image: { + type: String, + value: 'default', + }, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/empty/index.json b/miniprogram_npm/@vant/weapp/empty/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/empty/index.wxml b/miniprogram_npm/@vant/weapp/empty/index.wxml new file mode 100644 index 0000000..9c7b719 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.wxml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + {{ description }} + + + + + + diff --git a/miniprogram_npm/@vant/weapp/empty/index.wxs b/miniprogram_npm/@vant/weapp/empty/index.wxs new file mode 100644 index 0000000..9696dd4 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.wxs @@ -0,0 +1,14 @@ +/* eslint-disable */ +var PRESETS = ['error', 'search', 'default', 'network']; + +function imageUrl(image) { + if (PRESETS.indexOf(image) !== -1) { + return 'https://img.yzcdn.cn/vant/empty-image-' + image + '.png'; + } + + return image; +} + +module.exports = { + imageUrl: imageUrl, +}; diff --git a/miniprogram_npm/@vant/weapp/empty/index.wxss b/miniprogram_npm/@vant/weapp/empty/index.wxss new file mode 100644 index 0000000..40b3747 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/empty/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;padding:32px 0}.van-empty__image{width:160px;height:160px}.van-empty__image:empty{display:none}.van-empty__image__img{width:100%;height:100%}.van-empty__image:not(:empty)+.van-empty__image{display:none}.van-empty__description{margin-top:16px;padding:0 60px;color:#969799;font-size:14px;line-height:20px}.van-empty__description:empty,.van-empty__description:not(:empty)+.van-empty__description{display:none}.van-empty__bottom{margin-top:24px} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/field/index.js b/miniprogram_npm/@vant/weapp/field/index.js new file mode 100644 index 0000000..e017616 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.js @@ -0,0 +1,151 @@ +'use strict'; +var __assign = + (this && this.__assign) || + function () { + __assign = + Object.assign || + function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; +Object.defineProperty(exports, '__esModule', { value: true }); +var utils_1 = require('../common/utils'); +var component_1 = require('../common/component'); +var props_1 = require('./props'); +component_1.VantComponent({ + field: true, + classes: ['input-class', 'right-icon-class', 'label-class'], + props: __assign( + __assign( + __assign(__assign({}, props_1.commonProps), props_1.inputProps), + props_1.textareaProps + ), + { + size: String, + icon: String, + label: String, + error: Boolean, + center: Boolean, + isLink: Boolean, + leftIcon: String, + rightIcon: String, + autosize: null, + required: Boolean, + iconClass: String, + clickable: Boolean, + inputAlign: String, + customStyle: String, + errorMessage: String, + arrowDirection: String, + showWordLimit: Boolean, + errorMessageAlign: String, + readonly: { + type: Boolean, + observer: 'setShowClear', + }, + clearable: { + type: Boolean, + observer: 'setShowClear', + }, + border: { + type: Boolean, + value: true, + }, + titleWidth: { + type: String, + value: '6.2em', + }, + } + ), + data: { + focused: false, + innerValue: '', + showClear: false, + }, + created: function () { + this.value = this.data.value; + this.setData({ innerValue: this.value }); + }, + methods: { + onInput: function (event) { + var _a = (event.detail || {}).value, + value = _a === void 0 ? '' : _a; + this.value = value; + this.setShowClear(); + this.emitChange(); + }, + onFocus: function (event) { + this.focused = true; + this.setShowClear(); + this.$emit('focus', event.detail); + }, + onBlur: function (event) { + this.focused = false; + this.setShowClear(); + this.$emit('blur', event.detail); + }, + onClickIcon: function () { + this.$emit('click-icon'); + }, + onClickInput: function (event) { + this.$emit('click-input', event.detail); + }, + onClear: function () { + var _this = this; + this.setData({ innerValue: '' }); + this.value = ''; + this.setShowClear(); + utils_1.nextTick(function () { + _this.emitChange(); + _this.$emit('clear', ''); + }); + }, + onConfirm: function (event) { + var _a = (event.detail || {}).value, + value = _a === void 0 ? '' : _a; + this.value = value; + this.setShowClear(); + this.$emit('confirm', value); + }, + setValue: function (value) { + this.value = value; + this.setShowClear(); + if (value === '') { + this.setData({ innerValue: '' }); + } + this.emitChange(); + }, + onLineChange: function (event) { + this.$emit('linechange', event.detail); + }, + onKeyboardHeightChange: function (event) { + this.$emit('keyboardheightchange', event.detail); + }, + emitChange: function () { + var _this = this; + this.setData({ value: this.value }); + utils_1.nextTick(function () { + _this.$emit('input', _this.value); + _this.$emit('change', _this.value); + }); + }, + setShowClear: function () { + var _a = this.data, + clearable = _a.clearable, + readonly = _a.readonly; + var _b = this, + focused = _b.focused, + value = _b.value; + this.setData({ + showClear: !!clearable && !!focused && !!value && !readonly, + }); + }, + noop: function () {}, + }, +}); diff --git a/miniprogram_npm/@vant/weapp/field/index.json b/miniprogram_npm/@vant/weapp/field/index.json new file mode 100644 index 0000000..5906c50 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } +} diff --git a/miniprogram_npm/@vant/weapp/field/index.wxml b/miniprogram_npm/@vant/weapp/field/index.wxml new file mode 100644 index 0000000..08eee01 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.wxml @@ -0,0 +1,56 @@ + + + + + + + {{ label }} + + + + + + + + + + + + + + + + + + + + + {{ value.length >= maxlength ? maxlength : value.length }}/{{ maxlength }} + + + {{ errorMessage }} + + diff --git a/miniprogram_npm/@vant/weapp/field/index.wxs b/miniprogram_npm/@vant/weapp/field/index.wxs new file mode 100644 index 0000000..78575b9 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function inputStyle(autosize) { + if (autosize && autosize.constructor === 'Object') { + return style({ + 'min-height': addUnit(autosize.minHeight), + 'max-height': addUnit(autosize.maxHeight), + }); + } + + return ''; +} + +module.exports = { + inputStyle: inputStyle, +}; diff --git a/miniprogram_npm/@vant/weapp/field/index.wxss b/miniprogram_npm/@vant/weapp/field/index.wxss new file mode 100644 index 0000000..6e3b16f --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-field{--cell-icon-size:16px;--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:#646566;color:var(--field-label-color,#646566)}.van-field__label--disabled{color:#c8c9cc;color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{display:flex;align-items:center}.van-field__body--textarea{box-sizing:border-box;padding:3.6px 0;line-height:1.2em;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__control:empty+.van-field__control{display:block}.van-field__control{position:relative;display:none;box-sizing:border-box;width:100%;margin:0;padding:0;line-height:inherit;text-align:left;background-color:initial;border:0;resize:none;color:#323233;color:var(--field-input-text-color,#323233);height:24px;height:var(--cell-line-height,24px);min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__control:empty{display:none}.van-field__control--textarea{height:18px;height:var(--field-text-area-min-height,18px);min-height:18px;min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:#ee0a24;color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;opacity:1;color:#c8c9cc;color:var(--field-input-disabled-text-color,#c8c9cc)}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__placeholder{position:absolute;top:0;right:0;left:0;pointer-events:none;color:#c8c9cc;color:var(--field-placeholder-text-color,#c8c9cc)}.van-field__placeholder--error{color:#ee0a24;color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{display:flex;align-items:center;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;vertical-align:middle;padding:0 8px;padding:0 var(--padding-xs,8px);margin-right:-8px;margin-right:-var(--padding-xs,8px)}.van-field__button,.van-field__clear-root,.van-field__icon-container{flex-shrink:0}.van-field__clear-root{font-size:16px;font-size:var(--field-clear-icon-size,16px);color:#c8c9cc;color:var(--field-clear-icon-color,#c8c9cc)}.van-field__icon-container{font-size:16px;font-size:var(--field-icon-size,16px);color:#969799;color:var(--field-icon-container-color,#969799)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:8px;padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{text-align:left;font-size:12px;font-size:var(--field-error-message-text-font-size,12px);color:#ee0a24;color:var(--field-error-message-color,#ee0a24)}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{text-align:right;margin-top:4px;margin-top:var(--padding-base,4px);color:#646566;color:var(--field-word-limit-color,#646566);font-size:12px;font-size:var(--field-word-limit-font-size,12px);line-height:16px;line-height:var(--field-word-limit-line-height,16px)}.van-field__word-num{display:inline}.van-field__word-num--full{color:#ee0a24;color:var(--field-word-num-full-color,#ee0a24)} \ No newline at end of file diff --git a/miniprogram_npm/@vant/weapp/field/input.wxml b/miniprogram_npm/@vant/weapp/field/input.wxml new file mode 100644 index 0000000..3ecab24 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/input.wxml @@ -0,0 +1,27 @@ + diff --git a/miniprogram_npm/@vant/weapp/field/props.js b/miniprogram_npm/@vant/weapp/field/props.js new file mode 100644 index 0000000..6ce703b --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/props.js @@ -0,0 +1,66 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.textareaProps = exports.inputProps = exports.commonProps = void 0; +exports.commonProps = { + value: { + type: String, + observer: function (value) { + if (value !== this.value) { + this.setData({ innerValue: value }); + this.value = value; + } + }, + }, + placeholder: String, + placeholderStyle: String, + placeholderClass: String, + disabled: Boolean, + maxlength: { + type: Number, + value: -1, + }, + cursorSpacing: { + type: Number, + value: 50, + }, + autoFocus: Boolean, + focus: Boolean, + cursor: { + type: Number, + value: -1, + }, + selectionStart: { + type: Number, + value: -1, + }, + selectionEnd: { + type: Number, + value: -1, + }, + adjustPosition: { + type: Boolean, + value: true, + }, + holdKeyboard: Boolean, +}; +exports.inputProps = { + type: { + type: String, + value: 'text', + }, + password: Boolean, + confirmType: String, + confirmHold: Boolean, +}; +exports.textareaProps = { + autoHeight: Boolean, + fixed: Boolean, + showConfirmBar: { + type: Boolean, + value: true, + }, + disableDefaultPadding: { + type: Boolean, + value: true, + }, +}; diff --git a/miniprogram_npm/@vant/weapp/field/textarea.wxml b/miniprogram_npm/@vant/weapp/field/textarea.wxml new file mode 100644 index 0000000..5015a51 --- /dev/null +++ b/miniprogram_npm/@vant/weapp/field/textarea.wxml @@ -0,0 +1,29 @@ + + + + + + + + 上传图片 + (最多三张) + + + + + + + + + + + + + + + diff --git a/pages/caogaozhi/caogaozhi.wxss b/pages/caogaozhi/caogaozhi.wxss new file mode 100644 index 0000000..4028062 --- /dev/null +++ b/pages/caogaozhi/caogaozhi.wxss @@ -0,0 +1,534 @@ +.top { + width:100%;height:100rpx;position:fixed;left:0;top:0;z-index:10; +} +.top_nav { + height:100rpx; + line-height:100rpx; + background:#6493FF; + position:relative; + color:#FFF; + font-size:32rpx; +} +.top_nav_center { + width:100%; + text-align:center; +} +.time { + height:100rpx; + line-height:100rpx; + position:absolute; + left:4%; + top:0; +} +.time image{ + width:50rpx; + height:50rpx; + margin-top:25rpx; + float:left; +} +.time text { + height:100rpx; + line-height:100rpx; + display:inline-block; + width:120rpx; + text-align:center; + letter-spacing:5rpx; + color:#FFF; + margin-left:20rpx; +} + +.coll { + position:absolute; + top:15rpx; + right:15%; + width:50rpx; + height:50rpx; + +} +.coll image { + width:100%; + height:100%; +} +.paper { + position:absolute; + top:15rpx; + right:4%; + width:50rpx; + height:50rpx; +} +.paper image { + width:100%; + height:100%; +} + + + + + + + + +.the_foot { + width:100%; + height:100rpx; + position:fixed; + left:0; + bottom:0; + z-index:10; +} +.foot { + height:100rpx; + line-height:100rpx; + background:#6493FF; + position:relative; + color:#FFF; + font-size:30rpx; +} +.foot_left { + width:28%; + height:100rpx; + position:absolute; + left:0; + top:0; +} + +.foot_center { + width:26%; + height:100rpx; + margin:0 auto; + text-align:center; +} +.foot_center image { + width:50rpx; + height:50rpx; + margin-top:25rpx; + float:left; +} +.foot_center text { + height:100rpx; + line-height:100rpx; + display:inline-block; + text-align:center; + color:#FFF; + margin-left:10rpx; +} + + +.foot_right { + width:28%; + height:100rpx; + position:absolute; + right:0; + top:0; +} +.foot button{ + width:90%; + height:70rpx; + line-height:70rpx; + margin-top:17rpx; + color:#6493FF; + font-size:30rpx; + +} + + + + + + + + +/*草稿纸*/ +.topic_cgz{ + position:fixed; + top:0; + width:100%; + height:100%; + background-color:rgba(0,0,0,0.4); + z-index:999; + overflow:hidden; +} +.topic_cgz_tab{ + width: 100%; + height:100%; + padding:0; + position: fixed; + top:0rpx; +} +.topic_cgz_tab .fl{ + width: 25%; + text-align: center; +} +.topic_cgz_tab image{ + width: 60rpx; + height: 60rpx; +} + + + + + + + + + + + + + + + + + + + + +/*滚动层*/ +scroll-item { + z-index:9; +} +.scoll-h { + height:100%; +} +.tab-content { + height:100%; + width:100%; + background:#fff; +} +.the_big_box { + height:100%; + width:100%; + background:#fff; + overflow-x:hidden; +} +.tab-content-top { + margin-top:20rpx; +} + + + + + + +/*问题*/ +.problem { + line-height:50rpx; + margin:20rpx; + font-size:34rpx; + color:#333333; +} +.wxParse-inline { + font-size:34rpx; +} +/*选项*/ +.option_box { + margin:0 30rpx; +} +.option{ + margin:30rpx 0; + margin-bottom:50rpx; +} +.option>view { + float:left; + width:70rpx; + height:70rpx; + position:relative; +} +.option>view>image { + width:100%; + height:100%; +} +.option>view>text { + position:absolute; + width:100%; + height:100%; + text-align:center; + left:0; + line-height:70rpx; + font-size:34rpx; + color:#B3B3B3; +} +.option>text { + margin-left:15rpx; + float:left; + width:85%; + font-size:34rpx; + color:#333; + line-height:50rpx; + margin-top:10rpx; +} +/*答题卡*/ +.Answer_card { + width:100%; + height:100%; + position:fixed; + left:0; + top:0; + background:#fff; + z-index:11; + overflow-y:scroll; +} +.card_top { + height:auto; + border-bottom:10rpx solid #f5f5f5; +} +.card_redius>view { + width:100%; + height:100%; + position:relative; +} +.card_redius { + width:200rpx; + height:200rpx; + border:2px solid #6493FF; + border-radius:50%; + margin:70rpx auto; +} +.card_redius .little_text { + position:absolute; + left:0; + top:40rpx; + width:100%; + text-align:center; + color:#999999; + font-size:30rpx; +} +.big_number { + position:absolute; + width:100%; + left:0; + top:83rpx; + text-align:center; + font-size:60rpx; +} +.circle { + width:80rpx; + height:80rpx; + overflow:hidden; + margin-top:40rpx; + margin-bottom:10rpx; + margin-left:60rpx; + display:inline-block; +} +.circle>view { + width:100%; + height:100%; + position:relative; +} +.circle image { + width:100%; + height:100%; +} +.circle text { + position:absolute; + left:0; + top:0; + width:100%; + text-align:center; + height:80rpx; + line-height: 80rpx; + font-size: 34rpx; + color:#bbb; +} +.title { + height:80rpx; + line-height:80rpx; + margin-top:20rpx; +} +.title>text { + font-size:34rpx; + margin-left:30rpx; + border-left:3px solid #6493FF; + padding-left:20rpx; + font-weight:bold; +} +.card_bottom { + margin:50rpx; +} +.button { + width:48%; + height:100rpx; + display:inline-block; + position:relative; + margin:1%; +} +.button_bj { + width:100%; + height:100%; +} +.button_image { + position:absolute; + left:40rpx; + top:31rpx; + width:40rpx; + height:40rpx; +} +.button text { + width:100%; + position:absolute; + left:30rpx; + top:0; + height:100rpx; + line-height:100rpx; + text-align:center; + color:#fff; + font-size:32rpx; +} +.tag { + padding:20rpx; + border-top:25rpx solid #f5f5f5; + padding-top:40rpx; +} +.tag .class{ + display:inline-block; + border:1px solid #6493FF; + padding:10rpx 20rpx; + font-size:30rpx; + margin-right:20rpx; + color:#6493FF; + border-radius:3px; + margin-bottom:20rpx; +} +.tag .label{ + display:inline-block; + border:1px solid #888888; + padding:10rpx 20rpx; + font-size:30rpx; + margin-right:20rpx; + margin-bottom:20rpx; + color:#888888; + border-radius:3px; +} +.analysis { + border-top:1px solid #f5f5f5; + padding-top:20rpx; + min-height:300rpx; +} +.analysis_title { + height:80rpx; + padding-top:15rpx; + +} +.analysis_title_left{ + margin-left:30rpx; + font-size:34rpx; + border-left:10rpx solid #6493FF; + padding-left:30rpx; + font-weight:bold; + float:left; +} +.analysis_title_right { + float:right; + width:220rpx; + height:60rpx; + background:#6493FF; + border-radius:50rpx; + margin-right:15rpx; +} +.analysis_title_right image { + width:35rpx; + height:35rpx; + position:absolute; + left:37rpx; + top:14rpx; +} +.analysis_title_right text{ + color:#E2EBFF; + height:60rpx; + line-height:60rpx; + padding-left:83rpx; + font-size:30rpx; +} +.list { + margin:20rpx; + border-radius:25rpx; + padding:20rpx; +} +.blue { + background:#E8F1FF; + border:1px solid #6493FF; +} + +.list_top { + position:relative; + height:125rpx; +} +.nickname { + position:absolute; + left:20%; + top:20rpx; + font-size:34rpx; + width:53%; + overflow:hidden; + height:45rpx; +} +.date { + position:absolute; + left:20%; + top:65rpx; + font-size:30rpx; + color:#888; +} +.head { + width:100rpx; + height:100rpx; + position:absolute; + left:2%; + top:10rpx; +} +.ding{ + width:50rpx; + height:50rpx; + position:absolute; + right:20%; + top:25rpx; +} +.zan{ + width:50rpx; + height:50rpx; + position:absolute; + right:8%; + top:20rpx; +} +.list_top image{ + width:100%; + height:100%; + border-radius:50%; +} +.list_down { + font-size:32rpx; + color:#888; +} +.list_down image { + width:120rpx; + height:120rpx; + display:block; + float:left; + margin-right:20rpx; + margin-top:20rpx; +} +.zan_count { + position:absolute; + right:2%; + top:32rpx; + font-size:32rpx; + color:#888888; +} +.image_box { + margin-top:40rpx; +} +.add { + width:120rpx; + height:120rpx; +} +.image_box text { + display:inline-block; + line-height:50rpx; + font-size:34rpx; + margin-left:15rpx; + padding-bottom:11rpx; + color:#888; +} +textarea { + position:static; +} \ No newline at end of file diff --git a/pages/chargeshop/chargeshop.js b/pages/chargeshop/chargeshop.js new file mode 100644 index 0000000..891ee10 --- /dev/null +++ b/pages/chargeshop/chargeshop.js @@ -0,0 +1,161 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + listdata:[ + { + goodsid:1, + goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png', + goodsname:'商品名称测试完成', + goodsintro:'这个商品的确不错哦', + goodsmoney:888, + goodsmoneyintro:'还要现金666元' + }, + { + goodsid:1, + goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png', + goodsname:'商品名称测试完成', + goodsintro:'这个商品的确不错哦', + goodsmoney:888, + goodsmoneyintro:'还要现金666元' + }, { + goodsid:1, + goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png', + goodsname:'商品名称测试完成', + goodsintro:'这个商品的确不错哦', + goodsmoney:888, + goodsmoneyintro:'还要现金666元' + }, { + goodsid:1, + goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png', + goodsname:'商品名称测试完成', + goodsintro:'这个商品的确不错哦', + goodsmoney:888, + goodsmoneyintro:'还要现金666元' + }, { + goodsid:1, + goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png', + goodsname:'商品名称测试完成', + goodsintro:'这个商品的确不错哦', + goodsmoney:888, + goodsmoneyintro:'还要现金666元' + }, + { + goodsid:1, + goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png', + goodsname:'商品名称测试完成', + goodsintro:'这个商品的确不错哦', + goodsmoney:888, + goodsmoneyintro:'还要现金666元' + }, + { + goodsid:1, + goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png', + goodsname:'商品名称测试完成', + goodsintro:'这个商品的确不错哦', + goodsmoney:888, + goodsmoneyintro:'还要现金666元' + }, + { + goodsid:1, + goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png', + goodsname:'商品名称测试完成', + goodsintro:'这个商品的确不错哦', + goodsmoney:888, + goodsmoneyintro:'还要现金666元' + } + ], + userinfo:[] + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + baseUrl.islogin(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.loaddata(); + }, + loaddata:function(params) { + //加载数据 + let url = baseUrl.globalData.baseUrl + '/user/getuserinfobyopenid'; + var param = { + id: baseUrl.globalData.currentuserinfo.id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + // console.log(res); + this.setData({ + userinfo: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + myodersclick:function(params) { + wx.navigateTo({ + url: '/pages/myorder/myorder', + }) + }, + goodinfoclick:function(params) { + console.log(params); + wx.navigateTo({ + url: '/pages/goodsinfo/goodsinfo?id=' + }) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/chargeshop/chargeshop.json b/pages/chargeshop/chargeshop.json new file mode 100644 index 0000000..f6c5e35 --- /dev/null +++ b/pages/chargeshop/chargeshop.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "兑换商城" +} \ No newline at end of file diff --git a/pages/chargeshop/chargeshop.wxml b/pages/chargeshop/chargeshop.wxml new file mode 100644 index 0000000..cf20446 --- /dev/null +++ b/pages/chargeshop/chargeshop.wxml @@ -0,0 +1,36 @@ + + + + + + + + {{userinfo.score}} + + + + + + + + + + + + + + + + + +

商品名称商品名称

+
+ + 文字说明文字说明文字说明 拷贝 3 + + + 666怼币 + +
+
+ \ No newline at end of file diff --git a/pages/chargeshop/chargeshop.wxss b/pages/chargeshop/chargeshop.wxss new file mode 100644 index 0000000..ad4d876 --- /dev/null +++ b/pages/chargeshop/chargeshop.wxss @@ -0,0 +1,143 @@ +/* 兑换商城的头部 */ +.shophead { + width: 666rpx; + height: 232rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/shoptop.png') no-repeat; + background-size: cover; + margin: 0 auto; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.headleft { + width: 60%; + height: 232rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.leftup image { + + width: 300rpx; + height: 90rpx; + margin: 0 50rpx; + +} + +.leftdown text { + + color: white; + font-size: 30rpx; +} + +.headright { + width: 40%; + height: 232rpx; +} + +.headright { + width: 50%; + height: 232rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.headright image { + + width: 210rpx; + height: 60rpx; +} + +/* 兑换商城的头部 */ + +/* 商品列表 */ + +.goodslist { + width: 666rpx; + margin: 0 auto; + display: flex; + flex-flow: row wrap; + align-content: flex-start; +} + +.goodsitems { + width: 210rpx; + height: 310rpx; + margin-left: 5rpx; + margin-right: 5rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top: 24rpx; +} + +.item1 { + width: 210rpx; + height: 213rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/shopbg.png') no-repeat; + background-size: cover; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.item1 image { + width: 192rpx; + height: 187rpx; +} + +.item2 { + width: 192rpx; + height: 32rpx; +} + +.item2 h2 { + width: 192rpx; + height: 32rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + font-size: 26rpx; + font-weight: 400; +} + +.item3 { + + width: 192rpx; + height: 30rpx; + margin-top: 5rpx; + line-height: 30rpx; + font-size: 22rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.item3 text { + + width: 192rpx; + height: 25rpx; + font-size: 22rpx; + color: #b2b2b2; +} + +.item4 { + + font-size: 24rpx; +} + +.item4 text { + + color: #f8bbd2; + font-size: 24rpx; +} + +/* 商品列表 */ \ No newline at end of file diff --git a/pages/classcommunityitemlist/classcommunityitemlist.js b/pages/classcommunityitemlist/classcommunityitemlist.js new file mode 100644 index 0000000..ddf2fb5 --- /dev/null +++ b/pages/classcommunityitemlist/classcommunityitemlist.js @@ -0,0 +1,185 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + pareid: 0, + listdata: [], + liveclickopen: 1, //2 + baseurl: baseUrl.globalData.baseimgurl, + coursename: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + this.setData({ + pareid: options.typeid + }); + + // this.pageScrollToBottom(); + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.getcousrethree(); + this.getcouresename(); + // this.pageScrollToBottom(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + liveopen(e) { + let arr = []; + arr = this.data.listdata; + console.log(e.currentTarget.dataset.itemid); + console.log(this.data.listdata); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = 1; //1 + arr[index] = item; + } else { + item['liveclickopen'] = 1; //2 + arr[index] = item + } + }) + this.setData({ + listdata: arr + }) + }, + liveclose(e) { + + let arr = []; + arr = this.data.listdata; + console.log(e.currentTarget.dataset.itemid); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = 2; + arr[index] = item; + } else { + item['liveclickopen'] = 2; + arr[index] = item + } + }) + this.setData({ + listdata: arr + }) + }, + getcouresename: function () { + + let id = this.data.pareid; + const that = this; + let url = baseUrl.globalData.baseUrl + '/classcourse/getcousretwoname'; + var param = { + id: that.data.pareid, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + coursename: res.data['name'] + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getcousrethree: function () { + const that = this; + let url = baseUrl.globalData.baseUrl + '/classcourse/getcoursethree'; + var param = { + pareid: that.data.pareid, + user_id:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + itemclickurl: function (e) { + console.log(e); + // return; + let typeid = e.currentTarget.dataset.typeid; + wx.navigateTo({ + url: '/pages/classcourselearning/classcourselearning?id=' + e.currentTarget.id + '&typeid=' + typeid, + }) + }, + pageScrollToBottom() { + wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + // rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height + console.log(rect.bottom + 2000) + // 使页面滚动到底部 + wx.pageScrollTo({ + scrollTop: rect.bottom + 2000 + }) + }).exec() + }, + + +}) \ No newline at end of file diff --git a/pages/classcommunityitemlist/classcommunityitemlist.json b/pages/classcommunityitemlist/classcommunityitemlist.json new file mode 100644 index 0000000..3e3a9cd --- /dev/null +++ b/pages/classcommunityitemlist/classcommunityitemlist.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "课程分类" + } \ No newline at end of file diff --git a/pages/classcommunityitemlist/classcommunityitemlist.wxml b/pages/classcommunityitemlist/classcommunityitemlist.wxml new file mode 100644 index 0000000..4771d20 --- /dev/null +++ b/pages/classcommunityitemlist/classcommunityitemlist.wxml @@ -0,0 +1,40 @@ + + + + {{coursename}} + + + + + + + + + {{itemwlmcchina.name}} + + + {{itemwlmcchina.num}} + + + + + + + + + + + {{itemchild.headpicvalue}} + + + {{itemchild.name}} + + + + + + + + + + \ No newline at end of file diff --git a/pages/classcommunityitemlist/classcommunityitemlist.wxss b/pages/classcommunityitemlist/classcommunityitemlist.wxss new file mode 100644 index 0000000..0f8d266 --- /dev/null +++ b/pages/classcommunityitemlist/classcommunityitemlist.wxss @@ -0,0 +1,127 @@ +.itemlist { + background: url('https://ndnd.duiduiedu.com/uploads/pics/kecheng001.png') no-repeat; + width: 750rpx; + height: 50rpx; + line-height: 50rpx; + background-size: cover; + display: flex; + flex-direction: row-reverse; + margin-top: 50rpx; + } + + .itemlist text { + + margin-right: 180rpx; + color: white; + } + + .collectionitems { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 10rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistred.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + + .collectionitems2 { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 10px; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistblue.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + + .item1 { + width: 60%; + } + + .item1 text { + width: 30%; + margin-left: 65rpx; + color: black; + font-size: 30rpx; + } + + .item2 { + width: 10%; + text-align: right; + } + + .item2 text { + color: black; + font-size: 30rpx; + } + + .item3 { + width: 20%; + text-align: center; + } + + .item3 image { + width: 28rpx; + height: 16rpx; + margin-right: 50rpx; + } + + .itemsup{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + border-bottom: 1rpx solid #fff; + } + + .itemsup2{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + display: none; + } + + .upitem1{ + + width: 107rpx; + height: 45rpx; + margin-left: 30rpx; + } + + .upitem1 text{ + + margin-left: 40rpx; + font-size: 28rpx; + } + .upitem2{ + width: 70%; + } + .upitem2 text{ + margin-left: 32rpx; + font-size: 28rpx; + } + .upitem3{ + margin-right: 37rpx; + } + .upitem3 image{ + width: 24rpx; + height: 26rpx; + } \ No newline at end of file diff --git a/pages/classcourselearning/classcourselearning.js b/pages/classcourselearning/classcourselearning.js new file mode 100644 index 0000000..6e34fc8 --- /dev/null +++ b/pages/classcourselearning/classcourselearning.js @@ -0,0 +1,1346 @@ +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + videurl: "https://xyg.jsjbkc.com/pics/xyg1.mp4?v" + Date.now(), + imagecount: 4, + courseid: 1, + itemdata: [], + baseurl: Apps.globalData.baseimgurl, + showview: false, + title: '', + content: '', + images: '', + upload_picture_list: [], + imagesListp: [], + imagestr: [], + imageslists: [], //图片预览 + ismdata: 1, //是否材料型数据跳转 + typeid: 1, + isdisplay: 1, + ispic: 0, + accesstoken: '', + xid: 0, + onefeilei: 0, //课程一级分类 + viptype_id: 1, //VIP类型 + videoContext: {}, // 用于绑定视频标签 + showvide: false, + videtimes: 5, + videtimes2: 10, + cousreshow: false, //检查用户是对课程有权限,对VIP用户onWaiting + headpicvalue: 0,//课程积分 + sliderValue: 0, //控制进度条slider的值, + updateState: false, //防止视频播放过程中导致的拖拽失效 + playStates: false, //控制播放 & 暂停按钮的显示 + fullScreen: false,//是否是全屏 + recommendListArr: [], + chongzhivalue: '怼币购买', + poptitle: '怼币购买后可学习14天', + isfinall: 0, //检测用户的课程是否完成 + video_data: {}, //要播放的视频对象 + show: false, + isvip:false, //是否VIP, + showdiage: false, + pathid:"", + actions: [ + { + name: '1.0倍速', + value: 1 + }, + { + name: '1.25倍速', + value: 1.25 + }, + { + name: '1.5倍速', + value: 1.5 + }, + { + name: '2.0倍速', + value: 2 + }, + ], + }, + showdiagePopup(e) { + console.log(e); + let pathid=e.currentTarget.id; + + let files = pathid; // knowfiles.currentTarget.id; + if(files.length==0){ + + wx.showToast({ + title: '暂时还没有讲义,不可下载',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + }else{ + this.setData({ showdiage: true,pathid:pathid }); + } + + }, + + onshowdiageClose() { + this.setData({ showdiage: false }); + }, + vippopmsg: function () { + //vip课程弹出消息框 + //判断VIP课程还有多少天 + this.vipkechengday(this.data.onefeilei, wx.getStorageSync('wxuserid')); + }, + vipkechengday: function (onefeilei, wxuserid) { + //判断VIP课程还有多少天 + const that = this; + let url = Apps.globalData.baseUrl + '/user/vipscourseuserday'; + var param = { + user_id: wxuserid, + sourceid: onefeilei + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + // 您的VIP会员剩余374天 + Toast('您的VIP会员剩余' + res + '天'); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + popmsg: function () { + //怼币课程弹出消息框 + //判断怼币课程还有多少天 + console.log(this.data.courseid); + console.log(wx.getStorageSync('wxuserid')); + this.duibikechengday(this.data.courseid, wx.getStorageSync('wxuserid')); + // Toast('您的课程还有8天到期,到期后需重新购买'); + }, + popclick: function () { + if (this.data.isdisplay == 1 && this.data.typeid != 1) { + //弹出购买信息 + this.setData({ + showvide: true + }); + this.videoContext.pause(); + + } + + }, + duibikechengday: function (sourceid, wxuserid) { + //判断怼币课程还有多少天 + //检查用户是否可以听课 + const that = this; + let url = Apps.globalData.baseUrl + '/user/setdecuserscoreday'; + var param = { + user_id: wxuserid, + sourceid: sourceid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + Toast('您的课程还有' + res + '天到期,到期后需重新购买'); + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + bsbtnclick: function () { + let bsdata = !this.data.show; + console.log(bsdata); + this.setData({ + show: bsdata + }) + }, + onClose: function () { + this.setData({ show: false }); + }, + onSelect: function (event) { + console.log(event.detail); + console.log(event.detail.value); + let rate = event.detail.value; + this.videoContext.playbackRate(Number(rate)); + this.onClose(); + }, + bindButtonRate: function (e) { + let rate = e.detail; + console.log(rate); + this.videoContext.playbackRate(Number(rate)); + }, + fullvideo: function (params) { + console.log(params); + // 全屏 + this.videoContext = wx.createVideoContext('myVideo'); + this.videoContext.requestFullScreen({ + direction: 1 + }); + }, + bindfullscreenchange: function (e) { + // let fullScreen = e.detail.fullScreen //值true为进入全屏,false为退出全屏 + // let videoContext = wx.createVideoContext('myVideo') + if (!e.detail.fullScreen) { + // 退出全屏 + this.videoContext.exitFullScreen() + } + else { + // 全屏 + this.videoContext = wx.createVideoContext('myVideo'); + this.videoContext.requestFullScreen({ + direction: -90 + }); + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + Apps.islogin(); + console.log(options); + // if (options.typeid == 3) { + // this.setData({ + // chongzhivalue: '充值VIP', + // poptitle: 'VIP期限内可无限畅学' + // }) + // } + this.setData({ + courseid: options.id, + typeid: options.typeid, + updateState: true + }); + + }, + buyclick(event) { + console.log(event.detail); + console.log("===========") + //购买是跳转,还是在这里需要判断购买 + console.log(this.data.viptype_id); + if (this.data.viptype_id == 2) { + //实现怼币购买 + this.kqcheckdescusersorce(wx.getStorageSync('wxuserid'), this.data.cousrceid, this.data.headpicvalue); + } else if (this.data.viptype_id == 3) { + //跳转购买课程页面 + wx.navigateTo({ + url: '/pages/viprecharge/viprecharge', + }) + } + }, + cancleclick() { + this.setData({ showvide: false }); + }, + videoUpdate(e) { + if (this.data.updateState) { + //判断拖拽完成后才触发更新,避免拖拽失效 + const times = e.detail.currentTime.toFixed(0); + let sliderValue = e.detail.currentTime / e.detail.duration * 100; + // console.log(sliderValue); + this.setData({ + sliderValue: sliderValue, + duration: e.detail.duration + }) + // console.log('sliderValue=>' + times); + // console.log('11试看=>' + times); + // this.publicdata(times); + + } + }, + publicdata: function (times) { + + //公共数据 + + //对2,3类型课程需要监控,一判断是否已用怼币购买过,二是判断是否为VIP用户 + if (this.data.viptype_id != 1) { + + //购买用户,怼币购买用户 + //1免费,2怼币,3VIP,4优惠值 + //先检查是否有怼币 + //增加一个两个小时的时长 + // console.log('先检查是否有怼币'); + // console.log(that.data.isdisplay); + if (this.data.isdisplay == 1) { + + if (this.data.cousreshow == false) { + + if (times >= this.data.videtimes) { + this.setData({ + showvide: true, + playStates: false, + sliderValue: times + }); + this.videoContext.pause(); + } + } + } + + } + }, + sliderChanging(e) { + + const times = e.detail.value.toFixed(0); + this.setData({ + updateState: false //拖拽过程中,不允许更新进度条 + }) + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.publicdata(times); + } else { + this.videoContext.play(); + } + }, + sliderChange(e) { + + const times = e.detail.value.toFixed(0); + this.setData({ + sliderValue: e.detail.value, + updateState: false //完成拖动后允许更新滚动条 + }) + + if (this.data.duration) { + this.videoContext.seek(e.detail.value / 100 * this.data.duration); //完成拖动后,计算对应时间并跳转到指定位置 + this.setData({ + sliderValue: e.detail.value.toFixed(0), + updateState: true //完成拖动后允许更新滚动条 + }) + } + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.setData({ + showvide: true, + duration: e.detail.duration, + playStates: false, + sliderValue: times + }); + this.publicdata(times); + + } else { + this.videoContext.play(); + } + + + }, + videoOpreation() { + + const playstats = !this.data.playStates; + this.setData({ + playStates: playstats, + }); + this.data.playStates ? this.videoContext.pause() : this.videoContext.play(); + const times = this.data.sliderValue; + console.log(times); + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.publicdata(times); + } + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + this.videoContext = wx.createVideoContext('myVideo'); + this.setData({ + updateState: true + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.isdisplay(); + this.getcoursedata(this.data.courseid); + // this.wrodtypelist(this.data.courseid); + // this.isjumpurl(this.data.typeid, 1); + // this.isfinallfun(this.data.courseid, wx.getStorageSync('wxuserid'), 2); //2不删除 + + }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + messageclick: function (e) { + + wx.reLaunch({ + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + }) + }, + deletewordreply: function (par) { + + //删除留言 + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/deletewordreply'; + var param = { + wordid: par + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + this.wrodtypelist(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getcoursedata: function (params) { + const that = this; + let url = Apps.globalData.baseUrl + '/classcourse/getcousrefourlist'; + var param = { + id: params, + user_id: wx.getStorageSync('wxuserid') == '' ? 0 : wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log('res===================='); + console.log(res); + let cousrceid = res.data.id; + let headpicvalue = res.data.headpicvalue; + console.log(res.data.onefeilei); + that.setData({ + itemdata: res.data, //课程数据 + onefeilei: res.data.onefeilei, //课程一级分类 + viptype_id: res.data.viptype_id,//课程类型 + headpicvalue: headpicvalue, //课程积分 + cousrceid: cousrceid, //课程ID + videtimes: res.data.bz, //视听时长 + videurl:res.data.vodurl + }); + + if (that.data.isdisplay == 1) { + + + // if (res.data.viptype_id == 3 || res.data.viptype_id == 2) { + //检查用户是否有课程权限 + // that.checkusercousre(res.data.onefeilei); + // } + console.log(res.data.viptype_id); + if(res.data.viptype_id == 1){ + // console.log(res.data.viptype_i) + // that.setData({ + // cousreshow:true, + // isvip:true + // }) + }else{ + + // that.checkusercousre(res.data.onefeilei); + } + that.checkusercousre(res.data.onefeilei); + // if (that.data.cousreshow == false) { + // //如果怼币课程看否,购买 + // that.checkuserscource(wx.getStorageSync('wxuserid'), cousrceid, headpicvalue); + // } + + // if (res.data.viptype_id == 2) { + // //如果怼币课程看否,购买 + // that.checkuserscource(wx.getStorageSync('wxuserid'), cousrceid, headpicvalue); + // } + // if (res.data.viptype_id == 3 || res.data.viptype_id == 2) { + // //检查用户是否有课程权限 + // that.checkusercousre(res.data.onefeilei, cousrceid); + // } + } + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + kqcheckdescusersorce: function (user_id, sourceid, headpicvalue) { + //扣除用户怼币 + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkdescuserscore'; + var param = { + user_id: user_id, + sourceid: sourceid, + headpicvalue: headpicvalue + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + + that.setData({ + cousreshow: res.data + }) + + if (res.data == false) { + + + wx.showModal({ + title: '提示', + content: '您的怼币不够,需要' + headpicvalue + '怼币,才能安心学习该课程', + success (res) { + if (res.confirm) { + console.log('确定'); + wx.navigateTo({ + url: '/pages/index/index', + }) + } else if (res.cancel) { + console.log('取消'); + wx.navigateTo({ + url: '/pages/vipquanyi/vipquanyi', + }) + } + } + }) + + // wx.showModal({ + // title: '提示', + // content: '您的怼币不够,需要' + headpicvalue + '怼币,才能安心学习该课程', + // cancelText: '退出', + // confirmText: '去充怼币', + // success: function (res) { + // if (res.cancel) { + // //这个跳转是左边按钮的跳转链接 + // //这里取消操作 + // console.log('确认扣除怼币' + headpicvalue); + // wx.navigateTo({ + // url: '/pages/index/index', + // }) + + // } else { + // //这里是右边按钮的跳转链接 + // wx.navigateTo({ + // url: '/pages/vipquanyi/vipquanyi', + // }) + // } + // } + // }) + }else{ + + Toast('课程购买成功,您花费了' + headpicvalue + '怼币,请安心学习该课程'); + + // wx.showModal({ + // title: '怼币购买成功', + // content: '课程购买成功,您花费了' + headpicvalue + '怼币,请安心学习该课程', + // success (res) { + // if (res.confirm) { + // console.log('确定'); + // wx.navigateTo({ + // url: '/pages/courselearning/courselearning?id=' + that.data.courseid + "&typeid=" + that.data.typeid, + // }) + // } else if (res.cancel) { + // console.log('取消') + // } + // } + // }) + + // wx.showModal({ + // title: '怼币购买成功', + // content: '课程购买成功,您花费了' + headpicvalue + '怼币,请安心学习该课程', + // cancelText: '好的,去学习', + // confirmText: '去充怼币', + // success: function (res) { + + // // wx.navigateTo({ + // // url: '/pages/courselearning/courselearning?id=' + that.data.courseid + "&typeid=" + that.data.typeid, + // // }) + // } + // }).catch((errMsg) => { + // console.log(errMsg); + // }); + + } + }) + }, + checkuserscource: function (user_id, sourceid, headpicvalue) { + //检查用户是否可以听课 + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkuserscource'; + var param = { + user_id: user_id, + sourceid: sourceid, + headpicvalue: headpicvalue + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + that.setData({ + cousreshow: res.data + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + finallclick: function (params) { + + if (this.data.cousreshow == false) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + this.isfinallfun(this.data.courseid, wx.getStorageSync('wxuserid'), 1); + }, + isfinallfun: function (id, userid, typeid) { + //是否完成函数 + const that = this; + let url = Apps.globalData.baseUrl + '/classcourse/finallclick'; + var param = { + id: id, + user_id: userid, + typeid: typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + that.setData({ + isfinall: res + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + downfile: function (knowfiles) { + + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + // let files = knowfiles.currentTarget.id; + let files = this.data.pathid;// knowfiles.currentTarget.id; + + + wx.downloadFile({ + url: this.data.baseurl + files, + success(res) { + + wx.shareFileMessage({ + filePath: res.tempFilePath, + success() {}, + fail: console.error, + }) + + // wx.openDocument({ + // filePath: res.tempFilePath, + // showMenu:true, //关键点 + // success() { + // // wx.showToast({ + // // title: '下载成功',//提示文字 + // // duration: 2000,//显示时长 + // // mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + // // icon: 'success', //图标,支持"success"、"loading" + // // success: function () { },//接口调用成功 + // // fail: function () { }, //接口调用失败的回调函数 + // // complete: function () { } //接口调用结束的回调函数 + // // }) + // } + // }) + } + }) + }, + downfilepoto: function (knowfiles) { + + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + // let files = knowfiles.currentTarget.id; + let files = this.data.pathid + + wx.downloadFile({ + url: this.data.baseurl + files, + success(res) { + wx.openDocument({ + filePath: res.tempFilePath, + showMenu:true, //关键点 + success() { + } + }) + } + }) + }, + collectionclick: function (params) { + + let id = params.currentTarget.id; + console.log(id); + this.collectionclickdata(id, wx.getStorageSync('wxuserid')); + + }, + collectionclickdata: function (collection_id, user_id) { + const that = this; + let url = Apps.globalData.baseUrl + '/course/coursecollection'; + var param = { + id: collection_id, + user_id: user_id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + this.getcoursedata(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + displayview: function () { + console.log(this.data.showview); + this.setData({ + showview: (!this.data.showview) + }) + this.getacctoken(); + this.pageScrollToBottom(); + }, + wrodtypelist: function (params) { + + //获取课程留言 + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscourselist'; + var param = { + id: params, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + delesourceclick: function (par) { + const that = this; + wx.showModal({ + title: '删除提示', + content: '您将删除该留言信息', + cancelText: '退出', + confirmText: '确认', + success: function (res) { + if (res.cancel) { + //这个跳转是左边按钮的跳转链接 + //这里取消操作 + console.log(res); + + } else { + //这里是右边按钮的跳转链接 + let id = par.currentTarget.id; + //删除课程留言数据 + let url = Apps.globalData.baseUrl + '/wordslist/wordscoursedelete'; + var param = { + id: id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.wrodtypelist(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } + } + }) + + }, + wordsclick: function (ee) { + + let e1 = ee.currentTarget.id; + // let e2 = Apps.globalData.currentuserinfo.id; + let e2 =wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscourseclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + + // that.getpicchekc(that.data.imagesListp[i]); + + // if (that.data.ispic == 1) { + + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + } + + // } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + // 删除图片 + removeChooseImage(e) { + let imgs = this.data.imagestr; + let { index } = e.currentTarget.dataset; + imgs.splice(index, 1); + this.setData({ + imagestr: imgs + }) + }, + // 预览图片 + previewBigImage(e) { + let that = this; + let imgs = that.data.imagestr; + let index = e.currentTarget.dataset.index; + let arr = []; + imgs.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + //当前显示图片 + current: arr[index], + //所有图片 + urls: arr + }) + }, + isjumpblack:function(){ + console.log(wx.getStorageSync('userisblack')); + if(wx.getStorageSync('userisblack')>=2){ + + wx.showToast({ + title: "您已被禁言,请联系管理员",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + formSubmit: function (e) { + + Apps.islogin(); + + if(wx.getStorageSync('userisblack')>=2){ + this.isjumpblack(); + return; + } + + let content = this.data.wordstextname; + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + this.getmsgcheck(content); + + }, + bindTextAreaBlur: function (e) { + this.setData({ + wordstextname: e.detail.value + }) + }, + uploadpicsimage: function (e) { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/uploadpics'; + var param = { + url: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscouresadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordsid: that.data.courseid, + xid: that.data.xid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + + that.wrodtypelist(that.data.courseid); + + that.setData({ + wordstextname: '', + imagestr: '' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + contentclick: function (params) { + + console.log(params); + let id = params.currentTarget.id; + let xid = params.currentTarget.dataset.xid; + console.log(id); + this.setData({ + wordstextname: '回复@' + id, + showview: true, + xid: xid + }); + + // this.addinccomment(xid); + + this.getacctoken(); + + wx.showToast({ + title: '@成功,留言请移底部留言', + icon: 'none', + duration: 1500 + }) + this.pageScrollToBottom(); + + }, rdclick: function (params) { + + this.pageScrollToBottom(); + }, addinccomment: function (params) { + //增加评论数 + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/addcommentcount'; + var param = { + id: params, + userid: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(that.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + clickbtn: function (params) { + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscourseclickcount'; + var param = { + words_id: params.currentTarget.id, + user_id: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(this.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + knowledgeclick: function (params) { + //知识要点 + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + let examid = params.currentTarget.id; + if(examid>0){ + wx.navigateTo({ + url: '/pages/knowledge/knowledge?examid=' + examid, + }) + }else{ + Toast('此课程暂无知识要点'); + } + + + }, + examingclick: function (params) { + + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + let examid = params.currentTarget.id; + let ismdata = this.data.ismdata; + let grouppaper_id = this.data.itemdata.grouppaper_id; + if(grouppaper_id>0){ + + + if (ismdata == 2) { + wx.navigateTo({ + url: '/pages/exammakings/exammakings?examid=' + examid + '&grouppaper_id=' + grouppaper_id, + }) + } else { + wx.navigateTo({ + url: '/pages/examing/examing?examid=' + examid + '&grouppaper_id=' + grouppaper_id, + }) + } + }else{ + + Toast('该课程无练习试题'); + } + }, + preview: function (params) { + let that = this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + + let rearr = that.data.replylist[arrindex].pics; + console.log(rearr); + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + isjumpurl: function (id, groupid) { + + const that = this; + let url = Apps.globalData.baseUrl + '/exam/isarrdata'; + var param = { + id: id, + groupid: groupid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + ismdata: res.data + }); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + isdisplay: function (params) { + //是否显示视频 + const that = this; + let url = Apps.globalData.baseUrl + '/index/isdisplay'; + var param = { + pareid: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + isdisplay: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + console.log('-=-=-=-=-=-=-=-='); + console.log(res); + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getmsgcheck: function (params) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": that.data.accesstoken + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + that.wordsadd(params, that.data.imagestr); + // if (res.errcode == "0") { + // that.wordsadd(params, that.data.imagestr) + // } else { + + // wx.showToast({ + // title: '留言内容有敏感词请重新输入',//提示文字 + // duration: 2000,//显示时长 + // mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + // icon: 'none', //图标,支持"success"、"loading" + // success: function () { },//接口调用成功 + // fail: function () { }, //接口调用失败的回调函数 + // complete: function () { } //接口调用结束的回调函数 + // }) + // } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + checkusercousre: function (para) { + //vip课程 + //检测用户是否这个课程的权限 + Apps.islogin(); + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkusercousre' + var param = { + user_id: wx.getStorageSync('wxuserid'), + courseid: para, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log('// 检查一下用户是否有课程权限 cousreshow=true'); + console.log(res); + console.log(res.data); + // 检查一下用户是否有课程权限 cousreshow=true + that.setData({ + cousreshow: res.data.iscousreshow, + isvip:res.data.isvip + }); + + if(res.data.isvip==false && that.data.viptype_id==2){ + + that.checkuserscource(wx.getStorageSync('wxuserid'), that.data.cousrceid, that.data.headpicvalue); + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getpicchekc: function (params) { + // let url="https://api.weixin.qq.com/wxa/media_check_async?access_token="+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkpic' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "media_url": params, + "media_type": 2, + "version": 2, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log("res==========="); + console.log(res); + + this.setData({ + ispic: 1 + }) + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + pageScrollToBottom() { + wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height + console.log(rect.bottom * 20) + // 使页面滚动到底部 + wx.pageScrollTo({ + scrollTop: rect.bottom * 20 + }) + }).exec() + }, + +}) \ No newline at end of file diff --git a/pages/classcourselearning/classcourselearning.json b/pages/classcourselearning/classcourselearning.json new file mode 100644 index 0000000..9c44bd3 --- /dev/null +++ b/pages/classcourselearning/classcourselearning.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "课程学习", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/classcourselearning/classcourselearning.wxml b/pages/classcourselearning/classcourselearning.wxml new file mode 100644 index 0000000..96da078 --- /dev/null +++ b/pages/classcourselearning/classcourselearning.wxml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/classcourselearning/classcourselearning.wxss b/pages/classcourselearning/classcourselearning.wxss new file mode 100644 index 0000000..c4ef157 --- /dev/null +++ b/pages/classcourselearning/classcourselearning.wxss @@ -0,0 +1,339 @@ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.courselivecontinor { + background-color: #F5F5F5; +} + +.functionalarea { + + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 485rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + /* font-weight: 400rpx; */ +} + +.headrightdown { + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + padding-top: 20rpx; + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.round-click{ + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; + } + .round-click image{ + height: 61rpx; + line-height: 61rpx; + width: 54rpx; + } + + + +.areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; + } + .areaclass textarea{ + width: 540rpx; + min-height: 300rpx; + } + + + .areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; + } + .areafooterleft image{ + + width: 52rpx; + height: 52rpx; + + } + .areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; + } + .areafooterright{ + width: 120rpx; + height: 56rpx; + } + .areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; + } + button::after { + border: none; + } + + .header_view_hide{ + display: none; + } + .header_view_show{ + display: block; + } + .vipimage image{ + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; + } + + + .process-container image{ + + position: relative; + z-index: 99; + transform:translate(20%, -10%); + z-index: 999; + width: 60rpx; + height: 60rpx; + +} + +.slider-container { + height: 1rpx; + position: relative; + z-index: 999; + left: 50%; + top: -379%; + transform: translate(-50%, -78rpx); + z-index: 999; + width: 80%; +} +.slider{ + width: 80%; + margin: 0 auto; +} +.mod_action { + position: relative; + z-index: 999; + left:520rpx; + top:-50rpx; + border-radius: 20%; + /* transform: translate(-50%, -98rpx); */ + width: 180rpx; + height: 15rpx; + +} +.playfull{ + position: relative; + z-index: 999; + left:40rpx; + top:70rpx; + border-radius: 20%; + /* transform: translate(-50%, -98rpx); */ + width: 180rpx; + height: 120rpx; +} +.van-dropdown-menu{ + height: var(--dropdown-menu-height,28px)!important; +} +.van-dropdown-menu__item{ + background: url("https://ndnd.duiduiedu.com/uploads/pics/bsbtn.png"); + width: 300px; + height: 90rpx; + background-size:cover; + background-repeat:no-repeat; +} +.playfull image{ + width: 180rpx; + height: 80rpx; +} +.mod_action image{ + width: 180rpx; + height: 80rpx; +} + + + +.choose_upload_view { + margin-top: 30rpx; + margin-left: 10%; + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-start; + flex-wrap: wrap; + } + .choose_upload_item { + margin-left: 38rpx; + margin-bottom: 20rpx; + position: relative; + width: 100rpx; + display: flex; + align-items: center; + } + .choose_upload_view .choose_upload_img { + width: 100rpx; + height: 100rpx; + } + .choose_upload_view .remove_img_icon { + padding: 4rpx; + position:absolute; + top: -15rpx; + right: -13rpx; + width: 28rpx; + height: 28rpx; + border-radius: 50%; + background-color: rgba(248, 236, 236, 0.5); + } + .other_upload { + margin-left: 15rpx; + width: 80rpx; + } \ No newline at end of file diff --git a/pages/classindex/classindex.js b/pages/classindex/classindex.js new file mode 100644 index 0000000..a4a68bb --- /dev/null +++ b/pages/classindex/classindex.js @@ -0,0 +1,384 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +const { default: toast } = require('../../miniprogram_npm/@vant/weapp/toast/toast.js'); +Page({ + + data: { + startPageX: 0, + currentView: DEFAULT_PAGE, + livesdata: [], + baseurl: baseUrl.globalData.baseimgurl, + movies: [], + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + itemdata: [], + isdisplay: 1, + onelist: [], //一级数据 + activeshow: 1, + currentid: 1, + classid:1 //班级ID + }, + checkclassshow(event) { + //新增开关功能 + console.log(event); + console.log(event.currentTarget.id); + const id = event.currentTarget.id; + let arr1 = []; + let arr = []; + arr = this.data.onelist; + + // if (id == 1) { + + // arr.forEach(function (item, index) { + // console.log(item); + // if (item.id == 2) { + // arr1[index] = item; + // } + // }) + // this.setData({ + // onelist: arr1 + // }) + + // } else { + // arr.forEach(function (item, index) { + // console.log(item); + // if (item.id == 1) { + // arr1[index] = item; + // } + // }) + // this.setData({ + // onelist: arr1 + // }) + // } + + + + // arr.forEach(function (item, index) { + + // if (index == e.currentTarget.dataset.itemid) { + // item['liveclickopen'] = 2; + // arr[index] = item; + // } else { + // item['liveclickopen'] = 2; + // arr[index] = item + // } + // }) + // this.setData({ + // listdata: arr + // }) + + + }, + footeronChange(event) { + this.setData({ + footeractive: event.detail + }); + }, + onChangefooter(event) { + console.log(event.detail); + this.setData({ + footeractive: event.detail + }); + }, + onChange(event) { + wx.showToast({ + title: `切换到标签 ${event.detail.name}`, + icon: 'none', + }); + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + console.log(e.currentTarget.id); + this.getindexcoursetwo(e.currentTarget.id); + this.setData({ + active: e.currentTarget.id + }) + }, + loaditem(id) { + console.log(id); + }, + cardaddclick(e) { + + console.log(e); + + }, + challengeclickleft(e) { + console.log(e.currentTarget.id); + this.setData({ + challengeactive: e.currentTarget.id + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + //baseUrl.islogin(); + console.log("------------==============-------------"); + console.log(options.classid); + console.log("------------==============-------------"); + + this.setData({ + classid:options.classid + }); + + }, + getpopindexcouse: function (params) { + //顶级分类 + const that = this; + let url = baseUrl.globalData.baseUrl + '/classindex/indexcoursetop'; + var param = { + id: this.data.classid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res.data[0].id); + that.setData({ + list: res.data, + active:res.data[0].id + }); + if(res.data[0].id>0){ + that.getindexcoursetwo(res.data[0].id); + } + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getindexcourse: function () { + const that = this; + let url = baseUrl.globalData.baseUrl + '/classindex/indexcourse'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + list: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getindexcoursetwo: function (e) { + + //得到二级课程的数据 + const that = this; + let url = baseUrl.globalData.baseUrl + '/classindex/indexcoursepara'; + var param = { + pareid: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log('==================='); + console.log(res.data); + that.setData({ + onelist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + // this.setData({ + // active: 1 + // }); + + // if (wx.getStorageSync('userinfo') != null) { + // baseUrl.globalData.currentuserinfo = wx.getStorageSync('userinfo'); + // wx.setStorageSync('wxopenid', wx.getStorageSync('userinfo').openid); + // } + this.isdisplay(); + wx.showShareMenu({ + withShareTicket: true, + menus: ['shareAppMessage', 'shareTimeline'] + }) + this.getpopindexcouse(); //顶级分类 + // this.getindexcourse(); //一级分类 + console.log("activeid"+this.data.active) + this.getindexcoursetwo(this.data.active); + // this.adsfun(); + //this.indexlives(); + this.isjumpblack(); + + }, + isjumpblack: function () { + console.log(wx.getStorageSync('userisblack')); + if (wx.getStorageSync('userisblack') == 2) { + + wx.showToast({ + title: "不允许访问该程序",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + wx.reLaunch({ + url: '/pages/userlogin/userlogin', + }) + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + indexlives: function () { + //直播列表 + const that = this; + let url = baseUrl.globalData.baseUrl + '/lives/indexlives'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + // console.log(res); + that.setData({ + livesdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + adsfun: function () { + //广告 + const that = this; + let url = baseUrl.globalData.baseUrl + '/ads/index'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + // console.log(res); + that.setData({ + movies: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + livelistclick: function () { + + if (this.data.isdisplay == 1) { + // 直播列表 + wx.navigateTo({ + url: '/pages/indexlives/indexlives', + }) + } else { + wx.showToast({ + title: `功能正在开发中`, + icon: 'none', + }); + } + }, + messageclick: function () { + + wx.navigateTo({ + url: '/pages/messagelist/messagelist', + }) + }, + resclick: function () { + wx.navigateTo({ + url: '/pages/indexreslists/indexreslists', + }) + }, + courselearningclick: function (e) { + + //课程学习 + console.log(e.currentTarget.id); + wx.navigateTo({ + url: '/pages/classcommunityitemlist/classcommunityitemlist?typeid=' + e.currentTarget.id, + }) + }, + picsclick: function (e) { + console.log(e); + if (this.data.isdisplay == 1) { + console.log(e.currentTarget.id); + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=' + e.currentTarget.id, + }) + } + + }, + isdisplay: function (params) { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/index/isdisplay'; + var param = { + pareid: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + isdisplay: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + onShareAppMessage: function (options) {//分享onShareAppMessage + return { + title: '怼怼公考', + path: `/pages/classindex/classindex`, + success: function (res) { + console.log(res, '成功') + console.info(res + '成功'); + wx.showToast({ + title: '分享成功', + }) + // 转发成功 + }, + fail: function (res) { + console.log(res + '失败'); + // 转发失败 + }, + complete: function (res) { + // 不管成功失败都会执行 + console.log(res, '成功或失败') + wx.showToast({ + title: '成功或失败', + }) + } + } + } + +}) \ No newline at end of file diff --git a/pages/classindex/classindex.json b/pages/classindex/classindex.json new file mode 100644 index 0000000..3ed55af --- /dev/null +++ b/pages/classindex/classindex.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "班级课程", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/classindex/classindex.wxml b/pages/classindex/classindex.wxml new file mode 100644 index 0000000..8f047f3 --- /dev/null +++ b/pages/classindex/classindex.wxml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + + + + + + + + + + \ No newline at end of file diff --git a/pages/classindex/classindex.wxss b/pages/classindex/classindex.wxss new file mode 100644 index 0000000..4675bd4 --- /dev/null +++ b/pages/classindex/classindex.wxss @@ -0,0 +1,356 @@ +.swiper { + height: 218rpx; + width: 666rpx; + margin: 0 auto; +} + +.swiper image { + height: 100%; + width: 100%; +} +.cardgongneng{ + display: flex; + flex-wrap: wrap; + align-content: center; + justify-content:space-between; + height: 170rpx; + width: 666rpx; + margin: 25rpx auto; + border: 1rpx solid #e7d1d1; + border-radius: 2%; + box-shadow:1px 1px 1px 1px rgb(236, 234, 234); +} +.cardgongneng2{ + display: flex; + flex-wrap: wrap; + align-content: center; + justify-content:space-between; + height: 170rpx; + width: 570rpx; + margin: 0 auto; +} +.cardgongneng2 image{ + width: 85rpx; + height: 100rpx; + +} +.zhibocss { + display: flex; + flex-wrap: wrap; + align-content: flex-start; + height: 180rpx; + width: 666rpx; + margin: 50rpx auto; + background: url(https://ndnd.duiduiedu.com/uploads/pics/line.png); + background-repeat: no-repeat; + background-size: 666rpx 180rpx; + display: none; +} + +.item1 { + + width: 50rpx; + height: 150rpx; + box-sizing: border-box; + margin: 15rpx 16rpx; +} + +.itemhead { + margin-top: 20rpx; + margin-left: 20rpx; +} + +.itemhead h2 { + + font-weight: 600; + font-family: 'Arial Narrow', Arial; + font-size: large; +} + +.item1 image { + width: 50rpx; + height: 150rpx; +} + +.item2 { + width: 160rpx; + height: 160rpx; +} + +.item2 image { + margin-left: 10rpx; + width: 150rpx; + height: 160rpx; +} + +.item3 { + width: 334rpx; + height: 170rpx; +} + +.item4 { + padding-top: 10rpx; + padding-left: 15rpx; + width: 75rpx; + height: 164rpx; +} + +.item4 image { + + width: 75rpx; + height: 164rpx; +} + +.itemmiddle { + display: flex; + margin-left: 15rpx; + width: 334rpx; + height: 50rpx; +} + +.itemmiddleleft { + display: flex; + margin-top: 10rpx; + flex-direction: row; +} + +.itemmiddleleft text { + color: #AEAEAE; + align-items: center; + font-size: 24rpx; + font-weight: 400; +} + +.itemmiddleleft image { + + width: 30rpx; + height: 30rpx; + padding-right: 10rpx; +} + +.itemmiddleright { + display: flex; + margin-top: 10rpx; + margin-left: 10rpx; + flex-direction: row; +} + +.itemmiddleright text { + color: #AEAEAE; + align-items: center; + font-size: 24rpx; + font-weight: 400; +} + +.itemmiddleright image { + + width: 30rpx; + height: 30rpx; + padding-right: 10rpx; +} + +.itemend { + width: 300rpx; + overflow: hidden; + color: #AEAEAE; + line-height: 28rpx; + margin-bottom: 10rpx; + margin-left: 20rpx; + font-size: 18rpx; +} + +.curriculum { + + margin: 0 auto; + /* margin-top: 20rpx; */ + width: 686rpx; + /* height: 350rpx; */ + /* margin-bottom: 80rpx; */ +} + +.curriculumup { + + width: 750rpx; + height: 55rpx; +} + +.curriculumupstart { + float: left; + width: 660rpx; + height: 55rpx; + margin-top: 20rpx; + margin-bottom: 10rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.card { + display: flex; + justify-content: center; + align-items: center; + box-sizing: border-box; + height: 55rpx; + line-height: 55rpx; + /* margin: 100rpx 200rpx; */ + font-size: 20px; + /* padding-left: 20rpx; + padding-right: 30rpx; */ + margin-left: 10rpx; + border-radius: 4px; +} +.curriculumdown { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 666rpx; + /* height: 295rpx; */ +} + +.curriculumitem { + display: flex; + flex-direction: column; + /* width: 33%; */ + width: 33%; + height: 150rpx; + align-items: center; + margin-top: 20rpx; + /* margin-bottom: 20rpx; */ +} + +.downup { + width: 90rpx; + height: 80rpx; + text-align: center; +} + +.downup image { + width: 80rpx; + height: 90rpx; + text-align: center; +} + +.downdown { + margin-top: 15rpx; + text-align: center; + width: 180rpx; + height: 30rpx; +} + +.downdown text { + font-size: 20rpx; + +} + + + +.curriculumupend image { + width: 50rpx; + height: 50rpx; +} + +.challenge { + width: 666rpx; + margin: 0 auto; + height: 83rpx; +} + +.challengeleft { + + float: left; + width: 429rpx; + height: 80rpx; + +} + +.challengeleft image { + + width: 440rpx; + height: 80rpx; +} + +.challengeright { + float: left; + width: 238rpx; + height: 80rpx; +} + +.challengeright image { + + width: 240rpx; + height: 80rpx; +} + + +.challenge2 { + width: 666rpx; + margin: 0 auto; + height: 83rpx; +} + +.challenge2left { + + float: left; + + width: 238rpx; + height: 80rpx; + +} + +.challenge2left image { + + + width: 253rpx; + height: 80rpx; +} + +.challenge2right { + float: left; + width: 429rpx; + height: 80rpx; +} + +.challenge2right image { + + width: 432rpx; + height: 80rpx; +} + +.van-tabbar-item { + height: 298rpx; + width: 130rpx; +} + +/***parent**/ +.parentclass { + margin: 0 auto; + width: 666rpx; +} +.parentimage{ + width: 200rpx; + height: 30rpx; + margin-top: 10rpx; + +} +.parentimage image{ + width: 200rpx; + height: 30rpx; +} diff --git a/pages/collectioncourse/collectioncourse.js b/pages/collectioncourse/collectioncourse.js new file mode 100644 index 0000000..e32e8a4 --- /dev/null +++ b/pages/collectioncourse/collectioncourse.js @@ -0,0 +1,152 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + listdata:[], + baseurl: baseUrl.globalData.baseimgurl, + liveclickopen: 2, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + baseUrl.islogin(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getcollectioncourse(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + liveopen(e) { + let arr = []; + console.log('---------'); + console.log(this.data.listdata); + arr = Array.from(this.data.listdata); + // arr = this.data.listdata; + // console.log(e.currentTarget.dataset.itemid); + console.log(arr); + arr.forEach(function(item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = 1; + arr[index] = item; + } else { + item['liveclickopen'] = 2; + arr[index] = item + } + }); + console.log(arr); + this.setData({ + listdata: arr + }) + }, + liveclose(e) { + + let arr = []; + arr = Array.from(this.data.listdata); + console.log(e.currentTarget.dataset.itemid); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = 2; + arr[index] = item; + } else { + item['liveclickopen'] = 2; + arr[index] = item + } + }); + console.log(arr); + this.setData({ + listdata: arr + }) + }, + communityclick:function(e){ + + console.log(e.currentTarget.id); + wx.navigateTo({ + url: '/pages/courselearning/courselearning?id='+e.currentTarget.id, + }) + }, + collectioncourseclick:function(params) { + wx.navigateTo({ + url: '/pages/collectionsub/collectionsub', + }) + }, + getcollectioncourse:function () { + const that = this; + let url = baseUrl.globalData.baseUrl + '/course/mycollectcourse'; + var param = { + user_id: wx.getStorageSync('wxuserid')==null?3:wx.getStorageSync('wxuserid'), + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + that.setData({ + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + itemclickurl:function(e){ + console.log(e); + // return; + let typeid=e.currentTarget.dataset.typeid; + wx.navigateTo({ + url: '/pages/courselearning/courselearning?id=' + e.currentTarget.id+'&typeid='+typeid, + }) + } + +}) \ No newline at end of file diff --git a/pages/collectioncourse/collectioncourse.json b/pages/collectioncourse/collectioncourse.json new file mode 100644 index 0000000..40a6faa --- /dev/null +++ b/pages/collectioncourse/collectioncourse.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "收藏课程" +} \ No newline at end of file diff --git a/pages/collectioncourse/collectioncourse.wxml b/pages/collectioncourse/collectioncourse.wxml new file mode 100644 index 0000000..33673fa --- /dev/null +++ b/pages/collectioncourse/collectioncourse.wxml @@ -0,0 +1,36 @@ + + + + + + + + + + + + {{itemwlmcchina.gname}} + + + {{itemwlmcchina.num}} + + + + + + + + + + {{item.headpicvalue}} + + + {{item.name}} + + + + + + + + \ No newline at end of file diff --git a/pages/collectioncourse/collectioncourse.wxss b/pages/collectioncourse/collectioncourse.wxss new file mode 100644 index 0000000..71f7c7b --- /dev/null +++ b/pages/collectioncourse/collectioncourse.wxss @@ -0,0 +1,126 @@ +.itemlist { + /* background: url('https://ndnd.duiduiedu.com/uploads/pics/kecheng001.png') no-repeat; */ + width: 750rpx; + height: 50rpx; + line-height: 50rpx; + background-size: cover; + display: flex; + flex-direction: row-reverse; + margin-top: 50rpx; +} + +.itemlist image { + + width: 750rpx; + height: 50rpx; +} + +.collectionitems { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 35rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistred.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.collectionitems2 { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 35rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistblue.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.item1 { + width: 33%; +} + +.item1 text { + width: 40%; + margin-left: 65rpx; + color: black; + font-size: 30rpx; +} + +.item2 { + width: 40%; + text-align: right; +} + +.item2 text { + color: black; + font-size: 30rpx; +} + +.item3 { + width: 20%; + text-align: center; +} + +.item3 image { + width: 28rpx; + height: 16rpx; + margin-right: 50rpx; +} + +.itemsup{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +} + +.itemsup2{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + display: none; +} + +.upitem1{ + + + width: 100rpx; + height: 45rpx; + margin-left: 30rpx; +} + +.upitem1 text{ + margin-left: 40rpx; + font-size: 28rpx; +} +.upitem2{ + width: 70%; +} +.upitem2 text{ + margin-left: 32rpx; + font-size: 28rpx; +} +.upitem3{ + margin-right: 37rpx; +} +.upitem3 image{ + width: 12rpx; + height: 26rpx; +} \ No newline at end of file diff --git a/pages/collectionsub/collectionsub.js b/pages/collectionsub/collectionsub.js new file mode 100644 index 0000000..78950f3 --- /dev/null +++ b/pages/collectionsub/collectionsub.js @@ -0,0 +1,152 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + listdata:[], + baseurl: baseUrl.globalData.baseimgurl, + liveclickopen: 2, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + baseUrl.islogin(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getcollectioncourse(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + liveopen(e) { + let arr = []; + console.log('---------'); + console.log(this.data.listdata); + arr = Array.from(this.data.listdata); + // arr = this.data.listdata; + // console.log(e.currentTarget.dataset.itemid); + console.log(arr); + arr.forEach(function(item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = 1; + arr[index] = item; + } else { + item['liveclickopen'] = 2; + arr[index] = item + } + }); + console.log(arr); + this.setData({ + listdata: arr + }) + }, + liveclose(e) { + + let arr = []; + arr = Array.from(this.data.listdata); + console.log(e.currentTarget.dataset.itemid); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = 2; + arr[index] = item; + } else { + item['liveclickopen'] = 2; + arr[index] = item + } + }); + console.log(arr); + this.setData({ + listdata: arr + }) + }, + communityclick:function(e){ + + console.log(e.currentTarget.id); + wx.navigateTo({ + url: '/pages/courselearning/courselearning?id='+e.currentTarget.id, + }) + }, + collectioncourseclick:function(params) { + wx.navigateTo({ + url: '/pages/collectioncourse/collectioncourse', + }) + }, + getcollectioncourse:function () { + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/mycollectexam'; + var param = { + user_id: wx.getStorageSync('wxuserid')==null?3:wx.getStorageSync('wxuserid'), + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + that.setData({ + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + itemclickurl:function(e){ + console.log(e); + // return; + let typeid=e.currentTarget.dataset.typeid; + wx.navigateTo({ + url: '/pages/explainnote/explainnote?id=' + e.currentTarget.id+'&typeid='+typeid, + }) + } + +}) \ No newline at end of file diff --git a/pages/collectionsub/collectionsub.json b/pages/collectionsub/collectionsub.json new file mode 100644 index 0000000..40a6faa --- /dev/null +++ b/pages/collectionsub/collectionsub.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "收藏课程" +} \ No newline at end of file diff --git a/pages/collectionsub/collectionsub.wxml b/pages/collectionsub/collectionsub.wxml new file mode 100644 index 0000000..234867d --- /dev/null +++ b/pages/collectionsub/collectionsub.wxml @@ -0,0 +1,35 @@ + + + + + + + + + + + {{itemwlmcchina.gname}} + + + {{itemwlmcchina.num}} + + + + + + + + + + {{item.headpicvalue}} + + + {{item.name}} + + + + + + + + \ No newline at end of file diff --git a/pages/collectionsub/collectionsub.wxss b/pages/collectionsub/collectionsub.wxss new file mode 100644 index 0000000..71f7c7b --- /dev/null +++ b/pages/collectionsub/collectionsub.wxss @@ -0,0 +1,126 @@ +.itemlist { + /* background: url('https://ndnd.duiduiedu.com/uploads/pics/kecheng001.png') no-repeat; */ + width: 750rpx; + height: 50rpx; + line-height: 50rpx; + background-size: cover; + display: flex; + flex-direction: row-reverse; + margin-top: 50rpx; +} + +.itemlist image { + + width: 750rpx; + height: 50rpx; +} + +.collectionitems { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 35rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistred.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.collectionitems2 { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 35rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistblue.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.item1 { + width: 33%; +} + +.item1 text { + width: 40%; + margin-left: 65rpx; + color: black; + font-size: 30rpx; +} + +.item2 { + width: 40%; + text-align: right; +} + +.item2 text { + color: black; + font-size: 30rpx; +} + +.item3 { + width: 20%; + text-align: center; +} + +.item3 image { + width: 28rpx; + height: 16rpx; + margin-right: 50rpx; +} + +.itemsup{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +} + +.itemsup2{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + display: none; +} + +.upitem1{ + + + width: 100rpx; + height: 45rpx; + margin-left: 30rpx; +} + +.upitem1 text{ + margin-left: 40rpx; + font-size: 28rpx; +} +.upitem2{ + width: 70%; +} +.upitem2 text{ + margin-left: 32rpx; + font-size: 28rpx; +} +.upitem3{ + margin-right: 37rpx; +} +.upitem3 image{ + width: 12rpx; + height: 26rpx; +} \ No newline at end of file diff --git a/pages/communityinfo/communityinfo.js b/pages/communityinfo/communityinfo.js new file mode 100644 index 0000000..df4aeec --- /dev/null +++ b/pages/communityinfo/communityinfo.js @@ -0,0 +1,627 @@ +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + id: 0, + title: '动态修改', + imagecount: 4, + indeximagecount: 4, + baseurl: Apps.globalData.baseimgurl, + indexlist: [], + replylist: [], + wordsid: 0, + wordstextname: '', + title: '', + content: '', + images: '', + upload_picture_list: [], + imagesListp: [], + imagestr: [], + accesstoken: '', + scrollTop: 0, + ispic: 0, + jztype:1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // console.log(options); + this.setData({ + id: options.id, + jztype:options.jztype + }); + if(options.jztype==2){ + this.pageScrollToBottom(); + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.getwordsinfo(this.data.id); + this.getwordsreply(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + deleteword:function(par){ + //删除留言 + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/deleteword'; + var param = { + wordid: par + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + this.getwordsinfo(that.data.id); + this.getwordsreply(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + deletewordreply:function(par){ + //删除留言 + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/deletewordreply'; + var param = { + wordid: par + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + this.getwordsinfo(that.data.id); + this.getwordsreply(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwordsinfo: function (e) { + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/getsinglewords'; + var param = { + id: e, + user_id:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + that.setData({ + indexlist: res.data, + wordsid: res.data.id + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsclick: function (ee) { + + let e1 = ee.currentTarget.id; + let e2 = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/wordsclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + this.getwordsinfo(this.data.id); + this.getwordsreply(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwordsreply: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/wordsreply'; + var param = { + wordsid: that.data.id, + user_id:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + that.setData({ + replylist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + + // that.getpicchekc(that.data.imagesListp[i]); + + // if (that.data.ispic == 1) { + + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/indexclasslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + // } + } + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + isjumpblack:function(){ + console.log(wx.getStorageSync('userisblack')); + if(wx.getStorageSync('userisblack')>=2){ + + wx.showToast({ + title: "您已被禁言,请联系管理员",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + formSubmit: function (e) { + + Apps.islogin(); + this.getacctoken(); + + if(wx.getStorageSync('userisblack')>=2){ + this.isjumpblack(); + return; + } + + this.setData({ + wordstextname:e.detail.value.wordsname + }) + // let content = this.data.wordstextname; + let content=e.detail.value.wordsname; + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + + this.getmsgcheck(content, this.data.accesstoken); + // this.pageScrollToBottom(); + + }, + bindTextAreaBlur: function (e) { + this.setData({ + wordstextname: e.detail.value + }) + }, + uploadpicsimage: function (e) { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/uploadpics'; + var param = { + url: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/wordsadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordsid: that.data.id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + that.getwordsinfo(that.data.id); + that.getwordsreply(); + that.setData({ + wordstextname: '', + imagestr:[] + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + contentclick: function (params) { + + let id = params.currentTarget.id; + let xid = params.currentTarget.dataset.xid; + this.setData({ + wordstextname: '@' + id + }); + this.addinccomment(xid) + wx.showToast({ + title: '@成功,请移底部留言',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'success', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + + this.pageScrollToBottom(); + + }, + deletebtnclick: function (params) { + + //删除主贴,看是否是自己的 + console.log(params); + // Toast('删除成功'); + const that = this; + wx.showModal({ + title: '删除提示', + content: '您将删除该留言信息', + cancelText: '退出', + confirmText: '确认', + success: function (res) { + if (res.cancel) { + //这个跳转是左边按钮的跳转链接 + //这里取消操作 + console.log(res); + + } else { + let wordid=params.currentTarget.id; + that.deleteword(wordid); + } + } + }) + + + + }, + deletebtnclickly:function(params){ + //删除回复贴,看是否是自己的 + console.log(params); + // let wordid=params.currentTarget.id; + // this.deletewordreply(wordid); + // Toast('删除成功'); + + const that = this; + wx.showModal({ + title: '删除提示', + content: '您将删除该留言信息', + cancelText: '退出', + confirmText: '确认', + success: function (res) { + if (res.cancel) { + //这个跳转是左边按钮的跳转链接 + //这里取消操作 + console.log(res); + + } else { + let wordid=params.currentTarget.id; + that.deletewordreply(wordid); + } + } + }) + + }, + addinccomment: function (params) { + //增加评论数 + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/addcommentrepycount'; + var param = { + id: params, + userid: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + // 删除图片 + removeChooseImage(e) { + let imgs = this.data.imagestr; + let { index } = e.currentTarget.dataset; + imgs.splice(index, 1); + this.setData({ + imagestr: imgs + }) + }, + // 预览图片 + previewBigImage(e) { + let that = this; + let imgs = that.data.imagestr; + let index = e.currentTarget.dataset.index; + let arr = []; + imgs.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + //当前显示图片 + current: arr[index], + //所有图片 + urls: arr + }) + }, + preview: function (params) { + let that = this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let rearr = that.data.replylist[arrindex].pics; + console.log(rearr); + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + preview2: function (params) { + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let rearr = that.data.indexlist[arrindex].pics; + console.log(rearr); + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, communityinfoclick: function (e) { + //社区留言信息 + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + }) + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + wx.setStorageSync('accesstoen', res.access_token); + that.setData({ + accesstoken: res.access_token + }); + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getmsgcheck: function (params, accesstoken) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + // let url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": accesstoken //that.data.accesstoken + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(params, that.data.imagestr); + + that.wordsadd(params, that.data.imagestr); + + // if (res.errcode == "0") { + // that.wordsadd(params, that.data.imagestr); + // }else { + + // wx.showToast({ + // title: '留言内容有敏感词请重新输入',//提示文字 + // duration: 2000,//显示时长 + // mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + // icon: 'none', //图标,支持"success"、"loading" + // success: function () { },//接口调用成功 + // fail: function () { }, //接口调用失败的回调函数 + // complete: function () { } //接口调用结束的回调函数 + // }) + // } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getpicchekc: function (params) { + // let url="https://api.weixin.qq.com/wxa/media_check_async?access_token="+wx.getStorageSync('accesstoen'); + + let url = Apps.globalData.baseUrl + '/user/checkpic' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "media_url": params, + "media_type": 2, + "version": 2, + "access_token": wx.getStorageSync('accesstoen') + }; + + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log("res==========="); + console.log(res); + this.setData({ + ispic: 1 + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + pageScrollToBottom() { + wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + // rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height + console.log(rect.bottom * 15) + console.log(rect.bottom) + // 使页面滚动到底部 + wx.pageScrollTo({ + scrollTop: rect.bottom * 15 + }) + }).exec() + }, + +}) \ No newline at end of file diff --git a/pages/communityinfo/communityinfo.json b/pages/communityinfo/communityinfo.json new file mode 100644 index 0000000..88569bd --- /dev/null +++ b/pages/communityinfo/communityinfo.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/communityinfo/communityinfo.wxml b/pages/communityinfo/communityinfo.wxml new file mode 100644 index 0000000..2a1ffe3 --- /dev/null +++ b/pages/communityinfo/communityinfo.wxml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/pages/communityinfo/communityinfo.wxss b/pages/communityinfo/communityinfo.wxss new file mode 100644 index 0000000..99d4720 --- /dev/null +++ b/pages/communityinfo/communityinfo.wxss @@ -0,0 +1,241 @@ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 485rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + /* font-weight: 400rpx; */ +} + +.headrightdown { + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} +.mssagemiddledown2 { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.messageend { + + margin: 32rpx 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 25rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} +.messageendmiddle text{ + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright{ + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text{ + + font-size: 28rpx; + padding-left: 23rpx; +} +.feigexian{ + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} +.areaclass{ + + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} +.areaclass textarea{ + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} +.areafooterleft image{ + + width: 52rpx; + height: 52rpx; + +} +.areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} +.areafooterright{ + width: 120rpx; + height: 56rpx; +} +.areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; +} +button::after { + border: none; +} +.vipimage image{ + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; +} + + +.choose_upload_view { + margin-top: 30rpx; + margin-left: 10%; + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-start; + flex-wrap: wrap; + } + .choose_upload_item { + margin-left: 38rpx; + margin-bottom: 20rpx; + position: relative; + width: 100rpx; + display: flex; + align-items: center; + } + .choose_upload_view .choose_upload_img { + width: 100rpx; + height: 100rpx; + } + .choose_upload_view .remove_img_icon { + padding: 4rpx; + position:absolute; + top: -15rpx; + right: -13rpx; + width: 28rpx; + height: 28rpx; + border-radius: 50%; + background-color: rgba(248, 236, 236, 0.5); + } + .other_upload { + margin-left: 15rpx; + width: 80rpx; + } \ No newline at end of file diff --git a/pages/communityinfocomment/communityinfocomment.js b/pages/communityinfocomment/communityinfocomment.js new file mode 100644 index 0000000..a6a68d2 --- /dev/null +++ b/pages/communityinfocomment/communityinfocomment.js @@ -0,0 +1,500 @@ +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + id:0, + imagecount:4, + indeximagecount:4, + baseurl: Apps.globalData.baseimgurl, + indexlist:[], + replylist:[], + wordsid:0, + wordstextname:'', + title: '', + content: '', + images: '' , + upload_picture_list: [], + imagesListp:[], + imagestr:[], + accesstoken:'', + scrollTop: 0, + ispic:0, + xid:0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + this.setData({ + id:options.id + }); + wx.setNavigationBarTitle({ + title: this.data.title, + }) + + this.getacctoken(); + // this.pageScrollToBottom(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.getwordsinfo(this.data.id); + this.getwordsreply(); + + this.pageScrollToBottom(); + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getwordsinfo:function(e){ + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/getsinglewords'; + var param = { + id: e, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + console.log("================"); + that.setData({ + indexlist: res.data, + wordsid:res.data.id + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsclick:function(ee){ + + console.log(ee); + console.log(Apps.globalData.currentuserinfo); + let e1=ee.currentTarget.id; + let e2=wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordsclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + + this.getwordsinfo(this.data.id); + this.getwordsreply(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwordsreply:function(){ + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordsreply'; + var param = { + wordsid: that.data.id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist:res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic:function(){ + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr=[]; + var arr=''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + + that.getpicchekc(that.data.imagesListp[i]); + + if(that.data.ispic==1){ + + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success:function(res){ + //打印 + console.log("------------响应数据:"); + console.log(res.data); + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr:that.data.imagestr + }); + }, + }) + } + } + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + formSubmit:function(e) { + + Apps.islogin(); + + if(wx.getStorageSync('wxuserid')==''){ + wx.navigateTo({ + url: '/pages/userlogin/userlogin', + }) + } + + let content = this.data.wordstextname; + + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + + // this.wordsadd(content,this.data.imagestr); + + this.getmsgcheck(content,this.data.accesstoken); + this.pageScrollToBottom(); + }, + bindTextAreaBlur: function(e) { + this.setData({ + wordstextname:e.detail.value + }) + }, + uploadpicsimage:function(e){ + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/uploadpics'; + var param = { + url: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsadd:function(content,imagestr){ + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordsadd'; + var param = { + content: content, + imagestr:imagestr, + userid:wx.getStorageSync('wxuserid')==''?3:wx.getStorageSync('wxuserid'), + wordsid:that.data.id, + xid:that.data.xid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if(res.data>0){ + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + that.getwordsinfo(that.data.id); + that.getwordsreply(); + that.setData({ + wordstextname:'' + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + },contentclick:function(params) { + + let id=params.currentTarget.id; + let xid=params.currentTarget.dataset.xid; + this.setData({ + wordstextname:'@'+id, + xid:xid + }); + this.getacctoken(); + // this.addinccomment(xid) + wx.showToast({ + title: '@成功,请移底部留言',//提示文字 + duration:2000,//显示时长 + mask:true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon:'success', //图标,支持"success"、"loading" + success:function(){ },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + + this.pageScrollToBottom(); + + },rdclick:function(params) { + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id='+params.currentTarget.id, + }) + },addinccomment:function(params) { + //增加评论数 + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/addcommentrepycount'; + var param = { + id:params, + userid:userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + preview:function (params) { + let that=this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex=params.currentTarget.dataset.id; + console.log(arrindex); + let rearr=that.data.replylist[arrindex].pics; + console.log(rearr); + let arr=[]; + rearr.forEach(function (item,index) { + arr[index]=that.data.baseurl+item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + preview2:function (params) { + let that=this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex=params.currentTarget.dataset.id; + let rearr=that.data.indexlist[arrindex].pics; + console.log(rearr); + let arr=[]; + rearr.forEach(function (item,index) { + arr[index]=that.data.baseurl+item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + },communityinfoclick:function(e){ + //社区留言信息 + console.log(e.currentTarget.id); + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id='+e.currentTarget.id, + }) + }, + getacctoken:function() { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getmsgcheck:function (params,accesstoken) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + // let url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='+wx.getStorageSync('accesstoen'); + let url=Apps.globalData.baseUrl+'/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content":params, + "access_token":that.data.accesstoken + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + if(res.errcode=="0"){ + that.wordsadd(params,that.data.imagestr) + }else{ + + wx.showToast({ + title: '留言内容有敏感词请重新输入',//提示文字 + duration:2000,//显示时长 + mask:true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon:'none', //图标,支持"success"、"loading" + success:function(){ },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getpicchekc:function(params) { + + let url=Apps.globalData.baseUrl+'/user/checkpic' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "media_url":params, + "media_type":2, + "version":2, + "access_token":wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + this.setData({ + ispic:1 + }) + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + pageScrollToBottom() { + wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + // rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height + console.log(rect.bottom*15) + console.log(rect.bottom) + // 使页面滚动到底部 + wx.pageScrollTo({ + scrollTop: rect.bottom*15 + }) + }).exec() + }, + +}) \ No newline at end of file diff --git a/pages/communityinfocomment/communityinfocomment.json b/pages/communityinfocomment/communityinfocomment.json new file mode 100644 index 0000000..88569bd --- /dev/null +++ b/pages/communityinfocomment/communityinfocomment.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/communityinfocomment/communityinfocomment.wxml b/pages/communityinfocomment/communityinfocomment.wxml new file mode 100644 index 0000000..b430a18 --- /dev/null +++ b/pages/communityinfocomment/communityinfocomment.wxml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + +
+ + + + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/pages/communityinfocomment/communityinfocomment.wxss b/pages/communityinfocomment/communityinfocomment.wxss new file mode 100644 index 0000000..7129c7f --- /dev/null +++ b/pages/communityinfocomment/communityinfocomment.wxss @@ -0,0 +1,203 @@ +/* pages/communityinfocomment/communityinfocomment.wxss */.courselive { + width: 750rpx; + height: 403rpx; +} + +.functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 485rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + /* font-weight: 400rpx; */ +} + +.headrightdown { + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} +.mssagemiddledown2 { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} +.messageendmiddle text{ + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright{ + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text{ + + font-size: 28rpx; + padding-left: 23rpx; +} +.feigexian{ + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} +.areaclass{ + + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} +.areaclass textarea{ + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} +.areafooterleft image{ + + width: 52rpx; + height: 52rpx; + +} +.areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} +.areafooterright{ + width: 120rpx; + height: 56rpx; +} +.areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; +} +button::after { + border: none; +} +.vipimage image{ + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; +} \ No newline at end of file diff --git a/pages/communityitemlist/communityitemlist.js b/pages/communityitemlist/communityitemlist.js new file mode 100644 index 0000000..16f4522 --- /dev/null +++ b/pages/communityitemlist/communityitemlist.js @@ -0,0 +1,185 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + pareid: 0, + listdata: [], + liveclickopen: 1, //2 + baseurl: baseUrl.globalData.baseimgurl, + coursename: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + this.setData({ + pareid: options.typeid + }); + + // this.pageScrollToBottom(); + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.getcousrethree(); + this.getcouresename(); + // this.pageScrollToBottom(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + liveopen(e) { + let arr = []; + arr = this.data.listdata; + console.log(e.currentTarget.dataset.itemid); + console.log(this.data.listdata); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = 1; //1 + arr[index] = item; + } else { + item['liveclickopen'] = 1; //2 + arr[index] = item + } + }) + this.setData({ + listdata: arr + }) + }, + liveclose(e) { + + let arr = []; + arr = this.data.listdata; + console.log(e.currentTarget.dataset.itemid); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = 2; + arr[index] = item; + } else { + item['liveclickopen'] = 2; + arr[index] = item + } + }) + this.setData({ + listdata: arr + }) + }, + getcouresename: function () { + + let id = this.data.pareid; + const that = this; + let url = baseUrl.globalData.baseUrl + '/course/getcousretwoname'; + var param = { + id: that.data.pareid, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + coursename: res.data['name'] + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getcousrethree: function () { + const that = this; + let url = baseUrl.globalData.baseUrl + '/course/getcoursethree'; + var param = { + pareid: that.data.pareid, + user_id:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + itemclickurl: function (e) { + console.log(e); + // return; + let typeid = e.currentTarget.dataset.typeid; + wx.navigateTo({ + url: '/pages/courselearning/courselearning?id=' + e.currentTarget.id + '&typeid=' + typeid, + }) + }, + pageScrollToBottom() { + wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + // rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height + console.log(rect.bottom + 2000) + // 使页面滚动到底部 + wx.pageScrollTo({ + scrollTop: rect.bottom + 2000 + }) + }).exec() + }, + + +}) \ No newline at end of file diff --git a/pages/communityitemlist/communityitemlist.json b/pages/communityitemlist/communityitemlist.json new file mode 100644 index 0000000..833f8dd --- /dev/null +++ b/pages/communityitemlist/communityitemlist.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "课程分类" +} \ No newline at end of file diff --git a/pages/communityitemlist/communityitemlist.wxml b/pages/communityitemlist/communityitemlist.wxml new file mode 100644 index 0000000..4771d20 --- /dev/null +++ b/pages/communityitemlist/communityitemlist.wxml @@ -0,0 +1,40 @@ + + + + {{coursename}} + + + + + + + + + {{itemwlmcchina.name}} + + + {{itemwlmcchina.num}} + + + + + + + + + + + {{itemchild.headpicvalue}} + + + {{itemchild.name}} + + + + + + + + + + \ No newline at end of file diff --git a/pages/communityitemlist/communityitemlist.wxss b/pages/communityitemlist/communityitemlist.wxss new file mode 100644 index 0000000..5fd306a --- /dev/null +++ b/pages/communityitemlist/communityitemlist.wxss @@ -0,0 +1,127 @@ +.itemlist { + background: url('https://ndnd.duiduiedu.com/uploads/pics/kecheng001.png') no-repeat; + width: 750rpx; + height: 50rpx; + line-height: 50rpx; + background-size: cover; + display: flex; + flex-direction: row-reverse; + margin-top: 50rpx; +} + +.itemlist text { + + margin-right: 180rpx; + color: white; +} + +.collectionitems { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 10rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistred.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.collectionitems2 { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 10px; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistblue.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.item1 { + width: 60%; +} + +.item1 text { + width: 30%; + margin-left: 65rpx; + color: black; + font-size: 30rpx; +} + +.item2 { + width: 10%; + text-align: right; +} + +.item2 text { + color: black; + font-size: 30rpx; +} + +.item3 { + width: 20%; + text-align: center; +} + +.item3 image { + width: 28rpx; + height: 16rpx; + margin-right: 50rpx; +} + +.itemsup{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + border-bottom: 1rpx solid #fff; +} + +.itemsup2{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + display: none; +} + +.upitem1{ + + width: 107rpx; + height: 45rpx; + margin-left: 30rpx; +} + +.upitem1 text{ + + margin-left: 40rpx; + font-size: 28rpx; +} +.upitem2{ + width: 70%; +} +.upitem2 text{ + margin-left: 32rpx; + font-size: 28rpx; +} +.upitem3{ + margin-right: 37rpx; +} +.upitem3 image{ + width: 24rpx; + height: 26rpx; +} \ No newline at end of file diff --git a/pages/communitylist/communitylist.js b/pages/communitylist/communitylist.js new file mode 100644 index 0000000..b6195d9 --- /dev/null +++ b/pages/communitylist/communitylist.js @@ -0,0 +1,558 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [], //图片预览 + showview: false, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 1, + accesstoken: '', + typeid: wx.getStorageSync('jmparm') == null ? 1 : wx.getStorageSync('jmparm'), + page: 1, //页面数, + pagecount: 0 + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + + if (options.length > 0) { + this.setData({ + active: options.id == '' ? 1 : options.id, + page: 1, + typeid: wx.getStorageSync('jmparm') + }) + } + + }, + displayview: function () { + wx.navigateTo({ + url: '/pages/createwords/createwords?typeid=' + this.data.typeid, + }) + + }, contentclick: function (params) { + + let id = params.currentTarget.id; + let xid = params.currentTarget.dataset.xid; + + this.setData({ + wordstextname: '@' + id + }); + + this.addinccomment(xid) + wx.showToast({ + title: '@成功,请移底部留言',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'success', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + + // this.pageScrollToBottom(); + + }, addinccomment: function (params) { + //增加评论数 + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/addcommentrepycount'; + var param = { + id: params, + userid: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + // pageScrollToBottom() { + // wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + // // rect.id // 节点的ID + // rect.dataset // 节点的dataset + // rect.left // 节点的左边界坐标 + // rect.right // 节点的右边界坐标 + // rect.top // 节点的上边界坐标 + // rect.bottom // 节点的下边界坐标 + // rect.width // 节点的宽度 + // rect.height + // console.log(rect.bottom*15) + // console.log(rect.bottom) + // // 使页面滚动到底部 + // wx.pageScrollTo({ + // scrollTop: rect.bottom*15 + // }) + // }).exec() + // }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + Apps.islogin(); + this.setData({ + active: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm'), + typeid: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm') + }) + //头部消息 + this.msglist(); + //留言类型 + this.wrodtypelist(); + //回复留言列表 + this.getwords(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + + wx.setStorageSync('jmparm', e.currentTarget.id); + this.setData({ + active: e.currentTarget.id, + typeid: e.currentTarget.id + }) + this.getwords(); + }, + duizhiticlick: function () { + wx.navigateTo({ + url: '/pages/allpapers/allpapers', + }) + }, + messagelistclick: function () { + wx.navigateTo({ + url: '/pages/messagelist/messagelist', + }) + }, + communityinfoclick: function (e) { + + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + }) + }, + communityinfocommentclick: function (e) { + + wx.navigateTo({ + //communityinfocomment + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id + '&jztype=2', + }) + }, + messagelistclick: function (e) { + //资讯列表分类 + wx.navigateTo({ + url: '/pages/messagelist/messagelist?typeid=' + e.currentTarget.id, + }) + }, + messageclick: function (e) { + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=' + e.currentTarget.id, + }) + }, + msglist: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/msglist/msgindexlist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + messagelist: res.data.sort() + + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wrodtypelist: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/getwordslist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + that.setData({ + list: res.data, + active: this.data.active + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwordspics: function (id) { + //得到单个信息图片数 + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/getwordssingle'; + var param = { + id: id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + console.log(res.data.pics); + that.setData({ + imageslists: res.data.pics, + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwords: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/getwords'; + var param = { + typeid: that.data.typeid, + page: that.data.page + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + let counts = res.data.length; + that.setData({ + replylist: res.data, + pagecount: counts == 0 ? 1 : counts + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsclick: function (ee) { + + let e1 = ee.currentTarget.id; + let e2 = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordsclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + //头部消息 + that.msglist(); + //留言类型 + that.wrodtypelist(); + that.getwords(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + bindTextAreaBlur: function (e) { + this.setData({ + wordstextname: e.detail.value + }) + }, + preview: function (params) { + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let picsid = params.currentTarget.dataset.pics; //单条信息ID + + // that.getwordspics(picsid); //得到单条信息图片 + console.log(that.data.replylist[picsid]); + let rearr = that.data.replylist[picsid].pics; + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + console.log('-----'); + console.log(arr); + + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + getmsgcheck: function (params, accesstoken) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + // let url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + console.log(res.errcode); + if (res.errcode == "0") { + that.wordsadd(params, that.data.imagestr) + } else { + + wx.showToast({ + title: '留言内容有敏感词请重新输入',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + } + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordsxqadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordstype_ids: this.data.typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + this.getwords(); + + that.setData({ + wordstextname: '' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + formSubmit: function (e) { + + this.getacctoken(); + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + this.getmsgcheck(content, this.data.accesstoken); + }, + // 触底加载 + onReachBottom: function () { + + this.setData({ + page: this.data.page + 1 + }) + let newpage = (this.data.page + 1); //页数触底加1 + console.log(newpage); + if (newpage * 10 >= this.data.pagecount) { + + wx.showToast({ + title: '触底了,没有可加载的数据了', + icon: 'none', + duration: 1500 + }) + + } else { + this.getwords(); + } + + } +}) \ No newline at end of file diff --git a/pages/communitylist/communitylist.json b/pages/communitylist/communitylist.json new file mode 100644 index 0000000..28c2c6a --- /dev/null +++ b/pages/communitylist/communitylist.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh":true, + "navigationBarTitleText": "怼社区" +} \ No newline at end of file diff --git a/pages/communitylist/communitylist.wxml b/pages/communitylist/communitylist.wxml new file mode 100644 index 0000000..103c441 --- /dev/null +++ b/pages/communitylist/communitylist.wxml @@ -0,0 +1,117 @@ + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + {{item.plcommentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + +
\ No newline at end of file diff --git a/pages/communitylist/communitylist.wxss b/pages/communitylist/communitylist.wxss new file mode 100644 index 0000000..788b491 --- /dev/null +++ b/pages/communitylist/communitylist.wxss @@ -0,0 +1,407 @@ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + font-weight: 400rpx; +} + +.headrightdown { + font-size: 30rpx; + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.mssagemiddledownone image { + width: 100%; + } + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.areaclass { + + width: 540rpx; + height: 193rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 26rpx; + height: 26rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.vipimage image { + width: 37rpx; + height: 33rpx; + position: relative; + left: -32rpx; + top: 148rpx; +} + +/* 社区头部 */ +.communityhead { + width: 680rpx; + height: 210rpx; + margin: 0 auto; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +} + +.communityheadleft { + background: url('https://ndnd.duiduiedu.com/uploads/pics/communtlistheadleft.png') no-repeat; + width: 385rpx; + height: 206rpx; + background-size: 100% 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.communityheadright { + width: 232rpx; + height: 206rpx; + margin-left: 40rpx; +} + +.communityheadrightup { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; +} + +.communityheadrightup image { + width: 240rpx; + height: 80rpx; +} + +.communityheadrightdown { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; +} + +.communityheadrightdown image { + width: 240rpx; + height: 80rpx; +} + +.communityheadleftitem1 { + width: 240rpx; + margin-left: 55rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.communityheadleftitem2 { + width: 80rpx; + height: 180rpx; +} + +.communityheadleftitem2 image { + width: 80rpx; + height: 175rpx; +} + +.messageitem { + width: 240rpx; + height: 38rpx; + /* border: 1rpx solid #1ccfd6; */ + color: #1ccfd6; + margin-bottom: 10rpx; + text-align: center; + overflow: hidden; +} + +/* 社区头部 */ + +/* 社区滑动 */ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; +} + +.curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; + margin-right: 10rpx; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.lineclass { + width: 685rpx; + margin: 2rpx auto; + border-bottom: 1rpx solid #dcdcdc; +} + +/* 社区滑动 */ + +/* 补充留言信息右边 */ +.itemright { + width: 200rpx; + margin-top: 50rpx; + margin-left: 30rpx; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.itemright image { + + margin-left: 10rpx; + width: 70rpx; + height: 35rpx; +} + +/* 补充留言信息右边 */ + +.header_view_hide{ + display: none; +} +.header_view_show{ + display: block; +} + +.round-click{ + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; +} +.round-click image{ + height: 61rpx; + line-height: 61rpx; + width: 54rpx; +} + +.areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} +.areaclass textarea{ + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} +.areafooterleft image{ + + width: 52rpx; + height: 52rpx; + +} +.areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} +.areafooterright{ + width: 120rpx; + height: 56rpx; +} +.areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; +} \ No newline at end of file diff --git a/pages/courselearning/courselearning.js b/pages/courselearning/courselearning.js new file mode 100644 index 0000000..3e93f2e --- /dev/null +++ b/pages/courselearning/courselearning.js @@ -0,0 +1,1346 @@ +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + videurl: "https://xyg.jsjbkc.com/pics/xyg1.mp4?v" + Date.now(), + imagecount: 4, + courseid: 1, + itemdata: [], + baseurl: Apps.globalData.baseimgurl, + showview: false, + title: '', + content: '', + images: '', + upload_picture_list: [], + imagesListp: [], + imagestr: [], + imageslists: [], //图片预览 + ismdata: 1, //是否材料型数据跳转 + typeid: 1, + isdisplay: 1, + ispic: 0, + accesstoken: '', + xid: 0, + onefeilei: 0, //课程一级分类 + viptype_id: 1, //VIP类型 + videoContext: {}, // 用于绑定视频标签 + showvide: false, + videtimes: 5, + videtimes2: 10, + cousreshow: false, //检查用户是对课程有权限,对VIP用户onWaiting + headpicvalue: 0,//课程积分 + sliderValue: 0, //控制进度条slider的值, + updateState: false, //防止视频播放过程中导致的拖拽失效 + playStates: false, //控制播放 & 暂停按钮的显示 + fullScreen: false,//是否是全屏 + recommendListArr: [], + chongzhivalue: '怼币购买', + poptitle: '怼币购买后可学习14天', + isfinall: 0, //检测用户的课程是否完成 + video_data: {}, //要播放的视频对象 + show: false, + isvip:false, //是否VIP, + showdiage: false, + pathid:"", + actions: [ + { + name: '1.0倍速', + value: 1 + }, + { + name: '1.25倍速', + value: 1.25 + }, + { + name: '1.5倍速', + value: 1.5 + }, + { + name: '2.0倍速', + value: 2 + }, + ], + }, + showdiagePopup(e) { + console.log(e); + let pathid=e.currentTarget.id; + + let files = pathid; // knowfiles.currentTarget.id; + if(files.length==0){ + + wx.showToast({ + title: '暂时还没有讲义,不可下载',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + }else{ + this.setData({ showdiage: true,pathid:pathid }); + } + + }, + + onshowdiageClose() { + this.setData({ showdiage: false }); + }, + vippopmsg: function () { + //vip课程弹出消息框 + //判断VIP课程还有多少天 + this.vipkechengday(this.data.onefeilei, wx.getStorageSync('wxuserid')); + }, + vipkechengday: function (onefeilei, wxuserid) { + //判断VIP课程还有多少天 + const that = this; + let url = Apps.globalData.baseUrl + '/user/vipscourseuserday'; + var param = { + user_id: wxuserid, + sourceid: onefeilei + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + // 您的VIP会员剩余374天 + Toast('您的VIP会员剩余' + res + '天'); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + popmsg: function () { + //怼币课程弹出消息框 + //判断怼币课程还有多少天 + console.log(this.data.courseid); + console.log(wx.getStorageSync('wxuserid')); + this.duibikechengday(this.data.courseid, wx.getStorageSync('wxuserid')); + // Toast('您的课程还有8天到期,到期后需重新购买'); + }, + popclick: function () { + if (this.data.isdisplay == 1 && this.data.typeid != 1) { + //弹出购买信息 + this.setData({ + showvide: true + }); + this.videoContext.pause(); + + } + + }, + duibikechengday: function (sourceid, wxuserid) { + //判断怼币课程还有多少天 + //检查用户是否可以听课 + const that = this; + let url = Apps.globalData.baseUrl + '/user/setdecuserscoreday'; + var param = { + user_id: wxuserid, + sourceid: sourceid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + Toast('您的课程还有' + res + '天到期,到期后需重新购买'); + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + bsbtnclick: function () { + let bsdata = !this.data.show; + console.log(bsdata); + this.setData({ + show: bsdata + }) + }, + onClose: function () { + this.setData({ show: false }); + }, + onSelect: function (event) { + console.log(event.detail); + console.log(event.detail.value); + let rate = event.detail.value; + this.videoContext.playbackRate(Number(rate)); + this.onClose(); + }, + bindButtonRate: function (e) { + let rate = e.detail; + console.log(rate); + this.videoContext.playbackRate(Number(rate)); + }, + fullvideo: function (params) { + console.log(params); + // 全屏 + this.videoContext = wx.createVideoContext('myVideo'); + this.videoContext.requestFullScreen({ + direction: 1 + }); + }, + bindfullscreenchange: function (e) { + // let fullScreen = e.detail.fullScreen //值true为进入全屏,false为退出全屏 + // let videoContext = wx.createVideoContext('myVideo') + if (!e.detail.fullScreen) { + // 退出全屏 + this.videoContext.exitFullScreen() + } + else { + // 全屏 + this.videoContext = wx.createVideoContext('myVideo'); + this.videoContext.requestFullScreen({ + direction: -90 + }); + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + Apps.islogin(); + console.log(options); + if (options.typeid == 3) { + this.setData({ + chongzhivalue: '充值VIP', + poptitle: 'VIP期限内可无限畅学' + }) + } + this.setData({ + courseid: options.id, + typeid: options.typeid, + updateState: true + }); + + }, + buyclick(event) { + console.log(event.detail); + console.log("===========") + //购买是跳转,还是在这里需要判断购买 + console.log(this.data.viptype_id); + if (this.data.viptype_id == 2) { + //实现怼币购买 + this.kqcheckdescusersorce(wx.getStorageSync('wxuserid'), this.data.cousrceid, this.data.headpicvalue); + } else if (this.data.viptype_id == 3) { + //跳转购买课程页面 + wx.navigateTo({ + url: '/pages/viprecharge/viprecharge', + }) + } + }, + cancleclick() { + this.setData({ showvide: false }); + }, + videoUpdate(e) { + if (this.data.updateState) { + //判断拖拽完成后才触发更新,避免拖拽失效 + const times = e.detail.currentTime.toFixed(0); + let sliderValue = e.detail.currentTime / e.detail.duration * 100; + // console.log(sliderValue); + this.setData({ + sliderValue: sliderValue, + duration: e.detail.duration + }) + // console.log('sliderValue=>' + times); + // console.log('11试看=>' + times); + this.publicdata(times); + + } + }, + publicdata: function (times) { + + //公共数据 + + //对2,3类型课程需要监控,一判断是否已用怼币购买过,二是判断是否为VIP用户 + if (this.data.viptype_id != 1) { + + //购买用户,怼币购买用户 + //1免费,2怼币,3VIP,4优惠值 + //先检查是否有怼币 + //增加一个两个小时的时长 + // console.log('先检查是否有怼币'); + // console.log(that.data.isdisplay); + if (this.data.isdisplay == 1) { + + if (this.data.cousreshow == false) { + + if (times >= this.data.videtimes) { + this.setData({ + showvide: true, + playStates: false, + sliderValue: times + }); + this.videoContext.pause(); + } + } + } + + } + }, + sliderChanging(e) { + + const times = e.detail.value.toFixed(0); + this.setData({ + updateState: false //拖拽过程中,不允许更新进度条 + }) + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.publicdata(times); + } else { + this.videoContext.play(); + } + }, + sliderChange(e) { + + const times = e.detail.value.toFixed(0); + this.setData({ + sliderValue: e.detail.value, + updateState: false //完成拖动后允许更新滚动条 + }) + + if (this.data.duration) { + this.videoContext.seek(e.detail.value / 100 * this.data.duration); //完成拖动后,计算对应时间并跳转到指定位置 + this.setData({ + sliderValue: e.detail.value.toFixed(0), + updateState: true //完成拖动后允许更新滚动条 + }) + } + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.setData({ + showvide: true, + duration: e.detail.duration, + playStates: false, + sliderValue: times + }); + this.publicdata(times); + + } else { + this.videoContext.play(); + } + + + }, + videoOpreation() { + + const playstats = !this.data.playStates; + this.setData({ + playStates: playstats, + }); + this.data.playStates ? this.videoContext.pause() : this.videoContext.play(); + const times = this.data.sliderValue; + console.log(times); + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.publicdata(times); + } + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + this.videoContext = wx.createVideoContext('myVideo'); + this.setData({ + updateState: true + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.isdisplay(); + this.getcoursedata(this.data.courseid); + this.wrodtypelist(this.data.courseid); + this.isjumpurl(this.data.typeid, 1); + this.isfinallfun(this.data.courseid, wx.getStorageSync('wxuserid'), 2); //2不删除 + + }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + messageclick: function (e) { + + wx.reLaunch({ + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + }) + }, + deletewordreply: function (par) { + + //删除留言 + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/deletewordreply'; + var param = { + wordid: par + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + this.wrodtypelist(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getcoursedata: function (params) { + const that = this; + let url = Apps.globalData.baseUrl + '/course/getcousrefourlist'; + var param = { + id: params, + user_id: wx.getStorageSync('wxuserid') == '' ? 0 : wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log('res===================='); + console.log(res); + let cousrceid = res.data.id; + let headpicvalue = res.data.headpicvalue; + console.log(res.data.onefeilei); + that.setData({ + itemdata: res.data, //课程数据 + onefeilei: res.data.onefeilei, //课程一级分类 + viptype_id: res.data.viptype_id,//课程类型 + headpicvalue: headpicvalue, //课程积分 + cousrceid: cousrceid, //课程ID + videtimes: res.data.bz, //视听时长 + videurl:res.data.vodurl + }); + + if (that.data.isdisplay == 1) { + + + // if (res.data.viptype_id == 3 || res.data.viptype_id == 2) { + //检查用户是否有课程权限 + // that.checkusercousre(res.data.onefeilei); + // } + console.log(res.data.viptype_id); + if(res.data.viptype_id == 1){ + // console.log(res.data.viptype_i) + // that.setData({ + // cousreshow:true, + // isvip:true + // }) + }else{ + + // that.checkusercousre(res.data.onefeilei); + } + that.checkusercousre(res.data.onefeilei); + // if (that.data.cousreshow == false) { + // //如果怼币课程看否,购买 + // that.checkuserscource(wx.getStorageSync('wxuserid'), cousrceid, headpicvalue); + // } + + // if (res.data.viptype_id == 2) { + // //如果怼币课程看否,购买 + // that.checkuserscource(wx.getStorageSync('wxuserid'), cousrceid, headpicvalue); + // } + // if (res.data.viptype_id == 3 || res.data.viptype_id == 2) { + // //检查用户是否有课程权限 + // that.checkusercousre(res.data.onefeilei, cousrceid); + // } + } + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + kqcheckdescusersorce: function (user_id, sourceid, headpicvalue) { + //扣除用户怼币 + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkdescuserscore'; + var param = { + user_id: user_id, + sourceid: sourceid, + headpicvalue: headpicvalue + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + + that.setData({ + cousreshow: res.data + }) + + if (res.data == false) { + + + wx.showModal({ + title: '提示', + content: '您的怼币不够,需要' + headpicvalue + '怼币,才能安心学习该课程', + success (res) { + if (res.confirm) { + console.log('确定'); + wx.navigateTo({ + url: '/pages/index/index', + }) + } else if (res.cancel) { + console.log('取消'); + wx.navigateTo({ + url: '/pages/vipquanyi/vipquanyi', + }) + } + } + }) + + // wx.showModal({ + // title: '提示', + // content: '您的怼币不够,需要' + headpicvalue + '怼币,才能安心学习该课程', + // cancelText: '退出', + // confirmText: '去充怼币', + // success: function (res) { + // if (res.cancel) { + // //这个跳转是左边按钮的跳转链接 + // //这里取消操作 + // console.log('确认扣除怼币' + headpicvalue); + // wx.navigateTo({ + // url: '/pages/index/index', + // }) + + // } else { + // //这里是右边按钮的跳转链接 + // wx.navigateTo({ + // url: '/pages/vipquanyi/vipquanyi', + // }) + // } + // } + // }) + }else{ + + Toast('课程购买成功,您花费了' + headpicvalue + '怼币,请安心学习该课程'); + + // wx.showModal({ + // title: '怼币购买成功', + // content: '课程购买成功,您花费了' + headpicvalue + '怼币,请安心学习该课程', + // success (res) { + // if (res.confirm) { + // console.log('确定'); + // wx.navigateTo({ + // url: '/pages/courselearning/courselearning?id=' + that.data.courseid + "&typeid=" + that.data.typeid, + // }) + // } else if (res.cancel) { + // console.log('取消') + // } + // } + // }) + + // wx.showModal({ + // title: '怼币购买成功', + // content: '课程购买成功,您花费了' + headpicvalue + '怼币,请安心学习该课程', + // cancelText: '好的,去学习', + // confirmText: '去充怼币', + // success: function (res) { + + // // wx.navigateTo({ + // // url: '/pages/courselearning/courselearning?id=' + that.data.courseid + "&typeid=" + that.data.typeid, + // // }) + // } + // }).catch((errMsg) => { + // console.log(errMsg); + // }); + + } + }) + }, + checkuserscource: function (user_id, sourceid, headpicvalue) { + //检查用户是否可以听课 + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkuserscource'; + var param = { + user_id: user_id, + sourceid: sourceid, + headpicvalue: headpicvalue + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + that.setData({ + cousreshow: res.data + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + finallclick: function (params) { + + if (this.data.cousreshow == false) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + this.isfinallfun(this.data.courseid, wx.getStorageSync('wxuserid'), 1); + }, + isfinallfun: function (id, userid, typeid) { + //是否完成函数 + const that = this; + let url = Apps.globalData.baseUrl + '/course/finallclick'; + var param = { + id: id, + user_id: userid, + typeid: typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + that.setData({ + isfinall: res + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + downfile: function (knowfiles) { + + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + // let files = knowfiles.currentTarget.id; + let files = this.data.pathid;// knowfiles.currentTarget.id; + + + wx.downloadFile({ + url: this.data.baseurl + files, + success(res) { + + wx.shareFileMessage({ + filePath: res.tempFilePath, + success() {}, + fail: console.error, + }) + + // wx.openDocument({ + // filePath: res.tempFilePath, + // showMenu:true, //关键点 + // success() { + // // wx.showToast({ + // // title: '下载成功',//提示文字 + // // duration: 2000,//显示时长 + // // mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + // // icon: 'success', //图标,支持"success"、"loading" + // // success: function () { },//接口调用成功 + // // fail: function () { }, //接口调用失败的回调函数 + // // complete: function () { } //接口调用结束的回调函数 + // // }) + // } + // }) + } + }) + }, + downfilepoto: function (knowfiles) { + + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + // let files = knowfiles.currentTarget.id; + let files = this.data.pathid + + wx.downloadFile({ + url: this.data.baseurl + files, + success(res) { + wx.openDocument({ + filePath: res.tempFilePath, + showMenu:true, //关键点 + success() { + } + }) + } + }) + }, + collectionclick: function (params) { + + let id = params.currentTarget.id; + console.log(id); + this.collectionclickdata(id, wx.getStorageSync('wxuserid')); + + }, + collectionclickdata: function (collection_id, user_id) { + const that = this; + let url = Apps.globalData.baseUrl + '/course/coursecollection'; + var param = { + id: collection_id, + user_id: user_id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + this.getcoursedata(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + displayview: function () { + console.log(this.data.showview); + this.setData({ + showview: (!this.data.showview) + }) + this.getacctoken(); + this.pageScrollToBottom(); + }, + wrodtypelist: function (params) { + + //获取课程留言 + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscourselist'; + var param = { + id: params, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + delesourceclick: function (par) { + const that = this; + wx.showModal({ + title: '删除提示', + content: '您将删除该留言信息', + cancelText: '退出', + confirmText: '确认', + success: function (res) { + if (res.cancel) { + //这个跳转是左边按钮的跳转链接 + //这里取消操作 + console.log(res); + + } else { + //这里是右边按钮的跳转链接 + let id = par.currentTarget.id; + //删除课程留言数据 + let url = Apps.globalData.baseUrl + '/wordslist/wordscoursedelete'; + var param = { + id: id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.wrodtypelist(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } + } + }) + + }, + wordsclick: function (ee) { + + let e1 = ee.currentTarget.id; + // let e2 = Apps.globalData.currentuserinfo.id; + let e2 =wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscourseclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + + // that.getpicchekc(that.data.imagesListp[i]); + + // if (that.data.ispic == 1) { + + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + } + + // } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + // 删除图片 + removeChooseImage(e) { + let imgs = this.data.imagestr; + let { index } = e.currentTarget.dataset; + imgs.splice(index, 1); + this.setData({ + imagestr: imgs + }) + }, + // 预览图片 + previewBigImage(e) { + let that = this; + let imgs = that.data.imagestr; + let index = e.currentTarget.dataset.index; + let arr = []; + imgs.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + //当前显示图片 + current: arr[index], + //所有图片 + urls: arr + }) + }, + isjumpblack:function(){ + console.log(wx.getStorageSync('userisblack')); + if(wx.getStorageSync('userisblack')>=2){ + + wx.showToast({ + title: "您已被禁言,请联系管理员",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + formSubmit: function (e) { + + Apps.islogin(); + + if(wx.getStorageSync('userisblack')>=2){ + this.isjumpblack(); + return; + } + + let content = this.data.wordstextname; + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + this.getmsgcheck(content); + + }, + bindTextAreaBlur: function (e) { + this.setData({ + wordstextname: e.detail.value + }) + }, + uploadpicsimage: function (e) { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/uploadpics'; + var param = { + url: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscouresadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordsid: that.data.courseid, + xid: that.data.xid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + + that.wrodtypelist(that.data.courseid); + + that.setData({ + wordstextname: '', + imagestr: '' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + contentclick: function (params) { + + console.log(params); + let id = params.currentTarget.id; + let xid = params.currentTarget.dataset.xid; + console.log(id); + this.setData({ + wordstextname: '回复@' + id, + showview: true, + xid: xid + }); + + // this.addinccomment(xid); + + this.getacctoken(); + + wx.showToast({ + title: '@成功,留言请移底部留言', + icon: 'none', + duration: 1500 + }) + this.pageScrollToBottom(); + + }, rdclick: function (params) { + + this.pageScrollToBottom(); + }, addinccomment: function (params) { + //增加评论数 + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/addcommentcount'; + var param = { + id: params, + userid: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(that.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + clickbtn: function (params) { + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscourseclickcount'; + var param = { + words_id: params.currentTarget.id, + user_id: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(this.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + knowledgeclick: function (params) { + //知识要点 + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + let examid = params.currentTarget.id; + if(examid>0){ + wx.navigateTo({ + url: '/pages/knowledge/knowledge?examid=' + examid, + }) + }else{ + Toast('此课程暂无知识要点'); + } + + + }, + examingclick: function (params) { + + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + let examid = params.currentTarget.id; + let ismdata = this.data.ismdata; + let grouppaper_id = this.data.itemdata.grouppaper_id; + if(grouppaper_id>0){ + + + if (ismdata == 2) { + wx.navigateTo({ + url: '/pages/exammakings/exammakings?examid=' + examid + '&grouppaper_id=' + grouppaper_id, + }) + } else { + wx.navigateTo({ + url: '/pages/examing/examing?examid=' + examid + '&grouppaper_id=' + grouppaper_id, + }) + } + }else{ + + Toast('该课程无练习试题'); + } + }, + preview: function (params) { + let that = this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + + let rearr = that.data.replylist[arrindex].pics; + console.log(rearr); + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + isjumpurl: function (id, groupid) { + + const that = this; + let url = Apps.globalData.baseUrl + '/exam/isarrdata'; + var param = { + id: id, + groupid: groupid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + ismdata: res.data + }); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + isdisplay: function (params) { + //是否显示视频 + const that = this; + let url = Apps.globalData.baseUrl + '/index/isdisplay'; + var param = { + pareid: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + isdisplay: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + console.log('-=-=-=-=-=-=-=-='); + console.log(res); + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getmsgcheck: function (params) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": that.data.accesstoken + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + that.wordsadd(params, that.data.imagestr); + // if (res.errcode == "0") { + // that.wordsadd(params, that.data.imagestr) + // } else { + + // wx.showToast({ + // title: '留言内容有敏感词请重新输入',//提示文字 + // duration: 2000,//显示时长 + // mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + // icon: 'none', //图标,支持"success"、"loading" + // success: function () { },//接口调用成功 + // fail: function () { }, //接口调用失败的回调函数 + // complete: function () { } //接口调用结束的回调函数 + // }) + // } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + checkusercousre: function (para) { + //vip课程 + //检测用户是否这个课程的权限 + Apps.islogin(); + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkusercousre' + var param = { + user_id: wx.getStorageSync('wxuserid'), + courseid: para, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log('// 检查一下用户是否有课程权限 cousreshow=true'); + console.log(res); + console.log(res.data); + // 检查一下用户是否有课程权限 cousreshow=true + that.setData({ + cousreshow: res.data.iscousreshow, + isvip:res.data.isvip + }); + + if(res.data.isvip==false && that.data.viptype_id==2){ + + that.checkuserscource(wx.getStorageSync('wxuserid'), that.data.cousrceid, that.data.headpicvalue); + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getpicchekc: function (params) { + // let url="https://api.weixin.qq.com/wxa/media_check_async?access_token="+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkpic' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "media_url": params, + "media_type": 2, + "version": 2, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log("res==========="); + console.log(res); + + this.setData({ + ispic: 1 + }) + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + pageScrollToBottom() { + wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height + console.log(rect.bottom * 20) + // 使页面滚动到底部 + wx.pageScrollTo({ + scrollTop: rect.bottom * 20 + }) + }).exec() + }, + +}) \ No newline at end of file diff --git a/pages/courselearning/courselearning.json b/pages/courselearning/courselearning.json new file mode 100644 index 0000000..b56a9df --- /dev/null +++ b/pages/courselearning/courselearning.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "课程学习", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/courselearning/courselearning.wxml b/pages/courselearning/courselearning.wxml new file mode 100644 index 0000000..8e066dc --- /dev/null +++ b/pages/courselearning/courselearning.wxml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 留言区 + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/pages/courselearning/courselearning.wxss b/pages/courselearning/courselearning.wxss new file mode 100644 index 0000000..c4ef157 --- /dev/null +++ b/pages/courselearning/courselearning.wxss @@ -0,0 +1,339 @@ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.courselivecontinor { + background-color: #F5F5F5; +} + +.functionalarea { + + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 485rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + /* font-weight: 400rpx; */ +} + +.headrightdown { + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + padding-top: 20rpx; + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.round-click{ + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; + } + .round-click image{ + height: 61rpx; + line-height: 61rpx; + width: 54rpx; + } + + + +.areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; + } + .areaclass textarea{ + width: 540rpx; + min-height: 300rpx; + } + + + .areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; + } + .areafooterleft image{ + + width: 52rpx; + height: 52rpx; + + } + .areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; + } + .areafooterright{ + width: 120rpx; + height: 56rpx; + } + .areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; + } + button::after { + border: none; + } + + .header_view_hide{ + display: none; + } + .header_view_show{ + display: block; + } + .vipimage image{ + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; + } + + + .process-container image{ + + position: relative; + z-index: 99; + transform:translate(20%, -10%); + z-index: 999; + width: 60rpx; + height: 60rpx; + +} + +.slider-container { + height: 1rpx; + position: relative; + z-index: 999; + left: 50%; + top: -379%; + transform: translate(-50%, -78rpx); + z-index: 999; + width: 80%; +} +.slider{ + width: 80%; + margin: 0 auto; +} +.mod_action { + position: relative; + z-index: 999; + left:520rpx; + top:-50rpx; + border-radius: 20%; + /* transform: translate(-50%, -98rpx); */ + width: 180rpx; + height: 15rpx; + +} +.playfull{ + position: relative; + z-index: 999; + left:40rpx; + top:70rpx; + border-radius: 20%; + /* transform: translate(-50%, -98rpx); */ + width: 180rpx; + height: 120rpx; +} +.van-dropdown-menu{ + height: var(--dropdown-menu-height,28px)!important; +} +.van-dropdown-menu__item{ + background: url("https://ndnd.duiduiedu.com/uploads/pics/bsbtn.png"); + width: 300px; + height: 90rpx; + background-size:cover; + background-repeat:no-repeat; +} +.playfull image{ + width: 180rpx; + height: 80rpx; +} +.mod_action image{ + width: 180rpx; + height: 80rpx; +} + + + +.choose_upload_view { + margin-top: 30rpx; + margin-left: 10%; + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-start; + flex-wrap: wrap; + } + .choose_upload_item { + margin-left: 38rpx; + margin-bottom: 20rpx; + position: relative; + width: 100rpx; + display: flex; + align-items: center; + } + .choose_upload_view .choose_upload_img { + width: 100rpx; + height: 100rpx; + } + .choose_upload_view .remove_img_icon { + padding: 4rpx; + position:absolute; + top: -15rpx; + right: -13rpx; + width: 28rpx; + height: 28rpx; + border-radius: 50%; + background-color: rgba(248, 236, 236, 0.5); + } + .other_upload { + margin-left: 15rpx; + width: 80rpx; + } \ No newline at end of file diff --git a/pages/createwords/createwords.js b/pages/createwords/createwords.js new file mode 100644 index 0000000..fd3fb8a --- /dev/null +++ b/pages/createwords/createwords.js @@ -0,0 +1,335 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [], //图片预览 + showview: true, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 0, + accesstoken: '', + typeid: 1, + title: '怼社区', + page: 1, //页面数, + pagecount: 0, + wordstextname: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + Apps.islogin(); + this.setData({ + typeid: options.typeid + }) + this.getacctoken(); + }, + bindTextAreaBlur: function (e) { + console.log(e.detail.value); + this.setData({ + wordstextname: e.detail.value + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + + }, + isjumpblack:function(){ + console.log(wx.getStorageSync('userisblack')); + if(wx.getStorageSync('userisblack')>=2){ + + wx.showToast({ + title: "您已被禁言,请联系管理员",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res.access_token); + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + formSubmit: function (e) { + + if(wx.getStorageSync('userisblack')>=2){ + this.isjumpblack(); + return; + } + + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + console.log(this.data.imagestr); + // this.wordsadd(content,this.data.imagestr); + this.getmsgcheck(content, this.data.accesstoken); + wx.setStorageSync('jmparm', this.data.typeid); + wx.switchTab({ + url: '/pages/communitylist/communitylist', + }) + }, + getmsgcheck: function (params, accesstoken) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + // let url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + console.log(res.errcode); + if (res.errcode == "0") { + that.wordsadd(params, that.data.imagestr) + } else { + + wx.showToast({ + title: '留言内容有敏感词请重新输入',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + + } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + // 删除图片 + removeChooseImage(e) { + let imgs = this.data.imagestr; + let { index } = e.currentTarget.dataset; + imgs.splice(index, 1); + this.setData({ + imagestr: imgs + }) + }, + // 预览图片 + previewBigImage(e) { + let that = this; + let imgs = that.data.imagestr; + let index = e.currentTarget.dataset.index; + let arr = []; + imgs.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + //当前显示图片 + current: arr[index], + //所有图片 + urls: arr + }) + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordsxqadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordstype_ids: this.data.typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + // this.getwords(that.data.typeid); + + that.setData({ + wordstextname: '', + imagestr: [] + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/createwords/createwords.json b/pages/createwords/createwords.json new file mode 100644 index 0000000..05a72c4 --- /dev/null +++ b/pages/createwords/createwords.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "用户发帖", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/createwords/createwords.wxml b/pages/createwords/createwords.wxml new file mode 100644 index 0000000..550f38b --- /dev/null +++ b/pages/createwords/createwords.wxml @@ -0,0 +1,22 @@ + +
+ + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/pages/createwords/createwords.wxss b/pages/createwords/createwords.wxss new file mode 100644 index 0000000..1785e4e --- /dev/null +++ b/pages/createwords/createwords.wxss @@ -0,0 +1,92 @@ +.areaclass { + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areaclass textarea { + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 52rpx; + height: 52rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.areafooterright { + width: 120rpx; + height: 56rpx; +} + +.areafooterright button { + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border: none; +} + + + +.choose_upload_view { + margin-top: 30rpx; + margin-left: 10%; + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-start; + flex-wrap: wrap; + } + .choose_upload_item { + margin-left: 38rpx; + margin-bottom: 20rpx; + position: relative; + width: 100rpx; + display: flex; + align-items: center; + } + .choose_upload_view .choose_upload_img { + width: 100rpx; + height: 100rpx; + } + .choose_upload_view .remove_img_icon { + padding: 4rpx; + position:absolute; + top: -15rpx; + right: -13rpx; + width: 28rpx; + height: 28rpx; + border-radius: 50%; + background-color: rgba(248, 236, 236, 0.5); + } + .other_upload { + margin-left: 15rpx; + width: 80rpx; + } \ No newline at end of file diff --git a/pages/daitika/daitika.js b/pages/daitika/daitika.js new file mode 100644 index 0000000..405ccb7 --- /dev/null +++ b/pages/daitika/daitika.js @@ -0,0 +1,169 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据---练习题查看交卷 + */ + data: { + coursetypefour_id: 1, + grouppaper_id: 1, + listdata: [], + list: [], + typeid:1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log('==============='); + console.log(options); + this.setData({ + coursetypefour_id: options.id, + grouppaper_id: options.grouppaper_id, + typeid:options.typeid + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getexamright(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + jumpitem:function(e){ + + console.log(e.currentTarget.dataset.id); + const id=e.currentTarget.dataset.id; + + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/getexamasitem'; + var param = { + id: id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + wx.navigateTo({ + url: '/pages/examing/examing?examid='+res.data.coursetypefour_id+'&index='+res.data.index+'&now='+res.data.now, + }) + + + // that.setData({ + // list: res.data.itemdata, + // listdata: res.data + // }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getexamright: function () { + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examuseransweras'; + let user_id = wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'); + var param = { + coursetypefour_id: that.data.coursetypefour_id, + user_id: user_id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + that.setData({ + list: res.data.itemdata, + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + viewallexplain: function (params) { + console.log(params); + console.log(this.data.coursetypefour_id); + let typeid = this.data.typeid; + let coursetypefour_id = this.data.coursetypefour_id; + let grouppaper_id = this.data.grouppaper_id; + console.log(this.data.list); + let arr=[]; + arr=this.data.list; + const arrstr=[]; + arr.forEach(element => { + arrstr.push(element.id); + }); + console.log(arrstr); + let jsonstr=JSON.stringify(arr); + this.examaddinnerdata(jsonstr); + + if (typeid == 1) { + wx.navigateTo({ + url: '/pages/exampaper/exampaper?id=' + coursetypefour_id + '&grouppaper_id=' + grouppaper_id, + }) + } else { + wx.navigateTo({ + url: '/pages/exampaper2/exampaper2?id=' + coursetypefour_id + '&grouppaper_id=' + grouppaper_id, + }) + } + },examaddinnerdata:function(listdata){ + //传送数组参数,批量添加数据 + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/foreachexaminner'; + var param = { + listdata: listdata + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + }).catch((errMsg) => { + console.log(errMsg); + }); + } + +}) \ No newline at end of file diff --git a/pages/daitika/daitika.json b/pages/daitika/daitika.json new file mode 100644 index 0000000..1a1a695 --- /dev/null +++ b/pages/daitika/daitika.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "答题卡" +} \ No newline at end of file diff --git a/pages/daitika/daitika.wxml b/pages/daitika/daitika.wxml new file mode 100644 index 0000000..aac16ee --- /dev/null +++ b/pages/daitika/daitika.wxml @@ -0,0 +1,27 @@ + + + + + + {{listdata.grouppapername}} + + + + + + + {{index+1}} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/daitika/daitika.wxss b/pages/daitika/daitika.wxss new file mode 100644 index 0000000..1ba642b --- /dev/null +++ b/pages/daitika/daitika.wxss @@ -0,0 +1,159 @@ +/* pages/exampaper2/exampaper2.wxss *//* 交卷头部 */ +.exampaperhead { + width: 100%; + height: 225rpx; + border-bottom: 16rpx solid #e6e2e2; + background-color: #f5f5f5; + } + + .headup { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 100rpx; + padding-top: 60rpx; + } + + .headup text { + font-size: 60rpx; + font-weight: 400; + color: #000000; + } + + .headdown { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 55rpx; + padding-top: 30rpx; + } + + .headdown text { + + font-size: 30rpx; + font-weight: 400; + color: #808080; + } + + /* 交卷头部 */ + + /* 提卷内容 */ + .subitexamcontent { + width: 680rpx; + margin: 40rpx auto; + } + + .examcontentup { + height: 40rpx; + border-left: 8rpx solid #1ccfd6; + margin-bottom: 40rpx; + margin-top: 40rpx; + } + + .examcontentup text { + + margin-left: 20rpx; + color: #010101; + font-size: 30rpx; + font-weight: 400; + } + + .examcontentdown { + display: flex; + flex-wrap: wrap; + width: 660rpx; + margin: 0 30rpx; + } + + .downitem { + width: 77rpx; + height: 77rpx; + flex: 0 19% !important; + margin-bottom: 40rpx; + } + + .examcontentdown image { + width: 77rpx; + height: 77rpx; + margin: 0 auto; + margin-top: 20rpx; + } + + .charclass { + display: flex; + justify-items: center; + } + + .charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + right:2rpx; + left: 10px; + top: -36px; + text-align: center; + } + + /* 提卷内容 */ + + /* 试卷时间 */ + .examtiems { + + width: 680rpx; + height: 50rpx; + margin: 50rpx auto; + } + + .examtiems text { + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + font-size: 30rpx; + font-weight: 400; + } + + + + /* 试卷解释 */ + .examanalysis { + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + position: fixed; + left: 36rpx; + bottom: 20rpx; + width: 680rpx; + height: 100rpx; + margin: 0 auto; + + } + + .alysisleft{ + + width: 330rpx; + height: 130rpx; + align-items: center; + } + + .alysisleft image { + width: 330rpx; + height: 100rpx; + } + .alysisright{ + + width: 330rpx; + height: 80rpx; + } + .alysisright image { + margin-left: 30rpx; + width: 330rpx; + height: 80rpx; + } + + /* 试卷解释 */ \ No newline at end of file diff --git a/pages/examanalysis/examanalysis.js b/pages/examanalysis/examanalysis.js new file mode 100644 index 0000000..e97a6cd --- /dev/null +++ b/pages/examanalysis/examanalysis.js @@ -0,0 +1,705 @@ +var WxParse = require('../../wxParse/wxParse.js'); +const app = getApp(); +var that; +var Interval; +var wechat; +var id; +var intt; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +var startX, endX; +var moveFlag = true; // 判断执行滑动事件 +Page({ + startX: 0, + startY: 0, + isClear: false, + startPageX: 0, + /** + * 页面的初始数据 --解释笔记 + */ + data: { + + title: '试题解释', + time: 2 * 60 * 60 * 1000, //初始时间 + paystatus: 1, //1未开始时间开始状态,2开始 + collection: 1, //1不收藏,2已收藏 + singdouble: 1, //1单选,2多选 + paiduanactive: 1, //1不是判断,2是判断题 + activeopen: true, + baseurl:baseUrl.globalData.baseimgurl, + paystatus: 1, //1未开始时间开始状态,2开始 + collection: 1, //1不收藏,2已收藏 + singdouble: 1, //1单选,2多选 + paiduanactive:1,//1不是判断,2是判断题 + zstime:1, //1正计,0倒计 + typeid:1, //0练习1正式 + activeopen:true, + coursetypefour_id:1, + itemdatacurrent:[], //当前数据 + itemdataall:[], //全部数据 + itemdata: [], //选项数据 + content:"",//富文本数据 + replylist:[], + showModalStatus: false, + pen: 3, + color: '#FFFFFF', + currentTab: 0, + now: 1, //当前页码 + all: 15, //总页码 + height: 0, + Timer_state: 1, + Answer_card: false, + Draft_paper: false, + false_analysis: false, + stem_height: 150, + jiexi: false, + field: { + analysis_text: "", + }, + img: [], + scroll: "scroll", + index: 0, + drag_line: false, + coursetypefour_id:1, + grouppaper_id:1, + typeid:1, + courseid:1,//试题ID + explainlist:[], //试题类型名称 + duicuo:1 //试题作答对与错1全部,2错的题 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.setNavigationBarTitle({ + title: this.data.title + }) + console.log(options); + this.setData({ + coursetypefour_id:options.coursetypefour_id, + grouppaper_id:options.grouppaper_id, + typeid:options.id, + duicuo:options.id + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getcoursetypefourexam(this.data.coursetypefour_id,this.data.grouppaper_id,this.data.duicuo); + this.wrodtypelist(this.data.courseid); + this.getexamexplantypelist(this.data.courseid); //试题类型列表 + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + //----------------------------- + // 手机触摸开始 + //----------------------------- + touchStart: function (e) { + //得到触摸点的坐标 + this.startX = e.changedTouches[0].x + this.startY = e.changedTouches[0].y + this.context = wx.createContext() + this.context.setStrokeStyle(this.data.color) + this.context.setLineWidth(this.data.pen) + this.context.setLineCap('round') // 让线条圆润 + this.context.beginPath() + + }, + //----------------------------- + // 触摸后移动 + //----------------------------- + touchMove: function (e) { + + var startX1 = e.changedTouches[0].x + var startY1 = e.changedTouches[0].y + this.context.moveTo(this.startX, this.startY) + this.context.lineTo(startX1, startY1) + this.context.stroke() + this.startX = startX1; + this.startY = startY1; + wx.drawCanvas({ + canvasId: 'myCanvas', + reserve: true, + actions: this.context.getActions() + }) + }, + penSelect: function (e) { + this.setData({ + pen: parseInt(e.currentTarget.dataset.param) + }); + this.isClear = false; + }, + colorSelect: function (e) { + this.setData({ + color: e.currentTarget.dataset.param + }); + this.isClear = false; + }, + cleardraw: function (e) { + this.setData({ + showModalStatus: false + }); + this.setData({ + showModalStatus: true + }); + }, + caogaoclick: function () { + + this.setData({ + showModalStatus: true, + }) + }, + //----------------------------- + // 草稿纸 + //----------------------------- + shows: function () { + const that = this; + console.log(that.data.Draft_paper); + that.data.Draft_paper = !that.data.Draft_paper; + if (that.data.Draft_paper == false) { + that.setData({ + Draft_paper: true, + }) + this.util('open'); + } else { + that.setData({ + Draft_paper: false, + showModalStatus: false + }) + } + }, + util: function (currentStatu) { + var animation = wx.createAnimation({ + duration: 200, + timingFunction: "linear", + delay: 0, + }); + this.animation = animation; + animation.opacity(0).rotateX(-100).step(); + this.setData({ + animationData: animation.export() + }) + setTimeout(function () { + animation.opacity(1).rotateX(0).step(); + this.setData({ + animationData: animation + }) + if (currentStatu == "close") { + this.setData({ + showModalStatus: false + }); + } + }.bind(this), 200) + // 显示 + if (currentStatu == "open") { + this.setData({ + showModalStatus: true + }); + } + }, + touchStart1: function (e) { + startX = e.touches[0].pageX; // 获取触摸时的原点 + moveFlag = true; + }, + // 触摸移动事件 + touchMove1: function (e) { + endX = e.touches[0].pageX; // 获取触摸时的原点 + if (moveFlag) { + if (endX - startX > 50) { + console.log("move right"); + this.move2right(); + moveFlag = false; + } + if (startX - endX > 50) { + console.log("move left"); + this.move2left(); + moveFlag = false; + } + } + + }, + // 触摸结束事件 + touchEnd1: function (e) { + moveFlag = true; // 回复滑动事件 + }, + move2left() { + const that = this; + const index = that.data.index + 1; + const all = that.data.all; + if (index < all) { + + console.log(that.data.itemdataall[index].id); + this.setData({ + index: index, + now: index + 1, + itemdata: that.data.itemdataall[index].examitem, + itemdatacurrent:that.data.itemdataall[index], + content:that.data.itemdataall[index].name.replace(/\ { + console.log(res.data); + that.setData({ + itemdataall: res.data.item, + itemdata:res.data.item[0].examitem, + all:res.data.item.length, + itemdatacurrent:res.data.item[0], + content:res.data.item[0].name.replace(/\ { + console.log(errMsg); + }); + }, //解释开始 + collectionselect: function (e) { + console.log(e); + this.getcollectionclick(e.currentTarget.id,wx.getStorageSync('wxuserid')); + }, + getcollectionclick:function(collection_id,user_id) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examcollection'; + var param = { + id: collection_id, + user_id:user_id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + collection: res.data + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + collectionclickdata:function(collection_id,user_id) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/course/coursecollection'; + var param = { + id: collection_id, + user_id:user_id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + this.getcoursedata(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + displayview:function() { + console.log(this.data.showview); + this.setData({ + showview:(!this.data.showview) + }) + }, + wrodtypelist:function(params){ + + //获取课程留言 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/wordsexam'; + var param = { + exam_id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsclick:function(ee){ + + let e1=ee.currentTarget.id; + let e2=baseUrl.globalData.currentuserinfo.id; + const that = this; + let url = baseUrl.globalData.baseUrl + '/wordslist/wordscourseclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic:function(){ + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr=[]; + var arr=''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: baseUrl.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success:function(res){ + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr:that.data.imagestr + }); + }, + }) + + } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + formSubmit:function(e) { + + if(wx.getStorageSync('wxuserid')==''){ + wx.navigateTo({ + url: '/pages/userlogin/userlogin', + }) + } + + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + // console.log(this.data.imagestr); + this.wordsadd(content,this.data.imagestr); + + }, + bindTextAreaBlur: function(e) { + this.setData({ + wordstextname:e.detail.value + }) + }, + uploadpicsimage:function(e){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/wordslist/uploadpics'; + var param = { + url: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsadd:function(content,imagestr){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examexplainadd'; + var param = { + content: content, + imagestr:imagestr, + userid:wx.getStorageSync('wxuserid')==''?3:wx.getStorageSync('wxuserid'), + exam_id:that.data.courseid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if(res.data>0){ + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + + that.wrodtypelist(that.data.courseid); //试题留言 + that.getexamexplantypelist(that.data.courseid); //试题类型列表 + that.setData({ + wordstextname:'' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + },contentclick:function(params) { + + console.log(params); + let id=params.currentTarget.id; + let xid=params.currentTarget.dataset.xid; + console.log(id); + this.setData({ + wordstextname:'回复@'+id, + showview:true + }); + + this.addinccomment(xid); + + wx.showToast({ + title: '@成功,留言请移底部留言', + icon: 'none', + duration: 1500 + }) + + + },rdclick:function(params) { + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id='+params.currentTarget.id, + }) + },addinccomment:function(params) { + //增加评论数 + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/addcommentcount'; + var param = { + id:params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(that.data.courseid); + this.getexamexplantypelist(that.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + clickbtn:function(params) { + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/wordscourseclickcount'; + var param = { + words_id:params.currentTarget.id, + user_id: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(this.data.courseid); + this.getexamexplantypelist(this.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + preview:function (params) { + let that=this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex=params.currentTarget.dataset.id; + + let rearr=that.data.replylist[arrindex].pics; + console.log(rearr); + let arr=[]; + rearr.forEach(function (item,index) { + arr[index]=that.data.baseurl+item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + getexamexplantypelist:function(params) { + + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examexplaintypelist'; + var param = { + exam_id:params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + this.setData({ + + explainlist:res.data + + }) + // this.wrodtypelist(this.data.courseid) + // this.wrodtypelist(this.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + + } + + +}) \ No newline at end of file diff --git a/pages/examanalysis/examanalysis.json b/pages/examanalysis/examanalysis.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/examanalysis/examanalysis.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/examanalysis/examanalysis.wxml b/pages/examanalysis/examanalysis.wxml new file mode 100644 index 0000000..cdc5563 --- /dev/null +++ b/pages/examanalysis/examanalysis.wxml @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{now}}/{{all}} + + + + + + + + + + + + + + + + + + + + 【{{itemdatacurrent.itemname}}】 + + + + + + + + + + + + + + + + + + {{item.charmu}} + + + + {{item.title}} + + + + + + + + + + + 【{{itemdatacurrent.itemname}}】 + + + + + + + + + + + + {{item.charmu}} + + + + {{item.title}} + + + + + + + + + + + + 正确答案 + + +     {{itemdatacurrent['answer']}} + + + + + {{itemdatacurrent['answername']}} + + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + 解释 + + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + +
+ + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/pages/examanalysis/examanalysis.wxss b/pages/examanalysis/examanalysis.wxss new file mode 100644 index 0000000..9390a00 --- /dev/null +++ b/pages/examanalysis/examanalysis.wxss @@ -0,0 +1,635 @@ +.page { + background-color: #ededed; +} + +.examing { + display: flex; + flex-direction: row; + align-items: center; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + top: 0; +} + +.item1 { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; +} + +.item1 image { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; +} + +.item4 { + width: 50rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 80rpx; + +} + +.item4 image { + width: 50rpx; + height: 44rpx; + margin: 0 19rpx; +} + +.item5 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 120rpx; + +} + +.item5 image { + width: 38rpx; + height: 47rpx; + margin: 0 22rpx; +} + +.item2 { + width: 150rpx; + height: 50rpx; + margin-top: 16rpx; + margin-left: 19rpx; +} + +.item2 text { + width: 150rpx; + height: 50rpx; + color: white; +} + +.item3 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 79rpx; +} + +.item3 text { + width: 100rpx; + height: 50rpx; + color: white; +} + +.examingfooter { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + bottom: 0; +} + +.footerleft image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.footermiddle image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.footerright image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.examingcontent { + width: 700rpx; + margin: 80rpx auto; + /* max-height: 250rpx; + overflow: hidden; */ +} + +.examingcontent2 { + width: 700rpx; + margin: 80rpx auto; +} + + +.examingcontent text { + font-size: 30rpx; + font-weight: 400; + +} + +.examintcontentda { + width: 700rpx; + margin: 0 auto; + float: left; + margin-bottom: 80rpx; +} + +.contentleft { + float: left; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin-left: 25rpx; +} + +.contentleft image { + width: 49rpx; + height: 49rpx; +} + +.contentright { + margin-left: 25rpx; + float: left; + width: 600rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + left: 4px; + top: -31px; + text-align: center; +} + +.item2 .van-count-down { + color: white; +} + +/*草稿纸*/ +.topic_cgz { + position: fixed; + top: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.4); + z-index: 999; + overflow: hidden; +} + +.topic_cgz_tab { + width: 100%; + height: 100%; + padding: 0; + position: fixed; + top: 0rpx; +} + +.topic_cgz_tab .fl { + width: 25%; + text-align: center; +} + +.topic_cgz_tab image { + width: 60rpx; + height: 60rpx; +} + +/*滚动层*/ +scroll-item { + z-index: 9; +} + +.scoll-h { + height: 100%; +} + +.tab-content { + height: 100%; + width: 100%; + background: #fff; +} + +.the_big_box { + height: 100%; + width: 100%; + background: #fff; + overflow-x: hidden; +} + +.tab-content-top { + margin-top: 20rpx; +} + +.toolsclass { + display: flex; + justify-items: center; + justify-content: space-between; + width: 100%; + margin: 0 auto; + height: 200rpx; + position: fixed; + bottom: 200; +} + +.openclass { + + display: flex; + justify-content: center; + width: 700rpx; + margin: 80rpx auto; + +} + +.openclass image { + width: 120rpx; + height: 24rpx; +} + +.examanswer { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + width: 100%; + height: 180rpx; + background-color: #f0f0f0; + margin: 50rpx auto; +} + +.answerleft { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 45%; + height: 180rpx; + align-items: center; +} +.answerleftup{ + + color: #808080; + font-size: 35rpx; +} + +.answerleftdown{ + + color: #1ccfd6; + font-size: 45rpx; + font-weight: 400; +} + +.answerright { + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 45%; + height: 180rpx; + align-items: center; + color: #000000; + font-size: 35rpx; +} + +.analysisnote{ + + width: 720rpx; + height: 280rpx; + overflow: hidden; + margin: 0 auto; + display: flex; + flex-direction:row; +} +.analysisnoteleft{ + width: 60%; + display: flex; + flex-wrap: wrap; + justify-content: space-between; + +} +.leftitem{ + margin-right: 20rpx; + line-height: 50rpx; + width: 44%; + height: 50rpx; + border: 1rpx solid #49dae0; + color: #49dae0; + font-size: 26rpx; + text-align: center; + margin-top: 10rpx; + +} + +.leftitem2{ + margin-right: 20rpx; + margin-right: 20rpx; + line-height: 50rpx; + width: 44%; + height: 50rpx; + border: 1rpx solid #909090; + color: #909090; + font-size: 26rpx; + text-align: center; + +} +.analysisnoteright{ + width: 38%; + height: 200rpx; + text-align: right; +} +.analysisnoteright image{ + + width: 180rpx; + height: 50rpx; + margin-right: 20rpx; + +} +.feigexiang{ + + width: 620rpx; + height: 10rpx; + border-bottom: 1rpx solid #dedcdc; + margin: 20rpx auto; +} +.explainline { + width: 705rpx; + height: 30rpx; + margin: 0 auto; + border-left: 8rpx solid #49dae0; +} +.explainline text{ + + + display: flex; + flex-direction: column; + justify-content:baseline; + align-items:left; + height: 30rpx; + line-height: 30rpx; + + font-size: 30rpx; + color:#323232; + margin-left: 30rpx; +} + +/* 笔记解释 */ +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 485rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + /* font-weight: 400rpx; */ +} + +.headrightdown { + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} +.feigexian{ + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} +.vipimage image{ + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; +} + +/* 笔记解释 */ + + +.examingcontent { + width:100%; + margin: 80rpx auto; + /* max-height: 250rpx; + overflow: hidden; */ +} + +.examingcontent2 { + width: 95%; + margin: 80rpx auto; +} + + +.examingcontent text { + font-size: 30rpx; + font-weight: 400; + +} + +.examintcontentda { + width: 700rpx; + margin: 0 auto; + float: left; + margin-bottom: 80rpx; +} + +.contentleft { + float: left; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin-left: 25rpx; +} + +.contentleft image { + width: 49rpx; + height: 49rpx; +} + +.contentright { + margin-left: 25rpx; + float: left; + width: 600rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + left: 8rpx; + top: -60rpx; + text-align: center; +} + +.item2 .van-count-down { + color: white; +} + /* + 解释开始 + */ + + +.areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} +.areaclass textarea{ + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} +.areafooterleft image{ + + width: 52rpx; + height: 52rpx; + +} +.areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} +.areafooterright{ + width: 120rpx; + height: 56rpx; +} +.areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; +} +button::after { + border: none; +} + +.header_view_hide{ + display: none; +} +.header_view_show{ + display: block; +} \ No newline at end of file diff --git a/pages/examing/examing.js b/pages/examing/examing.js new file mode 100644 index 0000000..28ba18a --- /dev/null +++ b/pages/examing/examing.js @@ -0,0 +1,739 @@ +var WxParse = require('../../wxParse/wxParse.js'); +const app = getApp(); +var that; +var Interval; +var wechat; +var id; +var intt; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + startX: 0, + startY: 0, + isClear: false, + + /** + * 页面的初始数据 + */ + data: { + reexam: 0, //是否反复作答 0不是,1是 + index: 0, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + timecount: '00:00:00', + cost: 0, + flag: 1, + endtime: "", + baseurl: baseUrl.globalData.baseimgurl, + time: 1 * 60 * 60 * 1000, //初始时间 + paystatus: 1, //1未开始时间开始状态,2开始 + collection: 1, //1不收藏,2已收藏 + singdouble: 1, //1单选,2多选 + paiduanactive: 1,//1不是判断,2是判断题 + zstime: 1, //1正计,0倒计 + typeid: 1, //0练习1正式 + activeopen: true, + coursetypefour_id: 1, + itemdatacurrent: [], //当前数据 + itemdataall: [], //全部数据 + itemdata: [], //选项数据 + content: "",//富文本数据 + showModalStatus: false, + pen: 3, + color: '#FFFFFF', + currentTab: 0, + now: 1, //当前页码 + all: 15, //总页码 + height: 0, + Timer_state: 1, + Answer_card: false, + Draft_paper: false, + false_analysis: false, + stem_height: 150, + jiexi: false, + field: { + analysis_text: "", + }, + img: [], + scroll: "scroll", + drag_line: false, + showvide: false, + showexampop: false, //查看交卷, + examlistdata: [], + examlist: [], + }, + showPopup() { + this.getids(); //先初始答题卡数据 + this.setData({ showexampop: true }); + this.getexamright(); + }, + + onCloseexam() { + this.setData({ showexampop: false }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + baseUrl.islogin(); + console.log(options) + if (options.index) { + this.setData({ + index: options.index, + reexam: 1 + }); + } + + if (options.now) { + this.setData({ + now: options.now + }); + } + this.setData({ + coursetypefour_id: options.examid + }); + + this.start(); + }, + + /**getcoursetypefourexam + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + console.log("================"); + console.log(this.data.index); + this.getcoursetypefourexam(this.data.coursetypefour_id, this.data.index); + this.initadddata(this.data.itemdataall, this.data.coursetypefour_id, wx.getStorageSync('wxuserid')); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + start: function () { + + let zstime = this.data.zstime; + if (zstime == 0) { + const countDown = this.selectComponent('.control-count-down'); + countDown.start(); + + } else { + + this.zsstart(); + } + this.setData({ + paystatus: 2 + }) + + }, + pause() { + let zstime = this.data.zstime; + if (zstime == 0) { + const countDown = this.selectComponent('.control-count-down'); + countDown.pause(); + + } else { + // this.zsstop(); + this.zsstop(); + + this.setData({ + showvide: true + }); + + } + this.setData({ + paystatus: 1 + }) + + }, + finished() { + console.log("交卷") + }, + collectionselect: function (e) { + console.log(e); + this.getcollectionclick(e.currentTarget.id, wx.getStorageSync('wxuserid')); + }, + getcollectionclick: function (collection_id, user_id) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examcollection'; + var param = { + id: collection_id, + user_id: user_id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + collection: res.data + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + + //----------------------------- + // 手机触摸开始 + //----------------------------- + touchStart: function (e) { + //得到触摸点的坐标 + this.startX = e.changedTouches[0].x + this.startY = e.changedTouches[0].y + this.context = wx.createContext() + this.context.setStrokeStyle(this.data.color) + this.context.setLineWidth(this.data.pen) + this.context.setLineCap('round') // 让线条圆润 + this.context.beginPath() + + }, + //----------------------------- + // 触摸后移动 + //----------------------------- + touchMove: function (e) { + + var startX1 = e.changedTouches[0].x + var startY1 = e.changedTouches[0].y + this.context.moveTo(this.startX, this.startY) + this.context.lineTo(startX1, startY1) + this.context.stroke() + this.startX = startX1; + this.startY = startY1; + wx.drawCanvas({ + canvasId: 'myCanvas', + reserve: true, + actions: this.context.getActions() + }) + }, + penSelect: function (e) { + this.setData({ + pen: parseInt(e.currentTarget.dataset.param) + }); + this.isClear = false; + }, + colorSelect: function (e) { + this.setData({ + color: e.currentTarget.dataset.param + }); + this.isClear = false; + }, + cleardraw: function (e) { + this.setData({ + showModalStatus: false + }); + this.setData({ + showModalStatus: true + }); + }, + caogaoclick: function () { + + this.setData({ + showModalStatus: true, + }) + }, + //----------------------------- + // 草稿纸 + //----------------------------- + shows: function () { + const that = this; + console.log(that.data.Draft_paper); + that.data.Draft_paper = !that.data.Draft_paper; + if (that.data.Draft_paper == false) { + that.setData({ + Draft_paper: true, + }) + this.util('open'); + } else { + that.setData({ + Draft_paper: false, + showModalStatus: false + }) + } + }, + util: function (currentStatu) { + var animation = wx.createAnimation({ + duration: 200, + timingFunction: "linear", + delay: 5, + }); + this.animation = animation; + animation.opacity(0).rotateX(-100).step(); + this.setData({ + animationData: animation.export() + }) + setTimeout(function () { + animation.opacity(1).rotateX(0).step(); + this.setData({ + animationData: animation + }) + if (currentStatu == "close") { + this.setData({ + showModalStatus: false + }); + } + }.bind(this), 200) + // 显示 + if (currentStatu == "open") { + this.setData({ + showModalStatus: true + }); + } + }, //----------------------------- + // 究极的过度效果 + //----------------------------- + guodu: function () { + var animation = wx.createAnimation({ + timingFunction: "ease-in-out", + delay: 15, + }); + this.animation = animation; + animation.opacity(0).translateY(-50).scale(0).step(150); + this.setData({ + animationData: animation.export() + }) + setTimeout(function () { + animation.opacity(1).translateY(0).scale(1).step(100); + this.setData({ + animationData: animation + }) + }.bind(this), 150); + }, + next: function (e) { + + const that = this; + that.getids(); //增加没有选项数据 + that.guodu(); + const index = that.data.index - 0 + 1; + console.log('------------'); + console.log(index); + const all = that.data.all; + if (index < all) { + that.setData({ + index: index, + now: index + 1, + itemdata: that.data.itemdataall[index].examitem, + itemdatacurrent: that.data.itemdataall[index], + content: that.data.itemdataall[index].name.replace(/\ { + if (item.id == index && item.selectvalue == "1") { + item.selectvalue = "2"; + } else if (item.id == index) { + item.selectvalue = "1"; + } + return item + }) + console.log(arr); + this.setData({ + itemdata: arr + }); + + }, //获取id + getids() { + let ids = this.data.itemdata.filter(item => item.selectvalue == '2').map(item => item.charmu); + let dx = this.data.itemdata.filter(item => item.selectvalue == '2').map(item => item.charmu); + console.log(ids); + console.log(dx); + console.log('多选Id:' + ids) + console.log('单选Id:' + dx); + console.log(this.data.itemdatacurrent); + let itemcurrent = this.data.itemdatacurrent; + let user_id = wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'); + let examanswer = 1; + if (itemcurrent.examtype == 1) { + examanswer = dx + ''; + } else { + examanswer = ids + ''; + } + this.addexamdata(this.data.coursetypefour_id, itemcurrent.examtype, itemcurrent.typeid, itemcurrent.id, itemcurrent.itemname, examanswer, itemcurrent.answer, user_id, itemcurrent.grouppaper_id, this.data.index, this.data.now); + + }, + initadddata: function (params, coursetypefour_id, user_id) { + //初始化答题卡数据 (1) + + console.log("===========----============="); + console.log(params); + let arr = params; + arr.forEach((element, index) => { + console.log(element); + let itemcurrent = element; + console.log(coursetypefour_id); + console.log(index); + console.log(arr.length); + this.addexamdata(coursetypefour_id, itemcurrent.examtype, itemcurrent.typeid, itemcurrent.id, itemcurrent.itemname, '', itemcurrent.answer, user_id, itemcurrent.grouppaper_id, index, arr.length); + }); + console.log("===========----============="); + }, + bindActive: function (e) { + + let arr = this.data.itemdata.map(item => { + if (item.id === e.currentTarget.dataset.id) { + item.selectvalue = 2 + } else { + item.selectvalue = 1 + } + return item + }) + this.setData({ + itemdata: arr + }); + // this.getids(); + this.next(this.data.now); + }, + openactive: function (e) { + console.log(e); + let opendata = this.data.openactive; + opendata = !opendata; + console.log(opendata); + this.setData({ + activeopen: opendata, + openactive: opendata + }) + + }, + //开始 + zsstart: function () { + var that = this; + //停止(暂停) + clearInterval(intt); + //时间重置 + that.setData({ + hour: that.data.hour, + minute: that.data.minute, + second: that.data.second, + millisecond: that.data.millisecond, + paystatus: 2 + }) + intt = setInterval(function () { that.zstimer() }, 50); + + + }, + //暂停 + zsstop: function () { + clearInterval(intt); + }, + //停止 + zsReset: function () { + var that = this + clearInterval(intt); + that.setData({ + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + timecount: '00:00:00', + }) + }, + zstimer: function () { + var that = this; + // console.log(that.data.millisecond) + that.setData({ + millisecond: that.data.millisecond + 5 + }) + if (that.data.millisecond >= 100) { + that.setData({ + millisecond: 0, + second: that.data.second + 1 + }) + } + if (that.data.second >= 60) { + that.setData({ + second: 0, + minute: that.data.minute + 1 + }) + } + + if (that.data.minute >= 60) { + that.setData({ + minute: 0, + hour: that.data.hour + 1 + }) + } + that.setData({ + timecount: that.data.hour + ":" + that.data.minute + ":" + that.data.second + }) + }, + getcoursetypefourexam: function (params, index) { + + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/paperexamitemas'; + var param = { + coursetypefour_id: params, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + // that.initadddata(res.data.item, params, wx.getStorageSync('wxuserid')); + that.setData({ + itemdataall: res.data.item, + itemdata: res.data.item[index].examitem, + all: res.data.item.length, + itemdatacurrent: res.data.item[index], + content: res.data.item[index].name.replace(/\ { + console.log(errMsg); + }); + }, + addexamdata: function (coursetypefour_id, examtype, typeid, exam_id, itemname, answer, rightanswer, user_id, grouppaper_id, index, now) { + + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examaddas'; + var param = { + coursetypefour_id: coursetypefour_id, + examtype: examtype, + typeid: typeid, + exam_id: exam_id, + itemname: itemname, + answer: answer, + rightanswer: rightanswer, + user_id: user_id, + grouppaper_id: grouppaper_id, + index: index, + now: now + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + subitexam: function () { + let examtype = this.data.singdouble; + let id = this.data.coursetypefour_id; + let typeid = this.data.typeid; + let grouppaper_id = this.data.itemdatacurrent.grouppaper_id; + console.log(id); + this.getids(); + // if (typeid == 1) { + // wx.navigateTo({ + // url: '/pages/daitika/daitika?id=' + id + '&grouppaper_id=' + grouppaper_id, + // }) + // } else { + // wx.navigateTo({ + // url: '/pages/exampaper2/exampaper2?id=' + id + '&grouppaper_id=' + grouppaper_id, + // }) + // } + wx.redirectTo({ + url: '/pages/daitika/daitika?id=' + id + '&grouppaper_id=' + grouppaper_id + '&typeid=' + typeid, + }) + + }, + getexamright: function () { + + //弹出答题卡 + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examuseransweras'; + let user_id = wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'); + var param = { + coursetypefour_id: that.data.coursetypefour_id, + user_id: user_id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + that.setData({ + examlist: res.data.itemdata, + examlistdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + jumpitem: function (e) { + + console.log(e.currentTarget.dataset.id); + const id = e.currentTarget.dataset.id; + + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/getexamasitem'; + var param = { + id: id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log("aaaaaaaaaaaaaaaaaaaaaaaaaaa") + console.log(res.data); + // wx.navigateTo({ + // url: '/pages/examing/examing?examid='+res.data.coursetypefour_id+'&index='+res.data.index+'&now='+res.data.now, + // }) + that.setData({ + index: res.data.index, + now: res.data.index - 0 + 1 + }); + + that.getcoursetypefourexam(res.data.coursetypefour_id, res.data.index); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + viewallexplain: function (params) { + + let typeid = this.data.typeid; + let coursetypefour_id = this.data.coursetypefour_id; + + let currentdata=this.data.itemdatacurrent; + console.log('currentdata========================'); + console.log(currentdata); + + let grouppaper_id = currentdata.grouppaper_id; + + console.log('grouppaper_id========================'); + console.log(grouppaper_id); + console.log(this.data.examlist); + let arr = []; + arr = this.data.examlist; + const arrstr = []; + arr.forEach(element => { + arrstr.push(element.id); + }); + console.log(arrstr); + let jsonstr = JSON.stringify(arr); + this.examaddinnerdata(jsonstr); + + if (typeid == 1) { + wx.navigateTo({ + url: '/pages/exampaper/exampaper?id=' + coursetypefour_id + '&grouppaper_id=' + grouppaper_id, + }) + } else { + wx.navigateTo({ + url: '/pages/exampaper2/exampaper2?id=' + coursetypefour_id + '&grouppaper_id=' + grouppaper_id, + }) + } + }, examaddinnerdata: function (listdata) { + //传送数组参数,批量添加数据 + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/foreachexaminner'; + var param = { + listdata: listdata + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + }).catch((errMsg) => { + console.log(errMsg); + }); + } + + +}) \ No newline at end of file diff --git a/pages/examing/examing.json b/pages/examing/examing.json new file mode 100644 index 0000000..6f0c60a --- /dev/null +++ b/pages/examing/examing.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "考试进行中。。。" +} \ No newline at end of file diff --git a/pages/examing/examing.wxml b/pages/examing/examing.wxml new file mode 100644 index 0000000..7e9a745 --- /dev/null +++ b/pages/examing/examing.wxml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{timecount}} + + + {{now}}/{{all}} + + + + + + + + + + + + + + + + + + 【{{itemdatacurrent.itemname}}】 + + + + + + + + + + + + + + + + + + {{item.charmu}} + + + + {{item.title}} + + + + + + + + + + + 【{{itemdatacurrent.itemname}}】 + + + + + + + + + + + + {{item.charmu}} + + + + {{item.title}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{examlistdata.grouppapername}} + + + + + + + {{index+1}} + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/examing/examing.wxss b/pages/examing/examing.wxss new file mode 100644 index 0000000..634fdc0 --- /dev/null +++ b/pages/examing/examing.wxss @@ -0,0 +1,369 @@ +.page { + background-color: #ededed; +} + +.examing { + display: flex; + flex-direction: row; + align-items: center; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + top: 0; +} + +.item1 { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; +} + +.item1 image { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; +} + +.item4 { + width: 50rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 80rpx; + +} + +.item4 image { + width: 50rpx; + height: 44rpx; + margin: 0 19rpx; +} + +.item5 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 120rpx; + +} + +.item5 image { + width: 38rpx; + height: 47rpx; + margin: 0 22rpx; +} + +.item2 { + width: 150rpx; + height: 50rpx; + margin-top: 16rpx; + margin-left: 19rpx; +} + +.item2 text { + width: 150rpx; + height: 50rpx; + color: white; +} + +.item3 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 79rpx; +} + +.item3 text { + width: 100rpx; + height: 50rpx; + color: white; +} + +.examingfooter { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + bottom: 0; +} + +.footerleft image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.footermiddle image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.footerright image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.examingcontent { + width:100%; + margin: 80rpx 20rpx; + /* max-height: 250rpx; + overflow: hidden; */ +} + +.examingcontent2 { + width: 100%; + margin: 80rpx auto; +} + + +.examingcontent text { + font-size: 30rpx; + font-weight: 400; + +} + +.examintcontentda { + width: 700rpx; + margin: 0 auto; + float: left; + margin-bottom: 80rpx; +} + +.contentleft { + float: left; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin-left: 25rpx; +} + +.contentleft image { + width: 49rpx; + height: 49rpx; +} + +.contentright { + margin-left: 25rpx; + float: left; + width: 600rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + left: 8rpx; + top: -60rpx; + text-align: center; +} + +.item2 .van-count-down { + color: white; +} + +/*草稿纸*/ +.topic_cgz { + position: fixed; + top: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.4); + z-index: 999; + overflow: hidden; +} + +.topic_cgz_tab { + width: 100%; + height: 100%; + padding: 0; + position: fixed; + top: 0rpx; +} + +.topic_cgz_tab .fl { + width: 25%; + text-align: center; +} + +.topic_cgz_tab image { + width: 60rpx; + height: 60rpx; +} + +/*滚动层*/ +scroll-item { + z-index: 9; +} + +.scoll-h { + height: 100%; +} + +.tab-content { + height: 100%; + width: 100%; + background: #fff; +} + +.the_big_box { + height: 100%; + width: 100%; + background: #fff; + overflow-x: hidden; +} + +.tab-content-top { + margin-top: 20rpx; +} + +.toolsclass { + display: flex; + justify-items: center; + justify-content: space-between; + width: 100%; + margin: 0 auto; + height: 200rpx; + position: fixed; + bottom: 200; +} + +.openclass { + + display: flex; + justify-content: center; + width: 700rpx; + margin: 80rpx auto; + +} + +.openclass image { + width: 120rpx; + height: 24rpx; +} +.headdouble{ + display: flex; + flex-direction: row; + width: 100%; + margin: 0 auto; +} +.headdoubleleft{ + width: 100%; +} +.headdoubleright{ + width: 95%; + margin: 0 auto; +} + + + + /* 提卷内容 */ + .popsubitexamcontent { + width: 680rpx; + margin: 40rpx auto; + } + + .popexamcontentup { + height: 40rpx; + border-left: 8rpx solid #1ccfd6; + margin-bottom: 40rpx; + margin-top: 40rpx; + } + + .popexamcontentup text { + + margin-left: 20rpx; + color: #010101; + font-size: 30rpx; + font-weight: 400; + } + + .popexamcontentdown { + display: flex; + flex-wrap: wrap; + width: 660rpx; + margin: 0 30rpx; + } + + .popdownitem { + width: 77rpx; + height: 77rpx; + flex: 0 19% !important; + margin-bottom: 40rpx; + } + + .popexamcontentdown image { + width: 77rpx; + height: 77rpx; + margin: 0 auto; + margin-top: 20rpx; + } + + .popcharclass { + display: flex; + justify-items: center; + } + + .popcharclass text { + width: 37rpx; + height: 33rpx; + position: relative; + right:2rpx; + left: 10px; + top: -36px; + text-align: center; + } + + /* 提卷内容 */ + + + /* 试卷解释 */ + .popexamanalysis { + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + position: fixed; + left: 36rpx; + bottom: 20rpx; + width: 680rpx; + height: 100rpx; + margin: 0 auto; + + } + + .popalysisleft{ + + width: 330rpx; + height: 130rpx; + align-items: center; + } + + .popalysisleft image { + width: 330rpx; + height: 100rpx; + } + .popalysisright{ + + width: 330rpx; + height: 80rpx; + } + .popalysisright image { + margin-left: 30rpx; + width: 330rpx; + height: 80rpx; + } + + /* 试卷解释 */ + \ No newline at end of file diff --git a/pages/examlist/examlist.js b/pages/examlist/examlist.js new file mode 100644 index 0000000..eef23bb --- /dev/null +++ b/pages/examlist/examlist.js @@ -0,0 +1,148 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + itemdata:[], + id:1, + typename:'国考', + ismdata:1 //是否材料型数据跳转 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + let id=options.id; + this.setData({ + id:id + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getpaper(this.data.id); + this.getpaperattrname(this.data.id); + this.isjumpurl(this.data.id,2); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + examingbtnclick:function(e){ + console.log(e); + console.log(this.data.ismdata); + // console.log(this.data.itemdata); + + let grouppaper_id=e.currentTarget.dataset.typeid; + // console.log(grouppaper_id); + // return; + if(this.data.ismdata==2){ + wx.navigateTo({ + url: '/pages/exammakings/exammakings?examid='+e.currentTarget.id+'&grouppaper_id='+grouppaper_id, + }) + }else{ + wx.navigateTo({ + url: '/pages/examing/examing?examid='+e.currentTarget.id+'&grouppaper_id='+grouppaper_id, + }) + } + + }, + isjumpurl:function(id,groupid) { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/isarrdata'; + var param = { + id:id, + groupid:groupid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + ismdata:res.data + }); + }).catch((errMsg) => { + console.log(errMsg); + }); +}, + getpaper:function(params) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/paperlist/getpaperlist'; + var param = { + paperattr_id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + itemdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getpaperattrname:function(params) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/paperlist/getpaperattrname'; + var param = { + id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + typename: res.data.name + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/examlist/examlist.json b/pages/examlist/examlist.json new file mode 100644 index 0000000..0f427e2 --- /dev/null +++ b/pages/examlist/examlist.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "国考试卷", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/examlist/examlist.wxml b/pages/examlist/examlist.wxml new file mode 100644 index 0000000..b4e1156 --- /dev/null +++ b/pages/examlist/examlist.wxml @@ -0,0 +1,11 @@ + + {{typename}} + + + + + + + {{item.name}} + + \ No newline at end of file diff --git a/pages/examlist/examlist.wxss b/pages/examlist/examlist.wxss new file mode 100644 index 0000000..9ecd92d --- /dev/null +++ b/pages/examlist/examlist.wxss @@ -0,0 +1,44 @@ +.examlist { + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 680rpx; + height: 90rpx; + margin: 0 auto; + background-color: #f5f5f5; + border-bottom: 1rpx solid #9c9898; +} + +.examlist text { + font-size: 40rpx; + font-weight: 400; +} + +.examitemlist { + display: flex; + flex-direction: row; + align-items: center; + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 28rpx; + background-color: #f0f0f0; +} + +.itemleft image { + + margin: 0 35rpx; + width: 31rpx; + height: 31rpx; +} + +.itemright{ + width: 470rpx; + overflow: hidden; +} +.itemright text{ + font-size: 30rpx; + font-weight: 400; +} \ No newline at end of file diff --git a/pages/exammakings/exammakings.js b/pages/exammakings/exammakings.js new file mode 100644 index 0000000..c28e0ec --- /dev/null +++ b/pages/exammakings/exammakings.js @@ -0,0 +1,126 @@ +var WxParse = require('../../wxParse/wxParse.js'); +const app = getApp(); +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + active: 0, + now: 1, //当前页码 + all: 15, //总页码 + index:1, + grouppaper_id:1,//组卷ID + listdata:[], //数据 + currentdata:[] //当前数据 + }, + onChange:function(event){ + + console.log(event.detail.index); + this.setData({ + active:event.detail.index + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + + + this.setData({ + grouppaper_id:options.grouppaper_id, + active:0 + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getexammaterial(this.data.grouppaper_id); + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getexammaterial:function(params) { + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/exammaterial'; + var param = { + grouppaper_id: params + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data[0]); + that.setData({ + itemdataall: res.data, + listdata:res.data[0].mitemdata, + all:res.data[0].mcount, + currentdata:res.data[0] + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + clickanswer:function(params) { + console.log(params.currentTarget.id); + let grouppaper_id=params.currentTarget.id; + wx.navigateTo({ + url: '/pages/examproblem/examproblem?grouppaper_id='+grouppaper_id + }) + + }, + clickm:function(params) { + console.log(params.currentTarget.id); + let grouppaper_id=params.currentTarget.id; + wx.navigateTo({ + url: '/pages/exammakings/exammakings?grouppaper_id='+grouppaper_id + }) + } +}) \ No newline at end of file diff --git a/pages/exammakings/exammakings.json b/pages/exammakings/exammakings.json new file mode 100644 index 0000000..a1da9cb --- /dev/null +++ b/pages/exammakings/exammakings.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "材料题" +} \ No newline at end of file diff --git a/pages/exammakings/exammakings.wxml b/pages/exammakings/exammakings.wxml new file mode 100644 index 0000000..3e58a2f --- /dev/null +++ b/pages/exammakings/exammakings.wxml @@ -0,0 +1,36 @@ + + + +{{currentdata.title}} + + +{{active+1}}/{{all}} + + + + + + + + + + + + {{item.namecontents}} + + + + + + + + + + 材料 + + + + 问题 + + + \ No newline at end of file diff --git a/pages/exammakings/exammakings.wxss b/pages/exammakings/exammakings.wxss new file mode 100644 index 0000000..8243cf1 --- /dev/null +++ b/pages/exammakings/exammakings.wxss @@ -0,0 +1,89 @@ +/* 材料头部 */ +.exammakingshead { + width: 100%; + height: 80rpx; + background-color: #49dae0; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + +} + +.headleft { + width: 580rpx; + overflow: hidden; +} + +.headleft text { + + color: white; + font-size: 30rpx; + margin-left: 40rpx; +} + +.headright text { + color: white; + font-size: 30rpx; + margin-right: 50rpx; +} + +.van-tabs__line { + background-color: #49dae0 !important; +} + +.makingscontent { + margin: 0 40rpx; +} + +.makingscontent text { + margin: 0 40rpx; + font-size: 30rpx; + +} + +/* 材料头部 */ + +/* 材料底部 */ +.makingsfooter { + + width: 100%; + height: 100rpx; + border-top: 2rpx solid #e5e7e7; + margin-top: 20rpx; + display: flex; + justify-content: center; + align-items: center; + position: fixed; + bottom: 0; + background-color: #f5f5f5; + opacity:1; +} + +.footerleft { + width: 160rpx; + height: 50rpx; + line-height: 50rpx; + background-color: #1ccfd6; + text-align: center; +} + +.footerleft text { + color: white; +} + +.footerright { + width: 160rpx; + height: 50rpx; + line-height: 50rpx; + background-color: #dad8d8; + text-align: center; + margin-left: 50rpx; + +} + +.footerright text { + color: black; +} + +/* 材料底部 */ \ No newline at end of file diff --git a/pages/exampaper/exampaper.js b/pages/exampaper/exampaper.js new file mode 100644 index 0000000..dbf954e --- /dev/null +++ b/pages/exampaper/exampaper.js @@ -0,0 +1,107 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + + list:[], + coursetypefour_id:1, + grouppaper_id:1, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + console.log(options); + this.setData({ + coursetypefour_id:options.id, + grouppaper_id:options.grouppaper_id + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getexamright(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + viewallexplain:function(params) { + console.log(params); + console.log(this.data.coursetypefour_id); + let typeid=params.currentTarget.id; + let coursetypefour_id=this.data.coursetypefour_id; + let grouppaper_id=this.data.grouppaper_id; + wx.navigateTo({ + url: '/pages/examanalysis/examanalysis?id='+typeid+'&coursetypefour_id='+coursetypefour_id+'&grouppaper_id='+grouppaper_id, + }) +}, +getexamright:function() { + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examuseranswerpaper'; + let user_id=wx.getStorageSync('wxuserid')==''?3:wx.getStorageSync('wxuserid'); + var param = { + coursetypefour_id: that.data.coursetypefour_id, + user_id:user_id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + that.setData({ + list:res.data, + listdata:res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); +} +}) \ No newline at end of file diff --git a/pages/exampaper/exampaper.json b/pages/exampaper/exampaper.json new file mode 100644 index 0000000..8e34fd3 --- /dev/null +++ b/pages/exampaper/exampaper.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "试卷" +} \ No newline at end of file diff --git a/pages/exampaper/exampaper.wxml b/pages/exampaper/exampaper.wxml new file mode 100644 index 0000000..771855d --- /dev/null +++ b/pages/exampaper/exampaper.wxml @@ -0,0 +1,51 @@ + + + + {{list.zdf}} + + + 总分{{list.zf}}分 + + + + + + + + + {{item.title}}(正确率{{item.itemright}}%) + + + + + + + + + {{index+1}} + + + + + + + + + + + + {{list.zf}} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/exampaper/exampaper.wxss b/pages/exampaper/exampaper.wxss new file mode 100644 index 0000000..b7ceadd --- /dev/null +++ b/pages/exampaper/exampaper.wxss @@ -0,0 +1,149 @@ +/* 交卷头部 */ +.exampaperhead { + width: 100%; + height: 225rpx; + border-bottom: 16rpx solid #e6e2e2; + background-color: #f5f5f5; +} + +.headup { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 55rpx; + padding-top: 50rpx; +} + +.headup text { + font-size: 60rpx; + font-weight: 400; + color: #000000; +} + +.headdown { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 55rpx; + padding-top: 30rpx; +} + +.headdown text { + + font-size: 30rpx; + font-weight: 400; + color: #808080; +} + +/* 交卷头部 */ + +/* 提卷内容 */ +.subitexamcontent { + width: 680rpx; + margin: 40rpx auto; +} + +.examcontentup { + height: 40rpx; + border-left: 8rpx solid #1ccfd6; + margin-bottom: 40rpx; + margin-top: 40rpx; +} + +.examcontentup text { + + margin-left: 20rpx; + color: #010101; + font-size: 30rpx; + font-weight: 400; +} + +.examcontentdown { + display: flex; + flex-wrap: wrap; + width: 660rpx; + margin: 0 30rpx; +} + +.downitem { + width: 77rpx; + height: 77rpx; + flex: 0 19% !important; + margin-bottom: 40rpx; +} + +.examcontentdown image { + width: 77rpx; + height: 77rpx; + margin: 0 auto; + margin-top: 20rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + right:2rpx; + left: 10px; + top: -36px; + text-align: center; +} + +/* 提卷内容 */ + +/* 试卷时间 */ +.examtiems { + + width: 680rpx; + height: 50rpx; + margin: 50rpx auto; + margin-bottom: 150rpx; +} + +.examtiems text { + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + font-size: 30rpx; + font-weight: 400; +} + +/* 试卷时间 */ + +/* 试卷解释 */ +.examanalysis { + + width: 680rpx; + height: 100rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin: 0 auto; + position: fixed; + bottom: 0; + +} + +.alysisleft image { + margin-left: 30rpx; + width: 330rpx; + height: 80rpx; +} + +.alysisright image { + margin-left: 30rpx; + width: 330rpx; + height: 80rpx; +} + +/* 试卷解释 */ \ No newline at end of file diff --git a/pages/exampaper2/exampaper2.js b/pages/exampaper2/exampaper2.js new file mode 100644 index 0000000..68ff555 --- /dev/null +++ b/pages/exampaper2/exampaper2.js @@ -0,0 +1,111 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据---练习题查看交卷 + */ + data: { + title:'练习完成', + coursetypefour_id:1, + grouppaper_id:1, + listdata:[], + list:[] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.setNavigationBarTitle({ + title: this.data.title + }) + console.log(options); + this.setData({ + coursetypefour_id:options.id, + grouppaper_id:options.grouppaper_id + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getexamright(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getexamright:function() { + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examuseranswer'; + let user_id=wx.getStorageSync('wxuserid')==''?3:wx.getStorageSync('wxuserid'); + var param = { + coursetypefour_id: that.data.coursetypefour_id, + user_id:user_id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + that.setData({ + list:res.data.itemdata, + listdata:res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + viewallexplain:function(params) { + console.log(params); + console.log(this.data.coursetypefour_id); + let typeid=params.currentTarget.id; + let coursetypefour_id=this.data.coursetypefour_id; + let grouppaper_id=this.data.grouppaper_id; + wx.navigateTo({ + url: '/pages/examanalysis/examanalysis?id='+typeid+'&coursetypefour_id='+coursetypefour_id+'&grouppaper_id='+grouppaper_id, + }) + } + +}) \ No newline at end of file diff --git a/pages/exampaper2/exampaper2.json b/pages/exampaper2/exampaper2.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/exampaper2/exampaper2.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/exampaper2/exampaper2.wxml b/pages/exampaper2/exampaper2.wxml new file mode 100644 index 0000000..3e14f64 --- /dev/null +++ b/pages/exampaper2/exampaper2.wxml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + {{listdata.grouppapername}}(正确率{{listdata.rightdata}}%) + + + + + + + + {{index+1}} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/exampaper2/exampaper2.wxss b/pages/exampaper2/exampaper2.wxss new file mode 100644 index 0000000..a1dd107 --- /dev/null +++ b/pages/exampaper2/exampaper2.wxss @@ -0,0 +1,157 @@ +/* pages/exampaper2/exampaper2.wxss *//* 交卷头部 */ +.exampaperhead { + width: 100%; + height: 225rpx; + border-bottom: 16rpx solid #e6e2e2; + background-color: #f5f5f5; +} + +.headup { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 100rpx; + padding-top: 60rpx; +} + +.headup text { + font-size: 60rpx; + font-weight: 400; + color: #000000; +} + +.headdown { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 55rpx; + padding-top: 30rpx; +} + +.headdown text { + + font-size: 30rpx; + font-weight: 400; + color: #808080; +} + +/* 交卷头部 */ + +/* 提卷内容 */ +.subitexamcontent { + width: 680rpx; + margin: 40rpx auto; +} + +.examcontentup { + height: 40rpx; + border-left: 8rpx solid #1ccfd6; + margin-bottom: 40rpx; + margin-top: 40rpx; +} + +.examcontentup text { + + margin-left: 20rpx; + color: #010101; + font-size: 30rpx; + font-weight: 400; +} + +.examcontentdown { + display: flex; + flex-wrap: wrap; + width: 660rpx; + margin: 0 30rpx; +} + +.downitem { + width: 77rpx; + height: 77rpx; + flex: 0 19% !important; + margin-bottom: 40rpx; +} + +.examcontentdown image { + width: 77rpx; + height: 77rpx; + margin: 0 auto; + margin-top: 20rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + right:2rpx; + left: 10px; + top: -36px; + text-align: center; +} + +/* 提卷内容 */ + +/* 试卷时间 */ +.examtiems { + + width: 680rpx; + height: 50rpx; + margin: 50rpx auto; +} + +.examtiems text { + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + font-size: 30rpx; + font-weight: 400; +} + + + +/* 试卷解释 */ +.examanalysis { + + width: 680rpx; + height: 100rpx; + margin: 0 30rx; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + position: fixed; + bottom: 0; +} + +.alysisleft{ + + width: 330rpx; + height: 80rpx; + margin-left: 30rpx; +} + +.alysisleft image { + width: 330rpx; + height: 80rpx; +} +.alysisright{ + + width: 330rpx; + height: 80rpx; +} +.alysisright image { + margin-left: 30rpx; + width: 330rpx; + height: 80rpx; +} + +/* 试卷解释 */ \ No newline at end of file diff --git a/pages/examproblem/examproblem.js b/pages/examproblem/examproblem.js new file mode 100644 index 0000000..4f11e9b --- /dev/null +++ b/pages/examproblem/examproblem.js @@ -0,0 +1,138 @@ +var WxParse = require('../../wxParse/wxParse.js'); +const app = getApp(); +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + active: 0, + totaldata:4, + openactive:2, + show:true, + title:'动态修改', + now: 1, //当前页码 + all: 15, //总页码 + index:1, + grouppaper_id:1,//组卷ID + listdata:[], //数据 + currentdata:[] //当前数据 + }, + onChange:function(event){ + + console.log(event.detail.index); + this.setData({ + active:event.detail.index + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + wx.setNavigationBarTitle({ + title: this.data.title + }) + this.setData({ + grouppaper_id:options.grouppaper_id + }); + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getexammaterial(this.data.grouppaper_id); + this.selectComponent('#tabs').resize(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + openactiveclick:function(event){ + console.log(event); + this.setData({ + openactive:event.currentTarget.id + }) + }, + getexammaterial:function(params) { + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/exammaterial'; + var param = { + grouppaper_id: params + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data[0]); + that.setData({ + itemdataall: res.data, + listdata:res.data[0].itemanswerdata, + all:res.data[0].answercount, + currentdata:res.data[0] + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); +}, +clickanswer:function(params) { + console.log(params.currentTarget.id); + let grouppaper_id=params.currentTarget.id; + wx.navigateTo({ + url: '/pages/examproblem/examproblem?grouppaper_id='+grouppaper_id + }) + + +}, +clickm:function(params) { + console.log(params.currentTarget.id); + let grouppaper_id=params.currentTarget.id; + wx.navigateTo({ + url: '/pages/exammakings/exammakings?grouppaper_id='+grouppaper_id + }) + } +}) \ No newline at end of file diff --git a/pages/examproblem/examproblem.json b/pages/examproblem/examproblem.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/examproblem/examproblem.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/examproblem/examproblem.wxml b/pages/examproblem/examproblem.wxml new file mode 100644 index 0000000..fc48811 --- /dev/null +++ b/pages/examproblem/examproblem.wxml @@ -0,0 +1,57 @@ + + + + {{currentdata.title}} + + + {{active+1}}/{{all}} + + + + + + + + + + + + {{item.namecon}} + + + + + + + + + + 参考答案 + + + + + + + + + {{item.answer}} + + + + + + + + + + + 材料 + + + + 问题 + + + \ No newline at end of file diff --git a/pages/examproblem/examproblem.wxss b/pages/examproblem/examproblem.wxss new file mode 100644 index 0000000..f16dcdb --- /dev/null +++ b/pages/examproblem/examproblem.wxss @@ -0,0 +1,156 @@ +/* 材料头部 */ +.exammakingshead { + width: 100%; + height: 80rpx; + background-color: #49dae0; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + +} + +.headleft { + width: 580rpx; + overflow: hidden; +} + +.headleft text { + + color: white; + font-size: 30rpx; + margin-left: 40rpx; +} + +.headright text { + color: white; + font-size: 30rpx; + margin-right: 50rpx; +} + +.van-tabs__line { + background-color: #49dae0 !important; +} + +.makingscontent { + margin: 0 40rpx; +} + +.makingscontent text { + margin: 0 40rpx; + font-size: 30rpx; + +} + +.makingscontentdown { + margin-top: 20rpx; + height: 20rpx; + background-color: #eef0f0; +} + +.makingscontentdownanswer { + height: 80rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +} + +.itemleft { + margin-left: 30rpx; + width: 50rpx; + height: 50rpx; +} + +.itemleft image { + width: 47rpx; + height: 47rpx; +} + +.itemmiddle { + margin-left: 30rpx; + width: 500rpx; + height: 50rpx; +} + +.itemmiddle text { + font-size: 30rpx; + font-weight: 400; + color: black; +} + +.itemright { + + margin-right: 60rpx; + width: 50rpx; + height: 50rpx; +} + +.itemright image { + width: 20rpx; + height: 20rpx; +} + +.answercontent { + margin: 0 40rpx; +} +.answercontent2{ + display: none; +} + +.answercontent text { + + font-size: 30rpx; + +} + + +/* 材料头部 */ + +/* 材料底部 */ +.makingsfooter { + + width: 100%; + height: 100rpx; + border-top: 2rpx solid #e5e7e7; + margin-top: 20rpx; + display: flex; + justify-content: center; + align-items: center; + position: fixed; + bottom: 0; + background-color: #f5f5f5; + opacity: 1; +} + +.footerleft { + width: 160rpx; + height: 50rpx; + line-height: 50rpx; + + background-color: #dad8d8; + text-align: center; +} + +.footerleft text { + color: white; +} + +.footerright { + width: 160rpx; + height: 50rpx; + line-height: 50rpx; + background-color: #1ccfd6; + text-align: center; + margin-left: 50rpx; + +} + +.footerright text { + color: white; +} +.van-tabs__line{ + left:10%; +} + +/* 材料底部 */ \ No newline at end of file diff --git a/pages/explainnote/explainnote.js b/pages/explainnote/explainnote.js new file mode 100644 index 0000000..c0f5d1e --- /dev/null +++ b/pages/explainnote/explainnote.js @@ -0,0 +1,372 @@ +var WxParse = require('../../wxParse/wxParse.js'); +const app = getApp(); +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + startX: 0, + startY: 0, + isClear: false, + /** + * 页面的初始数据 + */ + data: { + title: '我的收藏', + singdouble: 2, //1单选,2多选 + paiduanactive:1,//1不是判断,2是判断题 + activeopen:true, + itemdata: [], + itemdatacurrent:[], + exam_id:1, + baseurl:baseUrl.globalData.baseimgurl, + content:'', + examtypename:'' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.setNavigationBarTitle({ + title: this.data.title + }) + console.log(options); + this.setData({ + exam_id:options.id + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getexamdata(this.data.exam_id); + this.wrodtypelist(this.data.exam_id); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + openactive:function(e){ + console.log(e); + let opendata=this.data.openactive; + opendata=!opendata; + console.log(opendata); + this.setData({ + activeopen:opendata, + openactive:opendata + }) + }, + getexamdata:function(params) { + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/myexamexp'; + var param = { + exam_id:params + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + console.log(res.data.examtypename); + that.setData({ + itemdataall: res.data, + itemdata:res.data.examitem, + examtypename:res.data.examtypename, + content:res.data.name.replace(/\ { + console.log(errMsg); + }); + }, + wrodtypelist:function(params){ + + //获取课程留言 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/wordsexam'; + var param = { + exam_id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + formSubmit:function(e) { + + if(wx.getStorageSync('wxuserid')==''){ + wx.navigateTo({ + url: '/pages/userlogin/userlogin', + }) + } + + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + // console.log(this.data.imagestr); + this.wordsadd(content,this.data.imagestr); + + }, + bindTextAreaBlur: function(e) { + this.setData({ + wordstextname:e.detail.value + }) + }, + uploadpicsimage:function(e){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/wordslist/uploadpics'; + var param = { + url: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsadd:function(content,imagestr){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examexplainadd'; + var param = { + content: content, + imagestr:imagestr, + userid:wx.getStorageSync('wxuserid')==''?3:wx.getStorageSync('wxuserid'), + exam_id:that.data.courseid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if(res.data>0){ + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + + that.wrodtypelist(that.data.exam_id); //试题留言 + that.setData({ + wordstextname:'' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + },contentclick:function(params) { + + console.log(params); + let id=params.currentTarget.id; + let xid=params.currentTarget.dataset.xid; + console.log(id); + this.setData({ + wordstextname:'回复@'+id, + showview:true + }); + + this.addinccomment(xid); + + wx.showToast({ + title: '@成功,留言请移底部留言', + icon: 'none', + duration: 1500 + }) + },rdclick:function(params) { + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id='+params.currentTarget.id, + }) + },addinccomment:function(params) { + //增加评论数 + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/addcommentcount'; + var param = { + id:params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(that.data.courseid); + this.getexamexplantypelist(that.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + preview:function (params) { + let that=this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex=params.currentTarget.dataset.id; + + let rearr=that.data.replylist[arrindex].pics; + console.log(rearr); + let arr=[]; + rearr.forEach(function (item,index) { + arr[index]=that.data.baseurl+item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + uploadpic:function(){ + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr=[]; + var arr=''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: baseUrl.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success:function(res){ + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr:that.data.imagestr + }); + }, + }) + + } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + clickbtn:function(params) { + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/wordscourseclickcount'; + var param = { + words_id:params.currentTarget.id, + user_id: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(this.data.exam_id); + this.getexamdata(this.data.exam_id); + }).catch((errMsg) => { + console.log(errMsg); + }); +}, + +}) \ No newline at end of file diff --git a/pages/explainnote/explainnote.json b/pages/explainnote/explainnote.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/explainnote/explainnote.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/explainnote/explainnote.wxml b/pages/explainnote/explainnote.wxml new file mode 100644 index 0000000..c155727 --- /dev/null +++ b/pages/explainnote/explainnote.wxml @@ -0,0 +1,146 @@ + + + + + + 【{{examtypename}}】 + + + + + + + + + + + + + + + + + + {{item.charmu}} + + + + {{item.title}} + + + + + + + + + + + 【{{examtypename}}】 + + + + + + + + + + + + {{item.charmu}} + + + + {{item.title}} + + + + + + + + + + + + + + + + + + + + 解析笔记 + + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + +
+ + + + + + + + + + + +
diff --git a/pages/explainnote/explainnote.wxss b/pages/explainnote/explainnote.wxss new file mode 100644 index 0000000..ae84948 --- /dev/null +++ b/pages/explainnote/explainnote.wxss @@ -0,0 +1,498 @@ +.page { + background-color: #ededed; +} + +.examing { + display: flex; + flex-direction: row; + align-items: center; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + top: 0; +} + +.item1 { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; +} + +.item1 image { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; +} + +.item4 { + width: 50rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 80rpx; + +} + +.item4 image { + width: 50rpx; + height: 44rpx; + margin: 0 19rpx; +} + +.item5 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 120rpx; + +} + +.item5 image { + width: 38rpx; + height: 47rpx; + margin: 0 22rpx; +} + +.item2 { + width: 150rpx; + height: 50rpx; + margin-top: 16rpx; + margin-left: 19rpx; +} + +.item2 text { + width: 150rpx; + height: 50rpx; + color: white; +} + +.item3 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 79rpx; +} + +.item3 text { + width: 100rpx; + height: 50rpx; + color: white; +} + +.examingfooter { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + bottom: 0; +} + +.footerleft image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.footermiddle image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.footerright image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.examingcontent { + width: 700rpx; + margin: 20rpx auto; + margin-bottom: 40rpx; +} + +.examingcontent2 { + width: 700rpx; + margin: 20rpx auto; + margin-bottom: 40rpx; +} + + +.examingcontent text { + font-size: 30rpx; + font-weight: 400; + +} + +.examintcontentda { + width: 700rpx; + margin: 20rpx auto; + float: left; + margin-bottom: 40rpx; +} + +.contentleft { + float: left; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin-left: 25rpx; +} + +.contentleft image { + width: 49rpx; + height: 49rpx; +} + +.contentright { + margin-left: 25rpx; + float: left; + width: 600rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + left: 4px; + top: -31px; + text-align: center; +} + +.item2 .van-count-down { + color: white; +} + +.feigexian{ + width: 100%; + background-color: #f0f0f0; +} +.clear{ clear:both} + +.explainnotefont{ + width: 100%; + height: 100rpx; + line-height: 100rpx; +} +.explainnotefont text{ + + font-size: 40rpx; + margin-left:50rpx; +} +/* 留言区域 */ +.areaclass{ + + width: 80%; + height: 193rpx; + margin: 0 auto; + margin-top: 10rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} +.areafooterleft image{ + + width: 26rpx; + height: 26rpx; + +} +.areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} +/* 留言区域 */ +/* 笔记解释 */ +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 485rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + /* font-weight: 400rpx; */ +} + +.headrightdown { + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} +.feigexian{ + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} +.vipimage image{ + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; +} +.feigexiang{ + + width: 620rpx; + height: 10rpx; + border-bottom: 1rpx solid #dedcdc; + margin: 20rpx auto; +} +/* + 解释开始 + */ + + + .areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} +.areaclass textarea{ + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} +.areafooterleft image{ + + width: 52rpx; + height: 52rpx; + +} +.areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} +.areafooterright{ + width: 120rpx; + height: 56rpx; +} +.areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; +} +button::after { + border: none; +} + +.header_view_hide{ + display: none; +} +.header_view_show{ + display: block; +} + +/* 笔记解释 */ + + +.examingcontent { + width:100%; + margin: 80rpx auto; + /* max-height: 250rpx; + overflow: hidden; */ +} + +.examingcontent2 { + width: 100%; + margin: 80rpx auto; +} + + +.examingcontent text { + font-size: 30rpx; + font-weight: 400; + +} + +.examintcontentda { + width: 700rpx; + margin: 0 auto; + float: left; + margin-bottom: 80rpx; +} + +.contentleft { + float: left; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin-left: 25rpx; +} + +.contentleft image { + width: 49rpx; + height: 49rpx; +} + +.contentright { + margin-left: 25rpx; + float: left; + width: 600rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + left: 4px; + top: -31px; + text-align: center; +} + +.item2 .van-count-down { + color: white; +} +.headdouble{ + display: flex; + flex-direction: row; + width: 100%; + margin: 0 auto; + float: left; +} +.headdoubleleft{ + width: 25%; + float: left; +} +.headdoubleright{ + width: 85%; + float: left; +} \ No newline at end of file diff --git a/pages/goodsinfo/goodsinfo.js b/pages/goodsinfo/goodsinfo.js new file mode 100644 index 0000000..ad8d609 --- /dev/null +++ b/pages/goodsinfo/goodsinfo.js @@ -0,0 +1,68 @@ +// pages/goodsinfo/goodsinfo.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + title:'商品详情' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.setNavigationBarTitle({ + title: this.data.title, + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/goodsinfo/goodsinfo.json b/pages/goodsinfo/goodsinfo.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/goodsinfo/goodsinfo.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/goodsinfo/goodsinfo.wxml b/pages/goodsinfo/goodsinfo.wxml new file mode 100644 index 0000000..fa30d2c --- /dev/null +++ b/pages/goodsinfo/goodsinfo.wxml @@ -0,0 +1,24 @@ + + + + + + + + + 马小黑13356489245 + 广东省广州市黄埔区凤凰路99号A栋600 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/goodsinfo/goodsinfo.wxss b/pages/goodsinfo/goodsinfo.wxss new file mode 100644 index 0000000..bb78af7 --- /dev/null +++ b/pages/goodsinfo/goodsinfo.wxss @@ -0,0 +1,73 @@ +/* 商品详情头部 */ +Page { + background-color: #f1f1f1; +} + +.goodsheads { + + width: 666rpx; + height: 155rpx; + margin: 0 auto; + border: 1rpx solid #ffffff; + border-radius: 8rpx; + background-color: #ffffff; + margin-top: 20rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + margin-bottom: 100rpx; +} + +.headleft image { + + margin: 0 40rpx; + width: 56rpx; + height: 56rpx; + +} + +.headmiddle { + + width: 452rpx; + height: 90rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: left; +} + +.bigfont { + font-size: 30rpx; + color: black; +} + +.smallfont { + + margin-left: 30rpx; + font-size: 26rpx; + color: #b6b6b6; +} +.middledown{ + font-size: 26rpx; + color: black; + width: 452rpx; +} + +.headright image{ + width: 26rpx; + height: 15rpx; +} + +/* 商品详情头部 */ + +/* 商品内容页面 */ + .goodscontent{ + width: 666rpx; + margin: 0 auto; + } + .goodscontent image{ + + width: 100%; + } +/* 商品内容页面 */ \ No newline at end of file diff --git a/pages/grid/grid.js b/pages/grid/grid.js new file mode 100644 index 0000000..0a188ae --- /dev/null +++ b/pages/grid/grid.js @@ -0,0 +1,66 @@ +// pages/grid/grid.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/pages/grid/grid.json b/pages/grid/grid.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/grid/grid.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/grid/grid.wxml b/pages/grid/grid.wxml new file mode 100644 index 0000000..292e468 --- /dev/null +++ b/pages/grid/grid.wxml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pages/grid/grid.wxss b/pages/grid/grid.wxss new file mode 100644 index 0000000..5f51d73 --- /dev/null +++ b/pages/grid/grid.wxss @@ -0,0 +1 @@ +/* pages/grid/grid.wxss */ \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..25a4bae --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,484 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +const { default: toast } = require('../../miniprogram_npm/@vant/weapp/toast/toast.js'); +import { campApi } from '../../config/camp_api.js'; +Page({ + + data: { + startPageX: 0, + currentView: DEFAULT_PAGE, + livesdata: [], + baseurl: baseUrl.globalData.baseimgurl, + movies: [], + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + itemdata: [], + isdisplay: 1, + onelist: [], //一级数据 + activeshow: 1, + currentid: 1, + // 小方块数据 + blockItems: [] + }, + + // 打卡按钮点击事件 - 跳转到打卡营列表页面 + onCheckinClick() { + console.log('打卡按钮被点击'); + + // 跳转到打卡营列表页面 + wx.navigateTo({ + url: '/pages/camp_list/index', + success: () => { + console.log('跳转到打卡营列表页面成功'); + }, + fail: (err) => { + console.log('跳转失败:', err); + wx.showToast({ + title: '页面跳转失败', + icon: 'none' + }); + } + }); + }, + + // 直播按钮点击事件 + onLiveClick() { + console.log('直播按钮被点击'); + wx.showToast({ + title: '直播功能', + icon: 'none' + }); + // 这里可以添加直播相关的逻辑 + // 比如跳转到直播页面或调用直播接口 + }, + + // 获取小方块数据(使用 Fiber API) + getBlockItems() { + const that = this; + + // 使用统一的 campApi 接口(推荐打卡营) + campApi.getCamps(null) + .then((res) => { + console.log('小方块数据请求成功:', res); + + // Fiber API 返回格式:{ success: true, camps: [...] } + const camps = res.camps || []; + + if (Array.isArray(camps) && camps.length > 0) { + // 处理接口返回的数据,转换为小方块格式 + const blockItems = camps.map((item, index) => ({ + id: item.id || index + 1, + name: item.title || '未知标题', + icon: item.cover_image || 'https://ndnd.duiduiedu.com/uploads/pics/default-icon.png', + description: item.description || '', + // 保存原始数据,用于后续处理 + originalData: item + })); + + that.setData({ + blockItems: blockItems + }); + + console.log('小方块数据更新成功:', blockItems); + } else { + console.log('接口返回数据为空或格式异常:', res); + // 如果接口返回异常,显示空数据 + that.setData({ + blockItems: [] + }); + } + }) + .catch((err) => { + console.log('小方块数据请求失败:', err); + // 请求失败时显示空数据 + that.setData({ + blockItems: [] + }); + }); + }, + + + // 小方块点击事件 - 跳转到打卡营详情页面 + onBlockClick(e) { + const blockId = e.currentTarget.dataset.id; + const blockItem = this.data.blockItems.find(item => item.id == blockId); + + // console.log('小方块被点击:', blockItem); + + if (blockItem && blockItem.originalData) { + const camp = blockItem.originalData; + console.log('打卡营详情:', camp); + + // 直接跳转到打卡营详情页面 + wx.navigateTo({ + url: `/pages/camp_detail/index?id=${camp.id}&title=${encodeURIComponent(camp.title || '打卡营')}`, + success: () => { + console.log('跳转到打卡营详情页面成功:', camp.id); + }, + fail: (err) => { + console.log('跳转失败:', err); + wx.showToast({ + title: '页面跳转失败', + icon: 'none' + }); + } + }); + } else { + wx.showToast({ + title: '数据加载中...', + icon: 'none' + }); + } + }, + checkclassshow(event) { + //新增开关功能 + console.log(event); + console.log(event.currentTarget.id); + const id = event.currentTarget.id; + let arr1 = []; + let arr = []; + arr = this.data.onelist; + + // if (id == 1) { + + // arr.forEach(function (item, index) { + // console.log(item); + // if (item.id == 2) { + // arr1[index] = item; + // } + // }) + // this.setData({ + // onelist: arr1 + // }) + + // } else { + // arr.forEach(function (item, index) { + // console.log(item); + // if (item.id == 1) { + // arr1[index] = item; + // } + // }) + // this.setData({ + // onelist: arr1 + // }) + // } + + + + // arr.forEach(function (item, index) { + + // if (index == e.currentTarget.dataset.itemid) { + // item['liveclickopen'] = 2; + // arr[index] = item; + // } else { + // item['liveclickopen'] = 2; + // arr[index] = item + // } + // }) + // this.setData({ + // listdata: arr + // }) + + + }, + footeronChange(event) { + this.setData({ + footeractive: event.detail + }); + }, + onChangefooter(event) { + console.log(event.detail); + this.setData({ + footeractive: event.detail + }); + }, + onChange(event) { + wx.showToast({ + title: `切换到标签 ${event.detail.name}`, + icon: 'none', + }); + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + console.log(e.currentTarget.id); + this.getindexcoursetwo(e.currentTarget.id); + this.setData({ + active: e.currentTarget.id + }) + }, + loaditem(id) { + console.log(id); + }, + cardaddclick(e) { + + console.log(e); + + }, + challengeclickleft(e) { + console.log(e.currentTarget.id); + this.setData({ + challengeactive: e.currentTarget.id + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + //baseUrl.islogin(); + // 页面加载时获取小方块数据 + this.getBlockItems(); + }, + getpopindexcouse: function (params) { + //顶级分类 + const that = this; + let url = baseUrl.globalData.baseUrl + '/index/indexcoursetop'; + var param = { + id: '1' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + list: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getindexcourse: function () { + const that = this; + let url = baseUrl.globalData.baseUrl + '/index/indexcourse'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + list: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getindexcoursetwo: function (e) { + + //得到二级课程的数据 + const that = this; + let url = baseUrl.globalData.baseUrl + '/index/indexcoursepara'; + var param = { + pareid: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log('==================='); + console.log(res.data); + that.setData({ + onelist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.setData({ + active: 1 + }); + + // if (wx.getStorageSync('userinfo') != null) { + // baseUrl.globalData.currentuserinfo = wx.getStorageSync('userinfo'); + // wx.setStorageSync('wxopenid', wx.getStorageSync('userinfo').openid); + // } + this.isdisplay(); + wx.showShareMenu({ + withShareTicket: true, + menus: ['shareAppMessage', 'shareTimeline'] + }) + this.getpopindexcouse(); //顶级分类 + // this.getindexcourse(); //一级分类 + this.getindexcoursetwo(1); + this.adsfun(); + this.indexlives(); + this.isjumpblack(); + + }, + isjumpblack: function () { + console.log(wx.getStorageSync('userisblack')); + if (wx.getStorageSync('userisblack') == 2) { + + wx.showToast({ + title: "不允许访问该程序",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + wx.reLaunch({ + url: '/pages/userlogin/userlogin', + }) + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + indexlives: function () { + //直播列表 + const that = this; + let url = baseUrl.globalData.baseUrl + '/lives/indexlives'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + // console.log(res); + that.setData({ + livesdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + adsfun: function () { + //广告 + const that = this; + let url = baseUrl.globalData.baseUrl + '/ads/index'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + // console.log(res); + that.setData({ + movies: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + livelistclick: function () { + + if (this.data.isdisplay == 1) { + // 直播列表 + wx.navigateTo({ + url: '/pages/indexlives/indexlives', + }) + } else { + wx.showToast({ + title: `功能正在开发中`, + icon: 'none', + }); + } + }, + messageclick: function () { + + wx.navigateTo({ + url: '/pages/messagelist/messagelist', + }) + }, + resclick: function () { + wx.navigateTo({ + url: '/pages/indexreslists/indexreslists', + }) + }, + courselearningclick: function (e) { + + //课程学习 + console.log(e.currentTarget.id); + wx.navigateTo({ + url: '/pages/communityitemlist/communityitemlist?typeid=' + e.currentTarget.id, + }) + }, + picsclick: function (e) { + console.log(e); + if (this.data.isdisplay == 1) { + console.log(e.currentTarget.id); + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=' + e.currentTarget.id, + }) + } + + }, + isdisplay: function (params) { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/index/isdisplay'; + var param = { + pareid: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + isdisplay: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + onShareAppMessage: function (options) {//分享onShareAppMessage + return { + title: '怼怼公考', + path: `/pages/index/index`, + success: function (res) { + console.log(res, '成功') + console.info(res + '成功'); + wx.showToast({ + title: '分享成功', + }) + // 转发成功 + }, + fail: function (res) { + console.log(res + '失败'); + // 转发失败 + }, + complete: function (res) { + // 不管成功失败都会执行 + console.log(res, '成功或失败') + wx.showToast({ + title: '成功或失败', + }) + } + } + } + +}) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..da483a3 --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "怼学习", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..00b62bc --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + {{item.name}} + {{item.description}} + + + + + + + + + + + + 打卡 + > + + + + + + + + 直播 + > + + + + + + + + + + + + + + + +

{{livesdata.name}}

+
+ + + {{livesdata.author}} + + + {{livesdata.times}} + + + + {{livesdata.intro}} + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + + + + + + + + + +
\ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..e624567 --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,538 @@ +/* 左右布局容器 - 使用 swiper 的宽高 */ +.layout-container { + width: 666rpx; + height: 218rpx; + margin: 0 auto; + display: flex; + flex-direction: row; + gap: 20rpx; +} + +/* 左侧主内容区域 - 占 3/4 宽度 */ +.main-content-area { + width: 75%; /* 3/4 宽度 */ + height: 100%; + border: 2rpx solid #1ccfd6; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + background: #ffffff; + box-shadow: 0 4rpx 12rpx rgba(28, 207, 214, 0.1); +} + +/* 小方块容器样式 */ +.blocks-container { + width: 100%; + height: 100%; + white-space: nowrap; /* 防止换行 */ +} + +/* 小方块样式 */ +.block-item { + display: inline-flex; /* 使用 inline-flex 实现横向排列和内部 flex 布局 */ + flex-direction: column; + align-items: center; + justify-content: center; + width: 200rpx; + height: calc(100% - 40rpx); /* 填满剩余高度,减去上下边距 40rpx */ + margin: 20rpx; /* 上下左右边距都是 20rpx */ + margin-right: 0rpx; + background: #ffffff; + border: 2rpx solid #1ccfd6; /* 优化边框颜色,使用品牌色 */ + border-radius: 12rpx; + box-shadow: 0 2rpx 8rpx rgba(28, 207, 214, 0.15); /* 优化阴影颜色 */ + vertical-align: top; /* 顶部对齐 */ + transition: all 0.3s ease; +} + +.block-item .block-icon { + width: calc(100% - 20rpx); /* 占满小方块宽度,减去左右内边距 */ + height: 100rpx; /* 固定高度 */ + /* margin-bottom: 15rpx; 增加图标与文字之间的间距 */ + display: flex; + align-items: center; + justify-content: center; +} + +.block-item .block-text { + font-size: 26rpx; /* 增加字体大小 */ + color: #333; + text-align: center; + line-height: 1.2; + max-width: 200rpx; /* 增加文字最大宽度,适应更宽的方块 */ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin: 0 auto; /* 水平居中 */ + font-weight: 500; /* 增加字体粗细 */ + margin-top: 5rpx; +} + +/* 方块描述文字 */ +.block-item .block-desc { + font-size: 20rpx; /* 增加描述文字大小 */ + color: #666; + text-align: center; + line-height: 1.2; + max-width: 200rpx; /* 增加描述文字最大宽度 */ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin: 6rpx auto 0; /* 增加顶部间距 */ + display: block; +} + +.block-item:first-child { + margin-left: 20rpx; +} + +.block-item:last-child { + margin-right: 20rpx; +} + +.block-item:active { + transform: scale(0.95); + box-shadow: 0 4rpx 12rpx rgba(28, 207, 214, 0.25); /* 优化点击阴影颜色 */ +} + +/* 方块图标图片 */ +.block-icon image { + width: 100%; /* 占满图标容器的宽度 */ + height: 100%; /* 占满图标容器的高度 */ + object-fit: cover; /* 保持图片比例,裁剪多余部分 */ + border-radius: 8rpx; /* 添加圆角 */ +} + +/* 右侧功能按钮区域 - 占 1/4 宽度 */ +.function-buttons { + width: 25%; /* 1/4 宽度 */ + height: 100%; + display: flex; + flex-direction: column; + gap: 20rpx; + box-sizing: border-box; /* 确保边框和内边距包含在宽度内 */ + min-width: 0; /* 允许 flex 子元素收缩 */ +} + +.function-btn { + width: 100%; + height: 50%; /* 每个按钮占一半高度 */ + border-radius: 12rpx; + display: flex; + align-items: center; + padding: 0 10rpx; + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1); + transition: all 0.3s ease; + box-sizing: border-box; /* 确保 padding 不会增加总宽度 */ + overflow: hidden; /* 防止内容溢出 */ +} + +.function-btn:active { + transform: scale(0.95); +} + +/* 打卡按钮样式 */ +.checkin-btn { + border: 2rpx solid #1ccfd6; + background: #ffffff; +} + +.checkin-btn .btn-icon image { + width: 24rpx; + height: 24rpx; +} + +/* 直播按钮样式 */ +.live-btn { + border: 2rpx solid #ff6b9d; + background: #ffffff; +} + +.live-btn .btn-icon image { + width: 24rpx; + height: 24rpx; +} + +/* 按钮内部元素 */ +.btn-icon { + margin-right: 6rpx; + display: flex; + align-items: center; + flex-shrink: 0; /* 图标不缩放 */ +} + +.btn-text { + flex: 1; + font-size: 22rpx; + color: #333; + font-weight: 500; + white-space: nowrap; /* 防止文字换行 */ + overflow: hidden; /* 隐藏溢出文字 */ + text-overflow: ellipsis; /* 超出显示省略号 */ +} + +.btn-arrow { + font-size: 18rpx; + color: #999; + font-weight: bold; + flex-shrink: 0; /* 箭头不缩放 */ + margin-left: 4rpx; +} + +.swiper { + height: 218rpx; + width: 666rpx; + margin: 0 auto; +} + +.swiper image { + height: 100%; + width: 100%; +} +.cardgongneng{ + display: flex; + flex-wrap: wrap; + align-content: center; + justify-content:space-between; + height: 170rpx; + width: 666rpx; + margin: 25rpx auto; + border: 1rpx solid #e7d1d1; + border-radius: 2%; + box-shadow:1px 1px 1px 1px rgb(236, 234, 234); +} +.cardgongneng2{ + display: flex; + flex-wrap: wrap; + align-content: center; + justify-content:space-between; + height: 170rpx; + width: 570rpx; + margin: 0 auto; +} +.cardgongneng2 image{ + width: 85rpx; + height: 100rpx; + +} +.zhibocss { + display: flex; + flex-wrap: wrap; + align-content: flex-start; + height: 180rpx; + width: 666rpx; + margin: 50rpx auto; + background: url(https://ndnd.duiduiedu.com/uploads/pics/line.png); + background-repeat: no-repeat; + background-size: 666rpx 180rpx; + display: none; +} + +.item1 { + + width: 50rpx; + height: 150rpx; + box-sizing: border-box; + margin: 15rpx 16rpx; +} + +.itemhead { + margin-top: 20rpx; + margin-left: 20rpx; +} + +.itemhead h2 { + + font-weight: 600; + font-family: 'Arial Narrow', Arial; + font-size: large; +} + +.item1 image { + width: 50rpx; + height: 150rpx; +} + +.item2 { + width: 160rpx; + height: 160rpx; +} + +.item2 image { + margin-left: 10rpx; + width: 150rpx; + height: 160rpx; +} + +.item3 { + width: 334rpx; + height: 170rpx; +} + +.item4 { + padding-top: 10rpx; + padding-left: 15rpx; + width: 75rpx; + height: 164rpx; +} + +.item4 image { + + width: 75rpx; + height: 164rpx; +} + +.itemmiddle { + display: flex; + margin-left: 15rpx; + width: 334rpx; + height: 50rpx; +} + +.itemmiddleleft { + display: flex; + margin-top: 10rpx; + flex-direction: row; +} + +.itemmiddleleft text { + color: #AEAEAE; + align-items: center; + font-size: 24rpx; + font-weight: 400; +} + +.itemmiddleleft image { + + width: 30rpx; + height: 30rpx; + padding-right: 10rpx; +} + +.itemmiddleright { + display: flex; + margin-top: 10rpx; + margin-left: 10rpx; + flex-direction: row; +} + +.itemmiddleright text { + color: #AEAEAE; + align-items: center; + font-size: 24rpx; + font-weight: 400; +} + +.itemmiddleright image { + + width: 30rpx; + height: 30rpx; + padding-right: 10rpx; +} + +.itemend { + width: 300rpx; + overflow: hidden; + color: #AEAEAE; + line-height: 28rpx; + margin-bottom: 10rpx; + margin-left: 20rpx; + font-size: 18rpx; +} + +.curriculum { + + margin: 0 auto; + /* margin-top: 20rpx; */ + width: 686rpx; + /* height: 350rpx; */ + /* margin-bottom: 80rpx; */ +} + +.curriculumup { + + width: 750rpx; + height: 55rpx; +} + +.curriculumupstart { + float: left; + width: 660rpx; + height: 55rpx; + margin-top: 20rpx; + margin-bottom: 10rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.card { + display: flex; + justify-content: center; + align-items: center; + box-sizing: border-box; + height: 55rpx; + line-height: 55rpx; + /* margin: 100rpx 200rpx; */ + font-size: 20px; + /* padding-left: 20rpx; + padding-right: 30rpx; */ + margin-left: 10rpx; + border-radius: 4px; +} +.curriculumdown { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 666rpx; + /* height: 295rpx; */ +} + +.curriculumitem { + display: flex; + flex-direction: column; + /* width: 33%; */ + width: 33%; + height: 150rpx; + align-items: center; + margin-top: 20rpx; + /* margin-bottom: 20rpx; */ +} + +.downup { + width: 90rpx; + height: 80rpx; + text-align: center; +} + +.downup image { + width: 80rpx; + height: 90rpx; + text-align: center; +} + +.downdown { + margin-top: 15rpx; + text-align: center; + width: 180rpx; + height: 30rpx; +} + +.downdown text { + font-size: 20rpx; + +} + + + +.curriculumupend image { + width: 50rpx; + height: 50rpx; +} + +.challenge { + width: 666rpx; + margin: 0 auto; + height: 83rpx; +} + +.challengeleft { + + float: left; + width: 429rpx; + height: 80rpx; + +} + +.challengeleft image { + + width: 440rpx; + height: 80rpx; +} + +.challengeright { + float: left; + width: 238rpx; + height: 80rpx; +} + +.challengeright image { + + width: 240rpx; + height: 80rpx; +} + + +.challenge2 { + width: 666rpx; + margin: 0 auto; + height: 83rpx; +} + +.challenge2left { + + float: left; + + width: 238rpx; + height: 80rpx; + +} + +.challenge2left image { + + + width: 253rpx; + height: 80rpx; +} + +.challenge2right { + float: left; + width: 429rpx; + height: 80rpx; +} + +.challenge2right image { + + width: 432rpx; + height: 80rpx; +} + +.van-tabbar-item { + height: 298rpx; + width: 130rpx; +} + +/***parent**/ +.parentclass { + margin: 0 auto; + width: 666rpx; +} +.parentimage{ + width: 200rpx; + height: 30rpx; + margin-top: 10rpx; + +} +.parentimage image{ + width: 200rpx; + height: 30rpx; +} diff --git a/pages/indexclass/indexclass.js b/pages/indexclass/indexclass.js new file mode 100644 index 0000000..11711c8 --- /dev/null +++ b/pages/indexclass/indexclass.js @@ -0,0 +1,634 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [], //图片预览 + showview: false, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 1, + accesstoken: '', + typeid: wx.getStorageSync('jmparm') == null ? 1 : wx.getStorageSync('jmparm'), + page: 1, //页面数, + pagecount: 0, + classintorgg: [], + classid:1 + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log("=-=-=-=-=-=-=========----------"); + console.log(options.id); + if (options.id > 0) { + this.setData({ + active: options.id == '' ? 1 : options.id, + page: 1, + typeid: wx.getStorageSync('jmparm'), + classid:options.id + }) + } + + }, + displayview: function () { + wx.navigateTo({ + url: '/pages/indexcreatewords/indexcreatewords?typeid=' + this.data.typeid, + }) + + }, + contentclick: function (params) { + + let id = params.currentTarget.id; + let xid = params.currentTarget.dataset.xid; + + this.setData({ + wordstextname: '@' + id + }); + + this.addinccomment(xid) + wx.showToast({ + title: '@成功,请移底部留言', //提示文字 + duration: 2000, //显示时长 + mask: true, //是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'success', //图标,支持"success"、"loading" + success: function () {}, //接口调用成功 + fail: function () {}, //接口调用失败的回调函数 + complete: function () {} //接口调用结束的回调函数 + }) + + // this.pageScrollToBottom(); + + }, + addinccomment: function (params) { + //增加评论数 + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/addcommentrepycount'; + var param = { + id: params, + userid: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + // pageScrollToBottom() { + // wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + // // rect.id // 节点的ID + // rect.dataset // 节点的dataset + // rect.left // 节点的左边界坐标 + // rect.right // 节点的右边界坐标 + // rect.top // 节点的上边界坐标 + // rect.bottom // 节点的下边界坐标 + // rect.width // 节点的宽度 + // rect.height + // console.log(rect.bottom*15) + // console.log(rect.bottom) + // // 使页面滚动到底部 + // wx.pageScrollTo({ + // scrollTop: rect.bottom*15 + // }) + // }).exec() + // }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + Apps.islogin(); + this.setData({ + active: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm'), + typeid: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm') + }) + //头部消息 + this.msglist(); + //留言类型 + this.wrodtypelist(); + //回复留言列表 + this.getwords(); + this.getclassintro(this.data.classid); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + + wx.setStorageSync('jmparm', e.currentTarget.id); + this.setData({ + active: e.currentTarget.id, + typeid: e.currentTarget.id + }) + this.getwords(); + }, + duizhiticlick: function () { + wx.navigateTo({ + url: '/pages/allpapers/allpapers', + }) + }, + messagelistclick: function () { + wx.navigateTo({ + url: '/pages/messagelist/messagelist', + }) + }, + communityinfoclick: function (e) { + + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + }) + }, + communityinfocommentclick: function (e) { + + wx.navigateTo({ + //communityinfocomment + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id + '&jztype=2', + }) + }, + messagelistclick: function (e) { + //资讯列表分类 + wx.navigateTo({ + url: '/pages/messagelist/messagelist?typeid=' + e.currentTarget.id, + }) + }, + messageclick: function (e) { + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=' + e.currentTarget.id, + }) + }, + msglist: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/msglist/msgindexlist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + messagelist: res.data.sort() + + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wrodtypelist: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclass/getindexclasstype'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + that.setData({ + list: res.data, + active: this.data.active + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwordspics: function (id) { + //得到单个信息图片数 + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/getwordssingle'; + var param = { + id: id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + console.log(res.data.pics); + that.setData({ + imageslists: res.data.pics, + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getclassintro: function (params) { + //得到用户公告 + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/getclassgg'; + var param = { + classid: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + let counts = res.data.length; + that.setData({ + classintorgg: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwords: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/getwords'; + var param = { + typeid: that.data.typeid, + page: that.data.page + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + let counts = res.data.length; + that.setData({ + replylist: res.data, + pagecount: counts == 0 ? 1 : counts + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsclick: function (ee) { + + let e1 = ee.currentTarget.id; + let e2 = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/wordsclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + //头部消息 + that.msglist(); + //留言类型 + that.wrodtypelist(); + that.getwords(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + bindTextAreaBlur: function (e) { + this.setData({ + wordstextname: e.detail.value + }) + }, + preview: function (params) { + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let picsid = params.currentTarget.dataset.pics; //单条信息ID + + // that.getwordspics(picsid); //得到单条信息图片 + console.log(that.data.replylist[picsid]); + let rearr = that.data.replylist[picsid].pics; + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + console.log('-----'); + console.log(arr); + + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + getmsgcheck: function (params, accesstoken) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + // let url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + console.log(res.errcode); + if (res.errcode == "0") { + that.wordsadd(params, that.data.imagestr) + } else { + + wx.showToast({ + title: '留言内容有敏感词请重新输入', //提示文字 + duration: 2000, //显示时长 + mask: true, //是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () {}, //接口调用成功 + fail: function () {}, //接口调用失败的回调函数 + complete: function () {} //接口调用结束的回调函数 + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/indexclasslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + } + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/wordsxqadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordstype_ids: this.data.typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + this.getwords(); + + that.setData({ + wordstextname: '' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + formSubmit: function (e) { + + this.getacctoken(); + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + this.getmsgcheck(content, this.data.accesstoken); + }, + // 触底加载 + onReachBottom: function () { + + this.setData({ + page: this.data.page + 1 + }) + let newpage = (this.data.page + 1); //页数触底加1 + console.log(newpage); + if (newpage * 10 >= this.data.pagecount) { + + wx.showToast({ + title: '触底了,没有可加载的数据了', + icon: 'none', + duration: 1500 + }) + + } else { + this.getwords(); + } + + }, + clickmyroom: function (params) { + console.log(params.currentTarget.id); + console.log(this.data.classid); + console.log("-----------------------"); + // wx.navigateTo({ + // url: '/pages/indexclasszx/indexclasszx?myclassid=' + params.currentTarget.id, + // }) + wx.navigateTo({ + url: '/pages/classindex/classindex?classid='+this.data.classid, + }) + }, + clickclassintro: function (params) { + + const id = params.currentTarget.id; + var urlpath = ""; + if (id == 1) { + urlpath = "/pages/indexclassintro/indexclassintro?id="+ this.data.classid + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + } else if (id == 2) { + //indexreslistsnew + urlpath = "/pages/indexreslistsnew/indexreslistsnew?id=" + this.data.classid + // urlpath = "/pages/indexclassres/indexclassres?id=" + this.data.classid + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + } else if (id == 3) { + + urlpath = "/pages/indexjobtask/indexjobtask?id=" + this.data.classid + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + } else if (id == 4) { + urlpath = "/pages/indexobjectactivelist/indexobjectactivelist?id=" + this.data.classid + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + } else if (id == 5) { + urlpath = "/pages/indexclasssubwork/indexclasssubwork?id=" + this.data.classid + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + } + + } +}) \ No newline at end of file diff --git a/pages/indexclass/indexclass.json b/pages/indexclass/indexclass.json new file mode 100644 index 0000000..092f639 --- /dev/null +++ b/pages/indexclass/indexclass.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "班级", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/indexclass/indexclass.wxml b/pages/indexclass/indexclass.wxml new file mode 100644 index 0000000..90add91 --- /dev/null +++ b/pages/indexclass/indexclass.wxml @@ -0,0 +1,118 @@ + + + + + + + + + {{classintorgg['intro']}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + {{item.plcommentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + +
\ No newline at end of file diff --git a/pages/indexclass/indexclass.wxss b/pages/indexclass/indexclass.wxss new file mode 100644 index 0000000..206b9cb --- /dev/null +++ b/pages/indexclass/indexclass.wxss @@ -0,0 +1,431 @@ +.courselive { + width: 750rpx; + height: 403rpx; + } + + .functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; + } + + .areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; + } + + .areaitem image { + width: 120rpx; + height: 170rpx; + } + + .messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; + } + + .msseagehead { + display: flex; + flex-direction: row; + } + + .headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; + } + + .headleft image { + + width: 130rpx; + height: 133rpx; + } + + .headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; + } + + .headrightup text { + + font-size: 30rpx; + font-weight: 400rpx; + } + + .headrightdown { + font-size: 30rpx; + margin-top: 10rpx; + } + + .msseagemiddle { + margin: 0 60rpx; + } + + .mssagemiddledown { + margin: 25rpx auto; + } + + .mssagemiddledown image { + + width: 100%; + height: 265rpx; + } + + .mssagemiddledownone image { + width: 100%; + } + + .messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + + } + + .messageendleft { + width: 150rpx; + height: 30rpx; + } + + .messageendleft image { + width: 100rpx; + height: 30rpx; + } + + .messageendmiddle { + width: 150rpx; + height: 30rpx; + } + + .messageendmiddle image { + width: 35rpx; + height: 30rpx; + } + + .messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .messageendright { + + width: 150rpx; + height: 30rpx; + } + + .messageendright image { + width: 35rpx; + height: 30rpx; + + } + + .messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; + } + + .areaclass { + + width: 540rpx; + height: 193rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; + } + + .areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; + } + + .areafooterleft image { + + width: 26rpx; + height: 26rpx; + + } + + .areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; + } + + .vipimage image { + width: 37rpx; + height: 33rpx; + position: relative; + left: -32rpx; + top: 148rpx; + } + + /* 社区头部 */ + .communityhead { + width: 690rpx; + height: 210rpx; + margin: 0 auto; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + } + + .communityheadleft { + + width: 75rpx; + height: 195rpx; + background-size: 100% 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + .communityheadleft image{ + + width: 75rpx; + height: 195rpx; + } + .communityheadmiddle{ + width: 450rpx; + height: 195rpx; + border-radius: 5%; + margin-left:20rpx; + background-color: #D3FDFF; + } + .communityheadmiddle text{ + display: block; + color:#02BBC2; + font-size: 28rpx; + font-weight: 400; + padding-top:32rpx; + padding-left: 32rpx; + } + + .containerclass{ + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin: 0 auto; + width: 690rpx; + height: 180rpx; + margin-top:65rpx; + margin-bottom:50rpx; + border: 1rpx solid #d6cfcf; + border-radius: 2%; + box-shadow: 3px 3px 3px 3px rgb(236, 234, 234); + } + .containerclass image{ + margin-left: 20rpx; + width: 89rpx; + height: 108rpx; + margin-right: 20rpx; + } + + .communityheadright { + width: 140rpx; + height: 195rpx; + margin-left: 20rpx; + } + .communityheadright image { + width: 140rpx; + height: 195rpx; + } + + .communityheadleftitem1 { + width: 240rpx; + margin-left: 55rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + } + + .communityheadleftitem2 { + width: 80rpx; + height: 180rpx; + } + + .communityheadleftitem2 image { + width: 80rpx; + height: 175rpx; + } + + .messageitem { + width: 240rpx; + height: 38rpx; + /* border: 1rpx solid #1ccfd6; */ + color: #1ccfd6; + margin-bottom: 10rpx; + text-align: center; + overflow: hidden; + } + + /* 社区头部 */ + + /* 社区滑动 */ + .curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; + } + + .curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; + } + + .curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; + } + + .scroll-box { + white-space: nowrap; + height: 100%; + } + + .card-box { + display: inline-block; + margin-right: 10rpx; + } + + .card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; + } + + .lineclass { + width: 685rpx; + margin: 2rpx auto; + border-bottom: 1rpx solid #dcdcdc; + } + + /* 社区滑动 */ + + /* 补充留言信息右边 */ + .itemright { + width: 200rpx; + margin-top: 50rpx; + margin-left: 30rpx; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + } + + .itemright image { + + margin-left: 10rpx; + width: 70rpx; + height: 35rpx; + } + + /* 补充留言信息右边 */ + + .header_view_hide{ + display: none; + } + .header_view_show{ + display: block; + } + + .round-click{ + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; + } + .round-click image{ + height: 61rpx; + line-height: 61rpx; + width: 54rpx; + } + + .areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; + } + .areaclass textarea{ + width: 540rpx; + min-height: 300rpx; + } + + + .areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; + } + .areafooterleft image{ + + width: 52rpx; + height: 52rpx; + + } + .areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; + } + .areafooterright{ + width: 120rpx; + height: 56rpx; + } + .areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; + } \ No newline at end of file diff --git a/pages/indexclassintro/indexclassintro.js b/pages/indexclassintro/indexclassintro.js new file mode 100644 index 0000000..f70fed3 --- /dev/null +++ b/pages/indexclassintro/indexclassintro.js @@ -0,0 +1,353 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [], //图片预览 + showview: false, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 1, + accesstoken: '', + typeid: wx.getStorageSync('jmparm') == null ? 1 : wx.getStorageSync('jmparm'), + page: 1, //页面数, + pagecount: 0, + itemdata:[], + userctive:1, //1退出,2加入 + showdiage:false, + payid:0, //支付ID + totalmoney:0.01, //多少费用 + showdduihuan:false, + valueduihuanma:'' //后台兑换码 + + }, + onCloseduihuan:function (params) { + this.setData({ showduihuan: false }); + }, + duihuanmoney:function (params) { + this.setData({ + showdduihuan: true, + showdiage: false, + }); + }, + onChangeduihuan:function (params) { + console.log("用户已输入兑换码"); + console.log(params.detail); + this.setData({ + valueduihuanma :params.detail, + }) + + }, + querybtn:function (params) { + //确认兑换码 + console.log("确认数据"); + console.log(params); + console.log(this.data.valueduihuanma); + console.log(this.data.payid); + this.duihuanmadui(this.data.valueduihuanma,this.data.payid); + }, + + duihuanmadui:function (valueduihuanma,indexclasslist_id) { + //确认兑换码 + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/userduihuanma'; + var param = { + namenum:valueduihuanma, + indexclasslist_id:indexclasslist_id, + user_id:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + wx.reLaunch({ + url: '/pages/indexsq/indexsq', + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options.id); + if (options.id > 0) { + this.setData({ + active: options.id == 1 ? 1 : options.id, + }) + } + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + Apps.islogin(); + console.log(this.data.active); + this.haveindexclassuser(this.data.active); + this.getpaper(this.data.active); //班级列表 1全部,2我的班级 + + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + onshowdiageClose() { + this.setData({ showdiage: false }); + }, + showdiagePopup(e) { + console.log(e); + let pathid=e.currentTarget.id; + + this.setData({ showdiage: true,pathid:pathid }); + + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + exithaveclass:function (params) { + + const that = this; + wx.showModal({ + title: '退出提示', + content: '您将退出该班级', + cancelText: '退出', + confirmText: '确认', + success: function (res) { + if (res.cancel) { + //这个跳转是左边按钮的跳转链接 + //这里取消操作 + console.log(res); + + } else { + that.proexitexam(params); + } + + } + }) + + }, + proexitexam:function(params){ + + console.log(params.currentTarget.id); + const id=params.currentTarget.id; + const that = this; + let url = Apps.globalData.baseUrl + '/indexclass/exitindexclasslist'; + var param = { + id:id, + user_id:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + wx.reLaunch({ + url: '/pages/indexsq/indexsq', + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + haveindexclassuser: function (par) { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclass/haveindexclasslist'; + var param = { + id: par, + user_id:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log("232222222222222"); + console.log(res); + that.setData({ + userctive: res + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getpaper:function(params) { + const that = this; + let url = Apps.globalData.baseUrl + '/indexclass/indexclassfind'; + var param = { + id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log('res=================='); + console.log(res); + that.setData({ + itemdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + jonclass1:function(par){ + console.log("跳转"); + console.log(par.currentTarget.dataset.money); + let money=par.currentTarget.dataset.money; + console.log(par.currentTarget.id); + let payid=par.currentTarget.id; + this.setData({ + showdiage: true, + payid:payid, + totalmoney:money + }); + }, + payclassmoney:function(e){ + //微信支付 + console.log("微信支付"); + console.log(this.data.payid); + this.payorderclick(this.data.payid,this.data.totalmoney); + }, + payorderclick: function (id,money) { + + + const that = this; + let url = Apps.globalData.baseUrl + '/wxpay/makerorder'; + var param = { + id: id, + openid: wx.getStorageSync('wxopenid'), + paytypeid: 3, //加入班级 + user_id: wx.getStorageSync('wxuserid') == null ? 3 : wx.getStorageSync('wxuserid'), + vipsmonth: money + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + var rest = res; + // var orders = res.data.orders; + // 调用支付接口开始 + wx.requestPayment({ + timeStamp: rest.timeStamp, + nonceStr: rest.nonceStr, + package: rest.package, + signType: rest.signType, + paySign: rest.paySign, + success: function (res) { + + wx.setStorage("jmparm",2); + wx.reLaunch({ + url: '/pages/indexsq/indexsq', + }) + }, + fail: function (res) { + console.log(res) + }, + complete: function (res) { + console.log(res) + }, + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + jonclass:function(params) { + //加入学习 + console.log(params.currentTarget.id); + const that = this; + let url = Apps.globalData.baseUrl + '/indexclass/addindexclasslist'; + var param = { + id: params.currentTarget.id, + user_id:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log('res=================='); + console.log(res); + + if(res>0){ + wx.setStorageSync('jmparm', 2); + wx.reLaunch({ + url: '/pages/indexsq/indexsq', + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + examingbtnclick:function (params) { + + wx.navigateTo({ + url: '/pages/indexclass/indexclass?id='+params.currentTarget.id + }) + } +}) \ No newline at end of file diff --git a/pages/indexclassintro/indexclassintro.json b/pages/indexclassintro/indexclassintro.json new file mode 100644 index 0000000..8a2c056 --- /dev/null +++ b/pages/indexclassintro/indexclassintro.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh":true, + "navigationBarTitleText": "班级介绍" + } \ No newline at end of file diff --git a/pages/indexclassintro/indexclassintro.wxml b/pages/indexclassintro/indexclassintro.wxml new file mode 100644 index 0000000..10c4acd --- /dev/null +++ b/pages/indexclassintro/indexclassintro.wxml @@ -0,0 +1,54 @@ + + + + + + + + {{item.name}} + + + + + 报名时间: {{item.bmclass}} + + + 开班时间: {{item.startclass}} + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/indexclassintro/indexclassintro.wxss b/pages/indexclassintro/indexclassintro.wxss new file mode 100644 index 0000000..15bde82 --- /dev/null +++ b/pages/indexclassintro/indexclassintro.wxss @@ -0,0 +1,564 @@ +/* pages/indexsq/indexsq.wxss */ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + font-weight: 400rpx; +} + +.headrightdown { + font-size: 30rpx; + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.mssagemiddledownone image { + width: 100%; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.areaclass { + + width: 540rpx; + height: 193rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 26rpx; + height: 26rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.vipimage image { + width: 37rpx; + height: 33rpx; + position: relative; + left: -32rpx; + top: 148rpx; +} + +/* 社区头部 */ +.communityhead { + width: 695rpx; + height: 210rpx; + margin: 0 auto; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + background: url('https://ndnd.duiduiedu.com/uploads/pics/communtlistheadleft.png') no-repeat; + background-size: 100% 100%; +} + +.communityheadleft { + width: 680rpx; + height: 210rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.communityheadright { + width: 232rpx; + height: 206rpx; + margin-left: 40rpx; +} + +.communityheadrightup { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; +} + +.communityheadrightup image { + width: 240rpx; + height: 80rpx; +} + +.communityheadrightdown { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; +} + +.communityheadrightdown image { + width: 240rpx; + height: 80rpx; +} + +.communityheadleftitem1 { + width: 550rpx; + margin-left: 65rpx; + display: flex; + flex-direction: column; + justify-content: left; + align-items: left; +} + +.communityheadleftitem2 { + width: 100rpx; + height: 210rpx; +} + +.communityheadleftitem2 image { + width: 100rpx; + height: 210rpx; +} + +.messageitem { + width: 400rpx; + height: 38rpx; + border: 1rpx solid #1ccfd6; + color: #1ccfd6; + margin-left: 40rpx; + margin-bottom: 10rpx; + text-align: left; + overflow: hidden; +} + +/* 社区头部 */ + +/* 社区滑动 */ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; +} + +.curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; + margin-right: 10rpx; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.lineclass { + width: 685rpx; + margin: 2rpx auto; + border-bottom: 1rpx solid #dcdcdc; +} + +/* 社区滑动 */ + + + +/* 补充留言信息右边 */ + +.header_view_hide { + display: none; +} + +.header_view_show { + display: block; +} + +.round-click { + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; +} + +.round-click image { + height: 61rpx; + line-height: 61rpx; + width: 54rpx; +} + +.areaclass { + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areaclass textarea { + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 52rpx; + height: 52rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.areafooterright { + width: 120rpx; + height: 56rpx; +} + +.areafooterright button { + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border: none; +} + + +.challenge { + + width: 666rpx; + margin: 0 auto; + margin-top: 35rpx; + margin-bottom: 15rpx; + height: 83rpx; +} + +.challengeleft { + + float: left; + width: 429rpx; + height: 80rpx; + +} + +.challengeleft image { + + width: 440rpx; + height: 80rpx; +} + +.challengeright { + + float: left; + width: 238rpx; + height: 80rpx; +} + +.challengeright image { + + width: 240rpx; + height: 80rpx; +} + + +.challenge2 { + + width: 666rpx; + margin: 0 auto; + margin-top: 35rpx; + margin-bottom: 15rpx; + height: 83rpx; +} + +.challenge2left { + + float: left; + + width: 238rpx; + height: 80rpx; + +} + +.challenge2left image { + + + width: 253rpx; + height: 80rpx; +} + +.challenge2right { + float: left; + width: 429rpx; + height: 80rpx; +} + +.challenge2right image { + + width: 432rpx; + height: 80rpx; +} + +.examitemlist { + display: flex; + flex-direction: row; + align-items: center; + width: 690rpx; + height: 142rpx; + margin: 0 auto; + margin-top: 28rpx; + background-color: #f0f0f0; + background: url('https://ndnd.duiduiedu.com/uploads/pics/classintro.png') no-repeat; + background-size: 100% 100%; +} + +.itemleft image { + + margin: 10rpx 40rpx; + width: 106rpx; + height: 95rpx; +} + +.itemright { + display: flex; + width: 500rpx; + justify-items: center; + align-items: left; +} + +.itemright text { + margin-left: 60rpx; + font-size: 40rpx; + font-weight: 400; +} + +.bmclass { + display: flex; + flex-direction: column; + justify-content: center; + align-items: left; + width: 690rpx; + height: 88rpx; + margin: 20rpx auto; + background-color: #E2FEFF; + border-radius: 10%; +} + +.bmclass text { + + margin-left: 30rpx; + color: #1CCFD6; + font-size: 35rpx; + font-weight: 400; +} + +.kbclass { + display: flex; + flex-direction: column; + justify-content: center; + align-items: left; + width: 690rpx; + height: 88rpx; + margin: 20rpx auto; + background-color: #E2FEFF; + border-radius: 10%; +} + +.kbclass text { + + margin-left: 30rpx; + color: #1CCFD6; + font-size: 35rpx; + font-weight: 400; +} + +.bmclassselect{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: left; + width: 690rpx; + height: 123rpx; + margin: 20rpx auto; +} + +.bmclassselect image{ + + width: 690rpx; + height: 123rpx; +} \ No newline at end of file diff --git a/pages/indexclassres/indexclassres.js b/pages/indexclassres/indexclassres.js new file mode 100644 index 0000000..dabdf5b --- /dev/null +++ b/pages/indexclassres/indexclassres.js @@ -0,0 +1,195 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + startPageX: 0, + currentView: DEFAULT_PAGE, + baseurl: baseUrl.globalData.baseimgurl, + movies: [], + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + itemdata: [], + resfiles_id: 1, + pathid: "", + showdiage: false, + indexclassrestype_id:0, + classid:0, + classname:'' + }, + getclasstypename:function(classid){ + //班级类型名称 + const that = this; + let url = baseUrl.globalData.baseUrl + '/indexclassres/getindexclassname'; + var param = { + classid: classid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + classname: res.data + }); + wx.setNavigationBarTitle({ + title: res.data}) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getpaperattrlist: function (params,indexclassrestype_id) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/indexclassres/getindexclassreslist'; + var param = { + classid: params, + indexclassrestype_id:indexclassrestype_id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + itemdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + this.setData({ + classid: options.classid, + indexclassrestype_id:options.indexclassrestype_id + }) + + }, + onshowdiageClose() { + console.log('324323222222') + this.setData({ + showdiage: false + }); + console.log(this.data.showdiage) + }, + downfilepoto: function (knowfiles) { + + // let files = knowfiles.currentTarget.id; + let files = this.data.pathid + wx.downloadFile({ + url: files, + success(res) { + wx.openDocument({ + filePath: res.tempFilePath, + showMenu: true, //关键点 + success() { + } + }) + } + }) + }, + downfile: function (knowfiles) { + + let files = this.data.pathid;// knowfiles.currentTarget.id; + + wx.downloadFile({ + url: files, + success(res) { + + wx.shareFileMessage({ + filePath: res.tempFilePath, + success() { }, + fail: console.error, + }) + + } + }) + }, + showdiagePopup(e) { + console.log(e); + let pathid = e.currentTarget.id; + + let files = pathid; // knowfiles.currentTarget.id; + if (files.length == 0) { + + wx.showToast({ + title: '暂时还没有讲义,不可下载',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } else { + this.setData({ showdiage: true, pathid: pathid }); + } + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.getclasstypename(this.data.indexclassrestype_id); + this.getpaperattrlist(this.data.classid,this.data.indexclassrestype_id); + console.log("this.data.classname========") + console.log(this.data.classname) + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, +}) \ No newline at end of file diff --git a/pages/indexclassres/indexclassres.json b/pages/indexclassres/indexclassres.json new file mode 100644 index 0000000..ef4e026 --- /dev/null +++ b/pages/indexclassres/indexclassres.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "资料下载", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/indexclassres/indexclassres.wxml b/pages/indexclassres/indexclassres.wxml new file mode 100644 index 0000000..5f52961 --- /dev/null +++ b/pages/indexclassres/indexclassres.wxml @@ -0,0 +1,27 @@ + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + diff --git a/pages/indexclassres/indexclassres.wxss b/pages/indexclassres/indexclassres.wxss new file mode 100644 index 0000000..826752b --- /dev/null +++ b/pages/indexclassres/indexclassres.wxss @@ -0,0 +1,109 @@ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; +} + +.curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; + margin-right: 10rpx; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.lineclass { + width: 685rpx; + margin: 30rpx auto; + border-bottom: 1rpx solid #dcdcdc; +} + +.itemdataclass { + display: flex; + flex-direction: column; + align-items: flex-start; + width: 680rpx; + height: 200rpx; + margin: 0 auto; + margin-top: 20rpx; + background-color: #f0f0f0; + border-radius: 15rpx; +} + +.item1 { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + height: 103rpx; + +} + +.item1up image { + width: 45rpx; + height: 45rpx; + margin-left: 30rpx; + margin-top: 20rpx; +} + +.item1down text { + margin-left: 20rpx; + margin-top: 20rpx; + font-size: 30rpx; + font-weight: 400; +} + +.item2donw image { + margin-left: 10rpx; + margin-top: 20rpx; + width: 272rpx; + height: 55rpx; +} + +.item3 { + width: 80rpx; + margin-right: 35rpx; +} + +.item3 text { + font-size: 30rpx; + font-weight: 400; +} + +.item4 { + margin-right: 50rpx; +} + +.item4 image { + width: 38rpx; + height: 38rpx; +} + +.line_02 { + height: 1px; + border-top: 1px solid #ddd; + text-align: center; + width: 370px; + margin: 0 auto; +} \ No newline at end of file diff --git a/pages/indexclasssubwork/indexclasssubwork.js b/pages/indexclasssubwork/indexclasssubwork.js new file mode 100644 index 0000000..bf485fe --- /dev/null +++ b/pages/indexclasssubwork/indexclasssubwork.js @@ -0,0 +1,649 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + replylist1: [], + imageslists: [], //图片预览 + showview: false, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 1, + accesstoken: '', + typeid: wx.getStorageSync('jmparm') == null ? 1 : wx.getStorageSync('jmparm'), + page: 1, //页面数, + pagecount: 0, + classintorgg:[], + classid:0 + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log("=-=options=-=-=-=-=========----------"); + console.log(options); + if (options.id > 0) { + this.setData({ + active: options.id == '' ? 1 : options.id, + page: 1, + typeid: wx.getStorageSync('jmparm'), + classid:options.id + }) + } + + }, + displayview: function () { + wx.navigateTo({ + url: '/pages/indexcreatewordssubwork/indexcreatewordssubwork?typeid=' + this.data.classid, + }) + + }, contentclick: function (params) { + + let id = params.currentTarget.id; + let xid = params.currentTarget.dataset.xid; + + this.setData({ + wordstextname: '@' + id + }); + + this.addinccomment(xid) + wx.showToast({ + title: '@成功,请移底部留言',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'success', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + + // this.pageScrollToBottom(); + + }, addinccomment: function (params) { + //增加评论数 + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/addcommentrepycount'; + var param = { + id: params, + userid: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + // pageScrollToBottom() { + // wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + // // rect.id // 节点的ID + // rect.dataset // 节点的dataset + // rect.left // 节点的左边界坐标 + // rect.right // 节点的右边界坐标 + // rect.top // 节点的上边界坐标 + // rect.bottom // 节点的下边界坐标 + // rect.width // 节点的宽度 + // rect.height + // console.log(rect.bottom*15) + // console.log(rect.bottom) + // // 使页面滚动到底部 + // wx.pageScrollTo({ + // scrollTop: rect.bottom*15 + // }) + // }).exec() + // }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + Apps.islogin(); + this.setData({ + active: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm'), + typeid: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm') + }) + //头部消息 + this.msglist(); + //留言类型 + this.wrodtypelist(); + //回复留言列表 + this.getwords(); + this.getclassintro(this.data.active); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + + wx.setStorageSync('jmparm', e.currentTarget.id); + this.setData({ + active: e.currentTarget.id, + typeid: e.currentTarget.id + }) + this.getwords(); + }, + duizhiticlick: function () { + wx.navigateTo({ + url: '/pages/allpapers/allpapers', + }) + }, + messagelistclick: function () { + wx.navigateTo({ + url: '/pages/messagelist/messagelist', + }) + }, + communityinfoclick: function (e) { + + // wx.navigateTo({ + // url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + // }) + }, + communityinfocommentclick: function (e) { + + wx.navigateTo({ + //communityinfocomment + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id + '&jztype=2', + }) + }, + messagelistclick: function (e) { + //资讯列表分类 + wx.navigateTo({ + url: '/pages/messagelist/messagelist?typeid=' + e.currentTarget.id, + }) + }, + messageclick: function (e) { + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=' + e.currentTarget.id, + }) + }, + msglist: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/msglist/msgindexlist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + messagelist: res.data.sort() + + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wrodtypelist: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclass/getindexclasstype'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + that.setData({ + list: res.data, + active: this.data.active + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwordspics: function (id) { + //得到单个信息图片数 + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/getwordssingle'; + var param = { + id: id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + console.log(res.data.pics); + that.setData({ + imageslists: res.data.pics, + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getclassintro:function(params) { + //得到用户公告 + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/getclassgg'; + var param = { + classid: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + let counts = res.data.length; + that.setData({ + classintorgg: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwords: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslistsubwork/getwords'; + var param = { + typeid: that.data.classid, + page: that.data.page, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + let counts = res.data.length; + that.setData({ + replylist: res.data, + replylist1: res.data, + pagecount: counts == 0 ? 1 : counts + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsclick: function (ee) { + + let e1 = ee.currentTarget.id; + let e2 = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslistsubwork/wordsclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + //头部消息 + that.msglist(); + //留言类型 + that.wrodtypelist(); + that.getwords(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + bindTextAreaBlur: function (e) { + this.setData({ + wordstextname: e.detail.value + }) + }, + preview: function (params) { + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let picsid = params.currentTarget.dataset.pics; //单条信息ID + + // that.getwordspics(picsid); //得到单条信息图片 + console.log(that.data.replylist[picsid]); + let rearr = that.data.replylist[picsid].pics; + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + console.log('-----'); + console.log(arr); + + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + + preview1: function (params) { + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let picsid = params.currentTarget.dataset.pics; //单条信息ID + + // that.getwordspics(picsid); //得到单条信息图片 + console.log(that.data.replylist1[picsid]); + let rearr = that.data.replylist1[picsid].replyimages; + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + console.log('-----'); + console.log(arr); + + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + getmsgcheck: function (params, accesstoken) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + // let url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + console.log(res.errcode); + if (res.errcode == "0") { + that.wordsadd(params, that.data.imagestr) + } else { + + wx.showToast({ + title: '留言内容有敏感词请重新输入',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/indexclasslistsubwork/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + } + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslistsubwork/wordsxqadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordstype_ids: this.data.typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + this.getwords(); + + that.setData({ + wordstextname: '' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + formSubmit: function (e) { + + this.getacctoken(); + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + this.getmsgcheck(content, this.data.accesstoken); + }, + // 触底加载 + onReachBottom: function () { + + this.setData({ + page: this.data.page + 1 + }) + let newpage = (this.data.page + 1); //页数触底加1 + console.log(newpage); + if (newpage * 10 >= this.data.pagecount) { + + wx.showToast({ + title: '触底了,没有可加载的数据了', + icon: 'none', + duration: 1500 + }) + + } else { + this.getwords(); + } + + }, + clickmyroom: function (params) { + console.log(params.currentTarget.id); + wx.navigateTo({ + url: '/pages/indexclasszx/indexclasszx?myclassid=' + params.currentTarget.id, + }) + }, + clickclassintro: function (params) { + + const id = params.currentTarget.id; + var urlpath=""; + if(id==1){ + urlpath="/pages/indexclassintro/indexclassintro?id="+id + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + }else if(id==2){ + urlpath="/pages/indexclassres/indexclassres?id="+id + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + }else if(id==3){ + urlpath="/pages/indexjobtask/indexjobtask?id="+id + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + }else if(id==4){ + urlpath="/pages/indexclassintro/indexclassintro?id="+id + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + }else if(id==5){ + urlpath="/pages/indexclasssubwork/indexclasssubwork?id="+id + console.log(urlpath); + wx.navigateTo({ + url: urlpath, + }) + } + + } +}) \ No newline at end of file diff --git a/pages/indexclasssubwork/indexclasssubwork.json b/pages/indexclasssubwork/indexclasssubwork.json new file mode 100644 index 0000000..0910ccf --- /dev/null +++ b/pages/indexclasssubwork/indexclasssubwork.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "班级", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/indexclasssubwork/indexclasssubwork.wxml b/pages/indexclasssubwork/indexclasssubwork.wxml new file mode 100644 index 0000000..1902a6e --- /dev/null +++ b/pages/indexclasssubwork/indexclasssubwork.wxml @@ -0,0 +1,124 @@ + + + + + + + + + + {{classintorgg['intro']}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + +
\ No newline at end of file diff --git a/pages/indexclasssubwork/indexclasssubwork.wxss b/pages/indexclasssubwork/indexclasssubwork.wxss new file mode 100644 index 0000000..9d0d1e8 --- /dev/null +++ b/pages/indexclasssubwork/indexclasssubwork.wxss @@ -0,0 +1,435 @@ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + font-weight: 400rpx; +} + +.headrightdown { + font-size: 30rpx; + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.mssagemiddledownone image { + width: 100%; + } + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.areaclass { + + width: 540rpx; + height: 193rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 26rpx; + height: 26rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.vipimage image { + width: 37rpx; + height: 33rpx; + position: relative; + left: -32rpx; + top: 148rpx; +} + +/* 社区头部 */ +.communityhead { + + width: 690rpx; + height: 210rpx; + margin: 0 auto; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + display: none; +} + +.communityheadleft { + + width: 75rpx; + height: 195rpx; + background-size: 100% 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} +.communityheadleft image{ + + width: 75rpx; + height: 195rpx; +} +.communityheadmiddle{ + width: 450rpx; + height: 195rpx; + border-radius: 5%; + margin-left:20rpx; + background-color: #D3FDFF; +} +.communityheadmiddle text{ + display: block; + color:#02BBC2; + font-size: 28rpx; + font-weight: 400; + padding-top:32rpx; + padding-left: 32rpx; +} + +.containerclass{ + + display: flex; + display: none; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin: 0 auto; + width: 690rpx; + height: 180rpx; + margin-top:65rpx; + margin-bottom:50rpx; + border: 1rpx solid #d6cfcf; + border-radius: 2%; + box-shadow: 3px 3px 3px 3px rgb(236, 234, 234); +} +.containerclass image{ + margin-left: 20rpx; + width: 89rpx; + height: 108rpx; + margin-right: 20rpx; +} + +.communityheadright { + width: 140rpx; + height: 195rpx; + margin-left: 20rpx; +} +.communityheadright image { + width: 140rpx; + height: 195rpx; +} + +.communityheadleftitem1 { + width: 240rpx; + margin-left: 55rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.communityheadleftitem2 { + width: 80rpx; + height: 180rpx; +} + +.communityheadleftitem2 image { + width: 80rpx; + height: 175rpx; +} + +.messageitem { + width: 240rpx; + height: 38rpx; + /* border: 1rpx solid #1ccfd6; */ + color: #1ccfd6; + margin-bottom: 10rpx; + text-align: center; + overflow: hidden; +} + +/* 社区头部 */ + +/* 社区滑动 */ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; + display: none; +} + +.curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; + margin-right: 10rpx; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.lineclass { + width: 685rpx; + margin: 2rpx auto; + border-bottom: 1rpx solid #dcdcdc; +} + +/* 社区滑动 */ + +/* 补充留言信息右边 */ +.itemright { + width: 200rpx; + margin-top: 50rpx; + margin-left: 30rpx; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.itemright image { + + margin-left: 10rpx; + width: 70rpx; + height: 35rpx; +} + +/* 补充留言信息右边 */ + +.header_view_hide{ + display: none; +} +.header_view_show{ + display: block; +} + +.round-click{ + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; +} +.round-click image{ + height: 61rpx; + line-height: 61rpx; + width: 54rpx; +} + +.areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} +.areaclass textarea{ + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} +.areafooterleft image{ + + width: 52rpx; + height: 52rpx; + +} +.areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} +.areafooterright{ + width: 120rpx; + height: 56rpx; +} +.areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; +} \ No newline at end of file diff --git a/pages/indexclasszx/indexclasszx.js b/pages/indexclasszx/indexclasszx.js new file mode 100644 index 0000000..065834e --- /dev/null +++ b/pages/indexclasszx/indexclasszx.js @@ -0,0 +1,395 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [], //图片预览 + showview: false, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 1, + accesstoken: '', + typeid: wx.getStorageSync('jmparm') == null ? 1 : wx.getStorageSync('jmparm'), + page: 1, //页面数, + pagecount: 0, + h: '00', + m: '00', + s: '00', + //存储计时器 + setInter: '', + num: 1, + resdata:[], //班级信息 + userlistdata:[], //用户数据 + usersingledata:[] + + }, + // 计时器 + queryTime() { + const that = this; + var hou = that.data.h; + var min = that.data.m; + var sec = that.data.s; + that.data.setInter = setInterval(function () { + sec++; + if (sec >= 60) { + sec = 0; + min++; + if (min >= 60) { + min = 0; + hou++; + that.setData({ + h: (hou < 10 ? '0' + min : min) + }); + } else { + that.setData({ + m: (min < 10 ? '0' + min : min) + }); + } + } else { + that.setData({ + s: (sec < 10 ? '0' + sec : sec) + }); + } + var numVal = that.data.num + 1; + that.setData({ num: numVal }); + // console.log('setInterval==' + that.data.num); + }, 1000) + }, + taskStart() { + this.queryTime() + }, + taskEnd() { + //清除计时器 即清除setInter + clearInterval(this.data.setInter) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + + if (options.length > 0) { + this.setData({ + active: options.id == '' ? 1 : options.id, + page: 1, + typeid: wx.getStorageSync('jmparm') + }) + } + + }, + displayview: function () { + wx.navigateTo({ + url: '/pages/createwords/createwords?typeid=' + this.data.typeid, + }) + + }, contentclick: function (params) { + + let id = params.currentTarget.id; + let xid = params.currentTarget.dataset.xid; + + this.setData({ + wordstextname: '@' + id + }); + + this.addinccomment(xid) + wx.showToast({ + title: '@成功,请移底部留言',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'success', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + + // this.pageScrollToBottom(); + + }, addinccomment: function (params) { + //增加评论数 + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/addcommentrepycount'; + var param = { + id: params, + userid: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getroominfo:function(params) { + + const classid=this.data.active; + const that = this; + let url = Apps.globalData.baseUrl + '/indexstudyroom/getroomrennum'; + var param = { + classid: classid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log("res==================="); + console.log(res); + that.setData({ + resdata:res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + addroomuser:function () { + //添加用户与自习室 + const classid=this.data.active; + const that = this; + let url = Apps.globalData.baseUrl + '/indexstudyroom/addroomuser'; + var param = { + classid: classid, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log("res==================="); + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + updateroomusertime:function (parms) { + //更新停留时间 + const classid=this.data.active; + const that = this; + let url = Apps.globalData.baseUrl + '/indexstudyroom/updateroomusertime'; + var param = { + classid: classid, + user_id: wx.getStorageSync('wxuserid'), + times:parms + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log("ssssssssssssssss==================="); + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getroomuser:function(params) { + + //得到房间的用户 + //更新停留时间 + const classid=this.data.active; + const that = this; + let url = Apps.globalData.baseUrl + '/indexstudyroom/getroomuser'; + var param = { + classid: classid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log("aaaaaaaaaaaaaaa=================="); + console.log(res); + that.setData({ + userlistdata:res.data + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + + + getroomsingleuser:function(params) { + + //得到房间的用户 + //更新停留时间 + const classid=this.data.active; + const that = this; + let url = Apps.globalData.baseUrl + '/indexstudyroom/getroomsingleuser'; + var param = { + classid: classid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log("aaaaaaaaaaaaaaa=================="); + console.log(res); + that.setData({ + usersingledata:res.data + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.taskStart(); + Apps.islogin(); + this.setData({ + active: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm'), + typeid: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm') + }) + // //头部消息 + // this.msglist(); + // //留言类型 + // this.wrodtypelist(); + // //回复留言列表 + // this.getwords(); + this.getroominfo(); //得到自习室的信息 + this.addroomuser(); //添加自习室 + this.getroomuser();// 得到用户数 + this.getroomsingleuser(); //得到最后一个用户信息 + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + console.log("11111111111111111"); + this.taskEnd(); + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + console.log("22222222"); + console.log(this.data.num); + this.updateroomusertime(this.data.num); + //清除计时器 即清除setInter + clearInterval(this.data.setInter); + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + + wx.setStorageSync('jmparm', e.currentTarget.id); + this.setData({ + active: e.currentTarget.id, + typeid: e.currentTarget.id + }) + this.getwords(); + }, + duizhiticlick: function () { + wx.navigateTo({ + url: '/pages/allpapers/allpapers', + }) + }, + messagelistclick: function () { + wx.navigateTo({ + url: '/pages/messagelist/messagelist', + }) + }, + + // 触底加载 + onReachBottom: function () { + + this.setData({ + page: this.data.page + 1 + }) + let newpage = (this.data.page + 1); //页数触底加1 + console.log(newpage); + if (newpage * 10 >= this.data.pagecount) { + + wx.showToast({ + title: '触底了,没有可加载的数据了', + icon: 'none', + duration: 1500 + }) + + } else { + this.getwords(); + } + + } +}) \ No newline at end of file diff --git a/pages/indexclasszx/indexclasszx.json b/pages/indexclasszx/indexclasszx.json new file mode 100644 index 0000000..b7e9443 --- /dev/null +++ b/pages/indexclasszx/indexclasszx.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh":true, + "navigationBarTitleText": "怼社区" + } \ No newline at end of file diff --git a/pages/indexclasszx/indexclasszx.wxml b/pages/indexclasszx/indexclasszx.wxml new file mode 100644 index 0000000..2cf7e90 --- /dev/null +++ b/pages/indexclasszx/indexclasszx.wxml @@ -0,0 +1,58 @@ + + + + + + + + + + + {{usersingledata['nickname']}} + + + {{usersingledata['times']}} + + + + + + 累计专注{{resdata['totaltimes']}}分钟 + + + + 自习室人数{{resdata['totaluser']}}人 + + + + + + + + + + {{h}}:{{m}}:{{s}} + + + + + + + + + + + + + + + + + {{item.nickname}} + + + + + + + \ No newline at end of file diff --git a/pages/indexclasszx/indexclasszx.wxss b/pages/indexclasszx/indexclasszx.wxss new file mode 100644 index 0000000..461d138 --- /dev/null +++ b/pages/indexclasszx/indexclasszx.wxss @@ -0,0 +1,513 @@ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 120rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + width: 200rpx; + height: 142rpx; +} + +.headrightup text { + font-size: 30rpx; + font-weight: 400rpx; +} + +.headrightdown { + font-size: 30rpx; + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.mssagemiddledownone image { + width: 100%; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.areaclass { + + width: 540rpx; + height: 193rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 26rpx; + height: 26rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.vipimage image { + width: 37rpx; + height: 33rpx; + position: relative; + left: -32rpx; + top: 148rpx; +} + +/* 社区头部 */ +.communityhead { + width: 680rpx; + height: 210rpx; + margin: 0 auto; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +} + +.communityheadleft { + background: url('https://ndnd.duiduiedu.com/uploads/pics/communtlistheadleft.png') no-repeat; + width: 385rpx; + height: 206rpx; + background-size: 100% 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.communityheadright { + width: 232rpx; + height: 206rpx; + margin-left: 40rpx; +} + +.communityheadrightup { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; +} + +.communityheadrightup image { + width: 240rpx; + height: 80rpx; +} + +.communityheadrightdown { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; +} + +.communityheadrightdown image { + width: 240rpx; + height: 80rpx; +} + +.communityheadleftitem1 { + width: 240rpx; + margin-left: 55rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.communityheadleftitem2 { + width: 80rpx; + height: 180rpx; +} + +.communityheadleftitem2 image { + width: 80rpx; + height: 175rpx; +} + +.messageitem { + width: 240rpx; + height: 38rpx; + /* border: 1rpx solid #1ccfd6; */ + color: #1ccfd6; + margin-bottom: 10rpx; + text-align: center; + overflow: hidden; +} + +/* 社区头部 */ + +/* 社区滑动 */ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; +} + +.curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; + margin-right: 10rpx; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.lineclass { + width: 685rpx; + margin: 2rpx auto; + border-bottom: 1rpx solid #dcdcdc; +} + +/* 社区滑动 */ + +/* 补充留言信息右边 */ +.itemright { + width: 260rpx; + margin-top: 10rpx; + margin-left: 30rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: left; +} + +.itemrightup { + font-size: 32rpx; + font-weight: 400; +} + +.itemrightup text { + color: #FD77B0; +} + +.itemrightdown { + margin-top: 10rpx; +} + +.itemrightdown text { + color: #FD77B0; +} + +.middlecss { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 690rpx; + height: 160rpx; + margin: 0 auto; + background: url('https://ndnd.duiduiedu.com/uploads/pics/zx003.png') no-repeat; + background-size: 100% 100%; +} + +.middlecss text { + color: white; + font-size: 80rpx; + font-weight: 600; +} + +.middlecssdown { + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 690rpx; + height: 450rpx; + margin-top: 85rpx; +} + +.middlecssdown image { + + width: 695rpx; + height: 450rpx; + margin: 0 auto; +} + +.middlecssdown2 { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 690rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 71rpx; + margin-bottom: 36rpx; +} + +.middlecssdown2 image { + width: 486rpx; + height: 100rpx; + margin: 0 auto; + +} + +.middlecssdown3 { + display: flex; + flex-flow: row wrap; + justify-content: left; + align-items: left; + width: 690rpx; + margin: 0 auto; +} + +.middlecssdown3row { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 94rpx; + height: 122rpx; + margin: 0 auto; + margin-left: 50rpx; + margin-bottom: 30rpx; +} + +.donwup { + width: 103rpx; + height: 103rpx; + +} + +.donwup image { + border-radius: 50%; + overflow: hidden; + width: 103rpx; + height: 103rpx; +} + +.downdown { + + width: 103rpx; + height: 103rpx; +} + +.downdown text { + width: 103rpx; + height: 103rpx; + font-size: 20rpx; +} + +.round-click { + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; +} + +.round-click image { + height: 61rpx; + line-height: 61rpx; + width: 54rpx; +} + +.areaclass { + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areaclass textarea { + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 52rpx; + height: 52rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.areafooterright { + width: 120rpx; + height: 56rpx; +} + +.areafooterright button { + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border: none; +} \ No newline at end of file diff --git a/pages/indexcourselearning/indexcourselearning.js b/pages/indexcourselearning/indexcourselearning.js new file mode 100644 index 0000000..002c504 --- /dev/null +++ b/pages/indexcourselearning/indexcourselearning.js @@ -0,0 +1,1070 @@ +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + videurl: "https://xyg.jsjbkc.com/pics/xyg1.mp4?v" + Date.now(), + imagecount: 4, + courseid: 1, + itemdata: [], + baseurl: Apps.globalData.baseimgurl, + showview: false, + title: '', + content: '', + images: '', + upload_picture_list: [], + imagesListp: [], + imagestr: [], + imageslists: [], //图片预览 + ismdata: 1, //是否材料型数据跳转 + typeid: 1, + isdisplay: 1, + ispic: 0, + accesstoken: '', + xid: 0, + onefeilei: 0, //课程一级分类 + viptype_id: 1, //VIP类型 + videoContext: {}, // 用于绑定视频标签 + showvide: false, + videtimes: 5, + videtimes2: 10, + cousreshow: false, //检查用户是对课程有权限,对VIP用户onWaiting + headpicvalue: 0,//课程积分 + sliderValue: 0, //控制进度条slider的值, + updateState: false, //防止视频播放过程中导致的拖拽失效 + playStates: false, //控制播放 & 暂停按钮的显示 + fullScreen: false,//是否是全屏 + recommendListArr: [], + chongzhivalue: '怼币购买', + poptitle: '怼币购买后可学习14天', + isfinall: 0, //检测用户的课程是否完成 + video_data: {}, //要播放的视频对象 + show: false, + isvip: false, //是否VIP, + showdiage: false, + pathid: "", + actions: [ + { + name: '1.0倍速', + value: 1 + }, + { + name: '1.25倍速', + value: 1.25 + }, + { + name: '1.5倍速', + value: 1.5 + }, + { + name: '2.0倍速', + value: 2 + }, + ], + }, + showdiagePopup(e) { + console.log(e); + let pathid = e.currentTarget.id; + + let files = pathid; // knowfiles.currentTarget.id; + if (files.length == 0) { + + wx.showToast({ + title: '暂时还没有讲义,不可下载',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } else { + this.setData({ showdiage: true, pathid: pathid }); + } + + }, + + onshowdiageClose() { + this.setData({ showdiage: false }); + }, + vippopmsg: function () { + //vip课程弹出消息框 + //判断VIP课程还有多少天 + this.vipkechengday(this.data.onefeilei, wx.getStorageSync('wxuserid')); + }, + vipkechengday: function (onefeilei, wxuserid) { + //判断VIP课程还有多少天 + const that = this; + let url = Apps.globalData.baseUrl + '/user/vipscourseuserday'; + var param = { + user_id: wxuserid, + sourceid: onefeilei + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + // 您的VIP会员剩余374天 + Toast('您的VIP会员剩余' + res + '天'); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + popmsg: function () { + //怼币课程弹出消息框 + //判断怼币课程还有多少天 + console.log(this.data.courseid); + console.log(wx.getStorageSync('wxuserid')); + this.duibikechengday(this.data.courseid, wx.getStorageSync('wxuserid')); + // Toast('您的课程还有8天到期,到期后需重新购买'); + }, + popclick: function () { + if (this.data.isdisplay == 1 && this.data.typeid != 1) { + //弹出购买信息 + this.setData({ + showvide: true + }); + this.videoContext.pause(); + + } + + }, + duibikechengday: function (sourceid, wxuserid) { + //判断怼币课程还有多少天 + //检查用户是否可以听课 + const that = this; + let url = Apps.globalData.baseUrl + '/user/setdecuserscoreday'; + var param = { + user_id: wxuserid, + sourceid: sourceid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + Toast('您的课程还有' + res + '天到期,到期后需重新购买'); + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + bsbtnclick: function () { + let bsdata = !this.data.show; + console.log(bsdata); + this.setData({ + show: bsdata + }) + }, + onClose: function () { + this.setData({ show: false }); + }, + onSelect: function (event) { + console.log(event.detail); + console.log(event.detail.value); + let rate = event.detail.value; + this.videoContext.playbackRate(Number(rate)); + this.onClose(); + }, + bindButtonRate: function (e) { + let rate = e.detail; + console.log(rate); + this.videoContext.playbackRate(Number(rate)); + }, + fullvideo: function (params) { + console.log(params); + // 全屏 + this.videoContext = wx.createVideoContext('myVideo'); + this.videoContext.requestFullScreen({ + direction: 1 + }); + }, + bindfullscreenchange: function (e) { + // let fullScreen = e.detail.fullScreen //值true为进入全屏,false为退出全屏 + // let videoContext = wx.createVideoContext('myVideo') + if (!e.detail.fullScreen) { + // 退出全屏 + this.videoContext.exitFullScreen() + } + else { + // 全屏 + this.videoContext = wx.createVideoContext('myVideo'); + this.videoContext.requestFullScreen({ + direction: -90 + }); + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + Apps.islogin(); + console.log("options=========="); + console.log(options); + // if (options.typeid == 3) { + // this.setData({ + // chongzhivalue: '充值VIP', + // poptitle: 'VIP期限内可无限畅学' + // }) + // } + this.setData({ + courseid: options.id, + typeid: options.typeid, + updateState: true + }); + + }, + buyclick(event) { + console.log(event.detail); + console.log("===========") + //购买是跳转,还是在这里需要判断购买 + console.log(this.data.viptype_id); + if (this.data.viptype_id == 2) { + //实现怼币购买 + this.kqcheckdescusersorce(wx.getStorageSync('wxuserid'), this.data.cousrceid, this.data.headpicvalue); + } else if (this.data.viptype_id == 3) { + //跳转购买课程页面 + wx.navigateTo({ + url: '/pages/viprecharge/viprecharge', + }) + } + }, + cancleclick() { + this.setData({ showvide: false }); + }, + videoUpdate(e) { + if (this.data.updateState) { + //判断拖拽完成后才触发更新,避免拖拽失效 + const times = e.detail.currentTime.toFixed(0); + let sliderValue = e.detail.currentTime / e.detail.duration * 100; + // console.log(sliderValue); + this.setData({ + sliderValue: sliderValue, + duration: e.detail.duration + }) + // console.log('sliderValue=>' + times); + // console.log('11试看=>' + times); + this.publicdata(times); + + } + }, + publicdata: function (times) { + + //公共数据 + + //对2,3类型课程需要监控,一判断是否已用怼币购买过,二是判断是否为VIP用户 + if (this.data.viptype_id != 1) { + + //购买用户,怼币购买用户 + //1免费,2怼币,3VIP,4优惠值 + //先检查是否有怼币 + //增加一个两个小时的时长 + // console.log('先检查是否有怼币'); + // console.log(that.data.isdisplay); + if (this.data.isdisplay == 1) { + + if (this.data.cousreshow == false) { + + if (times >= this.data.videtimes) { + this.setData({ + showvide: true, + playStates: false, + sliderValue: times + }); + this.videoContext.pause(); + } + } + } + + } + }, + sliderChanging(e) { + + const times = e.detail.value.toFixed(0); + this.setData({ + updateState: false //拖拽过程中,不允许更新进度条 + }) + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.publicdata(times); + } else { + this.videoContext.play(); + } + }, + sliderChange(e) { + + const times = e.detail.value.toFixed(0); + this.setData({ + sliderValue: e.detail.value, + updateState: false //完成拖动后允许更新滚动条 + }) + + if (this.data.duration) { + this.videoContext.seek(e.detail.value / 100 * this.data.duration); //完成拖动后,计算对应时间并跳转到指定位置 + this.setData({ + sliderValue: e.detail.value.toFixed(0), + updateState: true //完成拖动后允许更新滚动条 + }) + } + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.setData({ + showvide: true, + duration: e.detail.duration, + playStates: false, + sliderValue: times + }); + this.publicdata(times); + + } else { + this.videoContext.play(); + } + + + }, + videoOpreation() { + + const playstats = !this.data.playStates; + this.setData({ + playStates: playstats, + }); + this.data.playStates ? this.videoContext.pause() : this.videoContext.play(); + const times = this.data.sliderValue; + console.log(times); + if (times >= this.data.videtimes) { + this.videoContext.pause(); + this.publicdata(times); + } + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + this.videoContext = wx.createVideoContext('myVideo'); + this.setData({ + updateState: true + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.isdisplay(); + this.getcoursedata(this.data.courseid); + this.wrodtypelist(this.data.courseid); + this.isjumpurl(this.data.typeid, 1); + // this.isfinallfun(this.data.courseid, wx.getStorageSync('wxuserid'), 2); //2不删除 + + }, + + isfinallfun: function (id, userid, typeid) { + //是否完成函数 + const that = this; + let url = Apps.globalData.baseUrl + '/course/finallclick'; + var param = { + id: id, + user_id: userid, + typeid: typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + that.setData({ + isfinall: res + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + messageclick: function (e) { + + wx.reLaunch({ + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + }) + }, + deletewordreply: function (par) { + + //删除留言 + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/deletewordreply'; + var param = { + wordid: par + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + this.wrodtypelist(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getcoursedata: function (params) { + const that = this; + let url = Apps.globalData.baseUrl + '/lives/indexcourselives'; + var param = { + id: params, + user_id: wx.getStorageSync('wxuserid') == '' ? 0 : wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log('res===================='); + console.log(res); + let cousrceid = res.data.id; + that.setData({ + itemdata: res.data, //课程数据 + cousrceid: cousrceid, //课程ID + videtimes: 100000000, //视听时长 + videurl: res.data.liveurl + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + displayview: function () { + console.log(this.data.showview); + this.setData({ + showview: (!this.data.showview) + }) + this.getacctoken(); + this.pageScrollToBottom(); + }, + wrodtypelist: function (params) { + + //获取课程留言 + const that = this; + let url = Apps.globalData.baseUrl + '/lives/liveswordscourselist'; + var param = { + id: params, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + delesourceclick: function (par) { + const that = this; + wx.showModal({ + title: '删除提示', + content: '您将删除该留言信息', + cancelText: '退出', + confirmText: '确认', + success: function (res) { + if (res.cancel) { + //这个跳转是左边按钮的跳转链接 + //这里取消操作 + console.log(res); + + } else { + //这里是右边按钮的跳转链接 + let id = par.currentTarget.id; + //删除课程留言数据 + let url = Apps.globalData.baseUrl + '/lives/liveswordscoursedelete'; + var param = { + id: id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.wrodtypelist(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } + } + }) + + }, + wordsclick: function (ee) { + + let e1 = ee.currentTarget.id; + // let e2 = Apps.globalData.currentuserinfo.id; + let e2 = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscourseclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + + // that.getpicchekc(that.data.imagesListp[i]); + + // if (that.data.ispic == 1) { + + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + } + + // } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + // 删除图片 + removeChooseImage(e) { + let imgs = this.data.imagestr; + let { index } = e.currentTarget.dataset; + imgs.splice(index, 1); + this.setData({ + imagestr: imgs + }) + }, + // 预览图片 + previewBigImage(e) { + let that = this; + let imgs = that.data.imagestr; + let index = e.currentTarget.dataset.index; + let arr = []; + imgs.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + //当前显示图片 + current: arr[index], + //所有图片 + urls: arr + }) + }, + isjumpblack: function () { + console.log(wx.getStorageSync('userisblack')); + if (wx.getStorageSync('userisblack') >= 2) { + + wx.showToast({ + title: "您已被禁言,请联系管理员",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + formSubmit: function (e) { + + Apps.islogin(); + + if (wx.getStorageSync('userisblack') >= 2) { + this.isjumpblack(); + return; + } + + let content = this.data.wordstextname; + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + this.getmsgcheck(content); + + }, + bindTextAreaBlur: function (e) { + this.setData({ + wordstextname: e.detail.value + }) + }, + uploadpicsimage: function (e) { + + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/uploadpics'; + var param = { + url: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/lives/liveswordscouresadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordsid: that.data.courseid, + xid: that.data.xid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + + that.wrodtypelist(that.data.courseid); + + that.setData({ + wordstextname: '', + imagestr: '' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + contentclick: function (params) { + + console.log(params); + let id = params.currentTarget.id; + let xid = params.currentTarget.dataset.xid; + console.log(id); + this.setData({ + wordstextname: '回复@' + id, + showview: true, + xid: xid + }); + + // this.addinccomment(xid); + + this.getacctoken(); + + wx.showToast({ + title: '@成功,留言请移底部留言', + icon: 'none', + duration: 1500 + }) + this.pageScrollToBottom(); + + }, rdclick: function (params) { + + this.pageScrollToBottom(); + }, addinccomment: function (params) { + //增加评论数 + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/addcommentcount'; + var param = { + id: params, + userid: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(that.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + clickbtn: function (params) { + console.log(params); + let userid = wx.getStorageSync('wxuserid'); + const that = this; + let url = Apps.globalData.baseUrl + '/wordslist/wordscourseclickcount'; + var param = { + words_id: params.currentTarget.id, + user_id: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(this.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + knowledgeclick: function (params) { + //知识要点 + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + let examid = params.currentTarget.id; + if (examid > 0) { + wx.navigateTo({ + url: '/pages/knowledge/knowledge?examid=' + examid, + }) + } else { + Toast('此课程暂无知识要点'); + } + + + }, + examingclick: function (params) { + + if (this.data.cousreshow == false && this.data.typeid != 1) { + wx.showToast({ + title: '试听课程,不可操作,请先购买课程',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + return; + } + + let examid = params.currentTarget.id; + let ismdata = this.data.ismdata; + let grouppaper_id = this.data.itemdata.grouppaper_id; + if (grouppaper_id > 0) { + + + if (ismdata == 2) { + wx.navigateTo({ + url: '/pages/exammakings/exammakings?examid=' + examid + '&grouppaper_id=' + grouppaper_id, + }) + } else { + wx.navigateTo({ + url: '/pages/examing/examing?examid=' + examid + '&grouppaper_id=' + grouppaper_id, + }) + } + } else { + + Toast('该课程无练习试题'); + } + }, + preview: function (params) { + let that = this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + + let rearr = that.data.replylist[arrindex].pics; + console.log(rearr); + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + isjumpurl: function (id, groupid) { + + const that = this; + let url = Apps.globalData.baseUrl + '/exam/isarrdata'; + var param = { + id: id, + groupid: groupid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + ismdata: res.data + }); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + isdisplay: function (params) { + //是否显示视频 + const that = this; + let url = Apps.globalData.baseUrl + '/index/isdisplay'; + var param = { + pareid: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + isdisplay: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + console.log('-=-=-=-=-=-=-=-='); + console.log(res); + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getmsgcheck: function (params) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": that.data.accesstoken + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + that.wordsadd(params, that.data.imagestr); + // if (res.errcode == "0") { + // that.wordsadd(params, that.data.imagestr) + // } else { + + // wx.showToast({ + // title: '留言内容有敏感词请重新输入',//提示文字 + // duration: 2000,//显示时长 + // mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + // icon: 'none', //图标,支持"success"、"loading" + // success: function () { },//接口调用成功 + // fail: function () { }, //接口调用失败的回调函数 + // complete: function () { } //接口调用结束的回调函数 + // }) + // } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + checkusercousre: function (para) { + //vip课程 + //检测用户是否这个课程的权限 + Apps.islogin(); + const that = this; + let url = Apps.globalData.baseUrl + '/user/checkusercousre' + var param = { + user_id: wx.getStorageSync('wxuserid'), + courseid: para, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log('// 检查一下用户是否有课程权限 cousreshow=true'); + console.log(res); + console.log(res.data); + // 检查一下用户是否有课程权限 cousreshow=true + that.setData({ + cousreshow: res.data.iscousreshow, + isvip: res.data.isvip + }); + + if (res.data.isvip == false && that.data.viptype_id == 2) { + + that.checkuserscource(wx.getStorageSync('wxuserid'), that.data.cousrceid, that.data.headpicvalue); + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getpicchekc: function (params) { + // let url="https://api.weixin.qq.com/wxa/media_check_async?access_token="+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkpic' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "media_url": params, + "media_type": 2, + "version": 2, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log("res==========="); + console.log(res); + + this.setData({ + ispic: 1 + }) + + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + pageScrollToBottom() { + wx.createSelectorQuery().select('#time-mo').boundingClientRect(function (rect) { + + rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height + console.log(rect.bottom * 20) + // 使页面滚动到底部 + wx.pageScrollTo({ + scrollTop: rect.bottom * 20 + }) + }).exec() + }, + +}) \ No newline at end of file diff --git a/pages/indexcourselearning/indexcourselearning.json b/pages/indexcourselearning/indexcourselearning.json new file mode 100644 index 0000000..9c44bd3 --- /dev/null +++ b/pages/indexcourselearning/indexcourselearning.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "课程学习", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/indexcourselearning/indexcourselearning.wxml b/pages/indexcourselearning/indexcourselearning.wxml new file mode 100644 index 0000000..3e7a628 --- /dev/null +++ b/pages/indexcourselearning/indexcourselearning.wxml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 留言区 + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/pages/indexcourselearning/indexcourselearning.wxss b/pages/indexcourselearning/indexcourselearning.wxss new file mode 100644 index 0000000..73075cc --- /dev/null +++ b/pages/indexcourselearning/indexcourselearning.wxss @@ -0,0 +1,340 @@ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.courselivecontinor { + background-color: #F5F5F5; +} + +.functionalarea { + + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; + margin-top: 40rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 485rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + /* font-weight: 400rpx; */ +} + +.headrightdown { + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + padding-top: 20rpx; + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.round-click{ + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; + } + .round-click image{ + height: 61rpx; + line-height: 61rpx; + width: 54rpx; + } + + + +.areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; + } + .areaclass textarea{ + width: 540rpx; + min-height: 300rpx; + } + + + .areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; + } + .areafooterleft image{ + + width: 52rpx; + height: 52rpx; + + } + .areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; + } + .areafooterright{ + width: 120rpx; + height: 56rpx; + } + .areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; + } + button::after { + border: none; + } + + .header_view_hide{ + display: none; + } + .header_view_show{ + display: block; + } + .vipimage image{ + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; + } + + + .process-container image{ + + position: relative; + z-index: 99; + transform:translate(20%, -10%); + z-index: 999; + width: 60rpx; + height: 60rpx; + +} + +.slider-container { + height: 1rpx; + position: relative; + z-index: 999; + left: 50%; + top: -379%; + transform: translate(-50%, -78rpx); + z-index: 999; + width: 80%; +} +.slider{ + width: 80%; + margin: 0 auto; +} +.mod_action { + position: relative; + z-index: 999; + left:520rpx; + top:-50rpx; + border-radius: 20%; + /* transform: translate(-50%, -98rpx); */ + width: 180rpx; + height: 15rpx; + +} +.playfull{ + position: relative; + z-index: 999; + left:40rpx; + top:70rpx; + border-radius: 20%; + /* transform: translate(-50%, -98rpx); */ + width: 180rpx; + height: 120rpx; +} +.van-dropdown-menu{ + height: var(--dropdown-menu-height,28px)!important; +} +.van-dropdown-menu__item{ + background: url("https://ndnd.duiduiedu.com/uploads/pics/bsbtn.png"); + width: 300px; + height: 90rpx; + background-size:cover; + background-repeat:no-repeat; +} +.playfull image{ + width: 180rpx; + height: 80rpx; +} +.mod_action image{ + width: 180rpx; + height: 80rpx; +} + + + +.choose_upload_view { + margin-top: 30rpx; + margin-left: 10%; + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-start; + flex-wrap: wrap; + } + .choose_upload_item { + margin-left: 38rpx; + margin-bottom: 20rpx; + position: relative; + width: 100rpx; + display: flex; + align-items: center; + } + .choose_upload_view .choose_upload_img { + width: 100rpx; + height: 100rpx; + } + .choose_upload_view .remove_img_icon { + padding: 4rpx; + position:absolute; + top: -15rpx; + right: -13rpx; + width: 28rpx; + height: 28rpx; + border-radius: 50%; + background-color: rgba(248, 236, 236, 0.5); + } + .other_upload { + margin-left: 15rpx; + width: 80rpx; + } \ No newline at end of file diff --git a/pages/indexcreatewords/indexcreatewords.js b/pages/indexcreatewords/indexcreatewords.js new file mode 100644 index 0000000..7cea842 --- /dev/null +++ b/pages/indexcreatewords/indexcreatewords.js @@ -0,0 +1,338 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [], //图片预览 + showview: true, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 0, + accesstoken: '', + typeid: 1, + title: '怼社区', + page: 1, //页面数, + pagecount: 0, + wordstextname: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + console.log(options); + + Apps.islogin(); + this.setData({ + typeid: options.typeid + }) + this.getacctoken(); + }, + bindTextAreaBlur: function (e) { + console.log(e.detail.value); + this.setData({ + wordstextname: e.detail.value + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + + }, + isjumpblack:function(){ + console.log(wx.getStorageSync('userisblack')); + if(wx.getStorageSync('userisblack')>=2){ + + wx.showToast({ + title: "您已被禁言,请联系管理员",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res.access_token); + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + formSubmit: function (e) { + + if(wx.getStorageSync('userisblack')>=2){ + this.isjumpblack(); + return; + } + + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + console.log(this.data.imagestr); + // this.wordsadd(content,this.data.imagestr); + this.getmsgcheck(content, this.data.accesstoken); + wx.setStorageSync('jmparm', this.data.typeid); + wx.navigateTo({ + url: '/pages/indexclass/indexclass', + }) + + }, + getmsgcheck: function (params, accesstoken) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + // let url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + console.log(res.errcode); + if (res.errcode == "0") { + that.wordsadd(params, that.data.imagestr) + } else { + + wx.showToast({ + title: '留言内容有敏感词请重新输入',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/indexclasslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + + } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + // 删除图片 + removeChooseImage(e) { + let imgs = this.data.imagestr; + let { index } = e.currentTarget.dataset; + imgs.splice(index, 1); + this.setData({ + imagestr: imgs + }) + }, + // 预览图片 + previewBigImage(e) { + let that = this; + let imgs = that.data.imagestr; + let index = e.currentTarget.dataset.index; + let arr = []; + imgs.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + //当前显示图片 + current: arr[index], + //所有图片 + urls: arr + }) + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslist/wordsxqadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordstype_ids: this.data.typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + // this.getwords(that.data.typeid); + + that.setData({ + wordstextname: '', + imagestr: [] + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/indexcreatewords/indexcreatewords.json b/pages/indexcreatewords/indexcreatewords.json new file mode 100644 index 0000000..d5b31e8 --- /dev/null +++ b/pages/indexcreatewords/indexcreatewords.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "用户发帖", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/indexcreatewords/indexcreatewords.wxml b/pages/indexcreatewords/indexcreatewords.wxml new file mode 100644 index 0000000..550f38b --- /dev/null +++ b/pages/indexcreatewords/indexcreatewords.wxml @@ -0,0 +1,22 @@ + +
+ + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/pages/indexcreatewords/indexcreatewords.wxss b/pages/indexcreatewords/indexcreatewords.wxss new file mode 100644 index 0000000..1785e4e --- /dev/null +++ b/pages/indexcreatewords/indexcreatewords.wxss @@ -0,0 +1,92 @@ +.areaclass { + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areaclass textarea { + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 52rpx; + height: 52rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.areafooterright { + width: 120rpx; + height: 56rpx; +} + +.areafooterright button { + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border: none; +} + + + +.choose_upload_view { + margin-top: 30rpx; + margin-left: 10%; + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-start; + flex-wrap: wrap; + } + .choose_upload_item { + margin-left: 38rpx; + margin-bottom: 20rpx; + position: relative; + width: 100rpx; + display: flex; + align-items: center; + } + .choose_upload_view .choose_upload_img { + width: 100rpx; + height: 100rpx; + } + .choose_upload_view .remove_img_icon { + padding: 4rpx; + position:absolute; + top: -15rpx; + right: -13rpx; + width: 28rpx; + height: 28rpx; + border-radius: 50%; + background-color: rgba(248, 236, 236, 0.5); + } + .other_upload { + margin-left: 15rpx; + width: 80rpx; + } \ No newline at end of file diff --git a/pages/indexcreatewordssubwork/indexcreatewordssubwork.js b/pages/indexcreatewordssubwork/indexcreatewordssubwork.js new file mode 100644 index 0000000..9c5ba62 --- /dev/null +++ b/pages/indexcreatewordssubwork/indexcreatewordssubwork.js @@ -0,0 +1,345 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [], //图片预览 + showview: true, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 0, + accesstoken: '', + typeid: 1, + title: '怼社区', + page: 1, //页面数, + pagecount: 0, + wordstextname: '', + classid:1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + + console.log("options==================="); + console.log(options); + + Apps.islogin(); + this.setData({ + typeid: options.typeid, + classid:options.typeid + }) + this.getacctoken(); + }, + bindTextAreaBlur: function (e) { + console.log(e.detail.value); + this.setData({ + wordstextname: e.detail.value + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + + }, + isjumpblack:function(){ + console.log(wx.getStorageSync('userisblack')); + if(wx.getStorageSync('userisblack')>=2){ + + wx.showToast({ + title: "您已被禁言,请联系管理员",//提示文字 + duration: 5000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res.access_token); + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + formSubmit: function (e) { + + if(wx.getStorageSync('userisblack')>=2){ + this.isjumpblack(); + return; + } + + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + console.log(this.data.imagestr); + // this.wordsadd(content,this.data.imagestr); + this.getmsgcheck(content, this.data.accesstoken); + wx.setStorageSync('jmparm', this.data.typeid); + wx.navigateTo({ + url: '/pages/indexclasssubwork/indexclasssubwork', + }) + + }, + getmsgcheck: function (params, accesstoken) { + // $url ='https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' .$accessToken; + const that = this; + // let url = 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='+wx.getStorageSync('accesstoen'); + let url = Apps.globalData.baseUrl + '/user/checkmsg' + var param = { + "openid": wx.getStorageSync('wxopenid'), + "scene": 2, + "version": 2, + "content": params, + "access_token": wx.getStorageSync('accesstoen') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(res); + console.log(res.errcode); + if (res.errcode == "0") { + that.wordsadd(params, that.data.imagestr) + } else { + + wx.showToast({ + title: '留言内容有敏感词请重新输入',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic: function () { + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr = []; + var arr = ''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/indexclasslistsubwork/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success: function (res) { + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr: that.data.imagestr + }); + }, + }) + + } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + // 删除图片 + removeChooseImage(e) { + let imgs = this.data.imagestr; + let { index } = e.currentTarget.dataset; + imgs.splice(index, 1); + this.setData({ + imagestr: imgs + }) + }, + // 预览图片 + previewBigImage(e) { + let that = this; + let imgs = that.data.imagestr; + let index = e.currentTarget.dataset.index; + let arr = []; + imgs.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + //当前显示图片 + current: arr[index], + //所有图片 + urls: arr + }) + }, + wordsadd: function (content, imagestr) { + + const that = this; + let url = Apps.globalData.baseUrl + '/indexclasslistsubwork/wordsxqadd'; + var param = { + content: content, + imagestr: imagestr, + userid: wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'), + wordstype_ids: this.data.typeid, + indexclasslist_id:this.data.typeid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if (res.data > 0) { + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + // this.getwords(that.data.typeid); + wx.redirectTo({ + url: '/pages/indexclasssubwork/indexclasssubwork?id='+that.data.typeid, + }) + that.setData({ + wordstextname: '', + imagestr: [] + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/indexcreatewordssubwork/indexcreatewordssubwork.json b/pages/indexcreatewordssubwork/indexcreatewordssubwork.json new file mode 100644 index 0000000..83f1885 --- /dev/null +++ b/pages/indexcreatewordssubwork/indexcreatewordssubwork.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "用户发帖", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/indexcreatewordssubwork/indexcreatewordssubwork.wxml b/pages/indexcreatewordssubwork/indexcreatewordssubwork.wxml new file mode 100644 index 0000000..550f38b --- /dev/null +++ b/pages/indexcreatewordssubwork/indexcreatewordssubwork.wxml @@ -0,0 +1,22 @@ + +
+ + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/pages/indexcreatewordssubwork/indexcreatewordssubwork.wxss b/pages/indexcreatewordssubwork/indexcreatewordssubwork.wxss new file mode 100644 index 0000000..ac02ede --- /dev/null +++ b/pages/indexcreatewordssubwork/indexcreatewordssubwork.wxss @@ -0,0 +1,92 @@ +.areaclass { + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areaclass textarea { + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 52rpx; + height: 52rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.areafooterright { + width: 120rpx; + height: 56rpx; +} + +.areafooterright button { + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border: none; +} + + + +.choose_upload_view { + margin-top: 30rpx; + margin-left: 10%; + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-start; + flex-wrap: wrap; +} +.choose_upload_item { + margin-left: 38rpx; + margin-bottom: 20rpx; + position: relative; + width: 100rpx; + display: flex; + align-items: center; +} +.choose_upload_view .choose_upload_img { + width: 100rpx; + height: 100rpx; +} +.choose_upload_view .remove_img_icon { + padding: 4rpx; + position:absolute; + top: -15rpx; + right: -13rpx; + width: 28rpx; + height: 28rpx; + border-radius: 50%; + background-color: rgba(248, 236, 236, 0.5); +} +.other_upload { + margin-left: 15rpx; + width: 80rpx; +} \ No newline at end of file diff --git a/pages/indexjobtask/indexjobtask.js b/pages/indexjobtask/indexjobtask.js new file mode 100644 index 0000000..55c879d --- /dev/null +++ b/pages/indexjobtask/indexjobtask.js @@ -0,0 +1,121 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +const utiltime = require('../../utils/util.js'); +Page({ + + data: { + date: '', + pareid: 1, + listdata: [], + spot: [], + indexclassid: 1, + workdate: [], + mycnt: 0 + }, + dateChange: function (e) { + + this.getindexclassindex(this.data.indexclassid, e.detail.dateString); + + this.setData({ + dateString: e.detail.dateString, + workdate: e.detail.dateString + }) + }, + /* + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + var timeNow = utiltime.formatDate(new Date()); + this.getindexclassindexbyworkitem(options.id); + this.getindexclassindex(options.id, timeNow); + this.setData({ + indexclassid: options.id, + date: timeNow, + spot: timeNow + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.getindexclassindex(this.data.indexclassid, this.data.workitem); + }, + getindexclassindexbyworkitem: function (indexclassid) { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/indexclass/indexclasslistres2'; + var param = { + indexclasslist_id: indexclassid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + that.setData({ + spot: res.data.workitem + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getindexclassindex: function (indexclassid, workdate) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/indexclass/indexclasslistres'; + var param = { + indexclasslist_id: indexclassid, + workdate: workdate + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + that.setData({ + listdata: res.data.data, + mycnt: res.data.cnt + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/indexjobtask/indexjobtask.json b/pages/indexjobtask/indexjobtask.json new file mode 100644 index 0000000..33e0824 --- /dev/null +++ b/pages/indexjobtask/indexjobtask.json @@ -0,0 +1,11 @@ +{ + "usingComponents": { + "calendar": "../../components/calendar/calendar" + }, + + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "作业任务", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/indexjobtask/indexjobtask.wxml b/pages/indexjobtask/indexjobtask.wxml new file mode 100644 index 0000000..72f8df1 --- /dev/null +++ b/pages/indexjobtask/indexjobtask.wxml @@ -0,0 +1,13 @@ + + + + + {{item.workres}} + + + + + + + + \ No newline at end of file diff --git a/pages/indexjobtask/indexjobtask.wxss b/pages/indexjobtask/indexjobtask.wxss new file mode 100644 index 0000000..3be79de --- /dev/null +++ b/pages/indexjobtask/indexjobtask.wxss @@ -0,0 +1,87 @@ +.collectionitems { + width: 680rpx; + height: 160rpx; + margin: 0 auto; + margin-top: 10rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistred.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-bottom: 10rpx; +} + +.collectionitems2 { + width: 680rpx; + height: 160rpx; + margin: 0 auto; + margin-top: 10px; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistblue.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-bottom: 10rpx; +} + +.item1 { + width: 80%; + display: flex; + flex-direction: column; +} + +.item1 text { + width: 100%; + margin-left: 65rpx; + color: black; + font-size: 32rpx; +} + +.item2 { + width: 10%; + text-align: right; +} + +.item2 text { + color: black; + font-size: 30rpx; +} + +.item3 { + width: 20%; + text-align: center; +} + +.item3 image { + width: 54rpx; + height: 53rpx; + margin-right: 50rpx; +} + +.itemsup { + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + border-bottom: 1rpx solid #fff; +} + +.itemsup2 { + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + display: none; +} \ No newline at end of file diff --git a/pages/indexlives/indexlives.js b/pages/indexlives/indexlives.js new file mode 100644 index 0000000..3879a7e --- /dev/null +++ b/pages/indexlives/indexlives.js @@ -0,0 +1,153 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + liveswitch: 1, + hiddenName: false, + listdata: [], + baseurl: baseUrl.globalData.baseimgurl, + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.getChannelsLiveInfo({ + finderUserName: 'sph1',// 这里是视频号id + success: res => { + console.log('success:', res) + }, + fail: res => { + console.log('fail:', res) + } + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getlivelist(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + getlivelist: function () { + const that = this; + let url = baseUrl.globalData.baseUrl + '/lives/liveslist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + clicklives: function (e) { + console.log(e.currentTarget.id); + console.log(e.currentTarget.dataset.ids); + const typeid = e.currentTarget.dataset.ids; + const id = e.currentTarget.id; + if (typeid == 0) { + wx.navigateTo({ + url: '/pages/indexlivesvoid/indexlivesvoid?id=' + id, + }) + } else { + wx.navigateTo({ + url: '/pages/indexcourselearning/indexcourselearning?id=' + e.currentTarget.id, + }) + } + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + liveopen(e) { + let arr = []; + arr = this.data.listdata; + console.log(e.currentTarget.dataset.itemid); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = true; + item['liveclickclose'] = false; + arr[index] = item; + } else { + item['liveclickopen'] = false; + item['liveclickclose'] = true; + arr[index] = item + } + }) + this.setData({ + listdata: arr + }) + }, + liveclose(e) { + + let arr = []; + arr = this.data.listdata; + console.log(e.currentTarget.dataset.itemid); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = false; + item['liveclickclose'] = true; + arr[index] = item; + } else { + item['liveclickopen'] = true; + item['liveclickclose'] = false; + arr[index] = item + } + }) + this.setData({ + listdata: arr + }) + } +}) \ No newline at end of file diff --git a/pages/indexlives/indexlives.json b/pages/indexlives/indexlives.json new file mode 100644 index 0000000..598f07e --- /dev/null +++ b/pages/indexlives/indexlives.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "直播列表", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/indexlives/indexlives.wxml b/pages/indexlives/indexlives.wxml new file mode 100644 index 0000000..d082f31 --- /dev/null +++ b/pages/indexlives/indexlives.wxml @@ -0,0 +1,25 @@ + + + + + + + + +

{{item.name}}

+
+ + {{item.intro}} + +
+ + + + + + + + + +
+
\ No newline at end of file diff --git a/pages/indexlives/indexlives.wxss b/pages/indexlives/indexlives.wxss new file mode 100644 index 0000000..16a0c68 --- /dev/null +++ b/pages/indexlives/indexlives.wxss @@ -0,0 +1,191 @@ +.page { + background-color: #f5f5f5; + overflow: hidden; +} + +.zhibocss { + display: flex; + flex-wrap: wrap; + align-content: flex-start; + height: 200rpx; + width: 690rpx; + margin: 0 auto; + margin-top: 50rpx; + background: url(https://ndnd.duiduiedu.com/uploads/pics/line.png); + background-repeat: no-repeat; + background-size: 690rpx 190rpx; + +} + +.livefooter { + height: 23rpx; + width: 623rpx; + margin: 0 auto; + margin-top: -9rpx; +} + +.livefooter image { + + width: 623rpx; + height: 23rpx; + +} + + +.itemhead { + margin-top: 20rpx; + margin-left: 20rpx; +} + +.itemhead h2 { + + font-weight: 800; + font-family: 'Arial Narrow', Arial; + font-size: large; +} + + +.item2 { + margin-left: 10rpx; + margin-top: 10rpx; + width: 160rpx; + height: 160rpx; +} + +.item2 image { + margin-top: 10rpx; + margin-left: 10rpx; + width: 141rpx; + height: 141rpx; + border-radius: 5rpx; +} + +.item3 { + + width: 304rpx; + height: 170rpx; + padding-right: 20rpx; +} + +.item4 { + margin-top: 10rpx; + width: 190rpx; + height: 180rpx; +} + +.itemup image { + margin-top: 10rpx; + width: 190rpx; + height: 61rpx; +} + +.itemdown image { + margin-top: 10rpx; + width: 190rpx; + height: 68rpx; +} + +.itemmiddle { + display: flex; + margin-left: 15rpx; + width: 334rpx; + height: 50rpx; +} + +.itemmiddleleft { + display: flex; + margin-top: 10rpx; + flex-direction: row; +} + +.itemmiddleleft text { + color: #AEAEAE; + align-items: center; + font-size: 24rpx; + font-weight: 400; +} + +.itemmiddleleft image { + + width: 30rpx; + height: 30rpx; + padding-right: 10rpx; +} + +.itemmiddleright { + display: flex; + margin-top: 10rpx; + margin-left: 10rpx; + flex-direction: row; +} + +.itemmiddleright text { + color: #AEAEAE; + align-items: center; + font-size: 24rpx; + font-weight: 400; +} + +.itemmiddleright image { + + width: 30rpx; + height: 30rpx; + padding-right: 10rpx; +} + +.itemend { + width: 300rpx; + overflow: hidden; + height: 80rpx; + color: #AEAEAE; + line-height: 28rpx; + margin-bottom: 10rpx; + margin-left: 20rpx; + margin-top: 10rpx; + font-size: 24rpx; +} + +.content { + margin: 0 auto; + width: 632rpx; + border-left: 2rpx solid red; + border-right: 2rpx solid red; +} + +.contentdown { + margin: 0 auto; + width: 650rpx; + height: 23rpx; + margin-top: -9rpx; +} + +.contentdown image { + margin: 0 auto; + width: 648rpx; + height: 23rpx; +} + +.contentmiddle { + margin: 0 auto; + margin-top: 50rpx; + width: 530rpx; +} + +.contentmiddle text { + font-size: 22rpx; + padding-bottom: 30rpx; + +} + +.contentup { + margin: 0 auto; + width: 555rpx; +} + +.contentup image { + width: 100%; + + margin: 0 auto; + margin-top: 30rpx; + height: 160rpx; +} \ No newline at end of file diff --git a/pages/indexlivesvoid/indexlivesvoid.js b/pages/indexlivesvoid/indexlivesvoid.js new file mode 100644 index 0000000..41b86d0 --- /dev/null +++ b/pages/indexlivesvoid/indexlivesvoid.js @@ -0,0 +1,143 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + onReady: function (e) { + // 使用 wx.createAudioContext 获取 audio 上下文 context + this.audioCtx = wx.createAudioContext('myAudio') + }, + /** + * 页面的初始数据 + */ + data: { + detailid: 0, + voddetail: [], + autodetail: [], + baseurl: baseUrl.globalData.baseimgurl, + replylist:[] + }, + audioPlay: function () { + this.audioCtx.play() + }, + audioPause: function () { + this.audioCtx.pause() + }, + audio14: function () { + this.audioCtx.seek(14) + }, + audioStart: function () { + this.audioCtx.seek(0) + }, + funplay: function () { + console.log("audio play"); + }, + funpause: function () { + console.log("audio pause"); + }, + funtimeupdate: function (u) { + console.log(u.detail.currentTime); + console.log(u.detail.duration); + }, + funended: function () { + console.log("audio end"); + }, + funerror: function (u) { + console.log(u.detail.errMsg); + }, + preview: function (params) { + console.log(params); + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let picsid = params.currentTarget.dataset.pics; //单条信息ID + console.log(picsid); + + let arr = []; + arr[0] = that.data.baseurl + picsid + console.log('-----'); + console.log(arr); + + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + this.setData({ + detailid: options.id + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let id = this.data.detailid; + this.msgdetail(id); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + msgdetail: function (e) { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/res/msgdetail'; + var param = { + id: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + voddetail: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/indexlivesvoid/indexlivesvoid.json b/pages/indexlivesvoid/indexlivesvoid.json new file mode 100644 index 0000000..85c0317 --- /dev/null +++ b/pages/indexlivesvoid/indexlivesvoid.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "直播", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/indexlivesvoid/indexlivesvoid.wxml b/pages/indexlivesvoid/indexlivesvoid.wxml new file mode 100644 index 0000000..70bfca2 --- /dev/null +++ b/pages/indexlivesvoid/indexlivesvoid.wxml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + {{voddetail['intro']}} + + + + + + + + + + + \ No newline at end of file diff --git a/pages/indexlivesvoid/indexlivesvoid.wxss b/pages/indexlivesvoid/indexlivesvoid.wxss new file mode 100644 index 0000000..d0ad4e8 --- /dev/null +++ b/pages/indexlivesvoid/indexlivesvoid.wxss @@ -0,0 +1,199 @@ +.courselive { + width: 750rpx; + height: 403rpx; + } + + .courselivecontinor { + background-color: #F5F5F5; + } + + .functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + } + + .areaitem { + display: flex; + flex-direction: column; + width: 666rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 20rpx; + } + + .areaitemup { + width: 100%; + height: 60rpx; + margin-top: 30rpx; + text-align: center; + } + + .areaitemdown { + width: 100%; + height: 60rpx; + } + + .percentageclass { + margin: 0 auto; + margin-top: 35rpx; + width: 412rpx; + } + + .messagearea text { + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; + margin-top: 60rpx; + } + + .msseagehead { + display: flex; + flex-direction: row; + } + + .headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; + } + + .headleft image { + + width: 130rpx; + height: 133rpx; + } + + .headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; + } + + .headrightup text { + + height: 40rpx; + width: 100rpx; + overflow: hidden; + font-size: 40rpx; + font-weight: 400rpx; + } + + .headrightdown { + margin-top: 10rpx; + } + + .msseagemiddle { + margin: 0 60rpx; + } + + .mssagemiddledown { + margin: 25rpx auto; + } + + .mssagemiddledown image { + + width: 100%; + height: 265rpx; + } + + .messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + + } + + .messageendleft { + width: 150rpx; + height: 30rpx; + } + + .messageendleft image { + width: 100rpx; + height: 30rpx; + } + + .messageendmiddle { + width: 150rpx; + height: 30rpx; + } + + .messageendmiddle image { + width: 35rpx; + height: 30rpx; + } + + .messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .messageendright { + + width: 150rpx; + height: 30rpx; + } + + .messageendright image { + width: 35rpx; + height: 30rpx; + + } + + .messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; + } + + .functionalarea { + margin-top: 0rpx; + } + + .paybtnclass { + margin-right: 80rpx; + } + + .adsclass { + + width: 666rpx; + margin: 0 auto; + background-color: #dbfeff; + height: 100%; + margin-top: 80rpx; + } + + .adsclassup image { + + width: 666rpx; + /* height: 285rpx; */ + /* height: 100%; */ + } + + .adsclassdown { + + width: 580rpx; + margin: 0 auto; + } + + .adsclassdown text { + margin-left: 30rpx; + font-size: 30rpx; + } \ No newline at end of file diff --git a/pages/indexobjectactivelist/indexobjectactivelist.js b/pages/indexobjectactivelist/indexobjectactivelist.js new file mode 100644 index 0000000..e104ce8 --- /dev/null +++ b/pages/indexobjectactivelist/indexobjectactivelist.js @@ -0,0 +1,123 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + messagelist:[], + baseurl:baseUrl.globalData.baseimgurl, + indexclassid:1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options.id); + this.setData({ + indexclassid:options.id + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.msglist(this.data.indexclassid); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + messageinfo:function(e){ + console.log("fan----------------"); + console.log(e); + let id=e.currentTarget.id; + this.msgadd(id); + + wx.navigateTo({ + url: '/pages/indexobjectivework/indexobjectivework?id='+id, + }) + }, + msgadd:function (params) { + + + const that = this; + let url = baseUrl.globalData.baseUrl + '/examobjectactive/examaddobjectactive'; + var param = { + user_id: wx.getStorageSync('wxuserid'), + examobjectactive_id:params + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + console.log(param); + console.log(res); + + + }).catch((errMsg) => { + console.log(errMsg); + }); + + + }, + msglist:function(params){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/examobjectactive/examobjectactivelist'; + var param = { + id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + messagelist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/indexobjectactivelist/indexobjectactivelist.json b/pages/indexobjectactivelist/indexobjectactivelist.json new file mode 100644 index 0000000..ed04cfa --- /dev/null +++ b/pages/indexobjectactivelist/indexobjectactivelist.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "客观题列表", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/indexobjectactivelist/indexobjectactivelist.wxml b/pages/indexobjectactivelist/indexobjectactivelist.wxml new file mode 100644 index 0000000..9cde991 --- /dev/null +++ b/pages/indexobjectactivelist/indexobjectactivelist.wxml @@ -0,0 +1,12 @@ + + + + + + + {{item.name}} + {{item.intro}} + + + + diff --git a/pages/indexobjectactivelist/indexobjectactivelist.wxss b/pages/indexobjectactivelist/indexobjectactivelist.wxss new file mode 100644 index 0000000..1c7b3fb --- /dev/null +++ b/pages/indexobjectactivelist/indexobjectactivelist.wxss @@ -0,0 +1,62 @@ +.messagelist { + display: flex; + flex-direction: row; + width: 678rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 35rpx; + border-radius: 3%; + border: 1rpx solid #22d0d7; + background-color: #dbfcfa; +} + +.messagelist2 { + display: flex; + flex-direction: row; + width: 678rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 35rpx; + border-radius: 3%; + border: 1rpx solid #fd7bb2; + background-color: #ffe6f3; +} + +.listleft { + + width: 12rpx; + height: 123; + margin: 23rpx 10rpx; +} + +.listleft image { + + width: 192rpx; + height: 123rpx; +} + +.listright { + width: 600rpx; + height: 123rpx; + margin: 23rpx 20rpx; +} + +.listrightup { + width: 600rpx; + overflow: hidden; + height: 50rpx; + line-height: 50rpx; +} + +.listrightup text { + width: 600rpx; + overflow: hidden; + font-size: 30rpx; + font-weight: 600; +} + +.listrightdown text { + width: 600rpx; + overflow: hidden; + font-size: 26rpx; +} \ No newline at end of file diff --git a/pages/indexobjectactiveworkok/indexobjectactiveworkok.js b/pages/indexobjectactiveworkok/indexobjectactiveworkok.js new file mode 100644 index 0000000..d7868da --- /dev/null +++ b/pages/indexobjectactiveworkok/indexobjectactiveworkok.js @@ -0,0 +1,126 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据---练习题查看交卷 + */ + data: { + title:'练习完成', + coursetypefour_id:1, + grouppaper_id:1, + listdata:[], + list:[] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + console.log(options.coursetypefour_id); + this.setData({ + coursetypefour_id:options.coursetypefour_id + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + getexamobjectactiovename: function (id) { + //得到试卷名称 + const that = this; + let url = baseUrl.globalData.baseUrl + '/examobjectactive/getexamobjectactiovename'; + var param = { + id: id, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + wx.setNavigationBarTitle({ + title: res.data["name"], + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getexamright(); + this.getexamobjectactiovename(this.data.coursetypefour_id); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getexamright:function() { + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/examobjectactive/examuseranswer'; + let user_id=wx.getStorageSync('wxuserid')==''?3:wx.getStorageSync('wxuserid'); + var param = { + coursetypefour_id: that.data.coursetypefour_id, + user_id:user_id + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + that.setData({ + list:res.data.itemdata, + listdata:res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + viewallexplain:function(params) { + console.log(params); + console.log(this.data.coursetypefour_id); + let typeid=params.currentTarget.id; + let coursetypefour_id=this.data.coursetypefour_id; + let grouppaper_id=this.data.grouppaper_id; + wx.navigateTo({ + url: '/pages/examanalysis/examanalysis?id='+typeid+'&coursetypefour_id='+coursetypefour_id+'&grouppaper_id='+grouppaper_id, + }) + } + +}) \ No newline at end of file diff --git a/pages/indexobjectactiveworkok/indexobjectactiveworkok.json b/pages/indexobjectactiveworkok/indexobjectactiveworkok.json new file mode 100644 index 0000000..4c8a691 --- /dev/null +++ b/pages/indexobjectactiveworkok/indexobjectactiveworkok.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "练习完成" +} \ No newline at end of file diff --git a/pages/indexobjectactiveworkok/indexobjectactiveworkok.wxml b/pages/indexobjectactiveworkok/indexobjectactiveworkok.wxml new file mode 100644 index 0000000..3e14f64 --- /dev/null +++ b/pages/indexobjectactiveworkok/indexobjectactiveworkok.wxml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + {{listdata.grouppapername}}(正确率{{listdata.rightdata}}%) + + + + + + + + {{index+1}} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/indexobjectactiveworkok/indexobjectactiveworkok.wxss b/pages/indexobjectactiveworkok/indexobjectactiveworkok.wxss new file mode 100644 index 0000000..efbe5d3 --- /dev/null +++ b/pages/indexobjectactiveworkok/indexobjectactiveworkok.wxss @@ -0,0 +1,158 @@ +/* pages/exampaper2/exampaper2.wxss *//* 交卷头部 */ +.exampaperhead { + width: 100%; + height: 225rpx; + border-bottom: 16rpx solid #e6e2e2; + background-color: #f5f5f5; +} + +.headup { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 100rpx; + padding-top: 60rpx; +} + +.headup text { + font-size: 60rpx; + font-weight: 400; + color: #000000; +} + +.headdown { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 55rpx; + padding-top: 30rpx; +} + +.headdown text { + + font-size: 30rpx; + font-weight: 400; + color: #808080; +} + +/* 交卷头部 */ + +/* 提卷内容 */ +.subitexamcontent { + width: 680rpx; + margin: 40rpx auto; +} + +.examcontentup { + height: 40rpx; + border-left: 8rpx solid #1ccfd6; + margin-bottom: 40rpx; + margin-top: 40rpx; +} + +.examcontentup text { + + margin-left: 20rpx; + color: #010101; + font-size: 30rpx; + font-weight: 400; +} + +.examcontentdown { + display: flex; + flex-wrap: wrap; + width: 660rpx; + margin: 0 30rpx; +} + +.downitem { + width: 77rpx; + height: 77rpx; + flex: 0 19% !important; + margin-bottom: 40rpx; +} + +.examcontentdown image { + width: 77rpx; + height: 77rpx; + margin: 0 auto; + margin-top: 20rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + right:2rpx; + left: 10px; + top: -36px; + text-align: center; +} + +/* 提卷内容 */ + +/* 试卷时间 */ +.examtiems { + + width: 680rpx; + height: 50rpx; + margin: 50rpx auto; +} + +.examtiems text { + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + font-size: 30rpx; + font-weight: 400; +} + + + +/* 试卷解释 */ +.examanalysis { + + width: 680rpx; + height: 100rpx; + margin: 0 30rx; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + position: fixed; + bottom: 0; + display: none; +} + +.alysisleft{ + + width: 330rpx; + height: 80rpx; + margin-left: 30rpx; +} + +.alysisleft image { + width: 330rpx; + height: 80rpx; +} +.alysisright{ + + width: 330rpx; + height: 80rpx; +} +.alysisright image { + margin-left: 30rpx; + width: 330rpx; + height: 80rpx; +} + +/* 试卷解释 */ \ No newline at end of file diff --git a/pages/indexobjectivework/indexobjectivework.js b/pages/indexobjectivework/indexobjectivework.js new file mode 100644 index 0000000..0f002a3 --- /dev/null +++ b/pages/indexobjectivework/indexobjectivework.js @@ -0,0 +1,290 @@ +var WxParse = require('../../wxParse/wxParse.js'); +const app = getApp(); +var that; +var Interval; +var wechat; +var id; +var intt; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + startX: 0, + startY: 0, + isClear: false, + + /** + * 页面的初始数据 + */ + data: { + reexam: 0, //是否反复作答 0不是,1是 + index: 0, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + timecount: '00:00:00', + cost: 0, + flag: 1, + endtime: "", + baseurl: baseUrl.globalData.baseimgurl, + time: 1 * 60 * 60 * 1000, //初始时间 + paystatus: 1, //1未开始时间开始状态,2开始 + collection: 1, //1不收藏,2已收藏 + singdouble: 1, //1单选,2多选 + paiduanactive: 1,//1不是判断,2是判断题 + zstime: 1, //1正计,0倒计 + typeid: 1, //0练习1正式 + activeopen: true, + coursetypefour_id: 1, + itemdatacurrent: [], //当前数据 + itemdataall: [], //全部数据 + itemdata: ['A', 'B', 'C', 'D'], //选项数据 + content: "",//富文本数据 + showModalStatus: false, + pen: 3, + color: '#FFFFFF', + currentTab: 0, + now: 1, //当前页码 + all: 15, //总页码 + height: 0, + Timer_state: 1, + Answer_card: false, + Draft_paper: false, + false_analysis: false, + stem_height: 150, + jiexi: false, + field: { + analysis_text: "", + }, + img: [], + scroll: "scroll", + drag_line: false, + showvide: false, + showexampop: false, //查看交卷, + examlistdata: [], + examlist: [], + }, + showPopup: function (params) { + console.log("params======="); + console.log(params); + let coursetypefour_id = params.currentTarget.id; + + wx.navigateTo({ + url: '/pages/indexobjectactiveworkok/indexobjectactiveworkok?coursetypefour_id=' + coursetypefour_id, + }) + console.log("查看交卷"); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + baseUrl.islogin(); + this.setData({ + coursetypefour_id: options.id + }) + + }, + + /**getcoursetypefourexam + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.getcoursetypefourexam(this.data.coursetypefour_id); + this.getexamobjectactiovename(this.data.coursetypefour_id); + // this.initadddata(this.data.itemdataall, this.data.coursetypefour_id, wx.getStorageSync('wxuserid')); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + + finished() { + console.log("交卷") + }, + collectionselect: function (e) { + console.log(e); + this.getcollectionclick(e.currentTarget.id, wx.getStorageSync('wxuserid')); + }, + + + //----------------------------- + // 手机触摸开始 + //----------------------------- + touchStart: function (e) { + //得到触摸点的坐标 + this.startX = e.changedTouches[0].x + this.startY = e.changedTouches[0].y + this.context = wx.createContext() + this.context.setStrokeStyle(this.data.color) + this.context.setLineWidth(this.data.pen) + this.context.setLineCap('round') // 让线条圆润 + this.context.beginPath() + + }, + //----------------------------- + // 触摸后移动 + //----------------------------- + touchMove: function (e) { + + var startX1 = e.changedTouches[0].x + var startY1 = e.changedTouches[0].y + this.context.moveTo(this.startX, this.startY) + this.context.lineTo(startX1, startY1) + this.context.stroke() + this.startX = startX1; + this.startY = startY1; + wx.drawCanvas({ + canvasId: 'myCanvas', + reserve: true, + actions: this.context.getActions() + }) + }, + + + //多选 + bindList(e) { + this.getids(); + let index = e.currentTarget.dataset.id; + console.log(index); + let arr = this.data.itemdata.map(item => { + if (item.id == index && item.selectvalue == "1") { + item.selectvalue = "2"; + } else if (item.id == index) { + item.selectvalue = "1"; + } + return item + }) + console.log(arr); + this.setData({ + itemdata: arr + }); + + }, //获取id + getids() { + let ids = this.data.itemdata.filter(item => item.selectvalue == '2').map(item => item.charmu); + let dx = this.data.itemdata.filter(item => item.selectvalue == '2').map(item => item.charmu); + console.log(ids); + console.log(dx); + console.log('多选Id:' + ids) + console.log('单选Id:' + dx); + console.log(this.data.itemdatacurrent); + let itemcurrent = this.data.itemdatacurrent; + let user_id = wx.getStorageSync('wxuserid') == '' ? 3 : wx.getStorageSync('wxuserid'); + let examanswer = 1; + if (itemcurrent.examtype == 1) { + examanswer = dx + ''; + } else { + examanswer = ids + ''; + } + // this.addexamdata(this.data.coursetypefour_id, itemcurrent.examtype, itemcurrent.typeid, itemcurrent.id, itemcurrent.itemname, examanswer, itemcurrent.answer, user_id, itemcurrent.grouppaper_id, this.data.index, this.data.now); + + }, + + bindActive: function (params) { + console.log(this.data.coursetypefour_id); + console.log(params.currentTarget.id); + console.log(params.currentTarget.dataset.id); + this.updateexamdata(params.currentTarget.id, params.currentTarget.dataset.id); + + }, + getexamobjectactiovename: function (id) { + //得到试卷名称 + const that = this; + let url = baseUrl.globalData.baseUrl + '/examobjectactive/getexamobjectactiovename'; + var param = { + id: id, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + wx.setNavigationBarTitle({ + title: res.data["name"], + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + updateexamdata: function (id, answer) { + + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/examobjectactive/updateexamdata'; + var param = { + id: id, + answer: answer, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + this.getcoursetypefourexam(that.data.coursetypefour_id); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getcoursetypefourexam: function (params) { + + //得到练习题目 + const that = this; + let url = baseUrl.globalData.baseUrl + '/examobjectactive/paperexamitem'; + var param = { + coursetypefour_id: params, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log("res===================="); + console.log(res); + that.setData({ + itemdataall: res.data, + itemdata: res.data + }); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, +}) \ No newline at end of file diff --git a/pages/indexobjectivework/indexobjectivework.json b/pages/indexobjectivework/indexobjectivework.json new file mode 100644 index 0000000..6f0c60a --- /dev/null +++ b/pages/indexobjectivework/indexobjectivework.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "考试进行中。。。" +} \ No newline at end of file diff --git a/pages/indexobjectivework/indexobjectivework.wxml b/pages/indexobjectivework/indexobjectivework.wxml new file mode 100644 index 0000000..2c3e00b --- /dev/null +++ b/pages/indexobjectivework/indexobjectivework.wxml @@ -0,0 +1,45 @@ + + + + + + {{item.exam_id}} + + + + + + 【A】 + 【A】 + + + 【B】 + 【B】 + + + + 【C】 + 【C】 + + + + 【D】 + 【D】 + + + + + + + + + + + + + + + + + + diff --git a/pages/indexobjectivework/indexobjectivework.wxss b/pages/indexobjectivework/indexobjectivework.wxss new file mode 100644 index 0000000..1908bad --- /dev/null +++ b/pages/indexobjectivework/indexobjectivework.wxss @@ -0,0 +1,409 @@ +.page { + background-color: #ededed; +} + +.examing { + display: flex; + flex-direction: row; + align-items: center; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + top: 0; +} + +.item1 { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; +} + +.item1 image { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; +} + +.item4 { + width: 50rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 80rpx; + +} + +.item4 image { + width: 50rpx; + height: 44rpx; + margin: 0 19rpx; +} + +.item5 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 120rpx; + +} + +.item5 image { + width: 38rpx; + height: 47rpx; + margin: 0 22rpx; +} + +.item2 { + width: 150rpx; + height: 50rpx; + margin-top: 16rpx; + margin-left: 19rpx; +} + +.item2 text { + width: 150rpx; + height: 50rpx; + color: white; +} + +.item3 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 79rpx; +} + +.item3 text { + width: 100rpx; + height: 50rpx; + color: white; +} + +.examingfooter { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: relative; + bottom: 0; +} + +.footerleft image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.footermiddle image { + margin: 0 auto; + + width: 160rpx; + height: 53rpx; +} + +.footerright image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; +} + +.examingcontent { + width: 100%; + margin: 80rpx 20rpx; + /* max-height: 250rpx; + overflow: hidden; */ +} + +.examingcontent2 { + width: 100%; + margin: 80rpx auto; +} + + +.examingcontent text { + font-size: 30rpx; + font-weight: 400; + +} + +.examintcontentda { + width: 700rpx; + margin: 0 auto; + float: left; + margin-bottom: 50rpx; + margin-top: 30rpx; +} + +.contentleft { + float: left; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin-left: 25rpx; +} + +.contentleft image { + width: 49rpx; + height: 49rpx; +} + +.contentright { + display: flex; + flex-direction: row; + margin-left: 25rpx; + margin-right: 50rpx; + width: 600rpx; +} + +.examitem { + + width: 100rpx; + height: 60rpx; + margin-left: 30rpx; + +} +.examitem text{ + + font-size: 50rpx; + width: 100rpx; + height: 60rpx; +} + +.charclass { + display: flex; + justify-items: center; +} + +.charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + left: 8rpx; + top: -60rpx; + text-align: center; +} + +.item2 .van-count-down { + color: white; +} + +/*草稿纸*/ +.topic_cgz { + position: fixed; + top: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.4); + z-index: 999; + overflow: hidden; +} + +.topic_cgz_tab { + width: 100%; + height: 100%; + padding: 0; + position: fixed; + top: 0rpx; +} + +.topic_cgz_tab .fl { + width: 25%; + text-align: center; +} + +.topic_cgz_tab image { + width: 60rpx; + height: 60rpx; +} + +/*滚动层*/ +scroll-item { + z-index: 9; +} + +.scoll-h { + height: 100%; +} + +.tab-content { + height: 100%; + width: 100%; + background: #fff; +} + +.the_big_box { + height: 100%; + width: 100%; + background: #fff; + overflow-x: hidden; +} + +.tab-content-top { + margin-top: 20rpx; +} + +.toolsclass { + display: flex; + justify-items: center; + justify-content: space-between; + width: 100%; + margin: 0 auto; + height: 200rpx; + position: fixed; + bottom: 200; +} + +.openclass { + + display: flex; + justify-content: center; + width: 700rpx; + margin: 80rpx auto; + +} + +.openclass image { + width: 120rpx; + height: 24rpx; +} + +.headdouble { + display: flex; + flex-direction: row; + width: 100%; + margin: 0 auto; +} + +.headdoubleleft { + width: 100%; +} + +.headdoubleright { + width: 95%; + margin: 0 auto; +} + + + +/* 提卷内容 */ +.popsubitexamcontent { + width: 680rpx; + margin: 40rpx auto; +} + +.popexamcontentup { + height: 40rpx; + border-left: 8rpx solid #1ccfd6; + margin-bottom: 40rpx; + margin-top: 40rpx; +} + +.popexamcontentup text { + + margin-left: 20rpx; + color: #010101; + font-size: 30rpx; + font-weight: 400; +} + +.popexamcontentdown { + display: flex; + flex-wrap: wrap; + width: 660rpx; + margin: 0 30rpx; +} + +.popdownitem { + width: 77rpx; + height: 77rpx; + flex: 0 19% !important; + margin-bottom: 40rpx; +} + +.popexamcontentdown image { + width: 77rpx; + height: 77rpx; + margin: 0 auto; + margin-top: 20rpx; +} + +.popcharclass { + display: flex; + justify-items: center; +} + +.popcharclass text { + width: 37rpx; + height: 33rpx; + position: relative; + right: 2rpx; + left: 10px; + top: -36px; + text-align: center; +} + +/* 提卷内容 */ + + +/* 试卷解释 */ +.popexamanalysis { + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + position: fixed; + left: 36rpx; + bottom: 20rpx; + width: 680rpx; + height: 100rpx; + margin: 0 auto; + +} + +.popalysisleft { + + width: 330rpx; + height: 130rpx; + align-items: center; +} + +.popalysisleft image { + width: 330rpx; + height: 100rpx; +} + +.popalysisright { + + width: 330rpx; + height: 80rpx; +} + +.popalysisright image { + margin-left: 30rpx; + width: 330rpx; + height: 80rpx; +} + +/* 试卷解释 */ + +.examiteminfocs { + position: relative; + height:200rpx; + margin-bottom: 100rpx; + padding-top: 100rpx; +} + +.colorchamu{ + color: rgb(0, 24, 236); +} +.mainclass{ + margin: 0 auto; + display: flex; + flex-direction: column; + padding-bottom: 50rpx; + margin-top: 50rpx; +} \ No newline at end of file diff --git a/pages/indexreslists/indexreslists.js b/pages/indexreslists/indexreslists.js new file mode 100644 index 0000000..656b372 --- /dev/null +++ b/pages/indexreslists/indexreslists.js @@ -0,0 +1,144 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + startPageX: 0, + currentView: DEFAULT_PAGE, + baseurl:baseUrl.globalData.baseimgurl, + movies: [], + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + itemdata: [], + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + console.log(e.currentTarget.id); + this.setData({ + active: e.currentTarget.id + }) + this.getpaperattrlist(e.currentTarget.id); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getpapertype(); + this.getpaperattrlist(1); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + examclicking:function(e){ + + console.log(e); + wx.navigateTo({ + url: '/pages/indexrespage/indexrespage?id='+e.currentTarget.id, + }) + }, + getpapertype:function(){ + const that = this; + let url = baseUrl.globalData.baseUrl + '/paperlist/getpapertypelist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + list: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getpaperattrlist:function(params) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/res/reslist'; + var param = { + papertype_id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + itemdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/indexreslists/indexreslists.json b/pages/indexreslists/indexreslists.json new file mode 100644 index 0000000..ef4e026 --- /dev/null +++ b/pages/indexreslists/indexreslists.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "资料下载", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/indexreslists/indexreslists.wxml b/pages/indexreslists/indexreslists.wxml new file mode 100644 index 0000000..5cc197b --- /dev/null +++ b/pages/indexreslists/indexreslists.wxml @@ -0,0 +1,23 @@ + + + + + + + + {{item.name}} + + + 点击查看全部 + + + + + + + + + + + + diff --git a/pages/indexreslists/indexreslists.wxss b/pages/indexreslists/indexreslists.wxss new file mode 100644 index 0000000..083b95c --- /dev/null +++ b/pages/indexreslists/indexreslists.wxss @@ -0,0 +1,85 @@ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; + } + .curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; + } + + .curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; + } + + .scroll-box { + white-space: nowrap; + height: 100%; + } + + .card-box { + display: inline-block; + margin-right: 10rpx; + } + + .card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; + } + .lineclass { + width: 685rpx; + margin: 30rpx auto; + border-bottom: 1rpx solid #dcdcdc; + } + .itemdataclass{ + display: flex; + flex-direction: row; + align-items:center; + justify-content:space-between; + width: 680rpx; + height: 160rpx; + margin: 0 auto; + margin-top:20rpx; + background-color: #f0f0f0; + border-radius: 15rpx; + } + .item1 image{ + width: 110rpx; + height: 110rpx; + margin: 0 35rpx; + } + .item2{ + width: 390rpx; + display: flex; + flex-direction: column; + justify-content: start; + } + .item2up text{ + font-size: 40rpx; + font-weight: 400; + } + .item2donw text{ + font-size: 30rpx; + font-weight: 200; + } + .item3{ + width: 80rpx; + margin-right:35rpx; + } + .item3 text{ + font-size: 30rpx; + font-weight: 400; + } + .item4{ + margin-right:50rpx; + } + .item4 image{ + width: 38rpx; + height: 38rpx; + } + \ No newline at end of file diff --git a/pages/indexreslistsnew/indexreslistsnew.js b/pages/indexreslistsnew/indexreslistsnew.js new file mode 100644 index 0000000..6a30ee8 --- /dev/null +++ b/pages/indexreslistsnew/indexreslistsnew.js @@ -0,0 +1,156 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + startPageX: 0, + currentView: DEFAULT_PAGE, + baseurl:baseUrl.globalData.baseimgurl, + movies: [], + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + itemdata: [], + pid:0, + classname:"" + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + console.log(e.currentTarget.id); + this.setData({ + active: e.currentTarget.id + }) + this.getpaperattrlist(e.currentTarget.id); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + this.setData({ + pid:options.id + }) + + wx.setNavigationBarTitle({ + title: '班级资料类型列表'}) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + // this.getpapertype(); + // this.getpaperattrlist(1); + this.getpaperattrlist(this.data.pid); + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + examclicking:function(e){ + + console.log(e); + let id=e.currentTarget.id; + let indexclassrestype_id=e.currentTarget.dataset.indexclassrestypeid; + wx.navigateTo({ + url: '/pages/indexclassres/indexclassres?classid='+indexclassrestype_id+"&indexclassrestype_id="+id, + }) + }, + getpapertype:function(){ + const that = this; + let url = baseUrl.globalData.baseUrl + '/paperlist/getpapertypelist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + list: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getpaperattrlist:function(params) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/res/indexclassrestype'; + var param = { + indexclasslist_id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + itemdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/indexreslistsnew/indexreslistsnew.json b/pages/indexreslistsnew/indexreslistsnew.json new file mode 100644 index 0000000..027e447 --- /dev/null +++ b/pages/indexreslistsnew/indexreslistsnew.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "资料下载", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/indexreslistsnew/indexreslistsnew.wxml b/pages/indexreslistsnew/indexreslistsnew.wxml new file mode 100644 index 0000000..76ad03b --- /dev/null +++ b/pages/indexreslistsnew/indexreslistsnew.wxml @@ -0,0 +1,22 @@ + + + + + + + + {{item.name}} + + + 点击查看全部 + + + + + + + + + + + \ No newline at end of file diff --git a/pages/indexreslistsnew/indexreslistsnew.wxss b/pages/indexreslistsnew/indexreslistsnew.wxss new file mode 100644 index 0000000..37c80b4 --- /dev/null +++ b/pages/indexreslistsnew/indexreslistsnew.wxss @@ -0,0 +1,84 @@ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; +} +.curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; + margin-right: 10rpx; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} +.lineclass { + width: 685rpx; + margin: 30rpx auto; + border-bottom: 1rpx solid #dcdcdc; +} +.itemdataclass{ + display: flex; + flex-direction: row; + align-items:center; + justify-content:space-between; + width: 680rpx; + height: 160rpx; + margin: 0 auto; + margin-top:20rpx; + background-color: #f0f0f0; + border-radius: 15rpx; +} +.item1 image{ + width: 110rpx; + height: 110rpx; + margin: 0 35rpx; +} +.item2{ + width: 390rpx; + display: flex; + flex-direction: column; + justify-content: start; +} +.item2up text{ + font-size: 40rpx; + font-weight: 400; +} +.item2donw text{ + font-size: 30rpx; + font-weight: 200; +} +.item3{ + width: 80rpx; + margin-right:35rpx; +} +.item3 text{ + font-size: 30rpx; + font-weight: 400; +} +.item4{ + margin-right:50rpx; +} +.item4 image{ + width: 38rpx; + height: 38rpx; +} diff --git a/pages/indexrespage/indexrespage.js b/pages/indexrespage/indexrespage.js new file mode 100644 index 0000000..f7b70ad --- /dev/null +++ b/pages/indexrespage/indexrespage.js @@ -0,0 +1,165 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + startPageX: 0, + currentView: DEFAULT_PAGE, + baseurl: baseUrl.globalData.baseimgurl, + movies: [], + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + itemdata: [], + resfiles_id: 1, + pathid: "", + showdiage: false + }, + getpaperattrlist: function (params) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/res/getrespagelist'; + var param = { + resfiles_id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + itemdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + this.setData({ + resfiles_id: options.id + }) + }, + onshowdiageClose() { + console.log('324323222222') + this.setData({ + showdiage: false + }); + console.log(this.data.showdiage) + }, + downfilepoto: function (knowfiles) { + + // let files = knowfiles.currentTarget.id; + let files = this.data.pathid + wx.downloadFile({ + url: files, + success(res) { + wx.openDocument({ + filePath: res.tempFilePath, + showMenu: true, //关键点 + success() { + } + }) + } + }) + }, + downfile: function (knowfiles) { + + let files = this.data.pathid;// knowfiles.currentTarget.id; + + wx.downloadFile({ + url: files, + success(res) { + + wx.shareFileMessage({ + filePath: res.tempFilePath, + success() { }, + fail: console.error, + }) + + } + }) + }, + showdiagePopup(e) { + console.log(e); + let pathid = e.currentTarget.id; + + let files = pathid; // knowfiles.currentTarget.id; + if (files.length == 0) { + + wx.showToast({ + title: '暂时还没有讲义,不可下载',//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { + return; + },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + } else { + this.setData({ showdiage: true, pathid: pathid }); + } + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + this.getpaperattrlist(this.data.resfiles_id); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, +}) \ No newline at end of file diff --git a/pages/indexrespage/indexrespage.json b/pages/indexrespage/indexrespage.json new file mode 100644 index 0000000..ef4e026 --- /dev/null +++ b/pages/indexrespage/indexrespage.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "资料下载", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/indexrespage/indexrespage.wxml b/pages/indexrespage/indexrespage.wxml new file mode 100644 index 0000000..5f52961 --- /dev/null +++ b/pages/indexrespage/indexrespage.wxml @@ -0,0 +1,27 @@ + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + diff --git a/pages/indexrespage/indexrespage.wxss b/pages/indexrespage/indexrespage.wxss new file mode 100644 index 0000000..826752b --- /dev/null +++ b/pages/indexrespage/indexrespage.wxss @@ -0,0 +1,109 @@ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; +} + +.curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; + margin-right: 10rpx; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.lineclass { + width: 685rpx; + margin: 30rpx auto; + border-bottom: 1rpx solid #dcdcdc; +} + +.itemdataclass { + display: flex; + flex-direction: column; + align-items: flex-start; + width: 680rpx; + height: 200rpx; + margin: 0 auto; + margin-top: 20rpx; + background-color: #f0f0f0; + border-radius: 15rpx; +} + +.item1 { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + height: 103rpx; + +} + +.item1up image { + width: 45rpx; + height: 45rpx; + margin-left: 30rpx; + margin-top: 20rpx; +} + +.item1down text { + margin-left: 20rpx; + margin-top: 20rpx; + font-size: 30rpx; + font-weight: 400; +} + +.item2donw image { + margin-left: 10rpx; + margin-top: 20rpx; + width: 272rpx; + height: 55rpx; +} + +.item3 { + width: 80rpx; + margin-right: 35rpx; +} + +.item3 text { + font-size: 30rpx; + font-weight: 400; +} + +.item4 { + margin-right: 50rpx; +} + +.item4 image { + width: 38rpx; + height: 38rpx; +} + +.line_02 { + height: 1px; + border-top: 1px solid #ddd; + text-align: center; + width: 370px; + margin: 0 auto; +} \ No newline at end of file diff --git a/pages/indexsq/indexsq.js b/pages/indexsq/indexsq.js new file mode 100644 index 0000000..e4ba8cf --- /dev/null +++ b/pages/indexsq/indexsq.js @@ -0,0 +1,286 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: Apps.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [], //图片预览 + showview: false, + upload_picture_list: [], + imagesListp: [], + imagestr: [], + id: 1, + accesstoken: '', + typeid: wx.getStorageSync('jmparm') == null ? 1 : wx.getStorageSync('jmparm'), + page: 1, //页面数, + pagecount: 0, + itemdata: [], + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + + if (options.length > 0) { + this.setData({ + active: options.id == '' ? 1 : options.id, + page: 1, + typeid: wx.getStorageSync('jmparm') + }) + } + wx.setStorageSync('jmparm',1); + this.setData({ + challengeactive: wx.getStorageSync('jmparm') == null ? 1 : wx.getStorageSync('jmparm') + }) + + }, + + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + Apps.islogin(); + console.log("=================="); + console.log(wx.getStorageSync('jmparm')) + this.getpaper(wx.getStorageSync('jmparm')); //班级列表 1全部,2我的班级 + this.setData({ + active: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm'), + typeid: wx.getStorageSync('jmparm') == '' ? 1 : wx.getStorageSync('jmparm') + }) + //头部消息 + this.msglist(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + getacctoken: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: '1213' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + + wx.setStorageSync('jmparm', e.currentTarget.id); + this.setData({ + active: e.currentTarget.id, + typeid: e.currentTarget.id + }) + this.getwords(); + }, + duizhiticlick: function () { + wx.navigateTo({ + url: '/pages/allpapers/allpapers', + }) + }, + messagelistclick: function () { + wx.navigateTo({ + url: '/pages/messagelist/messagelist', + }) + }, + communityinfoclick: function (e) { + + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + }) + }, + communityinfocommentclick: function (e) { + + wx.navigateTo({ + //communityinfocomment + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id + '&jztype=2', + }) + }, + messagelistclick: function (e) { + //资讯列表分类 + wx.navigateTo({ + url: '/pages/messagelist/messagelist?typeid=' + e.currentTarget.id, + }) + }, + messageclick: function (e) { + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=' + e.currentTarget.id, + }) + + // wx.navigateTo({ + // url: '/pages/indexclass/indexclass?id=' + e.currentTarget.id, + // }) + }, + msglist: function () { + + const that = this; + let url = Apps.globalData.baseUrl + '/msglist/msgindexlist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + messagelist: res.data.sort() + + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + + // 触底加载 + onReachBottom: function () { + + this.setData({ + page: this.data.page + 1 + }) + let newpage = (this.data.page + 1); //页数触底加1 + console.log(newpage); + if (newpage * 10 >= this.data.pagecount) { + + wx.showToast({ + title: '触底了,没有可加载的数据了', + icon: 'none', + duration: 1500 + }) + + } else { + this.getwords(); + } + + }, + getpaper: function (params) { + const that = this; + let url = Apps.globalData.baseUrl + '/indexclass/indexclasslist'; + var param = { + typepid: params, + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log("----------"); + console.log(res.data); + // wx.setStorageSync('jmparm',2); + that.setData({ + itemdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + examingbtnclick: function (params) { + console.log(params.currentTarget.id); + console.log("---------------------2") + console.log(wx.getStorageSync('jmparm')); + if(wx.getStorageSync('jmparm')==2){ + + wx.setStorageSync('jmparm',1); + + wx.navigateTo({ + url: '/pages/indexclass/indexclass?id=' +params.currentTarget.id, + }) + }else{ + wx.navigateTo({ + url: '/pages/indexclassintro/indexclassintro?id='+params.currentTarget.id, + }) + + } + + + + }, + challengeclickleft(e) { + console.log(e.currentTarget.id); + wx.setStorageSync('jmparm', e.currentTarget.id) + this.setData({ + challengeactive: e.currentTarget.id + }) + this.getpaper(e.currentTarget.id); + } +}) \ No newline at end of file diff --git a/pages/indexsq/indexsq.json b/pages/indexsq/indexsq.json new file mode 100644 index 0000000..b7e9443 --- /dev/null +++ b/pages/indexsq/indexsq.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh":true, + "navigationBarTitleText": "怼社区" + } \ No newline at end of file diff --git a/pages/indexsq/indexsq.wxml b/pages/indexsq/indexsq.wxml new file mode 100644 index 0000000..4156c4e --- /dev/null +++ b/pages/indexsq/indexsq.wxml @@ -0,0 +1,44 @@ + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + + + diff --git a/pages/indexsq/indexsq.wxss b/pages/indexsq/indexsq.wxss new file mode 100644 index 0000000..178afd8 --- /dev/null +++ b/pages/indexsq/indexsq.wxss @@ -0,0 +1,508 @@ +/* pages/indexsq/indexsq.wxss */ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; +} + +.areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; +} + +.areaitem image { + width: 120rpx; + height: 170rpx; +} + +.messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; +} + +.headrightup text { + + font-size: 30rpx; + font-weight: 400rpx; +} + +.headrightdown { + font-size: 30rpx; + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.mssagemiddledownone image { + width: 100%; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.areaclass { + + width: 540rpx; + height: 193rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 26rpx; + height: 26rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.vipimage image { + width: 37rpx; + height: 33rpx; + position: relative; + left: -32rpx; + top: 148rpx; +} + +/* 社区头部 */ +.communityhead { + width: 695rpx; + height: 220rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/communtlistheadleft.png') no-repeat; + background-size:100% 100%; + margin: 0 auto; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + +} + +.communityheadleft { + width: 690rpx; + height: 210rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + +} + +.communityheadright { + width: 232rpx; + height: 206rpx; + margin-left: 40rpx; +} + +.communityheadrightup { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; +} + +.communityheadrightup image { + width: 240rpx; + height: 80rpx; +} + +.communityheadrightdown { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; +} + +.communityheadrightdown image { + width: 240rpx; + height: 80rpx; +} + +.communityheadleftitem1 { + width: 550rpx; + margin-left: 65rpx; + display: flex; + flex-direction: column; + justify-content: left; + align-items: left; +} + +.communityheadleftitem2 { + width: 100rpx; + height: 210rpx; +} + +.communityheadleftitem2 image { + width: 100rpx; + height: 210rpx; +} + +.messageitem { + width: 400rpx; + height: 38rpx; + border: 1rpx solid #1ccfd6; + color: #1ccfd6; + margin-left: 40rpx; + margin-bottom: 10rpx; + text-align: left; + overflow: hidden; +} + +/* 社区头部 */ + +/* 社区滑动 */ +.curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; +} + +.curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; +} + +.curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; +} + +.scroll-box { + white-space: nowrap; + height: 100%; +} + +.card-box { + display: inline-block; + margin-right: 10rpx; +} + +.card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; +} + +.lineclass { + width: 685rpx; + margin: 2rpx auto; + border-bottom: 1rpx solid #dcdcdc; +} + +/* 社区滑动 */ + + + +/* 补充留言信息右边 */ + +.header_view_hide { + display: none; +} + +.header_view_show { + display: block; +} + +.round-click { + height: 61rpx; + width: 54rpx; + position: fixed; + bottom: 150rpx; + right: 20rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 9; +} + +.round-click image { + height: 61rpx; + line-height: 61rpx; + width: 54rpx; +} + +.areaclass { + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; +} + +.areaclass textarea { + width: 540rpx; + min-height: 300rpx; +} + + +.areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; +} + +.areafooterleft image { + + width: 52rpx; + height: 52rpx; + +} + +.areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; +} + +.areafooterright { + width: 120rpx; + height: 56rpx; +} + +.areafooterright button { + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border: none; +} + + +.challenge { + + width: 666rpx; + margin: 0 auto; + margin-top:35rpx; + margin-bottom:15rpx; + height: 83rpx; +} + +.challengeleft { + + float: left; + width: 429rpx; + height: 80rpx; + +} + +.challengeleft image { + + width: 440rpx; + height: 80rpx; +} + +.challengeright { + + float: left; + width: 238rpx; + height: 80rpx; +} + +.challengeright image { + + width: 240rpx; + height: 80rpx; +} + + +.challenge2 { + + width: 666rpx; + margin: 0 auto; + margin-top:35rpx; + margin-bottom:15rpx; + height: 83rpx; +} + +.challenge2left { + + float: left; + + width: 238rpx; + height: 80rpx; + +} + +.challenge2left image { + + + width: 253rpx; + height: 80rpx; +} + +.challenge2right { + float: left; + width: 429rpx; + height: 80rpx; +} + +.challenge2right image { + + width: 432rpx; + height: 80rpx; +} +.examitemlist { + display: flex; + flex-direction: row; + align-items: center; + width: 690rpx; + height: 128rpx; + margin: 0 auto; + margin-top: 28rpx; + background-color: #f0f0f0; + background: url('https://ndnd.duiduiedu.com/uploads/pics/classclass.png') no-repeat; + background-size: 100% 100%; + } + + .itemleft image { + + margin: 10rpx 20rpx; + width: 106rpx; + height: 95rpx; + } + + .itemright{ + display: flex; + width: 500rpx; + justify-items: center; + align-items: left; + } + .itemright text{ + margin-left: 30rpx; + font-size: 40rpx; + font-weight: 400; + } \ No newline at end of file diff --git a/pages/knowledge/knowledge.js b/pages/knowledge/knowledge.js new file mode 100644 index 0000000..4e2b40c --- /dev/null +++ b/pages/knowledge/knowledge.js @@ -0,0 +1,143 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + onReady: function (e) { + // 使用 wx.createAudioContext 获取 audio 上下文 context + this.audioCtx = wx.createAudioContext('myAudio') + }, + /** + * 页面的初始数据 + */ + data: { + detailid: 0, + voddetail: [], + autodetail: [], + baseurl: baseUrl.globalData.baseimgurl + }, + audioPlay: function () { + this.audioCtx.play() + }, + audioPause: function () { + this.audioCtx.pause() + }, + audio14: function () { + this.audioCtx.seek(14) + }, + audioStart: function () { + this.audioCtx.seek(0) + }, + funplay: function () { + console.log("audio play"); + }, + funpause: function () { + console.log("audio pause"); + }, + funtimeupdate: function (u) { + console.log(u.detail.currentTime); + console.log(u.detail.duration); + }, + funended: function () { + console.log("audio end"); + }, + funerror: function (u) { + console.log(u.detail.errMsg); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + this.setData({ + detailid: options.examid + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let id = this.data.detailid; + this.msgdetail(id); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + preview: function (params) { + console.log(params); + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let picsid = params.currentTarget.dataset.pics; //单条信息ID + console.log(picsid); + + let arr = []; + arr[0] = that.data.baseurl + picsid + console.log('-----'); + console.log(arr); + + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + msgdetail: function (e) { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/msglist/knowledgedetail'; + var param = { + id: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + voddetail: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/knowledge/knowledge.json b/pages/knowledge/knowledge.json new file mode 100644 index 0000000..f915065 --- /dev/null +++ b/pages/knowledge/knowledge.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "知识要点", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" + } \ No newline at end of file diff --git a/pages/knowledge/knowledge.wxml b/pages/knowledge/knowledge.wxml new file mode 100644 index 0000000..583be10 --- /dev/null +++ b/pages/knowledge/knowledge.wxml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + {{voddetail['intro']}} + + + + + + + + + + + \ No newline at end of file diff --git a/pages/knowledge/knowledge.wxss b/pages/knowledge/knowledge.wxss new file mode 100644 index 0000000..1be597f --- /dev/null +++ b/pages/knowledge/knowledge.wxss @@ -0,0 +1,198 @@ +.courselive { + width: 750rpx; + height: 403rpx; + } + + .courselivecontinor { + background-color: #F5F5F5; + } + + .functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + } + + .areaitem { + display: flex; + flex-direction: column; + width: 666rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 20rpx; + } + + .areaitemup { + width: 100%; + height: 60rpx; + margin-top: 30rpx; + text-align: center; + } + + .areaitemdown { + width: 100%; + height: 60rpx; + } + + .percentageclass { + margin: 0 auto; + margin-top: 35rpx; + width: 412rpx; + } + + .messagearea text { + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; + margin-top: 60rpx; + } + + .msseagehead { + display: flex; + flex-direction: row; + } + + .headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; + } + + .headleft image { + + width: 130rpx; + height: 133rpx; + } + + .headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; + } + + .headrightup text { + + height: 40rpx; + width: 100rpx; + overflow: hidden; + font-size: 40rpx; + font-weight: 400rpx; + } + + .headrightdown { + margin-top: 10rpx; + } + + .msseagemiddle { + margin: 0 60rpx; + } + + .mssagemiddledown { + margin: 25rpx auto; + } + + .mssagemiddledown image { + + width: 100%; + height: 265rpx; + } + + .messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + + } + + .messageendleft { + width: 150rpx; + height: 30rpx; + } + + .messageendleft image { + width: 100rpx; + height: 30rpx; + } + + .messageendmiddle { + width: 150rpx; + height: 30rpx; + } + + .messageendmiddle image { + width: 35rpx; + height: 30rpx; + } + + .messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .messageendright { + + width: 150rpx; + height: 30rpx; + } + + .messageendright image { + width: 35rpx; + height: 30rpx; + + } + + .messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; + } + + .functionalarea { + margin-top: 0rpx; + } + + .paybtnclass { + margin-right: 80rpx; + } + + .adsclass { + + width: 666rpx; + margin: 0 auto; + background-color: #dbfeff; + height: 100%; + margin-top: 80rpx; + } + + .adsclassup image { + + width: 666rpx; + /* height: 285rpx; */ + } + + .adsclassdown { + + width: 580rpx; + margin: 0 auto; + } + + .adsclassdown text { + margin-left: 30rpx; + font-size: 30rpx; + } \ No newline at end of file diff --git a/pages/leftright/leftright.js b/pages/leftright/leftright.js new file mode 100644 index 0000000..bc2b024 --- /dev/null +++ b/pages/leftright/leftright.js @@ -0,0 +1,29 @@ +const DEFAULT_PAGE = 0; + +Page({ + startPageX: 0, + currentView: DEFAULT_PAGE, + data: { + toView: `card_${DEFAULT_PAGE}`, + list: ['Javascript', 'Typescript', 'Java', 'PHP', 'Go','中华人民共和国','新中国成产100周年'] + }, + + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + + touchEnd(e) { + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150){ + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + } +}) \ No newline at end of file diff --git a/pages/leftright/leftright.json b/pages/leftright/leftright.json new file mode 100644 index 0000000..be3fbe0 --- /dev/null +++ b/pages/leftright/leftright.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "卡片滑动", + "backgroundColor": "#0D1740", + "navigationBarBackgroundColor": "#0D1740", + "navigationBarTextStyle": "white", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/leftright/leftright.wxml b/pages/leftright/leftright.wxml new file mode 100644 index 0000000..d2f1621 --- /dev/null +++ b/pages/leftright/leftright.wxml @@ -0,0 +1,10 @@ + + + + + {{item}} + + + + diff --git a/pages/leftright/leftright.wxss b/pages/leftright/leftright.wxss new file mode 100644 index 0000000..da8ed4e --- /dev/null +++ b/pages/leftright/leftright.wxss @@ -0,0 +1,28 @@ +page{ + overflow: hidden; +} +.scroll-box{ + white-space: nowrap; + height: 100%; +} + +.card-box{ + display: inline-block; + height:100vh; + width: 100%; +} + +.card{ + display: flex; + justify-content: center; + align-items: center; + box-sizing: border-box; + height:100vh; + width: 100%; + /* margin: 100rpx 200rpx; */ + font-size: 20px; + padding-left: 20rpx; + padding-right: 30rpx; + margin-left: 10rpx; + border-radius: 4px; +} \ No newline at end of file diff --git a/pages/livelist/livelist.js b/pages/livelist/livelist.js new file mode 100644 index 0000000..59b7af0 --- /dev/null +++ b/pages/livelist/livelist.js @@ -0,0 +1,132 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + liveswitch: 1, + hiddenName: false, + listdata: [], + baseurl:baseUrl.globalData.baseimgurl, + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getlivelist(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + getlivelist:function(){ + const that = this; + let url = baseUrl.globalData.baseUrl + '/lives/liveslist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + clicklives:function(e){ + console.log(e.currentTarget.id); + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + liveopen(e) { + let arr = []; + arr = this.data.listdata; + console.log(e.currentTarget.dataset.itemid); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = true; + item['liveclickclose'] = false; + arr[index] = item; + } else { + item['liveclickopen'] = false; + item['liveclickclose'] = true; + arr[index] = item + } + }) + this.setData({ + listdata: arr + }) + }, + liveclose(e) { + + let arr = []; + arr = this.data.listdata; + console.log(e.currentTarget.dataset.itemid); + arr.forEach(function (item, index) { + + if (index == e.currentTarget.dataset.itemid) { + item['liveclickopen'] = false; + item['liveclickclose'] = true; + arr[index] = item; + } else { + item['liveclickopen'] = true; + item['liveclickclose'] = false; + arr[index] = item + } + }) + this.setData({ + listdata: arr + }) + } +}) \ No newline at end of file diff --git a/pages/livelist/livelist.json b/pages/livelist/livelist.json new file mode 100644 index 0000000..6f61de0 --- /dev/null +++ b/pages/livelist/livelist.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "直播列表", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/livelist/livelist.wxml b/pages/livelist/livelist.wxml new file mode 100644 index 0000000..0d540c3 --- /dev/null +++ b/pages/livelist/livelist.wxml @@ -0,0 +1,45 @@ + + + + + + + + + + +

{{item.name}}

+
+ + + {{item.author}} + + + {{item.times}} + + + + {{item.intro}} + +
+ + + +
+ + + + +
\ No newline at end of file diff --git a/pages/livelist/livelist.wxss b/pages/livelist/livelist.wxss new file mode 100644 index 0000000..1af8d75 --- /dev/null +++ b/pages/livelist/livelist.wxss @@ -0,0 +1,189 @@ +.page { + background-color: #F5F5F5; + overflow: hidden; +} + +.zhibocss { + display: flex; + flex-wrap: wrap; + align-content: flex-start; + height: 180rpx; + width: 666rpx; + margin: 0 auto; + margin-top: 50rpx; + background: url(https://ndnd.duiduiedu.com/uploads/pics/line.png); + background-repeat: no-repeat; + background-size: 666rpx 180rpx; + +} + +.livefooter { + height: 23rpx; + width: 623rpx; + margin: 0 auto; + margin-top: -9rpx; +} + +.livefooter image { + + width: 623rpx; + height: 23rpx; + +} + +.item1 { + + width: 50rpx; + height: 150rpx; + box-sizing: border-box; + margin: 15rpx 16rpx; +} + +.itemhead { + margin-top: 20rpx; + margin-left: 20rpx; +} + +.itemhead h2 { + + font-weight: 600; + font-family: 'Arial Narrow', Arial; + font-size: large; +} + +.item1 image { + width: 50rpx; + height: 150rpx; +} + +.item2 { + width: 160rpx; + height: 160rpx; +} + +.item2 image { + margin-left: 10rpx; + width: 150rpx; + height: 160rpx; +} + +.item3 { + width: 334rpx; + height: 170rpx; + padding-right: 15rpx; +} + +.item4 { + padding-top: 10rpx; + width: 75rpx; + height: 180rpx; +} + +.item4 image { + width: 72rpx; + height: 164rpx; +} + +.itemmiddle { + display: flex; + margin-left: 15rpx; + width: 334rpx; + height: 50rpx; +} + +.itemmiddleleft { + display: flex; + margin-top: 10rpx; + flex-direction: row; +} + +.itemmiddleleft text { + color: #AEAEAE; + align-items: center; + font-size: 24rpx; + font-weight: 400; +} + +.itemmiddleleft image { + + width: 30rpx; + height: 30rpx; + padding-right: 10rpx; +} + +.itemmiddleright { + display: flex; + margin-top: 10rpx; + margin-left: 10rpx; + flex-direction: row; +} + +.itemmiddleright text { + color: #AEAEAE; + align-items: center; + font-size: 24rpx; + font-weight: 400; +} + +.itemmiddleright image { + + width: 30rpx; + height: 30rpx; + padding-right: 10rpx; +} + +.itemend { + width: 300rpx; + overflow: hidden; + height: 56rpx; + color: #AEAEAE; + line-height: 28rpx; + margin-bottom: 10rpx; + margin-left: 20rpx; + font-size: 18rpx; +} + +.content { + margin: 0 auto; + width: 632rpx; + border-left: 2rpx solid red; + border-right: 2rpx solid red; +} + +.contentdown { + margin: 0 auto; + width: 650rpx; + height: 23rpx; + margin-top: -9rpx; +} + +.contentdown image { + margin: 0 auto; + width: 648rpx; + height: 23rpx; +} + +.contentmiddle { + margin: 0 auto; + margin-top: 50rpx; + width: 530rpx; +} + +.contentmiddle text { + font-size: 22rpx; + padding-bottom: 30rpx; + +} + +.contentup { + margin: 0 auto; + width: 555rpx; +} + +.contentup image { + width: 100%; + + margin: 0 auto; + margin-top: 30rpx; + height: 160rpx; +} \ No newline at end of file diff --git a/pages/livetest/livetest.js b/pages/livetest/livetest.js new file mode 100644 index 0000000..399534c --- /dev/null +++ b/pages/livetest/livetest.js @@ -0,0 +1,139 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + roomId:1, + accesstoken:'' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getroomId(options); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + getroomId:function(ee){ + const that = this; + let url = baseUrl.globalData.baseUrl + '/user/acctoken'; + var param = { + pareid: ee + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res.access_token); + wx.setStorageSync('accesstoen', res.access_token) + that.setData({ + accesstoken: res.access_token + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getroomlist:function(){ + //getroomlist + const that = this; + let url = baseUrl.globalData.baseUrl + '/user/getroomlist'; + var param = { + access_token: wx.getStorageSync('accesstoen'), + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + // that.setData({ + // roomId: res.data.room_info.roomId + // }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + getroomreplyvodelist:function(){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/user/getroomreplyvide'; + var param = { + access_token: wx.getStorageSync('accesstoen'), + "action": "get_replay", + "room_id": that.roomId, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + // that.setData({ + // roomId: res.data.room_info.roomId + // }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + + this.getroomlist(this.data.accesstoken); + + let roomId = this.data.roomId // 填写具体的房间号,可通过下面【获取直播房间列表】 API 获取 + let customParams = encodeURIComponent(JSON.stringify({ path: 'pages/index/index', pid: 1 })) + // 开发者在直播间页面路径上携带自定义参数(如示例中的path和pid参数),后续可以在分享卡片链接和跳转至商详页时获取,详见【获取自定义参数】、【直播间到商详页面携带参数】章节(上限600个字符,超过部分会被截断) + this.setData({ + roomId, + customParams + }), + + this.getroomreplyvodelist(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/livetest/livetest.json b/pages/livetest/livetest.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/livetest/livetest.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/livetest/livetest.wxml b/pages/livetest/livetest.wxml new file mode 100644 index 0000000..f16a6c7 --- /dev/null +++ b/pages/livetest/livetest.wxml @@ -0,0 +1 @@ + diff --git a/pages/livetest/livetest.wxss b/pages/livetest/livetest.wxss new file mode 100644 index 0000000..bf8d79e --- /dev/null +++ b/pages/livetest/livetest.wxss @@ -0,0 +1 @@ +/* pages/livetest/livetest.wxss */ \ No newline at end of file diff --git a/pages/main/main.js b/pages/main/main.js new file mode 100644 index 0000000..17f2da9 --- /dev/null +++ b/pages/main/main.js @@ -0,0 +1,155 @@ +// index.js +const Apps = getApp(); +Page({ + data: { + userInfo: {}, + currentuserinfo: {}, + hasUserInfo: false, + canIUse: wx.canIUse('button.open-type.getUserInfo'), + canIUseGetUserProfile: false, + canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false + }, + // 事件处理函数 + bindViewTap() { + this.getUserProfile(); + }, + onLoad() { + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + }, + getUserProfile(e) { + + const that = this; + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + Apps.globalData.usersaveinfo = res.userInfo; + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + // 登录 + wx.login({ + success(res) { + if (res.code) { + //发起网络请求 + wx.request({ + url: 'https://ndnd.duiduiedu.com/addons/unishop/user/authSession', + data: { + code: res.code, + platform: 'MP-WEIXIN' + }, + header: { + 'content-type': 'application/x-www-form-urlencoded' + }, + method: "GET", + datatype: 'json', + success: function (res) { + console.log(res.data) + Apps.globalData.wxopenid = res.data.data.openid, + Apps.globalData.userInfo = res.data.data.userInfo + } + }) + } else { + console.log('登录失败!' + res.errMsg) + } + } + }) + }, + fail: (err) => { + + // 没有允许定位权限 + wx.showToast({ + title: '您拒绝了微信授权,将无法正常使用微信小程序', + icon: 'none' + }); + } + + }) + }, + getPhoneNumber(e) { + + console.log(Apps.globalData) + + if (e.detail.errMsg == 'getPhoneNumber:ok') { + wx.request({ + url: Apps.globalData.baseUrl + '/user/loginForWechatMini', + data: { + 'encryptedData': e.detail.encryptedData, + 'iv': e.detail.iv, + 'session_key': Apps.globalData.userInfo.session_key, + 'openid': Apps.globalData.userInfo.openid, + 'avatar': Apps.globalData.usersaveinfo.avatarUrl, + 'nickname': Apps.globalData.usersaveinfo.nickName + }, + header: { + 'content-type': 'application/json' // 默认值 + }, + method: "POST", + success(res) { + Apps.globalData.currentuserinfo = res.data.data + } + }) + } else { + // 没有允许定位权限 + wx.showToast({ + title: '您拒绝了微信授权,将无法正常使用微信小程序', + icon: 'none' + }); + + } + + }, + getUserInfo(e) { + // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true + }) + }, + getcureentuserinfo() { + console.log(Apps.globalData.currentuserinfo); + this.setData({ + + // currentuserinfo: Apps.globalData.currentuserinfo + currentuserinfo: wx.getStorageSync('userinfo') + + + }) + }, leftright() { + + wx.navigateTo({ + url: '/pages/leftright/leftright', + }) + + }, swipperpics() { + + wx.navigateTo({ + url: '/pages/mine/mine', + }) + }, + tarbar() { + wx.navigateTo({ + url: '/pages/tarbar/tarbar', + }) + }, + clickgrid() { + wx.navigateTo({ + url: '/pages/grid/grid', + }) + }, + clickpics() { + + wx.navigateTo({ + url: '/pages/picsdisplay/picsdisplay', + }) + }, swipecell() { + wx.navigateTo({ + url: '/pages/swipecell/swipecell', + }) + } +}) \ No newline at end of file diff --git a/pages/main/main.json b/pages/main/main.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/main/main.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/main/main.wxml b/pages/main/main.wxml new file mode 100644 index 0000000..729666c --- /dev/null +++ b/pages/main/main.wxml @@ -0,0 +1,41 @@ + + + + + + + + + {{currentuserinfo.mobile}} + + + + + 请使用1.4.4及以上版本基础库 + + + + {{userInfo.nickName}} + + + + + + + + + + + + + + + + + + + + + {{currentuserinfo.nickname}}--{{currentuserinfo.mobile}}--{{currentuserinfo.openid}}--{{currentuserinfo.id}} + + diff --git a/pages/main/main.wxss b/pages/main/main.wxss new file mode 100644 index 0000000..30c9b0a --- /dev/null +++ b/pages/main/main.wxss @@ -0,0 +1,22 @@ +/**index.wxss**/ +.userinfo { + align-self: flex-start; + margin-left: 10rpx; + display: flex; + /* flex-direction: column; */ + align-items: center; + color: #aaa; + justify-content: start; +} + +.userinfo-avatar { + overflow: hidden; + width: 68rpx; + height:68rpx; + margin: 20rpx; + border-radius: 50%; +} + +.usermotto { + margin-top: 200px; +} \ No newline at end of file diff --git a/pages/messageencyclopedias/messageencyclopedias.js b/pages/messageencyclopedias/messageencyclopedias.js new file mode 100644 index 0000000..9470169 --- /dev/null +++ b/pages/messageencyclopedias/messageencyclopedias.js @@ -0,0 +1,143 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + onReady: function (e) { + // 使用 wx.createAudioContext 获取 audio 上下文 context + this.audioCtx = wx.createAudioContext('myAudio') + }, + /** + * 页面的初始数据 + */ + data: { + detailid: 0, + voddetail: [], + autodetail: [], + baseurl: baseUrl.globalData.baseimgurl, + replylist:[] + }, + audioPlay: function () { + this.audioCtx.play() + }, + audioPause: function () { + this.audioCtx.pause() + }, + audio14: function () { + this.audioCtx.seek(14) + }, + audioStart: function () { + this.audioCtx.seek(0) + }, + funplay: function () { + console.log("audio play"); + }, + funpause: function () { + console.log("audio pause"); + }, + funtimeupdate: function (u) { + console.log(u.detail.currentTime); + console.log(u.detail.duration); + }, + funended: function () { + console.log("audio end"); + }, + funerror: function (u) { + console.log(u.detail.errMsg); + }, + preview: function (params) { + console.log(params); + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let picsid = params.currentTarget.dataset.pics; //单条信息ID + console.log(picsid); + + let arr = []; + arr[0] = that.data.baseurl + picsid + console.log('-----'); + console.log(arr); + + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + this.setData({ + detailid: options.id + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let id = this.data.detailid; + this.msgdetail(id); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + msgdetail: function (e) { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/msglist/msgdetail'; + var param = { + id: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + voddetail: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/messageencyclopedias/messageencyclopedias.json b/pages/messageencyclopedias/messageencyclopedias.json new file mode 100644 index 0000000..f2605eb --- /dev/null +++ b/pages/messageencyclopedias/messageencyclopedias.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "资讯百科", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/messageencyclopedias/messageencyclopedias.wxml b/pages/messageencyclopedias/messageencyclopedias.wxml new file mode 100644 index 0000000..4aed169 --- /dev/null +++ b/pages/messageencyclopedias/messageencyclopedias.wxml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + {{voddetail['intro']}} + + + + + + + + + + + \ No newline at end of file diff --git a/pages/messageencyclopedias/messageencyclopedias.wxss b/pages/messageencyclopedias/messageencyclopedias.wxss new file mode 100644 index 0000000..92aa0f4 --- /dev/null +++ b/pages/messageencyclopedias/messageencyclopedias.wxss @@ -0,0 +1,199 @@ +.courselive { + width: 750rpx; + height: 403rpx; +} + +.courselivecontinor { + background-color: #F5F5F5; +} + +.functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; +} + +.areaitem { + display: flex; + flex-direction: column; + width: 666rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 20rpx; +} + +.areaitemup { + width: 100%; + height: 60rpx; + margin-top: 30rpx; + text-align: center; +} + +.areaitemdown { + width: 100%; + height: 60rpx; +} + +.percentageclass { + margin: 0 auto; + margin-top: 35rpx; + width: 412rpx; +} + +.messagearea text { + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; + margin-top: 60rpx; +} + +.msseagehead { + display: flex; + flex-direction: row; +} + +.headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; +} + +.headleft image { + + width: 130rpx; + height: 133rpx; +} + +.headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; +} + +.headrightup text { + + height: 40rpx; + width: 100rpx; + overflow: hidden; + font-size: 40rpx; + font-weight: 400rpx; +} + +.headrightdown { + margin-top: 10rpx; +} + +.msseagemiddle { + margin: 0 60rpx; +} + +.mssagemiddledown { + margin: 25rpx auto; +} + +.mssagemiddledown image { + + width: 100%; + height: 265rpx; +} + +.messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + +} + +.messageendleft { + width: 150rpx; + height: 30rpx; +} + +.messageendleft image { + width: 100rpx; + height: 30rpx; +} + +.messageendmiddle { + width: 150rpx; + height: 30rpx; +} + +.messageendmiddle image { + width: 35rpx; + height: 30rpx; +} + +.messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.messageendright { + + width: 150rpx; + height: 30rpx; +} + +.messageendright image { + width: 35rpx; + height: 30rpx; + +} + +.messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; +} + +.feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; +} + +.functionalarea { + margin-top: 0rpx; +} + +.paybtnclass { + margin-right: 80rpx; +} + +.adsclass { + + width: 666rpx; + margin: 0 auto; + background-color: #dbfeff; + height: 100%; + margin-top: 80rpx; +} + +.adsclassup image { + + width: 666rpx; + /* height: 285rpx; */ + /* height: 100%; */ +} + +.adsclassdown { + + width: 580rpx; + margin: 0 auto; +} + +.adsclassdown text { + margin-left: 30rpx; + font-size: 30rpx; +} \ No newline at end of file diff --git a/pages/messagelist/messagelist.js b/pages/messagelist/messagelist.js new file mode 100644 index 0000000..36c9678 --- /dev/null +++ b/pages/messagelist/messagelist.js @@ -0,0 +1,93 @@ +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + messagelist:[], + baseurl:baseUrl.globalData.baseimgurl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.msglist(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + messageinfo:function(e){ + console.log(e); + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id='+e.currentTarget.id, + }) + }, + msglist:function(){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/msglist/messagelist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + messagelist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/messagelist/messagelist.json b/pages/messagelist/messagelist.json new file mode 100644 index 0000000..f2605eb --- /dev/null +++ b/pages/messagelist/messagelist.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "资讯百科", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/messagelist/messagelist.wxml b/pages/messagelist/messagelist.wxml new file mode 100644 index 0000000..4c843c1 --- /dev/null +++ b/pages/messagelist/messagelist.wxml @@ -0,0 +1,12 @@ + + + + + + + {{item.name}} + {{item.intro}} + + + + diff --git a/pages/messagelist/messagelist.wxss b/pages/messagelist/messagelist.wxss new file mode 100644 index 0000000..b5e70b8 --- /dev/null +++ b/pages/messagelist/messagelist.wxss @@ -0,0 +1,62 @@ +.messagelist { + display: flex; + flex-direction: row; + width: 678rpx; + height: 170rpx; + margin: 0 auto; + margin-top: 35rpx; + border-radius: 3%; + border: 1rpx solid #22d0d7; + background-color: #dbfcfa; +} + +.messagelist2 { + display: flex; + flex-direction: row; + width: 678rpx; + height: 170rpx; + margin: 0 auto; + margin-top: 35rpx; + border-radius: 3%; + border: 1rpx solid #fd7bb2; + background-color: #ffe6f3; +} + +.listleft { + + width: 192rpx; + height: 123; + margin: 23rpx 20rpx; +} + +.listleft image { + + width: 192rpx; + height: 123rpx; +} + +.listright { + width: 400rpx; + height: 123rpx; + margin: 23rpx 20rpx; +} + +.listrightup { + width: 400rpx; + overflow: hidden; + height: 50rpx; + line-height: 50rpx; +} + +.listrightup text { + width: 400rpx; + overflow: hidden; + font-size: 30rpx; + font-weight: 600; +} + +.listrightdown text { + width: 400rpx; + overflow: hidden; + font-size: 26rpx; +} \ No newline at end of file diff --git a/pages/mine/mine.js b/pages/mine/mine.js new file mode 100644 index 0000000..8ad51a1 --- /dev/null +++ b/pages/mine/mine.js @@ -0,0 +1,362 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Dialog from '@vant/weapp/dialog/dialog'; +Page({ + + data: { + myimg: 'https://ndnd.duiduiedu.com/uploads/pics/minemainhead.png', + userinfo: '', + avatar: '', + id: 0, + show: false, + popmsgdata: null, + username: '', + userdatainfo: '' + }, + getUserInfo(event) { + console.log(event.detail); + }, + onClose() { + this.setData({ show: false }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + usernamemdclick: function (params) { + this.setData({ showpopup: true }); + console.log(params); + }, + onClosepopup: function (params) { + this.setData({ showpopup: false }); + }, + onChangeuser: function (params) { + console.log(params.detail); + this.setData({ + username: params.detail + }) + }, + saveusername: function (params) { + //保存用户名称 + console.log(this.data.username); + this.updateusername(wx.getStorageSync('wxuserid'), this.data.username); + + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + Apps.islogin(); + + // if (Apps.globalData.currentuserinfo == null){ + // wx.redirectTo({ + // url: '/pages/userlogin/userlogin', + // }) + // } + + this.loaddata(); + this.popmsg(); + this.userisblack(wx.getStorageSync('userinfo').mobile); //是否黑名单 + + + + // } + + }, + kfbtn:function (params) { + + try { + wx.openCustomerServiceChat({ + extInfo: { + url: 'https://work.weixin.qq.com/kfid/kfc79f714830ba6cc05' //客服ID + }, + corpId: 'wwaf23716917173cba', //企业微信ID + success(res) {} + }) + } catch (error) { + showToast("请更新至微信最新版本") + } + + }, + userisblack: function (mobile) { + //用户是否黑名单 + //直播列表 + const that = this; + let url = Apps.globalData.baseUrl + '/user/isblack'; + var param = { + mobile: mobile + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + wx.setStorageSync('userisblack', res); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + aboutclick: function () { + //关于我们 + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=1', + }) + }, + onChooseAvatar: function (params) { + console.log(params); + }, + onClickShow: function () { + //加载数据 + let url = Apps.globalData.baseUrl + '/user/signdata'; + var param = { + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + let titles = "签到成功"; + if (res == 1) { + // titles = "签到成功"; + this.popmsg(); + } else if (res == 2) { + // titles = "连续签到成功"; + this.popmsg(); + } else if (res == 3) { + // titles = "重新签到成功"; + this.popmsg(); + } else { + titles = "今天已签到成功,无须再签到" + wx.showToast({ + title: titles,//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + onClickHide(e) { + this.setData({ show: false }); + //签到 + }, + noop(e) { + //加载数据 + console.log(e); + let url = Apps.globalData.baseUrl + '/user/mpopmsg'; + var param = { + user_id: wx.getStorageSync('wxuserid'), + id: e.currentTarget.id, + xid: e.currentTarget.dataset.xid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + this.setData({ show: false }); + this.loaddata(); + this.popmsg(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + loaddata: function (params) { + + // if (Apps.globalData.currentuserinfo == null){ + // wx.redirectTo({ + // url: '/pages/userlogin/userlogin', + // }) + // } + // Apps.islogin(); // 已在 onShow 中检查,此处移除避免重复跳转 + + //加载数据 + let url = Apps.globalData.baseUrl + '/user/getuserinfobyopenid'; + var param = { + // id: Apps.globalData.currentuserinfo.id + id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + // 移除重复的登录跳转,避免跳转两次 + // if (res.data == null) { + // //如果用户在数据中没有数据则重新注册 + // wx.navigateTo({ + // url: '/pages/userlogin/userlogin', + // }) + // } + if (res.data) { + Apps.globalData.userinfo = res.data; + // const userdatainfo = wx.getStorageSync('userinfo'); + console.log("res==============") + console.log(res) + this.setData({ + userinfo: res.data, + myimg: res.data.avatar, + username: res.data.username, + userdatainfo: res.data + }) + wx.setStorageSync('wxuserid', res.data.id); + wx.setStorageSync('userinfo', res.data); + wx.setStorageSync('wxopenid', res.data.openid); + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + vipclick: function (params) { + wx.navigateTo({ + url: '/pages/vipquanyi/vipquanyi', + }) + }, + myaddressclick: function (params) { + wx.navigateTo({ + url: '/pages/myaddress/myaddress', + }) + }, + vipchargeclick: function (params) { + wx.navigateTo({ + url: '/pages/viprecharge/viprecharge', + }) + }, + collectioncourseclick: function (params) { + wx.navigateTo({ + url: '/pages/collectionsub/collectionsub', + }) + }, + collectioncourse: function (params) { + wx.navigateTo({ + url: '/pages/collectioncourse/collectioncourse', + }) + }, + vipquanyiclick: function (params) { + wx.redirectTo({ + url: '/pages/viprecharge/viprecharge', + }) + }, + chargeshopclick: function (params) { + wx.navigateTo({ + url: '/pages/chargeshop/chargeshop', + }) + }, + mycommunityinfoclick: function (params) { + wx.navigateTo({ + url: '/pages/mycommunityinfo/mycommunityinfo', //我的怒贴 + }) + }, + myexamanalysisclick: function (params) { + wx.navigateTo({ + url: '/pages/myexamanalysis/myexamanalysis', //我的怒贴 + }) + }, + popmsg: function () { + + //加载弹窗 + if (wx.getStorageSync('wxuserid') == null) + return; + + let url = Apps.globalData.baseUrl + '/user/getpopmsg'; + var param = { + id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + if (res.data != null) { + this.setData({ + show: true, + popmsgdata: res.data + }); + } + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + myonChooseAvatar: function (e) { + console.log("fan------------") + console.log(e.detail.avatarUrl); + const tempFilePaths = e.detail.avatarUrl; + const that = this; + wx.uploadFile({ + url: Apps.globalData.baseUrl + '/wordslist/uploadpics', //仅为示例,非真实的接口地址 + filePath: tempFilePaths, + name: 'file', + formData: { + 'user': 'test' + }, + success(res) { + const dataurl = Apps.globalData.baseimgurl + JSON.parse(res.data); + that.updateuserimage(wx.getStorageSync('wxuserid'), dataurl); + that.setData({ + myimg: dataurl + }) + } + }) + }, + updateuserimage: function (id, avatar) { + + //更新用户头像 + const that = this; + let url = Apps.globalData.baseUrl + '/user/updateuserimage'; + var param = { + id: id, + avatar: avatar + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + updateusername: function (id, username) { + + //更新用户头像 + const that = this; + let url = Apps.globalData.baseUrl + '/user/updateusername'; + var param = { + id: id, + username: username + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + that.loaddata(); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + handleLogout: function () { + try { + wx.removeStorageSync('wxopenid'); + wx.removeStorageSync('wxuserid'); + wx.removeStorageSync('userinfo'); + wx.removeStorageSync('userisblack'); + } catch (e) { + console.log('清理本地登录信息失败:', e); + } + this.setData({ + userinfo: '', + userdatainfo: '', + myimg: 'https://ndnd.duiduiedu.com/uploads/pics/minemainhead.png', + }); + wx.showToast({ + title: '已退出登录', + icon: 'success', + duration: 1500, + }); + // 如需跳到登录页,可放开: + wx.redirectTo({ url: '/pages/userlogin/userlogin' }); + } +}) \ No newline at end of file diff --git a/pages/mine/mine.json b/pages/mine/mine.json new file mode 100644 index 0000000..55c8763 --- /dev/null +++ b/pages/mine/mine.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "怼自己" +} \ No newline at end of file diff --git a/pages/mine/mine.wxml b/pages/mine/mine.wxml new file mode 100644 index 0000000..e6bbed8 --- /dev/null +++ b/pages/mine/mine.wxml @@ -0,0 +1,108 @@ + + + + + + + + + + + + {{userdatainfo.username}} + + + + + + + + + + + + + + + + + + + + + + + + {{userinfo.score}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{popmsgdata.name}}怼币 + 来源:{{popmsgdata.msg}} + + + + + + + + \ No newline at end of file diff --git a/pages/mine/mine.wxss b/pages/mine/mine.wxss new file mode 100644 index 0000000..fc500fa --- /dev/null +++ b/pages/mine/mine.wxss @@ -0,0 +1,362 @@ +/* 我的头部 */ +Image { + height: auto; +} + +.minemain { + width: 690rpx; + height: 250rpx; + margin: 0 auto; + background-image: url('https://ndnd.duiduiedu.com/uploads/pics/minemainback1.png'); + background-repeat: no-repeat; + /*下面的是关键的设置100%显示*/ + background-size: 100% 100%; +} + +.minemainleft { + display: flex; + width: 400rpx; + margin-top: 46rpx; + float: left; +} + +.mineleft1 image { + position: absolute; + left: 0rpx; + width: 153rpx; + height: 156rpx; + align-items: center; + z-index: 0; + border-radius: 50%; +} +.mineleft1 button{ + width: 153rpx; + height: 156rpx; + margin-left: 32rpx; + border-radius: 50%; + flex-direction: column; + justify-content: center; + align-items: center; + z-index: 0; +} + +.mineleft2 { + width: 500rpx; + height: 56rpx; + margin-left: 32rpx; + margin-top: 30rpx; +} +.leftup { + + width: 380rpx; + height: 56rpx; + line-height: 56rpx; + overflow:hidden; +} +.leftup text { + width: 500rpx; + font-size: 40rpx; + color: white; + overflow:hidden; +} +.leftdown{ + width: 300rpx; + height: 56rpx; + line-height: 56rpx; +} +.leftdown label { + width: 300rpx; + font-size: 24rpx; + color: white; +} + +.minemainright { + + float: right; + width: 100rpx; + height: 250rpx; + margin-right: 20rpx; +} + +.item1 { + width: 100rpx; + height: 100rpx; + margin-top: 46rpx; +} + +.item1 image { + width: 60rpx; + height: 60rpx; + margin-top: 46rpx; +} + +/* 我的头部 */ + +/* vip权益 */ +.minevipquanyi { + + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + width: 690rpx; + height: 100rpx; + margin: 20rpx auto; + background-color: #e2feff; +} + +.minemiddle1 { + + width: 240rpx; + height: 72rpx; + text-align: left; + margin-left: 20rpx; +} + +.minemiddle1 image { + width: 232rpx; + height: 72rpx; +} + +.minemiddle2 { + width: 200rpx; + height: 60rpx; + line-height: 60rpx; + text-align: center; + margin-left: 20rpx; +} + +.minemiddle2 text { + width: 200rpx; + height: 60rpx; + font-weight: 700; + font-size: 40rpx; + color: #1CCFD6; +} + +.minemiddle3 { + width: 220rpx; + height: 60rpx; + text-align: right; + margin-left: 10rpx; + margin-right: 20rpx; +} + +.minemiddle3 image { + width: 208rpx; + height: 64rpx; +} + +/* vip权益 */ + +/* 金币兑换 */ +.minevipduihuan { + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 690rpx; + height: 100rpx; + margin: 0 auto; + +} + +.duihuan1 { + width: 340rpx; + text-align: left; +} + +.duihuan1 image { + width: 340rpx; + height: 107rpx; +} + +.duihuan2 { + margin-left: 10rpx; + width: 340rpx; + text-align: left; +} + +.duihuan2 image { + width: 340rpx; + height: 107rpx; +} + +/* 金币兑换 */ + +/* 我的工具列表 */ + +.minetoolslist { + width: 690rpx; + height: 460rpx; + background-color: #e0feff; + margin: 40rpx auto; + border-radius: 3%; +} + +.minetoolslist image { + + margin-left: 110rpx; + margin-top: 40rpx; + margin-bottom: 40rpx; + width: 85rpx; + height: 124rpx; + +} + +/* 我的工具列表 */ + +/* 联系列表 */ +.linklist { + width: 690rpx; + height: 72rpx; + margin: 0 auto; + margin-bottom: 10rpx; +} + +.linklist2 { + width: 690rpx; + margin: 0 auto; + margin-bottom: 20rpx; + +} + +.linklist2 button { + background-image: url('https://ndnd.duiduiedu.com/uploads/pics/minemainmg1.png'); + background-repeat: no-repeat; + height: 72rpx; + border: none; + font-size: 16px; +} + +.linklist3 { + + background-image: url('https://ndnd.duiduiedu.com/uploads/pics/minemainkf.png'); + background-repeat: no-repeat; + background-size: cover; + background-color: #fff1f7; + height: 60rpx; + font-size: 16px; + width: 690rpx; + margin: 0 auto; + margin-bottom: 40rpx; +} + +.linklist3::after { + border: none; +} + +.linklist image { + width: 690rpx; + height: 72rpx; +} + +/* 联系列表 */ +/* vip图标 */ +.vipimage { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + position: relative; + padding-right: 0rpx; + top: -2rpx; + left: 170rpx; + width: 250rpx; + height: 33rpx; + +} + +.vipimage text { + line-height: 35rpx; + height: 35rpx; + color: white; + font-size: 28rpx; +} + +.vipimage image { + + margin-left: 0rpx; + width: 37rpx; + height: 33rpx; + z-index: 2; +} + +/* vip图标 */ + +.wrapper { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; +} + +.block { + width: 100%; + height: 100%; + background: url('https://ndnd.duiduiedu.com/uploads/pics/userwrapper01.png') center no-repeat; + background-size: contain; +} + +.blockbutton { + width: 200rpx; + height: 40rpx; + position: relative; + left: 100rpx; + top: 400rpx; +} + +.blocktext1 { + + width: 250rpx; + height: 60rpx; + position: relative; + left: 280rpx; + top: 800rpx; +} + +.blocktext1 text { + font-size: 22rpx; +} + +.blocktext2 { + + width: 200rpx; + height: 60rpx; + position: relative; + left: 310rpx; + top: 820rpx; +} + +.blocktext2 text { + font-size: 28rpx; + color: #fbaa4c; +} + +.circleimages { + + position:fixed; + margin-left: 32rpx; + border-radius: 48%; + flex-direction: column; + justify-content: center; + align-items: center; + width: 150rpx; + height: 150rpx; + top: 55rpx; +} +.usernameclass{ + margin: 30 auto; + color: white; +} + +.usercontian{ + height: 750rpx; + text-indent: 10%; + word-break:break-all; + overflow-y: scroll; + padding-left: 20rpx; + padding-right: 40rpx; +} \ No newline at end of file diff --git a/pages/myaddress/myaddress.js b/pages/myaddress/myaddress.js new file mode 100644 index 0000000..1be5e72 --- /dev/null +++ b/pages/myaddress/myaddress.js @@ -0,0 +1,240 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + id:1, + title:'我的地址', + listdata:[], //地址列表 + listdatamorei:[],//地址列表默认地址 + currentdata:[], //当前值 + isnewadd:1,//是否新增,1为新增,2为修改 + checked:true + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.setNavigationBarTitle({ + title: this.data.title, + }) + baseUrl.islogin(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getaddresslist(wx.getStorageSync('wxuserid')); + this.getaddresslistmorei(wx.getStorageSync('wxuserid')); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + onClickShow() { + this.setData({ show: true }); + }, + + onClickHide() { + this.setData({ show: false }); + }, + submit:function(e){ + console.log(e); + let isnewadd=this.data.isnewadd; + let isdefault=this.data.checked?0:1; + + let name=e.detail.value.name; + let areaname=e.detail.value.areaname; + let phone=e.detail.value.phone; + let address=e.detail.value.address; + + if(isnewadd==1){ + + //修改 + //得到当前数据 + const that = this; + let url = baseUrl.globalData.baseUrl + '/myaddress/addressadd'; + var param = { + name:name, + phone:phone, + region:areaname, + addressinfo:address, + isdefault:isdefault + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + // console.log(res); + // that.setData({ + // currentdata:res.data + // }); + }).catch((errMsg) => { + console.log(errMsg); + }); + + + }else{ + + //修改 + //得到当前数据 + const that = this; + let id=that.data.id; + let url = baseUrl.globalData.baseUrl + '/myaddress/updateaddress'; + + var param = { + id:id, + name:name, + phone:phone, + region:areaname, + addressinfo:address, + isdefault:isdefault + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + // console.log(res); + // that.setData({ + // currentdata:res.data + // }); + }).catch((errMsg) => { + console.log(errMsg); + }); + } + this.setData({ show: false }); + wx.navigateTo({ + url: '/pages/myaddress/myaddress', + }) + }, + modfiyclick:function(params) { + console.log(params.currentTarget.id); + let id=params.currentTarget.id; + this.setData({ + show: true, + isnewadd:2, + id:id + }); + this.getcurrentdata(id); + + }, + delclick:function(params) { + console.log(params); + this.deletefun(params.currentTarget.id); + wx.navigateTo({ + url: '/pages/myaddress/myaddress', + }) + }, + onChange({ detail }) { + // 需要手动对 checked 状态进行更新 + console.log(detail) + this.setData({ checked: detail }); + }, + getaddresslist:function(params) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/myaddress/myaddresslist'; + var param = { + user_id:params + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + listdata:res.data + }); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getaddresslistmorei:function(params) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/myaddress/myaddresslistdefault'; + var param = { + user_id:params + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + listdatamorei:res.data + }); + }).catch((errMsg) => { + console.log(errMsg); + }); + },getcurrentdata:function(params) { + //得到当前数据 + const that = this; + let url = baseUrl.globalData.baseUrl + '/myaddress/getmyaddressbyid'; + var param = { + id:params + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + currentdata:res.data + }); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + deletefun:function(params) { + + //得到当前数据 + const that = this; + let url = baseUrl.globalData.baseUrl + '/myaddress/myaddresslistdelete'; + var param = { + id:params + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + // console.log(res); + // that.setData({ + // currentdata:res.data + // }); + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/myaddress/myaddress.json b/pages/myaddress/myaddress.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/myaddress/myaddress.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/myaddress/myaddress.wxml b/pages/myaddress/myaddress.wxml new file mode 100644 index 0000000..151b14e --- /dev/null +++ b/pages/myaddress/myaddress.wxml @@ -0,0 +1,68 @@ + + + + + + + + {{listdatamorei['name']}}{{listdatamorei['phone']}} + [默认地址] + + {{listdatamorei['addressinfo']}} + + + + + + + + + + + + + + + + + + + {{item.name}}{{item.phone}} + + {{item.addressinfo}} + + + + + + + + + + +
+ + 添加新地址 + + + + + + + + + + + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/pages/myaddress/myaddress.wxss b/pages/myaddress/myaddress.wxss new file mode 100644 index 0000000..f04d9fd --- /dev/null +++ b/pages/myaddress/myaddress.wxss @@ -0,0 +1,140 @@ +/* 商品详情头部 */ +Page { + background-color: #f1f1f1; +} + +.goodsheads { + + width: 666rpx; + height: 155rpx; + margin: 0 auto; + border: 1rpx solid #ffffff; + border-radius: 8rpx; + background-color: #ffffff; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +} + +.headleft image { + + margin: 0 40rpx; + width: 56rpx; + height: 56rpx; + +} + +.headmiddle { + + width: 452rpx; + height: 90rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: left; +} + +.bigfont { + font-size: 30rpx; + color: black; +} + +.smallfont { + + margin-left: 30rpx; + font-size: 26rpx; + color: #b6b6b6; +} + +.middledown { + font-size: 26rpx; + color: black; + width: 452rpx; +} + +.headright image { + width: 50rpx; + height: 50rpx; +} + +.moreiaddress { + color: red; + font-size: 26rpx; + margin-left: 30rpx; +} + +/* 商品详情头部 */ + +/* 分割线 */ +.feigeixian { + width: 607rpx; + height: 1rpx; + margin: 0 auto; + background-color: #909090; +} + +/* 分割线 */ + +.btnmyaddress { + + width: 666rpx; + margin: 0 auto; + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 5%; + border-bottom-left-radius: 5%; + background-color: #1ccfd6 !important; + font-size: 40rpx; + +} + +/* 弹窗信息 */ + +.wrapper { + display: flex; + flex-direction: column; + justify-content: center; + align-content: center; + width: 520rpx; + height: 670rpx; + + margin: 0 auto; + margin-top: 20%; +} +.wrapperup { + width: 520rpx; + height: 70rpx; + text-align: center; + border-radius: 5% 5% 0 0; + background-color: #1ccfd6; +} +.wrapperup text{ + + text-align: center; + color:white; + font-size:28rpx; + height: 70rpx; + line-height: 70rpx; + +} + +.wrappermiddle{ + width: 520rpx; + height: 570rpx; + background-color:#ffffff; +} +.wrapperdown{ + width: 520rpx; + height: 100rpx; + background-color:#f6f4f4; + border-radius: 0 0 5% 5%; +} +.savebtnclass{ + width: 90%; + height: 70rpx; + background-color: #1ccfd6; + color: white; + margin: 0 auto; + line-height: 70rpx; +} \ No newline at end of file diff --git a/pages/mycommunityinfo/mycommunityinfo.js b/pages/mycommunityinfo/mycommunityinfo.js new file mode 100644 index 0000000..1b25f7a --- /dev/null +++ b/pages/mycommunityinfo/mycommunityinfo.js @@ -0,0 +1,243 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + baseurl: baseUrl.globalData.baseimgurl, + messagelist: [], + startPageX: 0, + currentView: DEFAULT_PAGE, + imagecount: 4, + indeximagecount: 4, + active: 1, + challengeactive: 1, + toView: `card_${DEFAULT_PAGE}`, + list: [], + replylist: [], + imageslists: [] //图片预览 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.setNavigationBarTitle({ + title: '我的怼贴', + }) + baseUrl.islogin(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + //头部消息 + this.msglist(); + //留言类型 + this.wrodtypelist(); + //回复留言列表 + this.getwords(1); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + touchStart(e) { + this.startPageX = e.changedTouches[0].pageX; + }, + touchEnd(e) { + + const moveX = e.changedTouches[0].pageX - this.startPageX; + const maxPage = this.data.list.length - 1; + if (Math.abs(moveX) >= 150) { + if (moveX > 0) { + this.currentView = this.currentView !== 0 ? this.currentView - 1 : 0; + } else { + this.currentView = this.currentView !== maxPage ? this.currentView + 1 : maxPage; + } + } + this.setData({ + toView: `card_${this.currentView}` + }); + }, + touchecard(e) { + console.log(e.currentTarget.id); + this.setData({ + active: e.currentTarget.id + }) + this.getwords(e.currentTarget.id); + }, + duizhiticlick: function () { + + wx.navigateTo({ + url: '/pages/allpapers/allpapers', + }) + }, + messagelistclick: function () { + wx.navigateTo({ + url: '/pages/messagelist/messagelist', + }) + }, + communityinfoclick: function (e) { + //社区留言信息 + console.log(e.currentTarget.id); + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id=' + e.currentTarget.id, + }) + }, + messagelistclick: function (e) { + //资讯列表分类 + wx.navigateTo({ + url: '/pages/messagelist/messagelist?typeid=' + e.currentTarget.id, + }) + }, + messageclick: function (e) { + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=' + e.currentTarget.id, + }) + }, + msglist: function () { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/msglist/msgindexlist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + messagelist: res.data.sort() + + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wrodtypelist: function () { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/wordslist/getwordslist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + list: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getwords: function (ee) { + + const that = this; + let url = baseUrl.globalData.baseUrl + '/wordslist/getwordsbyuserid'; + var param = { + typeid: ee, + user_id: wx.getStorageSync('wxuserid') == null ? 3 : wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsclick: function (ee) { + console.log(ee); + console.log(baseUrl.globalData.currentuserinfo); + let e1 = ee.currentTarget.id; + let e2 = wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/wordslist/wordsclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist: res.data + }); + //头部消息 + that.msglist(); + //留言类型 + that.wrodtypelist(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + preview2: function (params) { + console.log(params); + let that = this; + let currentUrl = params.currentTarget.dataset.src; + let arrindex = params.currentTarget.dataset.id; + let indexpic = params.currentTarget.dataset.cid; + console.log(indexpic); + console.log(arrindex); + let rearr = that.data.replylist[arrindex].pics; + console.log(rearr); + let arr = []; + rearr.forEach(function (item, index) { + arr[index] = that.data.baseurl + item + }); + wx.previewImage({ + current: arr[indexpic], // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + } +}) \ No newline at end of file diff --git a/pages/mycommunityinfo/mycommunityinfo.json b/pages/mycommunityinfo/mycommunityinfo.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mycommunityinfo/mycommunityinfo.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mycommunityinfo/mycommunityinfo.wxml b/pages/mycommunityinfo/mycommunityinfo.wxml new file mode 100644 index 0000000..7189cec --- /dev/null +++ b/pages/mycommunityinfo/mycommunityinfo.wxml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + {{item.wordsclickcount}} + + + + + + + + \ No newline at end of file diff --git a/pages/mycommunityinfo/mycommunityinfo.wxss b/pages/mycommunityinfo/mycommunityinfo.wxss new file mode 100644 index 0000000..a7773b5 --- /dev/null +++ b/pages/mycommunityinfo/mycommunityinfo.wxss @@ -0,0 +1,330 @@ +.courselive { + width: 750rpx; + height: 403rpx; + } + + .functionalarea { + display: flex; + flex-flow: row wrap; + align-content: flex-start; + width: 750rpx; + height: 550rpx; + } + + .areaitem { + margin-top: 60rpx; + text-align: center; + width: 33%; + height: 170rpx; + } + + .areaitem image { + width: 120rpx; + height: 170rpx; + } + + .messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; + } + + .msseagehead { + display: flex; + flex-direction: row; + } + + .headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; + } + + .headleft image { + + width: 130rpx; + height: 133rpx; + } + + .headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 200rpx; + height: 142rpx; + } + + .headrightup text { + + font-size: 30rpx; + font-weight: 400rpx; + } + + .headrightdown { + font-size: 30rpx; + margin-top: 10rpx; + } + + .msseagemiddle { + margin: 0 60rpx; + } + + .mssagemiddledown { + margin: 25rpx auto; + } + + .mssagemiddledown image { + + width: 100%; + height: 265rpx; + } + + .messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + + } + + .messageendleft { + width: 150rpx; + height: 30rpx; + } + + .messageendleft image { + width: 100rpx; + height: 30rpx; + } + + .messageendmiddle { + width: 150rpx; + height: 30rpx; + } + + .messageendmiddle image { + width: 35rpx; + height: 30rpx; + } + + .messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .messageendright { + + width: 150rpx; + height: 30rpx; + } + + .messageendright image { + width: 35rpx; + height: 30rpx; + + } + + .messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .feigexian { + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; + } + + .areaclass { + + width: 540rpx; + height: 193rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; + } + + .areafooter { + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; + } + + .areafooterleft image { + + width: 26rpx; + height: 26rpx; + + } + + .areafooterright text { + font-size: 28rpx; + font-weight: 600; + color: #217ced; + } + + .vipimage image { + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; + } + + /* 社区头部 */ + .communityhead { + width: 680rpx; + height: 210rpx; + margin: 0 auto; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + } + + .communityheadleft { + background: url('https://ndnd.duiduiedu.com/uploads/pics/communtlistheadleft.png') no-repeat; + width: 385rpx; + height: 206rpx; + background-size: 100% 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + + .communityheadright { + width: 232rpx; + height: 206rpx; + margin-left: 40rpx; + } + + .communityheadrightup { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; + } + + .communityheadrightup image { + width: 240rpx; + height: 80rpx; + } + + .communityheadrightdown { + width: 240rpx; + height: 80rpx; + margin-top: 20rpx; + } + + .communityheadrightdown image { + width: 240rpx; + height: 80rpx; + } + + .communityheadleftitem1 { + width: 240rpx; + margin-left: 55rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + } + + .communityheadleftitem2 { + width: 80rpx; + height: 180rpx; + } + + .communityheadleftitem2 image { + width: 80rpx; + height: 175rpx; + } + + .messageitem { + width: 240rpx; + height: 38rpx; + border: 1rpx solid #1ccfd6; + color: #1ccfd6; + margin-bottom: 10rpx; + text-align: center; + overflow: hidden; + } + + /* 社区头部 */ + + /* 社区滑动 */ + .curriculumup { + width: 680rpx; + height: 55rpx; + margin: 0 auto; + margin-top: 40rpx; + } + + .curriculumupstart { + float: left; + width: 680rpx; + height: 55rpx; + } + + .curriculumupend { + float: left; + width: 50rpx; + height: 50rpx; + } + + .scroll-box { + white-space: nowrap; + height: 100%; + } + + .card-box { + display: inline-block; + margin-right: 10rpx; + } + + .card image { + height: 55rpx; + line-height: 55rpx; + width: 211rpx; + } + + .lineclass { + width: 685rpx; + margin: 2rpx auto; + border-bottom: 1rpx solid #dcdcdc; + } + + /* 社区滑动 */ + + /* 补充留言信息右边 */ + .itemright { + width: 200rpx; + margin-top: 50rpx; + margin-left: 30rpx; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + } + + .itemright image { + + margin-left: 10rpx; + width: 82rpx; + height: 32rpx; + } + + /* 补充留言信息右边 */ \ No newline at end of file diff --git a/pages/myexamanalysis/myexamanalysis.js b/pages/myexamanalysis/myexamanalysis.js new file mode 100644 index 0000000..226d841 --- /dev/null +++ b/pages/myexamanalysis/myexamanalysis.js @@ -0,0 +1,683 @@ +var WxParse = require('../../wxParse/wxParse.js'); +const app = getApp(); +var that; +var Interval; +var wechat; +var id; +var intt; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +var startX, endX; +var moveFlag = true; // 判断执行滑动事件 +Page({ + startX: 0, + startY: 0, + isClear: false, + startPageX: 0, + /** + * 页面的初始数据 --解释笔记 + */ + data: { + + title: '我的试题解释', + time: 2 * 60 * 60 * 1000, //初始时间 + paystatus: 1, //1未开始时间开始状态,2开始 + collection: 1, //1不收藏,2已收藏 + singdouble: 1, //1单选,2多选 + paiduanactive: 1, //1不是判断,2是判断题 + activeopen: true, + baseurl:baseUrl.globalData.baseimgurl, + paystatus: 1, //1未开始时间开始状态,2开始 + collection: 1, //1不收藏,2已收藏 + singdouble: 1, //1单选,2多选 + paiduanactive:1,//1不是判断,2是判断题 + zstime:1, //1正计,0倒计 + typeid:1, //0练习1正式 + activeopen:true, + coursetypefour_id:1, + itemdatacurrent:[], //当前数据 + itemdataall:[], //全部数据 + itemdata: [], //选项数据 + content:"",//富文本数据 + replylist:[], + showModalStatus: false, + pen: 3, + color: '#FFFFFF', + currentTab: 0, + now: 1, //当前页码 + all: 15, //总页码 + height: 0, + Timer_state: 1, + Answer_card: false, + Draft_paper: false, + false_analysis: false, + stem_height: 150, + jiexi: false, + field: { + analysis_text: "", + }, + img: [], + scroll: "scroll", + index: 0, + drag_line: false, + coursetypefour_id:1, + grouppaper_id:1, + typeid:1, + courseid:1,//试题ID + explainlist:[], //试题类型名称 + duicuo:1 //试题作答对与错1全部,2错的题 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.setNavigationBarTitle({ + title: this.data.title + }) + baseUrl.islogin(); + console.log(options); + this.setData({ + coursetypefour_id:options.coursetypefour_id, + grouppaper_id:options.grouppaper_id, + typeid:options.id, + duicuo:options.id + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + // this.getcoursetypefourexam(this.data.coursetypefour_id,this.data.grouppaper_id,this.data.duicuo); + this.wrodtypelist(); + // this.getexamexplantypelist(this.data.courseid); //试题类型列表 + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + //----------------------------- + // 手机触摸开始 + //----------------------------- + touchStart: function (e) { + //得到触摸点的坐标 + this.startX = e.changedTouches[0].x + this.startY = e.changedTouches[0].y + this.context = wx.createContext() + this.context.setStrokeStyle(this.data.color) + this.context.setLineWidth(this.data.pen) + this.context.setLineCap('round') // 让线条圆润 + this.context.beginPath() + + }, + //----------------------------- + // 触摸后移动 + //----------------------------- + touchMove: function (e) { + + var startX1 = e.changedTouches[0].x + var startY1 = e.changedTouches[0].y + this.context.moveTo(this.startX, this.startY) + this.context.lineTo(startX1, startY1) + this.context.stroke() + this.startX = startX1; + this.startY = startY1; + wx.drawCanvas({ + canvasId: 'myCanvas', + reserve: true, + actions: this.context.getActions() + }) + }, + penSelect: function (e) { + this.setData({ + pen: parseInt(e.currentTarget.dataset.param) + }); + this.isClear = false; + }, + colorSelect: function (e) { + this.setData({ + color: e.currentTarget.dataset.param + }); + this.isClear = false; + }, + cleardraw: function (e) { + this.setData({ + showModalStatus: false + }); + this.setData({ + showModalStatus: true + }); + }, + caogaoclick: function () { + + this.setData({ + showModalStatus: true, + }) + }, + //----------------------------- + // 草稿纸 + //----------------------------- + shows: function () { + const that = this; + console.log(that.data.Draft_paper); + that.data.Draft_paper = !that.data.Draft_paper; + if (that.data.Draft_paper == false) { + that.setData({ + Draft_paper: true, + }) + this.util('open'); + } else { + that.setData({ + Draft_paper: false, + showModalStatus: false + }) + } + }, + util: function (currentStatu) { + var animation = wx.createAnimation({ + duration: 200, + timingFunction: "linear", + delay: 0, + }); + this.animation = animation; + animation.opacity(0).rotateX(-100).step(); + this.setData({ + animationData: animation.export() + }) + setTimeout(function () { + animation.opacity(1).rotateX(0).step(); + this.setData({ + animationData: animation + }) + if (currentStatu == "close") { + this.setData({ + showModalStatus: false + }); + } + }.bind(this), 200) + // 显示 + if (currentStatu == "open") { + this.setData({ + showModalStatus: true + }); + } + }, + touchStart1: function (e) { + startX = e.touches[0].pageX; // 获取触摸时的原点 + moveFlag = true; + }, + // 触摸移动事件 + touchMove1: function (e) { + endX = e.touches[0].pageX; // 获取触摸时的原点 + if (moveFlag) { + if (endX - startX > 50) { + console.log("move right"); + this.move2right(); + moveFlag = false; + } + if (startX - endX > 50) { + console.log("move left"); + this.move2left(); + moveFlag = false; + } + } + + }, + // 触摸结束事件 + touchEnd1: function (e) { + moveFlag = true; // 回复滑动事件 + }, + move2left() { + const that = this; + const index = that.data.index + 1; + const all = that.data.all; + if (index < all) { + + console.log(that.data.itemdataall[index].id); + this.setData({ + index: index, + now: index + 1, + itemdata: that.data.itemdataall[index].examitem, + itemdatacurrent:that.data.itemdataall[index], + content:that.data.itemdataall[index].name.replace(/\ { + console.log(res.data); + that.setData({ + itemdataall: res.data.item, + itemdata:res.data.item[0].examitem, + all:res.data.item.length, + itemdatacurrent:res.data.item[0], + content:res.data.item[0].name.replace(/\ { + console.log(errMsg); + }); + }, //解释开始 + collectionclickdata:function(collection_id,user_id) { + const that = this; + let url = baseUrl.globalData.baseUrl + '/course/coursecollection'; + var param = { + id: collection_id, + user_id:user_id + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + this.getcoursedata(that.data.courseid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + displayview:function() { + console.log(this.data.showview); + this.setData({ + showview:(!this.data.showview) + }) + }, + wrodtypelist:function(params){ + + //获取课程留言 + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/wordsexamuser'; + var param = { + user_id: wx.getStorageSync('wxuserid')==null?3:wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + replylist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsclick:function(ee){ + + let e1=ee.currentTarget.id; + let e2=baseUrl.globalData.currentuserinfo.id; + const that = this; + let url = baseUrl.globalData.baseUrl + '/wordslist/wordscourseclickcount'; + var param = { + words_id: e1, + user_id: e2, + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + uploadpic:function(){ + var that = this; + let imagesList = []; + let maxSize = 1024 * 1024; + let maxLength = 6; + let flag = true; + wx.chooseImage({ + count: 9, //最多可以选择的图片总数 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 500 + }) + for (let i = 0; i < res.tempFiles.length; i++) { + if (res.tempFiles[i].size > maxSize) { + flag = false; + console.log(111) + wx.showModal({ + content: '图片太大,不允许上传', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } + } + }); + } + } + if (res.tempFiles.length > maxLength) { + console.log('222'); + wx.showModal({ + content: '最多能上传' + maxLength + '张图片', + showCancel: false, + success: function (res) { + if (res.confirm) { + console.log('确定'); + } + } + }) + } + if (flag == true && res.tempFiles.length <= maxLength) { + that.setData({ + imagesListp: res.tempFilePaths + }) + that.data.imagestr=[]; + var arr=''; + for (let i = 0; i < that.data.imagesListp.length; i++) { + wx.uploadFile({ + url: baseUrl.globalData.baseUrl + '/wordslist/uploadpics', + filePath: that.data.imagesListp[i], + name: 'file', + success:function(res){ + //打印 + console.log("------------响应数据:"); + console.log(res.data); + + var message = JSON.parse(res.data); + that.data.imagestr.push(message); + that.setData({ + imagestr:that.data.imagestr + }); + }, + }) + + } + + + } + console.log(res); + }, + fail: function (res) { + console.log(res); + } + }) + + }, + formSubmit:function(e) { + + if(wx.getStorageSync('wxuserid')==''){ + wx.navigateTo({ + url: '/pages/userlogin/userlogin', + }) + } + + let content = this.data.wordstextname; + console.log(content) + if (content == '') { + wx.showToast({ + title: '留言内容为空,请填写内容', + icon: 'none', + duration: 1500 + }) + return false; + } + // console.log(this.data.imagestr); + this.wordsadd(content,this.data.imagestr); + + }, + bindTextAreaBlur: function(e) { + this.setData({ + wordstextname:e.detail.value + }) + }, + uploadpicsimage:function(e){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/wordslist/uploadpics'; + var param = { + url: e + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + wordsadd:function(content,imagestr){ + + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examexplainadd'; + var param = { + content: content, + imagestr:imagestr, + userid:wx.getStorageSync('wxuserid')==''?3:wx.getStorageSync('wxuserid'), + exam_id:that.data.courseid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res.data); + if(res.data>0){ + wx.showToast({ + title: '留言内容成功', + icon: 'none', + duration: 1500 + }) + + that.wrodtypelist(that.data.courseid); //试题留言 + that.getexamexplantypelist(that.data.courseid); //试题类型列表 + that.setData({ + wordstextname:'' + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + },contentclick:function(params) { + + console.log(params); + let id=params.currentTarget.id; + let xid=params.currentTarget.dataset.xid; + console.log(id); + this.setData({ + wordstextname:'回复@'+id, + showview:true + }); + + this.addinccomment(xid); + + wx.showToast({ + title: '@成功,留言请移底部留言', + icon: 'none', + duration: 1500 + }) + + + },rdclick:function(params) { + wx.navigateTo({ + url: '/pages/communityinfo/communityinfo?id='+params.currentTarget.id, + }) + },addinccomment:function(params) { + //增加评论数 + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/addcommentcount'; + var param = { + id:params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(that.data.courseid); + this.getexamexplantypelist(that.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + clickbtn:function(params) { + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/wordscourseclickcount'; + var param = { + words_id:params.currentTarget.id, + user_id: userid + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + // this.wrodtypelist(this.data.courseid) + this.wrodtypelist(this.data.courseid); + this.getexamexplantypelist(this.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + preview:function (params) { + let that=this; + console.log(params) + let currentUrl = params.currentTarget.dataset.src; + let arrindex=params.currentTarget.dataset.id; + + let rearr=that.data.replylist[arrindex].pics; + console.log(rearr); + let arr=[]; + rearr.forEach(function (item,index) { + arr[index]=that.data.baseurl+item + }); + console.log(arr); + wx.previewImage({ + current: currentUrl, // 当前显示图片的http链接 + urls: arr // 需要预览的图片http链接列表 + }) + }, + getexamexplantypelist:function(params) { + + console.log(params); + let userid=wx.getStorageSync('wxuserid'); + const that = this; + let url = baseUrl.globalData.baseUrl + '/exam/examexplaintypelist'; + var param = { + exam_id:params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + this.setData({ + + explainlist:res.data + + }) + // this.wrodtypelist(this.data.courseid) + // this.wrodtypelist(this.data.courseid); + }).catch((errMsg) => { + console.log(errMsg); + }); + + } + + +}) \ No newline at end of file diff --git a/pages/myexamanalysis/myexamanalysis.json b/pages/myexamanalysis/myexamanalysis.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/myexamanalysis/myexamanalysis.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/myexamanalysis/myexamanalysis.wxml b/pages/myexamanalysis/myexamanalysis.wxml new file mode 100644 index 0000000..c5ce35e --- /dev/null +++ b/pages/myexamanalysis/myexamanalysis.wxml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + {{item.userinfo['nickname']}} + + + {{item.times}} + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + {{item.commentcount}} + + + + {{item.wordsclickcount}} + + + + + + + + + +
+ + + + + + + + + + + +
\ No newline at end of file diff --git a/pages/myexamanalysis/myexamanalysis.wxss b/pages/myexamanalysis/myexamanalysis.wxss new file mode 100644 index 0000000..cacf12e --- /dev/null +++ b/pages/myexamanalysis/myexamanalysis.wxss @@ -0,0 +1,635 @@ +.page { + background-color: #ededed; + } + + .examing { + display: flex; + flex-direction: row; + align-items: center; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + top: 0; + } + + .item1 { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; + } + + .item1 image { + width: 50rpx; + height: 50rpx; + margin: 0 19rpx; + } + + .item4 { + width: 50rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 80rpx; + + } + + .item4 image { + width: 50rpx; + height: 44rpx; + margin: 0 19rpx; + } + + .item5 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 120rpx; + + } + + .item5 image { + width: 38rpx; + height: 47rpx; + margin: 0 22rpx; + } + + .item2 { + width: 150rpx; + height: 50rpx; + margin-top: 16rpx; + margin-left: 19rpx; + } + + .item2 text { + width: 150rpx; + height: 50rpx; + color: white; + } + + .item3 { + width: 100rpx; + height: 50rpx; + margin-top: 10rpx; + margin-left: 79rpx; + } + + .item3 text { + width: 100rpx; + height: 50rpx; + color: white; + } + + .examingfooter { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; + height: 80rpx; + background-color: #49dae0; + position: fixed; + bottom: 0; + } + + .footerleft image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; + } + + .footermiddle image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; + } + + .footerright image { + margin: 0 25rpx; + width: 160rpx; + height: 53rpx; + } + + .examingcontent { + width: 700rpx; + margin: 80rpx auto; + max-height: 250rpx; + overflow: hidden; + } + + .examingcontent2 { + width: 700rpx; + margin: 80rpx auto; + } + + + .examingcontent text { + font-size: 30rpx; + font-weight: 400; + + } + + .examintcontentda { + width: 700rpx; + margin: 0 auto; + float: left; + margin-bottom: 80rpx; + } + + .contentleft { + float: left; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin-left: 25rpx; + } + + .contentleft image { + width: 49rpx; + height: 49rpx; + } + + .contentright { + margin-left: 25rpx; + float: left; + width: 600rpx; + } + + .charclass { + display: flex; + justify-items: center; + } + + .charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + left: 4px; + top: -31px; + text-align: center; + } + + .item2 .van-count-down { + color: white; + } + + /*草稿纸*/ + .topic_cgz { + position: fixed; + top: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.4); + z-index: 999; + overflow: hidden; + } + + .topic_cgz_tab { + width: 100%; + height: 100%; + padding: 0; + position: fixed; + top: 0rpx; + } + + .topic_cgz_tab .fl { + width: 25%; + text-align: center; + } + + .topic_cgz_tab image { + width: 60rpx; + height: 60rpx; + } + + /*滚动层*/ + scroll-item { + z-index: 9; + } + + .scoll-h { + height: 100%; + } + + .tab-content { + height: 100%; + width: 100%; + background: #fff; + } + + .the_big_box { + height: 100%; + width: 100%; + background: #fff; + overflow-x: hidden; + } + + .tab-content-top { + margin-top: 20rpx; + } + + .toolsclass { + display: flex; + justify-items: center; + justify-content: space-between; + width: 100%; + margin: 0 auto; + height: 200rpx; + position: fixed; + bottom: 200; + } + + .openclass { + + display: flex; + justify-content: center; + width: 700rpx; + margin: 80rpx auto; + + } + + .openclass image { + width: 120rpx; + height: 24rpx; + } + + .examanswer { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + width: 100%; + height: 180rpx; + background-color: #f0f0f0; + margin: 50rpx auto; + } + + .answerleft { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 45%; + height: 180rpx; + align-items: center; + } + .answerleftup{ + + color: #808080; + font-size: 35rpx; + } + + .answerleftdown{ + + color: #1ccfd6; + font-size: 45rpx; + font-weight: 400; + } + + .answerright { + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 45%; + height: 180rpx; + align-items: center; + color: #000000; + font-size: 35rpx; + } + + .analysisnote{ + + width: 720rpx; + height: 280rpx; + overflow: hidden; + margin: 0 auto; + display: flex; + flex-direction:row; + } + .analysisnoteleft{ + width: 60%; + display: flex; + flex-wrap: wrap; + justify-content: space-between; + + } + .leftitem{ + margin-right: 20rpx; + line-height: 50rpx; + width: 44%; + height: 50rpx; + border: 1rpx solid #49dae0; + color: #49dae0; + font-size: 26rpx; + text-align: center; + margin-top: 10rpx; + + } + + .leftitem2{ + margin-right: 20rpx; + margin-right: 20rpx; + line-height: 50rpx; + width: 44%; + height: 50rpx; + border: 1rpx solid #909090; + color: #909090; + font-size: 26rpx; + text-align: center; + + } + .analysisnoteright{ + width: 38%; + height: 200rpx; + text-align: right; + } + .analysisnoteright image{ + + width: 180rpx; + height: 50rpx; + margin-right: 20rpx; + + } + .feigexiang{ + + width: 620rpx; + height: 10rpx; + border-bottom: 1rpx solid #dedcdc; + margin: 20rpx auto; + } + .explainline { + width: 705rpx; + height: 30rpx; + margin: 0 auto; + border-left: 8rpx solid #49dae0; + } + .explainline text{ + + + display: flex; + flex-direction: column; + justify-content:baseline; + align-items:left; + height: 30rpx; + line-height: 30rpx; + + font-size: 30rpx; + color:#323232; + margin-left: 30rpx; + } + + /* 笔记解释 */ + .messagearea text { + + display: block; + font-size: 40rpx; + font-weight: 600rpx; + margin-left: 60rpx; + } + + .msseagehead { + display: flex; + flex-direction: row; + } + + .headleft { + margin-left: 60rpx; + margin-top: 50rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + overflow: hidden; + } + + .headleft image { + + width: 130rpx; + height: 133rpx; + } + + .headright { + margin-top: 80rpx; + margin-left: 23rpx; + width: 485rpx; + height: 142rpx; + } + + .headrightup text { + + font-size: 30rpx; + /* font-weight: 400rpx; */ + } + + .headrightdown { + margin-top: 10rpx; + } + + .msseagemiddle { + margin: 0 60rpx; + } + + .mssagemiddledown { + margin: 25rpx auto; + } + + .mssagemiddledown image { + + width: 100%; + height: 265rpx; + } + + .messageend { + + margin: 0 60rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + + } + + .messageendleft { + width: 150rpx; + height: 30rpx; + } + + .messageendleft image { + width: 100rpx; + height: 30rpx; + } + + .messageendmiddle { + width: 150rpx; + height: 30rpx; + } + + .messageendmiddle image { + width: 35rpx; + height: 30rpx; + } + + .messageendmiddle text { + + font-size: 28rpx; + padding-left: 23rpx; + } + + .messageendright { + + width: 150rpx; + height: 30rpx; + } + + .messageendright image { + width: 35rpx; + height: 30rpx; + + } + + .messageendright text { + + font-size: 28rpx; + padding-left: 23rpx; + } + .feigexian{ + + margin: 0 60rpx; + margin-top: 60rpx; + border-bottom: 2rpx solid #ada2a2; + } + .vipimage image{ + width: 37rpx; + height: 33rpx; + position: relative; + left: -25px; + top: 83px; + } + + /* 笔记解释 */ + + + .examingcontent { + width:100%; + margin: 80rpx auto; + /* max-height: 250rpx; + overflow: hidden; */ + } + + .examingcontent2 { + width: 100%; + margin: 80rpx auto; + } + + + .examingcontent text { + font-size: 30rpx; + font-weight: 400; + + } + + .examintcontentda { + width: 700rpx; + margin: 0 auto; + float: left; + margin-bottom: 80rpx; + } + + .contentleft { + float: left; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin-left: 25rpx; + } + + .contentleft image { + width: 49rpx; + height: 49rpx; + } + + .contentright { + margin-left: 25rpx; + float: left; + width: 600rpx; + } + + .charclass { + display: flex; + justify-items: center; + } + + .charclass text { + width: 37rpx; + height: 33rpx; + position: relative; + left: 4px; + top: -31px; + text-align: center; + } + + .item2 .van-count-down { + color: white; + } + /* + 解释开始 + */ + + + .areaclass{ + width: 540rpx; + min-height: 300rpx; + margin: 0 auto; + margin-top: 80rpx; + background-color: #f0f0f1; + border-radius: 5%; + } + .areaclass textarea{ + width: 540rpx; + min-height: 300rpx; + } + + + .areafooter{ + display: flex; + align-items: center; + justify-content: space-between; + width: 540rpx; + height: 60rpx; + margin: 0 auto; + margin-top: 10rpx; + } + .areafooterleft image{ + + width: 52rpx; + height: 52rpx; + + } + .areafooterright text{ + font-size: 28rpx; + font-weight: 600; + color: #217ced; + } + .areafooterright{ + width: 120rpx; + height: 56rpx; + } + .areafooterright button{ + + width: 120rpx; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + font-weight: 600; + color: #217ced; + border:none; + } + button::after { + border: none; + } + + .header_view_hide{ + display: none; + } + .header_view_show{ + display: block; + } \ No newline at end of file diff --git a/pages/myorder/myorder.js b/pages/myorder/myorder.js new file mode 100644 index 0000000..daf3f3c --- /dev/null +++ b/pages/myorder/myorder.js @@ -0,0 +1,75 @@ +const DEFAULT_PAGE = 0; +const baseUrl = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + active: 0, + }, + onChange(event) { + wx.showToast({ + title: `切换到标签 ${event.detail.name}`, + icon: 'none', + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + baseUrl.islogin(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/myorder/myorder.json b/pages/myorder/myorder.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/myorder/myorder.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/myorder/myorder.wxml b/pages/myorder/myorder.wxml new file mode 100644 index 0000000..dcde20d --- /dev/null +++ b/pages/myorder/myorder.wxml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 内容 2 + \ No newline at end of file diff --git a/pages/myorder/myorder.wxss b/pages/myorder/myorder.wxss new file mode 100644 index 0000000..9f13a60 --- /dev/null +++ b/pages/myorder/myorder.wxss @@ -0,0 +1,69 @@ +.van-tabs__line { + background-color: #49dae0 !important; +} + +.van-ellipsis { + + font-size: 32rpx; + font-weight: 400; +} + +Page { + background-color: #f5f5f5; +} + +.listdata { + + width: 690rpx; + height: 310rpx; + border: 1rpx solid #f5f5f5; + margin: 0 auto; + border-radius: 5%; + background-color: white; + margin-top: 40rpx; + display: flex; + flex-direction: column; + justify-items: center; + align-items: center; +} + +.dataitem1 { + margin-top: 20rpx; + width: 690rpx; + height: 180rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-content: center; +} + +.dataitem2 { + width: 690rpx; + height: 48rpx; + background-color: green; +} + +.dataitem3 { + width: 690rpx; + height: 80rpx; + background-color: yellow; +} + +.headitem1 { + + width: 164rpx; + height: 164rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/goodsline.png') no-repeat; + background-size: cover; + margin: 0 auto; +} +.headitem2{ + width: 340rpx; + height: 175rpx; + background-color: red; +} +.headitem3{ + width: 150rpx; + height: 175rpx; + background-color: green; +} \ No newline at end of file diff --git a/pages/mytest/mytest.js b/pages/mytest/mytest.js new file mode 100644 index 0000000..ee918e0 --- /dev/null +++ b/pages/mytest/mytest.js @@ -0,0 +1,42 @@ +//index.js +//获取应用实例 +const app = getApp() + +Page({ + data: { + + }, + onLoad: function () { + + }, + /** + * 点击日期时候触发的事件 + * bind:getdate + */ + getdate(e) { + console.log("----------"); + console.log(e.detail.datestr); + console.log(e.detail); + }, + /** + * 点击全选触发的事件 + * bind:checkall + */ + checkall(e) { + console.log(e.detail.days); + }, + /** + * 点击确定按钮触发的事件 + * bind:select + */ + cmfclick(e){ + console.log(e.detail.selectDays); + }, + /** + * 点击清空事件 + * bind:clear + */ + clear(e) { + console.log("要清空选中日期") + } +}) \ No newline at end of file diff --git a/pages/mytest/mytest.json b/pages/mytest/mytest.json new file mode 100644 index 0000000..2ed8749 --- /dev/null +++ b/pages/mytest/mytest.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "班级日历" + } \ No newline at end of file diff --git a/pages/mytest/mytest.wxml b/pages/mytest/mytest.wxml new file mode 100644 index 0000000..27bb2c0 --- /dev/null +++ b/pages/mytest/mytest.wxml @@ -0,0 +1,9 @@ + + + + + + + +sdfsdfsfds + \ No newline at end of file diff --git a/pages/mytest/mytest.wxss b/pages/mytest/mytest.wxss new file mode 100644 index 0000000..1d0a897 --- /dev/null +++ b/pages/mytest/mytest.wxss @@ -0,0 +1,6 @@ +/**index.wxss**/ +.center{ + display: flex; + justify-content: center; + margin-bottom: 10rpx; + } \ No newline at end of file diff --git a/pages/newmine/newmine.js b/pages/newmine/newmine.js new file mode 100644 index 0000000..bc6757f --- /dev/null +++ b/pages/newmine/newmine.js @@ -0,0 +1,318 @@ +const DEFAULT_PAGE = 0; +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Dialog from '@vant/weapp/dialog/dialog'; +Page({ + + data: { + myimg: 'https://ndnd.duiduiedu.com/uploads/pics/minemainhead.png', + userinfo: '', + avatar: '', + id: 0, + show: false, + popmsgdata: null, + username:'', + userdatainfo:'' + }, + getUserInfo(event) { + console.log(event.detail); + }, + onClose() { + this.setData({ show: false }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + usernamemdclick:function(params) { + this.setData({ showpopup: true }); + console.log(params); + }, + onClosepopup:function(params) { + this.setData({ showpopup: false }); + }, + onChangeuser:function (params) { + console.log(params.detail); + this.setData({ + username:params.detail + }) + }, + saveusername:function(params) { + //保存用户名称 + console.log(this.data.username); + this.updateusername(wx.getStorageSync('wxuserid'),this.data.username); + + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + // Apps.islogin(); + + // if (Apps.globalData.currentuserinfo == null){ + // wx.redirectTo({ + // url: '/pages/userlogin/userlogin', + // }) + // } + + this.loaddata(); + this.popmsg(); + this.userisblack(wx.getStorageSync('userinfo').mobile); //是否黑名单 + + + + // } + + }, + userisblack: function (mobile) { + //用户是否黑名单 + //直播列表 + const that = this; + let url = Apps.globalData.baseUrl + '/user/isblack'; + var param = { + mobile: mobile + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + wx.setStorageSync('userisblack', res); + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + aboutclick: function () { + //关于我们 + wx.navigateTo({ + url: '/pages/messageencyclopedias/messageencyclopedias?id=1', + }) + }, + onChooseAvatar: function (params) { + console.log(params); + }, + onClickShow: function () { + //加载数据 + let url = Apps.globalData.baseUrl + '/user/signdata'; + var param = { + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + let titles = "签到成功"; + if (res == 1) { + // titles = "签到成功"; + this.popmsg(); + } else if (res == 2) { + // titles = "连续签到成功"; + this.popmsg(); + } else if (res == 3) { + // titles = "重新签到成功"; + this.popmsg(); + } else { + titles = "今天已签到成功,无须再签到" + wx.showToast({ + title: titles,//提示文字 + duration: 2000,//显示时长 + mask: true,//是否显示透明蒙层,防止触摸穿透,默认:false + icon: 'none', //图标,支持"success"、"loading" + success: function () { },//接口调用成功 + fail: function () { }, //接口调用失败的回调函数 + complete: function () { } //接口调用结束的回调函数 + }) + + } + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + onClickHide(e) { + this.setData({ show: false }); + //签到 + }, + noop(e) { + //加载数据 + console.log(e); + let url = Apps.globalData.baseUrl + '/user/mpopmsg'; + var param = { + user_id: wx.getStorageSync('wxuserid'), + id: e.currentTarget.id, + xid: e.currentTarget.dataset.xid + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + this.setData({ show: false }); + this.loaddata(); + this.popmsg(); + + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + loaddata: function (params) { + + // if (Apps.globalData.currentuserinfo == null){ + // wx.redirectTo({ + // url: '/pages/userlogin/userlogin', + // }) + // } + Apps.islogin(); + + //加载数据 + let url = Apps.globalData.baseUrl + '/user/getuserinfobyopenid'; + var param = { + // id: Apps.globalData.currentuserinfo.id + id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + if (res.data == null) { + //如果用户在数据中没有数据则重新注册 + wx.navigateTo({ + url: '/pages/userlogin/userlogin', + }) + } + this.setData({ + userinfo: res.data + }); + Apps.globalData.userinfo=res.data; + // const userdatainfo = wx.getStorageSync('userinfo'); + + this.setData({ + myimg: res.data.avatar, + username: res.data.username, + userdatainfo: res.data + }) + wx.setStorageSync('wxuserid', res.data.id); + wx.setStorageSync('userinfo', res.data); + wx.setStorageSync('wxopenid', res.data.openid); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + vipclick: function (params) { + wx.navigateTo({ + url: '/pages/vipquanyi/vipquanyi', + }) + }, + myaddressclick: function (params) { + wx.navigateTo({ + url: '/pages/myaddress/myaddress', + }) + }, + vipchargeclick: function (params) { + wx.navigateTo({ + url: '/pages/viprecharge/viprecharge', + }) + }, + collectioncourseclick: function (params) { + wx.navigateTo({ + url: '/pages/collectionsub/collectionsub', + }) + }, + vipquanyiclick: function (params) { + wx.redirectTo({ + url: '/pages/viprecharge/viprecharge', + }) + }, + chargeshopclick: function (params) { + wx.navigateTo({ + url: '/pages/chargeshop/chargeshop', + }) + }, + mycommunityinfoclick: function (params) { + wx.navigateTo({ + url: '/pages/mycommunityinfo/mycommunityinfo', //我的怒贴 + }) + }, + myexamanalysisclick: function (params) { + wx.navigateTo({ + url: '/pages/myexamanalysis/myexamanalysis', //我的怒贴 + }) + }, + popmsg: function () { + + //加载弹窗 + if (wx.getStorageSync('wxuserid') == null) + return; + + let url = Apps.globalData.baseUrl + '/user/getpopmsg'; + var param = { + id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + if (res.data != null) { + this.setData({ + show: true, + popmsgdata: res.data + }); + } + }).catch((errMsg) => { + console.log(errMsg); + }); + + }, + myonChooseAvatar: function (e) { + console.log("fan------------") + console.log(e.detail.avatarUrl); + const tempFilePaths =e.detail.avatarUrl; + const that = this; + wx.uploadFile({ + url: Apps.globalData.baseUrl +'/wordslist/uploadpics', //仅为示例,非真实的接口地址 + filePath: tempFilePaths, + name: 'file', + formData: { + 'user': 'test' + }, + success(res) { + const dataurl= Apps.globalData.baseimgurl+JSON.parse(res.data); + that.updateuserimage(wx.getStorageSync('wxuserid'),dataurl); + that.setData({ + myimg:dataurl + }) + } + }) + }, + updateuserimage: function (id,avatar) { + + //更新用户头像 + const that = this; + let url = Apps.globalData.baseUrl + '/user/updateuserimage'; + var param = { + id: id, + avatar:avatar + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + updateusername: function (id,username) { + + //更新用户头像 + const that = this; + let url = Apps.globalData.baseUrl + '/user/updateusername'; + var param = { + id: id, + username:username + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + that.loaddata(); + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/newmine/newmine.json b/pages/newmine/newmine.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/pages/newmine/newmine.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/newmine/newmine.wxml b/pages/newmine/newmine.wxml new file mode 100644 index 0000000..f2862a7 --- /dev/null +++ b/pages/newmine/newmine.wxml @@ -0,0 +1,103 @@ + + + + + + + + + + + + {{userdatainfo.username}} + + + + + + + + + + + + + + + + + + + + + + + + {{userinfo.score}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{popmsgdata.name}}怼币 + 来源:{{popmsgdata.msg}} + + + + + + + + \ No newline at end of file diff --git a/pages/newmine/newmine.wxss b/pages/newmine/newmine.wxss new file mode 100644 index 0000000..82cab8d --- /dev/null +++ b/pages/newmine/newmine.wxss @@ -0,0 +1,353 @@ +/* 我的头部 */ +Image { + height: auto; +} + +.minemain { + width: 690rpx; + height: 250rpx; + margin: 0 auto; + background-image: url('https://ndnd.duiduiedu.com/uploads/pics/minemainback1.png'); + background-repeat: no-repeat; + /*下面的是关键的设置100%显示*/ + background-size: 100% 100%; +} + +.minemainleft { + display: flex; + width: 400rpx; + margin-top: 46rpx; + float: left; +} + +.mineleft1 image { + position: absolute; + left: 0rpx; + width: 153rpx; + height: 156rpx; + align-items: center; + z-index: 0; + border-radius: 50%; +} +.mineleft1 button{ + width: 153rpx; + height: 156rpx; + margin-left: 32rpx; + border-radius: 50%; + flex-direction: column; + justify-content: center; + align-items: center; + z-index: 0; +} + +.mineleft2 { + width: 500rpx; + height: 56rpx; + margin-left: 32rpx; + margin-top: 30rpx; +} +.leftup { + + width: 380rpx; + height: 56rpx; + line-height: 56rpx; + overflow:hidden; +} +.leftup text { + width: 500rpx; + font-size: 40rpx; + color: white; + overflow:hidden; +} +.leftdown{ + width: 300rpx; + height: 56rpx; + line-height: 56rpx; +} +.leftdown label { + width: 300rpx; + font-size: 24rpx; + color: white; +} + +.minemainright { + + float: right; + width: 100rpx; + height: 250rpx; + margin-right: 20rpx; +} + +.item1 { + width: 100rpx; + height: 100rpx; + margin-top: 46rpx; +} + +.item1 image { + width: 60rpx; + height: 60rpx; + margin-top: 46rpx; +} + +/* 我的头部 */ + +/* vip权益 */ +.minevipquanyi { + + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + width: 690rpx; + height: 100rpx; + margin: 20rpx auto; + background-color: #e2feff; +} + +.minemiddle1 { + + width: 240rpx; + height: 72rpx; + text-align: left; + margin-left: 20rpx; +} + +.minemiddle1 image { + width: 232rpx; + height: 72rpx; +} + +.minemiddle2 { + width: 200rpx; + height: 60rpx; + line-height: 60rpx; + text-align: center; + margin-left: 20rpx; +} + +.minemiddle2 text { + width: 200rpx; + height: 60rpx; + font-weight: 700; + font-size: 40rpx; + color: #1CCFD6; +} + +.minemiddle3 { + width: 220rpx; + height: 60rpx; + text-align: right; + margin-left: 10rpx; + margin-right: 20rpx; +} + +.minemiddle3 image { + width: 208rpx; + height: 64rpx; +} + +/* vip权益 */ + +/* 金币兑换 */ +.minevipduihuan { + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 690rpx; + height: 100rpx; + margin: 0 auto; + +} + +.duihuan1 { + width: 340rpx; + text-align: left; +} + +.duihuan1 image { + width: 340rpx; + height: 107rpx; +} + +.duihuan2 { + margin-left: 10rpx; + width: 340rpx; + text-align: left; +} + +.duihuan2 image { + width: 340rpx; + height: 107rpx; +} + +/* 金币兑换 */ + +/* 我的工具列表 */ + +.minetoolslist { + width: 690rpx; + height: 460rpx; + background-color: #e0feff; + margin: 40rpx auto; + border-radius: 3%; +} + +.minetoolslist image { + + margin-left: 110rpx; + margin-top: 40rpx; + margin-bottom: 40rpx; + width: 85rpx; + height: 124rpx; + +} + +/* 我的工具列表 */ + +/* 联系列表 */ +.linklist { + width: 690rpx; + height: 72rpx; + margin: 0 auto; + margin-bottom: 10rpx; +} + +.linklist2 { + width: 690rpx; + margin: 0 auto; + margin-bottom: 20rpx; + +} + +.linklist2 button { + background-image: url('https://ndnd.duiduiedu.com/uploads/pics/minemainmg1.png'); + background-repeat: no-repeat; + height: 72rpx; + border: none; + font-size: 16px; +} + +.linklist3 { + + background-image: url('https://ndnd.duiduiedu.com/uploads/pics/minemainkf.png'); + background-repeat: no-repeat; + background-size: cover; + background-color: #fff1f7; + height: 60rpx; + font-size: 16px; + width: 690rpx; + margin: 0 auto; + margin-bottom: 40rpx; +} + +.linklist3::after { + border: none; +} + +.linklist image { + width: 690rpx; + height: 72rpx; +} + +/* 联系列表 */ +/* vip图标 */ +.vipimage { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + position: relative; + padding-right: 0rpx; + top: -2rpx; + left: 170rpx; + width: 250rpx; + height: 33rpx; + +} + +.vipimage text { + line-height: 35rpx; + height: 35rpx; + color: white; + font-size: 28rpx; +} + +.vipimage image { + + margin-left: 0rpx; + width: 37rpx; + height: 33rpx; + z-index: 2; +} + +/* vip图标 */ + +.wrapper { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; +} + +.block { + width: 100%; + height: 100%; + background: url('https://ndnd.duiduiedu.com/uploads/pics/userwrapper01.png') center no-repeat; + background-size: contain; +} + +.blockbutton { + width: 200rpx; + height: 40rpx; + position: relative; + left: 100rpx; + top: 400rpx; +} + +.blocktext1 { + + width: 250rpx; + height: 60rpx; + position: relative; + left: 280rpx; + top: 800rpx; +} + +.blocktext1 text { + font-size: 22rpx; +} + +.blocktext2 { + + width: 200rpx; + height: 60rpx; + position: relative; + left: 310rpx; + top: 820rpx; +} + +.blocktext2 text { + font-size: 28rpx; + color: #fbaa4c; +} + +.circleimages { + + position:fixed; + margin-left: 32rpx; + border-radius: 48%; + flex-direction: column; + justify-content: center; + align-items: center; + width: 150rpx; + height: 150rpx; + top: 55rpx; +} +.usernameclass{ + margin: 30 auto; + color: white; +} \ No newline at end of file diff --git a/pages/newtest/newtest.js b/pages/newtest/newtest.js new file mode 100644 index 0000000..11b7aa0 --- /dev/null +++ b/pages/newtest/newtest.js @@ -0,0 +1,128 @@ +// pages/newtest/newtest.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + sliderValue: 0, //控制进度条slider的值, + updateState: false, //防止视频播放过程中导致的拖拽失效 + playStates: false //控制播放 & 暂停按钮的显示 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + this.videoContext = wx.createVideoContext('myVideo'); + this.setData({ + updateState: true + }) + }, + videoUpdate(e) { + if (this.data.updateState) { //判断拖拽完成后才触发更新,避免拖拽失效 + let sliderValue = e.detail.currentTime / e.detail.duration * 100; + let time = e.detail.currentTime.toFixed(0); + // let time = sliderValue.toFixed(0); + console.log('试看=>'+time); + if (time >= 20) { + this.videoContext.pause(); + } + this.setData({ + duration: e.detail.duration, + playStates:false, + sliderValue:time + }) + } + }, + sliderChanging(e) { + const times=this.data.sliderValue; + if(times>=20){ + this.videoContext.pause(); + console.log(times); + }else{ + this.videoContext.play(); + } + this.setData({ + updateState: false //拖拽过程中,不允许更新进度条 + }) + }, + sliderChange(e) { + if (this.data.duration) { + // const times=e.detail.value / 100 * this.data.duration; + const times=this.data.sliderValue; + if(times>=20){ + this.videoContext.pause(); + console.log(times); + }else{ + this.videoContext.play(); + } + this.setData({ + sliderValue: e.detail.value, + updateState: false //完成拖动后允许更新滚动条 + }) + } + }, + videoOpreation() { + + const times= this.data.sliderValue; + console.log(times); + if(times>=20){ + this.videoContext.pause(); + // this.data.playStates ? this.videoContext.pause() : this.videoContext.play(); + this.setData({ + playStates: !this.data.playStates + }) + } + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/newtest/newtest.json b/pages/newtest/newtest.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/newtest/newtest.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/newtest/newtest.wxml b/pages/newtest/newtest.wxml new file mode 100644 index 0000000..5212e28 --- /dev/null +++ b/pages/newtest/newtest.wxml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/pages/newtest/newtest.wxss b/pages/newtest/newtest.wxss new file mode 100644 index 0000000..ab9477c --- /dev/null +++ b/pages/newtest/newtest.wxss @@ -0,0 +1,23 @@ +.process-container image{ + + position: relative; + z-index: 99; + transform:translate(20%, -170%); + z-index: 999; + width: 60rpx; + height: 60rpx; + +} + +.slider-container { + position: relative; + z-index: 99; + left: 50%; + top: -379%; + transform: translate(-50%, -490%); + z-index: 999; + width: 80%; +} +.slider{ + width: 80%; +} \ No newline at end of file diff --git a/pages/picsdisplay/picsdisplay.js b/pages/picsdisplay/picsdisplay.js new file mode 100644 index 0000000..0f5e9c3 --- /dev/null +++ b/pages/picsdisplay/picsdisplay.js @@ -0,0 +1,66 @@ +// pages/picsdisplay/picsdisplay.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/pages/picsdisplay/picsdisplay.json b/pages/picsdisplay/picsdisplay.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/picsdisplay/picsdisplay.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/picsdisplay/picsdisplay.wxml b/pages/picsdisplay/picsdisplay.wxml new file mode 100644 index 0000000..b11fba3 --- /dev/null +++ b/pages/picsdisplay/picsdisplay.wxml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pages/picsdisplay/picsdisplay.wxss b/pages/picsdisplay/picsdisplay.wxss new file mode 100644 index 0000000..ea2d947 --- /dev/null +++ b/pages/picsdisplay/picsdisplay.wxss @@ -0,0 +1 @@ +/* pages/picsdisplay/picsdisplay.wxss */ \ No newline at end of file diff --git a/pages/singledouble/singledouble.js b/pages/singledouble/singledouble.js new file mode 100644 index 0000000..ee7f1f5 --- /dev/null +++ b/pages/singledouble/singledouble.js @@ -0,0 +1,72 @@ +Page({ + + /** + * 页面的初始数据 + */ + data: { + list:[{"id":"452113a3","name":"肥肥","active":''}, + {"id":"a1b931a0","name":"滚滚","active":''}, + {"id":"115af7f9","name":"圆圆","active":''}, + {"id":"60fe875c","name":"胖胖","active":''}, + {"id":"8f100654","name":"嘟嘟","active":''}], + type:[ + { id:'sgyl',name:'单选11111',active:false}, + { id:'js',name:'单选22222',active:false}, + { id:'shjjfz',name:'单选33333',active:false}, + { id:'sbhqs',name:'单选4444',active:false}, + { id:'ldmf',name:'单选5555',active:false}, + { id:'xfgw',name:'单选66666',active:false} + ] + }, + + //单选 + bindActive(e){ + let arr = this.data.type.map(item=>{ + if(item.id===e.currentTarget.dataset.id){ + item.active=!item.active + }else{ + item.active=false + } + return item + }) + this.setData({type:arr}); + this.getPeopleInfo(); + }, + +//多选 + bindList(e){ + let index=e.currentTarget.dataset.id; + let arr=this.data.list.map(item=>{ + if(item.id == index && item.active == ""){ + item.active="active"; + }else if(item.id == index){ + item.active=""; + } + return item + }) + this.setData({list:arr}); + this.getPeopleInfo(); + }, + +//获取id + getPeopleInfo(){ + let ids=this.data.list.filter( item=> item.active == 'active').map(item => item.id); + let dx=this.data.type.filter(item => item.active == true).map(item=>item.id); + console.log('多选Id:'+ids) + console.log('单选Id:'+dx); + }, + onLoad: function (options) { + var arrSimple=new Array('A','D','C','B'); + arrSimple.sort(); + console.log(arrSimple); + + + var strList = ['A', 'C', 'D', 'B']; + + strList.sort((a, b) => { + return a.localeCompare(b); + }); + console.log(strList); + + }, +}) diff --git a/pages/singledouble/singledouble.json b/pages/singledouble/singledouble.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/singledouble/singledouble.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/singledouble/singledouble.wxml b/pages/singledouble/singledouble.wxml new file mode 100644 index 0000000..db2c619 --- /dev/null +++ b/pages/singledouble/singledouble.wxml @@ -0,0 +1,14 @@ + + + 多选 + + {{item.name}} + + + + + 单选 + + {{item.name}} + + diff --git a/pages/singledouble/singledouble.wxss b/pages/singledouble/singledouble.wxss new file mode 100644 index 0000000..307e8bf --- /dev/null +++ b/pages/singledouble/singledouble.wxss @@ -0,0 +1,21 @@ +.content{ + margin-bottom: 50rpx; +} +.title{ + font-size: 40rpx; + font-weight: bold; +} +.item > view{ + color: #666666; + font-size: 24.8rpx; + background: #EEEEEE; + padding: 11rpx 27rpx; + border-radius: 24rpx; + margin-top: 16rpx; + margin-right: 16rpx; + cursor: pointer; +} +.item .active{ + color:#ffffff; + background-color: #1D80F5; +} diff --git a/pages/swipecell/swipecell.js b/pages/swipecell/swipecell.js new file mode 100644 index 0000000..1d5df33 --- /dev/null +++ b/pages/swipecell/swipecell.js @@ -0,0 +1,81 @@ +// pages/swipecell/swipecell.js +Page({ + onClose(event) { + const { position, instance } = event.detail; + switch (position) { + case 'left': + case 'cell': + instance.close(); + break; + case 'right': + Dialog.confirm({ + message: '确定删除吗?', + }).then(() => { + instance.close(); + }); + break; + } + }, + /** + * 页面的初始数据 + */ + 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/pages/swipecell/swipecell.json b/pages/swipecell/swipecell.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/swipecell/swipecell.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/swipecell/swipecell.wxml b/pages/swipecell/swipecell.wxml new file mode 100644 index 0000000..b7c052a --- /dev/null +++ b/pages/swipecell/swipecell.wxml @@ -0,0 +1,18 @@ + + + 普通按钮1 + 普通按钮1 + + + 普通按钮2 + 普通按钮4 + 普通按钮5 + 普通按钮6 + + + + 普通按钮3 + 普通按钮3 + + + diff --git a/pages/swipecell/swipecell.wxss b/pages/swipecell/swipecell.wxss new file mode 100644 index 0000000..389195a --- /dev/null +++ b/pages/swipecell/swipecell.wxss @@ -0,0 +1 @@ +/* pages/swipecell/swipecell.wxss */ \ No newline at end of file diff --git a/pages/tarbar/tarbar.js b/pages/tarbar/tarbar.js new file mode 100644 index 0000000..9f030c0 --- /dev/null +++ b/pages/tarbar/tarbar.js @@ -0,0 +1,85 @@ +// pages/tarbar/tarbar.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + active: 0, + active2:0, + icon: { + normal: 'https://img.yzcdn.cn/vant/user-inactive.png', + active: 'https://img.yzcdn.cn/vant/user-active.png', + }, + }, + onChange2(event) { + this.setData({ active2: event.detail }); + }, + onChange(event) { + wx.showToast({ + title: `切换到标签 ${event.detail.name}`, + icon: 'none', + }); + }, + clickconent(e){ + + console.log(e) + + }, + + /** + * 生命周期函数--监听页面加载 + */ + 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/pages/tarbar/tarbar.json b/pages/tarbar/tarbar.json new file mode 100644 index 0000000..dcc01ac --- /dev/null +++ b/pages/tarbar/tarbar.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#ff99cc", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "微信接口功能演示", + "backgroundColor": "#ccc", + "backgroundTextStyle": "light" +} \ No newline at end of file diff --git a/pages/tarbar/tarbar.wxml b/pages/tarbar/tarbar.wxml new file mode 100644 index 0000000..606a4f8 --- /dev/null +++ b/pages/tarbar/tarbar.wxml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + 内容 2 + 内容 3 + 内容 4 + 内容 5 + 内容 6 + 内容 7 + 内容 8 + + + + + + + 自定义 + + 标签 + 标签 + diff --git a/pages/tarbar/tarbar.wxss b/pages/tarbar/tarbar.wxss new file mode 100644 index 0000000..5fe0a0c --- /dev/null +++ b/pages/tarbar/tarbar.wxss @@ -0,0 +1,7 @@ +.bordercss{ + + border-style: solid; + border-color: green; + border: 2rpx salmon; + background-color: green; +} \ No newline at end of file diff --git a/pages/userlogin/userlogin.js b/pages/userlogin/userlogin.js new file mode 100644 index 0000000..ea90624 --- /dev/null +++ b/pages/userlogin/userlogin.js @@ -0,0 +1,286 @@ +const Apps = getApp(); +import Toast from '@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + checked: false, + showpop: false, + isLogging: false, // 添加登录中的标志位,防止重复点击 + redirectUrl: '', // 登录成功后需要跳转的页面路径 + redirectParams: {} // 登录成功后需要传递的参数 + }, + onClose() { + this.setData({ showpop: false }); + }, + bindconfirmdata: function (params) { + this.setData({ checked: true }); + }, + + canclebtn: function (params) { + this.setData({ + checked: false + }) + }, + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // 接收跳转参数,用于登录成功后返回 + if (options.redirect_url) { + this.setData({ + redirectUrl: decodeURIComponent(options.redirect_url) + }); + } + // 接收其他参数,如 camp_id + if (options.camp_id) { + // camp_detail 页面使用 id 参数,所以只传递 id + this.setData({ + redirectParams: { + id: options.camp_id // camp_detail 页面使用 id 参数 + } + }); + } + }, + // checkbox 勾选状态变化 + onChange(event) { + console.log(event.detail); + this.setData({ + checked: event.detail + }); + }, + + // 显示协议弹窗 + showAgreement() { + this.setData({ + showpop: true + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + // 保留用户登录态及跳转参数,避免清空导致页面无法正常跳转显示 + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + /** + * 获取手机号码登录 + */ + getPhoneNumber(e) { + const that = this; + + console.log('getPhoneNumber 事件返回:', e.detail); + + // 检查是否勾选协议 + if (that.data.checked == false) { + Toast.success('请先阅读协议'); + return; + } + + // 防止重复点击 + if (that.data.isLogging) { + console.log('正在登录中,请勿重复点击'); + return; + } + + // 用户拒绝授权 + if (e.detail.errMsg !== 'getPhoneNumber:ok') { + wx.showToast({ + title: '您拒绝了手机号授权', + icon: 'none' + }); + return; + } + + // 设置登录中状态 + that.setData({ + isLogging: true + }); + + // 显示加载提示 + wx.showLoading({ + title: '登录中...', + mask: true + }); + + // 获取手机号的加密数据 + const encryptedData = e.detail.encryptedData; // 加密数据 + const iv = e.detail.iv; // 加密算法的初始向量 + + console.log('手机号 encryptedData:', encryptedData); + console.log('手机号 iv:', iv); + + // 先调用 wx.login 获取登录凭证 code + wx.login({ + success(loginRes) { + if (loginRes.code) { + const loginCode = loginRes.code; // 登录凭证,用于获取 openid + console.log('登录 code:', loginCode); + + // 一次性发起网络请求,传递 code、iv、encryptedData 三个参数 + wx.request({ + // url: 'http://127.0.0.1:8006/addons/unishop/user/authSession', + url: 'https://ndnd.duiduiedu.com/addons/unishop/user/authSession', + data: { + code: loginCode, // 使用 wx.login 返回的 code + iv: iv, + encryptedData: encryptedData, + platform: 'MP-WEIXIN' + }, + header: { + 'content-type': 'application/x-www-form-urlencoded' + }, + method: "POST", + datatype: 'json', + success: function (authRes) { + console.log('authSession 返回:', authRes); + + // 关闭加载提示 + wx.hideLoading(); + + if (!authRes.data || !authRes.data.data) { + // 重置登录状态 + that.setData({ + isLogging: false + }); + + wx.showToast({ + title: '登录失败,请重试', + icon: 'none' + }); + return; + } + + // authSession 接口已经返回完整用户信息,直接使用 + const userData = authRes.data.data; + + // 保存全局数据 + Apps.globalData.wxopenid = userData.openid; + Apps.globalData.session_key = userData.userInfo.session_key; + Apps.globalData.currentuserinfo = userData.userInfo; + + // 保存到本地存储 + wx.setStorageSync('wxopenid', userData.openid); + wx.setStorageSync('wxuserid', userData.userInfo.id); + wx.setStorageSync('userinfo', userData.userInfo); + + // 登录成功,根据是否有跳转参数决定跳转位置 + wx.showToast({ + title: '登录成功', + icon: 'success', + duration: 1500 + }); + + setTimeout(() => { + // 如果有重定向URL,跳转到指定页面 + if (that.data.redirectUrl) { + var redirectUrl = that.data.redirectUrl; + // 如果有参数,构建完整的URL + if (that.data.redirectParams && Object.keys(that.data.redirectParams).length > 0) { + var params = []; + for (var key in that.data.redirectParams) { + params.push(key + '=' + that.data.redirectParams[key]); + } + redirectUrl += '?' + params.join('&'); + } + wx.redirectTo({ + url: redirectUrl + }); + } else { + // 默认跳转到首页 + wx.switchTab({ + url: '/pages/index/index', + }); + } + }, 1500); + }, + fail: function (err) { + // 请求失败,重置状态 + wx.hideLoading(); + that.setData({ + isLogging: false + }); + + console.log('请求失败:', err); + wx.showToast({ + title: '网络请求失败,请重试', + icon: 'none' + }); + } + }) + } else { + // wx.login 失败,重置状态 + wx.hideLoading(); + that.setData({ + isLogging: false + }); + + console.log('wx.login 失败:' + loginRes.errMsg); + wx.showToast({ + title: '登录失败,请重试', + icon: 'none' + }); + } + }, + fail: (loginErr) => { + // wx.login 调用失败,重置状态 + wx.hideLoading(); + that.setData({ + isLogging: false + }); + + console.log('wx.login 调用失败:', loginErr); + wx.showToast({ + title: '登录失败,请重试', + icon: 'none' + }); + } + }) + } +}) \ No newline at end of file diff --git a/pages/userlogin/userlogin.json b/pages/userlogin/userlogin.json new file mode 100644 index 0000000..99fff04 --- /dev/null +++ b/pages/userlogin/userlogin.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "用户授权" +} \ No newline at end of file diff --git a/pages/userlogin/userlogin.wxml b/pages/userlogin/userlogin.wxml new file mode 100644 index 0000000..b1b55ed --- /dev/null +++ b/pages/userlogin/userlogin.wxml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + 一、用户协议 + + 用户协议是小程序开发者与用户之间达成的协议,规定了用户使用小程序的条件、权利和义务等内容。用户在使用小程序之前需要同意用户协议,否则无法使用小程序。 + + + 主要内容包括: + + 1. 用户注册和账号管理规定:包括用户注册、账号安全和管理等规定。 + + + 2. 使用规范和限制:包括用户在小程序上发布内容的规范、禁止发布的内容和行为等规定。 + + + 3. 用户权利和义务:包括用户在使用小程序时享有的权利和应承担的义务等规定。 + + + 4. 免责声明和责任限制:包括小程序开发者对小程序服务的免责声明和责任限制等规定。 + + + 5. 争议解决方式:包括双方在发生争议时解决方式的规定。 + + + 二、隐私政策 + + 隐私政策是小程序开发者为保护用户隐私而制定的政策,规定了小程序开发者在收集、使用、存储、保护用户个人信息时应遵守的原则和措施。 + + + 隐私政策包括: + + 1. 收集和使用用户个人信息的范围和目的:包括小程序开发者收集和使用哪些用户个人信息、为什么收集和使用这些信息等说明。 + + + 2. 个人信息的保护和管理:包括小程序开发者如何保护和管理用户个人信息,以及如何处理用户请求删除、更正、撤回同意等要求的规定。 + + + 3. 信息共享和披露:包括小程序开发者在哪些情况下会共享或披露用户个人信息的规定。 + + + 4. Cookie和类似技术的使用:包括小程序开发者在使用Cookie和类似技术时应遵守的规定。 + + + 5. 隐私政策的更新和变更:包括小程序开发者如何更新和变更隐私政策,以及用户如何获得通知和选择的规定。 + + + 三、用户权利 + + 小程序开发者需要确保用户在使用小程序时的知情权和选择权。在用户协议和隐私政策中,应当详细说明用户的权利和义务,并让用户明确知道自己的个人信息将会被收集和使用。用户有权选择是否同意协议和政策,以及随时撤回同意或删除个人信息的权利。 + + + 四、信息安全 + + 小程序开发者建立健全的个人信息保护机制,确保用户个人信息的安全和保密。开发者采取技术措施和管理措施,防止用户个人信息被泄露、丢失或被滥用。对于个人信息安全事件的处理,开发者及时采取应对措施,并向用户说明情况,依法履行相关报告和告知义务。 + + + 五、协议效力 + + 用户协议和隐私政策是保障用户合法权益和保护用户隐私的重要文件。小程序开发者制定协议和政策时,遵守法律法规和相关规定的要求,确保协议和政策的合法性和有效性。 + + + + + + \ No newline at end of file diff --git a/pages/userlogin/userlogin.wxss b/pages/userlogin/userlogin.wxss new file mode 100644 index 0000000..1900910 --- /dev/null +++ b/pages/userlogin/userlogin.wxss @@ -0,0 +1,209 @@ +/* ========== 页面容器 ========== */ +.userlogin { + width: 100%; + min-height: 100vh; + background: #ffffff url('https://ndnd.duiduiedu.com/uploads/pics/phonenumber.png') no-repeat center 80px; + background-size: 100% auto; + display: flex; + flex-direction: column; + justify-content: space-between; + padding: 100rpx 60rpx 80rpx; + box-sizing: border-box; + position: relative; + overflow: hidden; +} + +/* ========== 顶部 Logo 和标题区域 ========== */ +.login-header { + position: relative; + z-index: 1; + text-align: center; + animation: fadeInDown 0.8s ease-out; +} + +.logo-container { + width: 160rpx; + height: 160rpx; + margin: 0 auto 40rpx; + background: #ffffff; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.08); + animation: scaleIn 0.6s ease-out; +} + +.logo { + width: 100rpx; + height: 100rpx; +} + +.app-title { + font-size: 56rpx; + font-weight: bold; + color: #333333; + margin-bottom: 20rpx; + letter-spacing: 4rpx; + text-shadow: 0 2rpx 8rpx rgba(255, 255, 255, 0.8); +} + +.app-subtitle { + font-size: 28rpx; + color: #666666; + letter-spacing: 2rpx; +} + +/* ========== 底部登录区域 ========== */ +.login-bottom { + position: relative; + z-index: 1; + animation: fadeInUp 0.8s ease-out; +} + +/* 登录按钮包装器 */ +.login-btn-wrapper { + margin-bottom: 40rpx; +} + +.login-button { + width: 100%; + height: 96rpx; + line-height: 96rpx; + background: linear-gradient(to right, #1ccfd6, #17b3b8); + color: #ffffff; + border: none; + border-radius: 48rpx; + box-shadow: 0 10rpx 30rpx rgba(28, 207, 214, 0.3); + font-size: 32rpx; + font-weight: 500; + display: flex; + align-items: center; + justify-content: center; + gap: 10rpx; +} + +.login-button::after { + border: none; +} + +/* 协议勾选区域 */ +.agreement-check { + display: flex; + justify-content: center; + align-items: center; +} + +.agreement-text { + font-size: 24rpx; + color: #666666; +} + +.agreement-link { + font-size: 24rpx; + color: #1ccfd6; + text-decoration: none; + font-weight: 500; + cursor: pointer; +} + +/* 协议弹窗内容 */ +.usercontian { + height: 750rpx; + overflow-y: scroll; + padding: 30rpx 40rpx; + font-size: 28rpx; + line-height: 1.8; + color: #333; + word-break: break-all; +} + +.usercontian text { + display: block; + text-align: justify; +} + +/* 协议段落标题 */ +.agreement-title { + font-size: 32rpx; + font-weight: bold; + color: #1ccfd6; + margin: 30rpx 0 20rpx; + line-height: 1.5; +} + +.agreement-item { + margin: 20rpx 0; + padding-left: 20rpx; + line-height: 1.8; +} + +/* ========== 动画效果 ========== */ +@keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(60rpx); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes fadeInDown { + from { + opacity: 0; + transform: translateY(-60rpx); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes scaleIn { + from { + opacity: 0; + transform: scale(0.8); + } + to { + opacity: 1; + transform: scale(1); + } +} + +@keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +/* ========== 响应式设计 ========== */ +@media (max-height: 600px) { + .userlogin { + padding: 60rpx 60rpx 50rpx; + } + + .logo-container { + width: 120rpx; + height: 120rpx; + margin-bottom: 30rpx; + } + + .logo { + width: 80rpx; + height: 80rpx; + } + + .app-title { + font-size: 48rpx; + } + + .login-button { + height: 88rpx; + line-height: 88rpx; + } +} \ No newline at end of file diff --git a/pages/vipmonth/vipmonth.js b/pages/vipmonth/vipmonth.js new file mode 100644 index 0000000..e43a411 --- /dev/null +++ b/pages/vipmonth/vipmonth.js @@ -0,0 +1,139 @@ +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + pareid: 0, + listdata: [], + liveclickopen: 2, + baseurl: Apps.globalData.baseimgurl, + coursename: '', + vipsmonth_id: 1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options); + this.setData({ + pareid: options.id, + vipsmonth_id: options.vipsmonth_id + }); + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + Apps.islogin(); + this.getvipmonthcourse(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + getvipmonthcourse: function () { + const that = this; + let url = Apps.globalData.baseUrl + '/vip/getvipmonthcourselist'; + var param = { + id: that.data.pareid, + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + listdata: res.data, + coursename: res.data[0]['parentname'] + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + payorderclick: function (params) { + + let vipsmonth = params.currentTarget.dataset.vipsmonth; + const that = this; + let url = Apps.globalData.baseUrl + '/wxpay/makerorder'; + var param = { + id: params.currentTarget.id, + openid: wx.getStorageSync('wxopenid'), + paytypeid: 2, //会员卡充值 + user_id: wx.getStorageSync('wxuserid') == null ? 3 : wx.getStorageSync('wxuserid'), + vipsmonth: vipsmonth + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + var rest = res; + // var orders = res.data.orders; + // 调用支付接口开始 + wx.requestPayment({ + timeStamp: rest.timeStamp, + nonceStr: rest.nonceStr, + package: rest.package, + signType: rest.signType, + paySign: rest.paySign, + success: function (res) { + Toast('VIP充值成功'); + }, + fail: function (res) { + console.log(res) + }, + complete: function (res) { + console.log(res) + }, + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + +}) \ No newline at end of file diff --git a/pages/vipmonth/vipmonth.json b/pages/vipmonth/vipmonth.json new file mode 100644 index 0000000..e6513cf --- /dev/null +++ b/pages/vipmonth/vipmonth.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "课程会员卡" +} \ No newline at end of file diff --git a/pages/vipmonth/vipmonth.wxml b/pages/vipmonth/vipmonth.wxml new file mode 100644 index 0000000..1e64d0f --- /dev/null +++ b/pages/vipmonth/vipmonth.wxml @@ -0,0 +1,24 @@ + + + {{coursename}} + + + + + + + + + {{itemwlmcchina.name}} + + + {{itemwlmcchina.prices}} + + + + + + + + + \ No newline at end of file diff --git a/pages/vipmonth/vipmonth.wxss b/pages/vipmonth/vipmonth.wxss new file mode 100644 index 0000000..877520a --- /dev/null +++ b/pages/vipmonth/vipmonth.wxss @@ -0,0 +1,126 @@ +.itemlist { + background: url('https://ndnd.duiduiedu.com/uploads/pics/kecheng001.png') no-repeat; + width: 750rpx; + height: 50rpx; + line-height: 50rpx; + background-size: cover; + display: flex; + flex-direction: row-reverse; + margin-top: 50rpx; + } + + .itemlist text { + + margin-right: 180rpx; + color: white; + } + + .collectionitems { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 35rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistred.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + + .collectionitems2 { + width: 680rpx; + height: 100rpx; + margin: 0 auto; + margin-top: 35rpx; + background: url('https://ndnd.duiduiedu.com/uploads/pics/itemlistblue.png') no-repeat; + background-size: cover; + + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + + .item1 { + width: 60%; + } + + .item1 text { + width: 30%; + margin-left: 65rpx; + color: black; + font-size: 30rpx; + } + + .item2 { + width: 10%; + text-align: right; + } + + .item2 text { + color: black; + font-size: 30rpx; + } + + .item3 { + width: 20%; + text-align: center; + } + + .item3 image { + width: 28rpx; + height: 16rpx; + margin-right: 50rpx; + } + + .itemsup{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + } + + .itemsup2{ + width: 620rpx; + height: 62rpx; + background-color: #dfe2e2; + margin-left: 50rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + display: none; + } + + .upitem1{ + + width: 107rpx; + height: 45rpx; + margin-left: 30rpx; + } + + .upitem1 text{ + + margin-left: 40rpx; + font-size: 28rpx; + } + .upitem2{ + width: 70%; + } + .upitem2 text{ + margin-left: 32rpx; + font-size: 28rpx; + } + .upitem3{ + margin-right: 37rpx; + } + .upitem3 image{ + width: 12rpx; + height: 26rpx; + } \ No newline at end of file diff --git a/pages/vipquanyi/vipquanyi.js b/pages/vipquanyi/vipquanyi.js new file mode 100644 index 0000000..5ac290a --- /dev/null +++ b/pages/vipquanyi/vipquanyi.js @@ -0,0 +1,143 @@ +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + listdata: [], + baseurl: Apps.globalData.baseimgurl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + Apps.islogin(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getviplist(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + vipclick: function () { + wx.navigateTo({ + url: '/pages/viprecharge/viprecharge', + }) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + payorderclick: function (params) { + // console.log(baseUrl.globalData.wxopenid); + // console.log(params.currentTarget.id); + // return; + Apps.islogin(); + const that = this; + let url = Apps.globalData.baseUrl + '/wxpay/makerorder'; + var param = { + id: params.currentTarget.id, + openid: wx.getStorageSync('wxopenid'), + paytypeid: 1, //会员充值 + user_id: wx.getStorageSync('wxuserid') == null ? 3 : wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + // that.setData({ + // listdata: res.data + // }); + + console.log(res); + var rest = res; + // var orders = res.data.orders; + // 调用支付接口开始 + wx.requestPayment({ + timeStamp: rest.timeStamp, + nonceStr: rest.nonceStr, + package: rest.package, + signType: rest.signType, + paySign: rest.paySign, + success: function (res) { + console.log(res); + + Toast('怼币充值成功'); + // wx.navigateTo({ + // url: '/pages/goodlist/goodlist?orders=' + orders, + // }) + }, + fail: function (res) { + console.log(res) + }, + complete: function (res) { + console.log(res) + }, + }) + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + getviplist: function (params) { + const that = this; + let url = Apps.globalData.baseUrl + '/vip/getviplist'; + var param = { + id: '123456789' + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/vipquanyi/vipquanyi.json b/pages/vipquanyi/vipquanyi.json new file mode 100644 index 0000000..195f5a3 --- /dev/null +++ b/pages/vipquanyi/vipquanyi.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "怼币充值" +} \ No newline at end of file diff --git a/pages/vipquanyi/vipquanyi.wxml b/pages/vipquanyi/vipquanyi.wxml new file mode 100644 index 0000000..b343056 --- /dev/null +++ b/pages/vipquanyi/vipquanyi.wxml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pages/vipquanyi/vipquanyi.wxss b/pages/vipquanyi/vipquanyi.wxss new file mode 100644 index 0000000..73a6aac --- /dev/null +++ b/pages/vipquanyi/vipquanyi.wxss @@ -0,0 +1,45 @@ +/* VIP头部 */ +.viphead{ + + width: 100%; + height: 80rpx; + margin: 0 auto; +} +.viphead image{ + width: 100%; + height: 80rpx; +} +/* VIP头部 */ + +/* 中间部分 */ +.vipmiddle{ + + width: 100%; + height: 81rpx; + margin: 0 auto; + margin-top: 25rpx; + margin-bottom: 280rpx; +} +.vipmiddle image{ + + width: 100%; + height: 81rpx; + margin: 0 auto; +} +/* 中间部分 */ + +/* 月卡图片 */ +.vipimages{ + + width:600rpx; + height: 172rpx; + margin: 0 auto; + margin-top: 25rpx; + +} +.vipimages image{ + + width:600rpx; + height: 172rpx; +} +/* 月卡图片 */ \ No newline at end of file diff --git a/pages/viprecharge/viprecharge.js b/pages/viprecharge/viprecharge.js new file mode 100644 index 0000000..1e04881 --- /dev/null +++ b/pages/viprecharge/viprecharge.js @@ -0,0 +1,115 @@ +const Apps = getApp(); +const api = require('../../config/api.js'); +const util = require('../../config/util.js'); +import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + listdata:[], + baseurl:Apps.globalData.baseimgurl, + viplist:[] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + Apps.islogin(); + this.getvipsmonth(); + this.vipkechengdays(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + getvipsmonth:function(params) { + const that = this; + let url = Apps.globalData.baseUrl + '/vip/getvipmonthlist'; + var param = { + id: params + }; + //此处为使用封装的post请求 + util.get(url, param).then((res) => { + console.log(res); + that.setData({ + listdata: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + }, + vipmonthclick:function(params) { + console.log(params); + wx.navigateTo({ + url: '/pages/vipmonth/vipmonth?id='+params.currentTarget.id, + }) + }, + vipkechengdays:function() { + //得到用户VIP课程天数 + const that = this; + let url = Apps.globalData.baseUrl + '/vip/displayvipdata'; + var param = { + user_id: wx.getStorageSync('wxuserid') + }; + //此处为使用封装的post请求 + util.post(url, param).then((res) => { + console.log(res); + that.setData({ + viplist: res.data + }); + + }).catch((errMsg) => { + console.log(errMsg); + }); + } +}) \ No newline at end of file diff --git a/pages/viprecharge/viprecharge.json b/pages/viprecharge/viprecharge.json new file mode 100644 index 0000000..440a1cb --- /dev/null +++ b/pages/viprecharge/viprecharge.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "VIP充值" +} \ No newline at end of file diff --git a/pages/viprecharge/viprecharge.wxml b/pages/viprecharge/viprecharge.wxml new file mode 100644 index 0000000..623ce64 --- /dev/null +++ b/pages/viprecharge/viprecharge.wxml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/pages/viprecharge/viprecharge.wxss b/pages/viprecharge/viprecharge.wxss new file mode 100644 index 0000000..2c06a67 --- /dev/null +++ b/pages/viprecharge/viprecharge.wxss @@ -0,0 +1,41 @@ +/* VIP头部 */ +.viphead{ + + width: 680rpx; + height: 310rpx; + margin: 0 auto; + margin-bottom: 40rpx; +} +.viphead image{ + width: 680rpx; + height: 310rpx; +} +/* VIP头部 */ + +.vipmiddle{ + margin-top: 0rpx; +} + +/* 月卡图片 */ +.vipimages{ + + width:600rpx; + height: 172rpx; + margin: 10rpx auto; + margin-bottom: 25rpx; + +} +.vipimages image{ + + width:600rpx; + height: 172rpx; +} +/* 月卡图片 */ + +.vipdays{ + margin: 0 auto; + width:600rpx; + margin-bottom: 45rpx; + padding-bottom: 30rpx; + +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..56bf628 --- /dev/null +++ b/project.config.json @@ -0,0 +1,79 @@ +{ + "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "preloadBackgroundData": false, + "minified": true, + "newFeature": false, + "coverView": true, + "nodeModules": true, + "autoAudits": false, + "showShadowRootInWxmlPanel": true, + "scopeDataCheck": false, + "uglifyFileName": false, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "compileHotReLoad": true, + "lazyloadPlaceholderEnable": false, + "useMultiFrameRuntime": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "useIsolateContext": false, + "userConfirmedBundleSwitch": false, + "packNpmManually": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "disableUseStrict": false, + "minifyWXML": true, + "showES6CompileOption": false, + "useCompilerPlugins": false, + "ignoreUploadUnusedFiles": true, + "useStaticServer": true, + "localPlugins": false, + "condition": false, + "useApiHook": false, + "useApiHostProcess": false, + "compileWorklet": false, + "swc": false, + "disableSWC": true + }, + "compileType": "miniprogram", + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + }, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 4 + }, + "appid": "wx583d78cc00f29dc1", + "packOptions": { + "ignore": [], + "include": [] + }, + "libVersion": "3.10.2", + "simulatorPluginLibVersion": {} +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..d13a538 --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,25 @@ +{ + "setting": { + "preloadBackgroundData": false, + "compileHotReLoad": true, + "urlCheck": false, + "coverView": true, + "lazyloadPlaceholderEnable": false, + "skylineRenderEnable": false, + "autoAudits": false, + "useApiHook": false, + "useApiHostProcess": false, + "showShadowRootInWxmlPanel": true, + "useStaticServer": true, + "useLanDebug": false, + "showES6CompileOption": false, + "checkInvalidKey": true, + "ignoreDevUnusedFiles": true, + "bigPackageSizeSupport": false, + "useIsolateContext": false + }, + "condition": {}, + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "libVersion": "3.10.2", + "projectname": "ndnd" +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/utils/oss.js b/utils/oss.js new file mode 100644 index 0000000..066380c --- /dev/null +++ b/utils/oss.js @@ -0,0 +1,102 @@ +// 阿里云直传工具 +import apiConfig from '../config/api_config.js'; +import request from './request.js'; + +function requestOssSignature(dir) { + // 使用 Fiber 后端的接口 + const dirParam = dir || 'camp'; + return request({ + url: `/oss/upload/signature?dir=${encodeURIComponent(dirParam)}`, + method: 'GET' + }).then(function(res) { + // Fiber 后端直接返回凭证数据(JSON格式),兼容可能的包裹格式 + // 如果返回 { success: true, data: {...} },则提取 data;否则直接使用 res + if (res && res.success === true && res.data) { + return res.data; + } + // 直接返回数据(Fiber 后端直接返回 PolicyToken 结构) + return res; + }).catch(function(err) { + console.error('获取OSS上传凭证失败:', err); + return null; + }); +} + +function normalizeSignature(raw) { + if (!raw) return null; + // Fiber 后端直接返回凭证数据,兼容旧格式 { success, data } 或直接返回 + var data = raw.data || raw; + // 常见字段名兼容 + var host = data.host || data.endpoint || ''; + var dir = data.dir || data.prefix || ''; + var policy = data.policy; + var signature = data.signature; + + // v4 字段(表单直传)- Fiber 后端使用这些字段名 + var sigVer = data.x_oss_signature_version || data['x-oss-signature-version'] || data.signature_version || data.SignatureVersion; + var credential = data.x_oss_credential || data['x-oss-credential'] || data.credential || data.Credential; + var date = data.x_oss_date || data['x-oss-date'] || data.date || data.Date; + var securityToken = data.security_token || data['x-oss-security-token'] || data.SecurityToken || data.securityToken; + + // v2 兼容字段(旧接口可能使用) + var accessId = data.accessid || data.accessKeyId || data.OSSAccessKeyId || data.accessId; + + if (!host || !policy || !signature) return null; + + // Fiber 后端使用 v4 签名,返回 v4 所需字段 + if (sigVer) { + return { + host: host, + dir: dir, + policy: policy, + signature: signature, + signatureVersion: sigVer, + credential: credential, + date: date, + securityToken: securityToken + }; + } + + // v2 兼容(旧接口) + if (!accessId) return null; + return { host: host, dir: dir, accessId: accessId, policy: policy, signature: signature }; +} + +function buildOssKey(options) { + var now = new Date(); + function pad(n){ return n < 10 ? ('0'+n) : ''+n; } + var y = now.getFullYear(); + var m = pad(now.getMonth()+1); + var d = pad(now.getDate()); + var h = pad(now.getHours()); + var mm = pad(now.getMinutes()); + var s = pad(now.getSeconds()); + var ts = now.getTime(); + + var userId = String(options.userId || 'anonymous'); + var taskId = String(options.taskId || 'unknown'); + var baseDir = options.baseDir || 'camp'; + var subDir = options.subDir || 'subjective'; + var ext = options.ext || 'jpg'; + + return [ + baseDir, + 'user_'+userId, + subDir, + taskId, + ''+y+m+d, + ts+'_'+Math.floor(Math.random()*100000)+'.'+ext + ].join('/'); +} + +async function getOssConfig(dir) { + var raw = await requestOssSignature(dir || 'camp'); + return normalizeSignature(raw); +} + +module.exports = { + getOssConfig, + buildOssKey +}; + + diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..497bd7c --- /dev/null +++ b/utils/request.js @@ -0,0 +1,95 @@ +import apiConfig from '../config/api_config.js'; + + const request = (options) => { + return new Promise((resolve, reject) => { + const app = getApp(); + // 使用统一的域名配置 + const baseURL = apiConfig.fiberApiBaseURL; + + // 获取token + const token = wx.getStorageSync('token'); + + // 构建请求头 + const header = { + 'Content-Type': 'application/json', + ...options.header + }; + + // 如果有token,添加到header + if (token) { + header.Authorization = `Bearer ${token}`; + } + + wx.request({ + url: `${baseURL}${options.url}`, + method: options.method || 'GET', + data: options.data, + header: header, + success: (res) => { + // 首先检查是否是401错误 + if (res.statusCode === 401 || res.data.code === 401) { + // 清除登录信息 + wx.removeStorageSync('token'); + wx.removeStorageSync('userInfo'); + // 立即跳转到登录页 + wx.reLaunch({ + url: '/pages/login/index' + }); + reject(res.data); + return; + } + + // 处理其他状态码 + if (res.statusCode === 200) { + // 支持两种响应格式: + // 1. { code: 200, data: {...} } - 旧格式 + // 2. { success: true, ... } - 新格式 + // 3. 直接返回数据对象(如 OSS 凭证接口) + + // 检查是否是直接返回数据的接口(如 OSS 凭证接口) + const isDirectDataResponse = options.url && ( + options.url.includes('/oss/upload/signature') + ); + + // 如果是直接返回数据的接口,直接 resolve + if (isDirectDataResponse) { + resolve(res.data); + return; + } + + if (res.data.code === 200 || res.data.success === true) { + resolve(res.data); + } else { + // 检查是否是获取进度接口,如果是则不显示错误提示(没有进度是正常情况) + const isProgressInfo = options.url && options.url.includes('/camp/progress/info'); + if (!isProgressInfo) { + // 其他业务错误才显示提示 + wx.showToast({ + title: res.data.message || '请求失败', + icon: 'none' + }); + } + // 无论是否显示提示,都 resolve,让调用方自己处理 + resolve(res.data); + } + } else { + // HTTP 状态码错误 + wx.showToast({ + title: '服务器错误', + icon: 'none' + }); + reject(res); + } + }, + fail: (err) => { + wx.showToast({ + title: '网络错误', + icon: 'none' + }); + reject(err); + } + }); + }); +}; + +export default request; \ No newline at end of file diff --git a/utils/util.js b/utils/util.js new file mode 100644 index 0000000..0984e55 --- /dev/null +++ b/utils/util.js @@ -0,0 +1,28 @@ +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` +} + +const formatDate = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + + return `${[year, month, day].map(formatNumber).join('/')}` +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : `0${n}` +} + +module.exports = { + formatTime, + formatDate +} diff --git a/wxParse/emojis/00.gif b/wxParse/emojis/00.gif new file mode 100644 index 0000000..5be27cb Binary files /dev/null and b/wxParse/emojis/00.gif differ diff --git a/wxParse/emojis/01.gif b/wxParse/emojis/01.gif new file mode 100644 index 0000000..a2644a9 Binary files /dev/null and b/wxParse/emojis/01.gif differ diff --git a/wxParse/emojis/02.gif b/wxParse/emojis/02.gif new file mode 100644 index 0000000..40cfda4 Binary files /dev/null and b/wxParse/emojis/02.gif differ diff --git a/wxParse/emojis/03.gif b/wxParse/emojis/03.gif new file mode 100644 index 0000000..6d6f762 Binary files /dev/null and b/wxParse/emojis/03.gif differ diff --git a/wxParse/emojis/04.gif b/wxParse/emojis/04.gif new file mode 100644 index 0000000..6ccdaa2 Binary files /dev/null and b/wxParse/emojis/04.gif differ diff --git a/wxParse/emojis/05.gif b/wxParse/emojis/05.gif new file mode 100644 index 0000000..ab0b81b Binary files /dev/null and b/wxParse/emojis/05.gif differ diff --git a/wxParse/emojis/06.gif b/wxParse/emojis/06.gif new file mode 100644 index 0000000..ceab122 Binary files /dev/null and b/wxParse/emojis/06.gif differ diff --git a/wxParse/emojis/07.gif b/wxParse/emojis/07.gif new file mode 100644 index 0000000..2f45399 Binary files /dev/null and b/wxParse/emojis/07.gif differ diff --git a/wxParse/emojis/08.gif b/wxParse/emojis/08.gif new file mode 100644 index 0000000..f6c8834 Binary files /dev/null and b/wxParse/emojis/08.gif differ diff --git a/wxParse/emojis/09.gif b/wxParse/emojis/09.gif new file mode 100644 index 0000000..c2d8450 Binary files /dev/null and b/wxParse/emojis/09.gif differ diff --git a/wxParse/emojis/10.gif b/wxParse/emojis/10.gif new file mode 100644 index 0000000..905c15b Binary files /dev/null and b/wxParse/emojis/10.gif differ diff --git a/wxParse/emojis/100.gif b/wxParse/emojis/100.gif new file mode 100644 index 0000000..92ad35d Binary files /dev/null and b/wxParse/emojis/100.gif differ diff --git a/wxParse/emojis/101.gif b/wxParse/emojis/101.gif new file mode 100644 index 0000000..1f27663 Binary files /dev/null and b/wxParse/emojis/101.gif differ diff --git a/wxParse/emojis/102.gif b/wxParse/emojis/102.gif new file mode 100644 index 0000000..748ded1 Binary files /dev/null and b/wxParse/emojis/102.gif differ diff --git a/wxParse/emojis/103.gif b/wxParse/emojis/103.gif new file mode 100644 index 0000000..be9eaa0 Binary files /dev/null and b/wxParse/emojis/103.gif differ diff --git a/wxParse/emojis/104.gif b/wxParse/emojis/104.gif new file mode 100644 index 0000000..d7c2066 Binary files /dev/null and b/wxParse/emojis/104.gif differ diff --git a/wxParse/emojis/105.gif b/wxParse/emojis/105.gif new file mode 100644 index 0000000..2f353ca Binary files /dev/null and b/wxParse/emojis/105.gif differ diff --git a/wxParse/emojis/106.gif b/wxParse/emojis/106.gif new file mode 100644 index 0000000..5193534 Binary files /dev/null and b/wxParse/emojis/106.gif differ diff --git a/wxParse/emojis/107.gif b/wxParse/emojis/107.gif new file mode 100644 index 0000000..70d38d3 Binary files /dev/null and b/wxParse/emojis/107.gif differ diff --git a/wxParse/emojis/108.gif b/wxParse/emojis/108.gif new file mode 100644 index 0000000..749d500 Binary files /dev/null and b/wxParse/emojis/108.gif differ diff --git a/wxParse/emojis/109.gif b/wxParse/emojis/109.gif new file mode 100644 index 0000000..6f57d56 Binary files /dev/null and b/wxParse/emojis/109.gif differ diff --git a/wxParse/emojis/11.gif b/wxParse/emojis/11.gif new file mode 100644 index 0000000..b512dd5 Binary files /dev/null and b/wxParse/emojis/11.gif differ diff --git a/wxParse/emojis/110.gif b/wxParse/emojis/110.gif new file mode 100644 index 0000000..e253abc Binary files /dev/null and b/wxParse/emojis/110.gif differ diff --git a/wxParse/emojis/111.gif b/wxParse/emojis/111.gif new file mode 100644 index 0000000..0c56723 Binary files /dev/null and b/wxParse/emojis/111.gif differ diff --git a/wxParse/emojis/112.gif b/wxParse/emojis/112.gif new file mode 100644 index 0000000..c8ddce8 Binary files /dev/null and b/wxParse/emojis/112.gif differ diff --git a/wxParse/emojis/113.gif b/wxParse/emojis/113.gif new file mode 100644 index 0000000..2727104 Binary files /dev/null and b/wxParse/emojis/113.gif differ diff --git a/wxParse/emojis/114.gif b/wxParse/emojis/114.gif new file mode 100644 index 0000000..53918e2 Binary files /dev/null and b/wxParse/emojis/114.gif differ diff --git a/wxParse/emojis/115.gif b/wxParse/emojis/115.gif new file mode 100644 index 0000000..4db3369 Binary files /dev/null and b/wxParse/emojis/115.gif differ diff --git a/wxParse/emojis/116.gif b/wxParse/emojis/116.gif new file mode 100644 index 0000000..57326bd Binary files /dev/null and b/wxParse/emojis/116.gif differ diff --git a/wxParse/emojis/117.gif b/wxParse/emojis/117.gif new file mode 100644 index 0000000..14611b6 Binary files /dev/null and b/wxParse/emojis/117.gif differ diff --git a/wxParse/emojis/118.gif b/wxParse/emojis/118.gif new file mode 100644 index 0000000..8c25500 Binary files /dev/null and b/wxParse/emojis/118.gif differ diff --git a/wxParse/emojis/119.gif b/wxParse/emojis/119.gif new file mode 100644 index 0000000..65bb468 Binary files /dev/null and b/wxParse/emojis/119.gif differ diff --git a/wxParse/emojis/12.gif b/wxParse/emojis/12.gif new file mode 100644 index 0000000..547529c Binary files /dev/null and b/wxParse/emojis/12.gif differ diff --git a/wxParse/emojis/120.gif b/wxParse/emojis/120.gif new file mode 100644 index 0000000..5ce77c0 Binary files /dev/null and b/wxParse/emojis/120.gif differ diff --git a/wxParse/emojis/121.gif b/wxParse/emojis/121.gif new file mode 100644 index 0000000..a021aba Binary files /dev/null and b/wxParse/emojis/121.gif differ diff --git a/wxParse/emojis/122.gif b/wxParse/emojis/122.gif new file mode 100644 index 0000000..9a79e11 Binary files /dev/null and b/wxParse/emojis/122.gif differ diff --git a/wxParse/emojis/123.gif b/wxParse/emojis/123.gif new file mode 100644 index 0000000..b9480be Binary files /dev/null and b/wxParse/emojis/123.gif differ diff --git a/wxParse/emojis/124.gif b/wxParse/emojis/124.gif new file mode 100644 index 0000000..7fed477 Binary files /dev/null and b/wxParse/emojis/124.gif differ diff --git a/wxParse/emojis/125.gif b/wxParse/emojis/125.gif new file mode 100644 index 0000000..e2c3c11 Binary files /dev/null and b/wxParse/emojis/125.gif differ diff --git a/wxParse/emojis/126.gif b/wxParse/emojis/126.gif new file mode 100644 index 0000000..24105c9 Binary files /dev/null and b/wxParse/emojis/126.gif differ diff --git a/wxParse/emojis/127.gif b/wxParse/emojis/127.gif new file mode 100644 index 0000000..0cead36 Binary files /dev/null and b/wxParse/emojis/127.gif differ diff --git a/wxParse/emojis/128.gif b/wxParse/emojis/128.gif new file mode 100644 index 0000000..3185861 Binary files /dev/null and b/wxParse/emojis/128.gif differ diff --git a/wxParse/emojis/129.gif b/wxParse/emojis/129.gif new file mode 100644 index 0000000..ffd7c6b Binary files /dev/null and b/wxParse/emojis/129.gif differ diff --git a/wxParse/emojis/13.gif b/wxParse/emojis/13.gif new file mode 100644 index 0000000..3475300 Binary files /dev/null and b/wxParse/emojis/13.gif differ diff --git a/wxParse/emojis/130.gif b/wxParse/emojis/130.gif new file mode 100644 index 0000000..d828e3d Binary files /dev/null and b/wxParse/emojis/130.gif differ diff --git a/wxParse/emojis/131.gif b/wxParse/emojis/131.gif new file mode 100644 index 0000000..dcb096f Binary files /dev/null and b/wxParse/emojis/131.gif differ diff --git a/wxParse/emojis/132.gif b/wxParse/emojis/132.gif new file mode 100644 index 0000000..1b272a6 Binary files /dev/null and b/wxParse/emojis/132.gif differ diff --git a/wxParse/emojis/133.gif b/wxParse/emojis/133.gif new file mode 100644 index 0000000..0d0e864 Binary files /dev/null and b/wxParse/emojis/133.gif differ diff --git a/wxParse/emojis/134.gif b/wxParse/emojis/134.gif new file mode 100644 index 0000000..cf48356 Binary files /dev/null and b/wxParse/emojis/134.gif differ diff --git a/wxParse/emojis/14.gif b/wxParse/emojis/14.gif new file mode 100644 index 0000000..6a788f8 Binary files /dev/null and b/wxParse/emojis/14.gif differ diff --git a/wxParse/emojis/15.gif b/wxParse/emojis/15.gif new file mode 100644 index 0000000..debab8e Binary files /dev/null and b/wxParse/emojis/15.gif differ diff --git a/wxParse/emojis/16.gif b/wxParse/emojis/16.gif new file mode 100644 index 0000000..ed5d29f Binary files /dev/null and b/wxParse/emojis/16.gif differ diff --git a/wxParse/emojis/17.gif b/wxParse/emojis/17.gif new file mode 100644 index 0000000..85886fe Binary files /dev/null and b/wxParse/emojis/17.gif differ diff --git a/wxParse/emojis/18.gif b/wxParse/emojis/18.gif new file mode 100644 index 0000000..b6af218 Binary files /dev/null and b/wxParse/emojis/18.gif differ diff --git a/wxParse/emojis/19.gif b/wxParse/emojis/19.gif new file mode 100644 index 0000000..e045ff2 Binary files /dev/null and b/wxParse/emojis/19.gif differ diff --git a/wxParse/emojis/20.gif b/wxParse/emojis/20.gif new file mode 100644 index 0000000..efd650f Binary files /dev/null and b/wxParse/emojis/20.gif differ diff --git a/wxParse/emojis/21.gif b/wxParse/emojis/21.gif new file mode 100644 index 0000000..cb8cf6d Binary files /dev/null and b/wxParse/emojis/21.gif differ diff --git a/wxParse/emojis/22.gif b/wxParse/emojis/22.gif new file mode 100644 index 0000000..96b04df Binary files /dev/null and b/wxParse/emojis/22.gif differ diff --git a/wxParse/emojis/23.gif b/wxParse/emojis/23.gif new file mode 100644 index 0000000..96516b8 Binary files /dev/null and b/wxParse/emojis/23.gif differ diff --git a/wxParse/emojis/24.gif b/wxParse/emojis/24.gif new file mode 100644 index 0000000..5f925c7 Binary files /dev/null and b/wxParse/emojis/24.gif differ diff --git a/wxParse/emojis/25.gif b/wxParse/emojis/25.gif new file mode 100644 index 0000000..97f8b1a Binary files /dev/null and b/wxParse/emojis/25.gif differ diff --git a/wxParse/emojis/26.gif b/wxParse/emojis/26.gif new file mode 100644 index 0000000..a7cded7 Binary files /dev/null and b/wxParse/emojis/26.gif differ diff --git a/wxParse/emojis/27.gif b/wxParse/emojis/27.gif new file mode 100644 index 0000000..bb46890 Binary files /dev/null and b/wxParse/emojis/27.gif differ diff --git a/wxParse/emojis/28.gif b/wxParse/emojis/28.gif new file mode 100644 index 0000000..f59dd58 Binary files /dev/null and b/wxParse/emojis/28.gif differ diff --git a/wxParse/emojis/29.gif b/wxParse/emojis/29.gif new file mode 100644 index 0000000..3c5227e Binary files /dev/null and b/wxParse/emojis/29.gif differ diff --git a/wxParse/emojis/30.gif b/wxParse/emojis/30.gif new file mode 100644 index 0000000..e24a180 Binary files /dev/null and b/wxParse/emojis/30.gif differ diff --git a/wxParse/emojis/31.gif b/wxParse/emojis/31.gif new file mode 100644 index 0000000..073e743 Binary files /dev/null and b/wxParse/emojis/31.gif differ diff --git a/wxParse/emojis/32.gif b/wxParse/emojis/32.gif new file mode 100644 index 0000000..772eff2 Binary files /dev/null and b/wxParse/emojis/32.gif differ diff --git a/wxParse/emojis/33.gif b/wxParse/emojis/33.gif new file mode 100644 index 0000000..217c1c5 Binary files /dev/null and b/wxParse/emojis/33.gif differ diff --git a/wxParse/emojis/34.gif b/wxParse/emojis/34.gif new file mode 100644 index 0000000..e9d4213 Binary files /dev/null and b/wxParse/emojis/34.gif differ diff --git a/wxParse/emojis/35.gif b/wxParse/emojis/35.gif new file mode 100644 index 0000000..d6da2c3 Binary files /dev/null and b/wxParse/emojis/35.gif differ diff --git a/wxParse/emojis/36.gif b/wxParse/emojis/36.gif new file mode 100644 index 0000000..c1e6ac9 Binary files /dev/null and b/wxParse/emojis/36.gif differ diff --git a/wxParse/emojis/37.gif b/wxParse/emojis/37.gif new file mode 100644 index 0000000..92efec6 Binary files /dev/null and b/wxParse/emojis/37.gif differ diff --git a/wxParse/emojis/38.gif b/wxParse/emojis/38.gif new file mode 100644 index 0000000..489f0f9 Binary files /dev/null and b/wxParse/emojis/38.gif differ diff --git a/wxParse/emojis/39.gif b/wxParse/emojis/39.gif new file mode 100644 index 0000000..734f6d8 Binary files /dev/null and b/wxParse/emojis/39.gif differ diff --git a/wxParse/emojis/40.gif b/wxParse/emojis/40.gif new file mode 100644 index 0000000..24a8eb6 Binary files /dev/null and b/wxParse/emojis/40.gif differ diff --git a/wxParse/emojis/41.gif b/wxParse/emojis/41.gif new file mode 100644 index 0000000..99139e1 Binary files /dev/null and b/wxParse/emojis/41.gif differ diff --git a/wxParse/emojis/42.gif b/wxParse/emojis/42.gif new file mode 100644 index 0000000..f60897e Binary files /dev/null and b/wxParse/emojis/42.gif differ diff --git a/wxParse/emojis/43.gif b/wxParse/emojis/43.gif new file mode 100644 index 0000000..4350491 Binary files /dev/null and b/wxParse/emojis/43.gif differ diff --git a/wxParse/emojis/44.gif b/wxParse/emojis/44.gif new file mode 100644 index 0000000..650d3dd Binary files /dev/null and b/wxParse/emojis/44.gif differ diff --git a/wxParse/emojis/45.gif b/wxParse/emojis/45.gif new file mode 100644 index 0000000..5c8e071 Binary files /dev/null and b/wxParse/emojis/45.gif differ diff --git a/wxParse/emojis/46.gif b/wxParse/emojis/46.gif new file mode 100644 index 0000000..f3cb074 Binary files /dev/null and b/wxParse/emojis/46.gif differ diff --git a/wxParse/emojis/47.gif b/wxParse/emojis/47.gif new file mode 100644 index 0000000..5b3057a Binary files /dev/null and b/wxParse/emojis/47.gif differ diff --git a/wxParse/emojis/48.gif b/wxParse/emojis/48.gif new file mode 100644 index 0000000..27a30c1 Binary files /dev/null and b/wxParse/emojis/48.gif differ diff --git a/wxParse/emojis/49.gif b/wxParse/emojis/49.gif new file mode 100644 index 0000000..dcfa48a Binary files /dev/null and b/wxParse/emojis/49.gif differ diff --git a/wxParse/emojis/50.gif b/wxParse/emojis/50.gif new file mode 100644 index 0000000..029cf0f Binary files /dev/null and b/wxParse/emojis/50.gif differ diff --git a/wxParse/emojis/51.gif b/wxParse/emojis/51.gif new file mode 100644 index 0000000..69f183f Binary files /dev/null and b/wxParse/emojis/51.gif differ diff --git a/wxParse/emojis/52.gif b/wxParse/emojis/52.gif new file mode 100644 index 0000000..d41e8aa Binary files /dev/null and b/wxParse/emojis/52.gif differ diff --git a/wxParse/emojis/53.gif b/wxParse/emojis/53.gif new file mode 100644 index 0000000..56352dd Binary files /dev/null and b/wxParse/emojis/53.gif differ diff --git a/wxParse/emojis/54.gif b/wxParse/emojis/54.gif new file mode 100644 index 0000000..b28d848 Binary files /dev/null and b/wxParse/emojis/54.gif differ diff --git a/wxParse/emojis/55.gif b/wxParse/emojis/55.gif new file mode 100644 index 0000000..e18da84 Binary files /dev/null and b/wxParse/emojis/55.gif differ diff --git a/wxParse/emojis/56.gif b/wxParse/emojis/56.gif new file mode 100644 index 0000000..edf96f0 Binary files /dev/null and b/wxParse/emojis/56.gif differ diff --git a/wxParse/emojis/57.gif b/wxParse/emojis/57.gif new file mode 100644 index 0000000..3f0e2b9 Binary files /dev/null and b/wxParse/emojis/57.gif differ diff --git a/wxParse/emojis/58.gif b/wxParse/emojis/58.gif new file mode 100644 index 0000000..47b1aaa Binary files /dev/null and b/wxParse/emojis/58.gif differ diff --git a/wxParse/emojis/59.gif b/wxParse/emojis/59.gif new file mode 100644 index 0000000..918288b Binary files /dev/null and b/wxParse/emojis/59.gif differ diff --git a/wxParse/emojis/60.gif b/wxParse/emojis/60.gif new file mode 100644 index 0000000..66d2113 Binary files /dev/null and b/wxParse/emojis/60.gif differ diff --git a/wxParse/emojis/61.gif b/wxParse/emojis/61.gif new file mode 100644 index 0000000..034933e Binary files /dev/null and b/wxParse/emojis/61.gif differ diff --git a/wxParse/emojis/62.gif b/wxParse/emojis/62.gif new file mode 100644 index 0000000..8d5c4fd Binary files /dev/null and b/wxParse/emojis/62.gif differ diff --git a/wxParse/emojis/63.gif b/wxParse/emojis/63.gif new file mode 100644 index 0000000..d58fcf6 Binary files /dev/null and b/wxParse/emojis/63.gif differ diff --git a/wxParse/emojis/64.gif b/wxParse/emojis/64.gif new file mode 100644 index 0000000..c4e00bd Binary files /dev/null and b/wxParse/emojis/64.gif differ diff --git a/wxParse/emojis/65.gif b/wxParse/emojis/65.gif new file mode 100644 index 0000000..da23bfa Binary files /dev/null and b/wxParse/emojis/65.gif differ diff --git a/wxParse/emojis/66.gif b/wxParse/emojis/66.gif new file mode 100644 index 0000000..310ec65 Binary files /dev/null and b/wxParse/emojis/66.gif differ diff --git a/wxParse/emojis/67.gif b/wxParse/emojis/67.gif new file mode 100644 index 0000000..51761ba Binary files /dev/null and b/wxParse/emojis/67.gif differ diff --git a/wxParse/emojis/68.gif b/wxParse/emojis/68.gif new file mode 100644 index 0000000..345cb43 Binary files /dev/null and b/wxParse/emojis/68.gif differ diff --git a/wxParse/emojis/69.gif b/wxParse/emojis/69.gif new file mode 100644 index 0000000..e0f28a0 Binary files /dev/null and b/wxParse/emojis/69.gif differ diff --git a/wxParse/emojis/70.gif b/wxParse/emojis/70.gif new file mode 100644 index 0000000..24284cf Binary files /dev/null and b/wxParse/emojis/70.gif differ diff --git a/wxParse/emojis/71.gif b/wxParse/emojis/71.gif new file mode 100644 index 0000000..a0ccf2e Binary files /dev/null and b/wxParse/emojis/71.gif differ diff --git a/wxParse/emojis/72.gif b/wxParse/emojis/72.gif new file mode 100644 index 0000000..7e113ee Binary files /dev/null and b/wxParse/emojis/72.gif differ diff --git a/wxParse/emojis/73.gif b/wxParse/emojis/73.gif new file mode 100644 index 0000000..c0293c3 Binary files /dev/null and b/wxParse/emojis/73.gif differ diff --git a/wxParse/emojis/74.gif b/wxParse/emojis/74.gif new file mode 100644 index 0000000..1c52bde Binary files /dev/null and b/wxParse/emojis/74.gif differ diff --git a/wxParse/emojis/75.gif b/wxParse/emojis/75.gif new file mode 100644 index 0000000..9cb9aa7 Binary files /dev/null and b/wxParse/emojis/75.gif differ diff --git a/wxParse/emojis/76.gif b/wxParse/emojis/76.gif new file mode 100644 index 0000000..27019f8 Binary files /dev/null and b/wxParse/emojis/76.gif differ diff --git a/wxParse/emojis/77.gif b/wxParse/emojis/77.gif new file mode 100644 index 0000000..8f882f5 Binary files /dev/null and b/wxParse/emojis/77.gif differ diff --git a/wxParse/emojis/78.gif b/wxParse/emojis/78.gif new file mode 100644 index 0000000..d0d0856 Binary files /dev/null and b/wxParse/emojis/78.gif differ diff --git a/wxParse/emojis/79.gif b/wxParse/emojis/79.gif new file mode 100644 index 0000000..61652a7 Binary files /dev/null and b/wxParse/emojis/79.gif differ diff --git a/wxParse/emojis/80.gif b/wxParse/emojis/80.gif new file mode 100644 index 0000000..9a77936 Binary files /dev/null and b/wxParse/emojis/80.gif differ diff --git a/wxParse/emojis/81.gif b/wxParse/emojis/81.gif new file mode 100644 index 0000000..2329101 Binary files /dev/null and b/wxParse/emojis/81.gif differ diff --git a/wxParse/emojis/82.gif b/wxParse/emojis/82.gif new file mode 100644 index 0000000..644748a Binary files /dev/null and b/wxParse/emojis/82.gif differ diff --git a/wxParse/emojis/83.gif b/wxParse/emojis/83.gif new file mode 100644 index 0000000..fbf275b Binary files /dev/null and b/wxParse/emojis/83.gif differ diff --git a/wxParse/emojis/84.gif b/wxParse/emojis/84.gif new file mode 100644 index 0000000..076f0c6 Binary files /dev/null and b/wxParse/emojis/84.gif differ diff --git a/wxParse/emojis/85.gif b/wxParse/emojis/85.gif new file mode 100644 index 0000000..d254af4 Binary files /dev/null and b/wxParse/emojis/85.gif differ diff --git a/wxParse/emojis/86.gif b/wxParse/emojis/86.gif new file mode 100644 index 0000000..8f09d33 Binary files /dev/null and b/wxParse/emojis/86.gif differ diff --git a/wxParse/emojis/87.gif b/wxParse/emojis/87.gif new file mode 100644 index 0000000..df70756 Binary files /dev/null and b/wxParse/emojis/87.gif differ diff --git a/wxParse/emojis/88.gif b/wxParse/emojis/88.gif new file mode 100644 index 0000000..4d8b15e Binary files /dev/null and b/wxParse/emojis/88.gif differ diff --git a/wxParse/emojis/89.gif b/wxParse/emojis/89.gif new file mode 100644 index 0000000..05726dc Binary files /dev/null and b/wxParse/emojis/89.gif differ diff --git a/wxParse/emojis/90.gif b/wxParse/emojis/90.gif new file mode 100644 index 0000000..adaf20e Binary files /dev/null and b/wxParse/emojis/90.gif differ diff --git a/wxParse/emojis/91.gif b/wxParse/emojis/91.gif new file mode 100644 index 0000000..608d0ad Binary files /dev/null and b/wxParse/emojis/91.gif differ diff --git a/wxParse/emojis/92.gif b/wxParse/emojis/92.gif new file mode 100644 index 0000000..b909e16 Binary files /dev/null and b/wxParse/emojis/92.gif differ diff --git a/wxParse/emojis/93.gif b/wxParse/emojis/93.gif new file mode 100644 index 0000000..7f71a8c Binary files /dev/null and b/wxParse/emojis/93.gif differ diff --git a/wxParse/emojis/94.gif b/wxParse/emojis/94.gif new file mode 100644 index 0000000..4f26d7d Binary files /dev/null and b/wxParse/emojis/94.gif differ diff --git a/wxParse/emojis/95.gif b/wxParse/emojis/95.gif new file mode 100644 index 0000000..5ef6d38 Binary files /dev/null and b/wxParse/emojis/95.gif differ diff --git a/wxParse/emojis/96.gif b/wxParse/emojis/96.gif new file mode 100644 index 0000000..2b709e1 Binary files /dev/null and b/wxParse/emojis/96.gif differ diff --git a/wxParse/emojis/97.gif b/wxParse/emojis/97.gif new file mode 100644 index 0000000..cf29be8 Binary files /dev/null and b/wxParse/emojis/97.gif differ diff --git a/wxParse/emojis/98.gif b/wxParse/emojis/98.gif new file mode 100644 index 0000000..c70e7d3 Binary files /dev/null and b/wxParse/emojis/98.gif differ diff --git a/wxParse/emojis/99.gif b/wxParse/emojis/99.gif new file mode 100644 index 0000000..05c1863 Binary files /dev/null and b/wxParse/emojis/99.gif differ diff --git a/wxParse/html2json.js b/wxParse/html2json.js new file mode 100644 index 0000000..7b165fa --- /dev/null +++ b/wxParse/html2json.js @@ -0,0 +1,303 @@ +/** + * html2Json 改造来自: https://github.com/Jxck/html2json + * + * + * author: Di (微信小程序开发工程师) + * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) + * 垂直微信小程序开发交流社区 + * + * github地址: https://github.com/icindy/wxParse + * + * for: 微信小程序富文本解析 + * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 + */ + +var __placeImgeUrlHttps = "https"; +var __emojisReg = ''; +var __emojisBaseSrc = ''; +var __emojis = {}; +var wxDiscode = require('./wxDiscode.js'); +var HTMLParser = require('./htmlparser.js'); +// Empty Elements - HTML 5 +var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"); +// Block Elements - HTML 5 +var block = makeMap("br,a,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"); + +// Inline Elements - HTML 5 +var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"); + +// Elements that you can, intentionally, leave open +// (and which close themselves) +var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); + +// Attributes that have their values filled in disabled="disabled" +var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"); + +// Special Elements (can contain anything) +var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block"); +function makeMap(str) { + var obj = {}, items = str.split(","); + for (var i = 0; i < items.length; i++) + obj[items[i]] = true; + return obj; +} + +function q(v) { + return '"' + v + '"'; +} + +function removeDOCTYPE(html) { + return html + .replace(/<\?xml.*\?>\n/, '') + .replace(/<.*!doctype.*\>\n/, '') + .replace(/<.*!DOCTYPE.*\>\n/, ''); +} + +function trimHtml(html) { + return html + .replace(/\r?\n+/g, '') + .replace(//ig, '') + .replace(/\/\*.*?\*\//ig, '') + .replace(/[ ]+ + // add to parents + var parent = bufArray[0] || results; + if (parent.nodes === undefined) { + parent.nodes = []; + } + parent.nodes.push(node); + } else { + bufArray.unshift(node); + } + }, + end: function (tag) { + //debug(tag); + // merge into parent tag + var node = bufArray.shift(); + if (node.tag !== tag) console.error('invalid state: mismatch end tag'); + + //当有缓存source资源时于于video补上src资源 + if(node.tag === 'video' && results.source){ + node.attr.src = results.source; + delete results.source; + } + + if (bufArray.length === 0) { + results.nodes.push(node); + } else { + var parent = bufArray[0]; + if (parent.nodes === undefined) { + parent.nodes = []; + } + parent.nodes.push(node); + } + }, + chars: function (text) { + //debug(text); + var node = { + node: 'text', + text: text, + textArray:transEmojiStr(text) + }; + + if (bufArray.length === 0) { + node.index = index.toString() + index += 1 + results.nodes.push(node); + } else { + var parent = bufArray[0]; + if (parent.nodes === undefined) { + parent.nodes = []; + } + node.index = parent.index + '.' + parent.nodes.length + parent.nodes.push(node); + } + }, + comment: function (text) { + //debug(text); + // var node = { + // node: 'comment', + // text: text, + // }; + // var parent = bufArray[0]; + // if (parent.nodes === undefined) { + // parent.nodes = []; + // } + // parent.nodes.push(node); + }, + }); + return results; +}; + +function transEmojiStr(str){ + // var eReg = new RegExp("["+__reg+' '+"]"); +// str = str.replace(/\[([^\[\]]+)\]/g,':$1:') + + var emojiObjs = []; + //如果正则表达式为空 + if(__emojisReg.length == 0 || !__emojis){ + var emojiObj = {} + emojiObj.node = "text"; + emojiObj.text = str; + array = [emojiObj]; + return array; + } + //这个地方需要调整 + str = str.replace(/\[([^\[\]]+)\]/g,':$1:') + var eReg = new RegExp("[:]"); + var array = str.split(eReg); + for(var i = 0; i < array.length; i++){ + var ele = array[i]; + var emojiObj = {}; + if(__emojis[ele]){ + emojiObj.node = "element"; + emojiObj.tag = "emoji"; + emojiObj.text = __emojis[ele]; + emojiObj.baseSrc= __emojisBaseSrc; + }else{ + emojiObj.node = "text"; + emojiObj.text = ele; + } + emojiObjs.push(emojiObj); + } + + return emojiObjs; +} + +function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){ + __emojisReg = reg; + __emojisBaseSrc=baseSrc; + __emojis=emojis; +} + +module.exports = { + html2json: html2json, + emojisInit:emojisInit +}; + diff --git a/wxParse/htmlparser.js b/wxParse/htmlparser.js new file mode 100644 index 0000000..811ddac --- /dev/null +++ b/wxParse/htmlparser.js @@ -0,0 +1,192 @@ +/** + * + * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser + * + * author: Di (微信小程序开发工程师) + * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) + * 垂直微信小程序开发交流社区 + * + * github地址: https://github.com/icindy/wxParse + * + * for: 微信小程序富文本解析 + * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 + */ +// Regular Expressions for parsing tags and attributes +var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, + endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/, + attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; + +// Empty Elements - HTML 5 +var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"); + +// Block Elements - HTML 5 +var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"); + +// Inline Elements - HTML 5 +var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"); + +// Elements that you can, intentionally, leave open +// (and which close themselves) +var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); + +// Attributes that have their values filled in disabled="disabled" +var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"); + +// Special Elements (can contain anything) +var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block"); + +function HTMLParser(html, handler) { + var index, chars, match, stack = [], last = html; + stack.last = function () { + return this[this.length - 1]; + }; + + while (html) { + chars = true; + + // Make sure we're not in a script or style element + if (!stack.last() || !special[stack.last()]) { + + // Comment + if (html.indexOf(""); + + if (index >= 0) { + if (handler.comment) + handler.comment(html.substring(4, index)); + html = html.substring(index + 3); + chars = false; + } + + // end tag + } else if (html.indexOf("]*>"), function (all, text) { + text = text.replace(/|/g, "$1$2"); + if (handler.chars) + handler.chars(text); + + return ""; + }); + + + parseEndTag("", stack.last()); + } + + if (html == last) + throw "Parse Error: " + html; + last = html; + } + + // Clean up any remaining tags + parseEndTag(); + + function parseStartTag(tag, tagName, rest, unary) { + tagName = tagName.toLowerCase(); + + if (block[tagName]) { + while (stack.last() && inline[stack.last()]) { + parseEndTag("", stack.last()); + } + } + + if (closeSelf[tagName] && stack.last() == tagName) { + parseEndTag("", tagName); + } + + unary = empty[tagName] || !!unary; + + if (!unary) + stack.push(tagName); + + if (handler.start) { + var attrs = []; + + rest.replace(attr, function (match, name) { + var value = arguments[2] ? arguments[2] : + arguments[3] ? arguments[3] : + arguments[4] ? arguments[4] : + fillAttrs[name] ? name : ""; + + attrs.push({ + name: name, + value: value, + escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //" + }); + }); + + if (handler.start) { + handler.start(tagName, attrs, unary); + } + + } + } + + function parseEndTag(tag, tagName) { + // If no tag name is provided, clean shop + if (!tagName) + var pos = 0; + + // Find the closest opened tag of the same type + else { + tagName = tagName.toLowerCase(); + for (var pos = stack.length - 1; pos >= 0; pos--) + if (stack[pos] == tagName) + break; + } + if (pos >= 0) { + // Close all the open elements, up the stack + for (var i = stack.length - 1; i >= pos; i--) + if (handler.end) + handler.end(stack[i]); + + // Remove the open elements from the stack + stack.length = pos; + } + } +}; + + +function makeMap(str) { + var obj = {}, items = str.split(","); + for (var i = 0; i < items.length; i++) + obj[items[i]] = true; + return obj; +} + +module.exports = HTMLParser; diff --git a/wxParse/showdown.js b/wxParse/showdown.js new file mode 100644 index 0000000..d29206d --- /dev/null +++ b/wxParse/showdown.js @@ -0,0 +1,2532 @@ +/** + * + * showdown: https://github.com/showdownjs/showdown + * + * author: Di (微信小程序开发工程师) + * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) + * 垂直微信小程序开发交流社区 + * + * github地址: https://github.com/icindy/wxParse + * + * for: 微信小程序富文本解析 + * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 + */ + +function getDefaultOpts(simple) { + 'use strict'; + + var defaultOptions = { + omitExtraWLInCodeBlocks: { + defaultValue: false, + describe: 'Omit the default extra whiteline added to code blocks', + type: 'boolean' + }, + noHeaderId: { + defaultValue: false, + describe: 'Turn on/off generated header id', + type: 'boolean' + }, + prefixHeaderId: { + defaultValue: false, + describe: 'Specify a prefix to generated header ids', + type: 'string' + }, + headerLevelStart: { + defaultValue: false, + describe: 'The header blocks level start', + type: 'integer' + }, + parseImgDimensions: { + defaultValue: false, + describe: 'Turn on/off image dimension parsing', + type: 'boolean' + }, + simplifiedAutoLink: { + defaultValue: false, + describe: 'Turn on/off GFM autolink style', + type: 'boolean' + }, + literalMidWordUnderscores: { + defaultValue: false, + describe: 'Parse midword underscores as literal underscores', + type: 'boolean' + }, + strikethrough: { + defaultValue: false, + describe: 'Turn on/off strikethrough support', + type: 'boolean' + }, + tables: { + defaultValue: false, + describe: 'Turn on/off tables support', + type: 'boolean' + }, + tablesHeaderId: { + defaultValue: false, + describe: 'Add an id to table headers', + type: 'boolean' + }, + ghCodeBlocks: { + defaultValue: true, + describe: 'Turn on/off GFM fenced code blocks support', + type: 'boolean' + }, + tasklists: { + defaultValue: false, + describe: 'Turn on/off GFM tasklist support', + type: 'boolean' + }, + smoothLivePreview: { + defaultValue: false, + describe: 'Prevents weird effects in live previews due to incomplete input', + type: 'boolean' + }, + smartIndentationFix: { + defaultValue: false, + description: 'Tries to smartly fix identation in es6 strings', + type: 'boolean' + } + }; + if (simple === false) { + return JSON.parse(JSON.stringify(defaultOptions)); + } + var ret = {}; + for (var opt in defaultOptions) { + if (defaultOptions.hasOwnProperty(opt)) { + ret[opt] = defaultOptions[opt].defaultValue; + } + } + return ret; +} + +/** + * Created by Tivie on 06-01-2015. + */ + +// Private properties +var showdown = {}, + parsers = {}, + extensions = {}, + globalOptions = getDefaultOpts(true), + flavor = { + github: { + omitExtraWLInCodeBlocks: true, + prefixHeaderId: 'user-content-', + simplifiedAutoLink: true, + literalMidWordUnderscores: true, + strikethrough: true, + tables: true, + tablesHeaderId: true, + ghCodeBlocks: true, + tasklists: true + }, + vanilla: getDefaultOpts(true) + }; + +/** + * helper namespace + * @type {{}} + */ +showdown.helper = {}; + +/** + * TODO LEGACY SUPPORT CODE + * @type {{}} + */ +showdown.extensions = {}; + +/** + * Set a global option + * @static + * @param {string} key + * @param {*} value + * @returns {showdown} + */ +showdown.setOption = function (key, value) { + 'use strict'; + globalOptions[key] = value; + return this; +}; + +/** + * Get a global option + * @static + * @param {string} key + * @returns {*} + */ +showdown.getOption = function (key) { + 'use strict'; + return globalOptions[key]; +}; + +/** + * Get the global options + * @static + * @returns {{}} + */ +showdown.getOptions = function () { + 'use strict'; + return globalOptions; +}; + +/** + * Reset global options to the default values + * @static + */ +showdown.resetOptions = function () { + 'use strict'; + globalOptions = getDefaultOpts(true); +}; + +/** + * Set the flavor showdown should use as default + * @param {string} name + */ +showdown.setFlavor = function (name) { + 'use strict'; + if (flavor.hasOwnProperty(name)) { + var preset = flavor[name]; + for (var option in preset) { + if (preset.hasOwnProperty(option)) { + globalOptions[option] = preset[option]; + } + } + } +}; + +/** + * Get the default options + * @static + * @param {boolean} [simple=true] + * @returns {{}} + */ +showdown.getDefaultOptions = function (simple) { + 'use strict'; + return getDefaultOpts(simple); +}; + +/** + * Get or set a subParser + * + * subParser(name) - Get a registered subParser + * subParser(name, func) - Register a subParser + * @static + * @param {string} name + * @param {function} [func] + * @returns {*} + */ +showdown.subParser = function (name, func) { + 'use strict'; + if (showdown.helper.isString(name)) { + if (typeof func !== 'undefined') { + parsers[name] = func; + } else { + if (parsers.hasOwnProperty(name)) { + return parsers[name]; + } else { + throw Error('SubParser named ' + name + ' not registered!'); + } + } + } +}; + +/** + * Gets or registers an extension + * @static + * @param {string} name + * @param {object|function=} ext + * @returns {*} + */ +showdown.extension = function (name, ext) { + 'use strict'; + + if (!showdown.helper.isString(name)) { + throw Error('Extension \'name\' must be a string'); + } + + name = showdown.helper.stdExtName(name); + + // Getter + if (showdown.helper.isUndefined(ext)) { + if (!extensions.hasOwnProperty(name)) { + throw Error('Extension named ' + name + ' is not registered!'); + } + return extensions[name]; + + // Setter + } else { + // Expand extension if it's wrapped in a function + if (typeof ext === 'function') { + ext = ext(); + } + + // Ensure extension is an array + if (!showdown.helper.isArray(ext)) { + ext = [ext]; + } + + var validExtension = validate(ext, name); + + if (validExtension.valid) { + extensions[name] = ext; + } else { + throw Error(validExtension.error); + } + } +}; + +/** + * Gets all extensions registered + * @returns {{}} + */ +showdown.getAllExtensions = function () { + 'use strict'; + return extensions; +}; + +/** + * Remove an extension + * @param {string} name + */ +showdown.removeExtension = function (name) { + 'use strict'; + delete extensions[name]; +}; + +/** + * Removes all extensions + */ +showdown.resetExtensions = function () { + 'use strict'; + extensions = {}; +}; + +/** + * Validate extension + * @param {array} extension + * @param {string} name + * @returns {{valid: boolean, error: string}} + */ +function validate(extension, name) { + 'use strict'; + + var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension', + ret = { + valid: true, + error: '' + }; + + if (!showdown.helper.isArray(extension)) { + extension = [extension]; + } + + for (var i = 0; i < extension.length; ++i) { + var baseMsg = errMsg + ' sub-extension ' + i + ': ', + ext = extension[i]; + if (typeof ext !== 'object') { + ret.valid = false; + ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given'; + return ret; + } + + if (!showdown.helper.isString(ext.type)) { + ret.valid = false; + ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given'; + return ret; + } + + var type = ext.type = ext.type.toLowerCase(); + + // normalize extension type + if (type === 'language') { + type = ext.type = 'lang'; + } + + if (type === 'html') { + type = ext.type = 'output'; + } + + if (type !== 'lang' && type !== 'output' && type !== 'listener') { + ret.valid = false; + ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"'; + return ret; + } + + if (type === 'listener') { + if (showdown.helper.isUndefined(ext.listeners)) { + ret.valid = false; + ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"'; + return ret; + } + } else { + if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) { + ret.valid = false; + ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method'; + return ret; + } + } + + if (ext.listeners) { + if (typeof ext.listeners !== 'object') { + ret.valid = false; + ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given'; + return ret; + } + for (var ln in ext.listeners) { + if (ext.listeners.hasOwnProperty(ln)) { + if (typeof ext.listeners[ln] !== 'function') { + ret.valid = false; + ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln + + ' must be a function but ' + typeof ext.listeners[ln] + ' given'; + return ret; + } + } + } + } + + if (ext.filter) { + if (typeof ext.filter !== 'function') { + ret.valid = false; + ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given'; + return ret; + } + } else if (ext.regex) { + if (showdown.helper.isString(ext.regex)) { + ext.regex = new RegExp(ext.regex, 'g'); + } + if (!ext.regex instanceof RegExp) { + ret.valid = false; + ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given'; + return ret; + } + if (showdown.helper.isUndefined(ext.replace)) { + ret.valid = false; + ret.error = baseMsg + '"regex" extensions must implement a replace string or function'; + return ret; + } + } + } + return ret; +} + +/** + * Validate extension + * @param {object} ext + * @returns {boolean} + */ +showdown.validateExtension = function (ext) { + 'use strict'; + + var validateExtension = validate(ext, null); + if (!validateExtension.valid) { + console.warn(validateExtension.error); + return false; + } + return true; +}; + +/** + * showdownjs helper functions + */ + +if (!showdown.hasOwnProperty('helper')) { + showdown.helper = {}; +} + +/** + * Check if var is string + * @static + * @param {string} a + * @returns {boolean} + */ +showdown.helper.isString = function isString(a) { + 'use strict'; + return (typeof a === 'string' || a instanceof String); +}; + +/** + * Check if var is a function + * @static + * @param {string} a + * @returns {boolean} + */ +showdown.helper.isFunction = function isFunction(a) { + 'use strict'; + var getType = {}; + return a && getType.toString.call(a) === '[object Function]'; +}; + +/** + * ForEach helper function + * @static + * @param {*} obj + * @param {function} callback + */ +showdown.helper.forEach = function forEach(obj, callback) { + 'use strict'; + if (typeof obj.forEach === 'function') { + obj.forEach(callback); + } else { + for (var i = 0; i < obj.length; i++) { + callback(obj[i], i, obj); + } + } +}; + +/** + * isArray helper function + * @static + * @param {*} a + * @returns {boolean} + */ +showdown.helper.isArray = function isArray(a) { + 'use strict'; + return a.constructor === Array; +}; + +/** + * Check if value is undefined + * @static + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + */ +showdown.helper.isUndefined = function isUndefined(value) { + 'use strict'; + return typeof value === 'undefined'; +}; + +/** + * Standardidize extension name + * @static + * @param {string} s extension name + * @returns {string} + */ +showdown.helper.stdExtName = function (s) { + 'use strict'; + return s.replace(/[_-]||\s/g, '').toLowerCase(); +}; + +function escapeCharactersCallback(wholeMatch, m1) { + 'use strict'; + var charCodeToEscape = m1.charCodeAt(0); + return '~E' + charCodeToEscape + 'E'; +} + +/** + * Callback used to escape characters when passing through String.replace + * @static + * @param {string} wholeMatch + * @param {string} m1 + * @returns {string} + */ +showdown.helper.escapeCharactersCallback = escapeCharactersCallback; + +/** + * Escape characters in a string + * @static + * @param {string} text + * @param {string} charsToEscape + * @param {boolean} afterBackslash + * @returns {XML|string|void|*} + */ +showdown.helper.escapeCharacters = function escapeCharacters(text, charsToEscape, afterBackslash) { + 'use strict'; + // First we have to escape the escape characters so that + // we can build a character class out of them + var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])'; + + if (afterBackslash) { + regexString = '\\\\' + regexString; + } + + var regex = new RegExp(regexString, 'g'); + text = text.replace(regex, escapeCharactersCallback); + + return text; +}; + +var rgxFindMatchPos = function (str, left, right, flags) { + 'use strict'; + var f = flags || '', + g = f.indexOf('g') > -1, + x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')), + l = new RegExp(left, f.replace(/g/g, '')), + pos = [], + t, s, m, start, end; + + do { + t = 0; + while ((m = x.exec(str))) { + if (l.test(m[0])) { + if (!(t++)) { + s = x.lastIndex; + start = s - m[0].length; + } + } else if (t) { + if (!--t) { + end = m.index + m[0].length; + var obj = { + left: {start: start, end: s}, + match: {start: s, end: m.index}, + right: {start: m.index, end: end}, + wholeMatch: {start: start, end: end} + }; + pos.push(obj); + if (!g) { + return pos; + } + } + } + } + } while (t && (x.lastIndex = s)); + + return pos; +}; + +/** + * matchRecursiveRegExp + * + * (c) 2007 Steven Levithan + * MIT License + * + * Accepts a string to search, a left and right format delimiter + * as regex patterns, and optional regex flags. Returns an array + * of matches, allowing nested instances of left/right delimiters. + * Use the "g" flag to return all matches, otherwise only the + * first is returned. Be careful to ensure that the left and + * right format delimiters produce mutually exclusive matches. + * Backreferences are not supported within the right delimiter + * due to how it is internally combined with the left delimiter. + * When matching strings whose format delimiters are unbalanced + * to the left or right, the output is intentionally as a + * conventional regex library with recursion support would + * produce, e.g. "<" and ">" both produce ["x"] when using + * "<" and ">" as the delimiters (both strings contain a single, + * balanced instance of ""). + * + * examples: + * matchRecursiveRegExp("test", "\\(", "\\)") + * returns: [] + * matchRecursiveRegExp(">>t<>", "<", ">", "g") + * returns: ["t<>", ""] + * matchRecursiveRegExp("
test
", "]*>", "", "gi") + * returns: ["test"] + */ +showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) { + 'use strict'; + + var matchPos = rgxFindMatchPos (str, left, right, flags), + results = []; + + for (var i = 0; i < matchPos.length; ++i) { + results.push([ + str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end), + str.slice(matchPos[i].match.start, matchPos[i].match.end), + str.slice(matchPos[i].left.start, matchPos[i].left.end), + str.slice(matchPos[i].right.start, matchPos[i].right.end) + ]); + } + return results; +}; + +/** + * + * @param {string} str + * @param {string|function} replacement + * @param {string} left + * @param {string} right + * @param {string} flags + * @returns {string} + */ +showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) { + 'use strict'; + + if (!showdown.helper.isFunction(replacement)) { + var repStr = replacement; + replacement = function () { + return repStr; + }; + } + + var matchPos = rgxFindMatchPos(str, left, right, flags), + finalStr = str, + lng = matchPos.length; + + if (lng > 0) { + var bits = []; + if (matchPos[0].wholeMatch.start !== 0) { + bits.push(str.slice(0, matchPos[0].wholeMatch.start)); + } + for (var i = 0; i < lng; ++i) { + bits.push( + replacement( + str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end), + str.slice(matchPos[i].match.start, matchPos[i].match.end), + str.slice(matchPos[i].left.start, matchPos[i].left.end), + str.slice(matchPos[i].right.start, matchPos[i].right.end) + ) + ); + if (i < lng - 1) { + bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start)); + } + } + if (matchPos[lng - 1].wholeMatch.end < str.length) { + bits.push(str.slice(matchPos[lng - 1].wholeMatch.end)); + } + finalStr = bits.join(''); + } + return finalStr; +}; + +/** + * POLYFILLS + */ +if (showdown.helper.isUndefined(console)) { + console = { + warn: function (msg) { + 'use strict'; + alert(msg); + }, + log: function (msg) { + 'use strict'; + alert(msg); + }, + error: function (msg) { + 'use strict'; + throw msg; + } + }; +} + +/** + * Created by Estevao on 31-05-2015. + */ + +/** + * Showdown Converter class + * @class + * @param {object} [converterOptions] + * @returns {Converter} + */ +showdown.Converter = function (converterOptions) { + 'use strict'; + + var + /** + * Options used by this converter + * @private + * @type {{}} + */ + options = {}, + + /** + * Language extensions used by this converter + * @private + * @type {Array} + */ + langExtensions = [], + + /** + * Output modifiers extensions used by this converter + * @private + * @type {Array} + */ + outputModifiers = [], + + /** + * Event listeners + * @private + * @type {{}} + */ + listeners = {}; + + _constructor(); + + /** + * Converter constructor + * @private + */ + function _constructor() { + converterOptions = converterOptions || {}; + + for (var gOpt in globalOptions) { + if (globalOptions.hasOwnProperty(gOpt)) { + options[gOpt] = globalOptions[gOpt]; + } + } + + // Merge options + if (typeof converterOptions === 'object') { + for (var opt in converterOptions) { + if (converterOptions.hasOwnProperty(opt)) { + options[opt] = converterOptions[opt]; + } + } + } else { + throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions + + ' was passed instead.'); + } + + if (options.extensions) { + showdown.helper.forEach(options.extensions, _parseExtension); + } + } + + /** + * Parse extension + * @param {*} ext + * @param {string} [name=''] + * @private + */ + function _parseExtension(ext, name) { + + name = name || null; + // If it's a string, the extension was previously loaded + if (showdown.helper.isString(ext)) { + ext = showdown.helper.stdExtName(ext); + name = ext; + + // LEGACY_SUPPORT CODE + if (showdown.extensions[ext]) { + console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' + + 'Please inform the developer that the extension should be updated!'); + legacyExtensionLoading(showdown.extensions[ext], ext); + return; + // END LEGACY SUPPORT CODE + + } else if (!showdown.helper.isUndefined(extensions[ext])) { + ext = extensions[ext]; + + } else { + throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.'); + } + } + + if (typeof ext === 'function') { + ext = ext(); + } + + if (!showdown.helper.isArray(ext)) { + ext = [ext]; + } + + var validExt = validate(ext, name); + if (!validExt.valid) { + throw Error(validExt.error); + } + + for (var i = 0; i < ext.length; ++i) { + switch (ext[i].type) { + + case 'lang': + langExtensions.push(ext[i]); + break; + + case 'output': + outputModifiers.push(ext[i]); + break; + } + if (ext[i].hasOwnProperty(listeners)) { + for (var ln in ext[i].listeners) { + if (ext[i].listeners.hasOwnProperty(ln)) { + listen(ln, ext[i].listeners[ln]); + } + } + } + } + + } + + /** + * LEGACY_SUPPORT + * @param {*} ext + * @param {string} name + */ + function legacyExtensionLoading(ext, name) { + if (typeof ext === 'function') { + ext = ext(new showdown.Converter()); + } + if (!showdown.helper.isArray(ext)) { + ext = [ext]; + } + var valid = validate(ext, name); + + if (!valid.valid) { + throw Error(valid.error); + } + + for (var i = 0; i < ext.length; ++i) { + switch (ext[i].type) { + case 'lang': + langExtensions.push(ext[i]); + break; + case 'output': + outputModifiers.push(ext[i]); + break; + default:// should never reach here + throw Error('Extension loader error: Type unrecognized!!!'); + } + } + } + + /** + * Listen to an event + * @param {string} name + * @param {function} callback + */ + function listen(name, callback) { + if (!showdown.helper.isString(name)) { + throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given'); + } + + if (typeof callback !== 'function') { + throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given'); + } + + if (!listeners.hasOwnProperty(name)) { + listeners[name] = []; + } + listeners[name].push(callback); + } + + function rTrimInputText(text) { + var rsp = text.match(/^\s*/)[0].length, + rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm'); + return text.replace(rgx, ''); + } + + /** + * Dispatch an event + * @private + * @param {string} evtName Event name + * @param {string} text Text + * @param {{}} options Converter Options + * @param {{}} globals + * @returns {string} + */ + this._dispatch = function dispatch (evtName, text, options, globals) { + if (listeners.hasOwnProperty(evtName)) { + for (var ei = 0; ei < listeners[evtName].length; ++ei) { + var nText = listeners[evtName][ei](evtName, text, this, options, globals); + if (nText && typeof nText !== 'undefined') { + text = nText; + } + } + } + return text; + }; + + /** + * Listen to an event + * @param {string} name + * @param {function} callback + * @returns {showdown.Converter} + */ + this.listen = function (name, callback) { + listen(name, callback); + return this; + }; + + /** + * Converts a markdown string into HTML + * @param {string} text + * @returns {*} + */ + this.makeHtml = function (text) { + //check if text is not falsy + if (!text) { + return text; + } + + var globals = { + gHtmlBlocks: [], + gHtmlMdBlocks: [], + gHtmlSpans: [], + gUrls: {}, + gTitles: {}, + gDimensions: {}, + gListLevel: 0, + hashLinkCounts: {}, + langExtensions: langExtensions, + outputModifiers: outputModifiers, + converter: this, + ghCodeBlocks: [] + }; + + // attacklab: Replace ~ with ~T + // This lets us use tilde as an escape char to avoid md5 hashes + // The choice of character is arbitrary; anything that isn't + // magic in Markdown will work. + text = text.replace(/~/g, '~T'); + + // attacklab: Replace $ with ~D + // RegExp interprets $ as a special character + // when it's in a replacement string + text = text.replace(/\$/g, '~D'); + + // Standardize line endings + text = text.replace(/\r\n/g, '\n'); // DOS to Unix + text = text.replace(/\r/g, '\n'); // Mac to Unix + + if (options.smartIndentationFix) { + text = rTrimInputText(text); + } + + // Make sure text begins and ends with a couple of newlines: + //text = '\n\n' + text + '\n\n'; + text = text; + // detab + text = showdown.subParser('detab')(text, options, globals); + + // stripBlankLines + text = showdown.subParser('stripBlankLines')(text, options, globals); + + //run languageExtensions + showdown.helper.forEach(langExtensions, function (ext) { + text = showdown.subParser('runExtension')(ext, text, options, globals); + }); + + // run the sub parsers + text = showdown.subParser('hashPreCodeTags')(text, options, globals); + text = showdown.subParser('githubCodeBlocks')(text, options, globals); + text = showdown.subParser('hashHTMLBlocks')(text, options, globals); + text = showdown.subParser('hashHTMLSpans')(text, options, globals); + text = showdown.subParser('stripLinkDefinitions')(text, options, globals); + text = showdown.subParser('blockGamut')(text, options, globals); + text = showdown.subParser('unhashHTMLSpans')(text, options, globals); + text = showdown.subParser('unescapeSpecialChars')(text, options, globals); + + // attacklab: Restore dollar signs + text = text.replace(/~D/g, '$$'); + + // attacklab: Restore tildes + text = text.replace(/~T/g, '~'); + + // Run output modifiers + showdown.helper.forEach(outputModifiers, function (ext) { + text = showdown.subParser('runExtension')(ext, text, options, globals); + }); + return text; + }; + + /** + * Set an option of this Converter instance + * @param {string} key + * @param {*} value + */ + this.setOption = function (key, value) { + options[key] = value; + }; + + /** + * Get the option of this Converter instance + * @param {string} key + * @returns {*} + */ + this.getOption = function (key) { + return options[key]; + }; + + /** + * Get the options of this Converter instance + * @returns {{}} + */ + this.getOptions = function () { + return options; + }; + + /** + * Add extension to THIS converter + * @param {{}} extension + * @param {string} [name=null] + */ + this.addExtension = function (extension, name) { + name = name || null; + _parseExtension(extension, name); + }; + + /** + * Use a global registered extension with THIS converter + * @param {string} extensionName Name of the previously registered extension + */ + this.useExtension = function (extensionName) { + _parseExtension(extensionName); + }; + + /** + * Set the flavor THIS converter should use + * @param {string} name + */ + this.setFlavor = function (name) { + if (flavor.hasOwnProperty(name)) { + var preset = flavor[name]; + for (var option in preset) { + if (preset.hasOwnProperty(option)) { + options[option] = preset[option]; + } + } + } + }; + + /** + * Remove an extension from THIS converter. + * Note: This is a costly operation. It's better to initialize a new converter + * and specify the extensions you wish to use + * @param {Array} extension + */ + this.removeExtension = function (extension) { + if (!showdown.helper.isArray(extension)) { + extension = [extension]; + } + for (var a = 0; a < extension.length; ++a) { + var ext = extension[a]; + for (var i = 0; i < langExtensions.length; ++i) { + if (langExtensions[i] === ext) { + langExtensions[i].splice(i, 1); + } + } + for (var ii = 0; ii < outputModifiers.length; ++i) { + if (outputModifiers[ii] === ext) { + outputModifiers[ii].splice(i, 1); + } + } + } + }; + + /** + * Get all extension of THIS converter + * @returns {{language: Array, output: Array}} + */ + this.getAllExtensions = function () { + return { + language: langExtensions, + output: outputModifiers + }; + }; +}; + +/** + * Turn Markdown link shortcuts into XHTML tags. + */ +showdown.subParser('anchors', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('anchors.before', text, options, globals); + + var writeAnchorTag = function (wholeMatch, m1, m2, m3, m4, m5, m6, m7) { + if (showdown.helper.isUndefined(m7)) { + m7 = ''; + } + wholeMatch = m1; + var linkText = m2, + linkId = m3.toLowerCase(), + url = m4, + title = m7; + + if (!url) { + if (!linkId) { + // lower-case and turn embedded newlines into spaces + linkId = linkText.toLowerCase().replace(/ ?\n/g, ' '); + } + url = '#' + linkId; + + if (!showdown.helper.isUndefined(globals.gUrls[linkId])) { + url = globals.gUrls[linkId]; + if (!showdown.helper.isUndefined(globals.gTitles[linkId])) { + title = globals.gTitles[linkId]; + } + } else { + if (wholeMatch.search(/\(\s*\)$/m) > -1) { + // Special case for explicit empty url + url = ''; + } else { + return wholeMatch; + } + } + } + + url = showdown.helper.escapeCharacters(url, '*_', false); + var result = ''; + + return result; + }; + + // First, handle reference-style links: [link text] [id] + /* + text = text.replace(/ + ( // wrap whole match in $1 + \[ + ( + (?: + \[[^\]]*\] // allow brackets nested one level + | + [^\[] // or anything else + )* + ) + \] + + [ ]? // one optional space + (?:\n[ ]*)? // one optional newline followed by spaces + + \[ + (.*?) // id = $3 + \] + )()()()() // pad remaining backreferences + /g,_DoAnchors_callback); + */ + text = text.replace(/(\[((?:\[[^\]]*]|[^\[\]])*)][ ]?(?:\n[ ]*)?\[(.*?)])()()()()/g, writeAnchorTag); + + // + // Next, inline-style links: [link text](url "optional title") + // + + /* + text = text.replace(/ + ( // wrap whole match in $1 + \[ + ( + (?: + \[[^\]]*\] // allow brackets nested one level + | + [^\[\]] // or anything else + ) + ) + \] + \( // literal paren + [ \t]* + () // no id, so leave $3 empty + ? // href = $4 + [ \t]* + ( // $5 + (['"]) // quote char = $6 + (.*?) // Title = $7 + \6 // matching quote + [ \t]* // ignore any spaces/tabs between closing quote and ) + )? // title is optional + \) + ) + /g,writeAnchorTag); + */ + text = text.replace(/(\[((?:\[[^\]]*]|[^\[\]])*)]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, + writeAnchorTag); + + // + // Last, handle reference-style shortcuts: [link text] + // These must come last in case you've also got [link test][1] + // or [link test](/foo) + // + + /* + text = text.replace(/ + ( // wrap whole match in $1 + \[ + ([^\[\]]+) // link text = $2; can't contain '[' or ']' + \] + )()()()()() // pad rest of backreferences + /g, writeAnchorTag); + */ + text = text.replace(/(\[([^\[\]]+)])()()()()()/g, writeAnchorTag); + + text = globals.converter._dispatch('anchors.after', text, options, globals); + return text; +}); + +showdown.subParser('autoLinks', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('autoLinks.before', text, options, globals); + + var simpleURLRegex = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)(?=\s|$)(?!["<>])/gi, + delimUrlRegex = /<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)>/gi, + simpleMailRegex = /(?:^|[ \n\t])([A-Za-z0-9!#$%&'*+-/=?^_`\{|}~\.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?:$|[ \n\t])/gi, + delimMailRegex = /<(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi; + + text = text.replace(delimUrlRegex, replaceLink); + text = text.replace(delimMailRegex, replaceMail); + // simpleURLRegex = /\b(((https?|ftp|dict):\/\/|www\.)[-.+~:?#@!$&'()*,;=[\]\w]+)\b/gi, + // Email addresses: + + if (options.simplifiedAutoLink) { + text = text.replace(simpleURLRegex, replaceLink); + text = text.replace(simpleMailRegex, replaceMail); + } + + function replaceLink(wm, link) { + var lnkTxt = link; + if (/^www\./i.test(link)) { + link = link.replace(/^www\./i, 'http://www.'); + } + return '' + lnkTxt + ''; + } + + function replaceMail(wholeMatch, m1) { + var unescapedStr = showdown.subParser('unescapeSpecialChars')(m1); + return showdown.subParser('encodeEmailAddress')(unescapedStr); + } + + text = globals.converter._dispatch('autoLinks.after', text, options, globals); + + return text; +}); + +/** + * These are all the transformations that form block-level + * tags like paragraphs, headers, and list items. + */ +showdown.subParser('blockGamut', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('blockGamut.before', text, options, globals); + + // we parse blockquotes first so that we can have headings and hrs + // inside blockquotes + text = showdown.subParser('blockQuotes')(text, options, globals); + text = showdown.subParser('headers')(text, options, globals); + + // Do Horizontal Rules: + var key = showdown.subParser('hashBlock')('
', options, globals); + text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, key); + text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm, key); + text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, key); + + text = showdown.subParser('lists')(text, options, globals); + text = showdown.subParser('codeBlocks')(text, options, globals); + text = showdown.subParser('tables')(text, options, globals); + + // We already ran _HashHTMLBlocks() before, in Markdown(), but that + // was to escape raw HTML in the original Markdown source. This time, + // we're escaping the markup we've just created, so that we don't wrap + //

tags around block-level tags. + text = showdown.subParser('hashHTMLBlocks')(text, options, globals); + text = showdown.subParser('paragraphs')(text, options, globals); + + text = globals.converter._dispatch('blockGamut.after', text, options, globals); + + return text; +}); + +showdown.subParser('blockQuotes', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('blockQuotes.before', text, options, globals); + /* + text = text.replace(/ + ( // Wrap whole match in $1 + ( + ^[ \t]*>[ \t]? // '>' at the start of a line + .+\n // rest of the first line + (.+\n)* // subsequent consecutive lines + \n* // blanks + )+ + ) + /gm, function(){...}); + */ + + text = text.replace(/((^[ \t]{0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) { + var bq = m1; + + // attacklab: hack around Konqueror 3.5.4 bug: + // "----------bug".replace(/^-/g,"") == "bug" + bq = bq.replace(/^[ \t]*>[ \t]?/gm, '~0'); // trim one level of quoting + + // attacklab: clean up hack + bq = bq.replace(/~0/g, ''); + + bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines + bq = showdown.subParser('githubCodeBlocks')(bq, options, globals); + bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse + + bq = bq.replace(/(^|\n)/g, '$1 '); + // These leading spaces screw with

 content, so we need to fix that:
+    bq = bq.replace(/(\s*
[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
+      var pre = m1;
+      // attacklab: hack around Konqueror 3.5.4 bug:
+      pre = pre.replace(/^  /mg, '~0');
+      pre = pre.replace(/~0/g, '');
+      return pre;
+    });
+
+    return showdown.subParser('hashBlock')('
\n' + bq + '\n
', options, globals); + }); + + text = globals.converter._dispatch('blockQuotes.after', text, options, globals); + return text; +}); + +/** + * Process Markdown `
` blocks.
+ */
+showdown.subParser('codeBlocks', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('codeBlocks.before', text, options, globals);
+  /*
+   text = text.replace(text,
+   /(?:\n\n|^)
+   (								// $1 = the code block -- one or more lines, starting with a space/tab
+   (?:
+   (?:[ ]{4}|\t)			// Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width
+   .*\n+
+   )+
+   )
+   (\n*[ ]{0,3}[^ \t\n]|(?=~0))	// attacklab: g_tab_width
+   /g,function(){...});
+   */
+
+  // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
+  text += '~0';
+
+  var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g;
+  text = text.replace(pattern, function (wholeMatch, m1, m2) {
+    var codeblock = m1,
+        nextChar = m2,
+        end = '\n';
+
+    codeblock = showdown.subParser('outdent')(codeblock);
+    codeblock = showdown.subParser('encodeCode')(codeblock);
+    codeblock = showdown.subParser('detab')(codeblock);
+    codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
+    codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
+
+    if (options.omitExtraWLInCodeBlocks) {
+      end = '';
+    }
+
+    codeblock = '
' + codeblock + end + '
'; + + return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar; + }); + + // attacklab: strip sentinel + text = text.replace(/~0/, ''); + + text = globals.converter._dispatch('codeBlocks.after', text, options, globals); + return text; +}); + +/** + * + * * Backtick quotes are used for spans. + * + * * You can use multiple backticks as the delimiters if you want to + * include literal backticks in the code span. So, this input: + * + * Just type ``foo `bar` baz`` at the prompt. + * + * Will translate to: + * + *

Just type foo `bar` baz at the prompt.

+ * + * There's no arbitrary limit to the number of backticks you + * can use as delimters. If you need three consecutive backticks + * in your code, use four for delimiters, etc. + * + * * You can use spaces to get literal backticks at the edges: + * + * ... type `` `bar` `` ... + * + * Turns to: + * + * ... type `bar` ... + */ +showdown.subParser('codeSpans', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('codeSpans.before', text, options, globals); + + /* + text = text.replace(/ + (^|[^\\]) // Character before opening ` can't be a backslash + (`+) // $2 = Opening run of ` + ( // $3 = The code block + [^\r]*? + [^`] // attacklab: work around lack of lookbehind + ) + \2 // Matching closer + (?!`) + /gm, function(){...}); + */ + + if (typeof(text) === 'undefined') { + text = ''; + } + text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, + function (wholeMatch, m1, m2, m3) { + var c = m3; + c = c.replace(/^([ \t]*)/g, ''); // leading whitespace + c = c.replace(/[ \t]*$/g, ''); // trailing whitespace + c = showdown.subParser('encodeCode')(c); + return m1 + '' + c + ''; + } + ); + + text = globals.converter._dispatch('codeSpans.after', text, options, globals); + return text; +}); + +/** + * Convert all tabs to spaces + */ +showdown.subParser('detab', function (text) { + 'use strict'; + + // expand first n-1 tabs + text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width + + // replace the nth with two sentinels + text = text.replace(/\t/g, '~A~B'); + + // use the sentinel to anchor our regex so it doesn't explode + text = text.replace(/~B(.+?)~A/g, function (wholeMatch, m1) { + var leadingText = m1, + numSpaces = 4 - leadingText.length % 4; // g_tab_width + + // there *must* be a better way to do this: + for (var i = 0; i < numSpaces; i++) { + leadingText += ' '; + } + + return leadingText; + }); + + // clean up sentinels + text = text.replace(/~A/g, ' '); // g_tab_width + text = text.replace(/~B/g, ''); + + return text; + +}); + +/** + * Smart processing for ampersands and angle brackets that need to be encoded. + */ +showdown.subParser('encodeAmpsAndAngles', function (text) { + 'use strict'; + // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: + // http://bumppo.net/projects/amputator/ + text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&'); + + // Encode naked <'s + text = text.replace(/<(?![a-z\/?\$!])/gi, '<'); + + return text; +}); + +/** + * Returns the string, with after processing the following backslash escape sequences. + * + * attacklab: The polite way to do this is with the new escapeCharacters() function: + * + * text = escapeCharacters(text,"\\",true); + * text = escapeCharacters(text,"`*_{}[]()>#+-.!",true); + * + * ...but we're sidestepping its use of the (slow) RegExp constructor + * as an optimization for Firefox. This function gets called a LOT. + */ +showdown.subParser('encodeBackslashEscapes', function (text) { + 'use strict'; + text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback); + text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g, showdown.helper.escapeCharactersCallback); + return text; +}); + +/** + * Encode/escape certain characters inside Markdown code runs. + * The point is that in code, these characters are literals, + * and lose their special Markdown meanings. + */ +showdown.subParser('encodeCode', function (text) { + 'use strict'; + + // Encode all ampersands; HTML entities are not + // entities within a Markdown code span. + text = text.replace(/&/g, '&'); + + // Do the angle bracket song and dance: + text = text.replace(//g, '>'); + + // Now, escape characters that are magic in Markdown: + text = showdown.helper.escapeCharacters(text, '*_{}[]\\', false); + + // jj the line above breaks this: + //--- + //* Item + // 1. Subitem + // special char: * + // --- + + return text; +}); + +/** + * Input: an email address, e.g. "foo@example.com" + * + * Output: the email address as a mailto link, with each character + * of the address encoded as either a decimal or hex entity, in + * the hopes of foiling most address harvesting spam bots. E.g.: + * + * foo + * @example.com + * + * Based on a filter by Matthew Wickline, posted to the BBEdit-Talk + * mailing list: + * + */ +showdown.subParser('encodeEmailAddress', function (addr) { + 'use strict'; + + var encode = [ + function (ch) { + return '&#' + ch.charCodeAt(0) + ';'; + }, + function (ch) { + return '&#x' + ch.charCodeAt(0).toString(16) + ';'; + }, + function (ch) { + return ch; + } + ]; + + addr = 'mailto:' + addr; + + addr = addr.replace(/./g, function (ch) { + if (ch === '@') { + // this *must* be encoded. I insist. + ch = encode[Math.floor(Math.random() * 2)](ch); + } else if (ch !== ':') { + // leave ':' alone (to spot mailto: later) + var r = Math.random(); + // roughly 10% raw, 45% hex, 45% dec + ch = ( + r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch) + ); + } + return ch; + }); + + addr = '' + addr + ''; + addr = addr.replace(/">.+:/g, '">'); // strip the mailto: from the visible part + + return addr; +}); + +/** + * Within tags -- meaning between < and > -- encode [\ ` * _] so they + * don't conflict with their use in Markdown for code, italics and strong. + */ +showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text) { + 'use strict'; + + // Build a regex to find HTML tags and comments. See Friedl's + // "Mastering Regular Expressions", 2nd Ed., pp. 200-201. + var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi; + + text = text.replace(regex, function (wholeMatch) { + var tag = wholeMatch.replace(/(.)<\/?code>(?=.)/g, '$1`'); + tag = showdown.helper.escapeCharacters(tag, '\\`*_', false); + return tag; + }); + + return text; +}); + +/** + * Handle github codeblocks prior to running HashHTML so that + * HTML contained within the codeblock gets escaped properly + * Example: + * ```ruby + * def hello_world(x) + * puts "Hello, #{x}" + * end + * ``` + */ +showdown.subParser('githubCodeBlocks', function (text, options, globals) { + 'use strict'; + + // early exit if option is not enabled + if (!options.ghCodeBlocks) { + return text; + } + + text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals); + + text += '~0'; + + text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, language, codeblock) { + var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n'; + + // First parse the github code block + codeblock = showdown.subParser('encodeCode')(codeblock); + codeblock = showdown.subParser('detab')(codeblock); + codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines + codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace + + codeblock = '
' + codeblock + end + '
'; + + codeblock = showdown.subParser('hashBlock')(codeblock, options, globals); + + // Since GHCodeblocks can be false positives, we need to + // store the primitive text and the parsed text in a global var, + // and then return a token + return '\n\n~G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n'; + }); + + // attacklab: strip sentinel + text = text.replace(/~0/, ''); + + return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals); +}); + +showdown.subParser('hashBlock', function (text, options, globals) { + 'use strict'; + text = text.replace(/(^\n+|\n+$)/g, ''); + return '\n\n~K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n'; +}); + +showdown.subParser('hashElement', function (text, options, globals) { + 'use strict'; + + return function (wholeMatch, m1) { + var blockText = m1; + + // Undo double lines + blockText = blockText.replace(/\n\n/g, '\n'); + blockText = blockText.replace(/^\n/, ''); + + // strip trailing blank lines + blockText = blockText.replace(/\n+$/g, ''); + + // Replace the element text with a marker ("~KxK" where x is its key) + blockText = '\n\n~K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n'; + + return blockText; + }; +}); + +showdown.subParser('hashHTMLBlocks', function (text, options, globals) { + 'use strict'; + + var blockTags = [ + 'pre', + 'div', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'blockquote', + 'table', + 'dl', + 'ol', + 'ul', + 'script', + 'noscript', + 'form', + 'fieldset', + 'iframe', + 'math', + 'style', + 'section', + 'header', + 'footer', + 'nav', + 'article', + 'aside', + 'address', + 'audio', + 'canvas', + 'figure', + 'hgroup', + 'output', + 'video', + 'p' + ], + repFunc = function (wholeMatch, match, left, right) { + var txt = wholeMatch; + // check if this html element is marked as markdown + // if so, it's contents should be parsed as markdown + if (left.search(/\bmarkdown\b/) !== -1) { + txt = left + globals.converter.makeHtml(match) + right; + } + return '\n\n~K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n'; + }; + + for (var i = 0; i < blockTags.length; ++i) { + text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^(?: |\\t){0,3}<' + blockTags[i] + '\\b[^>]*>', '', 'gim'); + } + + // HR SPECIAL CASE + text = text.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, + showdown.subParser('hashElement')(text, options, globals)); + + // Special case for standalone HTML comments: + text = text.replace(/()/g, + showdown.subParser('hashElement')(text, options, globals)); + + // PHP and ASP-style processor instructions ( and <%...%>) + text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, + showdown.subParser('hashElement')(text, options, globals)); + return text; +}); + +/** + * Hash span elements that should not be parsed as markdown + */ +showdown.subParser('hashHTMLSpans', function (text, config, globals) { + 'use strict'; + + var matches = showdown.helper.matchRecursiveRegExp(text, ']*>', '', 'gi'); + + for (var i = 0; i < matches.length; ++i) { + text = text.replace(matches[i][0], '~L' + (globals.gHtmlSpans.push(matches[i][0]) - 1) + 'L'); + } + return text; +}); + +/** + * Unhash HTML spans + */ +showdown.subParser('unhashHTMLSpans', function (text, config, globals) { + 'use strict'; + + for (var i = 0; i < globals.gHtmlSpans.length; ++i) { + text = text.replace('~L' + i + 'L', globals.gHtmlSpans[i]); + } + + return text; +}); + +/** + * Hash span elements that should not be parsed as markdown + */ +showdown.subParser('hashPreCodeTags', function (text, config, globals) { + 'use strict'; + + var repFunc = function (wholeMatch, match, left, right) { + // encode html entities + var codeblock = left + showdown.subParser('encodeCode')(match) + right; + return '\n\n~G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n'; + }; + + text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^(?: |\\t){0,3}]*>\\s*]*>', '^(?: |\\t){0,3}\\s*
', 'gim'); + return text; +}); + +showdown.subParser('headers', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('headers.before', text, options, globals); + + var prefixHeader = options.prefixHeaderId, + headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart), + + // Set text-style headers: + // Header 1 + // ======== + // + // Header 2 + // -------- + // + setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, + setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; + + text = text.replace(setextRegexH1, function (wholeMatch, m1) { + + var spanGamut = showdown.subParser('spanGamut')(m1, options, globals), + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', + hLevel = headerLevelStart, + hashBlock = '' + spanGamut + ''; + return showdown.subParser('hashBlock')(hashBlock, options, globals); + }); + + text = text.replace(setextRegexH2, function (matchFound, m1) { + var spanGamut = showdown.subParser('spanGamut')(m1, options, globals), + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', + hLevel = headerLevelStart + 1, + hashBlock = '' + spanGamut + ''; + return showdown.subParser('hashBlock')(hashBlock, options, globals); + }); + + // atx-style headers: + // # Header 1 + // ## Header 2 + // ## Header 2 with closing hashes ## + // ... + // ###### Header 6 + // + text = text.replace(/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm, function (wholeMatch, m1, m2) { + var span = showdown.subParser('spanGamut')(m2, options, globals), + hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"', + hLevel = headerLevelStart - 1 + m1.length, + header = '' + span + ''; + + return showdown.subParser('hashBlock')(header, options, globals); + }); + + function headerId(m) { + var title, escapedId = m.replace(/[^\w]/g, '').toLowerCase(); + + if (globals.hashLinkCounts[escapedId]) { + title = escapedId + '-' + (globals.hashLinkCounts[escapedId]++); + } else { + title = escapedId; + globals.hashLinkCounts[escapedId] = 1; + } + + // Prefix id to prevent causing inadvertent pre-existing style matches. + if (prefixHeader === true) { + prefixHeader = 'section'; + } + + if (showdown.helper.isString(prefixHeader)) { + return prefixHeader + title; + } + return title; + } + + text = globals.converter._dispatch('headers.after', text, options, globals); + return text; +}); + +/** + * Turn Markdown image shortcuts into tags. + */ +showdown.subParser('images', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('images.before', text, options, globals); + + var inlineRegExp = /!\[(.*?)]\s?\([ \t]*()?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(['"])(.*?)\6[ \t]*)?\)/g, + referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[(.*?)]()()()()()/g; + + function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) { + + var gUrls = globals.gUrls, + gTitles = globals.gTitles, + gDims = globals.gDimensions; + + linkId = linkId.toLowerCase(); + + if (!title) { + title = ''; + } + + if (url === '' || url === null) { + if (linkId === '' || linkId === null) { + // lower-case and turn embedded newlines into spaces + linkId = altText.toLowerCase().replace(/ ?\n/g, ' '); + } + url = '#' + linkId; + + if (!showdown.helper.isUndefined(gUrls[linkId])) { + url = gUrls[linkId]; + if (!showdown.helper.isUndefined(gTitles[linkId])) { + title = gTitles[linkId]; + } + if (!showdown.helper.isUndefined(gDims[linkId])) { + width = gDims[linkId].width; + height = gDims[linkId].height; + } + } else { + return wholeMatch; + } + } + + altText = altText.replace(/"/g, '"'); + altText = showdown.helper.escapeCharacters(altText, '*_', false); + url = showdown.helper.escapeCharacters(url, '*_', false); + var result = '' + altText + 'x "optional title") + text = text.replace(inlineRegExp, writeImageTag); + + text = globals.converter._dispatch('images.after', text, options, globals); + return text; +}); + +showdown.subParser('italicsAndBold', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('italicsAndBold.before', text, options, globals); + + if (options.literalMidWordUnderscores) { + //underscores + // Since we are consuming a \s character, we need to add it + text = text.replace(/(^|\s|>|\b)__(?=\S)([\s\S]+?)__(?=\b|<|\s|$)/gm, '$1$2'); + text = text.replace(/(^|\s|>|\b)_(?=\S)([\s\S]+?)_(?=\b|<|\s|$)/gm, '$1$2'); + //asterisks + text = text.replace(/(\*\*)(?=\S)([^\r]*?\S[*]*)\1/g, '$2'); + text = text.replace(/(\*)(?=\S)([^\r]*?\S)\1/g, '$2'); + + } else { + // must go first: + text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, '$2'); + text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, '$2'); + } + + text = globals.converter._dispatch('italicsAndBold.after', text, options, globals); + return text; +}); + +/** + * Form HTML ordered (numbered) and unordered (bulleted) lists. + */ +showdown.subParser('lists', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('lists.before', text, options, globals); + /** + * Process the contents of a single ordered or unordered list, splitting it + * into individual list items. + * @param {string} listStr + * @param {boolean} trimTrailing + * @returns {string} + */ + function processListItems (listStr, trimTrailing) { + // The $g_list_level global keeps track of when we're inside a list. + // Each time we enter a list, we increment it; when we leave a list, + // we decrement. If it's zero, we're not in a list anymore. + // + // We do this because when we're not inside a list, we want to treat + // something like this: + // + // I recommend upgrading to version + // 8. Oops, now this line is treated + // as a sub-list. + // + // As a single paragraph, despite the fact that the second line starts + // with a digit-period-space sequence. + // + // Whereas when we're inside a list (or sub-list), that line will be + // treated as the start of a sub-list. What a kludge, huh? This is + // an aspect of Markdown's syntax that's hard to parse perfectly + // without resorting to mind-reading. Perhaps the solution is to + // change the syntax rules such that sub-lists must start with a + // starting cardinal number; e.g. "1." or "a.". + globals.gListLevel++; + + // trim trailing blank lines: + listStr = listStr.replace(/\n{2,}$/, '\n'); + + // attacklab: add sentinel to emulate \z + listStr += '~0'; + + var rgx = /(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm, + isParagraphed = (/\n[ \t]*\n(?!~0)/.test(listStr)); + + listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) { + checked = (checked && checked.trim() !== ''); + var item = showdown.subParser('outdent')(m4, options, globals), + bulletStyle = ''; + + // Support for github tasklists + if (taskbtn && options.tasklists) { + bulletStyle = ' class="task-list-item" style="list-style-type: none;"'; + item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () { + var otp = ' -1)) { + item = showdown.subParser('githubCodeBlocks')(item, options, globals); + item = showdown.subParser('blockGamut')(item, options, globals); + } else { + // Recursion for sub-lists: + item = showdown.subParser('lists')(item, options, globals); + item = item.replace(/\n$/, ''); // chomp(item) + if (isParagraphed) { + item = showdown.subParser('paragraphs')(item, options, globals); + } else { + item = showdown.subParser('spanGamut')(item, options, globals); + } + } + item = '\n' + item + '\n'; + return item; + }); + + // attacklab: strip sentinel + listStr = listStr.replace(/~0/g, ''); + + globals.gListLevel--; + + if (trimTrailing) { + listStr = listStr.replace(/\s+$/, ''); + } + + return listStr; + } + + /** + * Check and parse consecutive lists (better fix for issue #142) + * @param {string} list + * @param {string} listType + * @param {boolean} trimTrailing + * @returns {string} + */ + function parseConsecutiveLists(list, listType, trimTrailing) { + // check if we caught 2 or more consecutive lists by mistake + // we use the counterRgx, meaning if listType is UL we look for UL and vice versa + var counterRxg = (listType === 'ul') ? /^ {0,2}\d+\.[ \t]/gm : /^ {0,2}[*+-][ \t]/gm, + subLists = [], + result = ''; + + if (list.search(counterRxg) !== -1) { + (function parseCL(txt) { + var pos = txt.search(counterRxg); + if (pos !== -1) { + // slice + result += '\n\n<' + listType + '>' + processListItems(txt.slice(0, pos), !!trimTrailing) + '\n\n'; + + // invert counterType and listType + listType = (listType === 'ul') ? 'ol' : 'ul'; + counterRxg = (listType === 'ul') ? /^ {0,2}\d+\.[ \t]/gm : /^ {0,2}[*+-][ \t]/gm; + + //recurse + parseCL(txt.slice(pos)); + } else { + result += '\n\n<' + listType + '>' + processListItems(txt, !!trimTrailing) + '\n\n'; + } + })(list); + for (var i = 0; i < subLists.length; ++i) { + + } + } else { + result = '\n\n<' + listType + '>' + processListItems(list, !!trimTrailing) + '\n\n'; + } + + return result; + } + + // attacklab: add sentinel to hack around khtml/safari bug: + // http://bugs.webkit.org/show_bug.cgi?id=11231 + text += '~0'; + + // Re-usable pattern to match any entire ul or ol list: + var wholeList = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm; + + if (globals.gListLevel) { + text = text.replace(wholeList, function (wholeMatch, list, m2) { + var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol'; + return parseConsecutiveLists(list, listType, true); + }); + } else { + wholeList = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm; + //wholeList = /(\n\n|^\n?)( {0,3}([*+-]|\d+\.)[ \t]+[\s\S]+?)(?=(~0)|(\n\n(?!\t| {2,}| {0,3}([*+-]|\d+\.)[ \t])))/g; + text = text.replace(wholeList, function (wholeMatch, m1, list, m3) { + + var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol'; + return parseConsecutiveLists(list, listType); + }); + } + + // attacklab: strip sentinel + text = text.replace(/~0/, ''); + + text = globals.converter._dispatch('lists.after', text, options, globals); + return text; +}); + +/** + * Remove one level of line-leading tabs or spaces + */ +showdown.subParser('outdent', function (text) { + 'use strict'; + + // attacklab: hack around Konqueror 3.5.4 bug: + // "----------bug".replace(/^-/g,"") == "bug" + text = text.replace(/^(\t|[ ]{1,4})/gm, '~0'); // attacklab: g_tab_width + + // attacklab: clean up hack + text = text.replace(/~0/g, ''); + + return text; +}); + +/** + * + */ +showdown.subParser('paragraphs', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('paragraphs.before', text, options, globals); + // Strip leading and trailing lines: + text = text.replace(/^\n+/g, ''); + text = text.replace(/\n+$/g, ''); + + var grafs = text.split(/\n{2,}/g), + grafsOut = [], + end = grafs.length; // Wrap

tags + + for (var i = 0; i < end; i++) { + var str = grafs[i]; + // if this is an HTML marker, copy it + if (str.search(/~(K|G)(\d+)\1/g) >= 0) { + grafsOut.push(str); + } else { + str = showdown.subParser('spanGamut')(str, options, globals); + str = str.replace(/^([ \t]*)/g, '

'); + str += '

'; + grafsOut.push(str); + } + } + + /** Unhashify HTML blocks */ + end = grafsOut.length; + for (i = 0; i < end; i++) { + var blockText = '', + grafsOutIt = grafsOut[i], + codeFlag = false; + // if this is a marker for an html block... + while (grafsOutIt.search(/~(K|G)(\d+)\1/) >= 0) { + var delim = RegExp.$1, + num = RegExp.$2; + + if (delim === 'K') { + blockText = globals.gHtmlBlocks[num]; + } else { + // we need to check if ghBlock is a false positive + if (codeFlag) { + // use encoded version of all text + blockText = showdown.subParser('encodeCode')(globals.ghCodeBlocks[num].text); + } else { + blockText = globals.ghCodeBlocks[num].codeblock; + } + } + blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs + + grafsOutIt = grafsOutIt.replace(/(\n\n)?~(K|G)\d+\2(\n\n)?/, blockText); + // Check if grafsOutIt is a pre->code + if (/^]*>\s*]*>/.test(grafsOutIt)) { + codeFlag = true; + } + } + grafsOut[i] = grafsOutIt; + } + text = grafsOut.join('\n\n'); + // Strip leading and trailing lines: + text = text.replace(/^\n+/g, ''); + text = text.replace(/\n+$/g, ''); + return globals.converter._dispatch('paragraphs.after', text, options, globals); +}); + +/** + * Run extension + */ +showdown.subParser('runExtension', function (ext, text, options, globals) { + 'use strict'; + + if (ext.filter) { + text = ext.filter(text, globals.converter, options); + + } else if (ext.regex) { + // TODO remove this when old extension loading mechanism is deprecated + var re = ext.regex; + if (!re instanceof RegExp) { + re = new RegExp(re, 'g'); + } + text = text.replace(re, ext.replace); + } + + return text; +}); + +/** + * These are all the transformations that occur *within* block-level + * tags like paragraphs, headers, and list items. + */ +showdown.subParser('spanGamut', function (text, options, globals) { + 'use strict'; + + text = globals.converter._dispatch('spanGamut.before', text, options, globals); + text = showdown.subParser('codeSpans')(text, options, globals); + text = showdown.subParser('escapeSpecialCharsWithinTagAttributes')(text, options, globals); + text = showdown.subParser('encodeBackslashEscapes')(text, options, globals); + + // Process anchor and image tags. Images must come first, + // because ![foo][f] looks like an anchor. + text = showdown.subParser('images')(text, options, globals); + text = showdown.subParser('anchors')(text, options, globals); + + // Make links out of things like `` + // Must come after _DoAnchors(), because you can use < and > + // delimiters in inline links like [this](). + text = showdown.subParser('autoLinks')(text, options, globals); + text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals); + text = showdown.subParser('italicsAndBold')(text, options, globals); + text = showdown.subParser('strikethrough')(text, options, globals); + + // Do hard breaks: + text = text.replace(/ +\n/g, '
\n'); + + text = globals.converter._dispatch('spanGamut.after', text, options, globals); + return text; +}); + +showdown.subParser('strikethrough', function (text, options, globals) { + 'use strict'; + + if (options.strikethrough) { + text = globals.converter._dispatch('strikethrough.before', text, options, globals); + text = text.replace(/(?:~T){2}([\s\S]+?)(?:~T){2}/g, '$1'); + text = globals.converter._dispatch('strikethrough.after', text, options, globals); + } + + return text; +}); + +/** + * Strip any lines consisting only of spaces and tabs. + * This makes subsequent regexs easier to write, because we can + * match consecutive blank lines with /\n+/ instead of something + * contorted like /[ \t]*\n+/ + */ +showdown.subParser('stripBlankLines', function (text) { + 'use strict'; + return text.replace(/^[ \t]+$/mg, ''); +}); + +/** + * Strips link definitions from text, stores the URLs and titles in + * hash references. + * Link defs are in the form: ^[id]: url "optional title" + * + * ^[ ]{0,3}\[(.+)\]: // id = $1 attacklab: g_tab_width - 1 + * [ \t]* + * \n? // maybe *one* newline + * [ \t]* + * ? // url = $2 + * [ \t]* + * \n? // maybe one newline + * [ \t]* + * (?: + * (\n*) // any lines skipped = $3 attacklab: lookbehind removed + * ["(] + * (.+?) // title = $4 + * [")] + * [ \t]* + * )? // title is optional + * (?:\n+|$) + * /gm, + * function(){...}); + * + */ +showdown.subParser('stripLinkDefinitions', function (text, options, globals) { + 'use strict'; + + var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=~0))/gm; + + // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug + text += '~0'; + + text = text.replace(regex, function (wholeMatch, linkId, url, width, height, blankLines, title) { + linkId = linkId.toLowerCase(); + globals.gUrls[linkId] = showdown.subParser('encodeAmpsAndAngles')(url); // Link IDs are case-insensitive + + if (blankLines) { + // Oops, found blank lines, so it's not a title. + // Put back the parenthetical statement we stole. + return blankLines + title; + + } else { + if (title) { + globals.gTitles[linkId] = title.replace(/"|'/g, '"'); + } + if (options.parseImgDimensions && width && height) { + globals.gDimensions[linkId] = { + width: width, + height: height + }; + } + } + // Completely remove the definition from the text + return ''; + }); + + // attacklab: strip sentinel + text = text.replace(/~0/, ''); + + return text; +}); + +showdown.subParser('tables', function (text, options, globals) { + 'use strict'; + + if (!options.tables) { + return text; + } + + var tableRgx = /^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|~0)/gm; + + function parseStyles(sLine) { + if (/^:[ \t]*--*$/.test(sLine)) { + return ' style="text-align:left;"'; + } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) { + return ' style="text-align:right;"'; + } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) { + return ' style="text-align:center;"'; + } else { + return ''; + } + } + + function parseHeaders(header, style) { + var id = ''; + header = header.trim(); + if (options.tableHeaderId) { + id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"'; + } + header = showdown.subParser('spanGamut')(header, options, globals); + + return '' + header + '\n'; + } + + function parseCells(cell, style) { + var subText = showdown.subParser('spanGamut')(cell, options, globals); + return '' + subText + '\n'; + } + + function buildTable(headers, cells) { + var tb = '\n\n\n', + tblLgn = headers.length; + + for (var i = 0; i < tblLgn; ++i) { + tb += headers[i]; + } + tb += '\n\n\n'; + + for (i = 0; i < cells.length; ++i) { + tb += '\n'; + for (var ii = 0; ii < tblLgn; ++ii) { + tb += cells[i][ii]; + } + tb += '\n'; + } + tb += '\n
\n'; + return tb; + } + + text = globals.converter._dispatch('tables.before', text, options, globals); + + text = text.replace(tableRgx, function (rawTable) { + + var i, tableLines = rawTable.split('\n'); + + // strip wrong first and last column if wrapped tables are used + for (i = 0; i < tableLines.length; ++i) { + if (/^[ \t]{0,3}\|/.test(tableLines[i])) { + tableLines[i] = tableLines[i].replace(/^[ \t]{0,3}\|/, ''); + } + if (/\|[ \t]*$/.test(tableLines[i])) { + tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, ''); + } + } + + var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}), + rawStyles = tableLines[1].split('|').map(function (s) { return s.trim();}), + rawCells = [], + headers = [], + styles = [], + cells = []; + + tableLines.shift(); + tableLines.shift(); + + for (i = 0; i < tableLines.length; ++i) { + if (tableLines[i].trim() === '') { + continue; + } + rawCells.push( + tableLines[i] + .split('|') + .map(function (s) { + return s.trim(); + }) + ); + } + + if (rawHeaders.length < rawStyles.length) { + return rawTable; + } + + for (i = 0; i < rawStyles.length; ++i) { + styles.push(parseStyles(rawStyles[i])); + } + + for (i = 0; i < rawHeaders.length; ++i) { + if (showdown.helper.isUndefined(styles[i])) { + styles[i] = ''; + } + headers.push(parseHeaders(rawHeaders[i], styles[i])); + } + + for (i = 0; i < rawCells.length; ++i) { + var row = []; + for (var ii = 0; ii < headers.length; ++ii) { + if (showdown.helper.isUndefined(rawCells[i][ii])) { + + } + row.push(parseCells(rawCells[i][ii], styles[ii])); + } + cells.push(row); + } + + return buildTable(headers, cells); + }); + + text = globals.converter._dispatch('tables.after', text, options, globals); + + return text; +}); + +/** + * Swap back in all the special characters we've hidden. + */ +showdown.subParser('unescapeSpecialChars', function (text) { + 'use strict'; + + text = text.replace(/~E(\d+)E/g, function (wholeMatch, m1) { + var charCodeToReplace = parseInt(m1); + return String.fromCharCode(charCodeToReplace); + }); + return text; +}); +module.exports = showdown; diff --git a/wxParse/wxDiscode.js b/wxParse/wxDiscode.js new file mode 100644 index 0000000..fca29bb --- /dev/null +++ b/wxParse/wxDiscode.js @@ -0,0 +1,207 @@ +// HTML 支持的数学符号 +function strNumDiscode(str){ + str = str.replace(/∀/g, '∀'); + str = str.replace(/∂/g, '∂'); + str = str.replace(/&exists;/g, '∃'); + str = str.replace(/∅/g, '∅'); + str = str.replace(/∇/g, '∇'); + str = str.replace(/∈/g, '∈'); + str = str.replace(/∉/g, '∉'); + str = str.replace(/∋/g, '∋'); + str = str.replace(/∏/g, '∏'); + str = str.replace(/∑/g, '∑'); + str = str.replace(/−/g, '−'); + str = str.replace(/∗/g, '∗'); + str = str.replace(/√/g, '√'); + str = str.replace(/∝/g, '∝'); + str = str.replace(/∞/g, '∞'); + str = str.replace(/∠/g, '∠'); + str = str.replace(/∧/g, '∧'); + str = str.replace(/∨/g, '∨'); + str = str.replace(/∩/g, '∩'); + str = str.replace(/∩/g, '∪'); + str = str.replace(/∫/g, '∫'); + str = str.replace(/∴/g, '∴'); + str = str.replace(/∼/g, '∼'); + str = str.replace(/≅/g, '≅'); + str = str.replace(/≈/g, '≈'); + str = str.replace(/≠/g, '≠'); + str = str.replace(/≤/g, '≤'); + str = str.replace(/≥/g, '≥'); + str = str.replace(/⊂/g, '⊂'); + str = str.replace(/⊃/g, '⊃'); + str = str.replace(/⊄/g, '⊄'); + str = str.replace(/⊆/g, '⊆'); + str = str.replace(/⊇/g, '⊇'); + str = str.replace(/⊕/g, '⊕'); + str = str.replace(/⊗/g, '⊗'); + str = str.replace(/⊥/g, '⊥'); + str = str.replace(/⋅/g, '⋅'); + return str; +} + +//HTML 支持的希腊字母 +function strGreeceDiscode(str){ + str = str.replace(/Α/g, 'Α'); + str = str.replace(/Β/g, 'Β'); + str = str.replace(/Γ/g, 'Γ'); + str = str.replace(/Δ/g, 'Δ'); + str = str.replace(/Ε/g, 'Ε'); + str = str.replace(/Ζ/g, 'Ζ'); + str = str.replace(/Η/g, 'Η'); + str = str.replace(/Θ/g, 'Θ'); + str = str.replace(/Ι/g, 'Ι'); + str = str.replace(/Κ/g, 'Κ'); + str = str.replace(/Λ/g, 'Λ'); + str = str.replace(/Μ/g, 'Μ'); + str = str.replace(/Ν/g, 'Ν'); + str = str.replace(/Ξ/g, 'Ν'); + str = str.replace(/Ο/g, 'Ο'); + str = str.replace(/Π/g, 'Π'); + str = str.replace(/Ρ/g, 'Ρ'); + str = str.replace(/Σ/g, 'Σ'); + str = str.replace(/Τ/g, 'Τ'); + str = str.replace(/Υ/g, 'Υ'); + str = str.replace(/Φ/g, 'Φ'); + str = str.replace(/Χ/g, 'Χ'); + str = str.replace(/Ψ/g, 'Ψ'); + str = str.replace(/Ω/g, 'Ω'); + + str = str.replace(/α/g, 'α'); + str = str.replace(/β/g, 'β'); + str = str.replace(/γ/g, 'γ'); + str = str.replace(/δ/g, 'δ'); + str = str.replace(/ε/g, 'ε'); + str = str.replace(/ζ/g, 'ζ'); + str = str.replace(/η/g, 'η'); + str = str.replace(/θ/g, 'θ'); + str = str.replace(/ι/g, 'ι'); + str = str.replace(/κ/g, 'κ'); + str = str.replace(/λ/g, 'λ'); + str = str.replace(/μ/g, 'μ'); + str = str.replace(/ν/g, 'ν'); + str = str.replace(/ξ/g, 'ξ'); + str = str.replace(/ο/g, 'ο'); + str = str.replace(/π/g, 'π'); + str = str.replace(/ρ/g, 'ρ'); + str = str.replace(/ς/g, 'ς'); + str = str.replace(/σ/g, 'σ'); + str = str.replace(/τ/g, 'τ'); + str = str.replace(/υ/g, 'υ'); + str = str.replace(/φ/g, 'φ'); + str = str.replace(/χ/g, 'χ'); + str = str.replace(/ψ/g, 'ψ'); + str = str.replace(/ω/g, 'ω'); + str = str.replace(/ϑ/g, 'ϑ'); + str = str.replace(/ϒ/g, 'ϒ'); + str = str.replace(/ϖ/g, 'ϖ'); + str = str.replace(/·/g, '·'); + return str; +} + +// + +function strcharacterDiscode(str){ + // 加入常用解析 + str = str.replace(/ /g, ' '); + str = str.replace(/"/g, "'"); + str = str.replace(/&/g, '&'); + // str = str.replace(/</g, '‹'); + // str = str.replace(/>/g, '›'); + + str = str.replace(/</g, '<'); + str = str.replace(/>/g, '>'); + str = str.replace(/•/g, '•'); + + return str; +} + +// HTML 支持的其他实体 +function strOtherDiscode(str){ + str = str.replace(/Œ/g, 'Œ'); + str = str.replace(/œ/g, 'œ'); + str = str.replace(/Š/g, 'Š'); + str = str.replace(/š/g, 'š'); + str = str.replace(/Ÿ/g, 'Ÿ'); + str = str.replace(/ƒ/g, 'ƒ'); + str = str.replace(/ˆ/g, 'ˆ'); + str = str.replace(/˜/g, '˜'); + str = str.replace(/ /g, ''); + str = str.replace(/ /g, ''); + str = str.replace(/ /g, ''); + str = str.replace(/‌/g, ''); + str = str.replace(/‍/g, ''); + str = str.replace(/‎/g, ''); + str = str.replace(/‏/g, ''); + str = str.replace(/–/g, '–'); + str = str.replace(/—/g, '—'); + str = str.replace(/‘/g, '‘'); + str = str.replace(/’/g, '’'); + str = str.replace(/‚/g, '‚'); + str = str.replace(/“/g, '“'); + str = str.replace(/”/g, '”'); + str = str.replace(/„/g, '„'); + str = str.replace(/†/g, '†'); + str = str.replace(/‡/g, '‡'); + str = str.replace(/•/g, '•'); + str = str.replace(/…/g, '…'); + str = str.replace(/‰/g, '‰'); + str = str.replace(/′/g, '′'); + str = str.replace(/″/g, '″'); + str = str.replace(/‹/g, '‹'); + str = str.replace(/›/g, '›'); + str = str.replace(/‾/g, '‾'); + str = str.replace(/€/g, '€'); + str = str.replace(/™/g, '™'); + + str = str.replace(/←/g, '←'); + str = str.replace(/↑/g, '↑'); + str = str.replace(/→/g, '→'); + str = str.replace(/↓/g, '↓'); + str = str.replace(/↔/g, '↔'); + str = str.replace(/↵/g, '↵'); + str = str.replace(/⌈/g, '⌈'); + str = str.replace(/⌉/g, '⌉'); + + str = str.replace(/⌊/g, '⌊'); + str = str.replace(/⌋/g, '⌋'); + str = str.replace(/◊/g, '◊'); + str = str.replace(/♠/g, '♠'); + str = str.replace(/♣/g, '♣'); + str = str.replace(/♥/g, '♥'); + + str = str.replace(/♦/g, '♦'); + str = str.replace(/'/g, '\''); + return str; +} + +function strMoreDiscode(str){ + str = str.replace(/\r\n/g,""); + str = str.replace(/\n/g,""); + + str = str.replace(/code/g,"wxxxcode-style"); + return str; +} + +function strDiscode(str){ + str = strNumDiscode(str); + str = strGreeceDiscode(str); + str = strcharacterDiscode(str); + str = strOtherDiscode(str); + str = strMoreDiscode(str); + return str; +} +function urlToHttpUrl(url,rep){ + + var patt1 = new RegExp("^//"); + var result = patt1.test(url); + if(result){ + url = rep+":"+url; + } + return url; +} + +module.exports = { + strDiscode:strDiscode, + urlToHttpUrl:urlToHttpUrl +} \ No newline at end of file diff --git a/wxParse/wxParse.js b/wxParse/wxParse.js new file mode 100644 index 0000000..44709cf --- /dev/null +++ b/wxParse/wxParse.js @@ -0,0 +1,240 @@ +/** + * author: Di (微信小程序开发工程师) + * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) + * 垂直微信小程序开发交流社区 + * + * github地址: https://github.com/icindy/wxParse + * + * for: 微信小程序富文本解析 + * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 + */ + +/** + * utils函数引入 + **/ +import showdown from './showdown.js'; +import HtmlToJson from './html2json.js'; +/** + * 配置及公有属性 + **/ +var realWindowWidth = 0; +var realWindowHeight = 0; +wx.getSystemInfo({ + success: function (res) { + realWindowWidth = res.windowWidth + realWindowHeight = res.windowHeight + } +}) +/** + * 主函数入口区 + **/ +function wxParse(bindName = 'wxParseData', type='html', data='
数据不能为空
', target,imagePadding) { + + var that = target; + var transData = {};//存放转化后的数据 + + if (type == 'html') { + transData = HtmlToJson.html2json(data, bindName); + + } else if (type == 'md' || type == 'markdown') { + var converter = new showdown.Converter(); + var html = converter.makeHtml(data); + transData = HtmlToJson.html2json(html, bindName); + } + transData.view = {}; + transData.view.imagePadding = 0; + if(typeof(imagePadding) != 'undefined'){ + transData.view.imagePadding = imagePadding + } + var bindData = {}; + bindData[bindName] = transData; + + + + that.setData(bindData) + + + that.wxParseImgLoad = wxParseImgLoad; + that.wxParseImgTap = wxParseImgTap; +} + + + +//-------------------------- +// 图片点击事件 +//-------------------------- +function wxParseImgTap(e) { + var nowImgUrl = e.currentTarget.dataset.src; + var urls = []; + urls[0] = e.currentTarget.dataset.src; + wx.previewImage({ + current: e.currentTarget.dataset.src, + urls: urls, + }) +} + + + + +//-------------------------- +// 图片视觉宽高计算函数区 +//-------------------------- +function wxParseImgLoad(e) { + + var that = this; + var tagFrom = e.target.dataset.from; + var idx = e.target.dataset.idx; + + if (typeof (tagFrom) != undefined ) { + calMoreImageInfo(e, idx, that, tagFrom) + } +} + +//-------------------------- +// 假循环获取计算图片视觉最佳宽高 +//-------------------------- + +function calMoreImageInfo(e, idx, that, bindName) { + + var temData = that.data[bindName]; + + if (that.data.ground_text != undefined) { + if (that.data.ground_text.length > 0) { + for (var i = 0; i < that.data.ground_text.length; i++) { + if (that.data.ground_text[i].node == bindName) { + temData = that.data.ground_text[i] + } + } + } + } + + if (that.data.problem_text != undefined){ + if (that.data.problem_text.length > 0) { + for (var i = 0; i < that.data.problem_text.length;i++){ + if (that.data.problem_text[i].node == bindName){ + temData = that.data.problem_text[i] + } + } + } + } + + if (temData!=undefined){ + + + if (temData.images!=undefined){ + + if (!temData || temData.images.length == 0) { + return; + } + var temImages = temData.images; + + //因为无法获取view宽度 需要自定义padding进行计算,稍后处理 + var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName); + temImages[idx].width = recal.imageWidth; + temImages[idx].height = recal.imageheight; + temData.images = temImages; + var bindData = {}; + bindData[bindName] = temData; + that.setData(bindData); + var index = temImages[idx].index + var key = `${bindName}` + for (var i of index.split('.')) key+=`.nodes[${i}]` + var keyW = key + '.width' + var keyH = key + '.height' + that.setData({ + [keyW]: recal.imageWidth, + [keyH]: recal.imageheight, + }) + + } + } +} + + +//-------------------------- +// 计算视觉优先的图片宽高 +//-------------------------- + +function wxAutoImageCal(originalWidth, originalHeight,that,bindName) { + //获取图片的原始长宽 + var windowWidth = 0, windowHeight = 0; + var autoWidth = 0, autoHeight = 0; + var results = {}; + + + + //定义地面课程 + if (that.data.ground_text!=undefined){ + if (that.data.ground_text.length>0){ + for (var i = 0; i < that.data.ground_text.length; i++) { + if (that.data.ground_text[i].node == bindName) { + var padding = that.data.ground_text[i].view.imagePadding; + } + } + } + } + + //定义问题 + if (that.data.problem_text != undefined) { + if (that.data.problem_text.length > 0) { + for (var i = 0; i < that.data.problem_text.length; i++) { + if (that.data.problem_text[i].node == bindName) { + var padding = that.data.problem_text[i].view.imagePadding; + } + } + } + } + + windowWidth = realWindowWidth-2*padding; + windowHeight = realWindowHeight; + //判断按照那种方式进行缩放 + // console.log("windowWidth" + windowWidth); + if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候 + autoWidth = windowWidth; + // console.log("autoWidth" + autoWidth); + autoHeight = (autoWidth * originalHeight) / originalWidth; + // console.log("autoHeight" + autoHeight); + results.imageWidth = autoWidth; + results.imageheight = autoHeight; + } else {//否则展示原来的数据 + results.imageWidth = originalWidth; + results.imageheight = originalHeight; + } + return results; +} + + +//-------------------------- +// +//-------------------------- +function wxParseTemArray(temArrayName,bindNameReg,total,that){ + var array = []; + var temData = that.data; + var obj = null; + for(var i = 0; i < total; i++){ + var simArr = temData[bindNameReg+i].nodes; + array.push(simArr); + } + + temArrayName = temArrayName || 'wxParseTemArray'; + obj = JSON.parse('{"'+ temArrayName +'":""}'); + obj[temArrayName] = array; + that.setData(obj); +} + +//-------------------------- +// +//-------------------------- + +function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){ + HtmlToJson.emojisInit(reg,baseSrc,emojis); +} + + +module.exports = { + wxParse: wxParse, + wxParseTemArray:wxParseTemArray, + emojisInit:emojisInit +} + + diff --git a/wxParse/wxParse.wxml b/wxParse/wxParse.wxml new file mode 100644 index 0000000..beec33a --- /dev/null +++ b/wxParse/wxParse.wxml @@ -0,0 +1,967 @@ + + + + + + + + + + + + +