5bd03939 by 杨炀

no message

1 parent c3c91799
import config from '@/config.js'
import {
h5LoginAuto
h5LoginAuto
} from './login'
const excludeUrls = ['pages/index/login', 'pages/index/register']
// 获取Token
function getToken() {
try {
const token = uni.getStorageSync('token')
if (token) {
return token
} else {
return ''
}
} catch (e) {
console.log(e)
}
try {
const token = uni.getStorageSync('token')
if (token) {
return token
} else {
return ''
}
} catch (e) {
console.log(e)
}
}
// 获取请求头
function getHeaders() {
const token = getToken()
const header = {
'Authorization': token,
'Content-Type': 'application/json' // 根据自己的数据类型
// "Content-Type":"application/x-www-form-urlencoded",
}
return header
const token = getToken()
const header = {
'Authorization': token,
'Content-Type': 'application/json' // 根据自己的数据类型
// "Content-Type":"application/x-www-form-urlencoded",
}
return header
}
const request = function(req) {
req.method = req.method.toUpperCase()
if (!['GET', 'POST', 'PUT', 'DELETE'].includes(req.method)) {
uni.showToast({
title: `暂不支持的请求方式: ${req.method}`,
icon: 'none'
})
return
}
if (req.method === 'GET') {
if (!req.params) {
req.params = {}
}
req.params.pageNum = req.params.pageNum || 1
req.params.pageSize = req.params.pageSize || 50
}
req.method = req.method.toUpperCase()
if (!['GET', 'POST', 'PUT', 'DELETE'].includes(req.method)) {
uni.showToast({
title: `暂不支持的请求方式: ${req.method}`,
icon: 'none'
})
return
}
// if (req.method == 'POST' && !req.hideLoding) {
// uni.showLoading({
// title: '提交中...'
// })
// }
if (req.method === 'GET') {
if (!req.params) {
req.params = {}
}
req.params.pageNum = req.params.pageNum || 1
req.params.pageSize = req.params.pageSize || 50
}
return new Promise((resolve, reject) => {
uni.request({
url: config.baseUrl_api + req.url,
method: req.method,
data: req.params,
header: getHeaders()
}).then(res => {
switch (res.statusCode) {
case 200:
const data = res.data || {}
if (data.code === 200 || data.pageData?.code === 200) {
resolve(data)
} else if (req.url.indexOf('getMemberCountInfo') > -1) {
resolve(data)
} else {
if (!excludeUrls.includes(req.url)) {
if(data.msg){
uni.showModal({
content: data.msg,
success: function(res) {
}
})
}
uni.hideLoading()
// uni.showToast({
// title: data.msg,
// icon: 'none',
// duration: 3000
// })
}
// if (req.method == 'POST' && !req.hideLoding) {
// uni.showLoading({
// title: '提交中...'
// })
// }
// 登录超时
if (data.code === 60002 || data.code === 60001) {
uni.redirectTo({
url: '/pages/index/login'
})
} else if (data.code === 401) {
h5LoginAuto()
.then(() => {
uni.hideLoading()
uni.redirectTo({
url: getCurrentPages()[getCurrentPages()
.length - 1].$page.fullPath
})
})
.catch(() => {
uni.showToast({
title: '服务异常,请稍后重试',
icon: 'none'
})
})
}
reject(res)
}
break
default:
reject(res)
}
}).catch(res => {
reject(res)
}).finally(() => {
// if (req.method == 'POST' && !req.hideLoding) {
// uni.hideLoading()
// }
})
})
return new Promise((resolve, reject) => {
uni.request({
url: config.baseUrl_api + req.url,
method: req.method,
data: req.params,
header: getHeaders()
}).then(res => {
switch (res.statusCode) {
case 200:
const data = res.data || {}
if (data.code === 200 || data.pageData?.code === 200) {
resolve(data)
} else if (req.url.indexOf('getMemberCountInfo') > -1) {
resolve(data)
} else {
if (!excludeUrls.includes(req.url)) {
if (data.msg) {
// uni.showModal({
// content: data.msg,
// success: function(res) {
// }
// })
uni.showToast({
title: data.msg,
icon: 'none',
duration: 3000
})
}
uni.hideLoading()
}
// 登录超时
if (data.code === 60002 || data.code === 60001) {
uni.redirectTo({
url: '/pages/index/login'
})
} else if (data.code === 401) {
h5LoginAuto()
.then(() => {
uni.hideLoading()
uni.redirectTo({
url: getCurrentPages()[getCurrentPages()
.length - 1].$page.fullPath
})
})
.catch(() => {
uni.showToast({
title: '服务异常,请稍后重试',
icon: 'none'
})
})
}
reject(res)
}
break
default:
reject(res)
}
}).catch(res => {
reject(res)
}).finally(() => {
// if (req.method == 'POST' && !req.hideLoding) {
// uni.hideLoading()
// }
})
})
}
export default request
export default request
\ No newline at end of file
......
......@@ -4,7 +4,7 @@
// staging
// const baseUrl_api = "http://22yidpjzjifv.ngrok.xiaomiqiu123.top/stage-api/";
const baseUrl_api = "http://192.168.1.95:8787";
const baseUrl_api = "http://192.168.1.11:8787";
export default {
baseUrl_api
......
<template>
<view>
<!-- 机构会员 -->
<!-- 机构会员 -->
<view class="searchbar">
<uni-easyinput placeholderStyle="font-size:30rpx" :input-border="false" prefixIcon="search"
v-model="query.name" placeholder="搜索会员名称" @blur="getList" @clear="getList">
</uni-easyinput>
</view>
<view class="wBox">
<!-- 成员 -->
<view class="userlist">
<view class="item" v-for="n in list">
<view class="item" v-for="n in list" @click="goDetail(n)">
<view class="photobox">
<view class="colorful">{{n.name?.slice(0,1)}}</view>
</view>
......@@ -78,6 +83,11 @@
list.value = res.rows
total.value = res.total
})
}
function goDetail(n){
uni.navigateTo({
url: `/pages/personalVip/detail?perId=${n.perId}`
})
}
</script>
......@@ -87,5 +97,21 @@
right: 20rpx;
font-size: 26rpx;
color: #999;
}
.searchbar {
display: flex;
align-items: center;
padding: 25rpx;
box-sizing: border-box;
:deep(.uni-easyinput .uni-easyinput__content) {
border-radius: 35rpx;
border: none;
height: 70rpx;
}
:deep(.uni-easyinput__content-input) {
font-size: 26rpx;
}
}
</style>
\ No newline at end of file
......
......@@ -7,7 +7,7 @@
</uni-easyinput>
</view>
<view class="vipData">
<view> <text>{{ forms?.total }}</text></view>
<view><text>{{ forms?.total }}</text></view>
<view>有效会员 <text>{{ forms?.effective }}</text></view>
<view>过期会员 <text>{{ forms?.expired }}</text></view>
<view>即将过期会员 <text>{{ forms?.soon }}</text></view>
......@@ -73,10 +73,14 @@
})
function getList() {
uni.showLoading({
title:'加载中'
})
console.log(current.value,currentTabName.value,query.value.dType)
api.getGroupVipList(query.value).then(res => {
infoList.value = res.rows
total.value = res.total
total.value = res.total
uni.hideLoading()
})
}
function getGroupInfo(){
......
......@@ -417,5 +417,6 @@
}
:deep(.uni-section .uni-section-header){
padding: 0 30rpx;
}
}
</style>
\ No newline at end of file
......
<template>
<view class="mainbox">
<view class="photobox">
<image class="photo" v-if="form.photo" :src="config.baseUrl_api + form.photo" mode='widthFix'></image>
<image class="photo" v-if="form.photo" :src="form.photo" mode='widthFix'></image>
<view class="colorful" v-else>{{form.name?.slice(0,1)}}</view>
</view>
<uni-list>
......@@ -49,6 +49,9 @@
if(form.value.cityId){
getRegionsList(form.value.cityId)
}
if(form.photo&&form.photo.indexOf('http')==-1){
form.photo = config.baseUrl_api + form.photo
}
})
})
function getRegionsList(cityId){
......
......@@ -15,7 +15,7 @@
<image class="icon" v-else src="@/static/member/dx.png" />
</view>
<view class="photobox">
<image class="photo" v-if="n.photo" :src="config.baseUrl_api+n.photo" mode='aspectFill'></image>
<image class="photo" v-if="n.photo" :src="n.photo" mode='aspectFill'></image>
<view class="colorful" v-else>{{n.name.slice(0,1)}}</view>
</view>
<view @click="handleInfo(n)">
......@@ -83,7 +83,12 @@
function getList() {
api.selectPageList(queryParams.value).then(res => {
list.value = res.rows
list.value = res.rows
for(var l of list.value){
if(l.photo&&l.photo.indexOf('http')==-1){
l.photo = config.baseUrl_api + l.photo
}
}
total.value = res.total
})
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!