|
@@ -33,8 +33,7 @@ Page({
|
|
|
previewHeight: '',
|
|
|
productionMore: '',
|
|
|
questionsMore: '',
|
|
|
- wxObjectives: [],
|
|
|
- shareImgSrc: ''
|
|
|
+ wxObjectives: []
|
|
|
},
|
|
|
|
|
|
/* 区分答疑和分享 */
|
|
@@ -206,58 +205,11 @@ Page({
|
|
|
},
|
|
|
|
|
|
onShow: function () {
|
|
|
- //2. canvas绘制文字和图片
|
|
|
- const ctx = wx.createCanvasContext('myCanvas');
|
|
|
- var imgPath = '../image/bg_1.png'
|
|
|
- ctx.setFillStyle('red')
|
|
|
- ctx.fillRect(10, 10, 150, 75)
|
|
|
-
|
|
|
- ctx.drawImage(imgPath, 30, 10, 60, 60);
|
|
|
-
|
|
|
- ctx.setFontSize(12)
|
|
|
- ctx.setFillStyle('#6F6F6F')
|
|
|
- ctx.fillText('妖妖灵', 10, 10)
|
|
|
- ctx.draw();
|
|
|
+
|
|
|
},
|
|
|
keep: function () {
|
|
|
- wx.canvasToTempFilePath({
|
|
|
- x: 0,
|
|
|
- y: 0,
|
|
|
- width: 600,
|
|
|
- height: 800,
|
|
|
- destWidth: 600,
|
|
|
- destHeight:800,
|
|
|
- canvasId: 'myCanvas',
|
|
|
- success: (res) => {
|
|
|
- console.log('canvas'+res.tempFilePath);
|
|
|
- this.setData({
|
|
|
- shareImgSrc : res.tempFilePath
|
|
|
- })
|
|
|
|
|
|
- },
|
|
|
- fail:function (res) {
|
|
|
- console.log(res)
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- wx.saveImageToPhotosAlbum({
|
|
|
- filePath:this.data.shareImgSrc,
|
|
|
- success(res) {
|
|
|
- wx.showModal({
|
|
|
- title: '存图成功',
|
|
|
- content: '图片成功保存到相册了,去发朋友圈',
|
|
|
- showCancel:false,
|
|
|
- confirmText:'好哒',
|
|
|
- confirmColor:'#72B9C3',
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('用户点击确定');
|
|
|
- }
|
|
|
- //that.hideShareImg()
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
},
|
|
|
/* 转发*/
|
|
|
onShareAppMessage: function (ops) {
|
|
@@ -279,4 +231,83 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ /*授权后执行的事件*/
|
|
|
+ impower: function (e) {
|
|
|
+ console.log(e)
|
|
|
+ const columnId = util.column('6').columnId;
|
|
|
+ /* 分享 */
|
|
|
+ this.distinction(2, columnId, 1, 2, res => {
|
|
|
+ if(res.data.success) {
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.setData({
|
|
|
+ productionData: res.data.data
|
|
|
+ })
|
|
|
+ if(res.data.data) {
|
|
|
+ if(res.data.data.totalSize > 2) {
|
|
|
+ this.setData({
|
|
|
+ productionMore: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /* 答疑 */
|
|
|
+ this.distinction(1, columnId, 1, 2, res => {
|
|
|
+ if(res.data.success) {
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.setData({
|
|
|
+ questionsData: res.data.data
|
|
|
+ })
|
|
|
+ if(res.data.data) {
|
|
|
+ this.setData({
|
|
|
+ questionsdian: util.replyNo(res.data.data.list)
|
|
|
+ })
|
|
|
+ if(res.data.data.totalSize > 2) {
|
|
|
+ this.setData({
|
|
|
+ questionsMore: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /*科目信息*/
|
|
|
+ login.getOpenidSessionKey((res) => {
|
|
|
+ APIClient.getEachSchedule({
|
|
|
+ uid: res.data.data.uid
|
|
|
+ }, {
|
|
|
+ "category": 6
|
|
|
+ }).success((res) => {
|
|
|
+ const lessonListLength = res.data.data.lessonPage.list.length;
|
|
|
+ const previewLength = util.preview(res.data.data.lessonPage.list).length;
|
|
|
+ if(lessonListLength > 4) {
|
|
|
+ this.setData({
|
|
|
+ lessonListHeight: 280
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(previewLength > 4){
|
|
|
+ this.setData({
|
|
|
+ previewHeight: 280
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ courseData: res.data.data,
|
|
|
+ list: util.studyPageTime(res.data.data.lessonPage.list),
|
|
|
+ wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, function() {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
|
|
|
+ showCancel: false,
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击确定')
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
})
|