app-xiangsonghua/app-saas-src/script/index/contactFrame.js
2024-12-26 17:00:06 +08:00

83 lines
1.8 KiB
JavaScript

var app = {
init: {},
bind: {},
getOcMsg: {}
}
app.init = function() {
app.bind();
app.getOcMsg();
}
app.bind = function() {
$("#phoneGroup").on("touchend", function() {
if (!app.lbPhone) {
return;
}
var lbPhone = $api.trim(app.lbPhone.toString());
api.call({
type: 'tel_prompt',
number: lbPhone
});
});
//下拉刷新
api.setRefreshHeaderInfo({
bgColor: "#CCCCCC",
textColor: "#FFFFFF"
}, function(ret, err) {
app.getOcMsg(function() {
api.refreshHeaderLoadDone();
});
});
}
/**
* 弹出提示框
*/
app.toast = function(msg) {
api.toast({
msg: msg,
duration: 3000,
locaiton: 'top'
});
}
app.getOcMsg = function(callback) {
var ocId = $api.getStorage("ocId");
var url = "/admin/rest/oc";
var args = {
ocId: ocId
};
$api.get(url, args, function(data, err) {
if (err) {
app.toast("网络请求失败");
} else {
if (!data.code || data.code != 200) {
toast("服务器响应错误" + (data.code ? (",错误码:" + data.code) : ""));
} else {
if (data.body) {
var lbPhone = $("#lbPhone");
var cusManagerName = $("#cusManagerName");
lbPhone.html(data.body.telephone);
cusManagerName.html((data.body.ocName ?data.body.ocName: ''));
app.lbPhone = data.body.telephone;
}
}
}
if (callback) {
callback();
}
});
}
apiready = function() {
app.init();
}