123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- // pages/art/art.js
- const app = getApp()
- const util = require('../../utils/util.js');
- const APIClient = require('../../utils/APIClient.js');
- const login = require('../../utils/loginSchedule.js');
- Page({
- data: {
- flag: false,
- productionData: {},
- questionsData: {},
- courseData: {}
- },
- methods: {
- shareImage: function(e) {
- console.log(e.target.dataset.flag)
- }
- },
- onLoad: function (options) {
- //分享按钮
- wx.showShareMenu({
- withShareTicket: true
- })
- },
- onShow: function () {
- const columnId = util.column('5').columnId;
- /* 区分答疑和分享 */
- let distinction = (type, success) => {
- login.getOpenidSessionKey(function(res) {
- //console.log(res.data.data.uid);
- APIClient.getProductionSchedule({
- uid: res.data.data.uid
- }, {
- "type": type,
- "columnId": columnId,
- "pageNo": 1,
- "pageSize": 2
- }).success(success)
- }, function() {
- wx.showModal({
- title: '提示',
- content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- });
- };
- /* 分享 */
- distinction(2, res => {
- if(res.data.success) {
- console.log(res.data.data)
- this.setData({
- productionData: res.data.data,
- })
- }
-
- });
- /* 答疑 */
- distinction(1, res => {
- if(res.data.success) {
- console.log(res.data.data)
- this.setData({
- questionsData: res.data.data,
- })
- }
- });
- /*科目信息*/
- login.getOpenidSessionKey((res) => {
- //console.log(res.data.data.uid);
- APIClient.getEachSchedule({
- uid: res.data.data.uid
- }, {
- "category": 5
- }).success((res) => {
- //console.log('科目信息' + JSON.stringify(res));
- this.setData({
- courseData: res.data.data
- })
- })
- }, function() {
- wx.showModal({
- title: '提示',
- content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- });
- },
- /* 转发*/
- onShareAppMessage: function (ops) {
- if (ops.from === 'button') {
- // 来自页面内转发按钮
- console.log(ops.target)
- }
- const postId = ops.target.dataset.postid;
- return {
- title: '小学王者班',
- path: `pages/transmit/transmit?ind=7&postId=${postId}`,
- success: function (res) {
- // 转发成功
- console.log("转发成功:" + JSON.stringify(res));
- },
- fail: function (res) {
- // 转发失败
- console.log("转发失败:" + JSON.stringify(res));
- }
- }
- },
- })
|