首页活动,报事报修评价
Some checks failed
Uniapp 自动化打包 CI/CD / 打包 Uniapp 项目 (push) Has been cancelled

This commit is contained in:
2025-09-09 17:21:35 +08:00
parent fb02715afb
commit 400e95c81b
7 changed files with 199 additions and 71 deletions

View File

@@ -30,5 +30,5 @@ const config = {
config.baseUrl = 'http://183.230.235.66:11010/api';
// config.baseUrl = 'http://46a44a1b.r28.cpolar.top';
// config.baseUrl = 'http://5b35f15d.r28.cpolar.top';
export default config;

View File

@@ -16,6 +16,8 @@ const install = (Vue, vm) => {
//首页公告
getNotices:(params = {})=>vm.$u.get(config.adminPath+'/property/mobile/notices/todayList', params),
//首页活动
getActivityList:(params = {})=>vm.$u.get(config.adminPath+'/property/mobile/activity/list', params),
//工作台列表
getFunList:(params = {})=>vm.$u.get(config.adminPath+'/system/funList/list', params),
//我的访客列表
@@ -29,10 +31,13 @@ const install = (Vue, vm) => {
getOrderList2:(params = {})=>vm.$u.get(config.adminPath+'/property/mobile/workOrders/list',params),
//订单类型
getOrdersType:(params = {})=>vm.$u.get(config.adminPath+'/property/workOrdersType/list',params),
getOrdersType:(params = {})=>vm.$u.get(config.adminPath+'/property/workOrdersType/list',params),
//报事报修订单类型
getRepairTypes:(params = {})=>vm.$u.get(config.adminPath+'/property/workOrdersType/queryList',params),
//报事报修订单类型
getRepairTypes2:(params = {})=>vm.$u.get(config.adminPath+'/property/mobile/workOrders/typeTree',params),
//工单详情
getRepairDetail:(params = {}, id) => vm.$u.get(config.adminPath+`/property/workOrders/{id}`,params),

View File

@@ -53,17 +53,17 @@
<view class="hot-section">
<view class="hot-title-row">
<text class="hot-title">热门活动</text>
<text class="hot-more">全部热门活动 ></text>
<text v-if="false" class="hot-more">全部热门活动 ></text>
</view>
<view class="hot-list">
<view class="hot-card" v-for="(item, idx) in hotList" :key="idx">
<image :src="item.img" class="hot-img" mode="aspectFill" />
<view class="hot-card" v-for="(item, idx) in hotList" :key="idx" @click="goActivityDetail(item)">
<image :src="item.activityImgUrl" class="hot-img" mode="aspectFill" />
<view class="hot-info">
<text class="hot-tag">#热门活动</text>
<text class="hot-desc">{{ item.title }}</text>
<view class="hot-meta">
<text class="hot-date">{{ item.date }}</text>
<text class="hot-status">进行中</text>
<text class="hot-date">{{ item.startTime }}</text>
<text class="hot-status">{{ getStatusText(item.status) }}</text>
</view>
</view>
</view>
@@ -80,13 +80,13 @@ import toast from '../../../uview-ui/libs/function/toast';
name: 'Home',
data() {
return {
banners: [{
img: '/static/aaa_banner1.png'
}
// ,
// {
// img: 'https://picsum.photos/750/300?random=2'
// }
banners: [{
img: '/static/aaa_banner1.png'
}
// ,
// {
// img: 'https://picsum.photos/750/300?random=2'
// }
],
current: 0,
gridList: [
@@ -120,29 +120,37 @@ import toast from '../../../uview-ui/libs/function/toast';
scrollTop: 0,
scrollInterval: null,
scrollHeight: 0,
hotList: [{
img: '/static/aaa_hd1.png',
title: '世界骑行日 低碳出行 让城市更美好',
date: '2025-07-03'
},
{
img: '/static/aaa_hd2.png',
title: '仲夏之夜低碳出行·绿色生活让城市更美好',
date: '2025-07-03'
}
hotList: [
]
}
},
onLoad() {
this.getNotices()
this.getActivityList()
},
methods: {
// 获取状态文字描述
getStatusText(status) {
const statusMap = {
'1': '待进行',
'2': '进行中',
'3': '已完成'
};
return statusMap[status] || '未知状态';
},
async getNotices() {
let res = await this.$u.api.getNotices();
if (res.code == '200') {
this.newsList = res.rows
}
},
async getActivityList() {
let res = await this.$u.api.getActivityList();
if (res.code == '200') {
this.hotList = res.rows
}
},
goNoticeDetail(item){
let params = {}
params.title = item.title
@@ -151,6 +159,15 @@ import toast from '../../../uview-ui/libs/function/toast';
const itemStr = encodeURIComponent(JSON.stringify(params));
uni.navigateTo({ url: '/pages/sys/user/serviceCenter/questionDetail?item=' + itemStr });
},
goActivityDetail(item){
let params = {}
params.title = item.title
params.content = item.activityContent
params.time = item.startTime
params.img = item.activityImgUrl
const itemStr = encodeURIComponent(JSON.stringify(params));
uni.navigateTo({ url: '/pages/sys/user/serviceCenter/questionDetail?item=' + itemStr });
},
onBannerChange(e) {
this.current = e.detail.current;
},

View File

@@ -71,14 +71,33 @@
this.selectedType = item;
},
async getOrderType() {
this.repairTypes = []
let params = {
parentId: '1952989217332658178'
}
let res = await this.$u.api.getRepairTypes(params);
let res = await this.$u.api.getRepairTypes2(params);
if (res.code == '200') {
this.repairTypes = res.data
this.repairInfo.type = res.data[0].id;
this.selectType(res.data[0].orderTypeName)
// 只处理前两条数据
const types = [];
const data = res.data.slice(0, 2); // 只取前两条数据
// 遍历前两个父级分类
data.forEach(parent => {
// 如果没有children或者children为空则添加父级数据
if (!parent.children || parent.children.length === 0) {
types.push(parent);
} else {
// 如果有children则添加所有children数据
types.push(...parent.children);
}
});
this.repairTypes = types;
if (this.repairTypes.length > 0) {
this.repairInfo.type = this.repairTypes[0].id;
this.selectType(this.repairTypes[0].orderTypeName)
}
}
},
// 删除图片
@@ -122,7 +141,7 @@
uni.showToast({
title: '上传失败',
icon: 'none'
});
});
uni.hideLoading();
return;
}
@@ -136,21 +155,21 @@
async realSubmit() {
let res = await this.$u.api.addOrder2(this.repairInfo);
if (res.code == '200') {
if (res.code == '200') {
uni.hideLoading();
// 关闭页面前发送事件通知前页面刷新
uni.$emit('refreshData', '');
// 返回上一页
uni.navigateBack();
const itemStr = encodeURIComponent(JSON.stringify(this.repairInfo));
uni.navigateTo({
url: "/pages/sys/user/myRepair/addSuc?item=" + itemStr,
uni.navigateBack();
const itemStr = encodeURIComponent(JSON.stringify(this.repairInfo));
uni.navigateTo({
url: "/pages/sys/user/myRepair/addSuc?item=" + itemStr,
});
}else{
uni.showToast({
title: res.msg,
icon: 'none'
});
}else{
uni.showToast({
title: res.msg,
icon: 'none'
});
}
},

View File

@@ -34,7 +34,7 @@
<view class="repair-info">建立时间{{ item.createTime }}</view>
<view class="repair-info">工单类型{{ item.typeName }}</view>
<view class="repair-info">报事位置{{ item.location }}</view>
<view v-if="getStatusLabel(item.status) === '已结束'" class="repair-eval-btn eval-btn-right">服务评价</view>
<view v-if="getStatusLabel(item.status) === '已结束'" class="repair-eval-btn eval-btn-right" @click.stop="goTEvaluate(item)">服务评价</view>
</view>
<!-- 加载提示 -->
@@ -138,7 +138,7 @@
pageNum: this.pageNum,
pageSize: this.pageSize
};
let res = await this.$u.api.getOrderList(params);
let res = await this.$u.api.getOrderList2(params);
if (res.code == '200') {
const rows = res.rows || [];
if (reset) {
@@ -212,10 +212,10 @@
};
return statusMap[status] || '';
},
goTEvaluate() {
const detailItemStr = encodeURIComponent(JSON.stringify(this.detailItem));
goTEvaluate(item) {
const itemStr = encodeURIComponent(JSON.stringify(item));
uni.navigateTo({
url: `/pages/sys/user/myRepair/repairEvaluate?detailItem=${detailItemStr}`
url: "/pages/sys/user/myRepair/repairEvaluate?item=" + itemStr
});
},
handleScroll(e) {

View File

@@ -1,6 +1,5 @@
<template>
<view class="evaluate-container">
<!-- 评分项 -->
<view class="evaluate-list">
<view class="evaluate-row">
@@ -8,23 +7,34 @@
<view class="evaluate-stars">
<image v-for="i in 5" :key="i"
:src="detailItem.serviceEvalua >= i ? '/static/ic_evaluate_select.png' : '/static/ic_evaluate_disselect.png'"
class="evaluate-star" @click="detailItem.serviceEvalua = i" />
class="evaluate-star" :class="{'disabled': isViewMode}" @click="!isViewMode && setRating(i)" />
</view>
</view>
</view>
<!-- 输入框 -->
<textarea class="evaluate-textarea" placeholder="说点什么吧..." v-model="detailItem.serviceEvaluaText" />
<textarea class="evaluate-textarea" placeholder="说点什么吧..." v-model="detailItem.serviceEvaluaText"
:disabled="isViewMode" />
<!-- 上传照片 -->
<!-- 上传照片 -->
<view class="repair-evaluate-section">
<view class="repair-evaluate-section" v-if="!isViewMode">
<view class="add-repair-label">上传照片 <text class="add-repair-optional">(非必填最多三张)</text></view>
<u-upload :fileList="selectedImages" @delete="deletePic" name="upload" multiple maxCount="3" width="180"
height="180" :autoUpload="false"></u-upload>
<u-upload :fileList="selectedImages" @on-list-change="onListChange" @delete="deletePic" name="upload"
multiple maxCount="3" width="180" height="180" :autoUpload="false"></u-upload>
</view>
<!-- 查看图片 -->
<view class="repair-evaluate-section" v-else>
<view class="add-repair-label">评价图片</view>
<view class="image-preview-container" v-if="imageList.length > 0">
<image v-for="(img, index) in imageList" :key="index" :src="img" class="preview-image"
@click="previewImage(index)"></image>
</view>
<view class="no-image" v-else>暂无图片</view>
</view>
<!-- 提交按钮 -->
<button class="evaluate-btn" @click="submit">提交</button>
<button class="evaluate-btn" @click="submit" v-if="!isViewMode">提交</button>
</view>
</template>
@@ -41,48 +51,98 @@
return {
comment: '',
selectedImages: [], // 存储已选图片
detailItem: null // 接收传递的详情项
imageList: [], // 查看模式下的图片列表
detailItem: {
serviceEvalua: 0,
serviceEvaluaText: ''
}, // 接收传递的详情项
isViewMode: false // 是否为查看模式
}
},
onLoad(options) {
// 接收传递的detailItem参数
if (options.detailItem) {
// 接收传递的参数
if (options.item) {
try {
this.detailItem = JSON.parse(decodeURIComponent(options.detailItem));
const item = JSON.parse(decodeURIComponent(options.item));
this.detailItem = {
...this.detailItem,
...item
};
console.log(this.detailItem)
this.isViewMode = this.detailItem.serviceEvalua
if (this.isViewMode) {
this.getImageUrl()
}
} catch (e) {
console.error('解析detailItem参数失败', e);
console.error('解析item参数失败', e);
}
}
},
methods: {
async getImageUrl() {
if (!this.detailItem.imgUrl) return;
const imgIds = this.detailItem.imgUrl.split(',');
const res = await this.$u.api.getImageUrl({}, imgIds.join(','));
if (res.code == 200 && res.data) this.imageList = res.data.map(item => item.url);
},
// 设置评分
setRating(rating) {
this.$set(this.detailItem, 'serviceEvalua', rating);
},
// 删除图片
deletePic(event) {
this.selectedImages.splice(event.index, 1);
},
// 图片列表变化处理
onListChange(list) {
this.selectedImages = list;
},
// 预览图片
previewImage(index) {
uni.previewImage({
current: index,
urls: this.imageList
});
},
async submit() {
console.log(this.selectedImages)
if (this.selectedImages.length <= 0) {
this.realSubmit()
return
}
// 遍历selectedImages数组并处理图片路径
const images = this.selectedImages.map(item => item.path.replace('file://', ''));
const result = await uploadFiles({
files: images,
url: this.vuex_config.baseUrl + '/resource/oss/upload',
name: 'file',
vm: this // 关键:用于注入 token 等
const images = this.selectedImages
.map(item => item?.path?.replace('file://', '') || item?.url || null)
.filter(path => path !== null);
uni.showLoading({
title: '加载中...'
});
const result = await uploadFiles({
files: images,
url: this.vuex_config.baseUrl + '/resource/oss/upload',
name: 'file',
vm: this // 关键:用于注入 token 等
});
if (result.code == '200') {
// 遍历result获取data.url加上,分割
const urls = result.map(item => item.data?.url || '').filter(url => url !== '');
this.detailItem.imgUrl = urls.join(',');
this.realSubmit()
}
const allSuccess = result.every(item => item.code == 200);
if (!allSuccess) {
uni.showToast({
title: '上传失败',
icon: 'none'
});
uni.hideLoading();
return;
}
// 遍历result获取data.url加上,分割
const urls = result.map(item => item.data?.ossId || '').filter(ossId => ossId !== '');
this.detailItem.imgUrl = urls.join(',');
this.realSubmit()
},
async realSubmit() {
let res = await this.$u.api.updateOrder(this.detailItem);
let res = await this.$u.api.updateOrder2(this.detailItem);
if (res.code == '200') {
// 关闭页面前发送事件通知前页面刷新
uni.$emit('refreshData', '');
@@ -133,6 +193,10 @@
margin-right: 36rpx;
}
.evaluate-star.disabled {
opacity: 1;
}
.evaluate-tag {
flex: 0 0 calc((100% - 60rpx) / 4);
@@ -164,6 +228,10 @@
display: block;
}
.evaluate-textarea[disabled] {
background-color: #f0f0f0;
}
.evaluate-btn {
width: 80vw;
height: 88rpx;
@@ -198,4 +266,23 @@
font-size: 24rpx;
font-weight: 400;
}
.image-preview-container {
display: flex;
flex-wrap: wrap;
}
.preview-image {
width: 180rpx;
height: 180rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
}
.no-image {
color: #888;
font-size: 28rpx;
text-align: center;
padding: 20rpx 0;
}
</style>

View File

@@ -13,7 +13,7 @@
{{info.content}}
</view>
<image src="/static/ic_q_d_01.png" class="question-img" mode="widthFix" />
<image src="info.img" class="question-img" mode="widthFix" />
<view class="question-time">{{info.time}}</view>
</view>
</view>