123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- //index.js
- //获取应用实例
- const app = getApp();
- const api = app.api;
- Page({
- data: {
- motto: 'Hello World',
- isShowPop: false,
- userInfo: {},
- hasUserInfo: false,
- settleInfo: undefined,
- bannerList: undefined,
- canIUse: wx.canIUse('button.open-type.getUserInfo'),
- banner: ['https://resource.artouchstone.com/miniapp/artist/images/index/banner.png', 'https://resource.artouchstone.com/miniapp/artist/images/index/banner.png','https://resource.artouchstone.com/miniapp/artist/images/index/banner.png'],
- bannerIndex: 0,
- swiper:{
- indicatorDots: false,
- vertical: false,
- autoplay: true,
- interval: 5000,
- duration: 500
- }
- },
- //事件处理函数
- bindViewTap: function() {
- wx.navigateTo({
- url: '../logs/logs'
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- getData(opt) {
- this.getUserSettleInfo();
- this.getBanner();
- if(opt){
- opt()
- }
- },
- getUserSettleInfo(opt){
- app.post(api.getUserSettleInfo,{},{
- needToken:false
- }).then(res => {
- console.log(res);
- this.setData({
- settleInfo: res.data
- })
- if(opt){
- opt()
- }
-
- })
- },
- getBanner(){
- app.post(api.getBanner,{code:'banner'},{ needToken:false}).then(res => {
- console.log(res);
- this.setData({
- bannerList: res.data
- })
- })
- },
- onShareAppMessage(){
- },
- currentHandle(e) {
- let {
- current
- } = e.detail
- this.setData({
- bannerIndex:current
- })
- },
- onLoad: function () {
- if (app.globalData.userInfo) {
- this.setData({
- userInfo: app.globalData.userInfo,
- hasUserInfo: true
- })
- } else if (this.data.canIUse){
- // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
- // 所以此处加入 callback 以防止这种情况
- app.userInfoReadyCallback = res => {
- this.setData({
- userInfo: res.userInfo,
- hasUserInfo: true
- })
- }
- } else {
- // 在没有 open-type=getUserInfo 版本的兼容处理
- wx.getUserInfo({
- success: res => {
- app.globalData.userInfo = res.userInfo
- this.setData({
- userInfo: res.userInfo,
- hasUserInfo: true
- })
- }
- })
- }
- this.getData()
- },
- getUserInfo: function(e) {
- // console.log(e)
- app.globalData.userInfo = e.detail.userInfo
- this.setData({
- userInfo: e.detail.userInfo,
- hasUserInfo: true
- })
- },
- onSwiperTap: function(e){
- let index = e.target.dataset.index;
- wx.navigateTo({
- url: this.data.bannerList[index].redirectUrl
- })
- },
- enterMall: function () {
- const that = this;
- this.getUserSettleInfo(function(){
- const settleInfo = that.data.settleInfo;
- if(settleInfo.isVerification==0){
- that.showPop()
- }else if(settleInfo.artistCaStatus && settleInfo.artistCaStatus === 2){
- //艺术家认证通过
- wx.navigateTo({
- url: '/pages/user/artUpload/artUpload'
- })
- }else if(settleInfo.curatorCaStatus && settleInfo.curatorCaStatus === 1){
- //策展人认证中
- wx.navigateTo({
- url: '/pages/settled/success/success'
- })
- }else if(settleInfo.curatorCaStatus && settleInfo.curatorCaStatus === 2){
- //策展人认证通过
- wx.navigateTo({
- // url: '/pages/user/artUpload/artUpload'
- url: '/pages/settled/contacts/contacts'
- })
- }else if(settleInfo.companyCaStatus && settleInfo.companyCaStatus == 1){
- //公司入驻审核中
- wx.navigateTo({
- url: '/pages/settled/success/success'
- })
- }else if(settleInfo.companyCaStatus && settleInfo.companyCaStatus == 2){
- //公司入驻审核通过
- wx.navigateTo({
- url: '/pages/settled/contacts/contacts'
- })
- }else{
- wx.navigateTo({
- url: '/pages/settled/index/index'
- })
- }
- });
- },
- showPop(){
- this.setData({
- isShowPop:true
- });
- },
- hidePop(){
- this.setData({
- isShowPop:false
- });
- },
- /**
- * 邀请参展
- */
- invitation: function() {
- wx.navigateTo({
- url: '/pages/invitation/index/index',
- })
- }
- })
|