|
@@ -161,7 +161,22 @@
|
|
|
|
|
|
// me.tapSelectType(resp.data.data.rental_setting[0])
|
|
|
resp.data.data.distance = common.formatDistance(Number(resp.data.data.distance))
|
|
|
- resp.data.data.desc = this.$htmlData(resp.data.data.desc)
|
|
|
+
|
|
|
+
|
|
|
+ const imgRegex = /<img([^>]*)>/gi;
|
|
|
+
|
|
|
+ // 替换函数,设置 width="100%" 和 height="auto"
|
|
|
+ const updatedRichText = resp.data.data.model_desc.replace(imgRegex, (match) => {
|
|
|
+ // 使用正则表达式移除已有的 width 和 height 属性
|
|
|
+ const cleanedMatch = match.replace(/(width|height)="[^"]*"/gi, '');
|
|
|
+
|
|
|
+ // 添加新的 width="100%" 和 height="auto"
|
|
|
+ return cleanedMatch.replace('<img', '<img width="100%" height="auto"');
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ resp.data.data.model_desc = updatedRichText
|
|
|
+
|
|
|
me.setData({
|
|
|
car_detail: resp.data.data,
|
|
|
// price: ((resp.data.data.rental_setting[0]?.hire_price || 0) / 100).toFixed(2)
|
|
@@ -228,6 +243,15 @@
|
|
|
})
|
|
|
},
|
|
|
useCarBtn() {
|
|
|
+
|
|
|
+ const user_token = storage.getUserToken()
|
|
|
+ if (!user_token) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/loginRegister/login',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
const pData = {
|
|
|
...this.car_detail,
|
|
|
price: this.price
|