yujialong 2 weeks ago
parent 1a7f42cc24
commit 872f96d9d4
  1. 43
      apis/request.js
  2. 2
      config/request.js
  3. 2
      order/orderDetail/orderDetail.vue
  4. 2
      order/orders/orders.vue
  5. 2
      pages/index/index.vue

@ -1,16 +1,7 @@
import config from '@/config/request' import config from '@/config/request'
let HTTP_COUNT = 0 // loading次数 let logouted = 0
const request = options => { const request = options => {
HTTP_COUNT++
if (config.showLoading) {
// 请求数据时的loading
// uni.showToast({
// title: '加载中',
// duration: 200,
// icon: 'loading'
// })
}
const header = Object.assign({}, config.headers, { const header = Object.assign({}, config.headers, {
token: uni.getStorageSync('token') token: uni.getStorageSync('token')
}) })
@ -29,18 +20,22 @@ const request = options => {
if (status === 200) { if (status === 200) {
resolve(data) resolve(data)
} else if (status == 401) { } else if (status == 401) {
// 登录过期 if (!logouted) {
uni.clearStorageSync() // 登录过期
uni.showToast({ uni.clearStorageSync()
title: message, uni.showToast({
icon: 'none' title: message,
}) icon: 'none'
setTimeout(() => {
uni.navigateTo({
url: '../login/login'
}) })
}, 1500) setTimeout(() => {
reject(data) logouted = 0
uni.reLaunch({
url: '/pages/index/index'
})
}, 1500)
reject(data)
logouted = 1
}
} else if (!status) { } else if (!status) {
resolve(data) resolve(data)
} else { } else {
@ -58,12 +53,6 @@ const request = options => {
}) })
reject(err) reject(err)
}, },
complete: () => {
if (config.showLoading) {
// HTTP_COUNT--
// HTTP_COUNT || uni.hideLoading()
}
}
}) })
}) })
} }

@ -6,7 +6,7 @@
export default { export default {
baseURL: 'https://www.occupationlab.com/', baseURL: 'https://www.occupationlab.com/',
// baseURL: 'http://192.168.31.151:9000/', // baseURL: 'http://192.168.31.51:9000/',
// baseURL: 'http://121.37.12.51/', // baseURL: 'http://121.37.12.51/',
headers: { headers: {
'Content-Type': 'application/json;charset=UTF-8' 'Content-Type': 'application/json;charset=UTF-8'

@ -194,7 +194,7 @@
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons> <uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons>
<view class="text">修改</view> <view class="text">修改</view>
</view> </view>
<view class="item" v-if="auth('订单管理:续费')" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=renew`)"> <view class="item" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=renew`)">
<uni-icons class="icon" custom-prefix="iconfont" type="icon-product" size="30" color="#959595"></uni-icons> <uni-icons class="icon" custom-prefix="iconfont" type="icon-product" size="30" color="#959595"></uni-icons>
<view class="text">续费</view> <view class="text">续费</view>
</view> </view>

@ -215,7 +215,7 @@
}, },
// //
toDetail(item) { toDetail(item) {
if(!this.auth('订单管理:查看')) return // if(!this.auth(':')) return
this.$util.to(`../orderDetail/orderDetail?orderId=${item.orderId}&show=1`) this.$util.to(`../orderDetail/orderDetail?orderId=${item.orderId}&show=1`)
}, },
// //

@ -19,7 +19,7 @@
<image class="icon" src="@/static/image/index/index4.png" mode="widthFix"></image> <image class="icon" src="@/static/image/index/index4.png" mode="widthFix"></image>
<view class="text">方案</view> <view class="text">方案</view>
</li> </li>
<li v-if="auth('订单管理')" @click="$util.to('/order/orders/orders')"> <li @click="$util.to('/order/orders/orders')">
<image class="icon" src="@/static/image/index/index5.png" mode="widthFix"></image> <image class="icon" src="@/static/image/index/index5.png" mode="widthFix"></image>
<view class="text">订单</view> <view class="text">订单</view>
</li> </li>

Loading…
Cancel
Save