Merge branch 'master' of http://192.168.1.26:3000/dianliang/dl_uniapp
This commit is contained in:
commit
2f03910ae4
@ -162,6 +162,14 @@ export function getOrderList(params) {
|
||||
})
|
||||
}
|
||||
|
||||
export function prepayment(data) {
|
||||
return request({
|
||||
url: '/payApi/prepayment',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
export function saveOrder(data) {
|
||||
return request({
|
||||
url: '/member/order/uniSaveOrder',
|
||||
@ -184,4 +192,4 @@ export function saveBlack(data) {
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -119,29 +119,29 @@
|
||||
position: relative;
|
||||
|
||||
.item-top {
|
||||
padding-top: 25rpx;
|
||||
padding-top: 13rpx;
|
||||
flex-shrink: 0;
|
||||
width: 150rpx;
|
||||
height: 130rpx;
|
||||
|
||||
.dl-image {
|
||||
height: 45rpx;
|
||||
width: 45rpx;
|
||||
height: 53rpx;
|
||||
width: 53rpx;
|
||||
}
|
||||
|
||||
.dl-vip {
|
||||
position: absolute;
|
||||
height: 25rpx;
|
||||
top: -10rpx;
|
||||
right: -24px;
|
||||
height: 20rpx;
|
||||
top: 0rpx;
|
||||
right: -21px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-bottom {
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
font-size: 26rpx;
|
||||
position: absolute;
|
||||
bottom: 10rpx;
|
||||
bottom: 30rpx;
|
||||
}
|
||||
|
||||
.item-active {
|
||||
|
@ -1,7 +1,8 @@
|
||||
// 应用全局配置
|
||||
module.exports = {
|
||||
// baseUrl: 'https://notice.lighting-it.cn',
|
||||
baseUrl: 'http://localhost:8080',
|
||||
//baseUrl: 'https://notice.lighting-it.cn',
|
||||
baseUrl: 'https://www.ddtg.site/noticeApi',
|
||||
//baseUrl: 'http://192.168.1.31:8099',
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
// 应用名称
|
||||
|
3
main.js
3
main.js
@ -4,13 +4,12 @@ import store from './store' // store
|
||||
import plugins from './plugins' // plugins
|
||||
import './permission' // permission
|
||||
Vue.use(plugins)
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.prototype.$store = store
|
||||
App.mpType = 'app'
|
||||
|
||||
const app = new Vue({
|
||||
...App
|
||||
...App
|
||||
})
|
||||
|
||||
app.$mount()
|
||||
|
@ -18,12 +18,13 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 菜单 -->
|
||||
<view class="dl-menu-box">
|
||||
<view v-for="(item,index) in menus" @click="itemClick(index,item)" class="dl-menu"
|
||||
:class="index==menuIndex?'dl-menu click':'dl-menu'">{{item}}</view>
|
||||
<view class="dl-menu-box" style="padding-top: 10rpx;">
|
||||
<view v-for="(item,index) in menus" @click="itemClick(index,item)" class="dl-menu-dom">
|
||||
<view :class="index==menuIndex?'dl-menu click':'dl-menu'">{{item}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 筛选条件 -->
|
||||
<view class="dl-menu-box" style="padding-bottom: 20rpx;">
|
||||
<view class="dl-menu-box" style="padding-bottom: 20rpx;padding-left: 15rpx;padding-right: 15rpx;">
|
||||
<view :class="[0==chooseCondition?'dl-focus dl-search-box':'dl-search-box']" @click="choosePlat(0)"
|
||||
:key="chooseCondition">
|
||||
<text>{{queryParams.platformName}}</text>
|
||||
@ -65,6 +66,9 @@
|
||||
<image class="dl-go-view" src="@/static/index/go-view.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- 通告列表 -->
|
||||
<view class="dl-item-box">
|
||||
<scroll-view style="height: 100%;" scroll-y="true" @scrolltolower="onReachBottomCus" refresher-enabled
|
||||
@ -180,6 +184,7 @@
|
||||
getUserType
|
||||
} from '@/utils/common.js'
|
||||
import constant from '@/utils/constant';
|
||||
import store from '@/store'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -291,12 +296,9 @@
|
||||
* 选择平台
|
||||
*/
|
||||
async choosePlat(index) {
|
||||
this.$emit("openVip")
|
||||
return
|
||||
if (index == 2) {
|
||||
//鉴权
|
||||
if (!this.checkIfHasRights(rightsCode.subscribeSelect)) {
|
||||
this.$emit("openVip")
|
||||
if (!await this.checkIfHasRights(rightsCode.subscribeSelect)) {
|
||||
return
|
||||
}
|
||||
this.$refs.showRight2.open()
|
||||
@ -348,13 +350,13 @@
|
||||
} else if ('最新' == item) {
|
||||
//最新
|
||||
//鉴权
|
||||
if (!this.checkIfHasRights(rightsCode.highNewNotice)) {
|
||||
if (!await this.checkIfHasRights(rightsCode.highNewNotice)) {
|
||||
return
|
||||
}
|
||||
this.queryParams.sortBy = "new"
|
||||
} else if ('高奖励' == item) {
|
||||
//高奖励
|
||||
if (!this.checkIfHasRights(rightsCode.highNewNotice)) {
|
||||
if (!await this.checkIfHasRights(rightsCode.highNewNotice)) {
|
||||
return
|
||||
}
|
||||
this.queryParams.sortBy = "money"
|
||||
@ -370,7 +372,7 @@
|
||||
*/
|
||||
async goSeach() {
|
||||
//鉴权
|
||||
if (!this.checkIfHasRights(rightsCode.searchNotice)) {
|
||||
if (!await this.checkIfHasRights(rightsCode.searchNotice)) {
|
||||
return
|
||||
}
|
||||
this.showSearch = true
|
||||
@ -382,7 +384,7 @@
|
||||
async checkIfHasRights(rigthsCode) {
|
||||
let res = await hasRights(rigthsCode)
|
||||
if (!res) {
|
||||
toast('请开通会员')
|
||||
this.$emit("openVip")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -454,25 +456,34 @@
|
||||
*/
|
||||
goDetail(item) {
|
||||
let userInfo = getJSONData(constant.userInfo)
|
||||
let userType = getUserType()
|
||||
let param = {
|
||||
userId: userInfo.userId,
|
||||
userType: userType,
|
||||
noticeId: item.id,
|
||||
rightsCode: 'unlock_notice',
|
||||
deplete: 1
|
||||
}
|
||||
dealMemberRights(param).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.$tab.navigateTo(`/pages/notice/detail?id=${item.id}`)
|
||||
if (!userInfo) {
|
||||
store.dispatch('LogOut').then(res => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
|
||||
let userType = getUserType()
|
||||
let param = {
|
||||
userId: userInfo.userId,
|
||||
userType: userType,
|
||||
noticeId: item.id,
|
||||
rightsCode: 'unlock_notice',
|
||||
deplete: 1
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
dealMemberRights(param).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.$tab.navigateTo(`/pages/notice/detail?id=${item.id}`)
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**扣除解锁通告权益*/
|
||||
@ -509,7 +520,7 @@
|
||||
display: flex;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
padding: 55rpx 10rpx 0 15rpx;
|
||||
padding: 25rpx 10rpx 0 15rpx;
|
||||
border-bottom: 1px solid #F4F4F4;
|
||||
|
||||
|
||||
@ -521,15 +532,15 @@
|
||||
position: relative;
|
||||
|
||||
.dl-image {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.dl-vip {
|
||||
position: absolute;
|
||||
height: 25rpx;
|
||||
height: 20rpx;
|
||||
top: -10rpx;
|
||||
right: -22px;
|
||||
right: -20px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -551,18 +562,26 @@
|
||||
width: 100%;
|
||||
padding-top: 20rpx;
|
||||
|
||||
.dl-menu {
|
||||
flex-grow: 1;
|
||||
font-size: 30rpx;
|
||||
margin: 0 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
text-align: center;
|
||||
.dl-menu-dom {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.dl-menu {
|
||||
font-size: 30rpx;
|
||||
margin: 0 20rpx;
|
||||
padding-bottom: 10rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.click {
|
||||
font-size: 32rpx !important;
|
||||
color: #FF434E;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid #FF434E;
|
||||
border-bottom: 3px solid #FF434E;
|
||||
}
|
||||
|
||||
.dl-search-box {
|
||||
@ -571,9 +590,9 @@
|
||||
flex-grow: 1;
|
||||
font-size: 30rpx;
|
||||
margin: 0 15rpx;
|
||||
padding: 15rpx 25rpx;
|
||||
padding: 10rpx 25rpx;
|
||||
background-color: #F7F7F7;
|
||||
border-radius: 30rpx;
|
||||
border-radius: 40rpx;
|
||||
align-items: center;
|
||||
justify-content: left;
|
||||
display: flex;
|
||||
@ -591,8 +610,8 @@
|
||||
.dl-vip {
|
||||
position: absolute;
|
||||
width: 50rpx;
|
||||
height: 25rpx;
|
||||
top: -16rpx;
|
||||
height: 20rpx;
|
||||
top: -12rpx;
|
||||
right: -5px;
|
||||
}
|
||||
}
|
||||
@ -610,7 +629,7 @@
|
||||
align-items: center;
|
||||
border-radius: 35rpx;
|
||||
justify-content: center;
|
||||
height: 100rpx;
|
||||
height: 85rpx;
|
||||
width: 100%;
|
||||
background: url('/static/index/member-bg.png');
|
||||
background-size: 100% 100%;
|
||||
@ -645,7 +664,7 @@
|
||||
}
|
||||
|
||||
.dl-item-box {
|
||||
height: calc(100vh - var(--status-bar-height) - var(--window-bottom) - 586rpx);
|
||||
height: calc(100vh - var(--status-bar-height) - var(--window-bottom) - 505rpx);
|
||||
isplay: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
@ -21,16 +21,16 @@
|
||||
<image class="dl-icon" src="@/static/index/xing.png" mode="aspectFit"></image>
|
||||
<view class="dl-content">类型:{{item.bloggerTypesText||'无限制'}}</view>
|
||||
</view>
|
||||
<view class="text-item" style="padding-top: 10rpx;">
|
||||
<view class="item-box" style="width: 40%;">
|
||||
<view class="text-item" style="padding-top: 16rpx;">
|
||||
<view class="item-box" style="flex: 1;">
|
||||
<image class="dl-icon2" :src="imageUrl+item.avatar" mode="aspectFit"></image>
|
||||
<view class="dl-item-right">{{item.userNickName}}</view>
|
||||
</view>
|
||||
<view class="item-box">
|
||||
<view class="item-box" style="width: 28%;">
|
||||
<image class="dl-icon3" src="@/static/index/person.png" mode="aspectFit"></image>
|
||||
<view class="dl-item-right dl-number">{{item.reportNum}}</view>
|
||||
</view>
|
||||
<view class="item-box">
|
||||
<view class="item-box" style="width: 28%;">
|
||||
<image class="dl-icon3" src="@/static/index/eye.png" mode="aspectFit"></image>
|
||||
<view class="dl-item-right dl-number">{{item.viewNum}}</view>
|
||||
</view>
|
||||
@ -63,15 +63,15 @@
|
||||
<view class="dl-content">类型:{{dataObj.bloggerTypesText}}</view>
|
||||
</view>
|
||||
<view class="text-item" style="padding-top: 10rpx;">
|
||||
<view class="item-box" style="width: 40%;">
|
||||
<view class="item-box">
|
||||
<image class="dl-icon2" :src="imageUrl+dataObj.avatar" mode="aspectFit"></image>
|
||||
<view class="dl-item-right">{{dataObj.userNickName}}</view>
|
||||
</view>
|
||||
<view class="item-box">
|
||||
<view class="item-box" style="width: 25%;">
|
||||
<image class="dl-icon3" src="@/static/index/person.png" mode="aspectFit"></image>
|
||||
<view class="dl-item-right dl-number">{{dataObj.reportNum}}</view>
|
||||
</view>
|
||||
<view class="item-box">
|
||||
<view class="item-box" style="width: 25%;">
|
||||
<image class="dl-icon3" src="@/static/index/eye.png" mode="aspectFit"></image>
|
||||
<view class="dl-item-right dl-number">{{dataObj.viewNum}}</view>
|
||||
</view>
|
||||
@ -138,7 +138,7 @@
|
||||
.dl-notice-box {
|
||||
font-size: 29rpx;
|
||||
width: 100%;
|
||||
padding: 18rpx;
|
||||
padding: 18rpx 18rpx 10rpx 18rpx;
|
||||
background-color: white;
|
||||
border-radius: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
@ -157,6 +157,7 @@
|
||||
}
|
||||
|
||||
.dl-text {
|
||||
font-size: 30rpx;
|
||||
margin-left: 10rpx;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
@ -190,11 +191,12 @@
|
||||
|
||||
.dl-icon {
|
||||
flex: none;
|
||||
width: 40rpx;
|
||||
height: 44rpx;
|
||||
width: 25rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
|
||||
.dl-content {
|
||||
font-size: 24rpx;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@ -205,14 +207,13 @@
|
||||
|
||||
.item-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.dl-icon2 {
|
||||
flex: none;
|
||||
width: 40rpx;
|
||||
height: 44rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@ -224,6 +225,7 @@
|
||||
}
|
||||
|
||||
.dl-item-right {
|
||||
font-size: 26rpx;
|
||||
flex: 1;
|
||||
padding-left: 10rpx;
|
||||
min-width: 100rpx;
|
||||
@ -234,7 +236,8 @@
|
||||
}
|
||||
|
||||
.dl-number {
|
||||
font-size: 26rpx;
|
||||
color: #929292;
|
||||
font-size: 24rpx;
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
}
|
||||
@ -243,11 +246,11 @@
|
||||
|
||||
.right-image {
|
||||
flex: none;
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -121,13 +121,13 @@
|
||||
* 菜单切换
|
||||
* @param {Object} code
|
||||
*/
|
||||
changeMenu(code) {
|
||||
async changeMenu(code) {
|
||||
this.nowUserType = getUserType()
|
||||
if ("fabu" == code) {
|
||||
this.$tab.navigateTo('/pages/notice/public-notice')
|
||||
} else {
|
||||
if (code == 'dingyue') {
|
||||
if (!this.checkIfHasRights(rightsCode.subscribeSelect)) {
|
||||
if (!await this.checkIfHasRights(rightsCode.subscribeSelect)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -141,7 +141,7 @@
|
||||
async checkIfHasRights(rigthsCode) {
|
||||
let res = await hasRights(rigthsCode)
|
||||
if (!res) {
|
||||
toast('请开通会员')
|
||||
this.openVip()
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -218,4 +218,4 @@
|
||||
width: 70vw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -28,7 +28,14 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 购买 -->
|
||||
<!-- #ifdef H5 -->
|
||||
<view class="buy-button" @click="toOrder()">立即开通</view>
|
||||
<!-- #endif -->
|
||||
<!-- 调整h5 -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view class="buy-button" @click="openVip()">立即开通</view>
|
||||
|
||||
<!-- #endif -->
|
||||
<!-- 协议 -->
|
||||
<view class="xieyi-box">
|
||||
开通即代表您已阅读并同意<text
|
||||
@ -74,7 +81,8 @@
|
||||
rightList
|
||||
} from '@/api/business/base.js'
|
||||
import {
|
||||
saveOrder
|
||||
saveOrder,
|
||||
prepayment
|
||||
} from '@/api/business/member.js'
|
||||
import {
|
||||
getToken
|
||||
@ -174,31 +182,62 @@
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
|
||||
this.initData(options.userType);
|
||||
|
||||
//获取url中的search
|
||||
let search = location.search.slice(1);
|
||||
|
||||
let arr = search.split("&");
|
||||
let result = {};
|
||||
arr.forEach(function(item) {
|
||||
let itemArr = item.split('=');
|
||||
result[itemArr[0]] = itemArr[1];
|
||||
})
|
||||
let userTypeTemp = options.userType
|
||||
|
||||
this.initData(userTypeTemp);
|
||||
if (result.code) {
|
||||
userTypeTemp = result.state
|
||||
let that = this
|
||||
getWebAccessTokenAndOpenid(result.code).then(res => {
|
||||
|
||||
gzhLogin(res)
|
||||
that.$store.dispatch('GzhLogin', res).then(() => {
|
||||
that.initData(userTypeTemp);
|
||||
that.loginSuccess()
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.toLogin(options.userType)
|
||||
this.toLogin(userTypeTemp)
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
openVip() {
|
||||
// 在你想触发跳转的地方
|
||||
wx.openOfficialAccountProfile({
|
||||
username: 'tonggaokuaijie', // 此处填写公众号的微信号
|
||||
success: res => {},
|
||||
fail: res => {}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
binderror() {
|
||||
|
||||
},
|
||||
bindload() {
|
||||
|
||||
},
|
||||
// 登录成功后,处理函数
|
||||
loginSuccess(result) {
|
||||
// 设置用户信息
|
||||
this.$store.dispatch('GetInfo').then(res => {
|
||||
|
||||
})
|
||||
},
|
||||
toLogin(userType) {
|
||||
/*#ifdef APP-PLUS*/
|
||||
// App端特有的逻辑
|
||||
@ -223,7 +262,8 @@
|
||||
},
|
||||
/**初始化*/
|
||||
initData(userType) {
|
||||
if (getToken()) {
|
||||
|
||||
if (getToken() && userType) {
|
||||
this.userType = userType
|
||||
this.getCardList(userType);
|
||||
this.getRightsList(userType);
|
||||
@ -283,9 +323,12 @@
|
||||
// 查看相关协议
|
||||
handleUserAgrement(site) {
|
||||
this.$tab.navigateTo(`/pages/common/richview/index?title=${site.title}&code=${site.code}`)
|
||||
},
|
||||
toOpenH5() {
|
||||
|
||||
},
|
||||
/**生成订单*/
|
||||
toOrder() {
|
||||
async toOrder() {
|
||||
let data = {
|
||||
userType: this.userType,
|
||||
orderType: '01',
|
||||
@ -302,14 +345,17 @@
|
||||
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '月付会员') {
|
||||
data.goodsCycle = '01'
|
||||
}
|
||||
let that = this
|
||||
saveOrder(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
title: '保存成功'
|
||||
});
|
||||
uni.navigateBack()
|
||||
//吊起支付
|
||||
let payData = {
|
||||
orderNo: res.data.orderNo
|
||||
}
|
||||
prepayment(payData).then(paymentData => {
|
||||
that.wxpay(paymentData)
|
||||
})
|
||||
// uni.navigateBack()
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
@ -319,6 +365,58 @@
|
||||
});
|
||||
})
|
||||
},
|
||||
// 检测支付环境中的 WeixinJSBridge
|
||||
wxpay(data) {
|
||||
if (typeof WeixinJSBridge == "undefined") {
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('WeixinJSBridgeReady', onBridgeReady(data), false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent('WeixinJSBridgeReady', onBridgeReady(data));
|
||||
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady(data));
|
||||
}
|
||||
} else {
|
||||
this.onBridgeReady(data);
|
||||
}
|
||||
},
|
||||
|
||||
onBridgeReady(data) {
|
||||
|
||||
WeixinJSBridge.invoke(
|
||||
'getBrandWCPayRequest', {
|
||||
// 传入第一步后端接口返回的核心参数
|
||||
"appId": data.appId, //公众号
|
||||
"timeStamp": data.timeStamp, //时间戳
|
||||
"nonceStr": data.nonceStr, //随机串
|
||||
"package": data.packageVal, //prepay_id
|
||||
"signType": data.signType, //微信签名方式RSA
|
||||
"paySign": data.paySign //微信签名
|
||||
},
|
||||
function(res) {
|
||||
// 支付成功
|
||||
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
||||
// 使用以上方式判断前端返回,微信团队郑重提示:
|
||||
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
||||
}
|
||||
// 支付过程中用户取消
|
||||
if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
||||
|
||||
}
|
||||
// 支付失败
|
||||
if (res.err_msg == "get_brand_wcpay_request:fail") {
|
||||
|
||||
}
|
||||
/**
|
||||
* 其它
|
||||
* 1、请检查预支付会话标识prepay_id是否已失效
|
||||
* 2、请求的appid与下单接口的appid是否一致
|
||||
* */
|
||||
if (res.err_msg == "调用支付JSAPI缺少参数:total_fee") {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -258,8 +258,8 @@
|
||||
formatNumberWithUnits(number) {
|
||||
return formatNumberWithUnits(number)
|
||||
},
|
||||
getRightsCode() {
|
||||
let info = hasRights(rightsCode.manyCardReport)
|
||||
async getRightsCode() {
|
||||
let info = await hasRights(rightsCode.manyCardReport)
|
||||
if (!info) {
|
||||
this.rightInfo.manyCardReport = false
|
||||
} else {
|
||||
@ -319,9 +319,9 @@
|
||||
});
|
||||
})
|
||||
},
|
||||
submit(isSuper) {
|
||||
async submit(isSuper) {
|
||||
if (isSuper == '1') {
|
||||
let flag = hasRights(rightsCode.superReport)
|
||||
let flag = await hasRights(rightsCode.superReport)
|
||||
if (!flag) {
|
||||
uni.showToast({
|
||||
title: '无超级报名权益',
|
||||
|
BIN
static/VIP.png
Normal file
BIN
static/VIP.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 448 KiB |
@ -4,6 +4,9 @@ import constant from '@/utils/constant'
|
||||
import {
|
||||
changeUserType
|
||||
} from '@/utils/common.js'
|
||||
import {
|
||||
gzhLogin
|
||||
} from '@/api/wxApi'
|
||||
import {
|
||||
login,
|
||||
wxLogin,
|
||||
@ -69,6 +72,20 @@ const user = {
|
||||
})
|
||||
})
|
||||
},
|
||||
// 公众号登录
|
||||
GzhLogin({
|
||||
commit
|
||||
}, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
gzhLogin(data).then(res => {
|
||||
setToken(res.token)
|
||||
commit('SET_TOKEN', res.token)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 登录
|
||||
Login({
|
||||
commit
|
||||
@ -144,4 +161,4 @@ const user = {
|
||||
}
|
||||
}
|
||||
|
||||
export default user
|
||||
export default user
|
||||
|
131
utils/request.js
131
utils/request.js
@ -1,73 +1,78 @@
|
||||
import store from '@/store'
|
||||
import config from '@/config'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import {
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
import { toast, showConfirm, tansParams } from '@/utils/common'
|
||||
import {
|
||||
toast,
|
||||
showConfirm,
|
||||
tansParams
|
||||
} from '@/utils/common'
|
||||
|
||||
let timeout = 10000
|
||||
const baseUrl = config.baseUrl
|
||||
|
||||
const request = config => {
|
||||
// 是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
config.header = config.header || {}
|
||||
if (getToken() && !isToken) {
|
||||
config.header['Authorization'] = 'Bearer ' + getToken()
|
||||
}
|
||||
// get请求映射params参数
|
||||
if (config.params) {
|
||||
let url = config.url + '?' + tansParams(config.params)
|
||||
url = url.slice(0, -1)
|
||||
config.url = url
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: config.method || 'get',
|
||||
timeout: config.timeout || timeout,
|
||||
url: config.baseUrl || baseUrl + config.url,
|
||||
data: config.data,
|
||||
header: config.header,
|
||||
dataType: 'json'
|
||||
}).then(response => {
|
||||
let [error, res] = response
|
||||
if (error) {
|
||||
toast('后端接口连接异常')
|
||||
reject('后端接口连接异常')
|
||||
return
|
||||
}
|
||||
const code = res.data.code || 200
|
||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||
if (code === 401) {
|
||||
showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
|
||||
if (res.confirm) {
|
||||
store.dispatch('LogOut').then(res => {
|
||||
uni.reLaunch({ url: '/pages/login' })
|
||||
})
|
||||
}
|
||||
})
|
||||
reject('无效的会话,或者会话已过期,请重新登录。')
|
||||
} else if (code === 500) {
|
||||
toast(msg)
|
||||
reject(msg)
|
||||
} else if (code !== 200) {
|
||||
toast(msg)
|
||||
reject(msg)
|
||||
}
|
||||
resolve(res.data)
|
||||
})
|
||||
.catch(error => {
|
||||
let { message } = error
|
||||
if (message === 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
} else if (message.includes('timeout')) {
|
||||
message = '系统接口请求超时'
|
||||
} else if (message.includes('Request failed with status code')) {
|
||||
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||
}
|
||||
toast(message)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
// 是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
config.header = config.header || {}
|
||||
if (getToken() && !isToken) {
|
||||
config.header['Authorization'] = 'Bearer ' + getToken()
|
||||
}
|
||||
// get请求映射params参数
|
||||
if (config.params) {
|
||||
let url = config.url + '?' + tansParams(config.params)
|
||||
url = url.slice(0, -1)
|
||||
config.url = url
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: config.method || 'get',
|
||||
timeout: config.timeout || timeout,
|
||||
url: config.baseUrl || baseUrl + config.url,
|
||||
data: config.data,
|
||||
header: config.header,
|
||||
dataType: 'json'
|
||||
}).then(response => {
|
||||
let [error, res] = response
|
||||
if (error) {
|
||||
toast('后端接口连接异常')
|
||||
reject('后端接口连接异常')
|
||||
return
|
||||
}
|
||||
const code = res.data.code || 200
|
||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||
if (code === 401) {
|
||||
store.dispatch('LogOut').then(res => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login'
|
||||
})
|
||||
})
|
||||
} else if (code === 500) {
|
||||
toast(msg)
|
||||
reject(msg)
|
||||
} else if (code !== 200) {
|
||||
toast(msg)
|
||||
reject(msg)
|
||||
}
|
||||
resolve(res.data)
|
||||
})
|
||||
.catch(error => {
|
||||
let {
|
||||
message
|
||||
} = error
|
||||
if (message === 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
} else if (message.includes('timeout')) {
|
||||
message = '系统接口请求超时'
|
||||
} else if (message.includes('Request failed with status code')) {
|
||||
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||
}
|
||||
toast(message)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default request
|
||||
export default request
|
Loading…
Reference in New Issue
Block a user