1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // compontents/share/share.js
- const util = require('../../utils/util.js');
- const APIClient = require('../../utils/APIClient.js');
- const login = require('../../utils/loginSchedule.js');
- Component({
- /**
- * 组件的属性列表
- * grade年级
- */
- properties: {
- "grade": {
- type: String,
- value: ''
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- flag: true,
- gradeData: [
- '一年级',
- '二年级',
- '三年级',
- '四年级'
- ]
- },
- /**
- * 组件的方法列表
- */
- methods: {
- //隐藏框
- hidePopup: function () {
- this.setData({
- flag: !this.data.flag
- })
- },
- //展示框
- showPopup () {
- this.setData({
- flag: !this.data.flag
- })
- },
- grade (e) {
- const grade = e.currentTarget.dataset.grade + 1
- this.setData({
- grade: util.gradeUpper(grade)
- })
- //调用更改年级接口
- login.getOpenidSessionKey((res) => {
- //console.log(res.data.data.uid);
- APIClient.getSetNameSchedule({
- uid: res.data.data.uid
- }, {
- grade: grade
- }).success(res => {
- console.log(res)
- if(res.data.success) {
- wx.redirectTo({
- url: '../my/my?ind=0'
- })
- }
- })
- }, function() {
- wx.showModal({
- title: '提示',
- content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- });
- }
- }
- })
|