Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
mallapp
Commits
9d3e271d
Commit
9d3e271d
authored
Oct 13, 2021
by
Mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
甲鹤商品详情的显示
parent
c0ac8733
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
goods.vue
pages/goods/goods.vue
+25
-3
No files found.
pages/goods/goods.vue
View file @
9d3e271d
...
...
@@ -511,6 +511,8 @@ export default {
//当传过来有主播名称的时候 存入缓存
uni
.
setStorageSync
(
"AnchorName"
,
{
AnchorName
:
option
.
AnchorName
});
}
let
basedata
=
uni
.
getStorageSync
(
"basedata"
)?
uni
.
getStorageSync
(
"basedata"
):
''
;
this
.
AppletID
=
basedata
.
home_pages
.
id
?
basedata
.
home_pages
.
id
:
0
;
this
.
u
=
uni
.
getStorageSync
(
"mall_UserInfo"
);
// if (!this.u) {
// this.u = {
...
...
@@ -603,8 +605,8 @@ export default {
setTimeout
(()
=>
{
this
.
initImages
();
},
3000
);
let
basedata
=
uni
.
getStorageSync
(
"basedata"
)?
uni
.
getStorageSync
(
"basedata"
):
''
;
this
.
AppletID
=
basedata
.
home_pages
.
id
?
basedata
.
home_pages
.
id
:
0
;
},
methods
:
{
clickDescription
(
e
)
{
...
...
@@ -730,7 +732,11 @@ export default {
// /
<
img
/
g
,
// '
<
img
style
=
"margin-top:-4px;width:100%"
'
// );
this.detailContent = richtext;
this.detailContent = richtext;
if(this.AppletID==5){
this.detailContent = this.formatRichText(richtext)
}
this.loading = false;
//登录在调用评论接口
...
...
@@ -745,6 +751,22 @@ export default {
}
);
},
formatRichText(html) {// 甲鹤小程序的时候 图片超出的处理
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='
[
^
']+'
/
gi
,
''
);
match
=
match
.
replace
(
/width="
[^
"
]
+"/gi
,
''
).
replace
(
/width='
[^
'
]
+'/gi
,
''
);
match
=
match
.
replace
(
/height="
[^
"
]
+"/gi
,
''
).
replace
(
/height='
[^
'
]
+'/gi
,
''
);
return
match
;
});
newContent
=
newContent
.
replace
(
/style="
[^
"
]
+"/gi
,
function
(
match
,
capture
)
{
match
=
match
.
replace
(
/width:
[^
;
]
+;/gi
,
'max-width:100%;'
).
replace
(
/width:
[^
;
]
+;/gi
,
'max-width:100%;'
);
return
match
;
});
newContent
=
newContent
.
replace
(
/<br
[^
>
]
*
\/
>/gi
,
''
);
newContent
=
newContent
.
replace
(
/\<img/gi
,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"'
);
return
newContent
;
},
previewImage
(
i
)
{
uni
.
previewImage
({
urls
:
this
.
imgs
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment