密碼訪問
更新時(shí)間:2020-05-26
1.密碼規(guī)則
支持全站密碼、模型密碼、模型詳情密碼
全站密碼:驗(yàn)證通過后,全站所有模型及詳情都不用再輸入;
模型密碼:驗(yàn)證通過后,模型下所有列表及詳情都不用再輸入密碼;
模型詳情密碼:僅控制單個(gè)模型詳情。
2.語法說明
2.1 判斷邏輯
Pageinfo['access']
0 公開
1 會(huì)員登錄
2 密碼
舉例
{% if Pageinfo['access'] > 0 %}
{% if Pageinfo['access'] == 1 %}
<!-- 會(huì)員身份驗(yàn)證彈窗 -->
{% elseif Pageinfo['access'] == 2 %}
<!-- 單個(gè)詳情的密碼表單 -->
單個(gè)詳情的密碼表單
<form action="/front/interface/vacnew/" method="get" >
<!-- 單個(gè)詳情的 -->
<input type="hidden" name="mold" value="3">
<!-- 哪個(gè)模型 -->
<input type="hidden" name="moduletype" value="news">
<!-- 模型id -->
<input type="hidden" name="infoid" value="{{Pageinfo['_id']}}">
<!-- 密碼 -->
密碼
<hr/>
<input type="text" name="code" id="code" value="">
<hr/>
<button id="form-submit" type="button" >提交</button>
</form>
<!-- 模型級(jí)別的密碼表單 -->
模型級(jí)別的密碼表單
<form action="/front/interface/vacnew/" method="get" >
<!-- 模型的 -->
<input type="hidden" name="mold" value="2">
<!-- 哪個(gè)模型 -->
<input type="hidden" name="moduletype" value="news">
<!-- 密碼 -->
密碼
<hr/>
<input type="text" name="code" id="code" value="">
<hr/>
<button id="form-submit2" type="button" >提交</button>
</form>
<!-- 整站級(jí)別的密碼表單 -->
整站級(jí)別的密碼表單
<form action="/front/interface/vacnew/" method="get" >
<!-- 整站的 -->
<input type="hidden" name="mold" value="1">
<!-- 密碼 -->
密碼
<hr/>
<input type="text" name="code" id="code" value="">
<hr/>
<button id="form-submit3" type="button" >提交</button>
</form>
{% endif %}
{% else %}
分類名稱:{{Pageinfo['catename']}}
{% endif %}
<script src="https://static.westarcloud.com/5e13f3b5a86d40002441ad64/js/jquery-1.12.2.min.js"></script>
<script>
//單個(gè)詳情的密碼表單
$('#form-submit').on(
'click', function() {
var $form = $(this).closest('form'),_url = $form.attr('action'),data=$form.serialize();
$.ajax( {
type : "GET",
url : _url,
dataType:"json",
cache:false,
async:false,
data : data,
success : function(res) {
if(res.status) {
window.location.reload();
} else{
alert('密碼錯(cuò)誤,詳情請(qǐng)聯(lián)系客服');
}
}
});
}
)
//模型級(jí)別的密碼表單
$('#form-submit2').on(
'click', function() {
var $form = $(this).closest('form'),_url = $form.attr('action'),data=$form.serialize();
$.ajax( {
type : "GET",
url : _url,
dataType:"json",
cache:false,
async:false,
data : data,
success : function(res) {
if(res.status) {
window.location.reload();
} else{
alert('密碼錯(cuò)誤,詳情請(qǐng)聯(lián)系客服');
}
}
});
}
)
//整站級(jí)別的密碼表單
$('#form-submit3').on(
'click', function() {
var $form = $(this).closest('form'),_url = $form.attr('action'),data=$form.serialize();
$.ajax( {
type : "GET",
url : _url,
dataType:"json",
cache:false,
async:false,
data : data,
success : function(res) {
if(res.status) {
window.location.reload();
} else{
alert('密碼錯(cuò)誤,詳情請(qǐng)聯(lián)系客服');
}
}
});
}
)
</script>