Browse Source

no message

featrue/v4.1
xpz2018 5 years ago
parent
commit
820dbbe7e1
11 changed files with 87 additions and 27 deletions
  1. 2
      pages/api/moment.js
  2. 2
      pages/api/payment.js
  3. 2
      pages/api/saas.js
  4. 2
      pages/api/user.js
  5. 2
      pages/api/ztb.js
  6. 59
      pages/home/pindex/index.js
  7. 17
      pages/home/pindex/index.wxml
  8. 5
      pages/index/index.js
  9. 20
      pages/order/index/index.js
  10. 2
      pages/order/index/index.wxml
  11. 1
      pages/paper/index.json

2
pages/api/moment.js

@ -5,7 +5,7 @@ import { mGet, mPost } from "./request"
const app = getApp() const app = getApp()
const mconfig = { const mconfig = {
baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `http://47.113.118.47:9000`
baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `https://api-client-ztb-test.qniao.cn`
} }
// *******************************************************************账户业务*********************************************************** // *******************************************************************账户业务***********************************************************
// /article/save/Article 发文章 // /article/save/Article 发文章

2
pages/api/payment.js

@ -5,7 +5,7 @@ import { mGet, mPost } from "./request"
const app = getApp() const app = getApp()
const pconfig = { const pconfig = {
baseUrl: app.release ? `http://api-client-psc.qniao.cn` : `http://47.113.118.47:9000`
baseUrl: app.release ? `http://api-client-psc.qniao.cn` : `http://api-client-psc-test.qniao.cn`
} }
// *******************************************************账户业务*********************************************************** // *******************************************************账户业务***********************************************************
const getBankcardInfo = (cardNo) => mGet(`/payment-settlement-center/bankcard/bankcard/home/${cardNo}`, null, pconfig) const getBankcardInfo = (cardNo) => mGet(`/payment-settlement-center/bankcard/bankcard/home/${cardNo}`, null, pconfig)

2
pages/api/saas.js

@ -5,7 +5,7 @@ import { mGet, mPost, mDelete, mPut } from "./request"
const app = getApp() const app = getApp()
const sconfig = { const sconfig = {
baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `http://47.113.118.47:9000`
baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `https://api-client-ztb-test.qniao.cn`
} }
// *******************************************************************账户业务*********************************************************** // *******************************************************************账户业务***********************************************************
const getOrderExists = () => mGet(`/saas-trade/receive/v150/get/OrderExists`, null, sconfig) const getOrderExists = () => mGet(`/saas-trade/receive/v150/get/OrderExists`, null, sconfig)

2
pages/api/user.js

@ -11,7 +11,7 @@ const storage = require('../../utils/storage')
const app = getApp() const app = getApp()
const config = { const config = {
baseUrl: app.release ? 'https://api-client-uec.qniao.cn' : 'https:/api-client-uec-dev.qniao.cn'
baseUrl: app.release ? 'https://api-client-uec.qniao.cn' : 'https:/api-client-uec-test.qniao.cn'
} }
const wechatApplet = (params) => mPost('/uec/get/wechat-applet-session', params, config) const wechatApplet = (params) => mPost('/uec/get/wechat-applet-session', params, config)
const loginCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config) const loginCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config)

2
pages/api/ztb.js

@ -5,7 +5,7 @@ import { mGet, mPost } from "./request"
const app = getApp() const app = getApp()
const zconfig = { const zconfig = {
baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `http://47.113.118.47:9000`
baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `https://api-client-ztb-test.qniao.cn`
} }
// *******************************************************************账户业务*********************************************************** // *******************************************************************账户业务***********************************************************
// /authorize/get/product-line-token/by/login-token通过登录token获取产品线token // /authorize/get/product-line-token/by/login-token通过登录token获取产品线token

59
pages/home/pindex/index.js

@ -2,6 +2,7 @@
import { getBaseInfo, getBalanceInfo } from "../../api/saas" import { getBaseInfo, getBalanceInfo } from "../../api/saas"
const util = require('../../../utils/util') const util = require('../../../utils/util')
const math = require('../../../utils/math') const math = require('../../../utils/math')
const event = require('../../../utils/event')
const app = getApp() const app = getApp()
Component({ Component({
@ -9,6 +10,15 @@ Component({
addGlobalClass: true, addGlobalClass: true,
multipleSlots: true multipleSlots: true
}, },
lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
attached: function () {
event.on('EventMessage', this, this.onEvent)
},
detached: function () {
event.remove('EventMessage', this)
}
},
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
@ -16,6 +26,7 @@ Component({
firstShow: false, firstShow: false,
token: app.globalData.token, token: app.globalData.token,
userInfo: null, userInfo: null,
userName: null,
avatarUrl: null, avatarUrl: null,
accountMoney: 0 accountMoney: 0
}, },
@ -25,6 +36,9 @@ Component({
this.data.firstShow = true this.data.firstShow = true
}, },
fetchUserInfo: function () { fetchUserInfo: function () {
if(!app.globalData.userInfo){
return
}
getBaseInfo().then(result => { getBaseInfo().then(result => {
app.globalData.userInfo = result.data app.globalData.userInfo = result.data
this.setData({ this.setData({
@ -39,10 +53,23 @@ Component({
}).catch(err => { }).catch(err => {
}) })
}, },
onEvent: function (message) {
if (message.what == 888) {
this.setData({ userInfo: app.globalData.userInfo, accountMoney: 0, avatarUrl: '/assets/image/ygImg.png', userName: null })
}
},
checkout: function () { checkout: function () {
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
return
}
wx.navigateTo({ url: '/pages/withdrawal/checkout/index' }) wx.navigateTo({ url: '/pages/withdrawal/checkout/index' })
}, },
toUserInfo: function () { toUserInfo: function () {
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
return
}
if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){ if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){
wx.navigateTo({ url: '/pages/home/pauthory/index' }) wx.navigateTo({ url: '/pages/home/pauthory/index' })
} else { } else {
@ -50,11 +77,43 @@ Component({
} }
}, },
toAuthor: function () { toAuthor: function () {
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
return
}
if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){ if(app.globalData.userInfo.isAuth != 1 && app.globalData.userInfo.userType == 1){
wx.navigateTo({ url: '/pages/home/pauthory/index' }) wx.navigateTo({ url: '/pages/home/pauthory/index' })
} else { } else {
wx.navigateTo({ url: '/pages/home/pinfo/index' }) wx.navigateTo({ url: '/pages/home/pinfo/index' })
} }
},
toBankCard: function () {
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
return
}
wx.navigateTo({ url: '/pages/bank/index/index' })
},
toWithdrawal: function () {
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
return
}
wx.navigateTo({ url: '/pages/withdrawal/index/index' })
},
toBalance: function () {
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
return
}
wx.navigateTo({ url: '/pages/balance/index/index' })
},
toSetting: function () {
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
return
}
wx.navigateTo({ url: '/pages/home/setting/index' })
} }
} }
}) })

17
pages/home/pindex/index.wxml

@ -3,14 +3,14 @@
<view slot="content" style="color:black;font-size:18px">我的</view> <view slot="content" style="color:black;font-size:18px">我的</view>
</cu-custom> </cu-custom>
<view class="header-box flex flex-justify" style="padding:32rpx" wx:if="{{userInfo}}" bindtap="toUserInfo">
<view class="header-box flex flex-justify" style="padding:32rpx" bindtap="toUserInfo">
<view class="flex"> <view class="flex">
<wux-image width="{{60}}" height="{{60}}" wux-class="image" shape="circle" src="{{avatarUrl}}" /> <wux-image width="{{60}}" height="{{60}}" wux-class="image" shape="circle" src="{{avatarUrl}}" />
<view class="flex flex-column flex-center" style="margin-left:24rpx;align-items:flex-start"> <view class="flex flex-column flex-center" style="margin-left:24rpx;align-items:flex-start">
<view class="flex flex-center"> <view class="flex flex-center">
<text style="white-space: nowrap">{{userName || ''}}</text>
<text style="white-space: nowrap">{{userName || '您还没有登录,去登录'}}</text>
</view> </view>
<view class="flex flex-center" style="font-size:13px" catchtap="toAuthor">
<view class="flex flex-center" style="font-size:13px" catchtap="toAuthor" wx:if="{{userInfo}}">
<image class="img-auth2" src="{{userInfo.isAuth == 1 ? '/assets/image/icon_author.png' : '/assets/image/icon_unauthor.png'}}"></image> <image class="img-auth2" src="{{userInfo.isAuth == 1 ? '/assets/image/icon_author.png' : '/assets/image/icon_unauthor.png'}}"></image>
<text class="{{userInfo.isAuth == 1 ? 'text-blue' : 'text-gray'}}">{{userInfo.isAuth == 1 ? '已认证' : '未实名认证'}}</text> <text class="{{userInfo.isAuth == 1 ? 'text-blue' : 'text-gray'}}">{{userInfo.isAuth == 1 ? '已认证' : '未实名认证'}}</text>
<text class="text-yellow" style="font-size:14px;padding:4px;" wx:if="{{userInfo.isAuth != 1 && userInfo.userType == 1}}">去认证</text> <text class="text-yellow" style="font-size:14px;padding:4px;" wx:if="{{userInfo.isAuth != 1 && userInfo.userType == 1}}">去认证</text>
@ -33,13 +33,13 @@
</view> </view>
<wux-cell-group> <wux-cell-group>
<wux-cell title="银行卡" is-link url="/pages/bank/index/index">
<wux-cell title="银行卡" is-link bind:click="toBankCard">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_bank.png"></image> <image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_bank.png"></image>
</wux-cell> </wux-cell>
<wux-cell title="提现记录" is-link url="/pages/withdrawal/index/index">
<wux-cell title="提现记录" is-link bind:click="toWithdrawal">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_withdrawal.png"></image> <image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_withdrawal.png"></image>
</wux-cell> </wux-cell>
<wux-cell title="收支明细" is-link url="/pages/balance/index/index">
<wux-cell title="收支明细" is-link bind:click="toBalance">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_balance.png"></image> <image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_balance.png"></image>
</wux-cell> </wux-cell>
</wux-cell-group> </wux-cell-group>
@ -48,10 +48,7 @@
<wux-cell title="联系客服" is-link url="/pages/home/service/index"> <wux-cell title="联系客服" is-link url="/pages/home/service/index">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_kefu.png"></image> <image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_kefu.png"></image>
</wux-cell> </wux-cell>
<wux-cell title="设置" is-link url="/pages/home/setting/index">
<wux-cell title="设置" is-link bind:click="toSetting">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_setting.png"></image> <image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_setting.png"></image>
</wux-cell> </wux-cell>
<!-- <wux-cell title="二维码分享" is-link url="/pages/home/share/index">
<view slot="header" class="cuIcon-qr_code text-blue" style="width:32rpx;height:32rpx;margin:8rpx 12rpx 0rpx 0rpx"></view>
</wux-cell> -->
</wux-cell-group> </wux-cell-group>

5
pages/index/index.js

@ -39,6 +39,7 @@ Page({
this.data.path += '?' + options.key + '=' + options.value this.data.path += '?' + options.key + '=' + options.value
} }
} }
event.on('EventMessage', this, this.onEvent)
}, },
onReady: function () { onReady: function () {
wx.showLoading({ title: '获取中', mask: true }) wx.showLoading({ title: '获取中', mask: true })
@ -189,6 +190,7 @@ Page({
if(message.what == 250){ if(message.what == 250){
this.setData({ pageIndex: 0 }) this.setData({ pageIndex: 0 })
} else if(message.what == 884){ } else if(message.what == 884){
console.log('navigateBack>>')
wx.navigateBack() wx.navigateBack()
} }
}, },
@ -216,5 +218,8 @@ Page({
return return
} }
util.navigateTarget(this.data.landInfo.ruleRedirectInfo) util.navigateTarget(this.data.landInfo.ruleRedirectInfo)
},
onUnload: function(){
event.remove('EventMessage', this)
} }
}) })

20
pages/order/index/index.js

@ -42,7 +42,7 @@ Component({
methods: { methods: {
onRestart: function () { onRestart: function () {
if (!this.data.firstShow) { if (!this.data.firstShow) {
this.setData({ height: app.globalData.fragmentHeight - 100 })
this.setData({userInfo: app.globalData.userInfo, height: app.globalData.fragmentHeight - 100 })
this.fetchOrderList() this.fetchOrderList()
} }
this.data.firstShow = true this.data.firstShow = true
@ -50,6 +50,9 @@ Component({
onEvent: function (message) { onEvent: function (message) {
if (message.what == 13) { if (message.what == 13) {
this.onRefreshList() this.onRefreshList()
} else if (message.what == 888) {
this.setData({
userInfo: app.globalData.userInfo, orderList: [], loading: false })
} }
}, },
onRefreshList: function () { onRefreshList: function () {
@ -63,6 +66,10 @@ Component({
this.fetchOrderList() this.fetchOrderList()
}, },
fetchOrderList: function () { fetchOrderList: function () {
if (!app.globalData.userInfo) {
this.setData({ requesting: false, loading: false })
return
}
if (this.data.requesting || this.data.finished) { if (this.data.requesting || this.data.finished) {
return return
} }
@ -86,18 +93,11 @@ Component({
loading: false loading: false
}) })
} else { } else {
this.setData({
finished: true,
requesting: false,
loading: false
})
this.setData({ finished: true, requesting: false, loading: false })
} }
}).catch(err => { }).catch(err => {
//异常回调 //异常回调
this.setData({
requesting: false,
loading: false
})
this.setData({ requesting: false, loading: false })
util.showToast(err) util.showToast(err)
}) })
}, },

2
pages/order/index/index.wxml

@ -19,7 +19,7 @@
<view class="list-empty" style="height:{{ stick ? height : (height - 440)}}rpx"> <view class="list-empty" style="height:{{ stick ? height : (height - 440)}}rpx">
<view class="load-spinner text-gray" style="margin-bottom:24px" wx:if="{{loading}}" /> <view class="load-spinner text-gray" style="margin-bottom:24px" wx:if="{{loading}}" />
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image> <image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
<view class="text-empty">{{loading? '正在加载' : userInfo ? '暂无数据' : '你还没登录'}}</view>
</view> </view>
</view> </view>
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex"> <view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex">

1
pages/paper/index.json

@ -1,7 +1,6 @@
{ {
"disableScroll": true, "disableScroll": true,
"usingComponents": { "usingComponents": {
"message": "/pages/message/index",
"order": "/pages/order/index/index", "order": "/pages/order/index/index",
"home": "/pages/home/pindex/index" "home": "/pages/home/pindex/index"
} }
Loading…
Cancel
Save