|
require(["ipuUI", "jquery"], function (ipuUI, $) {
$.sizeReady(function () {
// 1.问题反馈 APP
var appPicker = ipuUI.popPicker({
layer: 1
});
var data = [{ // 选择的 APP 数据
text: '百度',
value: ""
},
{
text: '支付宝',
value: 'alipay'
},
{
text: '微信',
value: "weixin"
}
];
// 设置选择 APP
appPicker.setData(data);
appPicker.setSelectedValue(['baidu']);
$("input[name='app']").click(function () {
var self = $(this);
appPicker.show(function (data) {
console.log($(this), data.text);
self.val(data.text);
});
});
// 2.问题反馈类型
$(".feedback-card-type-item").click(function () { // 选择类型改变样式
$(this).addClass("active").siblings(".active").removeClass("active");
});
// 字数统计
var txt = document.querySelector(".feedback-card-issue textarea");
var txtNum = document.querySelector(".feedback-card-stat span");
txt.addEventListener("keyup", function () {
txtNum.textContent = txt.value.length;
});
// 上传图片
$(".feedback-card-camera").click(function () {
// 测试显示、删除图片
var imgUrl = [
"temp/01首页.png",
"temp/02菜单.png",
"temp/03我的.png"
];
var imgNum = Math.floor((Math.random() * imgUrl.length));
// 测试显示、删除图片
if (imgUrl.length) {
var elStr = '<div class="feedback-card-photo">' +
'<img src=' + imgUrl[imgNum] + '>' +
'<div class="feedback-card-close"></div>'
'</div>';
$(".feedback-card-photos").append(elStr);
}
// 删除图片
$(".feedback-card-close").click(function () {
$(this).context.parentNode.remove();
});
});
// 提交意见反馈,回到意见反馈首页
$(".feedback-commit").click(function () {
location.href = "feedback.html";
});
});
});
|