Merge branch 'dev-yxl' of gitee.com:zongzhige/shopxo-uniapp into dev

master
gongfuxiang 2026-02-26 15:22:49 +08:00
commit d8389681cf
4 changed files with 96 additions and 115 deletions

View File

@ -54,6 +54,11 @@
type: Boolean,
default: false,
},
//
propIsAllInfo: {
type: Boolean,
default: false,
},
// common
propPathType: {
type: String,
@ -98,10 +103,20 @@
var data = typeof res.data == 'object' ? res.data : JSON.parse(res.data);
if (data.code == 0 && (data.data.url || null) != null) {
if(self.propSingleCall) {
self.$emit('call-back', data.data.url, self.propCallData);
//
if(self.propIsAllInfo) {
self.$emit('call-back', data.data, self.propCallData);
} else {
self.$emit('call-back', data.data.url, self.propCallData);
}
} else {
var list = self.form_images_list;
list.push(data.data.url);
//
if(self.propIsAllInfo) {
list.push(data.data);
} else {
list.push(data.data.url);
}
self.setData({
form_images_list: list,
});

View File

@ -40,6 +40,7 @@
请选择文件最多可以上传{{ propMaxNum }}
</view>
</template>
<!-- 视频预览 -->
<uni-popup ref="popup" type="center" border-radius="20rpx" class="forminput-popup" mask-background-color="rgba(0,0,0,0.8)">
<view class="wh-auto ht-auto">
<view class="popup-close oh" @tap="popup_close">

View File

@ -39,7 +39,7 @@
<iconfont name="icon-givealike" :color="video_item.is_give_thumbs == 0 ? '#fff' : '#F4B73F'" size="60rpx" />
<text class="action-text">{{ video_item.give_thumbs_count }}</text>
</view>
<view v-if="base_config_data && base_config_data.is_video_comments_show && base_config_data.is_video_comments_show == 1" class="action-item" :data-value="video_item" @tap.stop="handle_comment">
<view v-if="base_config_data && base_config_data.is_video_comments_show && base_config_data.is_video_comments_show == 1" class="action-item" :data-id="video_item.id" @tap.stop="handle_comment">
<iconfont name="icon-comment" color="#fff" size="60rpx" />
<text class="action-text">{{ video_item.comments_count }}</text>
</view>
@ -115,9 +115,9 @@
<loading-component></loading-component>
</template>
<view v-else class="sub-comment-more flex-row align-c gap-10">
<view v-if="comment_item.page && comment_item.page < comment_item.page_total">
<template v-if="comment_item.page != null && comment_item.page < comment_item.page_total">
<commentMoreComponent :propId="comment_item.id" :propIsLevel="2" propText="展开" @comment_more_event="open_sub_comment"></commentMoreComponent>
</view>
</template>
<commentMoreComponent :propId="comment_item.id" propText="收起" propIconName="icon-arrow-top" @comment_more_event="close_sub_comment"></commentMoreComponent>
</view>
</template>
@ -147,9 +147,9 @@
</view>
<view class="flex-row align-c gap-10 wh-auto ht-auto pr-16 box-border-box">
<input :value="comment_input_value" class="comment-input" type="text" confirm-type="send" :adjust-position="false" :placeholder="input_placeholder" @focus="add_comment" @input="comment_input_event" @confirm="send_comment" />
<view data-type="image" @tap="comment_input_change">
<component-upload :propMaxNum="1" :propPathType="editor_path_type" propSlot propSingleCall propIsAllInfo @call-back="chat_upload_images_event">
<iconfont name="icon-layout-module-single-images" size="32rpx" color="#999"></iconfont>
</view>
</component-upload>
</view>
<view v-if="form_images_list.length > 0" class="pr w h comment-input-img-container">
<view v-for="(item, index) in form_images_list" :key="index" class="comment-input-img pr">
@ -212,9 +212,9 @@
</view>
<view class="flex-row align-c gap-10 wh-auto ht-auto pr-16 box-border-box">
<input :value="comment_input_value" :focus="is_add_comment" class="comment-input" type="text" confirm-type="done" :adjust-position="false" :auto-blur="true" :placeholder="input_placeholder" @input="comment_input_event" @blur="() => is_add_comment = false" @confirm="send_comment" />
<view data-type="image" @tap="comment_input_change">
<iconfont name="icon-layout-module-single-images" size="32rpx" color="#999"></iconfont>
</view>
<component-upload :propMaxNum="1" :propPathType="editor_path_type" propSlot propSingleCall propIsAllInfo @call-back="chat_upload_images_event">
<iconfont name="icon-layout-module-single-images" size="48rpx" color="#999"></iconfont>
</component-upload>
</view>
<view v-if="form_images_list.length > 0" class="pr w h comment-input-img-container">
<view v-for="(item, index) in form_images_list" :key="index" class="comment-input-img pr">
@ -240,6 +240,7 @@
import componentNoData from '@/components/no-data/no-data';
import componentBottomLine from '@/components/bottom-line/bottom-line';
import componentPopup from '@/components/popup/popup';
import componentUpload from '@/components/upload/upload';
//
var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0));
// #ifdef MP-TOUTIAO || H5
@ -254,7 +255,8 @@
componentNoData,
componentBottomLine,
componentPopup,
loadingComponent
loadingComponent,
componentUpload
},
data() {
return {
@ -316,7 +318,8 @@
is_add_comment: false,
//
listener_height: 0,
comments_data: {}
comments_data: {},
editor_path_type: 'video',
};
},
computed: {
@ -324,7 +327,7 @@
return this.show_comment_modal ? (this.move_distance > 0 ? `height: calc(30% + ${this.move_distance}px);` : 'height: 30%;') : 'height: 100%;';
},
commentContentStyle() {
return this.show_comment_modal && this.move_distance > 0 ? `transform: translateY(3px); height: calc(70% - ${this.move_distance}px);` : `transform: translateY(0); height: 70%;`;
return this.show_comment_modal && this.move_distance > 0 ? `transform: translateY(3px); height: calc(70% + 20rpx - ${this.move_distance}px);` : `transform: translateY(0); height: calc(70% + 20rpx);`;
},
current_video_index() {
return this.video_data_list.findIndex(item => item.id == this.current_video_id);
@ -443,6 +446,7 @@
video_data_list: [new_data.data],
report_type_list: new_data.report_type_list,
base_config_data: new_data.base_config_data,
editor_path_type: new_data.editor_path_type,
});
this.get_last_or_next_data_list(this.params.id, 1, 1);
} else {
@ -545,16 +549,18 @@
});
setTimeout(() => {
//#ifdef H5
if (this.video_contexts[this.current_index]) { // 0
this.video_play_event(this.video_contexts[this.current_index], true);
if (!this.paused) {
//#ifdef H5
if (this.video_contexts[this.current_index]) { // 0
this.video_play_event(this.video_contexts[this.current_index], true);
}
//#endif
//#ifndef H5
if (this.create_video_contexts[this.current_index]) { // 0
this.video_play_event(this.create_video_contexts[this.current_index], true);
}
//#endif
}
//#endif
//#ifndef H5
if (this.create_video_contexts[this.current_index]) { // 0
this.video_play_event(this.create_video_contexts[this.current_index], true);
}
//#endif
}, 200);
}, 0);
}
@ -602,7 +608,14 @@
is_seeking: false,
current_video_id: id, // ID
});
//#ifdef H5
// 使URLSearchParams
const url = new URL(location.href);
url.searchParams.set('id', id);
// URL
const pathname = location.href.split('?')[0];
history.replaceState(null, '', pathname + url.search);
//#endif
const index = this.video_data_list.findIndex(item => item.id == id);
//
@ -711,7 +724,7 @@
title: data.title || '',
desc: data.desc || '',
path: '/pages/plugins/video/detail/detail',
query: app.globalData.json_to_url_params(this.params),
query: 'id=' + this.current_video_id,
img: data.poster_url || ''
}
this.setData({
@ -797,70 +810,14 @@
comment_input_event(e) {
this.comment_input_value = e.detail.value;
},
comment_input_change(e) {
const { type } = e.currentTarget.dataset;
if (type == 'image') {
var self = this;
uni.chooseImage({
count: self.propMaxNum,
success(res) {
var success = 0;
var fail = 0;
var length = res.tempFilePaths.length;
var count = 0;
self.upload_one_by_one(res.tempFilePaths, success, fail, count, length, 'uploadimage');
},
});
}
},
//
upload_one_by_one(img_paths, success, fail, count, length, action) {
var self = this;
if (self.form_images_list.length <= this.propMaxNum) {
uni.uploadFile({
url: app.globalData.get_request_url('index', 'ueditor'),
filePath: img_paths[count],
name: 'upfile',
formData: {
action: action,
path_type: self.propPathType,
},
success: function (res) {
success++;
if (res.statusCode == 200) {
var data = typeof res.data == 'object' ? res.data : JSON.parse(res.data);
if (data.code == 0 && (data.data.url || null) != null) {
var list = self.form_images_list;
list.push({
url: data.data.url,
name: data.data.original,
size: data.data.size,
});
self.setData({
form_images_list: list,
});
self.$emit('call-back', self.form_images_list, self.propCallData);
} else {
app.globalData.showToast(data.msg);
}
}
},
fail: function (e) {
console.log(e);
fail++;
},
complete: function (e) {
count++;
//
if (count >= length) {
//
//app.showToast('' + success +'', 'success');
} else {
//
self.upload_one_by_one(img_paths, success, fail, count, length, action);
}
},
chat_upload_images_event(res) {
if((res || null) != null) {
//
this.form_images_list.push({
url: res.url,
name: res.name,
size: res.size,
});
}
},
@ -925,7 +882,8 @@
},
//
handle_comment(e) {
const old_data = e?.currentTarget?.dataset?.value || '';
const id = e?.currentTarget?.dataset?.id || '';
const old_data = this.video_data_list.find(item => item.id == id);
//
const new_data = old_data.comments_list.map(item1 => ({
...item1,
@ -1086,6 +1044,11 @@
if (item.id == new_video_comments_id) {
item.sub_comments.unshift(new_data);
item.comments_count++;
if (!item.show_sub_comment) {
item.show_sub_comment = true;
item.page = 0;
item.page_total = 1;
}
}
})
}
@ -1174,18 +1137,14 @@
if (data.code == 0) {
const new_data = data.data;
//
this.video_data_list.forEach(item => {
if (item.id == id) {
const new_item = {
...item,
...new_data,
};
item = new_item;
}
});
this.setData({
video_data_list: this.video_data_list
})
const index = this.video_data_list.findIndex(item => item.id == id);
if (index !== -1) {
// 使Object.assign
Object.assign(this.video_data_list[index], {
...this.video_data_list[index],
...new_data.data
});
}
}
}
});
@ -1442,7 +1401,6 @@
//
for (let i = 0; i < this.active_comments.length; i++) {
const comment = this.active_comments[i];
// id
if (comment.id == comment_id) {
continue;
@ -1450,19 +1408,19 @@
//
if (comment.sub_comments && Array.isArray(comment.sub_comments)) {
//
const filteredSubComments = comment.sub_comments.filter(
subComment => subComment.id != comment_id
);
//
if (filteredSubComments.length > 0 || comment.content) {
//
const index = comment.sub_comments.findIndex(subComment => subComment.id == comment_id);
if (index != -1) {
//
const filteredSubComments = comment.sub_comments.filter(subComment => subComment.id != comment_id);
//
if (filteredSubComments.length <= 0) {
comment.show_sub_comment = false;
}
comment.sub_comments = filteredSubComments;
filteredComments.push(comment);
}
//
comment.comments_count = filteredSubComments.length;
//
comment.comments_count = comment.comments_count - 1;
}
filteredComments.push(comment);
} else {
//
filteredComments.push(comment);
@ -1598,7 +1556,6 @@
* @param {Object} res - 键盘高度变化事件对象
*/
listener(res) {
console.log(res);
// 1
if (res.height > 0) {
this.listener_height = res.height - 1;

View File

@ -139,11 +139,16 @@ export default {
header_padding_left: padding_left,
menu_button_info: menu_button_info
});
//
this.search_history = uni.getStorageSync('search_history_key') || [];
if (this.search_history.length > 0) {
this.show_search_history = this.search_history.filter((item, index) => index < 5);
} else {
this.show_search_history = [];
}
//
this.search_query = '';
this.init_data();
},
init_data() {
@ -181,8 +186,10 @@ export default {
//
if (!isEmpty(e) && !this.search_history.includes(e)) {
this.search_history.push(e);
uni.setStorageSync('search_history_key', this.search_history);
}
this.search_query = e;
//
app.globalData.url_open(`/pages/plugins/video/search/search?search_query=${this.search_query}`, false);
},
perform_search(e) {
@ -198,6 +205,7 @@ export default {
this.search_history.splice(newIndex, 1);
}
this.show_search_history.splice(index, 1);
uni.setStorageSync('search_history_key', this.search_history);
},
perform_url(e) {
const url = e?.currentTarget?.dataset?.url || '';