define(
function(require,exports,module){
var $ = require(
'zepto'),
helper = require(
'helper'),
tips = require(
'tips'),
loadding = require(
'loadding'),
eventHelper = require(
'eventHelper'),
// IScroll = require('iscroll'),
route = require(
'route'),
_token =
helper.
getUrlParams(
'token'),
_user_api_id =
helper.
getUrlParams(
'user_api_id'),
_channel_type_number =
helper.
getUrlParams(
'channel_type_number'),
_type =
helper.
getUrlParams(
'type');
route.
setDefaultTitle(
'服务详情');
var workerDModule =
function(options){
var options = options || {};
return this.
init(
options);
}
workerDModule.
prototype = {
jumpType:
1,
init:
function(options){
this.
renderCss();
this.
payType =
1;
this.
$target =
$(options.
target ||
'body');
this.
$container =
this.
_renderHtml();
this.
renderToTarget();
return this;
},
renderToTarget:
function(){
this.
_renderServerData();
this.
$target.
append(
this.
$container);
this.
_bindEvent();
},
renderCss:
function(){
if(
$(
'link[href*="workerD.css"]').
length <=
0){
$(
'head').
append(
'<link href="/static/wx/css/workerD.css?v='+
helper.
getTimeStamp()+
'" type="text/css" rel="stylesheet">')
}
if(
$(
'link[href*="personalApply.css"]').
length <=
0){
$(
'head').
append(
'<link href="/static/wx/css/personalApply.css?v='+
helper.
getTimeStamp()+
'" type="text/css" rel="stylesheet">')
}
},
_renderServerData:
function(){
var _self =
this;
$.
ajax({
url:
'/ajax_getWorkerD.html',
data:{
token:
_token,
channel_type_number:
_channel_type_number,
user_api_id:
_user_api_id},
dataType:
'json',
type:
'post',
success:
function(res){
if(res.
status ==
0){
_self.
_renderData(res.
data);
console.
log(res.
data);
}
else{
//TODO 错误处理
}
},
error:
function(){
//TODO 错误处理
}
})
},
_renderData:
function(data){
var data = data,
$container =
this.
$container;
if(
data){
$container.
find(
'.header_img_url')[
0].
src=
data.head_url;
var sex_name=
data.
sex==
1?
'男':
'女';
var text1=
data.
real_name+
" "+
sex_name+
" "+
data.
age+
'岁';
$container.
find(
'.text1').
html(
text1);
var text2=
data.worker_type_name+
" "+
" "+
data.
worker_experience+
'年';
$container.
find(
'.text2').
html(
text2);
var text3=
data.worker_address;
$container.
find(
'.text3').
html(
text3);
$container.
find(
'#iphone').
val(
data.
contact_mobile);
$container.
find(
'.introduction').
html(
data.
introduction);
$container.
find(
'.certificate_pic1')[
0].
src=
data.certificate_pic1_url;
$container.
find(
'.certificate_pic2')[
0].
src=
data.certificate_pic2_url;
}
},
_renderHtml:
function(){
var $container =
$(
'<div></div>');
$titleHead =
$(
'<div class="div-a"></div>').
appendTo(
$container),
$titleContent =
$(
'<div class="div-b"></div>').
appendTo(
$container),
$dz =
$(
'<div class="wenzi"></div>').
appendTo(
$container),
$inputContent_1 =
$(
'<div class="personal_inputs"></div>').
appendTo(
$container),
$dz1 =
$(
'<div class="wenzi"></div>').
appendTo(
$container),
$uploadLine =
$(
'<div class="personal_upload"></div>').
appendTo(
$container),
$titleHead.
append(
'<img class="header_img_url" src="/static/images/default_2.png">');
$titleContent.
append(
'<p class="p-text text1"> </p><p class="p-text text2"> </p><p class="p-text text3"> </p>');
$titleContent.
append(
'<div class="submitLine"><span>我要预约TA</span></div><input type="hidden" value="" id="iphone">');
$dz.
append(
'<p><span style="font-size: 16px;color: #6A6A6A;"><span style="color: #28A7E1;"><strong>|</strong></span>个人简介</span><br></p>');
$inputContent_1.
append(
'<textarea readonly="readonly" class="textarea-text introduction"></textarea>');
$dz1.
append(
'<p><span style="font-size: 16px;color: #6A6A6A;"><span style="color: #28A7E1;"><strong>|</strong></span>证书</span><br></p>');
$uploadLine.
append(
'<div class="positive"><div><img class="certificate_pic1" src="/static/images/default_1.png"/></div></div>');
$uploadLine.
append(
'<div class="opposite"><div><img class="certificate_pic2" src="/static/images/default_1.png"/></div></div></p>');
$container.
find(
'.personal_upload > div > div').
css({
height:
$(
window).
height() /
1008 *
170,
width:
$(
window).
width() /
640 *
280
})
$container.
find(
'.header_img_line > div').
css({
height:
$(
window).
height() /
1008 *
146,
width:
$(
window).
width() /
640 *
147
})
$container.
find(
'.introduction').
css({
height:
$(
window).
height() /
1008 *
260
})
return $container;
},
_bindEvent:
function(){
this.
$container.
find(
'.submitLine span').
on(
'tap',
this.
_submitHandler.
bind(
this));
},
_submitHandler:
function (e){
var iphone=
this.
$container.
find(
'#iphone').
val();
if(
typeof(
iphone) ==
"undefined" ||
iphone==
''){
alert(
'对方没有留手机号');
return false;
}
window.
location.
href =
'tel://'+
iphone;
// $("#xgfPhone").text(xgfPhone);
}
};
return workerDModule
})
转载请注明原文地址: https://ju.6miu.com/read-50359.html