問答業(yè)務(wù)語法說明
更新時(shí)間:2019-12-09
問答業(yè)務(wù)適用于問答模型。
?
在模型詳情頁中配置提問表單代碼,在 “ 模型管理 ->問答 ->”開啟提問業(yè)務(wù)后可使用該功能。后臺(tái)關(guān)閉提問業(yè)務(wù)時(shí),前臺(tái)提交業(yè)務(wù)表單會(huì)失敗。
?
訪客提問發(fā)起頁面:問答列表頁和問答詳情頁
訪客回復(fù)發(fā)起頁面:問答詳情頁
1.網(wǎng)站訪客在前臺(tái)發(fā)布提問
說明:網(wǎng)站訪客前臺(tái)提交問題,必填的內(nèi)容有標(biāo)題、問題分類、問題描述、稱呼、手機(jī)、手機(jī)驗(yàn)證碼。
?
提問提交地址:/addquestion.html
<form action="/addquestion.html" method="post">
問題標(biāo)題:<input type="text" name="title" placeholder="一句話描述您的問題">
問題分類:<input type="text" name="catename" placeholder="請(qǐng)輸入分類">
分類ID:<input type="text" name="cateid" placeholder="請(qǐng)輸入分類ID">
問題描述: <textarea name="introfck" placeholder="請(qǐng)?jiān)敿?xì)描述您的問題"></textarea>
稱呼:<input type="text" name="nickname" placeholder="請(qǐng)輸入稱呼">
手機(jī):<input type="text" name="mobile" placeholder="請(qǐng)輸入手機(jī)號(hào)碼">
<button class="send" data-url="/sendsmscode.html">獲取驗(yàn)證碼</button>
驗(yàn)證碼:<input type="text" name="code" placeholder="請(qǐng)輸入驗(yàn)證碼">
<input type="hidden" name="id" value="{{Pageinfo['_id']}}">
<input type="hidden" name="moduletype" value="{{globalviewdata['model']}}">
<input type="hidden" name="basetype" value="{{globalviewdata['basetype']}}" >
<div>
<label>完成驗(yàn)證:</label>
<div id="captcha">
<div id="text">
行為驗(yàn)證? 安全組件加載中
</div>
</div>
</div>
<input type="submit" value="提交">
</form>
<script src="http://static.westarcloud.com/test/5c048df6a8497e03aa0665a0/js/jquery1.11.3.min.js"></script>
<script src="https://www.geetest.com/demo/libs/gt.js"></script>
<script>
let handler = function (captchaObj) {
captchaObj.appendTo('#captcha');
captchaObj.onReady(function () {
$("#wait").hide();
});
$('.send').click(function (e) {
e.preventDefault();
let result = captchaObj.getValidate();
if (!result) {
return alert('請(qǐng)完成驗(yàn)證');
}
$.ajax({
url: '/sendsmscode.html',
type: 'POST',
dataType: 'json',
data: {
mobile: $('input[name="mobile"]').val(),
geetest_challenge: result.geetest_challenge,
geetest_validate: result.geetest_validate,
geetest_seccode: result.geetest_seccode
},
success: function (data) {
if (data.status === 'true') {
alert('發(fā)送短信成功');
} else if (data.status === 'false') {
alert('驗(yàn)證失敗');
captchaObj.reset();
}
}
});
});
// 更多接口說明請(qǐng)參見:http://docs.geetest.com/install/client/web-front/
window.gt = captchaObj;
};
$.ajax({
url: "/front/interface/geetest?t=" + (new Date()).getTime(), // 加隨機(jī)數(shù)防止緩存
type: "get",
dataType: "json",
success: function (data) {
$('#text').hide();
$('#wait').show();
// 調(diào)用 initGeetest 進(jìn)行初始化
// 參數(shù)1:配置參數(shù)
// 參數(shù)2:回調(diào),回調(diào)的第一個(gè)參數(shù)驗(yàn)證碼對(duì)象,之后可以使用它調(diào)用相應(yīng)的接口
initGeetest({
// 以下 4 個(gè)配置參數(shù)為必須,不能缺少
gt: data.gt,
challenge: data.challenge,
offline: !data.success, // 表示用戶后臺(tái)檢測極驗(yàn)服務(wù)器是否宕機(jī)
new_captcha: data.new_captcha, // 用于宕機(jī)時(shí)表示是新驗(yàn)證碼的宕機(jī)
product: "float", // 產(chǎn)品形式,包括:float,popup
width: "300px",
https: true
// 更多配置參數(shù)說明請(qǐng)參見:http://docs.geetest.com/install/client/web-front/
}, handler);
}
});
</script>
2.網(wǎng)站訪客回復(fù)訪客提問
訪客對(duì)網(wǎng)站的提問做出回復(fù)
?
使用示例:
<form action="/addfaq.html" method="post"> //提交地址
<input type="text" name="nickname" > //昵稱
<input type="text" name="mobile" > //手機(jī)
<input type="text" name="code" > //短信驗(yàn)證碼
<input type="text" name="content" > //內(nèi)容
<input type="hidden" name="id" value="{{Pageinfo['_id']}}">
<input type="hidden" name="moduletype" value="{{globalviewdata['model']}}">
<input type="hidden" name="basetype" value="{{globalviewdata['basetype']}}" >
使用舉例:
<form action="/addfaq.html" method="post">
<input type="text" name="nickname" >
<input type="text" name="mobile" class="mobile" > <button class="send" data-url="/sendsmscode.html">獲取驗(yàn)證碼</button>
<input type="text" name="code" >
<textarea name="content" ></textarea>
<input type="hidden" name="id" value="{{Pageinfo['_id']}}">
<input type="hidden" name="moduletype" value="{{globalviewdata['model']}}">
<input type="hidden" name="basetype" value="{{globalviewdata['basetype']}}" >
<div>
<label>完成驗(yàn)證:</label>
<div id="captcha">
<div id="text">
行為驗(yàn)證? 安全組件加載中
</div>
</div>
</div>
<input type="submit" value="submit">
</form>
<script src="http://static.westarcloud.com/test/5c048df6a8497e03aa0665a0/js/jquery1.11.3.min.js"></script>
<script src="https://www.geetest.com/demo/libs/gt.js"></script>
<script>
let handler = function (captchaObj) {
captchaObj.appendTo('#captcha');
captchaObj.onReady(function () {
$("#wait").hide();
});
$('.send').click(function (e) {
e.preventDefault();
let result = captchaObj.getValidate();
if (!result) {
return alert('請(qǐng)完成驗(yàn)證');
}
$.ajax({
url: '/sendsmscode.html',
type: 'POST',
dataType: 'json',
data: {
mobile: $('input[name="mobile"]').val(),
geetest_challenge: result.geetest_challenge,
geetest_validate: result.geetest_validate,
geetest_seccode: result.geetest_seccode
},
success: function (data) {
if (data.status === 'true') {
alert('發(fā)送短信成功');
} else if (data.status === 'false') {
alert('驗(yàn)證失敗');
captchaObj.reset();
}
}
});
});
// 更多接口說明請(qǐng)參見:http://docs.geetest.com/install/client/web-front/
window.gt = captchaObj;
};
$.ajax({
url: "/front/interface/geetest?t=" + (new Date()).getTime(), // 加隨機(jī)數(shù)防止緩存
type: "get",
dataType: "json",
success: function (data) {
$('#text').hide();
$('#wait').show();
// 調(diào)用 initGeetest 進(jìn)行初始化
// 參數(shù)1:配置參數(shù)
// 參數(shù)2:回調(diào),回調(diào)的第一個(gè)參數(shù)驗(yàn)證碼對(duì)象,之后可以使用它調(diào)用相應(yīng)的接口
initGeetest({
// 以下 4 個(gè)配置參數(shù)為必須,不能缺少
gt: data.gt,
challenge: data.challenge,
offline: !data.success, // 表示用戶后臺(tái)檢測極驗(yàn)服務(wù)器是否宕機(jī)
new_captcha: data.new_captcha, // 用于宕機(jī)時(shí)表示是新驗(yàn)證碼的宕機(jī)
product: "float", // 產(chǎn)品形式,包括:float,popup
width: "300px",
https: true
// 更多配置參數(shù)說明請(qǐng)參見:http://docs.geetest.com/install/client/web-front/
}, handler);
}
});
</script>
獲取回復(fù)數(shù)據(jù):
”#域名#/getfaqlist.html?id=#當(dāng)前內(nèi)容id#&page=1”
?
獲取最佳回復(fù):
{{System.getTakeAnswer('faq', Pageinfo['_id']) }}?