123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- var docSex = null,
- hospital = '';
- mui.init();
- mui.plusReady(function() {
- plus.nativeUI.showWaiting();
- initData();
- });
- mui.previewImage();
- function initData(){
- var params = {};
- sendPost("doctor/baseinfo", params, queryFailed, success);
- }
- function getCount(){
- var url = "doctor/baseinfoCount",
- params = {};
- sendPost(url, params, null, function(res){
- if(res.status == 200){
- var count = res.data.concernCount;
- $("#concernCount").text(count);
- }else{
- mui.toast(res.msg)
- }
- })
- }
- var exBreif, exSkill, exMobile,oldMobile;
- function success(req) {
- if(req.status == 200) {
- exBreif = req.data.introduce;
- exSkill = req.data.expertise;
- exMobile = req.data.mobile;
- hospital = req.data.hospital;
- docSex = req.data.sex;
- //编辑手机号和身份证号,隐藏信息 2016-11-23 raolu start
- oldMobile = req.data.mobile;
- var sMobile = req.data.mobile.length> 0 ? (req.data.mobile.substr(0,3)+"****"+req.data.mobile.substr(-4)) : "";
- req.data.sMobile = sMobile;
- var slen = req.data.idcard ? req.data.idcard.length : 0,
- idcard = req.data.idcard,
- sID = slen > 13 ? (idcard.substr(0,4) + new Array(slen-8).join("*") +idcard.substr(-4)) : "";
- req.data.sIdcard = sID;
- //2016-11-23 end
- var cont = template("detail_info_tmpl", req.data);
- $(".content").html(cont);
- initDocPhoto("docPic", req.data.photo, req.data.sex);//图片加载失败时使用默认图片
- clickEvent();
- //获取关注人数
- getCount();
- //获取我的文章
- getMyArticle();
- plus.nativeUI.closeWaiting();
- } else {
- mui.toast(req.msg);
- plus.nativeUI.closeWaiting();
- }
- };
- function queryFailed(res) {
- if(res && res.msg) {
- plus.nativeUI.toast(res.msg);
- } else {
- plus.nativeUI.toast("数据加载失败");
- }
- plus.nativeUI.closeWaiting();
- };
- function clickEvent() {
- document.getElementById('edit_photo').addEventListener('tap', function() {
- var imgDom = document.getElementById("docPic");
- var url1 = showActionSheet(imgDom, this);
- });
- /*
- * 修改擅长
- */
- $("#edit_expertise").click(function() {
- var oldCont = $(this).html();
- if(!oldCont){
- oldCont="";
- }
- gotoModify("skill", oldCont.trim());
- });
-
- /*
- * 修改简介
- */
- $("#edit_introduce").click(function() {
- var oldCont = $(this).html().trim();
- if(!oldCont){
- oldCont="";
- }
- gotoModify("brief", oldCont.trim());
- });
- /**
- * 身份证修改
- */
- $("#idcard").click(function() {
- var cardValue = $(this).html();
- if(!cardValue){
- cardValue="";
- }
- gotoModify("idcard", cardValue.trim());
- });
- /**
- * 修改性别
- */
- $("#sexli").click(function() {
- gotoModify("sex", docSex);
- });
-
- $("#mobile").click(function() {
- var val = $.trim($(this).text());
- openWebviewExtras("edit_mobilephone.html",{"mobile": val});
- });
-
- //跳转去文章列表页面
- $("#moreArticle").click(function(){
- openWebviewExtras("../../jkjy/html/myArticle.html",{});
- });
-
- $("#articlePanel").on('click', '.article-item', function(){
- var code = $(this).attr("data-id");
- openWebview("../../jkjy/html/articleDetail.html", {
- articleId: code,
- referrer: ''
- });
- })
- }
- /*
- * 保存
- */
- function submit() {
- var mobileReg = /^[1][3578][0-9]{9}$/;
- var intro = $("#doc_brief").val();
- var exper = $("#doc_skill").val();
- var mobile = $("#mobile").val();
-
- if(!mobileReg.test(mobile)){
- mui.toast("请填写正确的手机号码!");
- return;
- }
- mobileModify = exMobile != mobile;
- if(intro == exBreif && exper == exSkill && !mobileModify && !isModify) {
- mui.toast("暂无修改");
- return;
- }
- uploadSingleImg(exper, intro, mobile);
- }
- var firstLevelCategoryId;
- function getMyArticle(){
- sendPost("/third/jkEdu/Article/getCategoryByName",{name:'健康文章'}, null, function(res){
- if(res.status == 200){
- firstLevelCategoryId = res.data.cid;
- queryListData();
- }
- },'get')
- }
- function queryListData(){
- var params ={
- firstLevelCategoryId: firstLevelCategoryId,
- secondLevelCategoryId: '',
- isAuthentication: "1",//文章是否认证
- insertTimeStart: '',
- insertTimeEnd: '',
- currentUserRole: hospital,
- iDisplayStart: 0,
- iDisplayLength: 1,
- currentUserRoleLevel: 4,
- roleType:1,
- isMyArticle: true
- }
- sendPost("/doctor/jkEdu/article/queryArticleAPPList",params, null, function(res){
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- var html = template('articleimgLi', {list : res.data.aaData});
- $("#articlePanel").append(html);
- }else{
- mui.toast(res.msg);
- }
- },'get')
- }
- template.helper("setContent", function(str){
- var reg=/<[^<>]+>/g;
- str = str.replace(reg, '');
- return str;
- });
- template.helper("getArticleImage", function(str){
- if(str){
- if(str.indexOf("../") > -1){
- return ""; //原福州代码中返回的相对路径
- }
- var url = getImgUrl(str);
- return "<img src='"+url+"'>";
- }
- return "";
- });
- template.helper("formatDate", function(str){
- if(str){
- return str.substr(0,19)
- }else{
- return "";
- }
- });
- window.addEventListener('getDocInfo', function(e) {
- initData();
- });
|