一些修改

This commit is contained in:
liuyuan
2025-03-06 09:37:47 +08:00
parent 9accfddbe5
commit 4566c2e696
6 changed files with 38 additions and 16 deletions

View File

@@ -41,7 +41,7 @@
</view>
<view class="list_item_price" v-if="item.courseCatalogueEntityList.length>1">
<text v-for="(v,i) in item.courseCatalogueEntityList" :key="i">
{{(v.title).substring(0, 1)}}<text v-if="i !== item.courseCatalogueEntityList.length - 1">/</text>
{{formatContent(v.title)}}<text v-if="i !== item.courseCatalogueEntityList.length - 1">/</text>
</text>
<text v-if="item.courseCatalogueEntityList[0].halfFee==0" style="padding-left: 20rpx;">免费</text>
<text v-else style="margin-left: 20rpx;">¥{{item.courseCatalogueEntityList[0].halfFee}}/{{item.courseCatalogueEntityList[0].fee}}</text>
@@ -148,6 +148,19 @@ export default {
this.countryText = text;
},
methods: {
//判断显示‘上/中/下’
formatContent(content) {
const keywords = ["上部", "中部", "下部"];
let result = [];
// 判断是否包含关键字
keywords.forEach((keyword) => {
if (content.includes(keyword)) {
result.push(keyword.substring(0, 1));
}
});
return result.join(" / ");
},
//获取数据
getData(id){
uni.showLoading({