diff --git a/api/api.js b/api/api.js index 0e725bb..dcfd220 100644 --- a/api/api.js +++ b/api/api.js @@ -22,7 +22,7 @@ export function api(key, data, callback, loadingTitle) { if (!req) { console.error('无效key--------' + key); - return + return Promise.reject('无效key--------' + key) } if (typeof callback == 'string') { @@ -39,7 +39,7 @@ export function api(key, data, callback, loadingTitle) { let storageKey = req.url let storage = limit[storageKey] if (storage && new Date().getTime() - storage < req.limit) { - return + return Promise.reject('接口限流', key) } limit[storageKey] = new Date().getTime() } @@ -49,7 +49,7 @@ export function api(key, data, callback, loadingTitle) { if (!uni.getStorageSync('token')) { utils.toLogin() console.error('需要登录') - return + return Promise.reject('必须登录') } } @@ -73,10 +73,10 @@ export function api(key, data, callback, loadingTitle) { loadingTitle || req.showLoading, loadingTitle || req.loadingTitle) }, 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) } diff --git a/api/http.js b/api/http.js index 108cd10..8c82045 100644 --- a/api/http.js +++ b/api/http.js @@ -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({ url: Vue.prototype.$config.baseUrl + uri, 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: () => { + reject('api fail') uni.showLoading({}) setTimeout(()=>{ 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) { @@ -83,54 +82,6 @@ function enhanceData(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 { http: http, - delete: deleted, - post: post, - get: get, - syncHttp: syncHttp } \ No newline at end of file diff --git a/common.scss b/common.scss index 248910f..23e22a8 100644 --- a/common.scss +++ b/common.scss @@ -82,9 +82,15 @@ color: #fff; padding-top: 11rpx; 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 { padding: 25rpx 0 19rpx; diff --git a/components/active/active-item.vue b/components/active/active-item.vue index 55dc31f..1b7f873 100644 --- a/components/active/active-item.vue +++ b/components/active/active-item.vue @@ -5,12 +5,12 @@ v-for="(item, index) in cardListData" :key="index"> - + {{item.title}} - {{item.startTime}} + {{ $dayjs(item.startTime).format('YYYY-MM-DD') }} {{item.address}} @@ -87,7 +87,7 @@ border-radius: 20rpx; overflow: hidden; - img { + image { width: 100%; height: 100%; } @@ -108,9 +108,15 @@ color: #fff; padding-top: 11rpx; 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 { diff --git a/components/cart/CardList.vue b/components/cart/CardList.vue index 5e13953..a301a9e 100644 --- a/components/cart/CardList.vue +++ b/components/cart/CardList.vue @@ -7,7 +7,7 @@ - + diff --git a/components/travel/travelList.vue b/components/travel/travelList.vue index a18108e..5b825d7 100644 --- a/components/travel/travelList.vue +++ b/components/travel/travelList.vue @@ -9,7 +9,7 @@ {{item.title}} - {{item.startTime}} + {{ $dayjs(item.startTime).format('YYYY-MM-DD') }} {{item.address}} diff --git a/pages/index/index.vue b/pages/index/index.vue index e021aec..4b70f8d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -15,7 +15,12 @@ - + @@ -57,6 +62,7 @@ + - + + + @@ -146,10 +169,14 @@ keyword:'', list: [], 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'), cardListData: [], city : '定位中', @@ -222,10 +249,11 @@ } }) 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=>{ uni.stopPullDownRefresh() if(res.code == 200) { @@ -282,6 +310,18 @@ this.tabs({id : 0}) 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}` + }) + } + }, } } @@ -312,6 +352,8 @@ display: flex; align-items: center; margin-bottom: 32rpx; + position: relative; + z-index: 9999; &-l { display: flex; align-items: center; diff --git a/pages_my/user-info.vue b/pages_my/user-info.vue index 9ec98c4..39dd450 100644 --- a/pages_my/user-info.vue +++ b/pages_my/user-info.vue @@ -27,7 +27,8 @@ - {{calculateAge}}岁 + {{calculateAge}}岁 + 未设置 @@ -131,7 +132,21 @@ return age; }, 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 } }, @@ -190,6 +205,7 @@ z-index: -1; } .content { + margin-top: 40rpx; padding: 0 30rpx 170rpx; padding-top: calc(var(--status-bar-height) + 110rpx); .img-box { diff --git a/pages_my/user-msg.vue b/pages_my/user-msg.vue index 257de95..18771f2 100644 --- a/pages_my/user-msg.vue +++ b/pages_my/user-msg.vue @@ -220,6 +220,7 @@ z-index: -1; } .content { + margin-top: 40rpx; padding: 0 30rpx 170rpx; padding-top: calc(var(--status-bar-height) + 110rpx); .title-box { diff --git a/pages_order/huodong-detail.vue b/pages_order/huodong-detail.vue index b06a1b6..10b4683 100644 --- a/pages_order/huodong-detail.vue +++ b/pages_order/huodong-detail.vue @@ -465,7 +465,7 @@ } } .lv-miaoshu { - margin-top: 300rpx; + margin-top: 370rpx; .value-box { background: #1B1713; border-radius: 27rpx; diff --git a/pages_zlx/zlx-form.vue b/pages_zlx/zlx-form.vue index 77a3c69..e20c52b 100644 --- a/pages_zlx/zlx-form.vue +++ b/pages_zlx/zlx-form.vue @@ -75,7 +75,7 @@ - 个人生活照片 + 个人生活照片(含全身照)