Merge branch 'main' of https://gitlab.guxuan.icu/Leo_Ding/JinShan_uniapp
@ -59,6 +59,12 @@
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"requiredPrivateInfos": ["getLocation"],
|
||||
"optimization" : {
|
||||
"minify": {
|
||||
"js": true,
|
||||
"css": true
|
||||
}
|
||||
},
|
||||
"permission" : {
|
||||
"scope.userLocation" : {
|
||||
"desc" : "你的位置信息将用于获取周边服务"
|
||||
|
||||
@ -203,13 +203,6 @@
|
||||
"usingComponents": {}
|
||||
}
|
||||
},
|
||||
// {
|
||||
// "path" : "pages/meetingDetail/ceshi/ceshi",
|
||||
// "style" :
|
||||
// {
|
||||
// "navigationBarTitleText" : ""
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"path": "pages/sign/sign",
|
||||
"style": {
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
<template>
|
||||
<view class="activity-detail-container">
|
||||
<!-- 顶部图片轮播 -->
|
||||
<swiper class="activity-banner" :autoplay="false" indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#5b9cf8">
|
||||
<view class="banner-container">
|
||||
<swiper class="activity-banner" :autoplay="false" indicator-dots indicator-color="rgba(255,255,255,0.5)"
|
||||
indicator-active-color="#5b9cf8">
|
||||
<swiper-item v-for="(img, index) in bannerImages" :key="index">
|
||||
<image
|
||||
:src="img"
|
||||
mode="aspectFill"
|
||||
class="w-full h-full"
|
||||
@click="previewImage(index)"
|
||||
/>
|
||||
<image :src="img" class="w-full h-full" @click="previewImage(index)" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="banner-mask"></view>
|
||||
</view>
|
||||
|
||||
<!-- 活动基本信息 -->
|
||||
<view class="activity-base-info">
|
||||
@ -29,121 +28,72 @@
|
||||
|
||||
<view class="info-grid">
|
||||
<view class="info-item">
|
||||
<u-icon name="star" size="24" color="#5b9cf8"></u-icon>
|
||||
<view class="info-text"><text>活动类型:</text>{{activityInfo.categoryName || '待确认'}} </view>
|
||||
<u-icon name="star" size="26" color="#5b9cf8"></u-icon>
|
||||
<view class="info-text"><text class="info-label">活动类型:</text>{{activityInfo.categoryName || '待确认'}} </view>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<u-icon name="map" size="24" color="#5b9cf8"></u-icon>
|
||||
<view class="info-text"><text>活动地址:</text>{{activityInfo.address || '待定'}}</view>
|
||||
<u-icon name="clock" size="26" color="#5b9cf8"></u-icon>
|
||||
<view class="info-text"><text class="info-label">活动时间:</text>{{ activityInfo.openAt }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<u-icon name="clock" size="24" color="#5b9cf8"></u-icon>
|
||||
<view class="info-text">{{ activityInfo.openAt }}</view>
|
||||
</view>
|
||||
<!-- <view class="info-item">
|
||||
<u-icon name="account" size="18" color="#36CFC9"></u-icon>
|
||||
<text class="info-text">已报名 {{activityInfo.participants}}人</text>
|
||||
</view> -->
|
||||
|
||||
<view class="info-item">
|
||||
<u-icon name="clock-fill" size="26" color="#ff5a5f"></u-icon>
|
||||
<view class="info-text"><text class="info-label">结束时间:</text>{{ formatTime(activityInfo.endAt,"YYYY-MM-DD HH:mm:ss") }}</view>
|
||||
</view>
|
||||
|
||||
<view class="info-item highlight">
|
||||
<u-icon name="warning" size="26" color="#ff9500"></u-icon>
|
||||
<view class="info-text"><text class="info-label">报名截止:</text>{{ formatTime(activityInfo.endSignupAt,"YYYY-MM-DD HH:mm:ss") }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 活动详情卡片 -->
|
||||
<view class="detail-card">
|
||||
<!-- <view class="card-header">
|
||||
<view class="header-line"></view>
|
||||
<text class="header-title">活动详情</text>
|
||||
</view> -->
|
||||
|
||||
<view class="detail-section">
|
||||
<view class="section-title">
|
||||
<view class="title-icon"></view>
|
||||
<text>活动详情</text>
|
||||
</view>
|
||||
<view class="section-content">
|
||||
<view v-html="activityInfo.content"></view>
|
||||
<image
|
||||
src="/static/route-map.jpg"
|
||||
mode="widthFix"
|
||||
class="route-map"
|
||||
@click="previewImage(bannerImages.length)"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="detail-section">
|
||||
<view class="section-title">
|
||||
<view class="title-icon"></view>
|
||||
<text>活动流程</text>
|
||||
</view>
|
||||
<view class="timeline">
|
||||
<view class="timeline-item" v-for="(step, index) in timeline" :key="index">
|
||||
<view class="timeline-dot" :style="{backgroundColor: dotColors[index]}"></view>
|
||||
<view class="timeline-content">
|
||||
<text class="timeline-time">{{step.time}}</text>
|
||||
<text class="timeline-desc">{{step.desc}}</text>
|
||||
<view class="section-content rich-text">
|
||||
<rich-text :nodes="activityInfo.content"></rich-text>
|
||||
<!-- <image src="/static/route-map.jpg" mode="widthFix" class="route-map"
|
||||
@click="previewImage(bannerImages.length)"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- <view class="detail-section">
|
||||
<view class="section-title">
|
||||
<view class="title-icon"></view>
|
||||
<text>积分规则</text>
|
||||
</view>
|
||||
<view class="point-rules">
|
||||
<view class="rule-item" v-for="(rule, index) in pointRules" :key="index">
|
||||
<view class="rule-icon">
|
||||
<text>{{index + 1}}</text>
|
||||
</view>
|
||||
<text class="rule-text">{{rule}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 温馨提示 -->
|
||||
<!-- <view class="tips-card">
|
||||
<view class="card-header">
|
||||
<view class="header-line"></view>
|
||||
<text class="header-title">温馨提示</text>
|
||||
</view>
|
||||
<view class="tips-content">
|
||||
<text class="tip-item" v-for="(tip, index) in tips" :key="index">
|
||||
{{tip}}
|
||||
</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="action-bar">
|
||||
<!-- <view class="action-btn favorite" @click="toggleFavorite">
|
||||
<u-icon :name="isFavorite ? 'heart-fill' : 'heart'" size="24" :color="isFavorite ? '#FF5A5F' : '#666'"></u-icon>
|
||||
<text>收藏</text>
|
||||
</view> -->
|
||||
<view class="action-btn share" @click="shareActivity">
|
||||
<u-icon name="share" size="30" color="#666"></u-icon>
|
||||
<text>分享</text>
|
||||
</view>
|
||||
<button class="signup-btn" @click="handleSignUp" >
|
||||
立即报名
|
||||
<view class="action-bar safe-area-inset-bottom">
|
||||
<button class="share-btn" open-type="share">
|
||||
<u-icon name="share" size="32" color="#fff"></u-icon>
|
||||
<text class="share-text">分享</text>
|
||||
</button>
|
||||
<button class="signup-btn" @click="handleSignUp">立即报名</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { get, post } from '@/utils/request';
|
||||
import { IMAGE_BASE_URL, BASE_URL } from '@/utils/config';
|
||||
import { formatTime, formatRelativeTime } from '@/utils/timeFormat';
|
||||
export default {
|
||||
import {
|
||||
get,
|
||||
post
|
||||
} from '@/utils/request';
|
||||
import {
|
||||
IMAGE_BASE_URL,
|
||||
BASE_URL
|
||||
} from '@/utils/config';
|
||||
import {
|
||||
formatTime,
|
||||
formatRelativeTime
|
||||
} from '@/utils/timeFormat';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formatTime,
|
||||
IMAGE_BASE_URL,
|
||||
Id:null,
|
||||
Id: null,
|
||||
isFavorite: false,
|
||||
isSignedUp: false,
|
||||
bannerImages: [],
|
||||
@ -175,7 +125,7 @@ export default {
|
||||
this.Id = options.Id;
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
mounted() {
|
||||
this.getActivitiesDetail();
|
||||
},
|
||||
methods: {
|
||||
@ -187,15 +137,15 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
async handleSignUp(){
|
||||
async handleSignUp() {
|
||||
try {
|
||||
const res = await get(`/api/v1/app_auth/activities/${this.Id}`);
|
||||
if ( !res.success) {
|
||||
if (!res.success) {
|
||||
uni.showToast({
|
||||
title: res.msg || '报名失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '报名成功!',
|
||||
icon: 'success'
|
||||
@ -206,13 +156,12 @@ export default {
|
||||
console.error('获取详情失败:', err);
|
||||
}
|
||||
},
|
||||
shareActivity() {
|
||||
uni.share({
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: this.activityInfo.title,
|
||||
content: '一起来参加社区夜跑活动吧!',
|
||||
href: '/pages/activity/detail',
|
||||
imageUrl: this.bannerImages[0]
|
||||
})
|
||||
path: `/pages/activity/detail?id=${this.Id}`,
|
||||
imageUrl: this.bannerImages[0] || '/static/logo.png'
|
||||
}
|
||||
},
|
||||
previewImage(index) {
|
||||
uni.previewImage({
|
||||
@ -220,7 +169,7 @@ export default {
|
||||
urls: [...this.bannerImages, '/static/route-map.jpg']
|
||||
})
|
||||
},
|
||||
async getActivitiesDetail(){
|
||||
async getActivitiesDetail() {
|
||||
try {
|
||||
const res = await get(`/api/v1/apps/home/activities/${this.Id}`);
|
||||
if (!res || !res.success) {
|
||||
@ -233,61 +182,89 @@ export default {
|
||||
this.bannerImages.push(item);
|
||||
}
|
||||
});
|
||||
this.activityInfo = {...res.data};
|
||||
this.activityInfo = {
|
||||
...res.data
|
||||
};
|
||||
} catch (err) {
|
||||
console.error('获取详情失败:', err);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$primary-color: #5b9cf8;
|
||||
$secondary-color: #F7F8FA;
|
||||
$text-color: #333;
|
||||
$light-text: #666;
|
||||
$border-color: #eee;
|
||||
$border-radius: 16rpx;
|
||||
$shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
$primary-color: #5b9cf8;
|
||||
$secondary-color: #f7f8fa;
|
||||
$text-color: #333;
|
||||
$light-text: #666;
|
||||
$lighter-text: #999;
|
||||
$border-color: #eee;
|
||||
$border-radius: 16rpx;
|
||||
$shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.08);
|
||||
$highlight-color: #fff8e6;
|
||||
|
||||
.activity-detail-container {
|
||||
padding-bottom: 120rpx;
|
||||
.activity-detail-container {
|
||||
padding-bottom: 160rpx;
|
||||
background-color: $secondary-color;
|
||||
color: $text-color;
|
||||
|
||||
.banner-container {
|
||||
position: relative;
|
||||
height: 500rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.activity-banner {
|
||||
width: 100%;
|
||||
height: 420rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
image {
|
||||
.activity-banner image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.banner-mask {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 120rpx;
|
||||
background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
|
||||
}
|
||||
}
|
||||
|
||||
.activity-base-info {
|
||||
padding: 30rpx;
|
||||
margin: -40rpx 20rpx 20rpx;
|
||||
background-color: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: $border-radius;
|
||||
box-shadow: $shadow;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
.title-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
padding-bottom: 20rpx;
|
||||
border-bottom: 1rpx solid rgba($border-color, 0.8);
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
flex: 1;
|
||||
font-size: 38rpx;
|
||||
font-weight: bold;
|
||||
color: $text-color;
|
||||
line-height: 1.4;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 6rpx 16rpx;
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 30rpx;
|
||||
font-size: 24rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
&.active {
|
||||
background-color: rgba($primary-color, 0.1);
|
||||
@ -299,199 +276,93 @@ $shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
gap: 20rpx;
|
||||
gap: 24rpx;
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: center; /* 垂直居中 */
|
||||
|
||||
&.highlight {
|
||||
background-color: #fff8e6;
|
||||
padding: 16rpx;
|
||||
border-radius: 12rpx;
|
||||
margin:0rpx -16rpx;
|
||||
}
|
||||
|
||||
.u-icon {
|
||||
flex-shrink: 0; /* 防止图标被压缩 */
|
||||
}
|
||||
|
||||
.info-text {
|
||||
font-size: 26rpx;
|
||||
color: $light-text;
|
||||
margin-left: 10rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
margin-left: 12rpx;
|
||||
display: flex;
|
||||
align-items: center; /* 确保内部文本垂直居中 */
|
||||
|
||||
.info-label {
|
||||
color: #999;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detail-card, .tips-card {
|
||||
.detail-card {
|
||||
background-color: #fff;
|
||||
border-radius: $border-radius;
|
||||
padding: 30rpx;
|
||||
margin: 0 20rpx 20rpx;
|
||||
box-shadow: $shadow;
|
||||
|
||||
.card-header {
|
||||
.detail-section {
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
margin-bottom: 24rpx;
|
||||
padding-bottom: 16rpx;
|
||||
border-bottom: 1rpx solid rgba($border-color, 0.5);
|
||||
|
||||
.header-line {
|
||||
width: 6rpx;
|
||||
.title-icon {
|
||||
width: 8rpx;
|
||||
height: 32rpx;
|
||||
background-color: $primary-color;
|
||||
border-radius: 4rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
text {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: $text-color;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-section {
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.title-icon {
|
||||
width: 8rpx;
|
||||
height: 28rpx;
|
||||
background-color: $primary-color;
|
||||
border-radius: 4rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
color: $text-color;
|
||||
}
|
||||
}
|
||||
|
||||
.section-content {
|
||||
font-size: 28rpx;
|
||||
font-size: 30rpx;
|
||||
line-height: 1.8;
|
||||
color: $light-text;
|
||||
line-height: 1.6;
|
||||
|
||||
&.rich-text {
|
||||
p {
|
||||
margin-bottom: 24rpx;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
border-radius: 8rpx;
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.route-map {
|
||||
width: 100%;
|
||||
margin-top: 20rpx;
|
||||
margin-top: 30rpx;
|
||||
border-radius: $border-radius;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline {
|
||||
position: relative;
|
||||
padding-left: 40rpx;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 15rpx;
|
||||
top: 10rpx;
|
||||
bottom: 10rpx;
|
||||
width: 2rpx;
|
||||
background-color: $border-color;
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
position: relative;
|
||||
padding-bottom: 30rpx;
|
||||
|
||||
&:last-child {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
position: absolute;
|
||||
left: -40rpx;
|
||||
top: 4rpx;
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
.timeline-time {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: $primary-color;
|
||||
font-weight: bold;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.timeline-desc {
|
||||
font-size: 28rpx;
|
||||
color: $light-text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.point-rules {
|
||||
.rule-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.rule-icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
background-color: $primary-color;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 16rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
text {
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.rule-text {
|
||||
font-size: 28rpx;
|
||||
color: $light-text;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tips-content {
|
||||
.tip-item {
|
||||
display: block;
|
||||
position: relative;
|
||||
padding-left: 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: $light-text;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 16rpx;
|
||||
|
||||
&::before {
|
||||
content: '•';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
color: $primary-color;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -502,53 +373,79 @@ $shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100rpx;
|
||||
height: 120rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 20rpx;
|
||||
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.08);
|
||||
z-index: 100;
|
||||
|
||||
.action-btn {
|
||||
// &.safe-area-inset-bottom {
|
||||
// padding-bottom: env(safe-area-inset-bottom);
|
||||
// }
|
||||
|
||||
.share-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 120rpx;
|
||||
height: 100%;
|
||||
width: 160rpx;
|
||||
height: 80rpx;
|
||||
background: linear-gradient(135deg, #6e8cfa, #5b9cf8);
|
||||
border-radius: 40rpx;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
margin-right: 20rpx;
|
||||
border: none;
|
||||
box-shadow: 0 4rpx 12rpx rgba(91, 156, 248, 0.2);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
text {
|
||||
font-size: 22rpx;
|
||||
color: $light-text;
|
||||
margin-top: 6rpx;
|
||||
.share-text {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
.share-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.signup-btn {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
background-color: #5b9cf8;
|
||||
background: linear-gradient(135deg, #ff7e5f, #ff5a5f);
|
||||
color: #fff;
|
||||
border-radius: 40rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 20rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(255, 90, 95, 0.2);
|
||||
transition: all 0.2s ease;
|
||||
border: none;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (min-width: 768px) {
|
||||
.activity-detail-container {
|
||||
max-width: 750px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,18 +1,20 @@
|
||||
<template>
|
||||
|
||||
<view class="aiHelper">
|
||||
|
||||
<view class="aiHelperContainer">
|
||||
<!-- 标题区域 -->
|
||||
<view class="aiHelperTitle" :style="{'background-image': `url(${aiHelperTitleBackground})`}">
|
||||
{{ aiHelperTitle }}
|
||||
</view>
|
||||
|
||||
<view class="aiHelperTitle" :style="{'background-image': `url(${aiHelperTitleBackground})`}">{{aiHelperTitle}}</view>
|
||||
<!-- AI类型卡片容器 -->
|
||||
<view class="aiBox">
|
||||
<view class="aiType" v-for="(item,index) in aiType" :key="item.id" @click="goAiType(item)">
|
||||
<view class="aiType" v-for="(item, index) in aiType" :key="item.id" @click="goAiType(item)">
|
||||
<view class="aiTypeContainer" :style="{'background-image': `url(${item.background})`}">
|
||||
<view class="aiLeft" :style="{'background-image': `url(${item.imagePath})`}">
|
||||
<view class="aiLeftTitle">{{item.name}}</view>
|
||||
<view class="aiLeftTitle">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="aiRight">
|
||||
<view class="aiRightTitle"><text>{{item.description}}</text></view>
|
||||
<view class="aiRightTitle"><text>{{ item.description }}</text></view>
|
||||
<view class="aiDescription"><text>开始对话></text></view>
|
||||
</view>
|
||||
</view>
|
||||
@ -20,37 +22,34 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view><Footer></Footer></view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Footer from '@/components/footer_common.vue';
|
||||
import {get,post} from '@/utils/request';
|
||||
import {IMAGE_BASE_URL,BASE_URL} from '@/utils/config';
|
||||
export default{
|
||||
name:'aiHelper',
|
||||
components:{Footer},
|
||||
data(){
|
||||
return{
|
||||
aiHelperTitle:'AI智能助手',
|
||||
aiHelperTitleBackground:'../../static/imgs/ai/title.png',
|
||||
aiType:[],
|
||||
import { get, post } from '@/utils/request';
|
||||
import { IMAGE_BASE_URL, BASE_URL } from '@/utils/config';
|
||||
export default {
|
||||
name: 'aiHelper',
|
||||
components: { Footer },
|
||||
data() {
|
||||
return {
|
||||
aiHelperTitle: 'AI智能助手',
|
||||
aiHelperTitleBackground: '../../static/imgs/ai/title.png',
|
||||
aiType: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getData();
|
||||
},
|
||||
methods:{
|
||||
goAiType(item){
|
||||
methods: {
|
||||
goAiType(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/chat/chatPage?serviceUrl=${item.serviceUrl}&apiKey=${item.apiKey}&id=${item.id}&name=${item.name}&icon=${item.icon}`
|
||||
});
|
||||
},
|
||||
async getData(){
|
||||
async getData() {
|
||||
let params = {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
@ -60,86 +59,91 @@
|
||||
if (!res || !res.success) {
|
||||
throw new Error('获取AI助手失败');
|
||||
}
|
||||
if(res.data.length>0){
|
||||
res.data.forEach((item)=>{
|
||||
item.background=IMAGE_BASE_URL+item.background
|
||||
item.imagePath=IMAGE_BASE_URL+item.imagePath
|
||||
item.icon=IMAGE_BASE_URL+item.icon
|
||||
if (res.data.length > 0) {
|
||||
res.data.forEach((item) => {
|
||||
item.background = IMAGE_BASE_URL + item.background
|
||||
item.imagePath = IMAGE_BASE_URL + item.imagePath
|
||||
item.icon = IMAGE_BASE_URL + item.icon
|
||||
})
|
||||
}
|
||||
this.aiType=res.data
|
||||
this.aiType = res.data
|
||||
} catch (err) {
|
||||
console.error('获取AI助手失败:', err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.aiHelper{
|
||||
// margin-top: 90rpx;
|
||||
// 引入变量和混入
|
||||
// @import "@/styles/variables.scss"; // 假设你有这个文件,没有可以忽略
|
||||
|
||||
.aiHelper {
|
||||
// 使用安全区域适配,避免底部被遮挡
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
|
||||
.aiHelperContainer {
|
||||
padding: 2%;
|
||||
padding-bottom: 50%;
|
||||
padding: 30rpx; // 使用rpx单位适配不同屏幕
|
||||
box-sizing: border-box; // 确保padding不会增加总宽度
|
||||
|
||||
.aiHelperTitle {
|
||||
font-size: 1rem;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0;
|
||||
line-height: 1.5;
|
||||
color: rgba(0, 0, 0, 1);
|
||||
color: #000;
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
margin-bottom: 3%;
|
||||
// background-image: url('../../static/imgs/ai/title.png');
|
||||
// padding: 20rpx 0 30rpx; // 增加底部内边距
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50% 80%;
|
||||
background-size: 30%;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.aiBox {
|
||||
// 增加容器内边距,避免卡片贴边
|
||||
padding: 10rpx 0;
|
||||
|
||||
.aiType {
|
||||
margin-bottom: 3%;
|
||||
// 关键优化:使用固定间距代替百分比,确保不同设备一致
|
||||
margin-bottom: 30rpx;
|
||||
width: 100%;
|
||||
height: 310rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.aiTypeContainer {
|
||||
display: flex;
|
||||
margin: 1%;
|
||||
border-radius: 0.5rem;
|
||||
border-radius: 20rpx; // 更大的圆角更美观
|
||||
background-size: cover;
|
||||
box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.25);
|
||||
background-position: 30% 50%;
|
||||
background-repeat: no-repeat;
|
||||
width: 96%;
|
||||
aspect-ratio: 2.1/1;
|
||||
width: 100%;
|
||||
// 关键优化:使用固定高度代替aspect-ratio,避免变形
|
||||
height: 320rpx;
|
||||
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.15); // 更柔和的阴影
|
||||
overflow: hidden; // 防止内容溢出
|
||||
|
||||
.aiLeft {
|
||||
border-radius: 0.5rem;
|
||||
border-radius: 16rpx;
|
||||
padding: 5% 0;
|
||||
margin-right: 12%;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
width: 35%;
|
||||
// height: 100%;
|
||||
/* margin-left: -5%;*/
|
||||
position: relative;
|
||||
// 增加内边距,避免内容贴边
|
||||
padding: 20rpx;
|
||||
|
||||
.aiLeftTitle {
|
||||
font-size: 0.8rem;
|
||||
font-size: 30rpx;
|
||||
font-weight: 900;
|
||||
letter-spacing: 0;
|
||||
line-height: 1.4;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
color: #fff;
|
||||
text-align: left;
|
||||
position: absolute;
|
||||
bottom: 10%;
|
||||
left: 10%;
|
||||
bottom: 20rpx;
|
||||
left: 20rpx;
|
||||
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3); // 增加文字阴影提高可读性
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,34 +151,66 @@
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: normal;
|
||||
justify-content: center;
|
||||
padding-right: 30rpx; // 增加右侧内边距
|
||||
|
||||
.aiRightTitle {
|
||||
font-size: 0.8rem;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0;
|
||||
line-height: 1.4;
|
||||
color: rgba(0, 0, 0, 1);
|
||||
color: #000;
|
||||
text-align: left;
|
||||
margin-bottom: 5%;
|
||||
margin-top: 22%;
|
||||
margin-bottom: 20rpx;
|
||||
line-height: 1.5; // 增加行高,避免文字拥挤
|
||||
// 限制最大宽度,防止文字溢出
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.aiDescription {
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0;
|
||||
line-height: 2.5;
|
||||
color: #999;
|
||||
text-align: right;
|
||||
width: 90%;
|
||||
width: 100%;
|
||||
padding-top: 10rpx;
|
||||
// 增加交互提示
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 增加hover效果,提升交互体验
|
||||
&:active .aiTypeContainer {
|
||||
transform: scale(0.98);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
&:active .aiDescription {
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 响应式适配:针对不同屏幕尺寸调整
|
||||
@media screen and (min-width: 750rpx) {
|
||||
.aiTypeContainer {
|
||||
height: 340rpx !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 375rpx) {
|
||||
.aiTypeContainer {
|
||||
height: 280rpx !important;
|
||||
}
|
||||
|
||||
.aiRightTitle {
|
||||
font-size: 28rpx !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -85,8 +85,14 @@
|
||||
</view>
|
||||
</u-modal>
|
||||
|
||||
<u-modal :show="showPhoneDialog" title="联系社区" confirm-text="拨打" cancel-text="取消" @confirm="callCommunityPhone"
|
||||
@cancel="showPhoneDialog = false">
|
||||
<u-modal
|
||||
:show="showPhoneDialog"
|
||||
title="联系社区"
|
||||
confirm-text="拨打"
|
||||
cancel-text="取消"
|
||||
@confirm="callCommunityPhone"
|
||||
@cancel="showPhoneDialog = false"
|
||||
:closeOnClickOverlay="true">
|
||||
<view class="phone-dialog-content">
|
||||
<text>社区电话:</text>
|
||||
<text class="phone-number">{{communityPhone}}</text>
|
||||
@ -157,8 +163,7 @@
|
||||
{
|
||||
key: 5,
|
||||
url: "/static/imgs/service/service_notice.png",
|
||||
name: '设置',
|
||||
pageUrl: 'serviceNoticeList'
|
||||
name: '设置'
|
||||
},
|
||||
{
|
||||
key: 6,
|
||||
@ -174,6 +179,9 @@
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
handleCloseModal() {
|
||||
this.showPhoneDialog = false;
|
||||
},
|
||||
// 初始化数据
|
||||
async initData() {
|
||||
const token = uni.getStorageSync('token');
|
||||
@ -198,15 +206,18 @@
|
||||
|
||||
// 更新用户信息
|
||||
updateUserInfo(data) {
|
||||
// 显示时拼接IMAGE_BASE_URL
|
||||
const avatarUrl = data.avatar ? `${IMAGE_BASE_URL}${data.avatar}` : '/static/imgs/index/nav.png';
|
||||
|
||||
this.userInfo = {
|
||||
nickName: data.name || data.nickName || '未命名用户',
|
||||
avatarUrl: data.avatar || data.avatarUrl || '/static/imgs/index/nav.png',
|
||||
avatarUrl: avatarUrl,
|
||||
bio: data.introduce || data.bio || '这家伙很懒,什么都没有写~',
|
||||
phone: data.phone || ''
|
||||
};
|
||||
|
||||
// 更新显示头像
|
||||
this.displayAvatar = this.userInfo.avatarUrl || '/static/imgs/index/nav.png';
|
||||
this.displayAvatar = this.userInfo.avatarUrl;
|
||||
|
||||
this.formData = {
|
||||
name: this.userInfo.nickName,
|
||||
@ -368,12 +379,13 @@
|
||||
async loginComplete(data) {
|
||||
try {
|
||||
// 获取最新用户信息
|
||||
this.showEditModal = false;
|
||||
const res = await get('/api/v1/app_auth/mine');
|
||||
if (res && res.success) {
|
||||
uni.setStorageSync('userInfo', res.data);
|
||||
this.updateUserInfo(res.data);
|
||||
this.isLogin = true;
|
||||
this.showEditModal = false;
|
||||
// this.showEditModal = false;
|
||||
this.showPhoneButton = false;
|
||||
uni.showToast({
|
||||
title: '登录成功'
|
||||
@ -414,7 +426,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
if (fileInfo.size > 2 * 1024 * 1024) {
|
||||
if (fileInfo.size > 3 * 1024 * 1024) {
|
||||
throw new Error('图片大小不能超过2MB');
|
||||
}
|
||||
|
||||
@ -452,7 +464,7 @@
|
||||
try {
|
||||
const res = JSON.parse(uploadRes.data);
|
||||
if (res && res.success) {
|
||||
resolve(`${IMAGE_BASE_URL}${res.data}`);
|
||||
resolve(res.data);
|
||||
} else {
|
||||
reject(new Error(res.message || '上传失败'));
|
||||
}
|
||||
@ -507,7 +519,12 @@
|
||||
name,
|
||||
bio
|
||||
} = this.formData;
|
||||
const avatarUrl = this.avatarList.length > 0 ? this.avatarList[0].url : "";
|
||||
console.log("====", this.avatarList)
|
||||
let avatarUrl = this.avatarList.length > 0 ? this.avatarList[0].url : "";
|
||||
|
||||
if (avatarUrl && avatarUrl.includes(IMAGE_BASE_URL)) {
|
||||
avatarUrl = avatarUrl.replace(IMAGE_BASE_URL, '');
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
uni.showToast({
|
||||
@ -535,12 +552,13 @@
|
||||
// 3. 更新本地存储和页面数据
|
||||
uni.setStorageSync('userInfo', res.data);
|
||||
this.updateUserInfo(res.data);
|
||||
this.showEditModal = false;
|
||||
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '修改成功'
|
||||
});
|
||||
this.showEditModal = false;
|
||||
|
||||
} else {
|
||||
throw new Error(res.message || '获取用户信息失败');
|
||||
}
|
||||
@ -559,10 +577,17 @@
|
||||
this.showEditModal = false;
|
||||
},
|
||||
|
||||
// 跳转页面
|
||||
// 跳转页面
|
||||
goPage(item) {
|
||||
if (item.key === 6) { // 联系社区的特殊处理
|
||||
this.handleContactCommunity();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.key === 5) { // 设置的特殊处理
|
||||
this.handleEditClick(); // 调用编辑用户信息的方法
|
||||
return;
|
||||
}
|
||||
|
||||
@ -585,7 +610,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
this.showPhoneDialog = true;
|
||||
uni.showModal({
|
||||
title: '联系社区',
|
||||
content: '是否要拨打社区电话:' + this.communityPhone,
|
||||
confirmText: '拨打',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.callCommunityPhone();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 拨打社区电话
|
||||
|
||||
@ -13,65 +13,63 @@
|
||||
<text class="title">{{ postData.title }}</text>
|
||||
<text class="content-text">{{ postData.content }}</text>
|
||||
<view class="images" v-if="postData.images && postData.images.length">
|
||||
<image v-for="(img, index) in postData.images" :key="index" :src="img" class="post-image" :class="{
|
||||
<image v-for="(img, index) in postData.images" :key="index" :src="`${IMAGE_BASE_URL}`+img"
|
||||
class="post-image" :class="{
|
||||
'single-img': postData.images.length === 1,
|
||||
'double-img': postData.images.length === 2,
|
||||
'multi-img': postData.images.length >= 3
|
||||
}" mode="aspectFill" @click="previewImage(index)"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="post-footer">
|
||||
<view class="post-actions">
|
||||
<view class="action-item">
|
||||
|
||||
<text class="action-text">{{ getTotalComments() }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 评论列表 -->
|
||||
<view class="comments-container">
|
||||
<view class="comments-title">评论 ({{ getTotalComments() }})</view>
|
||||
<view class="section-header">
|
||||
<text class="section-title">评论 ({{ getTotalComments() }})</text>
|
||||
</view>
|
||||
<view class="comments-list">
|
||||
<view v-for="(comment, index) in flatComments" :key="comment.id" class="comment-item" :style="{
|
||||
'--level': comment.level,
|
||||
'--indent': comment.level > 0 ? (comment.level * 60) + 'rpx' : '0'
|
||||
}">
|
||||
<!-- 层级视觉指示线条 -->
|
||||
<view class="comment-level-indicator" v-if="comment.level > 0"></view>
|
||||
|
||||
<!-- 评论内容区 -->
|
||||
<view class="comment-content-wrapper">
|
||||
<image class="comment-avatar" :src="comment.pusherPortrait" mode="aspectFill"></image>
|
||||
<view class="comment-main">
|
||||
<view class="comment-meta">
|
||||
<text class="comment-username">{{ comment.pusherName }}</text>
|
||||
<text class="comment-time">{{ formatTime(comment.createdAt) }}</text>
|
||||
</view>
|
||||
<view class="comment-text">{{ comment.content }}</view>
|
||||
<view class="comment-actions">
|
||||
<text class="reply-btn" @click="handleReply(comment.id)">回复</text>
|
||||
<!-- 只在一级评论显示折叠按钮 -->
|
||||
<text class="fold-btn" v-if="comment.level === 0 && hasChildren(comment)"
|
||||
@click="toggleFold(comment.id)">
|
||||
{{ getChildCount(comment) }}条回复{{ foldedComments.includes(comment.id) ? '展开' : '折叠' }}
|
||||
<view v-for="comment in flatComments" :key="comment.id" class="comment-item"
|
||||
:class="{'is-reply': comment.toUserName}">
|
||||
<view class="comment-header">
|
||||
<image class="avatar" :src="comment.pusherPortrait" mode="aspectFill"></image>
|
||||
<view class="comment-user-info">
|
||||
<text class="username">{{ comment.pusherName }}</text>
|
||||
<view class="meta-info">
|
||||
<text v-if="comment.toUserName" class="reply-to">
|
||||
回复 {{ comment.toUserName }}
|
||||
</text>
|
||||
<text class="time">{{ formatTime(comment.createdAt) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="comment-content">{{ comment.content }}</view>
|
||||
|
||||
<view class="comment-actions">
|
||||
<!-- <view class="action-item" @click="toggleLike(comment.id)">
|
||||
<text class="action-icon">{{ comment.isLiked ? '👍' : '👎' }}</text>
|
||||
<text class="action-count">{{ comment.likeCount || 0 }}</text>
|
||||
</view> -->
|
||||
<view class="action-item" @click="handleReply(comment.id)">
|
||||
<text class="action-text">回复</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view class="load-more" v-if="showLoadMore && !loading" @click="loadMoreComments">
|
||||
<text>加载更多</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 新评论输入框 -->
|
||||
<view class="comment-input-container">
|
||||
<!-- 回复提示条 -->
|
||||
<view class="replying-bar" v-if="replyingTo">
|
||||
<text class="replying-text">回复 @{{ getReplyUsername(replyingTo) }}</text>
|
||||
<text class="cancel-reply" @click="cancelReply">取消</text>
|
||||
</view>
|
||||
|
||||
<view class="input-wrapper">
|
||||
<input class="comment-input" v-model="newComment" :placeholder="replyingTo ? '输入回复内容...' : '写下你的评论...'"
|
||||
@confirm="submitComment" />
|
||||
@ -84,21 +82,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
get,
|
||||
post
|
||||
} from '@/utils/request';
|
||||
import {
|
||||
formatTime
|
||||
} from '@/utils/timeFormat';
|
||||
// import uniIcons from '@/components/uni-icons/uni-icons.vue';
|
||||
|
||||
import { get, post } from '@/utils/request';
|
||||
import { formatTime } from '@/utils/timeFormat';
|
||||
import { IMAGE_BASE_URL,BASE_URL } from '@/utils/config';
|
||||
export default {
|
||||
components: {
|
||||
// uniIcons
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
IMAGE_BASE_URL,
|
||||
Id: '',
|
||||
flatComments: [],
|
||||
newComment: "",
|
||||
@ -109,8 +99,8 @@
|
||||
loading: false,
|
||||
error: '',
|
||||
submitting: false,
|
||||
foldedComments: [], // 存储被折叠的评论ID
|
||||
showLoadMore: false, // 是否显示加载更多
|
||||
foldedComments: [],
|
||||
showLoadMore: false,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
};
|
||||
@ -125,9 +115,33 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 扁平化评论结构(核心修改)
|
||||
updateFlatComments() {
|
||||
const flattenComments = (comments, parentUser = '') => {
|
||||
return comments.reduce((arr, comment) => {
|
||||
// 添加回复关系和点赞状态
|
||||
const newComment = {
|
||||
...comment,
|
||||
toUserName: parentUser,
|
||||
isLiked: false,
|
||||
likeCount: comment.likeCount || 0
|
||||
};
|
||||
|
||||
arr.push(newComment);
|
||||
|
||||
if (comment.children && comment.children.length) {
|
||||
arr.push(...flattenComments(comment.children, comment.pusherName));
|
||||
}
|
||||
|
||||
return arr;
|
||||
}, []);
|
||||
};
|
||||
this.flatComments = flattenComments(this.postData.histories || []);
|
||||
},
|
||||
|
||||
// 检查用户是否已登录
|
||||
checkLogin() {
|
||||
const token = uni.getStorageSync('token'); // 假设token存储在本地
|
||||
const token = uni.getStorageSync('token');
|
||||
return !!token;
|
||||
},
|
||||
|
||||
@ -140,7 +154,7 @@
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/index' // 替换为实际的个人中心页面路径
|
||||
url: '/pages/mine/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -151,65 +165,28 @@
|
||||
previewImage(index) {
|
||||
if (!this.postData.images || !this.postData.images.length) return;
|
||||
|
||||
const fullImageUrls = this.postData.images.map(imagePath => {
|
||||
return IMAGE_BASE_URL + imagePath;
|
||||
});
|
||||
|
||||
uni.previewImage({
|
||||
current: index,
|
||||
urls: this.postData.images
|
||||
urls: fullImageUrls // 传递完整的 URL 数组
|
||||
});
|
||||
},
|
||||
|
||||
// 检查评论是否有子评论
|
||||
hasChildren(comment) {
|
||||
return comment.children && comment.children.length > 0;
|
||||
},
|
||||
|
||||
// 获取子评论数量
|
||||
getChildCount(comment) {
|
||||
if (!this.hasChildren(comment)) return 0;
|
||||
return comment.children.length;
|
||||
},
|
||||
|
||||
// 切换折叠状态
|
||||
toggleFold(commentId) {
|
||||
const index = this.foldedComments.indexOf(commentId);
|
||||
if (index === -1) {
|
||||
this.foldedComments.push(commentId);
|
||||
} else {
|
||||
this.foldedComments.splice(index, 1);
|
||||
// 切换点赞状态
|
||||
toggleLike(commentId) {
|
||||
const comment = this.flatComments.find(item => item.id === commentId);
|
||||
if (comment) {
|
||||
comment.isLiked = !comment.isLiked;
|
||||
comment.likeCount += comment.isLiked ? 1 : -1;
|
||||
}
|
||||
this.updateFlatComments();
|
||||
},
|
||||
|
||||
// 更新平铺评论列表(处理折叠逻辑)
|
||||
updateFlatComments() {
|
||||
const flattenWithFold = (comments, level = 0, parentFolded = false) => {
|
||||
return comments.reduce((arr, comment) => {
|
||||
// 只有一级评论才检查折叠状态
|
||||
const isFolded = level === 0 && this.foldedComments.includes(comment.id);
|
||||
const currentFolded = parentFolded || isFolded;
|
||||
|
||||
if (!parentFolded) {
|
||||
arr.push({
|
||||
...comment,
|
||||
level,
|
||||
isFolded
|
||||
});
|
||||
}
|
||||
|
||||
// 如果是一级评论且被折叠,则不显示子评论
|
||||
if (comment.children && comment.children.length && !(level === 0 && isFolded)) {
|
||||
arr.push(...flattenWithFold(comment.children, level + 1, currentFolded));
|
||||
}
|
||||
|
||||
return arr;
|
||||
}, []);
|
||||
};
|
||||
|
||||
this.flatComments = flattenWithFold(this.postData.histories || []);
|
||||
},
|
||||
// 加载更多评论
|
||||
loadMoreComments() {
|
||||
this.currentPage++;
|
||||
// 这里应该调用API获取更多评论,示例中简化处理
|
||||
this.getDetail();
|
||||
},
|
||||
|
||||
@ -222,14 +199,12 @@
|
||||
pageSize: this.pageSize
|
||||
});
|
||||
if (!res?.success) throw new Error(res?.message || '获取详情失败');
|
||||
|
||||
if (this.currentPage === 1) {
|
||||
this.postData = res.data;
|
||||
} else {
|
||||
// 合并评论数据
|
||||
this.postData.histories = [...this.postData.histories, ...res.data.histories];
|
||||
}
|
||||
|
||||
this.updateFlatComments();
|
||||
this.showLoadMore = (res.data.histories.length >= this.pageSize);
|
||||
} catch (err) {
|
||||
@ -242,22 +217,16 @@
|
||||
|
||||
formatTime(isoTime) {
|
||||
if (!isoTime) return '';
|
||||
return formatTime(isoTime); // 使用统一的格式化方法
|
||||
return formatTime(isoTime);
|
||||
},
|
||||
|
||||
// 计算总评论数
|
||||
getTotalComments() {
|
||||
const count = (comments) => {
|
||||
return comments.reduce((total, comment) => {
|
||||
return total + 1 + (comment.children ? count(comment.children) : 0);
|
||||
}, 0);
|
||||
};
|
||||
return count(this.postData.histories || []);
|
||||
return this.flatComments.length;
|
||||
},
|
||||
|
||||
// 提交评论/回复
|
||||
async submitComment() {
|
||||
// 检查用户是否已登录
|
||||
if (!this.checkLogin()) {
|
||||
this.goToLogin();
|
||||
this.newComment = "";
|
||||
@ -266,7 +235,6 @@
|
||||
|
||||
const content = this.newComment.trim();
|
||||
if (!content || this.submitting) return;
|
||||
|
||||
try {
|
||||
this.submitting = true;
|
||||
const requestData = {
|
||||
@ -274,12 +242,10 @@
|
||||
reciprocityId: this.postData.id,
|
||||
rootHistoryId: this.replyingTo || ""
|
||||
};
|
||||
|
||||
const response = await post(
|
||||
'/api/v1/app_auth/reciprocities/send',
|
||||
requestData
|
||||
);
|
||||
|
||||
if (response.success) {
|
||||
this.newComment = '';
|
||||
this.replyingTo = null;
|
||||
@ -309,7 +275,6 @@
|
||||
|
||||
// 处理回复按钮点击
|
||||
handleReply(commentId) {
|
||||
// 检查用户是否已登录
|
||||
if (!this.checkLogin()) {
|
||||
this.goToLogin();
|
||||
return;
|
||||
@ -332,150 +297,96 @@
|
||||
|
||||
// 获取被回复人的用户名
|
||||
getReplyUsername(commentId) {
|
||||
const findUser = (comments) => {
|
||||
for (const c of comments) {
|
||||
if (c.id === commentId) return c.pusherName;
|
||||
if (c.children && c.children.length) {
|
||||
const user = findUser(c.children);
|
||||
if (user) return user;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
||||
return findUser(this.postData.histories);
|
||||
const comment = this.flatComments.find(item => item.id === commentId);
|
||||
return comment ? comment.pusherName : '';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/* 使用SCSS增强样式能力 */
|
||||
$primary-color: #4361ee; // 更现代的蓝色
|
||||
$primary-light: #e9f0ff; // 浅蓝色背景
|
||||
$text-color: #2d3748; // 深灰色文字
|
||||
$light-text: #718096; // 浅灰色文字
|
||||
$border-color: #e2e8f0; // 更柔和的边框色
|
||||
$bg-color: #f7fafc; // 浅灰色背景
|
||||
$comment-bg: #ffffff; // 白色评论背景
|
||||
$shadow-sm: 0 1rpx 3rpx rgba(0, 0, 0, 0.05); // 小阴影
|
||||
$shadow-md: 0 4rpx 6rpx rgba(0, 0, 0, 0.08); // 中等阴影
|
||||
$radius-lg: 24rpx; // 大圆角
|
||||
$radius-md: 16rpx; // 中圆角
|
||||
$radius-sm: 8rpx; // 小圆角
|
||||
$transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); // 平滑过渡
|
||||
/* 基础变量定义 */
|
||||
$primary-color: #3881FF;
|
||||
$text-color: #333;
|
||||
$light-text: #999;
|
||||
$border-color: #eee;
|
||||
$bg-color: #f8f8f8;
|
||||
$radius-md: 16rpx;
|
||||
$radius-sm: 8rpx;
|
||||
$spacing-lg: 32rpx;
|
||||
$spacing-md: 24rpx;
|
||||
$spacing-sm: 16rpx;
|
||||
|
||||
.content {
|
||||
padding: 32rpx;
|
||||
background-color: $bg-color;
|
||||
/* 增加底部内边距,确保内容不被输入框遮挡 */
|
||||
padding: $spacing-lg;
|
||||
background-color: white;
|
||||
padding-bottom: 240rpx;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 主帖样式优化 */
|
||||
/* 主帖样式 */
|
||||
.post-container {
|
||||
background-color: white;
|
||||
border-radius: $radius-lg;
|
||||
padding: 48rpx;
|
||||
margin-bottom: 40rpx;
|
||||
box-shadow: $shadow-sm;
|
||||
transition: $transition;
|
||||
border: 1rpx solid $border-color;
|
||||
|
||||
&:hover {
|
||||
box-shadow: $shadow-md;
|
||||
transform: translateY(-1rpx);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
padding: 0 0 $spacing-lg 0;
|
||||
margin-bottom: $spacing-lg;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
|
||||
.post-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
margin-bottom: $spacing-md;
|
||||
|
||||
.avatar {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 32rpx;
|
||||
border: 2rpx solid white;
|
||||
box-shadow: $shadow-sm;
|
||||
background-color: #f5f5f5;
|
||||
transition: $transition;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
margin-right: $spacing-md;
|
||||
}
|
||||
|
||||
.post-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.username {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: $text-color;
|
||||
line-height: 1.5;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 26rpx;
|
||||
font-size: 24rpx;
|
||||
color: $light-text;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.post-content {
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
margin-bottom: 32rpx;
|
||||
color: $text-color;
|
||||
margin-bottom: $spacing-md;
|
||||
display: block;
|
||||
line-height: 1.6;
|
||||
letter-spacing: -0.01em;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.content-text {
|
||||
font-size: 30rpx;
|
||||
color: $text-color;
|
||||
line-height: 1.7;
|
||||
margin-bottom: 40rpx;
|
||||
display: block;
|
||||
word-break: break-word;
|
||||
}
|
||||
line-height: 1.6;
|
||||
margin-bottom: $spacing-lg;
|
||||
}
|
||||
|
||||
.images {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 24rpx;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
gap: $spacing-sm;
|
||||
|
||||
.post-image {
|
||||
border-radius: $radius-md;
|
||||
background-color: #f5f5f5;
|
||||
object-fit: cover;
|
||||
transition: $transition;
|
||||
box-shadow: $shadow-sm;
|
||||
cursor: zoom-in;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.02);
|
||||
box-shadow: $shadow-md;
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
background-color: $bg-color;
|
||||
|
||||
&.single-img {
|
||||
width: 100%;
|
||||
@ -483,186 +394,161 @@
|
||||
}
|
||||
|
||||
&.double-img {
|
||||
width: calc(50% - 12rpx);
|
||||
width: calc(50% - 8rpx);
|
||||
height: 360rpx;
|
||||
}
|
||||
|
||||
&.multi-img {
|
||||
width: calc(33.33% - 16rpx);
|
||||
width: calc(33.33% - 10.67rpx);
|
||||
height: 240rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/* 评论区样式优化 */
|
||||
.comments-container {
|
||||
background-color: white;
|
||||
border-radius: $radius-lg;
|
||||
padding: 0 40rpx;
|
||||
margin-bottom: 32rpx;
|
||||
box-shadow: $shadow-sm;
|
||||
border: 1rpx solid $border-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comments-title {
|
||||
/* 评论区样式(核心修改) */
|
||||
.comments-container {
|
||||
background-color: white;
|
||||
padding: 0;
|
||||
|
||||
.section-header {
|
||||
padding: $spacing-md 0;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
margin-bottom: $spacing-md;
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: $text-color;
|
||||
padding: 40rpx 0;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: -1rpx;
|
||||
width: 80rpx;
|
||||
height: 4rpx;
|
||||
background-color: $primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
.comments-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.comment-item {
|
||||
position: relative;
|
||||
padding: 20rpx 0;
|
||||
transition: $transition;
|
||||
margin-bottom: 8rpx;
|
||||
padding: $spacing-md 0;
|
||||
border-bottom: 1rpx solid $border-color;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1rpx solid rgba($border-color, 0.5);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba($primary-light, 0.2);
|
||||
&.is-reply {
|
||||
margin-left: 80rpx;
|
||||
/* 回复评论缩进 */
|
||||
padding-left: $spacing-md;
|
||||
background-color: rgba(248, 248, 248, 0.5);
|
||||
border-radius: $radius-md;
|
||||
}
|
||||
margin-bottom: $spacing-sm;
|
||||
}
|
||||
|
||||
.comment-level-indicator {
|
||||
position: absolute;
|
||||
top: 70rpx;
|
||||
width: 4rpx;
|
||||
background-color: rgba($border-color, 0.5);
|
||||
left: calc(60rpx + var(--indent) - 40rpx);
|
||||
height: calc(100% - 70rpx);
|
||||
}
|
||||
|
||||
.comment-content-wrapper {
|
||||
.comment-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding-left: var(--indent);
|
||||
}
|
||||
|
||||
.comment-avatar {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 24rpx;
|
||||
flex-shrink: 0;
|
||||
background-color: #f5f5f5;
|
||||
border: 1rpx solid $border-color;
|
||||
transition: $transition;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
|
||||
.comment-main {
|
||||
flex: 1;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.comment-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
margin-bottom: $spacing-sm;
|
||||
|
||||
.avatar {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: $spacing-sm;
|
||||
}
|
||||
|
||||
.comment-username {
|
||||
.comment-user-info {
|
||||
flex: 1;
|
||||
|
||||
.username {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $text-color;
|
||||
font-weight: 500;
|
||||
display: block;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.comment-time {
|
||||
.meta-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.reply-to {
|
||||
font-size: 24rpx;
|
||||
color: $primary-color;
|
||||
margin-right: $spacing-sm;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 24rpx;
|
||||
color: $light-text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comment-text {
|
||||
.comment-content {
|
||||
font-size: 28rpx;
|
||||
color: $text-color;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 12rpx;
|
||||
padding: 8rpx 0;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
margin-bottom: $spacing-sm;
|
||||
padding-left: 88rpx;
|
||||
/* 与头像对齐 */
|
||||
}
|
||||
|
||||
.comment-actions {
|
||||
display: flex;
|
||||
gap: $spacing-lg;
|
||||
padding-left: 88rpx;
|
||||
/* 与头像对齐 */
|
||||
|
||||
.action-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 32rpx;
|
||||
padding: 4rpx 0;
|
||||
}
|
||||
|
||||
.reply-btn,
|
||||
.fold-btn {
|
||||
color: $light-text;
|
||||
font-size: 24rpx;
|
||||
color: $primary-color;
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: $radius-sm;
|
||||
transition: $transition;
|
||||
cursor: pointer;
|
||||
background-color: rgba($primary-color, 0.05);
|
||||
|
||||
&:hover {
|
||||
background-color: rgba($primary-color, 0.1);
|
||||
.action-icon {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: scale(0.95);
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fold-btn {
|
||||
/* 加载更多 */
|
||||
.load-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: $spacing-lg 0;
|
||||
color: $light-text;
|
||||
background-color: rgba($light-text, 0.05);
|
||||
font-size: 28rpx;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba($light-text, 0.1);
|
||||
&:active {
|
||||
color: $primary-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 评论输入框样式优化 */
|
||||
/* 底部输入区 */
|
||||
.comment-input-container {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: white;
|
||||
padding: 24rpx 32rpx;
|
||||
padding: $spacing-md;
|
||||
border-top: 1rpx solid $border-color;
|
||||
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.08);
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.replying-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16rpx 24rpx;
|
||||
background-color: $primary-light;
|
||||
padding: $spacing-sm $spacing-md;
|
||||
background-color: $bg-color;
|
||||
border-radius: $radius-md;
|
||||
margin-bottom: 16rpx;
|
||||
margin-bottom: $spacing-sm;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.replying-text {
|
||||
color: $primary-color;
|
||||
@ -674,133 +560,44 @@
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: $radius-sm;
|
||||
cursor: pointer;
|
||||
transition: $transition;
|
||||
background-color: rgba($primary-color, 0.1);
|
||||
|
||||
&:hover {
|
||||
background-color: rgba($primary-color, 0.2);
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
gap: $spacing-md;
|
||||
|
||||
.comment-input {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
padding: 0 32rpx;
|
||||
height: 80rpx;
|
||||
background-color: $bg-color;
|
||||
border-radius: 40rpx;
|
||||
padding: 0 $spacing-md;
|
||||
font-size: 28rpx;
|
||||
border: 1rpx solid $border-color;
|
||||
border-radius: 48rpx;
|
||||
background-color: #f5f5f5;
|
||||
transition: $transition;
|
||||
outline: none;
|
||||
|
||||
&:focus {
|
||||
border-color: $primary-color;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 0 4rpx rgba($primary-color, 0.1);
|
||||
}
|
||||
|
||||
&::placeholder {
|
||||
color: #a0aec0;
|
||||
}
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
min-width: 140rpx;
|
||||
height: 88rpx;
|
||||
background-color: $primary-color;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 48rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
transition: $transition;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 32rpx;
|
||||
padding: 16rpx 32rpx;
|
||||
border-radius: 40rpx;
|
||||
min-width: 120rpx;
|
||||
text-align: center;
|
||||
|
||||
&:hover {
|
||||
background-color: darken($primary-color, 5%);
|
||||
box-shadow: $shadow-sm;
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: darken($primary-color, 10%);
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
background-color: #edf2f7;
|
||||
color: #a0aec0;
|
||||
cursor: not-allowed;
|
||||
box-shadow: none;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
/* 加载更多按钮 */
|
||||
.load-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 32rpx 0;
|
||||
color: $light-text;
|
||||
font-size: 28rpx;
|
||||
cursor: pointer;
|
||||
transition: $transition;
|
||||
|
||||
&:hover {
|
||||
color: $primary-color;
|
||||
}
|
||||
|
||||
text {
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/* 添加一些动画效果 */
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(20rpx); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.comment-item {
|
||||
animation: fadeIn 0.3s ease-out forwards;
|
||||
}
|
||||
|
||||
/* 响应式调整 */
|
||||
@media (max-width: 480px) {
|
||||
.content {
|
||||
padding: 24rpx;
|
||||
padding-bottom: 220rpx;
|
||||
}
|
||||
|
||||
.post-container {
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.comment-input-container {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.comment-item {
|
||||
padding: 16rpx 0;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.comment-avatar {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
|
||||
.comment-text {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,6 +1,41 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="content">
|
||||
<!-- 选择区域 -->
|
||||
<view class="form-item">
|
||||
<view class="label" @click="showTypeSelect = true" style="margin-bottom: 0;">
|
||||
<u-icon name="list" color="#3B8CFF" size="38"></u-icon>
|
||||
选择区域
|
||||
<view class="select-box">
|
||||
{{ workOrderArea || '请选择' }}
|
||||
<u-icon name="arrow-down" color="#999" size="30"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<u-picker
|
||||
:show="showTypeSelect"
|
||||
:columns="areaList"
|
||||
keyName="title"
|
||||
@confirm="handleTypeConfirm"
|
||||
@cancel="showTypeSelect = false">
|
||||
</u-picker>
|
||||
</view>
|
||||
|
||||
<!-- 工单分类 -->
|
||||
<view class="form-item">
|
||||
<view class="label" @click="showSelect = true" style="margin-bottom: 0;">
|
||||
<u-icon name="list" color="#3B8CFF" size="38"></u-icon>
|
||||
工单类型
|
||||
<view class="select-box">
|
||||
{{ workOrderCategory || '请选择' }}
|
||||
<u-icon name="arrow-down" color="#999" size="30"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<u-picker :show="showSelect" :columns="categoryList" keyName="label" @confirm="handleConfirm"
|
||||
@cancel="handleCancel">
|
||||
</u-picker>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item">
|
||||
<view class="label">
|
||||
<u-icon name="order" color="#3B8CFF" size="38"></u-icon>
|
||||
@ -44,20 +79,6 @@
|
||||
<text class="note">注:照片可识别工单内容,支持分批上传,但最大数量为8</text>
|
||||
</view>
|
||||
|
||||
<!-- 工单分类 -->
|
||||
<view class="form-item">
|
||||
<view class="label" @click="showSelect = true">
|
||||
<u-icon name="list" color="#3B8CFF" size="38"></u-icon>
|
||||
工单类型
|
||||
<view class="select-box">
|
||||
{{ workOrderCategory || '请选择' }}
|
||||
<u-icon name="arrow-down" color="#999" size="30"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<u-picker :show="showSelect" :columns="categoryList" keyName="label" @confirm="handleConfirm"
|
||||
@cancel="handleCancel">
|
||||
</u-picker>
|
||||
</view>
|
||||
|
||||
<!-- 工单地点 -->
|
||||
<view class="form-item">
|
||||
@ -99,17 +120,22 @@
|
||||
fileList: [],
|
||||
workOrderCategory: '',
|
||||
workOrderCategoryID: '',
|
||||
workOrderArea:'',
|
||||
workOrderAreaID:'',
|
||||
showSelect: false,
|
||||
showTypeSelect:false,
|
||||
categoryList: [],
|
||||
workOrderLocation: '',
|
||||
expectedTime: '',
|
||||
uploadedImages: [],
|
||||
uploadedVideos: [],
|
||||
videoFormats: ['mp4', 'mov', 'avi', 'wmv', 'mpeg', '3gp', 'flv', 'mkv']
|
||||
videoFormats: ['mp4', 'mov', 'avi', 'wmv', 'mpeg', '3gp', 'flv', 'mkv'],
|
||||
areaList:[],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getOrderList();
|
||||
this.getOrderTypeList();
|
||||
},
|
||||
methods: {
|
||||
handleBack() {
|
||||
@ -281,6 +307,7 @@
|
||||
concatName: this.concatName, // 新增联系人姓名
|
||||
customerPhone: this.customerPhone, // 新增联系人电话
|
||||
orderTypeId: this.workOrderCategoryID,
|
||||
orderAreaId:this.workOrderAreaID,
|
||||
address: this.workOrderLocation,
|
||||
images: this.uploadedImages,
|
||||
videos: this.uploadedVideos,
|
||||
@ -323,6 +350,8 @@
|
||||
this.fileList = [];
|
||||
this.uploadedImages = [];
|
||||
this.uploadedVideos = [];
|
||||
this.workOrderArea = '';
|
||||
this.workOrderAreaID = '';
|
||||
},
|
||||
|
||||
handleConfirm(e) {
|
||||
@ -331,6 +360,12 @@
|
||||
this.showSelect = false;
|
||||
},
|
||||
|
||||
handleTypeConfirm(e) {
|
||||
this.workOrderArea = e.value[0].title;
|
||||
this.workOrderAreaID = e.value[0].id;
|
||||
this.showTypeSelect = false;
|
||||
},
|
||||
|
||||
handleCancel() {
|
||||
this.showSelect = false;
|
||||
},
|
||||
@ -351,6 +386,24 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取工作区域
|
||||
async getOrderTypeList(){
|
||||
try {
|
||||
const res = await get('/api/v1/apps/work-order-area');
|
||||
if (res?.success) {
|
||||
this.areaList = [
|
||||
[...res.data]
|
||||
]
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取工作区域失败:', err);
|
||||
uni.showToast({
|
||||
title: '获取工作区域失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
BIN
static/imgs/.DS_Store
vendored
BIN
static/imgs/ai/.DS_Store
vendored
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 498 B |
|
Before Width: | Height: | Size: 822 B |
|
Before Width: | Height: | Size: 559 B |
|
Before Width: | Height: | Size: 703 B |
|
Before Width: | Height: | Size: 528 B |
|
Before Width: | Height: | Size: 736 B |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 551 B |
|
Before Width: | Height: | Size: 647 B |
|
Before Width: | Height: | Size: 746 B |