|
|
@ -204,7 +204,9 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="detail-content" v-html="goods.content"></view> |
|
|
|
<view class="detail-content" @click="onLook(goods.isLink,goods.contentLink)" v-if="goods.isLink" |
|
|
|
|
|
|
|
v-html="goods.content"></view> |
|
|
|
|
|
|
|
<view class="detail-content" v-else v-html="goods.content"></view> |
|
|
|
<view class="footer"> |
|
|
|
<view class="footer"> |
|
|
|
<view class="fooLeft"> |
|
|
|
<view class="fooLeft"> |
|
|
|
<view class="footerCus firstBtn" v-if="isLogin == false" @click="addCar()"> |
|
|
|
<view class="footerCus firstBtn" v-if="isLogin == false" @click="addCar()"> |
|
|
@ -557,6 +559,13 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
onLook(isLink, url) { |
|
|
|
|
|
|
|
if (isLink) { |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
|
|
url: '/pages/goods/webView?src=' + encodeURIComponent(url) //url是h5的展示地址pageB |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
async getGoodsStockInfor() { |
|
|
|
async getGoodsStockInfor() { |
|
|
|
let params = { |
|
|
|
let params = { |
|
|
|
list: [{ |
|
|
|
list: [{ |
|
|
@ -878,6 +887,29 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
getLinksFromRichText(richText) { |
|
|
|
|
|
|
|
// 正则表达式匹配a标签及其href属性 |
|
|
|
|
|
|
|
const regex = /<a[^>]*href="?([^">]+)"?[^>]*>(.*?)<\/a>/gim; |
|
|
|
|
|
|
|
let matches, links = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 执行正则表达式匹配 |
|
|
|
|
|
|
|
while ((matches = regex.exec(richText)) !== null) { |
|
|
|
|
|
|
|
// matches[1]是href属性值,matches[2]是标签内的文本 |
|
|
|
|
|
|
|
links = matches[1]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return links; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getValueAfterSymbol(str, symbol) { |
|
|
|
|
|
|
|
const parts = str.split(symbol); |
|
|
|
|
|
|
|
if (parts.length > 1) { |
|
|
|
|
|
|
|
return parts[1].trim(); // 使用trim()移除前后空格 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return str; // 如果没有找到符号,返回空字符串 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
containsLetterMix(str, mix) { |
|
|
|
|
|
|
|
return new RegExp(mix.split('').join('\\w*')).test(str) |
|
|
|
|
|
|
|
}, |
|
|
|
// 获取商品信息 |
|
|
|
// 获取商品信息 |
|
|
|
getGoodsDetail(type) { |
|
|
|
getGoodsDetail(type) { |
|
|
|
const that = this |
|
|
|
const that = this |
|
|
@ -897,10 +929,11 @@ |
|
|
|
.replace(/style=""/g, '') |
|
|
|
.replace(/style=""/g, '') |
|
|
|
.replace(/<img " src=/g, '<img src=') |
|
|
|
.replace(/<img " src=/g, '<img src=') |
|
|
|
.replace(/<img src=/g, '<img style="width: 100%; display:block" src=') |
|
|
|
.replace(/<img src=/g, '<img style="width: 100%; display:block" src=') |
|
|
|
// that.goods = info; |
|
|
|
info.contentLink = that.getValueAfterSymbol(that.getLinksFromRichText(info |
|
|
|
|
|
|
|
.content), 'client://') |
|
|
|
|
|
|
|
info.isLink = that.containsLetterMix(info.contentLink, 'jd.com') ? true : false |
|
|
|
Object.keys(info).forEach(item => { |
|
|
|
Object.keys(info).forEach(item => { |
|
|
|
this.$set(this.goods, item, info[item]) |
|
|
|
this.$set(this.goods, item, info[item]) |
|
|
|
// that.goods[item] = info[item] |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
that.isTodo = true; |
|
|
|
that.isTodo = true; |
|
|
@ -1009,7 +1042,6 @@ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 立即下单 |
|
|
|
// 立即下单 |
|
|
|
console.log(this.token, '登录信息') |
|
|
|
|
|
|
|
if (this.goods.stock_total == 0) { |
|
|
|
if (this.goods.stock_total == 0) { |
|
|
|
return this.$toast('库存不足,请选择其他商品购买') |
|
|
|
return this.$toast('库存不足,请选择其他商品购买') |
|
|
|
} |
|
|
|
} |
|
|
|