Commit 8d67920c by 杨树贤

添加隐藏逻辑

parent a53605fa
......@@ -154,27 +154,36 @@
});
$(document).on('click', '.viewAccount', function () {
let id = $(this).attr('id');
let type = $(this).attr('type');
let resp = ajax('/api/supplier_account/GetSupplierAccount', {id: id, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
if (resp.err_code === 0) {
switch (type) {
case 'mobile':
$(this).prev().text(resp.data.mobile);
break;
case 'password_raw':
$(this).prev().text(resp.data.password_raw);
break;
}
console.log(resp);
if ($(this).text() === '隐藏') {
$(this).prev().text($(this).attr('prev_text'));
$(this).text('查看');
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
let id = $(this).attr('id');
let type = $(this).attr('type');
let resp = ajax('/api/supplier_account/GetSupplierAccount', {id: id, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
let prevText = $(this).prev().text();
$(this).attr('prev_text', prevText);
if (resp.err_code === 0) {
switch (type) {
case 'mobile':
$(this).prev().text(resp.data.mobile);
break;
case 'password_raw':
$(this).prev().text(resp.data.password_raw);
break;
}
console.log(resp);
$(this).text('隐藏');
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
}
});
});
......
......@@ -150,33 +150,42 @@
}
$(document).on('click', '.viewContact', function () {
let contactId = $(this).attr('contact_id');
let type = $(this).attr('type');
let resp = ajax('/api/supplier_contact/GetSupplierContact', {contact_id: contactId, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
if (resp.err_code === 0) {
switch (type) {
case 'supplier_email':
$(this).prev().text(resp.data.supplier_email);
break;
case 'supplier_qq':
$(this).prev().text(resp.data.supplier_qq);
break;
case 'supplier_mobile':
$(this).prev().text(resp.data.supplier_mobile);
break;
case 'supplier_telephone':
$(this).prev().text(resp.data.supplier_telephone);
break;
}
console.log(resp);
if ($(this).text() === '隐藏') {
$(this).prev().text($(this).attr('prev_text'));
$(this).text('查看');
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
let contactId = $(this).attr('contact_id');
let type = $(this).attr('type');
let resp = ajax('/api/supplier_contact/GetSupplierContact', {contact_id: contactId, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
let prevText = $(this).prev().text();
$(this).attr('prev_text', prevText);
if (resp.err_code === 0) {
switch (type) {
case 'supplier_email':
$(this).prev().text(resp.data.supplier_email);
break;
case 'supplier_qq':
$(this).prev().text(resp.data.supplier_qq);
break;
case 'supplier_mobile':
$(this).prev().text(resp.data.supplier_mobile);
break;
case 'supplier_telephone':
$(this).prev().text(resp.data.supplier_telephone);
break;
}
$(this).text('隐藏');
console.log(resp);
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
}
});
});
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment