折扣功能+列表文字截取的问题

This commit is contained in:
liuyuan
2025-03-07 11:14:55 +08:00
parent eb42140cae
commit 32ab8f576c
3 changed files with 20 additions and 7 deletions

View File

@@ -12,8 +12,8 @@
"src" : "图片路径" "src" : "图片路径"
} }
], ],
"versionName" : "1.0.55", "versionName" : "1.0.56",
"versionCode" : 1055, "versionCode" : 1056,
"app-plus" : { "app-plus" : {
"nvueCompiler" : "uni-app", "nvueCompiler" : "uni-app",
"compatible" : { "compatible" : {

View File

@@ -52,7 +52,7 @@
<view class="btn_box_price" v-if="item.courseCatalogueEntityList.length>1"> <view class="btn_box_price" v-if="item.courseCatalogueEntityList.length>1">
<text v-for="(v,i) in item.courseCatalogueEntityList" :key="i"> <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>
<text v-if="item.courseCatalogueEntityList[0].halfFee==0" style="padding-left: 20rpx;">免费</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> <text v-else style="margin-left: 20rpx;">¥{{item.courseCatalogueEntityList[0].halfFee}}/{{item.courseCatalogueEntityList[0].fee}}</text>
@@ -207,6 +207,19 @@ export default {
}, },
//方法 //方法
methods: { methods: {
//判断显示‘上/中/下’
formatContent(content) {
const keywords = ["上部", "中部", "下部"];
let result = [];
// 判断是否包含关键字
keywords.forEach((keyword) => {
if (content.includes(keyword)) {
result.push(keyword.substring(0, 1));
}
});
return result.join("");
},
//获取国家-一级 //获取国家-一级
getCountryList() { getCountryList() {
$http.request({ $http.request({

View File

@@ -963,19 +963,19 @@
padding: 0 10rpx; padding: 0 10rpx;
background: linear-gradient(90deg, #258feb 0%, #00e1ec 100%); background: linear-gradient(90deg, #258feb 0%, #00e1ec 100%);
border-radius: 20rpx; border-radius: 20rpx;
font-size: 20rpx; font-size: 18rpx;
line-height: 40rpx; line-height: 40rpx;
height: 40rpx; height: 40rpx;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
margin-right: 10rpx; margin-right: 8rpx;
} }
.vip_type_item:last-child{ .vip_type_item:last-child{
margin-right: 0; margin-right: 0;
} }
.vip_type_item image{ .vip_type_item image{
width: 34rpx; width: 30rpx;
height: 24rpx; height: 20rpx;
} }
.vip_infor{ .vip_infor{
padding-left: 20rpx; padding-left: 20rpx;