5bd03939 by 杨炀

no message

1 parent c3c91799
1 import config from '@/config.js' 1 import config from '@/config.js'
2 import { 2 import {
3 h5LoginAuto 3 h5LoginAuto
4 } from './login' 4 } from './login'
5 5
6 const excludeUrls = ['pages/index/login', 'pages/index/register'] 6 const excludeUrls = ['pages/index/login', 'pages/index/register']
7 7
8 // 获取Token 8 // 获取Token
9 function getToken() { 9 function getToken() {
10 try { 10 try {
11 const token = uni.getStorageSync('token') 11 const token = uni.getStorageSync('token')
12 if (token) { 12 if (token) {
13 return token 13 return token
14 } else { 14 } else {
15 return '' 15 return ''
16 } 16 }
17 } catch (e) { 17 } catch (e) {
18 console.log(e) 18 console.log(e)
19 } 19 }
20 } 20 }
21 21
22 // 获取请求头 22 // 获取请求头
23 function getHeaders() { 23 function getHeaders() {
24 const token = getToken() 24 const token = getToken()
25 const header = { 25 const header = {
26 'Authorization': token, 26 'Authorization': token,
27 'Content-Type': 'application/json' // 根据自己的数据类型 27 'Content-Type': 'application/json' // 根据自己的数据类型
28 // "Content-Type":"application/x-www-form-urlencoded", 28 // "Content-Type":"application/x-www-form-urlencoded",
29 } 29 }
30 return header 30 return header
31 } 31 }
32 32
33 const request = function(req) { 33 const request = function(req) {
34 req.method = req.method.toUpperCase() 34 req.method = req.method.toUpperCase()
35 if (!['GET', 'POST', 'PUT', 'DELETE'].includes(req.method)) { 35 if (!['GET', 'POST', 'PUT', 'DELETE'].includes(req.method)) {
36 uni.showToast({ 36 uni.showToast({
37 title: `暂不支持的请求方式: ${req.method}`, 37 title: `暂不支持的请求方式: ${req.method}`,
38 icon: 'none' 38 icon: 'none'
39 }) 39 })
40 return 40 return
41 } 41 }
42
43 if (req.method === 'GET') {
44 if (!req.params) {
45 req.params = {}
46 }
47 req.params.pageNum = req.params.pageNum || 1
48 req.params.pageSize = req.params.pageSize || 50
49 }
50 42
51 // if (req.method == 'POST' && !req.hideLoding) { 43 if (req.method === 'GET') {
52 // uni.showLoading({ 44 if (!req.params) {
53 // title: '提交中...' 45 req.params = {}
54 // }) 46 }
55 // } 47 req.params.pageNum = req.params.pageNum || 1
48 req.params.pageSize = req.params.pageSize || 50
49 }
56 50
57 return new Promise((resolve, reject) => { 51 // if (req.method == 'POST' && !req.hideLoding) {
58 uni.request({ 52 // uni.showLoading({
59 url: config.baseUrl_api + req.url, 53 // title: '提交中...'
60 method: req.method, 54 // })
61 data: req.params, 55 // }
62 header: getHeaders()
63 }).then(res => {
64 switch (res.statusCode) {
65 case 200:
66 const data = res.data || {}
67 if (data.code === 200 || data.pageData?.code === 200) {
68 resolve(data)
69 } else if (req.url.indexOf('getMemberCountInfo') > -1) {
70 resolve(data)
71 } else {
72 if (!excludeUrls.includes(req.url)) {
73 if(data.msg){
74 uni.showModal({
75 content: data.msg,
76 success: function(res) {
77
78 }
79 })
80 }
81 uni.hideLoading()
82 // uni.showToast({
83 // title: data.msg,
84 // icon: 'none',
85 // duration: 3000
86 // })
87 }
88 56
89 // 登录超时 57 return new Promise((resolve, reject) => {
90 if (data.code === 60002 || data.code === 60001) { 58 uni.request({
91 uni.redirectTo({ 59 url: config.baseUrl_api + req.url,
92 url: '/pages/index/login' 60 method: req.method,
93 }) 61 data: req.params,
94 } else if (data.code === 401) { 62 header: getHeaders()
95 h5LoginAuto() 63 }).then(res => {
96 .then(() => { 64 switch (res.statusCode) {
97 uni.hideLoading() 65 case 200:
98 uni.redirectTo({ 66 const data = res.data || {}
99 url: getCurrentPages()[getCurrentPages() 67 if (data.code === 200 || data.pageData?.code === 200) {
100 .length - 1].$page.fullPath 68 resolve(data)
101 }) 69 } else if (req.url.indexOf('getMemberCountInfo') > -1) {
102 }) 70 resolve(data)
103 .catch(() => { 71 } else {
104 uni.showToast({ 72 if (!excludeUrls.includes(req.url)) {
105 title: '服务异常,请稍后重试', 73 if (data.msg) {
106 icon: 'none' 74 // uni.showModal({
107 }) 75 // content: data.msg,
108 }) 76 // success: function(res) {
109 } 77
110 78 // }
111 reject(res) 79 // })
112 } 80 uni.showToast({
113 break 81 title: data.msg,
114 default: 82 icon: 'none',
115 reject(res) 83 duration: 3000
116 } 84 })
117 }).catch(res => { 85 }
118 reject(res) 86 uni.hideLoading()
119 }).finally(() => { 87
120 // if (req.method == 'POST' && !req.hideLoding) { 88 }
121 // uni.hideLoading() 89
122 // } 90 // 登录超时
123 }) 91 if (data.code === 60002 || data.code === 60001) {
124 }) 92 uni.redirectTo({
93 url: '/pages/index/login'
94 })
95 } else if (data.code === 401) {
96 h5LoginAuto()
97 .then(() => {
98 uni.hideLoading()
99 uni.redirectTo({
100 url: getCurrentPages()[getCurrentPages()
101 .length - 1].$page.fullPath
102 })
103 })
104 .catch(() => {
105 uni.showToast({
106 title: '服务异常,请稍后重试',
107 icon: 'none'
108 })
109 })
110 }
111
112 reject(res)
113 }
114 break
115 default:
116 reject(res)
117 }
118 }).catch(res => {
119 reject(res)
120 }).finally(() => {
121 // if (req.method == 'POST' && !req.hideLoding) {
122 // uni.hideLoading()
123 // }
124 })
125 })
125 } 126 }
126 127
127 export default request 128 export default request
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 4
5 // staging 5 // staging
6 // const baseUrl_api = "http://22yidpjzjifv.ngrok.xiaomiqiu123.top/stage-api/"; 6 // const baseUrl_api = "http://22yidpjzjifv.ngrok.xiaomiqiu123.top/stage-api/";
7 const baseUrl_api = "http://192.168.1.95:8787"; 7 const baseUrl_api = "http://192.168.1.11:8787";
8 8
9 export default { 9 export default {
10 baseUrl_api 10 baseUrl_api
......
1 <template> 1 <template>
2 <view> 2 <view>
3 <!-- 机构会员 --> 3 <!-- 机构会员 -->
4 <view class="searchbar">
5 <uni-easyinput placeholderStyle="font-size:30rpx" :input-border="false" prefixIcon="search"
6 v-model="query.name" placeholder="搜索会员名称" @blur="getList" @clear="getList">
7 </uni-easyinput>
8 </view>
4 <view class="wBox"> 9 <view class="wBox">
5 <!-- 成员 --> 10 <!-- 成员 -->
6 <view class="userlist"> 11 <view class="userlist">
7 <view class="item" v-for="n in list"> 12 <view class="item" v-for="n in list" @click="goDetail(n)">
8 <view class="photobox"> 13 <view class="photobox">
9 <view class="colorful">{{n.name?.slice(0,1)}}</view> 14 <view class="colorful">{{n.name?.slice(0,1)}}</view>
10 </view> 15 </view>
...@@ -78,6 +83,11 @@ ...@@ -78,6 +83,11 @@
78 list.value = res.rows 83 list.value = res.rows
79 total.value = res.total 84 total.value = res.total
80 }) 85 })
86 }
87 function goDetail(n){
88 uni.navigateTo({
89 url: `/pages/personalVip/detail?perId=${n.perId}`
90 })
81 } 91 }
82 </script> 92 </script>
83 93
...@@ -87,5 +97,21 @@ ...@@ -87,5 +97,21 @@
87 right: 20rpx; 97 right: 20rpx;
88 font-size: 26rpx; 98 font-size: 26rpx;
89 color: #999; 99 color: #999;
100 }
101 .searchbar {
102 display: flex;
103 align-items: center;
104 padding: 25rpx;
105 box-sizing: border-box;
106
107 :deep(.uni-easyinput .uni-easyinput__content) {
108 border-radius: 35rpx;
109 border: none;
110 height: 70rpx;
111 }
112
113 :deep(.uni-easyinput__content-input) {
114 font-size: 26rpx;
115 }
90 } 116 }
91 </style> 117 </style>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 </uni-easyinput> 7 </uni-easyinput>
8 </view> 8 </view>
9 <view class="vipData"> 9 <view class="vipData">
10 <view> <text>{{ forms?.total }}</text></view> 10 <view><text>{{ forms?.total }}</text></view>
11 <view>有效会员 <text>{{ forms?.effective }}</text></view> 11 <view>有效会员 <text>{{ forms?.effective }}</text></view>
12 <view>过期会员 <text>{{ forms?.expired }}</text></view> 12 <view>过期会员 <text>{{ forms?.expired }}</text></view>
13 <view>即将过期会员 <text>{{ forms?.soon }}</text></view> 13 <view>即将过期会员 <text>{{ forms?.soon }}</text></view>
...@@ -73,10 +73,14 @@ ...@@ -73,10 +73,14 @@
73 }) 73 })
74 74
75 function getList() { 75 function getList() {
76 uni.showLoading({
77 title:'加载中'
78 })
76 console.log(current.value,currentTabName.value,query.value.dType) 79 console.log(current.value,currentTabName.value,query.value.dType)
77 api.getGroupVipList(query.value).then(res => { 80 api.getGroupVipList(query.value).then(res => {
78 infoList.value = res.rows 81 infoList.value = res.rows
79 total.value = res.total 82 total.value = res.total
83 uni.hideLoading()
80 }) 84 })
81 } 85 }
82 function getGroupInfo(){ 86 function getGroupInfo(){
......
...@@ -417,5 +417,6 @@ ...@@ -417,5 +417,6 @@
417 } 417 }
418 :deep(.uni-section .uni-section-header){ 418 :deep(.uni-section .uni-section-header){
419 padding: 0 30rpx; 419 padding: 0 30rpx;
420 } 420 }
421
421 </style> 422 </style>
...\ No newline at end of file ...\ No newline at end of file
......
1 <template> 1 <template>
2 <view class="mainbox"> 2 <view class="mainbox">
3 <view class="photobox"> 3 <view class="photobox">
4 <image class="photo" v-if="form.photo" :src="config.baseUrl_api + form.photo" mode='widthFix'></image> 4 <image class="photo" v-if="form.photo" :src="form.photo" mode='widthFix'></image>
5 <view class="colorful" v-else>{{form.name?.slice(0,1)}}</view> 5 <view class="colorful" v-else>{{form.name?.slice(0,1)}}</view>
6 </view> 6 </view>
7 <uni-list> 7 <uni-list>
...@@ -49,6 +49,9 @@ ...@@ -49,6 +49,9 @@
49 if(form.value.cityId){ 49 if(form.value.cityId){
50 getRegionsList(form.value.cityId) 50 getRegionsList(form.value.cityId)
51 } 51 }
52 if(form.photo&&form.photo.indexOf('http')==-1){
53 form.photo = config.baseUrl_api + form.photo
54 }
52 }) 55 })
53 }) 56 })
54 function getRegionsList(cityId){ 57 function getRegionsList(cityId){
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
15 <image class="icon" v-else src="@/static/member/dx.png" /> 15 <image class="icon" v-else src="@/static/member/dx.png" />
16 </view> 16 </view>
17 <view class="photobox"> 17 <view class="photobox">
18 <image class="photo" v-if="n.photo" :src="config.baseUrl_api+n.photo" mode='aspectFill'></image> 18 <image class="photo" v-if="n.photo" :src="n.photo" mode='aspectFill'></image>
19 <view class="colorful" v-else>{{n.name.slice(0,1)}}</view> 19 <view class="colorful" v-else>{{n.name.slice(0,1)}}</view>
20 </view> 20 </view>
21 <view @click="handleInfo(n)"> 21 <view @click="handleInfo(n)">
...@@ -83,7 +83,12 @@ ...@@ -83,7 +83,12 @@
83 83
84 function getList() { 84 function getList() {
85 api.selectPageList(queryParams.value).then(res => { 85 api.selectPageList(queryParams.value).then(res => {
86 list.value = res.rows 86 list.value = res.rows
87 for(var l of list.value){
88 if(l.photo&&l.photo.indexOf('http')==-1){
89 l.photo = config.baseUrl_api + l.photo
90 }
91 }
87 total.value = res.total 92 total.value = res.total
88 }) 93 })
89 } 94 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!