源文件
This commit is contained in:
129
pages/plugins/ask/comments/comments.vue
Normal file
129
pages/plugins/ask/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-ask-comments :propData="data" :propDataBase="data_base" :propEmojiList="emoji_list" propType="comments"></component-ask-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 componentAskComments from '../components/ask-comments/ask-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,
|
||||
componentAskComments,
|
||||
},
|
||||
|
||||
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', 'ask'),
|
||||
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 ask = data.data;
|
||||
this.setData({
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_status: 3,
|
||||
data_base: data.base || null,
|
||||
data: ask,
|
||||
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/ask/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>
|
||||
579
pages/plugins/ask/components/ask-comments/ask-comments.vue
Normal file
579
pages/plugins/ask/components/ask-comments/ask-comments.vue
Normal file
@@ -0,0 +1,579 @@
|
||||
<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_ask_comments_show || 0) == 1" class="fw-b">{{$t('user-order-detail.user-order-detail.423rmr')}}{{ data.comments_count || 0 }}{{$t('goods-list.goods-list.8y3cc7')}}</view>
|
||||
<!-- 点赞、评论、分享 -->
|
||||
<view v-if="propType == 'detail'" class="tr ask-comments-bottom-container cr-base">
|
||||
<view v-if="(data_base.is_ask_comments_show || 0) == 1" class="item dis-inline-block cr-base" :data-value="'/pages/plugins/ask/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_ask_give_thumbs || 0) == 1" :class="'item dis-inline-block cr-' + ((data.is_give_thumbs || 0) == 1 ? 'main' : 'base')" :data-askid="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_ask_comments_add || 0) == 1 && !input_comments_modal_status" class="padding-top-xxxl padding-bottom-xxl ask-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-base" class="textarea 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_ask_comments_show || 0) == 1 && (data.comments_list || null) != null && data.comments_list.length > 0" class="ask-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">
|
||||
<mp-html :content="item.content" />
|
||||
</view>
|
||||
<view class="ask-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_ask_comments_show || 0) == 1" class="item dis-inline-block" :data-index="index" :data-username="item.user.user_name_view" :data-askcommentsid="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_ask_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-askid="item.ask_id" :data-askcommentsid="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-ask-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="ask-comments-right-content-operate flex-row jc-e align-c text-size-xs cr-grey-9 padding-0">
|
||||
<view v-if="(data_base.is_ask_comments_show || 0) == 1" class="item dis-inline-block" :data-index="index" :data-username="comments.user.user_name_view" :data-askcommentsid="comments.ask_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_ask_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-askid="comments.ask_id" :data-askcommentsid="comments.id" :data-replycommentsid="comments.ask_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-askid="item.ask_id" :data-askcommentsid="item.id" @tap="comments_list_reply_event">
|
||||
<text v-if="item.is_comments_list_submit == undefined" class="cr-base">{{$t('goods-list.goods-list.278qr1')}}{{ item.comments_count }}{{$t('ask-comments.ask-comments.ymmd24')}}</text>
|
||||
<text v-else class="cr-base">{{$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.ask_detail_comments_more_page_number || 0) == 0 && (data.comments_count || 0) > 20) || ((data_base.ask_detail_comments_more_page_number || 0) > 0 && data.comments_count > data_base.ask_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/ask/comments/comments?id=' + data.id" @tap="url_event">
|
||||
<text class="cr-base">{{$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-askid="data.id" @tap="comments_list_reply_event">
|
||||
<text class="cr-base">{{$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="ask-comments-modal pf">
|
||||
<view class="ask-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-base" class="textarea 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-base 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_ask_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_ask_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 ask_comments_id = e.currentTarget.dataset.askcommentsid || 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_ask_comments_id: ask_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 ask_id = e.currentTarget.dataset.askid;
|
||||
var ask_comments_id = e.currentTarget.dataset.askcommentsid || 0;
|
||||
if (ask_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', 'ask'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
ask_id: ask_id,
|
||||
ask_comments_id: ask_comments_id,
|
||||
page: page,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
if (ask_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 (ask_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', 'ask'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
ask_id: this.data.id,
|
||||
content: this.input_comments_value,
|
||||
ask_comments_id: this.input_comments_modal_ask_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_ask_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_ask_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 ask_id = e.currentTarget.dataset.askid;
|
||||
var ask_comments_id = e.currentTarget.dataset.askcommentsid || 0;
|
||||
var reply_comments_id = e.currentTarget.dataset.replycommentsid || 0;
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('givethumbs', 'index', 'ask'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
ask_id: ask_id,
|
||||
ask_comments_id: ask_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>
|
||||
/**
|
||||
* 聚合点赞、评论、分享
|
||||
*/
|
||||
.ask-comments-bottom-container .item:not(:last-child) {
|
||||
margin-right: 64rpx;
|
||||
}
|
||||
.ask-comments-reply-container .emoji-icon,
|
||||
.ask-comments-modal .emoji-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx !important;
|
||||
}
|
||||
.ask-comments-reply-container .user-avatar {
|
||||
width: 72rpx;
|
||||
height: 72rpx !important;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.ask-comments-reply-container .right-base {
|
||||
padding-left: 16rpx;
|
||||
}
|
||||
.ask-comments-reply-container .right-base .comments {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
.ask-comments-reply-container .right-base .textarea {
|
||||
height: 120rpx;
|
||||
}
|
||||
.ask-comments-modal {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: calc(100% - 80rpx);
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
padding: 40rpx;
|
||||
z-index: 10;
|
||||
}
|
||||
.ask-comments-modal-content {
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
margin: 0 auto;
|
||||
margin-top: 30%;
|
||||
max-width: calc(800px - 180rpx);
|
||||
}
|
||||
.ask-comments-modal-content .textarea {
|
||||
height: 200rpx;
|
||||
}
|
||||
.ask-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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 评论列表
|
||||
*/
|
||||
.ask-comments-list > .item .user-avatar {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.ask-comments-list .comments-base,
|
||||
.ask-comments-list .comments-content {
|
||||
padding-left: 16rpx;
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
.reply-ask-comments-list {
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
.reply-ask-comments-list .right-content {
|
||||
padding-left: 16rpx;
|
||||
}
|
||||
</style>
|
||||
46
pages/plugins/ask/detail/detail.css
Normal file
46
pages/plugins/ask/detail/detail.css
Normal file
@@ -0,0 +1,46 @@
|
||||
.admin-img {
|
||||
width: 68rpx;
|
||||
height: 68rpx !important;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品链接
|
||||
*/
|
||||
.goods-link .img {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
.goods-link .title {
|
||||
min-height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 猜你喜欢
|
||||
*/
|
||||
.guess-like {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.guess-like::before,
|
||||
.guess-like::after {
|
||||
content: "";
|
||||
width: 76px;
|
||||
height: 1px;
|
||||
background: #dddddd;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.guess-like::before {
|
||||
left: calc(100% + 20rpx);
|
||||
}
|
||||
|
||||
.guess-like::after {
|
||||
right: calc(100% + 20rpx);
|
||||
}
|
||||
244
pages/plugins/ask/detail/detail.vue
Normal file
244
pages/plugins/ask/detail/detail.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="(info || null) !== null" :class="(data_base.is_user_add_ask || 0) == 1 ? 'page-bottom-fixed' : ''">
|
||||
<!-- true为空对象 false为非空对象 Object.keys(info).length == 0 -->
|
||||
<view class="ask-container bg-white spacing-mb">
|
||||
<view class="padding-main">
|
||||
<view v-if="(info.title || null) != null" class="fw-b text-size-xl spacing-mb">{{ info.title }}</view>
|
||||
<view class="cr-grey-9 text-size-xs margin-bottom-sm flex-row">
|
||||
{{ $t('detail.detail.kt41ki') }}{{ info.add_time_date }}
|
||||
<view class="fw-b padding-horizontal-xs">·</view>
|
||||
{{ info.access_count || '0' }}{{ $t('detail.detail.e6ga1y') }}
|
||||
</view>
|
||||
<view v-if="info.title != info.content">
|
||||
<mp-html :content="info.content" />
|
||||
</view>
|
||||
<block v-if="(info.goods || null) !== null">
|
||||
<view :data-value="info.goods.goods_url" @tap="url_event" class="cp">
|
||||
<view class="goods-link spacing-mt bg-grey-f9 padding-main border-radius-sm">
|
||||
<view class="flex-row jc-sb">
|
||||
<view class="img border-radius-sm oh margin-right-main">
|
||||
<image :src="info.goods.images" mode="widthFix" class="wh-auto"></image>
|
||||
</view>
|
||||
<view class="flex-1 flex-width flex-row jc-sb align-c">
|
||||
<view class="flex-1 flex-width padding-right-sm">
|
||||
<view class="title multi-text">{{ info.goods.title }}</view>
|
||||
<view class="flex-row align-c margin-top-xs">
|
||||
<text class="cr-red fw-b margin-right-main">{{ currency_symbol }}{{ info.goods.price }}</text>
|
||||
<text class="text-size-xs cr-grey-9 original-price">{{ currency_symbol }}{{ info.goods.original_price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<iconfont name="icon-arrow-right" color="#999"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view v-if="info.is_reply && info.is_reply === '1'" class="padding-main br-t-dashed">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="flex-row align-c">
|
||||
<image v-if="(logo_square || null) != null" :src="logo_square" mode="widthFix" class="admin-img circle br-f5 margin-right-sm"></image>
|
||||
<text>{{ $t('detail.detail.ng628i') }}</text>
|
||||
</view>
|
||||
<view v-if="(info.reply_time_date || null) != null" class="cr-grey-9 text-size-xs">{{ $t('detail.detail.7rg4bb') }}{{ info.reply_time_date }}</view>
|
||||
</view>
|
||||
<view class="padding-top-main">
|
||||
<mp-html :content="info.reply" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="padding-main br-t-dashed">
|
||||
<!-- 评论内容 -->
|
||||
<component-ask-comments :propData="info" :propDataBase="data_base" :propEmojiList="emoji_list" :propShareInfo="share_info"></component-ask-comments>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 猜你喜欢 -->
|
||||
<view v-if="goods_list.length > 0" class="padding-horizontal-main padding-top-sm">
|
||||
<view class="tc spacing-mb">
|
||||
<view class="guess-like fw-b text-size-md">{{ $t('goods-detail.goods-detail.v2974w') }}</view>
|
||||
</view>
|
||||
<component-goods-list :propData="{ style_type: 1, goods_list: goods_list, random: random_value }" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" propSource="detail" @CartSuccessEvent="cart_success_event"></component-goods-list>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
<view v-if="(data_base.is_user_add_ask || 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/ask/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('goods-detail.goods-detail.7ulh8b') }}</view>
|
||||
</view>
|
||||
<view data-value="/pages/plugins/ask/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('detail.detail.p7o522') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</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 componentGoodsList from '@/components/goods-list/goods-list';
|
||||
import componentAskComments from '../components/ask-comments/ask-comments';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
logo_square: app.globalData.get_application_logo_square(),
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: true,
|
||||
bottom_fixed_style: '',
|
||||
info: null,
|
||||
data_base: null,
|
||||
emoji_list: [],
|
||||
// 基础配置
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
// 猜你喜欢 参数
|
||||
goods_list: [],
|
||||
goods_is_loading: 0,
|
||||
goods_total: 0,
|
||||
goods_page_total: 0,
|
||||
goods_page: 1,
|
||||
// 标签插件
|
||||
plugins_label_data: null,
|
||||
// 增加随机数,避免无法监听数据列表内部数据更新
|
||||
random_value: 0,
|
||||
params: '',
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentGoodsList,
|
||||
componentAskComments,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: app.globalData.launch_params_handle(params),
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
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: {
|
||||
get_data(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.goods_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 是否加载中
|
||||
if (this.goods_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
goods_is_loading: 1,
|
||||
});
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('detail', 'index', 'ask'),
|
||||
method: 'POST',
|
||||
data: this.params,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
let data = res.data.data;
|
||||
var info = data.data || null;
|
||||
this.setData({
|
||||
info: info,
|
||||
data_base: data.base || null,
|
||||
emoji_list: data.emoji_list || [],
|
||||
goods_list: data.goods,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 0,
|
||||
goods_is_loading: 0,
|
||||
});
|
||||
|
||||
if (info != null) {
|
||||
// 基础自定义分享
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: info.title,
|
||||
desc: info.content,
|
||||
path: '/pages/plugins/ask/detail/detail',
|
||||
query: 'id=' + info.id,
|
||||
},
|
||||
});
|
||||
|
||||
// 标题
|
||||
uni.setNavigationBarTitle({ title: info.title || info.content });
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_msg: res.data.msg,
|
||||
data_list_loding_status: 0,
|
||||
goods_is_loading: 0,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
data_list_loding_status: 2,
|
||||
goods_is_loading: 0,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 猜你喜欢加入购物车回调
|
||||
cart_success_event() {
|
||||
// 传1表示为购物车回调方法调用的此方法
|
||||
this.get_data(1);
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './detail.css';
|
||||
</style>
|
||||
3
pages/plugins/ask/form/form.css
Normal file
3
pages/plugins/ask/form/form.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.form-container .form-gorup .textarea-height {
|
||||
min-height: 200rpx !important;
|
||||
}
|
||||
318
pages/plugins/ask/form/form.vue
Normal file
318
pages/plugins/ask/form/form.vue
Normal file
@@ -0,0 +1,318 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<form v-if="data_list_loding_status == 3" @submit="formSubmit" class="form-container">
|
||||
<view class="padding-main oh page-bottom-fixed">
|
||||
<view class="form-gorup border-radius-main oh flex-row jc-sb align-c margin-bottom-main">
|
||||
<view class=""> 标题 <text class="form-group-tips-must">*</text></view>
|
||||
<view class="flex-row align-c flex-1 flex-width">
|
||||
<input type="text" name="title" :value="data.title" maxlength="16" placeholder-class="cr-grey-9 tr" class="cr-base tr" placeholder="请输入标题" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-gorup border-radius-main margin-bottom-main">
|
||||
<view class="margin-bottom-sm">提问内容 <text class="form-group-tips-must">*</text></view>
|
||||
<sp-editor @init="initEditor" @input="rich_text_event" @upinImage="up_in_image_event"></sp-editor>
|
||||
</view>
|
||||
<view class="form-gorup border-radius-main oh flex-row jc-sb align-c margin-bottom-main">
|
||||
<view class=""> 提问分类 </view>
|
||||
<view class="flex-row jc-e align-c flex-1 flex-width">
|
||||
<picker @change="select_change_event" :value="category_id_index" :range="ask_category_list" range-key="name" name="category_id" data-field="category_id" class="margin-right-sm wh-auto tr">
|
||||
<view class="uni-input cr-base picker">
|
||||
<template v-if="category_id_index !== -1">
|
||||
{{ ask_category_list[category_id_index].name || '' }}
|
||||
</template>
|
||||
</view>
|
||||
</picker>
|
||||
<iconfont name="icon-arrow-right" size="34rpx" color="#ccc"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="is_show_email_notice == 1" class="form-gorup border-radius-main oh flex-row jc-sb align-c margin-bottom-main">
|
||||
<view class=""> 回复邮件通知 </view>
|
||||
<view class="flex-row align-c flex-1 flex-width">
|
||||
<input type="text" name="email_notice" :value="data.email_notice" placeholder-class="cr-grey-9 tr" class="cr-base tr" placeholder="请输入邮件" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="is_show_mobile_notice == 1" class="form-gorup border-radius-main oh flex-row jc-sb align-c margin-bottom-main">
|
||||
<view class="form-gorup-title"> 回复手机通知 </view>
|
||||
<view class="flex-row align-c flex-1 flex-width">
|
||||
<input type="text" name="mobile_notice" :value="data.mobile_notice" maxlength="16" placeholder-class="cr-grey-9 tr" class="cr-base tr" placeholder="请输入手机号" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 匿名发布 -->
|
||||
<!-- <view class="form-gorup border-radius-main oh flex-row jc-e align-c">
|
||||
<checkbox-group @change="is_anonymous_change_event">
|
||||
<label class="cr-grey-9">
|
||||
<checkbox value="1" :checked="false" :color="theme_color" style="transform: scale(0.7)" />
|
||||
<text class="pr top-xs">{{ $t('form.form.2f52v3') }}</text>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view> -->
|
||||
<view class="bottom-fixed">
|
||||
<view class="bottom-line-exclude">
|
||||
<button class="bg-main br-main cr-white round text-size" type="default" form-type="submit" hover-class="none" :loading="form_submit_loading" :disabled="form_submit_loading">{{ $t('form.form.4yd066') }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</form>
|
||||
<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 componentNoData from '@/components/no-data/no-data';
|
||||
import componentUpload from '@/components/upload/upload';
|
||||
const theme_color = app.globalData.get_theme_color();
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
theme_color: theme_color,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: this.$t('form.form.bniyyt'),
|
||||
params: {},
|
||||
form_submit_loading: false,
|
||||
is_anonymous: '0',
|
||||
editor_path_type: '',
|
||||
|
||||
data: {},
|
||||
ask_category_list: [],
|
||||
is_show_email_notice: 0,
|
||||
is_show_mobile_notice: 0,
|
||||
category_id_index: -1,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentUpload,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: params,
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 加载数据
|
||||
this.init();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
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() {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
// 网络请求
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('saveinfo', 'ask', 'ask'),
|
||||
method: 'POST',
|
||||
data: { id: this.params.id || null },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
var data = res.data.data;
|
||||
if (res.data.code == 0) {
|
||||
this.setData({
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_status: 3,
|
||||
data: data.data || {},
|
||||
ask_category_list: data.ask_category_list || [],
|
||||
editor_path_type: data.editor_path_type,
|
||||
is_show_email_notice: data.is_show_email_notice,
|
||||
is_show_mobile_notice: data.is_show_mobile_notice,
|
||||
category_id_index: (data.ask_category_list || []).length > 0 && data.data != null ? data.ask_category_list.findIndex((item) => item.id === data.data.category_id) : -1,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 表单提交
|
||||
formSubmit(e) {
|
||||
// 数据验证
|
||||
var validation = [
|
||||
{ fields: 'content', msg: this.$t('form.form.5v5bjs') },
|
||||
{ fields: 'title', msg: this.$t('form.form.5v5bjs') },
|
||||
];
|
||||
const new_data = {
|
||||
goods_id: this.params.goods_id || 0,
|
||||
id: this.params.id || null,
|
||||
...e.detail.value,
|
||||
content: this.data.content,
|
||||
category_id: this.data.category_id,
|
||||
};
|
||||
if (app.globalData.fields_check(new_data, validation)) {
|
||||
uni.showLoading({
|
||||
title: this.$t('buy.buy.r79t77'),
|
||||
});
|
||||
this.setData({
|
||||
form_submit_loading: true,
|
||||
});
|
||||
// 网络请求
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('save', 'ask', 'ask'),
|
||||
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.url_open('/pages/plugins/ask/user-list/user-list', true);
|
||||
}, 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'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// // 匿名发布
|
||||
// is_anonymous_change_event(e) {
|
||||
// this.setData({
|
||||
// is_anonymous: e.detail.value.length > 0 ? e.detail.value[0] : 0,
|
||||
// });
|
||||
// },
|
||||
|
||||
initEditor(editor) {
|
||||
// 初始化编辑器内容
|
||||
editor.setContents({
|
||||
html: (this.data || null) !== null ? this.data.content : '',
|
||||
});
|
||||
},
|
||||
|
||||
// 回调富文本内容
|
||||
rich_text_event(e) {
|
||||
var new_data = this.data;
|
||||
new_data.content = e.html;
|
||||
this.setData({
|
||||
data: new_data,
|
||||
});
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
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: this.editor_path_type, // 路径类型,默认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();
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 分类选择事件
|
||||
select_change_event(e) {
|
||||
var temp = this.data;
|
||||
const category_id = this.ask_category_list[e.detail.value].id;
|
||||
temp[e.currentTarget.dataset.field] = category_id;
|
||||
this.setData({
|
||||
data: temp,
|
||||
category_id_index: e.detail.value,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './form.css';
|
||||
</style>
|
||||
23
pages/plugins/ask/goods-list/goods-list.css
Normal file
23
pages/plugins/ask/goods-list/goods-list.css
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
.question .title{
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
background: #fd9525;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
.question .avatar,
|
||||
.ask .avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 4rpx;
|
||||
background: #F5F5F5;
|
||||
}
|
||||
.ask .title{
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
background: #99BB12;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
332
pages/plugins/ask/goods-list/goods-list.vue
Normal file
332
pages/plugins/ask/goods-list/goods-list.vue
Normal file
@@ -0,0 +1,332 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<block v-if="data_list.length > 0">
|
||||
<scroll-view :scroll-y="true" class="scroll-box padding-main bs-bb" @scrolltolower="scroll_lower" lower-threshold="60">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="bg-white border-radius-main padding-main oh" :class="data_list.length > index + 1 ? 'spacing-mb' : ''">
|
||||
<view class="title flex-row jc-sb align-c wh-auto">
|
||||
<view class="name flex-1 flex-width cr-base">{{ item.name }}{{$t('goods-list.goods-list.27nkjm')}}</view>
|
||||
<view class="date cr-grey-9">{{ item.add_time_date }}</view>
|
||||
</view>
|
||||
<view class="question spacing-mt">
|
||||
<view :data-value="item.url" @tap="url_event" class="flex-row cp">
|
||||
<view class="title cr-white tc margin-right-sm">{{$t('goods-list.goods-list.00n7i3')}}</view>
|
||||
<view class="flex-1 flex-width">
|
||||
<mp-html :content="item.content" />
|
||||
<view v-if="(item.images || null) != null && item.images.length > 0" class="avatar spacing-mt-10 radius margin-right-sm oh">
|
||||
<image v-for="(img, i) in item.images" class="wh-auto" @tap="comment_images_show_event" :data-index="i" :data-ix="i + 1" :src="img" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="item.is_reply == 1 || (item.reply || null) != null">
|
||||
<view class="ask flex-row spacing-mt">
|
||||
<view class="title cr-white tc margin-right-sm">{{$t('goods-list.goods-list.rw12i7')}}</view>
|
||||
<view class="flex-1 flex-width">
|
||||
<view class="padding-bottom-main">
|
||||
<mp-html :content="item.reply" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="item.bool_more && (item.comments_list || null) != null && item.comments_list.length > 0">
|
||||
<block v-for="(it, ix) in item.comments_list" :key="ix">
|
||||
<view class="cr-base br-t-f9 padding-vertical-main">{{ it.content }}</view>
|
||||
<view v-if="(it.images || null) != null && it.images.length > 0" class="avatar spacing-mt-10 radius margin-right-sm oh">
|
||||
<block v-for="(img, i) in it.images">
|
||||
<image class="wh-auto" @tap="comment_images_show_event" :data-index="i" :data-ix="i + 1" :src="img" mode="aspectFit"></image>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
<view v-if="item.comments_count > 0" class="more flex-row jc-e align-c br-t-f9 padding-top-main">
|
||||
<view v-if="(item.hide_more || false) === false && ((item.hide_comments_list_num === 0 && !item.bool_more) || (item.hide_comments_list_num == undefined || item.hide_comments_list_num > 0))" class="cr-red text-size-xs" @tap="open_more(item.id, index)">
|
||||
<text v-if="item.hide_comments_list_num === 0 && !item.bool_more">{{$t('common.view_more')}}</text>
|
||||
<text v-if="item.hide_comments_list_num == undefined || item.hide_comments_list_num > 0">{{$t('goods-list.goods-list.278qr1')}}{{ item.hide_comments_list_num || item.comments_count }}{{$t('goods-list.goods-list.8y3cc7')}}</text>
|
||||
<iconfont :name="item.bool_more ? 'icon-arrow-bottom' : 'icon-arrow-top'" size="24rpx" propClass="pr top-xs"></iconfont>
|
||||
</view>
|
||||
<view v-if="item.bool_more" class="cr-red text-size-xs margin-left-main" @tap="close_more(index)">
|
||||
<text>{{$t('goods-list.goods-list.aem3e6')}}</text>
|
||||
<iconfont name="icon-arrow-top" size="24rpx" propClass="pr top-xs"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</scroll-view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></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: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
params: {},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: 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);
|
||||
},
|
||||
|
||||
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: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
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('datalist', 'index', 'ask'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
page: this.data_page,
|
||||
goods_id: this.params.goods_id || 0,
|
||||
is_comments: 1,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if(this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = res.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: res.data.data.total,
|
||||
data_page_total: res.data.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_is_loading: 0,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
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'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 评价图片预览
|
||||
comment_images_show_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var ix = e.currentTarget.dataset.ix;
|
||||
uni.previewImage({
|
||||
current: this.data_list[index]['images'][ix],
|
||||
urls: this.data_list[index]['images'],
|
||||
});
|
||||
},
|
||||
|
||||
// 查看更多
|
||||
open_more(id, i) {
|
||||
var new_data_list = this.data_list;
|
||||
new_data_list[i].bool_more = true;
|
||||
if (new_data_list[i].bool_api === undefined || new_data_list[i].bool_api === true) {
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('commentsreplylist', 'index', 'ask'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
ask_id: id,
|
||||
ask_comments_id: 0,
|
||||
page: new_data_list[i].page || 1,
|
||||
is_comments: 1,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if ((new_data_list[i].page || 1) <= 1) {
|
||||
new_data_list[i].comments_list = res.data.data.data;
|
||||
} else {
|
||||
new_data_list[i].comments_list = new_data_list[i].comments_list.concat(res.data.data.data);
|
||||
}
|
||||
new_data_list[i].hide_comments_list_num = res.data.data.total-new_data_list[i].comments_list.length;
|
||||
// 判断当前页数是否小于总页数,如果是则继续显示更多按钮,且当前页+1,如果不是则隐藏更多按钮
|
||||
if (res.data.data.page < res.data.data.page_total) {
|
||||
new_data_list[i].hide_more = false;
|
||||
new_data_list[i].page = (new_data_list[i].page || 1) + 1;
|
||||
} else {
|
||||
new_data_list[i].hide_more = true;
|
||||
}
|
||||
new_data_list[i].page_total = res.data.data.page_total;
|
||||
new_data_list[i].bool_api = true;
|
||||
this.setData({
|
||||
data_list: new_data_list,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// 查看更多是否调用接口
|
||||
new_data_list[i].bool_api = true;
|
||||
// 是否隐藏更多查看按钮
|
||||
new_data_list[i].hide_more = !((new_data_list[i].hide_comments_list_num == undefined && new_data_list[i].comments_count > 0) || new_data_list[i].hide_comments_list_num < new_data_list[i].comments_count);
|
||||
this.setData({
|
||||
data_list: new_data_list,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 收起更多
|
||||
close_more(i) {
|
||||
var new_data_list = this.data_list;
|
||||
// 查看更多是否调用接口
|
||||
new_data_list[i].bool_api = false;
|
||||
// 是否隐藏更多查看按钮
|
||||
new_data_list[i].hide_more = false;
|
||||
// 是否展示更多内容
|
||||
new_data_list[i].bool_more = false;
|
||||
this.setData({
|
||||
data_list: new_data_list,
|
||||
});
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './goods-list.css';
|
||||
</style>
|
||||
38
pages/plugins/ask/index/index.css
Normal file
38
pages/plugins/ask/index/index.css
Normal file
@@ -0,0 +1,38 @@
|
||||
.scroll-box {
|
||||
height: calc(100vh - 40px);
|
||||
}
|
||||
|
||||
.status .ask-status {
|
||||
padding: 4rpx 10rpx;
|
||||
}
|
||||
|
||||
.ask-bg-green {
|
||||
background-color: #5FB95E;
|
||||
}
|
||||
|
||||
.ask-bg-yellow {
|
||||
background-color: #FAAD14;
|
||||
}
|
||||
|
||||
.status .num {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.ask-hot {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
line-height: 32rpx;
|
||||
color: #FFB868;
|
||||
}
|
||||
|
||||
.hot-bg-0 {
|
||||
background: linear-gradient(150deg, #FC6761 0%, #ED4540 100%);
|
||||
}
|
||||
|
||||
.hot-bg-1 {
|
||||
background: linear-gradient(150deg, #FFA12A 0%, #FF8605 100%);
|
||||
}
|
||||
|
||||
.hot-bg-2 {
|
||||
background: linear-gradient(150deg, #FFCE90 0%, #FFAA4E 100%);
|
||||
}
|
||||
324
pages/plugins/ask/index/index.vue
Normal file
324
pages/plugins/ask/index/index.vue
Normal file
@@ -0,0 +1,324 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<component-nav-back :propFixed="false" propClass="bg-white cr-black" propColor="#333" :style="'padding-top:' + (status_bar_height + 5) + 'px;'">
|
||||
<template slot="right" :class="is_mp_env ? 'top-search-width' : ''">
|
||||
<view class="margin-left-main" :class="is_mp_env ? '' : 'flex-1 flex-width'">
|
||||
<component-search @onsearch="search_button_event" propIsOnEvent :propIsRequired="false" propIconColor="#ccc" propPlaceholderClass="cr-grey-c" propBgColor="#f6f6f6"></component-search>
|
||||
</view>
|
||||
</template>
|
||||
</component-nav-back>
|
||||
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="60" :style="'height: calc(100vh - '+(40+status_bar_height)+'px)'">
|
||||
<view class="wh-auto">
|
||||
<!-- 轮播 -->
|
||||
<view v-if="slider_list.length > 0" class="padding-horizontal-main spacing-mb padding-top-main">
|
||||
<component-banner :propData="slider_list"></component-banner>
|
||||
</view>
|
||||
<!-- tab -->
|
||||
<view v-if="nav_list.length > 0" class="ask-tab flex-row jc-sa align-c bg-white wh-auto left-0 top-0 ps z-i padding-bottom-sm">
|
||||
<view v-for="(item, index) in nav_list" :key="index" class="flex-1 padding-vertical-sm tc" :class="nav_index === index ? 'cr-main fw-b nav-active-line' : 'cr-base'" :data-index="index" :data-type="item.type" @tap="nav_change_event">{{ item.name }}</view>
|
||||
</view>
|
||||
<!-- 内容列表 -->
|
||||
<view :class="(data_base.is_user_add_ask || 0) == 1 ? 'page-bottom-fixed' : ''">
|
||||
<view v-if="data_list.length > 0" class="padding-horizontal-main padding-top-main">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<view :data-value="'/pages/plugins/ask/detail/detail?id=' + item.id" @tap="url_event" class="padding-main border-radius-main bg-white oh cp spacing-mb flex-row">
|
||||
<view v-if="nav_index === 1">
|
||||
<view class="ask-hot border-radius-sm tc margin-right-sm va-m pr top-md" :class="index < 3 ? 'cr-white text-size-xs hot-bg-' + index : 'text-size-md'">{{ index + 1 }}</view>
|
||||
</view>
|
||||
<view class="flex-1 flex-width">
|
||||
<view class="title text-size fw-b">{{ item.title }}</view>
|
||||
<view v-if="item.title != item.content" class="content cr-base margin-top-sm padding-top-xs multi-text">
|
||||
<mp-html :content="item.content" />
|
||||
</view>
|
||||
<view class="status flex-row align-c spacing-mt text-size-xs">
|
||||
<view v-if="nav_index !== 1" class="ask-status cr-white border-radius-sm text-size-xss" :class="item.is_reply === '1' ? 'ask-bg-green' : 'ask-bg-yellow'">{{ item.is_reply === '1' ? $t('index.index.1c17n3') : $t('index.index.75l3l2') }}</view>
|
||||
<view class="num cr-grey-9 flex-row self-c">
|
||||
{{ item.add_time_date }}
|
||||
<view class="fw-b padding-horizontal-xs">·</view>
|
||||
{{ item.access_count || '0' }}{{ $t('detail.detail.e6ga1y') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 结尾 -->
|
||||
<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" :propLoadingLogoTop="slider_list.length > 0 ? '80%' : '50%'"></component-no-data>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view v-if="(data_base.is_user_add_ask || 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/ask/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('goods-detail.goods-detail.7ulh8b') }}</view>
|
||||
</view>
|
||||
<view data-value="/pages/plugins/ask/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('detail.detail.p7o522') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNavBack from '@/components/nav-back/nav-back';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentSearch from '@/components/search/search';
|
||||
import componentBanner from '@/components/slider/slider';
|
||||
|
||||
// 状态栏高度
|
||||
var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0));
|
||||
// #ifdef MP-TOUTIAO
|
||||
bar_height = 0;
|
||||
// #endif
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
status_bar_height: bar_height,
|
||||
is_mp_env: false,
|
||||
// #ifdef MP-WEIXIN || MP-BAIDU || MP-ALIPAY || MP-QQ || MP-KUAISHOU
|
||||
is_mp_env: true,
|
||||
// #endif
|
||||
bottom_fixed_style: '',
|
||||
data_base: {},
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
// 轮播
|
||||
slider_list: [],
|
||||
// 导航分类
|
||||
nav_list: [],
|
||||
nav_index: 0,
|
||||
nav_type: '',
|
||||
// 搜索框关键字
|
||||
search_bwg: '',
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNavBack,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentSearch,
|
||||
componentBanner
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 加载数据
|
||||
this.get_data();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
methods: {
|
||||
get_data() {
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'index', 'ask'),
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.search_tab_list.length > 0) {
|
||||
var data_base = res.data.data.base || {};
|
||||
this.setData({
|
||||
data_base: data_base,
|
||||
slider_list: res.data.data.slider_list || [],
|
||||
nav_list: res.data.data.search_tab_list || [],
|
||||
// 基础自定义分享
|
||||
share_info: {
|
||||
title: data_base.seo_title || data_base.application_name || this.$t('goods-detail.goods-detail.k5u755'),
|
||||
desc: data_base.seo_desc || '',
|
||||
path: '/pages/plugins/ask/index/index',
|
||||
},
|
||||
});
|
||||
|
||||
// 拉取列表数据
|
||||
this.get_data_list();
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('index.index.17vy72'),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: 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;
|
||||
}
|
||||
}
|
||||
|
||||
// 是否加载中
|
||||
if (this.data_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
data_is_loading: 1,
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('datalist', 'index', 'ask'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
page: this.data_page,
|
||||
type: this.nav_type,
|
||||
bwd: this.search_bwg,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = res.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: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: temp_data_list.length > 0 ? 3 : 0,
|
||||
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: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
data_is_loading: 0,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 查询
|
||||
search_button_event(e) {
|
||||
this.setData({
|
||||
search_bwg: e || '',
|
||||
data_page: 1,
|
||||
data_list: []
|
||||
});
|
||||
this.reset_scroll();
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 重置滑动位置
|
||||
reset_scroll() {
|
||||
this.setData({
|
||||
scroll_top: this.scroll_top_old,
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.setData({
|
||||
scroll_top: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
nav_change_event(e) {
|
||||
// 索引值
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var type = e.currentTarget.dataset.type || 0;
|
||||
this.setData({
|
||||
data_list: [],
|
||||
nav_index: index,
|
||||
nav_type: type,
|
||||
data_page: 1,
|
||||
});
|
||||
this.reset_scroll();
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './index.css';
|
||||
</style>
|
||||
146
pages/plugins/ask/user-detail/user-detail.vue
Normal file
146
pages/plugins/ask/user-detail/user-detail.vue
Normal file
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<block v-if="data_list_loding_status != 1 && data.length != 0">
|
||||
<component-panel-content :propData="data" :propDataField="field_list" propExcludeField="content" propTitle="详情"></component-panel-content>
|
||||
|
||||
<component-panel-content propTitle="提问内容">
|
||||
<view class="item br-b-f5 oh padding-vertical-main">
|
||||
<mp-html :content="data.content"></mp-html>
|
||||
</view>
|
||||
</component-panel-content>
|
||||
|
||||
<component-panel-content propTitle="回复内容">
|
||||
<view class="item br-b-f5 oh padding-vertical-main">
|
||||
<mp-html :content="data.reply"></mp-html>
|
||||
</view>
|
||||
</component-panel-content>
|
||||
</block>
|
||||
<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 componentNavBack from '@/components/nav-back/nav-back';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentPanelContent from '@/components/panel-content/panel-content';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
ask_static_url: app.globalData.get_static_url('ask', true),
|
||||
data: {},
|
||||
field_list: [],
|
||||
data_list_loding_status: 1,
|
||||
params: '',
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNavBack,
|
||||
componentNoData,
|
||||
componentPanelContent,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
if (params) {
|
||||
this.setData({
|
||||
params: params,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 加载数据
|
||||
this.init();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
this.get_data();
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
get_data() {
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('detail', 'ask', 'ask'),
|
||||
method: 'POST',
|
||||
data: this.params,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
this.setData({
|
||||
data: res.data.data.data || [],
|
||||
field_list: res.data.data.field_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')) {
|
||||
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'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 顶部返回操作
|
||||
top_nav_left_back_event(e) {
|
||||
app.globalData.page_back_prev_event();
|
||||
},
|
||||
|
||||
// 页面滚动监听
|
||||
onPageScroll(res) {
|
||||
uni.$emit('onPageScroll', res);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
3
pages/plugins/ask/user-list/user-list.css
Normal file
3
pages/plugins/ask/user-list/user-list.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.ask-status {
|
||||
padding: 4rpx 10rpx;
|
||||
}
|
||||
237
pages/plugins/ask/user-list/user-list.vue
Normal file
237
pages/plugins/ask/user-list/user-list.vue
Normal file
@@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view class="page-bottom-fixed">
|
||||
<view v-if="data_list.length > 0" class="padding-main">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="item padding-main border-radius-main oh bg-white spacing-mb">
|
||||
<view class="base oh br-b-dashed padding-bottom-main flex-row jc-sb align-c">
|
||||
<text class="cr-grey-9">{{ item.add_time_time }}</text>
|
||||
<text class="ask-status margin-left-xs" :class="item.is_reply == 1 ? 'cr-green' : 'cr-grey-c'">{{ item.is_reply_name }}</text>
|
||||
</view>
|
||||
<view :data-value="'/pages/plugins/ask/user-detail/user-detail?id=' + item.id" @tap="url_event" class="content margin-top-main cp">
|
||||
<component-panel-content :propData="item" :propDataField="field_list" :propIsItemShowMax="4" propExcludeField="add_time_time,is_reply" :propIsTerse="true"></component-panel-content>
|
||||
</view>
|
||||
<view class="item-operation tr margin-top-main">
|
||||
<button class="btn round br-grey-9 bg-white text-size-md" type="default" size="mini" @tap="delete_event" :data-value="item.id" hover-class="none">{{ $t('common.del') }}</button>
|
||||
<button v-if="item.is_reply == 0" class="btn round cr-main br-main bg-white text-size-md" type="default" size="mini" :data-value="'/pages/plugins/ask/form/form?id=' + item.id" @tap="url_event" hover-class="none">{{ $t('common.edit') }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
|
||||
<view class="bottom-fixed" :style="bottom_fixed_style">
|
||||
<view class="bottom-line-exclude">
|
||||
<button class="item bg-white br-main cr-main round text-size" type="default" data-value="/pages/plugins/ask/form/form" @tap="url_event" hover-class="none">{{ $t('goods-detail.goods-detail.7ulh8b') }}</button>
|
||||
</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 componentPanelContent from '@/components/panel-content/panel-content';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
bottom_fixed_style: '',
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentPanelContent,
|
||||
},
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
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: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
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', 'ask', 'ask'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
page: this.data_page,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if (this.data_page > 1) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data_list;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
field_list: res.data.data.field_list || [],
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.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_is_loading: 0,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
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'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 删除留言
|
||||
delete_event(e) {
|
||||
const value = e.currentTarget.dataset.value;
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('delete', 'ask', 'ask'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
ids: value,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
} else {
|
||||
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: () => {
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './user-list.css';
|
||||
</style>
|
||||
Reference in New Issue
Block a user