Browse Source

no message

featrue/v.4.0
xpz2018 5 years ago
parent
commit
745a11a4fb
7 changed files with 112 additions and 16 deletions
  1. 2
      app.js
  2. 4
      components/popup/index.wxss
  3. 49
      pages/index/index.js
  4. 4
      pages/index/index.json
  5. 33
      pages/index/index.wxml
  6. 27
      pages/index/index.wxss
  7. 9
      utils/request.js

2
app.js

@ -1,7 +1,7 @@
//app.js //app.js
App({ App({
//----------------------------------------------globalData-------------------------------------- //----------------------------------------------globalData--------------------------------------
release: 1,
release: 0,
httpUrl: 'https://api.qniao.cn', httpUrl: 'https://api.qniao.cn',
tmplIds: ['SUjEgwDopCv9xkkSZ4KbS0L7XbAiVQor6GmPg14K760'], tmplIds: ['SUjEgwDopCv9xkkSZ4KbS0L7XbAiVQor6GmPg14K760'],
agentMsgIds: ['kG8DErWDpyzBHCFaLlSKYMF7xVy8UpgogCwV_WSNt10', 'oLbv-IyJOia2tenh64_Lc8xeAzwgzu3gh1vFJ1Se-ME'], agentMsgIds: ['kG8DErWDpyzBHCFaLlSKYMF7xVy8UpgogCwV_WSNt10', 'oLbv-IyJOia2tenh64_Lc8xeAzwgzu3gh1vFJ1Se-ME'],

4
components/popup/index.wxss

@ -1,8 +1,8 @@
.wux-popup { .wux-popup {
position: fixed; position: fixed;
z-index: 1000; z-index: 1000;
width: 80%;
max-width: 600rpx
width: 100%;
max-width: 680rpx
} }
.wux-popup-position.wux-popup-position--center .wux-popup { .wux-popup-position.wux-popup-position--center .wux-popup {
top: 50%; top: 50%;

49
pages/index/index.js

@ -13,7 +13,9 @@ Page({
pageIndex: 1, pageIndex: 1,
safeBottom: app.globalData.safeBottom, safeBottom: app.globalData.safeBottom,
inited: false, inited: false,
path: null
path: null,
landInfo: null,
visible: false
}, },
/************************************** 初始化流程 ********************************************/ /************************************** 初始化流程 ********************************************/
onLoad: function (options) { onLoad: function (options) {
@ -71,7 +73,7 @@ Page({
this.fetchUserInfo() this.fetchUserInfo()
} else { } else {
wx.hideLoading() wx.hideLoading()
this.onResume()
this.toIndex()
} }
} }
}) })
@ -92,15 +94,36 @@ Page({
fetchUserInfo:function(){ fetchUserInfo:function(){
request.get('/recycle-service/user/get/base-info').then(result => { request.get('/recycle-service/user/get/base-info').then(result => {
app.globalData.userInfo = result.data app.globalData.userInfo = result.data
wx.hideLoading()
this.onResume()
if(this.data.path){
wx.navigateTo({ url: this.data.path })
var accessToken = wx.getStorageSync('accessToken')
if(accessToken){
app.globalData.userToken = accessToken
request.get('/saas-trade/receive/v150/get/OrderExists').then(result => {
wx.hideLoading()
if (Number(result.data) != 1 || !app.release) {
this.toIndex()
} else {
wx.reLaunch({ url: '/pages/paper/index' })
}
}).catch(err => {
//异常回调
wx.hideLoading()
this.toIndex()
})
} else {
wx.hideLoading()
this.toIndex()
} }
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
}) })
}, },
toIndex: function(){
this.onResume()
if(this.data.path){
wx.navigateTo({ url: this.data.path })
}
// 进行弹窗的dialog显示处理;
},
onResume: function(){ onResume: function(){
var pageView = this.selectComponent('#' + this.data.TabList[this.data.pageIndex].value) var pageView = this.selectComponent('#' + this.data.TabList[this.data.pageIndex].value)
if (pageView && this.data.inited) { if (pageView && this.data.inited) {
@ -128,5 +151,19 @@ Page({
}, },
stopTouchMove: function(e){ stopTouchMove: function(e){
return false return false
},
// 弹出框的处理;
onClose: function(){
this.setData({ visible: false, landInfo: null })
},
onImageLoad: function(){
this.setData({ visible: true })
},
onImageClick: function(){
console.log(this.data.landInfo)
this.setData({ visible: false, landInfo: null })
},
toRule: function(){
console.log('toRule>>>')
} }
}) })

4
pages/index/index.json

@ -2,6 +2,8 @@
"usingComponents": { "usingComponents": {
"mall": "/pages/mall/index/index", "mall": "/pages/mall/index/index",
"article": "/pages/article/index/index", "article": "/pages/article/index/index",
"home": "/pages/home/index/index"
"home": "/pages/home/index/index",
"wux-image": "/components/image/index",
"wux-popup": "/components/popup/index"
} }
} }

33
pages/index/index.wxml

@ -1,16 +1,39 @@
<wxs module="index" src="./index.wxs"></wxs> <wxs module="index" src="./index.wxs"></wxs>
<swiper current="{{pageIndex}}" duration="0" style="height:{{fragment}}rpx"> <swiper current="{{pageIndex}}" duration="0" style="height:{{fragment}}rpx">
<swiper-item catchtouchmove="stopTouchMove"><article id="{{TabList[0].value}}"/></swiper-item>
<swiper-item catchtouchmove="stopTouchMove"><mall id="{{TabList[1].value}}"/></swiper-item>
<swiper-item catchtouchmove="stopTouchMove"><home id="{{TabList[2].value}}"/></swiper-item>
<swiper-item catchtouchmove="stopTouchMove">
<article id="{{TabList[0].value}}" />
</swiper-item>
<swiper-item catchtouchmove="stopTouchMove">
<mall id="{{TabList[1].value}}" />
</swiper-item>
<swiper-item catchtouchmove="stopTouchMove">
<home id="{{TabList[2].value}}" />
</swiper-item>
</swiper> </swiper>
<view class="cu-bar tabbar bg-white shadow foot" style="height:{{100 + safeBottom}}rpx;padding-bottom:{{safeBottom}}rpx">
<view class="cu-bar tabbar bg-white shadow foot"
style="height:{{100 + safeBottom}}rpx;padding-bottom:{{safeBottom}}rpx">
<view wx:for="{{TabList}}" wx:key="index" class="action" bindtap="onNavChange" data-tab="{{item.index}}"> <view wx:for="{{TabList}}" wx:key="index" class="action" bindtap="onNavChange" data-tab="{{item.index}}">
<view class="cuIcon-cu-image"> <view class="cuIcon-cu-image">
<image mode="aspectFill" src="{{index.tabImage(pageIndex, item.index)}}"></image> <image mode="aspectFill" src="{{index.tabImage(pageIndex, item.index)}}"></image>
</view> </view>
<view class="{{pageIndex == item.index?'text-blue':'text-gray'}}">{{item.name}}</view> <view class="{{pageIndex == item.index?'text-blue':'text-gray'}}">{{item.name}}</view>
</view> </view>
</view>
</view>
<wux-popup wux-class="wux-landscape" wux-content-class="wux-landscape__popup" wux-body-class="wux-landscape__popup-body"
hasHeader="{{ false }}" hasFooter="{{ false }}" visible="{{ landInfo }}" mask="{{ true }}" bind:close="onClose">
<view class="wux-close" bindtap="onClose" wx:if="{{visible}}">
<text class="cuIcon-roundclose text-white" style="font-size:64rpx"></text>
</view>
<view class="wux-landscape__inner">
<wux-image width="{{654}}" height="{{680}}" nuit="{{'rpx'}}" src="{{'http://cdn.skyvow.cn/redpacket.png'}}"
bind:load="onImageLoad" bind:click="onImageClick">
<view class="flex flex-center" slot="loading" style="height:654rpx;width:680rpx">
<text class="icon--refresher"></text>
</view>
</wux-image>
<view class="text-df" style="color:#FFEF93;padding:12rpx 24rpx;margin-top:16rpx" catchtap="toRule" wx:if="{{visible}}">活动规则</view>
</view>
</wux-popup>

27
pages/index/index.wxss

@ -0,0 +1,27 @@
.wux-close {
width: 100%;
text-align: end;
display: inline-block;
padding-bottom: 24rpx;
}
.wux-landscape{
width: 100%;
max-width: 750rpx;
}
.wux-landscape__popup {
background-color: transparent!important
}
.wux-landscape__popup-body {
padding: 0!important
}
.wux-landscape__inner {
line-height: 1.5;
color: rgba(0,0,0,.65)
}
.wux-landscape__inner > image {
width: 100%;
max-width: 100%
}

9
utils/request.js

@ -21,6 +21,12 @@ function fun(url, method, data, header) {
app.globalData.token = authorization app.globalData.token = authorization
} }
} }
if(util.isEmpty(app.globalData.userToken)){
var userToken = wx.getStorageSync('userToken')
if (userToken) {
app.globalData.userToken = userToken
}
}
if(flag){ if(flag){
header = { header = {
'X-APP-ID': app.xAppId, 'X-APP-ID': app.xAppId,
@ -29,7 +35,8 @@ function fun(url, method, data, header) {
} }
} else { } else {
header = { header = {
'user-token': app.globalData.userToken,
'X-APP-ID': app.xAppId,
'user-token': '' + app.globalData.userToken,
appversion: app.version appversion: app.version
} }
} }

Loading…
Cancel
Save