Browse Source

修复bug

master
前端-胡立永 3 weeks ago
parent
commit
f589f96f04
11 changed files with 112 additions and 90 deletions
  1. +5
    -5
      api/api.js
  2. +12
    -61
      api/http.js
  3. +9
    -3
      common.scss
  4. +12
    -6
      components/active/active-item.vue
  5. +1
    -1
      components/cart/CardList.vue
  6. +1
    -1
      components/travel/travelList.vue
  7. +51
    -9
      pages/index/index.vue
  8. +18
    -2
      pages_my/user-info.vue
  9. +1
    -0
      pages_my/user-msg.vue
  10. +1
    -1
      pages_order/huodong-detail.vue
  11. +1
    -1
      pages_zlx/zlx-form.vue

+ 5
- 5
api/api.js View File

@ -22,7 +22,7 @@ export function api(key, data, callback, loadingTitle) {
if (!req) { if (!req) {
console.error('无效key--------' + key); console.error('无效key--------' + key);
return
return Promise.reject('无效key--------' + key)
} }
if (typeof callback == 'string') { if (typeof callback == 'string') {
@ -39,7 +39,7 @@ export function api(key, data, callback, loadingTitle) {
let storageKey = req.url let storageKey = req.url
let storage = limit[storageKey] let storage = limit[storageKey]
if (storage && new Date().getTime() - storage < req.limit) { if (storage && new Date().getTime() - storage < req.limit) {
return
return Promise.reject('接口限流', key)
} }
limit[storageKey] = new Date().getTime() limit[storageKey] = new Date().getTime()
} }
@ -49,7 +49,7 @@ export function api(key, data, callback, loadingTitle) {
if (!uni.getStorageSync('token')) { if (!uni.getStorageSync('token')) {
utils.toLogin() utils.toLogin()
console.error('需要登录') console.error('需要登录')
return
return Promise.reject('必须登录')
} }
} }
@ -73,10 +73,10 @@ export function api(key, data, callback, loadingTitle) {
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle) loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
}, req.debounce) }, req.debounce)
return
return Promise.reject('接口防抖', key)
} }
http.http(req.url, data, callback, req.method,
return http.http(req.url, data, callback, req.method,
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle) loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
} }


+ 12
- 61
api/http.js View File

@ -11,6 +11,13 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
}); });
} }
let reject, resolve;
let promise = new Promise((res, rej) => {
reject = rej
resolve = res
})
uni.request({ uni.request({
url: Vue.prototype.$config.baseUrl + uri, url: Vue.prototype.$config.baseUrl + uri,
data: enhanceData(data), data: enhanceData(data),
@ -43,10 +50,12 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
}); });
} }
callback(res.data)
callback && callback(res.data)
resolve(res.data)
}, },
fail: () => { fail: () => {
reject('api fail')
uni.showLoading({}) uni.showLoading({})
setTimeout(()=>{ setTimeout(()=>{
uni.hideLoading() uni.hideLoading()
@ -58,18 +67,8 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
} }
} }
}); });
}
function deleted(uri, data, callback) {
http(uri, data, callback, 'DELETE')
}
function post(uri, data, callback) {
http(uri, data, callback, 'POST')
}
function get(uri, data, callback) {
http(uri, data, callback, 'GET')
return promise
} }
function enhanceData(data) { function enhanceData(data) {
@ -83,54 +82,6 @@ function enhanceData(data) {
return data return data
} }
function sync(method, uri, data) {
return new Promise((resolve, reject) => {
uni.request({
url: uri,
data: data,
method: method,
header: {
'auth': '1AS9F1HPC4FBC9EN00J7KX2L5RJ99XHZ'
},
success: (res) => {
resolve(res.data)
},
fail: (err) => {
reject(err);
}
})
})
}
let cache = null
function async (method, uri, data) {
const promise = sync(method, uri, data).then(res => {
cache = res
}).catch(err => {
})
}
function syncHttp(uri, data, method = 'GET') {
async (method, uri, data)
}
export default { export default {
http: http, http: http,
delete: deleted,
post: post,
get: get,
syncHttp: syncHttp
} }

+ 9
- 3
common.scss View File

@ -82,9 +82,15 @@
color: #fff; color: #fff;
padding-top: 11rpx; padding-top: 11rpx;
width: 380rpx; width: 380rpx;
overflow:hidden; //超出的文本隐藏
text-overflow:ellipsis; //溢出用省略号显示
white-space:nowrap; //溢出不换行
// overflow:hidden; //超出的文本隐藏
// text-overflow:ellipsis; //溢出用省略号显示
// white-space:nowrap; //溢出不换行
overflow: hidden;
text-overflow: ellipsis;
display:-webkit-box; //作为弹性伸缩盒子模型显示
-webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
-webkit-line-clamp:2; //显示的行
} }
.date { .date {
padding: 25rpx 0 19rpx; padding: 25rpx 0 19rpx;


+ 12
- 6
components/active/active-item.vue View File

@ -5,12 +5,12 @@
v-for="(item, index) in cardListData" :key="index"> v-for="(item, index) in cardListData" :key="index">
<view class="content" :class="['U','S'].includes(item.state) ? 'content_border' : ''"> <view class="content" :class="['U','S'].includes(item.state) ? 'content_border' : ''">
<view class="left"> <view class="left">
<img :src="item.image.split(',')[0]" alt="">
<image :src="item.image.split(',')[0]" mode="aspectFill">
</view> </view>
<view class="right"> <view class="right">
<view class="detailed"> <view class="detailed">
<view class="title">{{item.title}}</view> <view class="title">{{item.title}}</view>
<view class="date">{{item.startTime}}</view>
<view class="date">{{ $dayjs(item.startTime).format('YYYY-MM-DD') }}</view>
<view class="address">{{item.address}}</view> <view class="address">{{item.address}}</view>
</view> </view>
<view class="price"> <view class="price">
@ -87,7 +87,7 @@
border-radius: 20rpx; border-radius: 20rpx;
overflow: hidden; overflow: hidden;
img {
image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
@ -108,9 +108,15 @@
color: #fff; color: #fff;
padding-top: 11rpx; padding-top: 11rpx;
width: 380rpx; width: 380rpx;
overflow:hidden; //
text-overflow:ellipsis; //
white-space:nowrap; //
// overflow:hidden; //
// text-overflow:ellipsis; //
// white-space:nowrap; //
overflow: hidden;
text-overflow: ellipsis;
display:-webkit-box; //
-webkit-box-orient:vertical; //--
-webkit-line-clamp:2; //
} }
.date { .date {


+ 1
- 1
components/cart/CardList.vue View File

@ -7,7 +7,7 @@
</view> </view>
<view class="content cardStyle_" :class="['U','S'].includes(item.state) ? 'content_border' : ''"> <view class="content cardStyle_" :class="['U','S'].includes(item.state) ? 'content_border' : ''">
<view class="left"> <view class="left">
<img :src="getImage(item)" alt="">
<image :src="getImage(item)" mode="aspectFill">
</view> </view>
<view class="right"> <view class="right">
<view class="detailed"> <view class="detailed">


+ 1
- 1
components/travel/travelList.vue View File

@ -9,7 +9,7 @@
<view class="right"> <view class="right">
<view class="detailed"> <view class="detailed">
<view class="title">{{item.title}}</view> <view class="title">{{item.title}}</view>
<view class="date">{{item.startTime}}</view>
<view class="date">{{ $dayjs(item.startTime).format('YYYY-MM-DD') }}</view>
<view class="address">{{item.address}}</view> <view class="address">{{item.address}}</view>
</view> </view>
<view class="data"> <view class="data">


+ 51
- 9
pages/index/index.vue View File

@ -15,7 +15,12 @@
</view> </view>
</view> </view>
<view class="swipe-box"> <view class="swipe-box">
<uv-swiper :list="list" keyName="image" height="336rpx" radius="30rpx" bgColor="transparent" indicator indicatorMode="dot"></uv-swiper>
<uv-swiper :list="list"
keyName="image"
height="336rpx" radius="30rpx"
bgColor="transparent" indicator
@click="swiperClick"
indicatorMode="dot"></uv-swiper>
</view> </view>
<view class="ydsk-box"> <view class="ydsk-box">
@ -57,6 +62,7 @@
</view> </view>
<view class="hd-list"> <view class="hd-list">
<uv-tabs <uv-tabs
@click= "tabs" @click= "tabs"
:list="hdList" :list="hdList"
@ -74,7 +80,24 @@
itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;" itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;"
></uv-tabs> ></uv-tabs>
<active-item :cardListData="cardListData" v-if="params.state != 2"/>
<uv-tabs
@click="({index}) => type = index"
:list="typeList"
lineWidth="50rpx"
:lineColor="`url(${lineBg}) 100% 100%`"
:activeStyle="{
color: '#fff',
fontWeight: 'bold',
transform: 'scale(1.05)'
}"
:inactiveStyle="{
color: '#999',
transform: 'scale(1)'
}"
itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;"
></uv-tabs>
<active-item :cardListData="cardListData" v-if="type == 0"/>
<travelList :cardListData="travelList" v-else/> <travelList :cardListData="travelList" v-else/>
<uv-load-more :status="status" fontSize="24rpx" dashed line /> <uv-load-more :status="status" fontSize="24rpx" dashed line />
</view> </view>
@ -146,10 +169,14 @@
keyword:'', keyword:'',
list: [], list: [],
hdList: [ hdList: [
{ id: 0, name: '近期活动' },
{ id: 1, name: '往期活动' },
{ id: 2, name: '旅行' },
{ id: 0, name: '近期' },
{ id: 1, name: '往期' },
],
typeList: [
{ id: 0, name: '活动' },
{ id: 1, name: '旅行' },
], ],
type : 0,
lineBg: require('@/static/image/cart/tabIcon.png'), lineBg: require('@/static/image/cart/tabIcon.png'),
cardListData: [], cardListData: [],
city : '定位中', city : '定位中',
@ -222,10 +249,11 @@
} }
}) })
this.$api('travelPageList', { this.$api('travelPageList', {
// ...this.params,
pageNo: this.params.pageNo,
pageSize: this.params.pageSize,
title: this.params.title,
...this.params,
// pageNo: this.params.pageNo,
// pageSize: this.params.pageSize,
// title: this.params.title,
// state: this.params.state,
}, res=>{ }, res=>{
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
if(res.code == 200) { if(res.code == 200) {
@ -282,6 +310,18 @@
this.tabs({id : 0}) this.tabs({id : 0})
this.$refs.popup.close() this.$refs.popup.close()
}, },
swiperClick(index){
let item = this.list[index]
if(item.type == 1){
uni.navigateTo({
url:`/pages_order/lvyou-detail?travelId=${item.travelId}`
})
}else if(item.type == 0){
uni.navigateTo({
url:`/pages_order/huodong-detail?activityId=${item.activityId}`
})
}
},
} }
} }
</script> </script>
@ -312,6 +352,8 @@
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 32rpx; margin-bottom: 32rpx;
position: relative;
z-index: 9999;
&-l { &-l {
display: flex; display: flex;
align-items: center; align-items: center;


+ 18
- 2
pages_my/user-info.vue View File

@ -27,7 +27,8 @@
<image v-if="info.sex == '男'" src="@/static/image/center/nan-icon.png" mode=""></image> <image v-if="info.sex == '男'" src="@/static/image/center/nan-icon.png" mode=""></image>
<image v-else src="@/static/image/center/nv-icon.png" mode=""></image> <image v-else src="@/static/image/center/nv-icon.png" mode=""></image>
</view> </view>
<view class="age-box">{{calculateAge}}</view>
<view class="age-box" v-if="calculateAge">{{calculateAge}}</view>
<view class="age-box" v-else>未设置</view>
<!-- <image src="@/static/image/center/nv-icon.png" mode=""></image> --> <!-- <image src="@/static/image/center/nv-icon.png" mode=""></image> -->
</view> </view>
<view class="form-box"> <view class="form-box">
@ -131,7 +132,21 @@
return age; return age;
}, },
stateArr() { stateArr() {
let arr = this.info.state.split(',')
let arr = []
if(this.info.state){
arr.push(...this.info.state.split(','))
}
if(this.info.shcool){
arr.push(...this.info.shcool.split(','))
}
if(this.info.shcoolType){
arr.push(...this.info.shcoolType.split(','))
}
if(this.info.workValue){
arr.push(...this.info.workValue.split(','))
}
return arr return arr
} }
}, },
@ -190,6 +205,7 @@
z-index: -1; z-index: -1;
} }
.content { .content {
margin-top: 40rpx;
padding: 0 30rpx 170rpx; padding: 0 30rpx 170rpx;
padding-top: calc(var(--status-bar-height) + 110rpx); padding-top: calc(var(--status-bar-height) + 110rpx);
.img-box { .img-box {


+ 1
- 0
pages_my/user-msg.vue View File

@ -220,6 +220,7 @@
z-index: -1; z-index: -1;
} }
.content { .content {
margin-top: 40rpx;
padding: 0 30rpx 170rpx; padding: 0 30rpx 170rpx;
padding-top: calc(var(--status-bar-height) + 110rpx); padding-top: calc(var(--status-bar-height) + 110rpx);
.title-box { .title-box {


+ 1
- 1
pages_order/huodong-detail.vue View File

@ -465,7 +465,7 @@
} }
} }
.lv-miaoshu { .lv-miaoshu {
margin-top: 300rpx;
margin-top: 370rpx;
.value-box { .value-box {
background: #1B1713; background: #1B1713;
border-radius: 27rpx; border-radius: 27rpx;


+ 1
- 1
pages_zlx/zlx-form.vue View File

@ -75,7 +75,7 @@
</view> </view>
<view class="xie-box"> <view class="xie-box">
<view class="title-box">个人生活照片</view>
<view class="title-box">个人生活照片含全身照</view>
<view class="xie-box-val"> <view class="xie-box-val">
<uv-upload <uv-upload
:fileList="fileList" :fileList="fileList"


Loading…
Cancel
Save