|
- // pages/index/sw/index.js
- const Http = require("../../utils/HttpBasics");
- var config = require("../../config/config.js");
- let app = getApp();
- Component({
- properties: {
- gamedata: {
- type: Object,
- value: {}
- }
- },
- data: {
- flag: false,
- alphaData: null,
- gameUrl: ''
- },
- methods:{
- gotogame: function (e) {
- let that=this;
- Http.get({
- url: config.api.checkUserStatus,
- data: {
- token: app.globalData.token
- }
- }).then(res1 => {
- Http.get({
- url: config.api.checkPhoneStatus,
- data: {}
- }).then(res => {
- var data = {
- couponChannelId: "" + that.data.couponChannelId,
- couponId: "" + that.data.couponId
- };
- if (that.data.couponChannelId == null) {
- var data = {
- couponId: "" + that.data.couponId
- };
- }
- wx.redirectTo({
- url: '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
- })
- }).catch(err => {
- if (err.code == 11005) {
- // 用户手机未授权
- /**
- * 将值传到用户手机号授权的页面
- *
- */
- app.globalData.skipUrl = '/pages/game/index?url=' + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
- app.globalData.skip = 'redirectTo'
- wx.redirectTo({
- url: "/pages/getphoneInfo/index?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
- });
- } else if (err.code == 11006) {
- // 用户手机已加密
- wx.redirectTo({
- url: "/pages/phoneinput/phoneinput?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
- });
- } else {
- wx.showToast({
- title: err.message,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- }
- })
- }).catch(err => {
- if (err.code == 11004) { //未授权微信
- app.globalData.type = 'gm'
- wx.redirectTo({
- url: "/pages/getuserinfo/index?path=index&url=" + e.target.dataset.data.url + "&id=" + e.target.dataset.data.id + "&gameId=" + e.target.dataset.data.gameId,
- });
- } else {
- wx.showToast({
- title: err.message,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- }
- })
- },
- a: function () {
- this.setData({ flag: false })
- },
- closeGame: function () {
- let that = this;
- var animation = wx.createAnimation({})
- // animation.opacity(0).step({ duration: 1000 })
- setTimeout(function () {
- that.setData({ flag: true })
- }, 500)
- animation.rotateZ(180).scale(0).opacity(0.5).step({ duration: 1000 })
- that.setData({ alphaData: animation.export() });
- },
- },
- });
|