Authored by shuaiguo

Merge branch 'refs/heads/develop'

... ... @@ -71,6 +71,7 @@
:add-type="0"
:column-type="columnType"
:authorUid="authorUid"
:direct-comment="true"
@on-comment="onComment">
参与评论
</CommentPlaceholderActionSheet>
... ...
... ... @@ -34,6 +34,7 @@ export default {
const uid = get(await this.$sdk.getUser(), 'uid', 0);
const commentId = this.$attrs['dest-id'];
const articleId = this.$attrs['article-id'];
const directComment = this.$attrs['direct-comment'] || ''; // 是否直接调用评论框,不弹出actionSheet
const commentType = this.$attrs.commentType;
let menu = [];
... ... @@ -61,58 +62,64 @@ export default {
];
}
this.$createActionSheet({
data: menu,
zIndex: 200,
onSelect: item => {
switch (item.content) {
case ITEM.comment: {
this.$refs.placeholder.openComentInput();
break;
}
case ITEM.remove: {
this.setCommentStatus({ type: 1, commentId }).then(result => {
if (result.code === 200) {
this.$createToast({
txt: '已删除',
type: 'correct',
time: 2000
}).show();
this.$emit('remove-comment', { commentId, commentType, articleId });
} else {
this.$createToast({
txt: '删除失败,请重试',
type: 'warn',
time: 2000
}).show();
}
});
break;
}
case ITEM.report: {
this.setCommentStatus({ type: 2, commentId }).then(result => {
if (result.code === 200) {
this.$createToast({
txt: '已举报',
type: 'correct',
time: 2000
}).show();
} else {
this.$createToast({
txt: '举报失败,请重试',
type: 'warn',
time: 2000
}).show();
}
});
break;
}
default: {
// pass
if (directComment) {
return this.$refs.placeholder.openComentInput();
} else {
this.$createActionSheet({
data: menu,
zIndex: 200,
onSelect: item => {
switch (item.content) {
case ITEM.comment: {
this.$refs.placeholder.openComentInput();
break;
}
case ITEM.remove: {
this.setCommentStatus({ type: 1, commentId }).then(result => {
if (result.code === 200) {
this.$createToast({
txt: '已删除',
type: 'correct',
time: 2000
}).show();
this.$emit('remove-comment', { commentId, commentType, articleId });
} else {
this.$createToast({
txt: '删除失败,请重试',
type: 'warn',
time: 2000
}).show();
}
});
break;
}
case ITEM.report: {
this.setCommentStatus({ type: 2, commentId }).then(result => {
if (result.code === 200) {
this.$createToast({
txt: '已举报',
type: 'correct',
time: 2000
}).show();
} else {
this.$createToast({
txt: '举报失败,请重试',
type: 'warn',
time: 2000
}).show();
}
});
break;
}
default: {
// pass
}
}
}
}
}).show();
}).show();
}
}
}
};
... ...
... ... @@ -58,7 +58,7 @@
<DownloadBottom v-if="share" :class="{'scroll-opacity': scrolling}"></DownloadBottom>
<ArticleDetailFooter ref="footer" class="detail-fixed-footer" :style="`transform: translate3d(0, ${viewMoreArticles ? '100%' : '0'}, 0)`" v-bind="footerData" @on-comment-click="onComment">
<template v-if="articleInfo.sort != 2" v-slot:before>
<template v-if="articleInfo.sort" v-slot:before>
<div class="footer-comment">
<CommentPlaceholder
ref="commentInput"
... ... @@ -184,7 +184,7 @@ export default {
return Object.assign({...articleState}, {hasAttention: authorState.hasAttention});
},
headerAnimateStep() {
if (this.articleInfo.sort !== 2 || this.scrollTop > this.coverHeight) {
if (this.articleInfo.sort !== 0 || this.scrollTop > this.coverHeight) {
return 100;
} else if (this.scrollTop > 0) {
let coverHeight = get(this.$refs, 'detailLong.coverHeight', 0);
... ... @@ -205,7 +205,7 @@ export default {
}
},
headerTitleAnimateStep() {
if (this.articleInfo.sort === 2) {
/* if (this.articleInfo.sort === 2) {
let {height, top} = get(this.$refs, 'detailLong.authorBlock', {});
let scrollTop = this.scrollTop + get(this.$refs, 'header.$el.offsetHeight', 0);
... ... @@ -223,7 +223,9 @@ export default {
return 0;
} else {
return 100;
}
}*/
return 100;
},
viewMoreArticles() {
let scrollTop = this.scrollTop;
... ... @@ -388,6 +390,9 @@ export default {
if (get(this.$refs, 'detailNote.onComment')) {
this.$refs.detailNote.onComment(comment);
}
if (get(this.$refs, 'detailLong.onComment')) {
this.$refs.detailLong.onComment(comment);
}
},
setShareData(article) {
if (this.$yoho.isApp || !article) {
... ...
... ... @@ -45,7 +45,7 @@ export default {
let style = {};
this.setIconColor(Math.floor((255 - 68) * (1 - this.stepPercent) + 68));
style.background = `rgba(255,255,255,${this.stepPercent})`;
style.background = `rgba(255,255,255, ${this.stepPercent})`;
if (this.stepPercent > 0.98) {
style.borderBottom = '1px solid #efefef';
... ...
<template>
<div class="article-detail-long">
<div class="header-cover" v-if="!share"></div>
<ArticleItemSlideImage ref="coverFigure" class="cover-figure" :data="coverImage" :thumb-size="coverSize"
<!--<ArticleItemSlideImage ref="coverFigure" class="cover-figure" :data="coverImage" :thumb-size="coverSize"
:style="`transform: translate3d(0, ${coverTranslateY}px, 0)`">
</ArticleItemSlideImage>
</ArticleItemSlideImage>-->
<div ref="authorBlock" class="author-block">
<ArticleItemHeader :share="share" :data="authorData" :lazy="lazy" :more="showMoreOpt"
@on-follow="onFollowAuthor"></ArticleItemHeader>
@on-follow="onFollowAuthor" style="visibility: hidden;"></ArticleItemHeader>
</div>
<div class="main-detail">
<div class="article-context">
<div class="context-title">{{data.articleTitle}}</div>
<ClientOnly>
<div ref="richTextWrapper" @touchstart="tStart" @touchend="tEnd" class="context-rich-text">
<div ref="richTextWrapper" class="context-rich-text">
<VRuntimeTemplate v-once ref="richText" :template="richText" :parent="{}"
:templateProps="{getNoteProduct}"></VRuntimeTemplate>
</div>
... ... @@ -62,6 +62,8 @@ const { mapState: mapArticleState, mapActions, mapGetters } = createNamespacedHe
let timeOutEvent = null;
let isMoving = false;
export default {
name: 'ArticleDetailLong',
props: {
... ... @@ -170,17 +172,27 @@ export default {
...mapMutations(['SET_STATUS_BAR_COLOR']),
...mapActions(['fetchProductBySknList']),
tStart(e) {
if (e.target.src) {
isMoving = false;
if (e.currentTarget && e.currentTarget.dataset.src) {
let src = e.currentTarget.dataset.src;
timeOutEvent = setTimeout(() => {
this.$yoho.longClickSaveImage({ url: e.target.src });
}, 1000);
if (!isMoving) {
this.$yoho.longClickSaveImage({ url: src });
}
}, 500);
}
},
tEnd() {
isMoving = false;
if (timeOutEvent) {
clearTimeout(timeOutEvent);
}
},
tMove() {
isMoving = true;
},
onFollowAuthor(follow) {
this.$emit('on-follow', this.data, follow);
},
... ... @@ -240,6 +252,24 @@ export default {
});
}
// 处理长按图片下载
if (childNodes.length > 0) {
let childsImgs = richText.querySelectorAll('img');
childsImgs.forEach((item) => {
if (item.parentNode && /P/i.test(item.parentNode.nodeName)) {
item.className += ' download-img';
item.parentNode.className += ' download-img-container';
if (item.src) {
item.parentNode.dataset.src = item.src;
item.parentNode.addEventListener('touchstart', vm.tStart);
item.parentNode.addEventListener('touchend', vm.tEnd);
item.parentNode.addEventListener('touchmove', vm.tMove);
}
}
});
}
richText.querySelectorAll('a').forEach(ele => {
if (ele && ele.querySelector && ele.querySelector('img')) {
ele.classList.add('yoho-img-link');
... ... @@ -356,7 +386,8 @@ export default {
}
.article-context {
padding: 30px 0;
padding-top: calc(env(safe-area-inset-top) + 30px);
padding-bottom: 30px;
}
.context-title {
... ... @@ -417,6 +448,10 @@ export default {
display: block;
}
img.download-img {
pointer-events: none;
}
p {
font-size: 32px !important;
... ...
... ... @@ -2,7 +2,8 @@ module.exports = {
presets: [
['@babel/preset-env', {
modules: false,
useBuiltIns: 'usage'
useBuiltIns: 'usage',
corejs: 2
}]
],
sourceType: 'unambiguous',
... ...
... ... @@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
... ... @@ -19,15 +19,15 @@ const webpackConfig = merge(baseConfig, {
},
optimization: {
minimizer: [
new UglifyJsPlugin({
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: true,
uglifyOptions: {
terserOptions: {
safari10: true,
compress: {
warnings: false
},
comments: false
drop_console: true
}
}
}),
new OptimizeCSSAssetsPlugin({
... ...
This diff could not be displayed because it is too large.
{
"name": "yoho-community-web",
"version": "6.9.17",
"version": "6.9.20",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -132,6 +132,7 @@
"stylelint-scss": "^3.8.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"terser-webpack-plugin": "^2.3.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"url-loader": "^1.1.2",
"vconsole": "^3.3.2",
... ...
... ... @@ -10,7 +10,7 @@ module.exports = {
propWhiteList: [] // 属性名称为空,表示替换所有属性的值
}),
require('autoprefixer')({
browsers: ['> 1%', 'android >=4', 'ios >=8']
overrideBrowserslist: ['> 1%', 'android >=4', 'ios >=8']
})
]
};
... ...
This diff could not be displayed because it is too large.