Browse Source

no message

featrue/v4.1
xpz2018 5 years ago
parent
commit
f278510f83
9 changed files with 157 additions and 194 deletions
  1. 4
      pages/api/payment.js
  2. 75
      pages/api/request.js
  3. 4
      pages/api/user.js
  4. 4
      pages/api/ztb.js
  5. 239
      pages/home/password/index.js
  6. 8
      pages/home/setting/index.wxml
  7. 8
      pages/ztbvip/index.js
  8. 7
      pages/ztbvip/index.wxml
  9. 2
      project.config.json

4
pages/api/payment.js

@ -5,9 +5,9 @@ import { mGet, mPost } from "./request"
const app = getApp() const app = getApp()
const pconfig = { const pconfig = {
baseUrl: app.release ? `https://psc.qniao.cn` : `http://psc-dev.qniao.cn`
baseUrl: app.release ? `http://api-client-ztb.qniao.cn` : `http://47.113.118.47:9000`
} }
// *******************************************************************账户业务***********************************************************
// *******************************************************账户业务***********************************************************
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)
const ocrBankcard = (params) => mPost(`/payment-settlement-center/bankcard/get/ocr/bankcard`, params, pconfig) const ocrBankcard = (params) => mPost(`/payment-settlement-center/bankcard/get/ocr/bankcard`, params, pconfig)
const verifyBankcard = (params) => mPost(`/payment-settlement-center/bankcard/post/verify/bankverify`, params, pconfig) const verifyBankcard = (params) => mPost(`/payment-settlement-center/bankcard/post/verify/bankverify`, params, pconfig)

75
pages/api/request.js

@ -50,7 +50,6 @@ axios.interceptors.response.use(
}, },
(err) => { (err) => {
// 做一些请求错误 // 做一些请求错误
console.error(err)
return Promise.reject(err) return Promise.reject(err)
} }
) )
@ -67,7 +66,40 @@ function handleResponse({ data, status }) {
} }
const STATUS = { const STATUS = {
"200"() { "200"() {
return handleResult(data)
if (data.code === 0) {
return Promise.resolve(data)
}
if (data.code === 401) {
app.globalData.token = null
app.globalData.userToken = null
app.globalData.userInfo = null
wx.removeStorageSync('Authorization')
event.emit('EventMessage', { what: 888, desc: 'Logout' })
let pages = getCurrentPages() //当前页面栈
let prevPage = pages[pages.length - 1] //当前页面
if (prevPage.route != 'pages/login/index') {
wx.showModal({
title: '温馨提示',
content: '登录信息已经过期,请重新登录',
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.navigateTo({ url: '/pages/login/index' })
}
}
})
}
var message = 'Token异常'
if (data.message) {
message = data.message
}
return Promise.reject(message)
}
var message = '数据错误'
if (data.message) {
message = data.message
}
return Promise.reject(message)
}, },
"400"() { "400"() {
return Promise.reject('请求错误') return Promise.reject('请求错误')
@ -89,41 +121,8 @@ function handleResponse({ data, status }) {
return STATUS[status] ? STATUS[status]() : Promise.reject('请求错误') return STATUS[status] ? STATUS[status]() : Promise.reject('请求错误')
} }
function handleResult(result) {
if (result.code === 0) {
return result
}
if (result.code === 401) {
app.globalData.token = null
app.globalData.userToken = null
app.globalData.userInfo = null
wx.removeStorageSync('Authorization')
event.emit('EventMessage', { what: 888, desc: 'Logout' })
let pages = getCurrentPages() //当前页面栈
let prevPage = pages[pages.length - 1] //当前页面
if (prevPage.route != 'pages/login/index') {
wx.showModal({
title: '温馨提示',
content: '登录信息已经过期,请重新登录',
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.navigateTo({ url: '/pages/login/index' })
}
}
})
}
var message = 'Token异常'
if (result.message) {
message = result.message
}
return Promise.reject(message)
}
var message = '数据错误'
if (result.message) {
message = result.message
}
return Promise.reject(message)
function handleResult(data) {
} }
export default axios export default axios
@ -140,7 +139,7 @@ export function mGet(url, params, config) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.get(url, params, config).then((res) => { axios.get(url, params, config).then((res) => {
resolve(res) resolve(res)
}).catch((err) => {
}).catch(err => {
reject(err) reject(err)
}) })
}) })

4
pages/api/user.js

@ -17,6 +17,7 @@ const wechatApplet = (params) => mPost('/uec/get/wechat-applet-session', params,
const loginCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config) const loginCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config)
const loginPwd = (params) => mPost(`/uec/authorize/by-password`, params, config) const loginPwd = (params) => mPost(`/uec/authorize/by-password`, params, config)
const postCaptcha = (params) => mPost(`/uec/get/auth-captcha`, params, config) const postCaptcha = (params) => mPost(`/uec/get/auth-captcha`, params, config)
const setPassword = (params) => mPost(`/uec/user/set/sign-in-password`, params, config)
const getUserInfo = (params) => mGet('/uec/get/user-info', params, config) const getUserInfo = (params) => mGet('/uec/get/user-info', params, config)
const getAuthSession = () => mGet('/uec/create/identity-auth-session', null, config) const getAuthSession = () => mGet('/uec/create/identity-auth-session', null, config)
const certificateImage = (params) => mPost('/uec/recognize/certificate-img', params, config) const certificateImage = (params) => mPost('/uec/recognize/certificate-img', params, config)
@ -190,5 +191,6 @@ export {
certificateImage, certificateImage,
certificateIdentity, certificateIdentity,
phoneWechat, phoneWechat,
loginWechat
loginWechat,
setPassword
} }

4
pages/api/ztb.js

@ -93,8 +93,6 @@ const getBillDetail = (id) => mGet(`/recycle-service/get/bill-detail/${id}`, nul
const sendCaptcha = (params) => mPost(`/recycle-service/send/captcha`, params, zconfig) const sendCaptcha = (params) => mPost(`/recycle-service/send/captcha`, params, zconfig)
const modifyMobile = (params) => mPost(`/recycle-service/user/modify/mobile`, params, zconfig) const modifyMobile = (params) => mPost(`/recycle-service/user/modify/mobile`, params, zconfig)
const modifyMemberInfo = (params) => mPost(`/recycle-service/user/update/member-info`, params, zconfig) const modifyMemberInfo = (params) => mPost(`/recycle-service/user/update/member-info`, params, zconfig)
const setPassword = (params) => mPost(`/recycle-service/user/set/sign-in-password`, params, zconfig)
const resetPassword = (params) => mPost(`/user-centre/commonLogin/resetPassword`, params, zconfig)
const getMessageList = (params) => mGet(`/message-center/message/get/message-list`, params, zconfig) const getMessageList = (params) => mGet(`/message-center/message/get/message-list`, params, zconfig)
const getNotificationList = (params) => mGet(`/message-center/message/get/notification-list`, params, zconfig) const getNotificationList = (params) => mGet(`/message-center/message/get/notification-list`, params, zconfig)
const readMessage = (params) => mPost(`/message-center/message/read`, params, zconfig) const readMessage = (params) => mPost(`/message-center/message/read`, params, zconfig)
@ -189,8 +187,6 @@ export {
sendCaptcha, sendCaptcha,
modifyMobile, modifyMobile,
modifyMemberInfo, modifyMemberInfo,
setPassword,
resetPassword,
getMessageList, getMessageList,
getNotificationList, getNotificationList,
readMessage, readMessage,

239
pages/home/password/index.js

@ -1,138 +1,105 @@
// // pages/home/password/index.js
// // 页面已经废弃,因为UEC的修改,暂时不会提供修改密码的功能
// import { $wuxCountDown } from '../../../components/index'
// import { setPassword } from '../../api/ztb'
// const request = require('../../../utils/request') //导入模块
// const util = require('../../../utils/util')
// const md5 = require('../../../utils/md5')
// const app = getApp()
// pages/home/password/index.js
// 页面已经废弃,因为UEC的修改,暂时不会提供修改密码的功能
import { $wuxCountDown } from '../../../components/index'
import { postCaptcha, setPassword } from "../../api/user"
const util = require('../../../utils/util')
const md5 = require('../../../utils/md5')
const app = getApp()
// Page({
// /**
// * 页面的初始数据
// */
// data: {
// second: null,
// codeEnable: true,
// pwdType: 'password',
// pwd_icon: 'attention',
// form: {
// mobile: null,
// password: null,
// verifyCode: null
// },
// requesting: false,
// first: false
// },
Page({
/**
* 页面的初始数据
*/
data: {
second: null,
codeEnable: true,
pwdType: 'password',
pwd_icon: 'attention',
form: {
mobile: null,
password: null,
verifyCode: null
},
requesting: false,
first: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ ['form.mobile']: app.globalData.userInfo.mobile })
if(options.from){
this.setData({ first: true })
}
},
bindForm: function (e) {
this.data.form[e.target.id] = e.detail.value
},
changePwd: function (e) {
if (this.data.pwdType === 'password') {
this.setData({ pwdType: 'text', pwd_icon: 'attentionforbid' })
} else {
this.setData({ pwdType: 'password', pwd_icon: 'attention' })
}
},
fetchCode: function () {
if (util.isEmpty(this.data.form.mobile)) {
util.showToast('请输入手机号码')
return
}
if (this.second && this.second.interval) return !1
wx.showLoading({ title: '正在获取', mask: true })
postCaptcha({ verifiableAccount: this.data.form.mobile, verifiableAccountType: 1, purpose: 2 }).then(result => {
wx.hideLoading()
this.setData({ codeEnable: false })
util.showToast('验证码已经发送')
this.second = new $wuxCountDown({
date: +(new Date) + 60000,
onEnd() {
this.setData({ second: '重新获取验证码', codeEnable: true })
},
render(date) {
const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
date.sec !== 0 && this.setData({ second: sec })
}
})
}).catch(error => {
wx.hideLoading()
util.showToast(error)
})
},
submitForm: function () {
if (this.data.requesting) {
return
}
if (util.isEmpty(this.data.form.mobile) && !this.data.first) {
util.showToast('请输入手机号码')
return
}
if (util.isEmpty(this.data.form.password)) {
util.showToast('请输入密码')
return
}
if (util.isEmpty(this.data.form.verifyCode) && !this.data.first) {
util.showToast('请输入验证码')
return
}
wx.showLoading({ title: '处理中', mask: true })
this.data.requesting = true
setPassword(this.data.form).then(res => {
wx.hideLoading()
util.showBackToast('设置成功')
}).catch(error => {
wx.hideLoading()
this.data.requesting = false
util.showToast(error)
})
},
onUnload: function(){
if(this.wuxCountDown){
this.wuxCountDown.stop()
this.wuxCountDown = null
}
}
// /**
// * 生命周期函数--监听页面加载
// */
// onLoad: function (options) {
// this.setData({
// ['form.mobile']: app.globalData.userInfo.mobile
// })
// if(options.from){
// this.setData({
// first: true
// })
// }
// },
// bindForm: function (e) {
// this.data.form[e.target.id] = e.detail.value
// },
// changePwd: function (e) {
// if (this.data.pwdType === 'password') {
// this.setData({
// pwdType: 'text'
// })
// this.setData({
// pwd_icon: 'attentionforbid'
// })
// } else {
// this.setData({
// pwdType: 'password'
// })
// this.setData({
// pwd_icon: 'attention'
// })
// }
// },
// fetchCode: function () {
// if (util.isEmpty(this.data.form.mobile)) {
// util.showToast('请输入手机号码')
// return
// }
// if (this.second && this.second.interval) return !1
// wx.showLoading({ title: '正在获取', mask: true })
// // //commonLogin/sendVerifyCode 发送验证码
// request.post('/user-centre/commonLogin/sendVerifyCode', {
// mobile: this.data.form.mobile,
// codeType: '7',
// type: 'yzmjc'
// }).then(result => {
// wx.hideLoading()
// this.setData({ codeEnable: false })
// util.showToast('验证码已经发送')
// this.second = new $wuxCountDown({
// date: +(new Date) + 60000,
// onEnd() {
// this.setData({ second: '重新获取验证码', codeEnable: true })
// },
// render(date) {
// const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
// date.sec !== 0 && this.setData({ second: sec })
// }
// })
// }).catch(error => {
// wx.hideLoading()
// util.showToast(error)
// })
// },
// submitForm: function () {
// if (this.data.requesting) {
// return
// }
// if (util.isEmpty(this.data.form.mobile) && !this.data.first) {
// util.showToast('请输入手机号码')
// return
// }
// if (util.isEmpty(this.data.form.password)) {
// util.showToast('请输入密码')
// return
// }
// if (util.isEmpty(this.data.form.verifyCode) && !this.data.first) {
// util.showToast('请输入验证码')
// return
// }
// wx.showLoading({ title: '处理中', mask: true })
// this.data.requesting = true
// if(this.data.first){
// // var data = { password : md5.hexMD5(this.data.form.password).toUpperCase() }
// setPassword({ password : this.data.form.password }).then(res => {
// wx.hideLoading()
// util.showBackToast('设置成功')
// }).catch(error => {
// wx.hideLoading()
// this.data.requesting = false
// util.showToast(error)
// })
// } else {
// resetPassword(this.data.form).then(res => {
// wx.hideLoading()
// util.showBackToast('设置成功')
// }).catch(error => {
// wx.hideLoading()
// this.data.requesting = false
// util.showToast(error)
// })
// }
// },
// onUnload: function(){
// if(this.wuxCountDown){
// this.wuxCountDown.stop()
// this.wuxCountDown = null
// }
// }
// })
})

8
pages/home/setting/index.wxml

@ -8,12 +8,12 @@
<wux-cell title="更换手机号码" is-link url="/pages/home/mobile/index"> <wux-cell title="更换手机号码" is-link url="/pages/home/mobile/index">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_phone.png"></image> <image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_phone.png"></image>
</wux-cell> </wux-cell>
<!-- <wux-cell title="修改登录密码" is-link url="/pages/home/password/index">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_pwd.png"></image>
</wux-cell> -->
<wux-cell title="修改支付密码" is-link url="/pages/bank/password/index">
<wux-cell title="修改登录密码" is-link url="/pages/home/password/index">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_pwd.png"></image> <image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_pwd.png"></image>
</wux-cell> </wux-cell>
<!-- <wux-cell title="修改支付密码" is-link url="/pages/bank/password/index">
<image slot="header" style="width:32rpx;height:32rpx;margin:12rpx 12rpx 0rpx 0rpx" src="/assets/image/icon_pwd.png"></image>
</wux-cell> -->
</wux-cell-group> </wux-cell-group>
<view style="height:16rpx"></view> <view style="height:16rpx"></view>

8
pages/ztbvip/index.js

@ -5,7 +5,6 @@ const event = require('../../utils/event.js')
const app = getApp() const app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
@ -17,7 +16,6 @@ Page({
divIndex:null, divIndex:null,
vipInfo: null vipInfo: null
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
@ -25,7 +23,7 @@ Page({
this.setData({ safeBottom: app.globalData.safeBottom, userInfo: app.globalData.userInfo }) this.setData({ safeBottom: app.globalData.safeBottom, userInfo: app.globalData.userInfo })
getMemberExpenseList().then(res => { getMemberExpenseList().then(res => {
this.setData({ iconList: res.data, divIndex:res.data[0].id }) this.setData({ iconList: res.data, divIndex:res.data[0].id })
})
}).catch(err => { })
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
}, },
onShow: function () { onShow: function () {
@ -39,11 +37,11 @@ Page({
userInfo: app.globalData.userInfo, userInfo: app.globalData.userInfo,
userName: util.isEmpty(app.globalData.userInfo.userName) ? '' : app.globalData.userInfo.userName.substring(0, 14) userName: util.isEmpty(app.globalData.userInfo.userName) ? '' : app.globalData.userInfo.userName.substring(0, 14)
}) })
})
}).catch(err => { })
getMemberInfo().then(res => { getMemberInfo().then(res => {
this.setData({ vipInfo: res.data, ['vipInfo.memberExpiredAt']: res.data.memberExpiredAt.substring(0, 10) }) this.setData({ vipInfo: res.data, ['vipInfo.memberExpiredAt']: res.data.memberExpiredAt.substring(0, 10) })
wx.hideLoading() wx.hideLoading()
}).catch(error => {
}).catch(err => {
wx.hideLoading() wx.hideLoading()
}) })
}, },

7
pages/ztbvip/index.wxml

@ -3,7 +3,8 @@
<cu-custom bgColor="bg-white" isBack="{{true}}"> <cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">纸通宝会员</view> <view slot="content">纸通宝会员</view>
</cu-custom> </cu-custom>
<wux-image width="{{750}}" height="{{270}}" nuit="{{'rpx'}}" src="https://pic.downk.cc/item/5f181ed214195aa594565927.png" mode="aspectFill"></wux-image>
<wux-image width="{{750}}" height="{{270}}" nuit="{{'rpx'}}" src="https://pic.downk.cc/item/5f181ed214195aa594565927.png" mode="aspectFill">
</wux-image>
<view style="padding:18rpx 24rpx;background-color:white"> <view style="padding:18rpx 24rpx;background-color:white">
<view class="header-box"> <view class="header-box">
<view class="flex"> <view class="flex">
@ -48,7 +49,7 @@
</view> </view>
</view> </view>
<view style="padding:8rpx 12rpx 18rpx 12rpx;background-color:white">
<view style="padding:8rpx 12rpx 18rpx 12rpx;background-color:white" wx:if="{{iconList.length}}">
<view style="font-size:32rpx;color:#333333;padding-left:12rpx;margin-bottom: 24rpx">选择购买的会员产品</view> <view style="font-size:32rpx;color:#333333;padding-left:12rpx;margin-bottom: 24rpx">选择购买的会员产品</view>
<view class="cu-list grid col-3 no-border" style="padding: 0rpx"> <view class="cu-list grid col-3 no-border" style="padding: 0rpx">
<view class="cu-item" wx:for="{{iconList}}" wx:key="index" data-index="{{index}}" bindtap="onGridTap"> <view class="cu-item" wx:for="{{iconList}}" wx:key="index" data-index="{{index}}" bindtap="onGridTap">
@ -67,7 +68,7 @@
</view> </view>
<view style="height:{{136 + safeBottom}}rpx;"></view> <view style="height:{{136 + safeBottom}}rpx;"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding: 32rpx 32rpx {{safeBottom + 32}}rpx 32rpx;">
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding: 32rpx 32rpx {{safeBottom + 32}}rpx 32rpx;" wx:if="{{iconList.length}}">
<button class="cu-btn bg-red round shadow-blur page-btn" bindtap="openVip">{{vipInfo.isVIP==1?'立即续费':'开通会员'}}</button> <button class="cu-btn bg-red round shadow-blur page-btn" bindtap="openVip">{{vipInfo.isVIP==1?'立即续费':'开通会员'}}</button>
</view> </view>

2
project.config.json

@ -40,7 +40,7 @@
"useApiHostProcess": true "useApiHostProcess": true
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.13.1",
"libVersion": "2.14.4",
"appid": "wx7a4a8415e6821108", "appid": "wx7a4a8415e6821108",
"projectname": "zhitongbao-mini", "projectname": "zhitongbao-mini",
"debugOptions": { "debugOptions": {

Loading…
Cancel
Save