|
@@ -1,6 +1,9 @@
|
|
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
|
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
|
|
|
|
|
-
|
|
|
|
|
|
+if(!empty($_GET['feedback'])) {
|
|
|
|
+ require_once __DIR__ . '/feedback.php';
|
|
|
|
+ exit;
|
|
|
|
+}
|
|
?>
|
|
?>
|
|
<?php $this->need('header.php'); ?>
|
|
<?php $this->need('header.php'); ?>
|
|
|
|
|
|
@@ -8,18 +11,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// 示例调用
|
|
// 示例调用
|
|
-$token = 'dataset-Emh5R5hCGorTuqG0dkQe7tMf'; // 传入实际的 token
|
|
|
|
|
|
+$token = 'dataset-Emh5R5hCGorTuqG0dkQe7tMf'; // 传入实际的 toke
|
|
$datasets = 'c08ae7fa-c4e7-4fae-8138-2097ff19e1a6'; // 传入实际的 datasets ID
|
|
$datasets = 'c08ae7fa-c4e7-4fae-8138-2097ff19e1a6'; // 传入实际的 datasets ID
|
|
$keyword = '';//'how to cute'; // 传入实际的查询关键字
|
|
$keyword = '';//'how to cute'; // 传入实际的查询关键字
|
|
$PathInfo = Typecho_Widget::widget('Widget_Options')->request->getPathInfo();;
|
|
$PathInfo = Typecho_Widget::widget('Widget_Options')->request->getPathInfo();;
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
// 检查请求路径是否以 '/search' 开头
|
|
// 检查请求路径是否以 '/search' 开头
|
|
if (strpos($PathInfo, '/search') === 0)
|
|
if (strpos($PathInfo, '/search') === 0)
|
|
{
|
|
{
|
|
@@ -32,9 +31,7 @@ if (strpos($PathInfo, '/search') === 0)
|
|
|
|
|
|
|
|
|
|
if(!empty($_GET['category'])) {
|
|
if(!empty($_GET['category'])) {
|
|
-
|
|
|
|
$category_id = $_GET['category'] * 1;
|
|
$category_id = $_GET['category'] * 1;
|
|
-
|
|
|
|
}
|
|
}
|
|
?>
|
|
?>
|
|
|
|
|
|
@@ -125,11 +122,15 @@ $thisChild["name"] ?></a></li> <?php } ?>
|
|
<script>
|
|
<script>
|
|
function toggleAnswer(index) {
|
|
function toggleAnswer(index) {
|
|
var answerDiv = document.getElementById('answer-' + index);
|
|
var answerDiv = document.getElementById('answer-' + index);
|
|
|
|
+ var feedbackDiv = document.getElementById('feedback-' + index);
|
|
var icon = document.getElementById('icon-' + index);
|
|
var icon = document.getElementById('icon-' + index);
|
|
|
|
|
|
if (answerDiv.style.display === 'none') {
|
|
if (answerDiv.style.display === 'none') {
|
|
|
|
|
|
answerDiv.style.display = 'block';
|
|
answerDiv.style.display = 'block';
|
|
|
|
+ feedbackDiv.style.display = 'block';
|
|
|
|
+
|
|
|
|
+
|
|
//icon.innerHTML = '▲'; // 展开时显示向上箭头
|
|
//icon.innerHTML = '▲'; // 展开时显示向上箭头
|
|
|
|
|
|
// 找到当前答案中的视频并自动播放
|
|
// 找到当前答案中的视频并自动播放
|
|
@@ -139,6 +140,7 @@ $thisChild["name"] ?></a></li> <?php } ?>
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
answerDiv.style.display = 'none';
|
|
answerDiv.style.display = 'none';
|
|
|
|
+ feedbackDiv.style.display = 'none';
|
|
//icon.innerHTML = '▼'; // 收起时显示向下箭头
|
|
//icon.innerHTML = '▼'; // 收起时显示向下箭头
|
|
|
|
|
|
// 如果答案被隐藏,暂停视频播放
|
|
// 如果答案被隐藏,暂停视频播放
|
|
@@ -183,6 +185,10 @@ $thisChild["name"] ?></a></li> <?php } ?>
|
|
padding-left: 20px; /* 答案缩进 */
|
|
padding-left: 20px; /* 答案缩进 */
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ .feedback-btn {
|
|
|
|
+ border: 1px solid #ddd; background: #f8f8f8; border-radius: 4px; padding: 5px 15px; margin-right: 10px; cursor: pointer; height: 32px; line-height: 1; display: inline-flex; align-items: center;
|
|
|
|
+ }
|
|
|
|
|
|
/* 在手机设备上将卡片padding设为0 */
|
|
/* 在手机设备上将卡片padding设为0 */
|
|
@media (max-width: 768px) {
|
|
@media (max-width: 768px) {
|
|
@@ -347,6 +353,24 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
|
|
<div id="answer-<?= $index ?>" class="answer" style="display: none;white-space: pre-line;">
|
|
<div id="answer-<?= $index ?>" class="answer" style="display: none;white-space: pre-line;">
|
|
<?= $answer ?>
|
|
<?= $answer ?>
|
|
</div>
|
|
</div>
|
|
|
|
+ <!-- 添加反馈按钮 -->
|
|
|
|
+ <div id="feedback-<?= $index ?>" class="feedback-container " style="display: none; margin-top: 30px; padding: 0 15px 15px 15px; text-align: center">
|
|
|
|
+ <div class="feedback-question" style="font-size: 14px; color: #666; margin-bottom: 5px;">Was this article helpful to you?</div>
|
|
|
|
+ <div class="feedback-buttons">
|
|
|
|
+ <button class="feedback-btn feedback-btn-<?= $index ?> helpful-btn" onclick="recordFeedback(<?= $index ?>, '<?= htmlspecialchars(addslashes($question), ENT_QUOTES, 'UTF-8') ?>', 1)" title="YES">
|
|
|
|
+ <i class="ri-thumb-up-line"></i>
|
|
|
|
+ </button>
|
|
|
|
+ <button class="feedback-btn feedback-btn-<?= $index ?> not-helpful-btn" onclick="recordFeedback(<?= $index ?>, '<?= htmlspecialchars(addslashes($question), ENT_QUOTES, 'UTF-8') ?>', 0)" title="NO">
|
|
|
|
+ <i class="ri-thumb-down-line"></i>
|
|
|
|
+ </button>
|
|
|
|
+ <button onclick="window.open('https://wa.me/8617000161888?text=Hello!', '_blank')" class="feedback-btn" title="No result ? Contact us on WhatsApp." >
|
|
|
|
+ <i class="ri-whatsapp-line"></i>
|
|
|
|
+ feedback
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+ <div id="feedback-result-<?= $index ?>" class="feedback-result" style="display: none; color: #666; margin-top: 5px;"></div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@@ -494,6 +518,24 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
|
|
<div id="answer-<?= $index ?>" class="answer" style="display: none;white-space: pre-line;">
|
|
<div id="answer-<?= $index ?>" class="answer" style="display: none;white-space: pre-line;">
|
|
<?= $answer ?>
|
|
<?= $answer ?>
|
|
</div>
|
|
</div>
|
|
|
|
+ <!-- 添加反馈按钮 -->
|
|
|
|
+ <div id="feedback-<?= $index ?>" class="feedback-container " style="display: none; margin-top: 30px; padding: 0 15px 15px 15px; text-align: center">
|
|
|
|
+ <div class="feedback-question" style="font-size: 14px; color: #666; margin-bottom: 5px;">Was this article helpful to you?</div>
|
|
|
|
+ <div class="feedback-buttons">
|
|
|
|
+ <button class="feedback-btn feedback-btn-<?= $index ?> helpful-btn" onclick="recordFeedback(<?= $index ?>, '<?= htmlspecialchars(addslashes($question), ENT_QUOTES, 'UTF-8') ?>', 1)" title="YES">
|
|
|
|
+ <i class="ri-thumb-up-line"></i>
|
|
|
|
+ </button>
|
|
|
|
+ <button class="feedback-btn feedback-btn-<?= $index ?> not-helpful-btn" onclick="recordFeedback(<?= $index ?>, '<?= htmlspecialchars(addslashes($question), ENT_QUOTES, 'UTF-8') ?>', 0)" title="NO">
|
|
|
|
+ <i class="ri-thumb-down-line"></i>
|
|
|
|
+ </button>
|
|
|
|
+ <button onclick="window.open('https://wa.me/8617000161888?text=Hello!', '_blank')" class="feedback-btn" title="No result ? Contact us on WhatsApp." >
|
|
|
|
+ <i class="ri-whatsapp-line"></i>
|
|
|
|
+ feedback
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+ <div id="feedback-result-<?= $index ?>" class="feedback-result" style="display: none; color: #666; margin-top: 5px;"></div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@@ -552,4 +594,6 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
<?php $this->need('footer.php'); ?>
|
|
<?php $this->need('footer.php'); ?>
|