文件

75 行
2.0 KiB
HTML
可执行文件

<!--[1.5.22]-->
<style>
.template {
width: 100%;
box-sizing: border-box;
padding: 0 15px;
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.template-con {
width: 40%;
min-width: 100px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.template-con > img {
width: 100%;
margin-bottom: 20px;
}
.Choice > label {
cursor: pointer;
}
</style>
<div>
<div class="template" style="display: flex">
<volist name="templateinfo" id="vo">
<div class="template-con">
<img class="template-style" src="{$vo['img']}" alt="">
<div class="Choice">
<label class="label">
<input id="icon" type="radio" name="na" value="{$vo['id']}"
<if condition="$templateid eq $vo['id']">checked</if>
>
<label for="icon">
</label>
<span>{$vo['name']}</span>
</label>
</div>
</div>
</volist>
</div>
</div>
<script>
layui.use(['form', 'table', 'layer'], function () {
var layer = layui.layer;
$(":radio").click(function () {
var id = $('input[name="na"]:checked').val()
console.log(id)
$.ajax({
url: "{:U('choicetemplate')}",
type: "post",
data: {templateid: id},
success: function (res) {
if (res.status == 1) {
layer.msg(res.msg, {time: 1500}, function () {
})
} else {
layer.msg(res.msg, {time: 1500}, function () {
})
}
}
})
});
})
</script>