源文件
This commit is contained in:
129
pages/plugins/blog/comments/comments.vue
Normal file
129
pages/plugins/blog/comments/comments.vue
Normal file
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="(data || null) != null" class="padding-main bg-white">
|
||||
<!-- 评论内容 -->
|
||||
<component-blog-comments :propData="data" :propDataBase="data_base" :propEmojiList="emoji_list" propType="comments"></component-blog-comments>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</view>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentBlogComments from '../components/blog-comments/blog-comments';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
params: null,
|
||||
data_base: null,
|
||||
data: null,
|
||||
emoji_list: [],
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentBlogComments,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: params,
|
||||
});
|
||||
|
||||
// 数据加载
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化
|
||||
get_data() {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('commentsinfo', 'index', 'blog'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: this.params.id || 0,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
var data = res.data.data;
|
||||
if (res.data.code == 0 && (data.data || null) != null) {
|
||||
var blog = data.data;
|
||||
this.setData({
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_status: 3,
|
||||
data_base: data.base || null,
|
||||
data: blog,
|
||||
emoji_list: data.emoji_list || [],
|
||||
});
|
||||
|
||||
// 基础自定义分享
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: this.data.seo_title || this.data.title,
|
||||
desc: this.data.seo_desc || this.data.describe,
|
||||
path: '/pages/plugins/blog/detail/detail',
|
||||
query: 'id=' + this.data.id,
|
||||
img: this.data.cover,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style></style>
|
||||
587
pages/plugins/blog/components/blog-comments/blog-comments.vue
Normal file
587
pages/plugins/blog/components/blog-comments/blog-comments.vue
Normal file
@@ -0,0 +1,587 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="(data || null) != null && (data_base || null) != null">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view v-if="(data_base.is_blog_comments_show || 0) == 1" class="fw-b">{{$t('user-order.user-order.twc3r7')}}{{ data.comments_count || '' }}</view>
|
||||
<!-- 点赞、评论、分享 -->
|
||||
<view v-if="propType == 'detail'" class="tr blog-comments-bottom-container cr-grey">
|
||||
<view v-if="(data_base.is_blog_comments_show || 0) == 1" class="item dis-inline-block cr-base" :data-value="'/pages/plugins/blog/comments/comments?id=' + data.id" @tap="url_event">
|
||||
<iconfont name="icon-message-square" size="28rpx" propClass="pr top-sm margin-right-xs"></iconfont>
|
||||
<text class="text-size-xs">{{$t('ask-comments.ask-comments.2zlnb5')}}{{ data.comments_count }})</text>
|
||||
</view>
|
||||
<view v-if="(data_base.is_blog_give_thumbs || 0) == 1" :class="'item dis-inline-block cr-' + ((data.is_give_thumbs || 0) == 1 ? 'main' : 'base')" :data-blogid="data.id" @tap="give_thumbs_event">
|
||||
<iconfont :name="(data.is_give_thumbs || 0) == 1 ? 'icon-givealike' : 'icon-givealike-o'" size="28rpx" propClass="pr top-sm margin-right-xs"></iconfont>
|
||||
<text class="va-m text-size-xs">{{$t('ask-comments.ask-comments.du7rcv')}}{{ data.give_thumbs_count }})</text>
|
||||
</view>
|
||||
<view class="item dis-inline-block cr-base" @tap="popup_share_event">
|
||||
<iconfont name="icon-share" size="28rpx" propClass="pr top-sm margin-right-xs"></iconfont>
|
||||
<text class="text-size-xs">{{$t('common.share')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评论回复表单 -->
|
||||
<view v-if="(data_base.is_blog_comments_add || 0) == 1 && !input_comments_modal_status" class="padding-top-xxxl padding-bottom-xxl blog-comments-reply-container flex-row jc-sb spacing-mb">
|
||||
<image :src="avatar" mode="aspectFill" class="user-avatar fl circle"></image>
|
||||
<view class="right-base flex-1 flex-width">
|
||||
<view class="comments border-radius-main padding-main">
|
||||
<textarea :placeholder="$t('ask-comments.ask-comments.m67961')" placeholder-class="cr-grey" class="wh-auto bg-grey-f8" :value="input_comments_value" :maxlength="input_comments_length_max" @input="comments_input_event" @blur="comments_input_event"></textarea>
|
||||
<view class="oh flex-row jc-sb align-e">
|
||||
<image :src="common_static_url + 'emoji-icon.png'" mode="aspectFill" class="emoji-icon va-m" @tap="emoji_event"></image>
|
||||
<view class="flex-row align-e">
|
||||
<!-- #ifndef MP-ALIPAY -->
|
||||
<text class="text-size-xs cr-grey-d margin-right-sm">{{$t('login.login.n24i5u')}}{{ input_comments_length_value }}{{$t('ask-comments.ask-comments.6l6vz7')}}</text>
|
||||
<!-- #endif -->
|
||||
<button type="default" size="mini" class="comment-btn cr-white border-radius-sm text-size-md va-m" :class="input_comments_value.length > 0 ? 'bg-main br-main ' : 'comment-btn-default'" @tap="comments_event">{{$t('user-order.user-order.twc3r7')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评论回复内容 -->
|
||||
<view v-if="(data_base.is_blog_comments_show || 0) == 1 && (data.comments_list || null) != null && data.comments_list.length > 0" class="blog-comments-list">
|
||||
<block v-for="(item, index) in data.comments_list" :key="index">
|
||||
<view class="item oh flex-row jc-sb">
|
||||
<image :src="item.user.avatar" mode="aspectFill" class="user-avatar circle fl"></image>
|
||||
<view class="right-content flex-1 flex-width" :class="data.comments_list.length > index + 1 ? 'br-b-e padding-bottom-main margin-bottom-main' : ''">
|
||||
<view class="comments-base oh">
|
||||
<text class="username fw-b">{{ item.user.user_name_view }}</text>
|
||||
<text class="cr-grey-9 margin-left-main">{{ item.add_time }}</text>
|
||||
</view>
|
||||
<view class="margin-top-sm comments-content">{{ item.content }}</view>
|
||||
<view class="blog-comments-right-content-operate margin-top-main flex-row jc-e align-c text-size-xs cr-grey-9">
|
||||
<view v-if="(data_base.is_blog_comments_show || 0) == 1" class="item dis-inline-block" :data-index="index" :data-username="item.user.user_name_view" :data-blogcommentsid="item.id" @tap="modal_open_event">
|
||||
<iconfont name="icon-message-square" size="28rpx" propClass="pr top-md margin-right-xs"></iconfont>
|
||||
<text class="va-m">{{$t('ask-comments.ask-comments.3fcnme')}}{{ item.comments_count }})</text>
|
||||
</view>
|
||||
<view v-if="(data_base.is_blog_give_thumbs || 0) == 1" :class="'item dis-inline-block margin-left-xxxl padding-left-sm cr-' + ((item.is_give_thumbs || 0) == 1 ? 'main' : '')" data-type="1" :data-index="index" :data-blogid="item.blog_id" :data-blogcommentsid="item.id" @tap="give_thumbs_event">
|
||||
<iconfont :name="(item.is_give_thumbs || 0) == 1 ? 'icon-givealike' : 'icon-givealike-o'" size="28rpx" propClass="pr top-md margin-right-xs"></iconfont>
|
||||
<text class="va-m">{{$t('ask-comments.ask-comments.du7rcv')}}{{ item.give_thumbs_count }})</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="(item.reply_comments_list || null) != null && item.reply_comments_list.length > 0" class="reply-blog-comments-list">
|
||||
<block v-for="(comments, index2) in item.reply_comments_list" :key="index2">
|
||||
<view class="bg-grey-e">
|
||||
<view class="item padding-main oh flex-row jc-sb">
|
||||
<image :src="comments.user.avatar" mode="aspectFill" class="user-avatar circle fl"></image>
|
||||
<view class="right-content flex-1 flex-width">
|
||||
<view class="comments-reply-base oh">
|
||||
<text class="username fw-b">{{ comments.user.user_name_view }}</text>
|
||||
<text class="cr-grey-9 margin-left-main">{{ comments.add_time }}</text>
|
||||
</view>
|
||||
<view v-if="(comments.reply_comments_text || null) != null" class="margin-top-sm reply-content">{{ comments.reply_comments_text }}</view>
|
||||
<view class="margin-top-sm">{{ comments.content }}</view>
|
||||
<view class="blog-comments-right-content-operate flex-row jc-e align-c text-size-xs cr-grey-9 padding-0">
|
||||
<view v-if="(data_base.is_blog_comments_show || 0) == 1" class="item dis-inline-block" :data-index="index" :data-username="comments.user.user_name_view" :data-blogcommentsid="comments.blog_comments_id" :data-replycommentsid="comments.id" @tap="modal_open_event">
|
||||
<iconfont name="icon-message-square" size="28rpx" propClass="pr top-md margin-right-xs"></iconfont>
|
||||
<text class="va-m">{{$t('ask-comments.ask-comments.3fcnme')}}{{ comments.comments_count }})</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="(data_base.is_blog_give_thumbs || 0) == 1"
|
||||
:class="'item dis-inline-block margin-left-xxxl padding-left-sm cr-' + ((comments.is_give_thumbs || 0) == 1 ? 'main' : '')"
|
||||
data-type="2"
|
||||
:data-index="index"
|
||||
:data-indexs="index2"
|
||||
:data-blogid="comments.blog_id"
|
||||
:data-blogcommentsid="comments.id"
|
||||
:data-replycommentsid="comments.blog_comments_id"
|
||||
@tap="give_thumbs_event"
|
||||
>
|
||||
<iconfont :name="(comments.is_give_thumbs || 0) == 1 ? 'icon-givealike' : 'icon-givealike-o'" size="28rpx" propClass="pr top-md margin-right-xs"></iconfont>
|
||||
<text class="va-m">{{$t('ask-comments.ask-comments.du7rcv')}}{{ comments.give_thumbs_count }})</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view v-if="(item.comments_count || 0) > 0 && (item.is_comments_list_submit == undefined || item.is_comments_list_submit == 1)" class="margin-top-lg text-size-xs">
|
||||
<text :data-index="index" :data-blogid="item.blog_id" :data-blogcommentsid="item.id" @tap="comments_list_reply_event">
|
||||
<text v-if="item.is_comments_list_submit == undefined" class="cr-grey">{{$t('goods-list.goods-list.278qr1')}}{{ item.comments_count }}{{$t('ask-comments.ask-comments.ymmd24')}}</text>
|
||||
<text v-else class="cr-grey">{{$t('ask-comments.ask-comments.dfhg54')}}</text>
|
||||
<iconfont name="icon-arrow-bottom" size="24rpx" propClass="margin-left-xs pr top-xs"></iconfont>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="((data_base.blog_detail_comments_more_page_number || 0) == 0 && (data.comments_count || 0) > 20) || ((data_base.blog_detail_comments_more_page_number || 0) > 0 && data.comments_count > data_base.blog_detail_comments_more_page_number)">
|
||||
<view v-if="propType == 'detail'" class="margin-top-xxxl tc padding-vertical-main bg-grey-f8 border-radius-sm">
|
||||
<text :data-value="'/pages/plugins/blog/comments/comments?id=' + data.id" @tap="url_event">
|
||||
<text class="cr-grey">{{$t('goods-list.goods-list.278qr1')}}{{ data.comments_count }}{{$t('ask-comments.ask-comments.5401r1')}}</text>
|
||||
<iconfont name="icon-arrow-right" size="24rpx" propClass="margin-left-xs pr top-xs"></iconfont>
|
||||
</text>
|
||||
</view>
|
||||
<view v-if="propType == 'comments' && (data.is_comments_list_submit == undefined || data.is_comments_list_submit == 1)" class="margin-top-xxxl tc padding-vertical-main bg-grey-f8 border-radius-sm">
|
||||
<text :data-blogid="data.id" @tap="comments_list_reply_event">
|
||||
<text class="cr-grey">{{$t('ask-comments.ask-comments.4l77wt')}}</text>
|
||||
<iconfont name="icon-arrow-bottom" size="24rpx" propClass="margin-left-xs pr top-xs"></iconfont>
|
||||
</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 回复弹窗 -->
|
||||
<view v-if="input_comments_modal_status" class="blog-comments-modal pf">
|
||||
<view class="blog-comments-modal-content bg-white border-radius-main pr">
|
||||
<view class="tc margin-bottom-lg">
|
||||
<text>{{$t('ask-comments.ask-comments.8sjar6')}}{{ input_comments_modal_username }}</text>
|
||||
<view class="close pa">
|
||||
<view @tap.stop="modal_close_event">
|
||||
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<textarea :placeholder="$t('ask-comments.ask-comments.m67961')" placeholder-class="cr-grey" class="wh-auto br padding-main" :value="input_comments_value" :maxlength="input_comments_length_max" @input="comments_input_event" @blur="comments_input_event"></textarea>
|
||||
<view class="margin-top-lg oh">
|
||||
<image :src="common_static_url + 'emoji-icon.png'" mode="aspectFill" class="emoji-icon va-m" @tap="emoji_event"></image>
|
||||
<view class="fr">
|
||||
<text class="va-m text-size-xs cr-grey margin-right-lg">{{$t('login.login.n24i5u')}}{{ input_comments_length_value }}{{$t('ask-comments.ask-comments.6l6vz7')}}</text>
|
||||
<button type="default" size="mini" class="comment-btn cr-white border-radius-sm text-size-xs va-m" :class="input_comments_value.length > 0 ? 'bg-main br-main ' : 'comment-btn-default'" @tap="comments_event">{{$t('user-order.user-order.twc3r7')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 表情弹窗 -->
|
||||
<component-emoji-popup ref="emoji" v-on:choiceConfirmEvent="emoji_choice_confirm_event"></component-emoji-popup>
|
||||
|
||||
<!-- 分享弹窗 -->
|
||||
<component-share-popup ref="share"></component-share-popup>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
import componentPopup from '@/components/popup/popup';
|
||||
import componentSharePopup from '@/components/share-popup/share-popup';
|
||||
import componentEmojiPopup from '@/components/emoji-popup/emoji-popup';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
common_static_url: common_static_url,
|
||||
avatar: app.globalData.data.default_user_head_src,
|
||||
user: null,
|
||||
data_base: null,
|
||||
data: null,
|
||||
emoji_list: [],
|
||||
input_comments_value: '',
|
||||
input_comments_cursor: 0,
|
||||
input_comments_length_value: 500,
|
||||
input_comments_length_max: 500,
|
||||
input_comments_modal_status: false,
|
||||
input_comments_modal_index: 0,
|
||||
input_comments_modal_username: '',
|
||||
input_comments_modal_blog_comments_id: 0,
|
||||
input_comments_modal_reply_comments_id: 0,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
propType: {
|
||||
type: String,
|
||||
default: 'detail',
|
||||
},
|
||||
propData: {
|
||||
type: [Object, null],
|
||||
default: null,
|
||||
},
|
||||
propDataBase: {
|
||||
type: [Object, null],
|
||||
default: null,
|
||||
},
|
||||
propEmojiList: {
|
||||
type: [Array, null],
|
||||
default: [],
|
||||
},
|
||||
propShareInfo: {
|
||||
type: [Object, null],
|
||||
default: {},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
componentPopup,
|
||||
componentSharePopup,
|
||||
componentEmojiPopup,
|
||||
},
|
||||
|
||||
// 页面被展示
|
||||
created: function (e) {
|
||||
var avatar = app.globalData.data.default_user_head_src;
|
||||
var user = app.globalData.get_user_cache_info() || null;
|
||||
this.setData({
|
||||
user: user,
|
||||
avatar: user == null ? avatar : user.avatar || avatar,
|
||||
data: this.propData,
|
||||
data_base: this.propDataBase,
|
||||
emoji_list: this.propEmojiList,
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 分享开启弹层
|
||||
popup_share_event(e) {
|
||||
if ((this.$refs.share || null) != null) {
|
||||
this.$refs.share.init({
|
||||
share_info: this.propShareInfo
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 评论弹窗关闭
|
||||
modal_close_event(e) {
|
||||
this.setData({
|
||||
input_comments_modal_status: false,
|
||||
input_comments_modal_index: 0,
|
||||
input_comments_modal_username: '',
|
||||
input_comments_modal_blog_comments_id: 0,
|
||||
input_comments_modal_reply_comments_id: 0,
|
||||
input_comments_value: '',
|
||||
});
|
||||
},
|
||||
|
||||
// 评论弹窗开启
|
||||
modal_open_event(e) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
var user = app.globalData.get_user_info(this, 'modal_open_event', e);
|
||||
if (user != false) {
|
||||
var index = parseInt(e.currentTarget.dataset.index || 0);
|
||||
var username = e.currentTarget.dataset.username;
|
||||
var blog_comments_id = e.currentTarget.dataset.blogcommentsid || 0;
|
||||
var reply_comments_id = e.currentTarget.dataset.replycommentsid || 0;
|
||||
this.setData({
|
||||
input_comments_modal_status: true,
|
||||
input_comments_value: '',
|
||||
input_comments_modal_index: index,
|
||||
input_comments_modal_username: username,
|
||||
input_comments_modal_blog_comments_id: blog_comments_id,
|
||||
input_comments_modal_reply_comments_id: reply_comments_id,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 表情选择事件
|
||||
emoji_event() {
|
||||
if (this.input_comments_length_value == 0) {
|
||||
app.globalData.showToast(this.$t('ask-comments.ask-comments.3o1rq6'));
|
||||
return false;
|
||||
}
|
||||
if ((this.$refs.emoji || null) != null) {
|
||||
this.$refs.emoji.init({ emoji_list: this.emoji_list });
|
||||
}
|
||||
},
|
||||
|
||||
// 评论输入和失去焦点事件
|
||||
comments_input_event(e) {
|
||||
var value = e.detail.value.trim();
|
||||
var length = this.input_comments_length_max - value.length;
|
||||
this.setData({
|
||||
input_comments_cursor: e.detail.cursor || 0,
|
||||
input_comments_value: value,
|
||||
input_comments_length_value: length <= 0 ? 0 : length,
|
||||
});
|
||||
},
|
||||
|
||||
// 表情选择确认事件
|
||||
emoji_choice_confirm_event(emoji) {
|
||||
var value = this.input_comments_value;
|
||||
var cursor = parseInt(this.input_comments_cursor || 0);
|
||||
if (value != '') {
|
||||
if (cursor == 0) {
|
||||
value = emoji + value;
|
||||
} else {
|
||||
var first = value.substr(0, cursor);
|
||||
var last = value.substr(cursor, value.length);
|
||||
value = first + emoji + last;
|
||||
}
|
||||
} else {
|
||||
value = emoji;
|
||||
}
|
||||
var length = this.input_comments_length_max - value.length;
|
||||
this.setData({
|
||||
input_comments_value: value,
|
||||
input_comments_length_value: length <= 0 ? 0 : length,
|
||||
});
|
||||
},
|
||||
|
||||
// 获取评论列表
|
||||
comments_list_reply_event(e) {
|
||||
var temp_data = this.data;
|
||||
var page = 1;
|
||||
var index = parseInt(e.currentTarget.dataset.index || 0);
|
||||
var blog_id = e.currentTarget.dataset.blogid;
|
||||
var blog_comments_id = e.currentTarget.dataset.blogcommentsid || 0;
|
||||
if (blog_comments_id == 0) {
|
||||
if ((temp_data['page'] || null) == null) {
|
||||
temp_data['page'] = 1;
|
||||
} else {
|
||||
temp_data['page'] += 1;
|
||||
}
|
||||
page = temp_data['page'];
|
||||
} else {
|
||||
if ((temp_data['comments_list'][index]['page'] || null) == null) {
|
||||
temp_data['comments_list'][index]['page'] = 1;
|
||||
} else {
|
||||
temp_data['comments_list'][index]['page'] += 1;
|
||||
}
|
||||
page = temp_data['comments_list'][index]['page'];
|
||||
}
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('commentsreplylist', 'index', 'blog'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
blog_id: blog_id,
|
||||
blog_comments_id: blog_comments_id,
|
||||
page: page,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
if (blog_comments_id == 0) {
|
||||
var temp_list = temp_data['comments_list'] || [];
|
||||
} else {
|
||||
var temp_list = temp_data['comments_list'][index]['reply_comments_list'] || [];
|
||||
}
|
||||
var data = res.data.data.data;
|
||||
for (var i in data) {
|
||||
temp_list.push(data[i]);
|
||||
}
|
||||
if (blog_comments_id == 0) {
|
||||
temp_data['comments_list'] = temp_list;
|
||||
temp_data['is_comments_list_submit'] = res.data.data.page >= res.data.data.page_total ? 0 : 1;
|
||||
} else {
|
||||
temp_data['comments_list'][index]['reply_comments_list'] = temp_list;
|
||||
temp_data['comments_list'][index]['is_comments_list_submit'] = res.data.data.page >= res.data.data.page_total ? 0 : 1;
|
||||
}
|
||||
this.setData({ data: temp_data });
|
||||
} else {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 评论
|
||||
comments_event(e) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
var user = app.globalData.get_user_info(this, 'comments_event', e);
|
||||
if (user != false) {
|
||||
if (this.input_comments_value == '') {
|
||||
app.globalData.showToast(this.$t('user-order-comments.user-order-comments.8f303u'));
|
||||
return false;
|
||||
}
|
||||
uni.showLoading({
|
||||
title: this.$t('buy.buy.r79t77'),
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('comments', 'index', 'blog'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
blog_id: this.data.id,
|
||||
content: this.input_comments_value,
|
||||
blog_comments_id: this.input_comments_modal_blog_comments_id,
|
||||
reply_comments_id: this.input_comments_modal_reply_comments_id,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data = this.data;
|
||||
if ((this.input_comments_modal_blog_comments_id || 0) == 0) {
|
||||
var temp_list = temp_data.comments_list || [];
|
||||
temp_list.splice(0, 0, res.data.data);
|
||||
temp_data['comments_list'] = temp_list;
|
||||
temp_data['comments_count'] = parseInt(temp_data['comments_count']) + 1;
|
||||
} else {
|
||||
var index = this.input_comments_modal_index;
|
||||
var temp_list = temp_data.comments_list[index]['reply_comments_list'] || [];
|
||||
temp_list.splice(0, 0, res.data.data);
|
||||
if ((this.input_comments_modal_reply_comments_id || 0) != 0) {
|
||||
for (var i in temp_list) {
|
||||
if (temp_list[i]['id'] == this.input_comments_modal_reply_comments_id) {
|
||||
temp_list[i]['comments_count'] = parseInt(temp_list[i]['comments_count']) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
temp_data.comments_list[index]['reply_comments_list'] = temp_list;
|
||||
temp_data.comments_list[index]['comments_count'] = parseInt(temp_data.comments_list[index]['comments_count']) + 1;
|
||||
}
|
||||
this.setData({
|
||||
data: temp_data,
|
||||
input_comments_value: '',
|
||||
input_comments_length_value: this.input_comments_length_max,
|
||||
input_comments_modal_status: false,
|
||||
input_comments_modal_index: 0,
|
||||
input_comments_modal_username: '',
|
||||
input_comments_modal_blog_comments_id: 0,
|
||||
input_comments_modal_reply_comments_id: 0,
|
||||
});
|
||||
} else {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 点赞
|
||||
give_thumbs_event(e) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
var user = app.globalData.get_user_info(this, 'give_thumbs_event', e);
|
||||
if (user != false) {
|
||||
var type = parseInt(e.currentTarget.dataset.type || 0);
|
||||
var blog_id = e.currentTarget.dataset.blogid;
|
||||
var blog_comments_id = e.currentTarget.dataset.blogcommentsid || 0;
|
||||
var reply_comments_id = e.currentTarget.dataset.replycommentsid || 0;
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('givethumbs', 'index', 'blog'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
blog_id: blog_id,
|
||||
blog_comments_id: blog_comments_id,
|
||||
reply_comments_id: reply_comments_id,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var temp_data = this.data;
|
||||
switch (type) {
|
||||
// 博客
|
||||
case 0:
|
||||
temp_data.is_give_thumbs = data.is_active;
|
||||
temp_data.give_thumbs_count = data.count;
|
||||
break;
|
||||
// 博客评论
|
||||
case 1:
|
||||
var index = parseInt(e.currentTarget.dataset.index || 0);
|
||||
temp_data['comments_list'][index]['is_give_thumbs'] = data.is_active;
|
||||
temp_data['comments_list'][index]['give_thumbs_count'] = data.count;
|
||||
break;
|
||||
// 博客评论回复
|
||||
case 2:
|
||||
var index = parseInt(e.currentTarget.dataset.index || 0);
|
||||
var indexs = parseInt(e.currentTarget.dataset.indexs || 0);
|
||||
temp_data['comments_list'][index]['reply_comments_list'][indexs]['is_give_thumbs'] = data.is_active;
|
||||
temp_data['comments_list'][index]['reply_comments_list'][indexs]['give_thumbs_count'] = data.count;
|
||||
break;
|
||||
}
|
||||
this.setData({ data: temp_data });
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
/**
|
||||
* 聚合点赞、评论、分享
|
||||
*/
|
||||
.blog-comments-bottom-container .item:not(:last-child) {
|
||||
margin-right: 64rpx;
|
||||
}
|
||||
.blog-comments-reply-container .emoji-icon,
|
||||
.blog-comments-modal .emoji-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx !important;
|
||||
}
|
||||
.blog-comments-reply-container .user-avatar {
|
||||
width: 72rpx;
|
||||
height: 72rpx !important;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.blog-comments-reply-container .right-base {
|
||||
padding-left: 16rpx;
|
||||
}
|
||||
.blog-comments-reply-container .right-base .comments {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
.blog-comments-reply-container .right-base textarea {
|
||||
height: 120rpx;
|
||||
}
|
||||
.blog-comments-modal {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: calc(100% - 80rpx);
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
padding: 40rpx;
|
||||
z-index: 10;
|
||||
}
|
||||
.blog-comments-modal-content {
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
margin: 0 auto;
|
||||
margin-top: 30%;
|
||||
max-width: calc(800px - 180rpx);
|
||||
}
|
||||
.blog-comments-modal-content textarea {
|
||||
height: 200rpx;
|
||||
}
|
||||
.blog-comments-modal-content .close {
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
}
|
||||
.comment-btn {
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
.comment-btn-default {
|
||||
border: 2rpx solid #d8dadc;
|
||||
background-color: #d8dadc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 评论列表
|
||||
*/
|
||||
.blog-comments-list > .item .user-avatar {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.blog-comments-list .comments-base,
|
||||
.blog-comments-list .comments-content {
|
||||
padding-left: 16rpx;
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
.reply-blog-comments-list {
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
.reply-blog-comments-list .right-content {
|
||||
padding-left: 16rpx;
|
||||
}
|
||||
</style>
|
||||
245
pages/plugins/blog/detail/detail.vue
Normal file
245
pages/plugins/blog/detail/detail.vue
Normal file
@@ -0,0 +1,245 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="(info || null) != null" :class="(data_base || null) != null && (data_base.is_user_add_blog || 0) == 1 ? 'page-bottom-fixed' : ''">
|
||||
<view class="padding-main bg-white spacing-mb">
|
||||
<view class="spacing-mb">
|
||||
<view class="fw-b text-size-xl">{{ info.title }}</view>
|
||||
<view class="cr-grey-9 margin-top-lg oh br-t padding-top-main text-size-xs">
|
||||
<view class="fl">
|
||||
<text>{{ $t('article-detail.article-detail.728374') }}</text>
|
||||
<text>{{ info.add_time }}</text>
|
||||
</view>
|
||||
<view class="fr">
|
||||
<text class="margin-left-xxxl">{{ $t('article-detail.article-detail.j92ru0') }}</text>
|
||||
<text>{{ info.access_count }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="oh web-html-content spacing-mb">
|
||||
<view v-if="(info.video_url || null) != null && ((info.is_live_play || 0) == 0 || client_type == 'weixin')">
|
||||
<video :src="info.video_url" class="wh-auto" :autoplay="false" :controls="true"></video>
|
||||
</view>
|
||||
<mp-html :content="info.content" />
|
||||
</view>
|
||||
<!-- 评论内容 -->
|
||||
<component-blog-comments :propData="info" :propDataBase="data_base" :propEmojiList="emoji_list" :propShareInfo="share_info"></component-blog-comments>
|
||||
</view>
|
||||
|
||||
<view class="padding-horizontal-main">
|
||||
<!-- 上一篇、下一篇 -->
|
||||
<view v-if="(last_next || null) != null" class="last-next-data spacing-mt margin-bottom-xxxl cr-grey-9">
|
||||
<view v-if="(last_next.last || null) != null" class="flex-row">
|
||||
<text>{{ $t('article-detail.article-detail.281s4a') }}</text>
|
||||
<text :data-value="last_next.last.url" @tap="url_event" class="dis-inline-block flex-row flex-width single-text cp item">{{ last_next.last.title }}</text>
|
||||
</view>
|
||||
<view v-if="(last_next.next || null) != null" class="margin-top flex-row cr-main">
|
||||
<text>{{ $t('article-detail.article-detail.uq5814') }}</text>
|
||||
<text :data-value="last_next.next.url" @tap="url_event" class="dis-inline-block flex-row flex-width single-text cp item">{{ last_next.next.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 推荐博文 -->
|
||||
<view v-if="right_list.length > 0" class="plugins-blog-list">
|
||||
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ $t('detail.detail.455787') }}{{ blog_main_name }}</text>
|
||||
<text data-value="/pages/plugins/blog/search/search" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<view v-for="(item, index) in right_list" :key="index">
|
||||
<view :data-value="item.url" @tap="url_event" class="item oh padding-main border-radius-main bg-white spacing-mb cp">
|
||||
<image class="blog-img fl radius" :src="item.cover" mode="aspectFill"></image>
|
||||
<view class="base fr">
|
||||
<view class="single-text">{{ item.title }}</view>
|
||||
<view class="cr-grey margin-top-sm">{{ item.add_time_date_cn }}</view>
|
||||
<view class="cr-grey multi-text margin-top-sm">{{ item.describe }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 相关商品 -->
|
||||
<view v-if="(info.goods_list || null) != null && info.goods_list.length > 0">
|
||||
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ $t('detail.detail.1j6yxy') }}</text>
|
||||
<text data-value="/pages/goods-search/goods-search" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<component-goods-list :propData="{ style_type: 1, goods_list: info.goods_list }" :propCurrencySymbol="currency_symbol"></component-goods-list>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
|
||||
<!-- 发布博文、我的博文入口 -->
|
||||
<view v-if="(data_base || null) != null && (data_base.is_user_add_blog || 0) == 1" class="bottom-fixed" :style="bottom_fixed_style">
|
||||
<view class="bottom-line-exclude">
|
||||
<view class="item flex-row jc-sa align-c text-size fw-b br bg-white round padding-vertical">
|
||||
<view data-value="/pages/plugins/blog/form/form" @tap="url_event" class="flex-1 tc flex-col jc-c align-c cp">
|
||||
<view class="divider-r-d wh-auto"> <iconfont name="icon-edit-below-line" size="30rpx" color="#333" propClass="margin-right-sm"></iconfont>{{$t('detail.detail.fn3w01')}}{{ blog_main_name }}</view>
|
||||
</view>
|
||||
<view data-value="/pages/plugins/blog/user-list/user-list" @tap="url_event" class="flex-1 tc flex-col jc-c align-c cp">
|
||||
<view class="wh-auto"> <iconfont name="icon-list-dot" size="32rpx" color="#333" propClass="margin-right-sm pr top-xs"></iconfont>{{$t('common.my')}}{{ blog_main_name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentBlogComments from '../components/blog-comments/blog-comments';
|
||||
import componentGoodsList from '@/components/goods-list/goods-list';
|
||||
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
common_static_url: common_static_url,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
client_type: app.globalData.application_client_type(),
|
||||
bottom_fixed_style: '',
|
||||
params: null,
|
||||
data_base: null,
|
||||
info: null,
|
||||
right_list: [],
|
||||
last_next: null,
|
||||
emoji_list: [],
|
||||
blog_main_name: this.$t('detail.detail.e439j9'),
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentBlogComments,
|
||||
componentGoodsList,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: app.globalData.launch_params_handle(params),
|
||||
});
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
// 数据加载
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.globalData.get_config('currency_symbol'),
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 初始化
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('detail', 'index', 'blog'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: this.params.id || 0,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
var data = res.data.data;
|
||||
if (res.data.code == 0 && (data.data || null) != null) {
|
||||
var info = data.data || null;
|
||||
var base = data.base || null;
|
||||
this.setData({
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 3,
|
||||
data_base: base,
|
||||
info: info,
|
||||
right_list: data.right_list || [],
|
||||
last_next: data.last_next || null,
|
||||
emoji_list: data.emoji_list || [],
|
||||
blog_main_name: base == null ? this.$t('detail.detail.e439j9') : (base.blog_main_name || this.$t('detail.detail.e439j9')),
|
||||
});
|
||||
|
||||
if (info != null) {
|
||||
// 基础自定义分享
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: info.seo_title || info.title,
|
||||
desc: info.seo_desc || info.describe,
|
||||
path: '/pages/plugins/blog/detail/detail',
|
||||
query: 'id=' + info.id,
|
||||
img: info.share_images || info.cover,
|
||||
},
|
||||
});
|
||||
|
||||
// 标题
|
||||
uni.setNavigationBarTitle({ title: info.title });
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
data_list_loding_status: 2,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style></style>
|
||||
11
pages/plugins/blog/form/form.css
Normal file
11
pages/plugins/blog/form/form.css
Normal file
@@ -0,0 +1,11 @@
|
||||
.sp-editor {
|
||||
height: 500rpx;
|
||||
}
|
||||
|
||||
.more {
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
.p-content {
|
||||
max-height: 50vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
450
pages/plugins/blog/form/form.vue
Normal file
450
pages/plugins/blog/form/form.vue
Normal file
@@ -0,0 +1,450 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="data_list_loding_status !== 1">
|
||||
<form @submit="form_submit" class="form-container">
|
||||
<view class="page-bottom-fixed padding-main">
|
||||
<view class="bg-white border-radius-main pr oh spacing-mb">
|
||||
<view class="form-gorup">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('user-detail.user-detail.uy6lrz')}}<text class="form-group-tips-must">*</text></view>
|
||||
<input type="text" name="title" :value="data.title || ''" maxlength="16" placeholder-class="cr-grey-9" class="cr-base flex-1 flex-width tr" :placeholder="$t('common.please_input')" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white border-radius-main pr oh spacing-mb">
|
||||
<view class="form-gorup">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('common.category')}}<text class="form-group-tips-must">*</text></view>
|
||||
<view class="flex-1 flex-width tr" @tap="popupOpen">
|
||||
<text :class="data.blog_category_name ? 'cr-black' : 'cr-grey-9'">{{ data.blog_category_name || $t('form.form.4cbom4') }}</text>
|
||||
<view class="pr top-sm margin-left-sm dis-inline-block">
|
||||
<iconfont name="icon-arrow-right" color="#999" size="28rpx"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white border-radius-main pr oh spacing-mb">
|
||||
<view class="form-gorup">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('form.form.043a10')}}</view>
|
||||
<view class="flex-1 flex-width tr">
|
||||
<switch :color="theme_color" :checked="(data.is_enable || 0) == 1 ? true : false" @change="is_enable_event" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white border-radius-main pr oh spacing-mb">
|
||||
<view class="form-gorup">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('form.form.5hn8k3')}}</view>
|
||||
<view class="margin-top-main">
|
||||
<component-upload :propData="image_list" :propMaxNum="1" :propPathType="editor_path_type" @call-back="retrun_image_event"></component-upload>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white border-radius-main pr oh">
|
||||
<view class="form-gorup">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('user-detail.user-detail.7cufw6')}}<text class="form-group-tips-must">*</text></view>
|
||||
<view class="margin-top-main sp-editor">
|
||||
<!-- <sp-editor :templates="(data || null) !== null ? data.content : ''" @input="rich_text_event" @upinImage="up_in_image_event"></sp-editor> -->
|
||||
<sp-editor @init="initEditor" @input="rich_text_event" @upinImage="up_in_image_event"></sp-editor>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="more oh" :style="'height:' + more_height">
|
||||
<view class="bg-white border-radius-main pr oh spacing-mb spacing-mt">
|
||||
<view class="form-gorup">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('form.form.xy87t8')}}</view>
|
||||
<textarea name="describe" placeholder-class="cr-grey-9" class="cr-base" :placeholder="$t('common.please_input')" maxlength="200" :value="data.describe"></textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white border-radius-main pr oh spacing-mb">
|
||||
<view class="form-gorup">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('form.form.kvr2i3')}}</view>
|
||||
<input type="text" name="seo_title" :value="data.seo_title || ''" maxlength="16" placeholder-class="cr-grey-9" class="cr-base flex-1 flex-width tr" :placeholder="$t('common.please_input')" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white border-radius-main pr oh spacing-mb">
|
||||
<view class="form-gorup">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('form.form.l87ju1')}}</view>
|
||||
<input type="text" name="seo_keywords" :value="data.seo_keywords || ''" maxlength="16" placeholder-class="cr-grey-9" class="cr-base flex-1 flex-width tr" :placeholder="$t('common.please_input')" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white border-radius-main pr oh">
|
||||
<view class="form-gorup">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main">{{$t('form.form.5487bt')}}</view>
|
||||
<input type="text" name="seo_desc" :value="data.seo_desc || ''" maxlength="16" placeholder-class="cr-grey-9" class="cr-base flex-1 flex-width tr" :placeholder="$t('common.please_input')" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white border-radius-main pr oh spacing-mb spacing-mt">
|
||||
<view class="padding-main flex-row jc-c align-c cr-grey-9" @tap="more_event">
|
||||
<text>{{ is_more ? $t('form.form.4h814w') : $t('form.form.lfwj0g') }}</text>
|
||||
<view class="margin-left-sm dis-inline-block">
|
||||
<iconfont :name="is_more ? 'icon-arrow-top' : 'icon-arrow-bottom'" color="#999" size="24rpx"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部操作 -->
|
||||
<view class="bottom-fixed" :style="bottom_fixed_style">
|
||||
<view class="bottom-line-exclude">
|
||||
<button class="item cr-white bg-main round text-size wh-auto" type="default" form-type="submit" hover-class="none" :loading="form_submit_loading" :disabled="form_submit_loading">{{$t('form.form.4yd066')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 分类选择 -->
|
||||
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
|
||||
<view class="p-title flex-row jc-sb align-c padding-main br-b-e">
|
||||
<view class="text-size-lg fw-b">{{$t('form.form.4vku7u')}}</view>
|
||||
<view class="popup-colse" @tap="popup_close_event">
|
||||
<iconfont name="icon-close-o" color="#333" size="28rpx"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p-content padding-main">
|
||||
<view v-for="(item, index) in blog_category_list" :key="index">
|
||||
<view class="padding-vertical-main flex-row jc-sb align-c" :class="data.blog_category_id == item.id ? 'cr-main' : ''" :data-value="item.name" :data-id="item.id" @tap="get_type_event">
|
||||
{{ item.name }}
|
||||
<iconfont v-if="data.blog_category_id === item.id" name="icon-checked" color="#333" size="28rpx"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</component-popup>
|
||||
</form>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentPopup from '@/components/popup/popup';
|
||||
import componentUpload from '@/components/upload/upload';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
theme_color: app.globalData.get_theme_color(),
|
||||
data_list_loding_status: 1,
|
||||
bottom_fixed_style: '',
|
||||
params: {},
|
||||
data: {},
|
||||
index: 0,
|
||||
// 分类选择弹窗
|
||||
popup_status: false,
|
||||
blog_category_list: [],
|
||||
|
||||
// 封面图片
|
||||
image_list: [],
|
||||
// 路径类型
|
||||
editor_path_type: 'common',
|
||||
|
||||
// 内容
|
||||
input_length_max: 500,
|
||||
input_value: '',
|
||||
// 查看更多
|
||||
more_height: '0',
|
||||
is_more: false,
|
||||
|
||||
// 提交按钮
|
||||
form_submit_loading: false,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
componentCommon,
|
||||
componentPopup,
|
||||
componentUpload,
|
||||
componentNoData,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: params || {},
|
||||
});
|
||||
|
||||
// 数据加载
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
// 数据加载
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 页面销毁时执行
|
||||
onUnload: function () {},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
this.get_data_list();
|
||||
} else {
|
||||
// 提示错误
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('form.form.8l3ul5'),
|
||||
});
|
||||
}
|
||||
},
|
||||
get_data_list() {
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('saveinfo', 'blog', 'blog'),
|
||||
method: 'POST',
|
||||
data: {...this.params, ...{lang_can_key: 'blog_category_list'}},
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var blog_category_list = res.data.data.blog_category_list || [];
|
||||
if (res.data.data.data) {
|
||||
var data = res.data.data.data || {};
|
||||
// 封面列表
|
||||
var img_list = [];
|
||||
if ((data.cover || null) != null && data.cover.length > 0) {
|
||||
img_list.push(data.cover);
|
||||
}
|
||||
// 分类名称匹配重新匹配赋值
|
||||
var blog_category_name = '';
|
||||
for(var i in blog_category_list) {
|
||||
if(blog_category_list[i]['id'] == data.blog_category_id) {
|
||||
blog_category_name = blog_category_list[i]['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
data['blog_category_name'] = blog_category_name;
|
||||
// 设置数据
|
||||
this.setData({
|
||||
data: data,
|
||||
blog_category_list: blog_category_list,
|
||||
image_list: img_list,
|
||||
more_height: data.describe || data.seo_title || data.seo_keywords || data.seo_desc ? '708rpx' : '0',
|
||||
is_more: data.describe || data.seo_title || data.seo_keywords || data.seo_desc ? 'true' : 'false',
|
||||
data_list_loding_status: 3,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
blog_category_list: blog_category_list,
|
||||
data_list_loding_status: 3,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
// 弹层打开
|
||||
popupOpen() {
|
||||
this.setData({
|
||||
popup_status: true,
|
||||
});
|
||||
},
|
||||
|
||||
// 弹层关闭
|
||||
popup_close_event(e) {
|
||||
this.setData({
|
||||
popup_status: false,
|
||||
});
|
||||
},
|
||||
|
||||
// 是否启用
|
||||
is_enable_event(e) {
|
||||
var new_data = this.data;
|
||||
new_data.is_enable = e.detail.value ? 1 : 0;
|
||||
this.setData({
|
||||
data: new_data,
|
||||
});
|
||||
},
|
||||
|
||||
// 获取选中的分类
|
||||
get_type_event(e) {
|
||||
var new_data = this.data;
|
||||
new_data.blog_category_id = e.currentTarget.dataset.id;
|
||||
new_data.blog_category_name = e.currentTarget.dataset.value;
|
||||
this.setData({
|
||||
data: new_data,
|
||||
popup_status: false,
|
||||
});
|
||||
},
|
||||
|
||||
// 上传回调
|
||||
retrun_image_event(data) {
|
||||
var new_data = this.data;
|
||||
new_data.cover = data[0];
|
||||
this.setData({
|
||||
data: new_data,
|
||||
});
|
||||
},
|
||||
|
||||
// 回调富文本内容
|
||||
rich_text_event(e) {
|
||||
var new_data = this.data;
|
||||
new_data.content = e.html;
|
||||
this.setData({
|
||||
data: new_data,
|
||||
});
|
||||
},
|
||||
initEditor(editor) {
|
||||
// 初始化编辑器内容
|
||||
editor.setContents({
|
||||
html: (this.data || null) !== null ? this.data.content : '',
|
||||
});
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
up_in_image_event(tempFiles, editorCtx) {
|
||||
var self = this;
|
||||
// 使用 uniCloud.uploadFile 上传图片的示例方法(可适用多选上传)
|
||||
tempFiles.forEach(async (item) => {
|
||||
uni.showLoading({
|
||||
title: self.$t('form.form.2e5rv3'),
|
||||
mask: true,
|
||||
});
|
||||
await uni.uploadFile({
|
||||
url: app.globalData.get_request_url('index', 'ueditor'),
|
||||
// #ifdef APP-PLUS || H5
|
||||
filePath: item.path,
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
filePath: item.tempFilePath,
|
||||
// #endif
|
||||
name: 'upfile',
|
||||
formData: {
|
||||
action: 'uploadimage',
|
||||
path_type: 'common', // 路径类型,默认common
|
||||
},
|
||||
success: function (res) {
|
||||
let data = JSON.parse(res.data);
|
||||
if (res.statusCode == 200) {
|
||||
// 上传完成后处理
|
||||
editorCtx.insertImage({
|
||||
src: data.data.url, // 此处需要将图片地址切换成服务器返回的真实图片地址
|
||||
// width: '50%',
|
||||
alt: self.$t('common.video'),
|
||||
success: function (e) {},
|
||||
});
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
fail: function (e) {
|
||||
app.globalData.showToast(e.errMsg);
|
||||
uni.hideLoading();
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 更多内容
|
||||
more_event() {
|
||||
this.setData({
|
||||
more_height: !this.is_more ? '708rpx' : '0',
|
||||
is_more: !this.is_more,
|
||||
});
|
||||
},
|
||||
|
||||
// 表单提交
|
||||
form_submit(e) {
|
||||
// 数据验证
|
||||
var validation = [
|
||||
{ fields: 'title', msg: this.$t('form.form.v19gg8') },
|
||||
{ fields: 'blog_category_id', msg: this.$t('form.form.gu3x97') },
|
||||
{ fields: 'content', msg: this.$t('form.form.adiq70') },
|
||||
];
|
||||
var validate = {
|
||||
blog_category_id: this.data.blog_category_id,
|
||||
content: this.data.content,
|
||||
title: e.detail.value.title,
|
||||
};
|
||||
if (app.globalData.fields_check(validate, validation)) {
|
||||
uni.showLoading({
|
||||
title: this.$t('buy.buy.r79t77'),
|
||||
});
|
||||
this.setData({
|
||||
form_submit_loading: true,
|
||||
});
|
||||
var new_data = {
|
||||
...e.detail.value,
|
||||
...this.data,
|
||||
};
|
||||
// 网络请求
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('save', 'blog', 'blog'),
|
||||
method: 'POST',
|
||||
data: new_data,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
setTimeout(function () {
|
||||
app.globalData.page_back_prev_event();
|
||||
}, 2000);
|
||||
} else {
|
||||
this.setData({
|
||||
form_submit_loading: false,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
this.setData({
|
||||
form_submit_loading: false,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './form.css';
|
||||
</style>
|
||||
42
pages/plugins/blog/index/index.css
Normal file
42
pages/plugins/blog/index/index.css
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 分类
|
||||
*/
|
||||
.nav-list {
|
||||
height: 38rpx;
|
||||
line-height: 38rpx;
|
||||
width: calc(100% - 155rpx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐博文
|
||||
*/
|
||||
.right-list .item .blog-title {
|
||||
width: calc(100% - 210rpx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类导航
|
||||
*/
|
||||
.nav-blog-category .item {
|
||||
width: calc(50% - 10rpx);
|
||||
}
|
||||
.nav-blog-category .item:nth-child(odd) {
|
||||
float: left;
|
||||
}
|
||||
.nav-blog-category .item:nth-child(even) {
|
||||
float: right;
|
||||
}
|
||||
.nav-blog-category .item .icon,
|
||||
.nav-blog-category .item .icon-text {
|
||||
width: 74rpx;
|
||||
height: 74rpx !important;
|
||||
}
|
||||
.nav-blog-category .item .icon-text {
|
||||
line-height: 72rpx;
|
||||
font-size: 48rpx;
|
||||
background: #e6f2f8;
|
||||
color: #3f51b5;
|
||||
}
|
||||
.nav-blog-category .item .right-base {
|
||||
width: calc(100% - 84rpx);
|
||||
}
|
||||
280
pages/plugins/blog/index/index.vue
Normal file
280
pages/plugins/blog/index/index.vue
Normal file
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="(data_base || null) != null" :class="(data_base || null) != null && (data_base.is_user_add_blog || 0) == 1 ? 'page-bottom-fixed' : ''">
|
||||
<!-- 搜索框 -->
|
||||
<view class="nav-search padding-main">
|
||||
<component-search propBrColor="#efefef" propBgColor="#fff" propUrl="/pages/plugins/blog/search/search"></component-search>
|
||||
</view>
|
||||
|
||||
<!-- 轮播 -->
|
||||
<view v-if="slide_list.length > 0" class="padding-horizontal-main spacing-mb">
|
||||
<component-banner :propData="slide_list"></component-banner>
|
||||
</view>
|
||||
|
||||
<!-- 分类导航 -->
|
||||
<view v-if="(data_base.is_home_category_main_nav || 0) == 1 && (category || null) != null && category.length > 0" class="nav-blog-category padding-horizontal-main oh">
|
||||
<block v-for="(item, index) in category" :key="index">
|
||||
<view class="item oh padding-main margin-bottom-main radius bg-white bs-bb" :data-value="item.url" @tap="url_event">
|
||||
<image v-if="(item.icon || null) != null" :src="item.icon" mode="aspectFill" class="fl icon radius"></image>
|
||||
<view v-else class="fl radius icon-text tc">{{ item.name.substr(0, 1) }}</view>
|
||||
<view class="fr right-base">
|
||||
<view class="single-text cr-base">
|
||||
<text class="fw">{{ item.name }}</text>
|
||||
<text v-if="(item.blog_data || null) != null && item.blog_data.day_comments_count > 0" class="margin-left-sm cr-red fw">({{ item.blog_data.day_comments_count }})</text>
|
||||
</view>
|
||||
<view v-if="(item.blog_data || null) != null" class="single-text cr-grey text-size-xs">
|
||||
<text>{{ blog_main_name }}: {{ item.blog_data.blog_count }}</text>
|
||||
<text v-if="(data_base.is_blog_comments_show || 0) == 1" class="margin-left">{{ $t('index.index.lkld04') }}{{ item.blog_data.comments_count }}</text>
|
||||
<text v-if="(data_base.is_blog_give_thumbs || 0) == 1" class="margin-left">{{ $t('index.index.r6vv25') }}{{ item.blog_data.give_thumbs_count }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 分类 -->
|
||||
<view class="padding-horizontal-main">
|
||||
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ $t('index.index.6rsqp1') }}{{ blog_main_name }}</text>
|
||||
<text data-value="/pages/plugins/blog/search/search" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 博文列表 -->
|
||||
<view v-if="data_list.length > 0" class="plugins-blog-list padding-horizontal-main">
|
||||
<view v-for="(item, index) in data_list" :key="index">
|
||||
<view :data-value="item.url" @tap="url_event" class="item oh padding-main border-radius-main bg-white cp spacing-mb">
|
||||
<image class="blog-img fl radius" :src="item.cover" mode="aspectFill"></image>
|
||||
<view class="base fr">
|
||||
<view class="single-text text-size">{{ item.title }}</view>
|
||||
<view class="cr-grey margin-top-sm">{{ item.add_time_date_cn }}</view>
|
||||
<view class="cr-base text-size-sm multi-text margin-top-sm">{{ item.describe }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 热门博文-滚动 -->
|
||||
<view v-if="hot_list.length > 0" class="padding-horizontal-main spacing-mb">
|
||||
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ $t('index.index.pot64x') }}{{ blog_main_name }}</text>
|
||||
<text data-value="/pages/plugins/blog/search/search" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<view class="rolling-horizontal border-radius-main oh">
|
||||
<view class="plugins-blog-rolling-list scroll-view-horizontal">
|
||||
<swiper :vertical="false" :autoplay="(data_base.is_home_hot_auto_play || 0) == 1" :circular="false" :display-multiple-items="hot_list.length < 3 ? hot_list.length : 3" interval="3000">
|
||||
<block v-for="(item, index) in hot_list" :key="index">
|
||||
<swiper-item>
|
||||
<view :data-value="item.url" @tap="url_event" class="item bg-white border-radius-main margin-right-main oh pr ht-auto pr cp">
|
||||
<image class="blog-img dis-block wh-auto" :src="item.cover" mode="aspectFill"></image>
|
||||
<view class="blog-title pa single-text cr-white padding-horizontal-main padding-top-sm padding-bottom-sm">{{ item.title }}</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 推荐博文 -->
|
||||
<view v-if="right_list.length > 0" class="padding-horizontal-main spacing-mb">
|
||||
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ $t('detail.detail.455787') }}{{ blog_main_name }}</text>
|
||||
<text data-value="/pages/plugins/blog/search/search" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<view class="right-list padding-horizontal-main border-radius-main bg-white">
|
||||
<block v-for="(item, index) in right_list" :key="index">
|
||||
<view :data-value="item.url" @tap="url_event" :class="'item padding-vertical-main oh cp ' + (index > 0 ? 'br-t' : '')">
|
||||
<view class="blog-title single-text fl">{{ item.title }}</view>
|
||||
<text class="cr-grey fr">{{ $t('detail.detail.e6ga1y') }}{{ item.access_count }}{{ $t('buy.buy.0pgsrm') }}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 推荐商品 -->
|
||||
<view v-if="goods_list.length > 0" class="goods-list oh padding-horizontal-main">
|
||||
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ $t('index.index.8t4j95') }}</text>
|
||||
<text data-value="/pages/goods-search/goods-search" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<component-goods-list :propData="{ style_type: 1, goods_list: goods_list }" :propCurrencySymbol="currency_symbol"></component-goods-list>
|
||||
</view>
|
||||
|
||||
<!-- 发布博文、我的博文入口 -->
|
||||
<view v-if="(data_base || null) != null && (data_base.is_user_add_blog || 0) == 1" class="bottom-fixed" :style="bottom_fixed_style">
|
||||
<view class="bottom-line-exclude">
|
||||
<view class="item flex-row jc-sa align-c text-size fw-b br bg-white round padding-vertical">
|
||||
<view data-value="/pages/plugins/blog/form/form" @tap="url_event" class="flex-1 tc flex-col jc-c align-c cp">
|
||||
<view class="divider-r-d wh-auto"> <iconfont name="icon-edit-below-line" size="30rpx" color="#333" propClass="margin-right-sm"></iconfont>{{$t('detail.detail.fn3w01')}}{{ blog_main_name }}</view>
|
||||
</view>
|
||||
<view data-value="/pages/plugins/blog/user-list/user-list" @tap="url_event" class="flex-1 tc flex-col jc-c align-c cp">
|
||||
<view class="wh-auto"> <iconfont name="icon-list-dot" size="32rpx" color="#333" propClass="margin-right-sm pr top-xs"></iconfont>{{$t('common.my')}}{{ blog_main_name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentSearch from '@/components/search/search';
|
||||
import componentBanner from '@/components/slider/slider';
|
||||
import componentCountdown from '@/components/countdown/countdown';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentGoodsList from '@/components/goods-list/goods-list';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
bottom_fixed_style: '',
|
||||
data_base: null,
|
||||
category: [],
|
||||
data_list: [],
|
||||
slide_list: [],
|
||||
goods_list: [],
|
||||
hot_list: [],
|
||||
right_list: [],
|
||||
blog_main_name: this.$t('detail.detail.e439j9'),
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentSearch,
|
||||
componentBanner,
|
||||
componentCountdown,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentGoodsList,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
// 获取数据
|
||||
this.get_data();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.globalData.get_config('currency_symbol'),
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'index', 'blog'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
category: data.category || [],
|
||||
data_list: data.data_list || [],
|
||||
slide_list: data.slide_list || [],
|
||||
goods_list: data.goods_list || [],
|
||||
hot_list: data.hot_list || [],
|
||||
right_list: data.right_list || [],
|
||||
blog_main_name: (data.base || null) == null ? this.$t('detail.detail.e439j9') : data.base.blog_main_name || this.$t('detail.detail.e439j9'),
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: true,
|
||||
});
|
||||
|
||||
// 基础自定义分享
|
||||
var title = this.data_base.seo_title || this.data_base.application_name;
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: title,
|
||||
desc: this.data_base.seo_desc,
|
||||
path: '/pages/plugins/blog/index/index',
|
||||
img: (this.slide_list || null) != null && this.slide_list.length > 0 ? this.slide_list[0]['images_url'] : '',
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
|
||||
// 标题
|
||||
uni.setNavigationBarTitle({ title: title });
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './index.css';
|
||||
</style>
|
||||
31
pages/plugins/blog/search/search.css
Normal file
31
pages/plugins/blog/search/search.css
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
.search-keywords icon {
|
||||
left: 30rpx;
|
||||
top: calc(50% - 6px);
|
||||
z-index: 1;
|
||||
}
|
||||
.search-keywords input {
|
||||
font-size: 26rpx;
|
||||
padding: 0 30rpx 0 76rpx;
|
||||
box-sizing: border-box;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类导航
|
||||
*/
|
||||
.nav-list {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
.scroll-box {
|
||||
height: calc(100vh - 110rpx - 30px);
|
||||
}
|
||||
342
pages/plugins/blog/search/search.vue
Normal file
342
pages/plugins/blog/search/search.vue
Normal file
@@ -0,0 +1,342 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="(data_base || null) != null">
|
||||
<!-- 搜索关键字 -->
|
||||
<view class="padding-horizontal-main padding-top-main padding-bottom-sm bg-white">
|
||||
<view class="search-keywords pr">
|
||||
<icon type="search" size="12" class="pa"></icon>
|
||||
<input type="text" confirm-type="search" :placeholder="$t('search.search.723rbx')" :value="search_keywords_value" @confirm="search_keywords_event" class="cr-base round wh-auto" placeholder-class="cr-grey" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分类 -->
|
||||
<scroll-view v-if="(category || null) != null && category.length > 0" class="nav-list scroll-view-horizontal bg-white oh" scroll-x="true">
|
||||
<view :class="'item cr-grey dis-inline-block padding-horizontal-main ' + (nav_active_value == 0 ? 'cr-main' : '')" @tap="nav_event" data-value="0">{{ $t('common.all') }}</view>
|
||||
<block v-for="(item, index) in category" :key="index">
|
||||
<view :class="'item cr-grey dis-inline-block padding-horizontal-main ' + (nav_active_value == item.id ? 'cr-main' : '')" @tap="nav_event" :data-value="item.id">{{ item.name }}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 列表 -->
|
||||
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="60">
|
||||
<view :class="(data_base.is_user_add_blog || 0) == 1 ? 'page-bottom-fixed' : ''">
|
||||
<view v-if="(data_list || null) != null && data_list.length > 0" class="plugins-blog-list padding-horizontal-main padding-top-main oh">
|
||||
<view v-for="(item, index) in data_list" :key="index">
|
||||
<view :data-value="item.url" @tap="url_event" class="item oh cp padding-main border-radius-main bg-white spacing-mb">
|
||||
<image class="blog-img fl radius" :src="item.cover" mode="aspectFill"></image>
|
||||
<view class="base fr">
|
||||
<view class="single-text text-size">{{ item.title }}</view>
|
||||
<view class="cr-grey margin-top-sm">{{ item.add_time_date_cn }}</view>
|
||||
<view class="cr-base text-size-sm multi-text margin-top-sm">{{ item.describe }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 发布博文、我的博文入口 -->
|
||||
<view v-if="(data_base.is_user_add_blog || 0) == 1" class="bottom-fixed" :style="bottom_fixed_style">
|
||||
<view class="bottom-line-exclude">
|
||||
<view class="item flex-row jc-sa align-c text-size fw-b br bg-white round padding-vertical">
|
||||
<view data-value="/pages/plugins/blog/form/form" @tap="url_event" class="flex-1 tc flex-col jc-c align-c cp">
|
||||
<view class="divider-r-d wh-auto"> <iconfont name="icon-edit-below-line" size="30rpx" color="#333" propClass="margin-right-sm"></iconfont>{{$t('detail.detail.fn3w01')}}{{ blog_main_name }}</view>
|
||||
</view>
|
||||
<view data-value="/pages/plugins/blog/user-list/user-list" @tap="url_event" class="flex-1 tc flex-col jc-c align-c cp">
|
||||
<view class="wh-auto"> <iconfont name="icon-list-dot" size="32rpx" color="#333" propClass="margin-right-sm pr top-xs"></iconfont>{{$t('common.my')}}{{ blog_main_name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
bottom_fixed_style: '',
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
params: null,
|
||||
data_base: null,
|
||||
category: [],
|
||||
nav_active_value: 0,
|
||||
search_keywords_value: '',
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
blog_main_name: this.$t('detail.detail.e439j9'),
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 参数处理
|
||||
params = app.globalData.launch_params_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: params,
|
||||
nav_active_value: params.id || 0,
|
||||
search_keywords_value: params.keywords || '',
|
||||
});
|
||||
|
||||
// 数据加载
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'search', 'blog'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
// 标题
|
||||
var blog_main_name = (data.base || null) == null ? this.$t('detail.detail.e439j9') : data.base.blog_main_name || this.$t('detail.detail.e439j9');
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
category: data.category || [],
|
||||
blog_main_name: blog_main_name,
|
||||
});
|
||||
uni.setNavigationBarTitle({ title: blog_main_name + this.$t('common.search') });
|
||||
|
||||
// 获取列表数据
|
||||
this.get_data_list(1);
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 基础自定义分享
|
||||
this.share_info_handle();
|
||||
|
||||
// 是否加载中
|
||||
if (this.data_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
this.setData({ data_is_loading: 1 });
|
||||
|
||||
// 加载loding
|
||||
if(this.data_page > 1) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('datalist', 'search', 'blog'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
page: this.data_page,
|
||||
id: this.nav_active_value,
|
||||
bwd: this.search_keywords_value,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
if (data.data.length > 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: data.total,
|
||||
data_page_total: data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data_page + 1,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
this.setData({
|
||||
data_bottom_line_status: this.data_page > 1 && this.data_page > this.data_page_total,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: this.$t('common.no_relevant_data_tips'),
|
||||
data_is_loading: 0,
|
||||
});
|
||||
if (this.data_page <= 1) {
|
||||
this.setData({
|
||||
data_list: [],
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 分享设置处理
|
||||
share_info_handle() {
|
||||
// 基础自定义分享
|
||||
var info = this.data_base || {};
|
||||
if ((this.nav_active_value || 0) != 0 && this.category.length > 0) {
|
||||
for (var i in this.category) {
|
||||
if (this.nav_active_value == this.category[i]['id']) {
|
||||
info = this.category[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: info.seo_title || this.data_base.application_name,
|
||||
desc: info.seo_desc,
|
||||
path: '/pages/plugins/blog/search/search',
|
||||
query: 'id=' + this.nav_active_value + '&keywords=' + this.search_keywords_value,
|
||||
},
|
||||
});
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_active_value: e.currentTarget.dataset.value || 0,
|
||||
data_page: 1,
|
||||
data_list: [],
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 关键字输入事件
|
||||
search_keywords_event(e) {
|
||||
this.setData({
|
||||
search_keywords_value: e.detail.value || '',
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './search.css';
|
||||
</style>
|
||||
37
pages/plugins/blog/user-list/user-list.css
Normal file
37
pages/plugins/blog/user-list/user-list.css
Normal file
@@ -0,0 +1,37 @@
|
||||
.blog-img {
|
||||
width: 236rpx;
|
||||
height: 182rpx;
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-block;
|
||||
height: 32rpx;
|
||||
line-height: 32rpx;
|
||||
border-radius: 18rpx;
|
||||
font-size: 10px;
|
||||
padding: 0 16rpx;
|
||||
}
|
||||
|
||||
.badge.success {
|
||||
color: #52C41A;
|
||||
background: rgb(82 196 26 / 10%);
|
||||
}
|
||||
|
||||
.badge.info {
|
||||
color: #999;
|
||||
background: #f4f4f4;
|
||||
}
|
||||
|
||||
.badge.error {
|
||||
color: #E22C08;
|
||||
background: rgba(226, 45, 8, 0.1);
|
||||
}
|
||||
|
||||
.add-icon {
|
||||
height: 80rpx;
|
||||
line-height: 76rpx;
|
||||
margin-right: 6rpx;
|
||||
}
|
||||
.multi-text {
|
||||
min-height: auto;
|
||||
}
|
||||
281
pages/plugins/blog/user-list/user-list.vue
Normal file
281
pages/plugins/blog/user-list/user-list.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<block v-if="data.length > 0">
|
||||
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="60">
|
||||
<view class="page-bottom-fixed padding-top-main">
|
||||
<view v-for="(item, index) in data" class="bg-white spacing-mb" :key="index">
|
||||
<view class="padding-main flex-row">
|
||||
<view v-if="item.cover" class="padding-right-main">
|
||||
<image class="blog-img radius" :src="item.cover" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="flex-1 flex-width">
|
||||
<view class="multi-text text-size fw-b margin-bottom-xs">{{ item.title }}</view>
|
||||
<view class="text-size-sm cr-grey-9 margin-bottom-sm">{{ item.date }}</view>
|
||||
<view class="badge" :class="item.status == '0' ? 'info' : item.status === '1' ? 'success' : 'error'">{{ item.status_name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="br-t-f5 flex-row jc-sa align-c text-size tc">
|
||||
<view class="cr-base flex-1 divider-r-f5 padding-vertical-main" :data-value="'/pages/plugins/blog/form/form?id=' + item.id" @tap="url_event">
|
||||
<view class="margin-right-xs dis-inline-block">
|
||||
<iconfont name="icon-edit-below-line" size="32rpx"></iconfont>
|
||||
</view>{{$t('common.edit')}}</view>
|
||||
<view class="cr-main flex-1 padding-vertical-main" :data-id="item.id" @tap="del_event">
|
||||
<view class="margin-right-xs dis-inline-block">
|
||||
<iconfont name="icon-delete" size="32rpx"></iconfont>
|
||||
</view>{{$t('common.del')}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</block>
|
||||
|
||||
<!-- 底部操作 -->
|
||||
<view class="bottom-fixed" :style="bottom_fixed_style">
|
||||
<view class="bottom-line-exclude">
|
||||
<button class="item cr-main bg-white br-main round text-size wh-auto flex-row align-c jc-c" type="default" hover-class="none" data-value="/pages/plugins/blog/form/form" @tap="url_event">
|
||||
<view class="add-icon">
|
||||
<iconfont name="icon-xzdz-tianjiabiaoq" size="32rpx"></iconfont>
|
||||
</view>
|
||||
<text>{{$t('common.add')}}</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="data.length == 0 && data_list_loding_status != 3">
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
theme_color: app.globalData.get_theme_color(),
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
bottom_fixed_style: '',
|
||||
data: [],
|
||||
data_is_loading: 0,
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 页面销毁时执行
|
||||
onUnload: function () {},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
this.get_data_list(1);
|
||||
} else {
|
||||
// 提示错误
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('form.form.8l3ul5'),
|
||||
});
|
||||
}
|
||||
},
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 是否加载中
|
||||
if (this.data_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
data_is_loading: 1,
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
// 加载loding
|
||||
if(this.data_page > 1) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
}
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'blog', 'blog'),
|
||||
method: 'POST',
|
||||
success: (res) => {
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
if (data.data.length > 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data: temp_data_list,
|
||||
data_total: data.total,
|
||||
data_page_total: data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_list_loding_msg: '',
|
||||
data_page: this.data_page + 1,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
this.setData({
|
||||
data_bottom_line_status: this.data_page > 1 && this.data_page > this.data_page_total,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_total: 0,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
if (this.data_page <= 1) {
|
||||
this.setData({
|
||||
data: [],
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
data_is_loading: 0,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
|
||||
// 删除blog
|
||||
del_event(e) {
|
||||
// 是否再次确认
|
||||
if (e.alert_status != 0 && e.alert_status != 1) {
|
||||
app.globalData.alert({
|
||||
msg: this.$t('user-list.user-list.yhvl2q'),
|
||||
is_show_cancel: 1,
|
||||
object: this,
|
||||
params: { id: e.currentTarget.dataset.id },
|
||||
method: 'del_event',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (e.alert_status == 1) {
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('delete', 'blog', 'blog'),
|
||||
method: 'POST',
|
||||
data: { ids: e.id },
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_list = [];
|
||||
var temp_data_list = this.data;
|
||||
for (var i in temp_data_list) {
|
||||
if (e.id.indexOf(temp_data_list[i]['id']) == -1) {
|
||||
temp_list.push(temp_data_list[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data: temp_list,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.del_success'), 'success');
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(this.$t('common.del_fail'));
|
||||
} else {
|
||||
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './user-list.css';
|
||||
</style>
|
||||
Reference in New Issue
Block a user