fix: 修复myAttention页面样式问题,优化文本截断效果
This commit is contained in:
parent
60281f17ce
commit
efbe517a92
@ -186,24 +186,15 @@
|
|||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.userInfo = uni.getStorageSync('userInfo')
|
const newUserInfo = uni.getStorageSync('userInfo')
|
||||||
if (this.userInfo == null || this.userInfo.userType == '09') {
|
// 只在用户信息发生变化时更新状态
|
||||||
this.showJoinImg = true
|
if (JSON.stringify(newUserInfo) !== JSON.stringify(this.userInfo)) {
|
||||||
} else {
|
this.userInfo = newUserInfo
|
||||||
this.showJoinImg = false
|
this.showJoinImg = !this.userInfo || this.userInfo.userType === '09'
|
||||||
|
|
||||||
|
// 只在用户状态变化时重新加载数据
|
||||||
|
this.resetAndLoadData()
|
||||||
}
|
}
|
||||||
// 重置分页参数
|
|
||||||
this.pageNum = 1
|
|
||||||
this.finished = false
|
|
||||||
this.featurePageList = []
|
|
||||||
this.getActivityList() // 获取活动列表
|
|
||||||
},
|
|
||||||
// onPullDownRefresh(){
|
|
||||||
// this.getFeaturePageListFun() // 专辑页列表
|
|
||||||
// },
|
|
||||||
onPullDownRefresh() {
|
|
||||||
// 禁用页面下拉刷新效果
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loginSuccess() {
|
loginSuccess() {
|
||||||
@ -212,10 +203,106 @@
|
|||||||
if (this.userInfo == null || this.userInfo.userType == '09') { // 没登录或者没认证门店
|
if (this.userInfo == null || this.userInfo.userType == '09') { // 没登录或者没认证门店
|
||||||
console.log('登录')
|
console.log('登录')
|
||||||
this.showJoinImg = true
|
this.showJoinImg = true
|
||||||
}else {
|
} else {
|
||||||
this.showJoinImg = false
|
this.showJoinImg = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 重置并加载数据
|
||||||
|
resetAndLoadData() {
|
||||||
|
this.pageNum = 1
|
||||||
|
this.finished = false
|
||||||
|
this.featurePageList = []
|
||||||
|
this.getActivityList()
|
||||||
|
},
|
||||||
|
// 获取活动列表
|
||||||
|
async getActivityList() {
|
||||||
|
if (this.loading || this.finished) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.loading = true
|
||||||
|
const res = await getActivities({
|
||||||
|
pageNum: this.pageNum,
|
||||||
|
pageSize: this.pageSize
|
||||||
|
})
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
const { rows, total } = res
|
||||||
|
|
||||||
|
// 处理数据,计算剩余天数和状态
|
||||||
|
const processedRows = this.processActivityData(rows)
|
||||||
|
|
||||||
|
// 更新列表数据
|
||||||
|
if (this.pageNum === 1) {
|
||||||
|
this.featurePageList = processedRows
|
||||||
|
} else {
|
||||||
|
this.featurePageList = [...this.featurePageList, ...processedRows]
|
||||||
|
}
|
||||||
|
|
||||||
|
this.total = total
|
||||||
|
this.finished = this.featurePageList.length >= total
|
||||||
|
this.pageNum++
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取活动列表失败:', error)
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 处理活动数据
|
||||||
|
processActivityData(rows) {
|
||||||
|
return rows
|
||||||
|
.map(it => {
|
||||||
|
// 计算剩余天数
|
||||||
|
const targetDate = new Date(it.endDate)
|
||||||
|
const currentDate = new Date()
|
||||||
|
const timeDiff = targetDate.getTime() - currentDate.getTime()
|
||||||
|
const remainingDays = Math.ceil(timeDiff / (1000 * 3600 * 24))
|
||||||
|
|
||||||
|
// 设置活动状态
|
||||||
|
let activityState = 'recruiting'
|
||||||
|
if (it.activityStatus === 2) {
|
||||||
|
activityState = 'in_progress'
|
||||||
|
} else if (it.activityStatus === 3) {
|
||||||
|
activityState = 'completed'
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...it,
|
||||||
|
remainingDays,
|
||||||
|
activityState,
|
||||||
|
remainingBeerCount: it.remainingBeerCount || 0,
|
||||||
|
barAwardStatus: it.barAwardStatus || 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(item => {
|
||||||
|
if (item.activityState === 'recruiting') {
|
||||||
|
return item.remainingDays >= 0
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 修改页面加载更多方法
|
||||||
|
async changePage() {
|
||||||
|
if (!this.finished) {
|
||||||
|
await this.getActivityList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleActivityClick(item) {
|
||||||
|
console.log('handleActivityClick called', item)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pagesActivity/activityDetail?id=" + item.id
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handlePopupChange(e) {
|
||||||
|
if (e && e.detail) {
|
||||||
|
this.currentAdIndex = e.detail.current;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleAdSwiperChange(e) {
|
||||||
|
if (e && e.detail) {
|
||||||
|
this.currentAdIndex = e.detail.current;
|
||||||
|
}
|
||||||
|
},
|
||||||
toAddAiad() {
|
toAddAiad() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pagesMy/addAiad'
|
url: '/pagesMy/addAiad'
|
||||||
@ -335,90 +422,6 @@
|
|||||||
// 实现搜索逻辑
|
// 实现搜索逻辑
|
||||||
console.log('搜索关键词:', this.keyword);
|
console.log('搜索关键词:', this.keyword);
|
||||||
},
|
},
|
||||||
// 获取活动列表
|
|
||||||
async getActivityList() {
|
|
||||||
if (this.loading || this.finished) return
|
|
||||||
this.loading = true
|
|
||||||
try {
|
|
||||||
const res = await getActivities({
|
|
||||||
pageNum: this.pageNum,
|
|
||||||
pageSize: this.pageSize
|
|
||||||
})
|
|
||||||
if (res.code === 200) {
|
|
||||||
const { rows, total } = res
|
|
||||||
|
|
||||||
// 处理数据,计算剩余天数和状态
|
|
||||||
const processedRows = rows.map(it => {
|
|
||||||
// 计算剩余天数
|
|
||||||
const targetDate = new Date(it.endDate);
|
|
||||||
const currentDate = new Date();
|
|
||||||
const timeDiff = targetDate.getTime() - currentDate.getTime();
|
|
||||||
const remainingDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
|
||||||
|
|
||||||
// 设置活动状态
|
|
||||||
let activityState = 'recruiting';
|
|
||||||
if (it.activityStatus === 2) {
|
|
||||||
activityState = 'in_progress';
|
|
||||||
} else if (it.activityStatus === 3) {
|
|
||||||
activityState = 'completed';
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
...it,
|
|
||||||
remainingDays,
|
|
||||||
activityState,
|
|
||||||
remainingBeerCount: it.remainingBeerCount || 0,
|
|
||||||
barAwardStatus: it.barAwardStatus || 0
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// 过滤掉招募剩余天数为负数的活动
|
|
||||||
const filteredRows = processedRows.filter(item => {
|
|
||||||
if (item.activityState === 'recruiting') {
|
|
||||||
return item.remainingDays >= 0
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.pageNum === 1) {
|
|
||||||
this.featurePageList = filteredRows;
|
|
||||||
} else {
|
|
||||||
this.featurePageList = [...this.featurePageList, ...filteredRows];
|
|
||||||
}
|
|
||||||
this.total = total;
|
|
||||||
this.finished = this.featurePageList.length >= total;
|
|
||||||
this.pageNum++;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取活动列表失败:', error)
|
|
||||||
} finally {
|
|
||||||
this.loading = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 修改页面加载更多方法
|
|
||||||
async changePage() {
|
|
||||||
if (!this.finished) {
|
|
||||||
await this.getActivityList()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 处理活动项点击
|
|
||||||
handleActivityClick(item) {
|
|
||||||
console.log('handleActivityClick called', item)
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pagesActivity/activityDetail?id=" + item.id
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handlePopupChange(e) {
|
|
||||||
if (e && e.detail) {
|
|
||||||
this.currentAdIndex = e.detail.current;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleAdSwiperChange(e) {
|
|
||||||
if (e && e.detail) {
|
|
||||||
this.currentAdIndex = e.detail.current;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -434,6 +437,20 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Roboto, "Segoe UI", "Microsoft YaHei", sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Roboto, "Segoe UI", "Microsoft YaHei", sans-serif;
|
||||||
|
|
||||||
|
.join-box {
|
||||||
|
width: 100%;
|
||||||
|
height: 562rpx;
|
||||||
|
background: #f5f5f5;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-box {
|
.search-box {
|
||||||
@ -477,13 +494,22 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
min-height: 200rpx;
|
||||||
|
position: relative;
|
||||||
|
z-index: 0;
|
||||||
|
|
||||||
scroll-view {
|
scroll-view {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-list {
|
.activity-list {
|
||||||
padding: 0 24rpx;
|
padding: 0 32rpx;
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
|
||||||
|
&.loading {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.more-btn-box {
|
.more-btn-box {
|
||||||
@ -646,7 +672,15 @@
|
|||||||
|
|
||||||
.bg-white {
|
.bg-white {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
// box-shadow: 0rpx 1rpx 3rpx 0rpx rgba(0, 0, 0, 0.1);
|
border-radius: 30rpx 30rpx 12rpx 12rpx;
|
||||||
|
padding-top: 8rpx;
|
||||||
|
position: relative;
|
||||||
|
transform: translateY(-20rpx);
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
.search-box {
|
||||||
|
margin: 24rpx 32rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-item {
|
.activity-item {
|
||||||
@ -811,4 +845,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加过渡效果
|
||||||
|
.fade-enter-active, .fade-leave-active {
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
.fade-enter, .fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -24,7 +24,7 @@
|
|||||||
<text class="text-lg">暂无法查看信息</text>
|
<text class="text-lg">暂无法查看信息</text>
|
||||||
<text class="sub-text">您还没有登录,请登录后查看信息</text>
|
<text class="sub-text">您还没有登录,请登录后查看信息</text>
|
||||||
<button class="login-btn" @click="toLogin">
|
<button class="login-btn" @click="toLogin">
|
||||||
<image src="@/static/send-2.svg" class="btn-icon"></image>
|
<image src="/static/send-2.svg" class="btn-icon"></image>
|
||||||
登录/认证
|
登录/认证
|
||||||
</button>
|
</button>
|
||||||
</block>
|
</block>
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<text class="text-lg">您的门店还未完成认证</text>
|
<text class="text-lg">您的门店还未完成认证</text>
|
||||||
<text class="sub-text">请点击认证门店信息</text>
|
<text class="sub-text">请点击认证门店信息</text>
|
||||||
<button class="login-btn" @click="toLogin">
|
<button class="login-btn" @click="toLogin">
|
||||||
<image src="@/static/send-2.svg" class="btn-icon"></image>
|
<image src="/static/send-2.svg" class="btn-icon"></image>
|
||||||
去认证
|
去认证
|
||||||
</button>
|
</button>
|
||||||
</block>
|
</block>
|
||||||
@ -142,7 +142,7 @@
|
|||||||
<view class="coin-item" v-for="(it, index) in myExchangeOrder" :key="index" @click="toOrderInfo(it)">
|
<view class="coin-item" v-for="(it, index) in myExchangeOrder" :key="index" @click="toOrderInfo(it)">
|
||||||
<view class="flex justify-between" style="margin-bottom: 16rpx;">
|
<view class="flex justify-between" style="margin-bottom: 16rpx;">
|
||||||
<text style="color: #5E5F60;font-weight: 600;font-size: 28rpx;">
|
<text style="color: #5E5F60;font-weight: 600;font-size: 28rpx;">
|
||||||
<image src="@/static/beerCoin.png" style="width: 24rpx;height: 24rpx;margin-right: 16rpx;"></image>
|
<image src="/static/beerCoin.png" style="width: 24rpx;height: 24rpx;margin-right: 16rpx;"></image>
|
||||||
啤酒币兑换</text>
|
啤酒币兑换</text>
|
||||||
<text style="color: #5E5F60;font-weight: 600;font-size: 24rpx;margin-top: 8rpx;">已完成</text>
|
<text style="color: #5E5F60;font-weight: 600;font-size: 24rpx;margin-top: 8rpx;">已完成</text>
|
||||||
</view>
|
</view>
|
||||||
@ -900,6 +900,12 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
border-radius: 44rpx;
|
border-radius: 44rpx;
|
||||||
|
|
||||||
|
.btn-icon {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,7 +403,7 @@
|
|||||||
height: 277rpx;
|
height: 277rpx;
|
||||||
|
|
||||||
.cover {
|
.cover {
|
||||||
width: 120rpx;
|
width: 150rpx;
|
||||||
height: 213rpx;
|
height: 213rpx;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
margin-right: 24rpx;
|
margin-right: 24rpx;
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { base_url } from '@/api/config.js';
|
import { base_url } from '@/api/config.js';
|
||||||
import { addFeedback } from '@/api/user.js';
|
import { addFeedback } from '@/api/user.js';
|
||||||
|
import { getToken } from '@/utils/auth.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -67,11 +68,18 @@ export default {
|
|||||||
addFeedback(data).then(res => {
|
addFeedback(data).then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交成功',
|
title: '提交成功',
|
||||||
icon: 'none'
|
icon: 'success'
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack();
|
uni.switchTab({
|
||||||
}, 500);
|
url: '/pages/index/my'
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '提交失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleUpload() {
|
handleUpload() {
|
||||||
@ -81,26 +89,7 @@ export default {
|
|||||||
uni.authorize({
|
uni.authorize({
|
||||||
scope: 'scope.camera',
|
scope: 'scope.camera',
|
||||||
success: () => {
|
success: () => {
|
||||||
uni.chooseImage({
|
this.chooseAndUploadImage();
|
||||||
count: 1,
|
|
||||||
success: (res) => {
|
|
||||||
uni.uploadFile({
|
|
||||||
url: base_url + '/bar/common/upload',
|
|
||||||
filePath: res.tempFilePaths[0],
|
|
||||||
name: 'file',
|
|
||||||
formData: { type: 'image' },
|
|
||||||
success: (uploadFileRes) => {
|
|
||||||
this.form.reviewImg = JSON.parse(uploadFileRes.data).url;
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
uni.showToast({
|
|
||||||
title: '上传失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail: () => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -125,21 +114,87 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
this.chooseAndUploadImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 选择并上传图片
|
||||||
|
chooseAndUploadImage() {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '上传中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const token = getToken();
|
||||||
|
console.log('当前token:', token);
|
||||||
|
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: base_url + '/bar/common/upload',
|
url: base_url + '/api/bar/common/upload',
|
||||||
filePath: res.tempFilePaths[0],
|
filePath: res.tempFilePaths[0],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
formData: { type: 'image' },
|
header: {
|
||||||
|
'Authorization': token,
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
formData: {
|
||||||
|
type: 'image'
|
||||||
|
},
|
||||||
success: (uploadFileRes) => {
|
success: (uploadFileRes) => {
|
||||||
this.form.reviewImg = JSON.parse(uploadFileRes.data).url;
|
console.log('上传响应原始数据:', uploadFileRes);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 检查状态码
|
||||||
|
if (uploadFileRes.statusCode !== 200) {
|
||||||
|
throw new Error(`服务器响应错误: ${uploadFileRes.statusCode}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
result = JSON.parse(uploadFileRes.data);
|
||||||
|
} catch (parseError) {
|
||||||
|
console.error('解析响应数据失败,原始数据:', uploadFileRes.data);
|
||||||
|
throw new Error('服务器响应格式错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('解析后的响应数据:', result);
|
||||||
|
|
||||||
|
if (result.code === 200) {
|
||||||
|
const imageUrl = result.data || result.url;
|
||||||
|
if (!imageUrl) {
|
||||||
|
throw new Error('未获取到图片地址');
|
||||||
|
}
|
||||||
|
this.form.reviewImg = imageUrl;
|
||||||
|
uni.showToast({
|
||||||
|
title: '上传成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw new Error(result.msg || '上传失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('处理上传响应错误:', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || '上传失败',
|
||||||
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('上传请求失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '上传失败',
|
||||||
|
icon: 'none'
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 7.8 KiB |
Loading…
x
Reference in New Issue
Block a user