first
This commit is contained in:
120
modules/member/themes/_mobile/rc-default/profile/component.js
Normal file
120
modules/member/themes/_mobile/rc-default/profile/component.js
Normal file
@@ -0,0 +1,120 @@
|
||||
var sheet_member_profile = $('#sheet-member-profile');
|
||||
|
||||
sheet_member_profile.on('show.rc.sheet', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
var sheet = $(this);
|
||||
var nic = button.attr('data-nic');
|
||||
var mbruid = button.attr('data-mbruid');
|
||||
var avatar = button.attr('data-avatar');
|
||||
sheet.find('[data-role="avatar"]').attr('src',avatar);
|
||||
sheet.find('[data-toggle="follow"]').attr('data-mbruid',mbruid);
|
||||
setTimeout(function(){
|
||||
$.post(rooturl+'/?r='+raccount+'&m=member&a=get_profileDataSimple',{
|
||||
mbruid : mbruid
|
||||
},function(response){
|
||||
var result = $.parseJSON(response);
|
||||
var id=result.id;
|
||||
var nic=result.nic;
|
||||
var bio=result.bio;
|
||||
var num_follower=result.num_follower;
|
||||
var num_post=result.num_post;
|
||||
var num_list=result.num_list;
|
||||
var _avatar=result.avatar;
|
||||
var isFollowing=result.isFollowing;
|
||||
sheet.find('[data-role="bio"]').text(bio);
|
||||
sheet.find('[data-role="num_follower"]').text(num_follower);
|
||||
sheet.find('[data-role="num_post"]').text(num_post);
|
||||
sheet.find('[data-role="num_list"]').text(num_list);
|
||||
if (!avatar) sheet.find('[data-role="avatar"]').attr('src',_avatar);
|
||||
sheet.find('[data-toggle="profile"]').attr('data-url','/@'+id).attr('data-mbruid',mbruid).attr('data-nic',nic);
|
||||
|
||||
if (memberid==id) {
|
||||
sheet.find('[data-role="follower"]').addClass('d-none');
|
||||
sheet.find('[data-role="ismy"]').text('(나)');
|
||||
} else {
|
||||
sheet.find('[data-role="follower"]').removeClass('d-none');
|
||||
sheet.find('[data-role="ismy"]').text('');
|
||||
}
|
||||
|
||||
if (isFollowing) {
|
||||
sheet.find('[data-role="isfollowing"]').removeClass('d-none');
|
||||
sheet.find('[data-toggle="follow"]').addClass('d-none');
|
||||
} else {
|
||||
sheet.find('[data-role="isfollowing"]').addClass('d-none');
|
||||
sheet.find('[data-toggle="follow"]').removeClass('d-none');
|
||||
}
|
||||
|
||||
});
|
||||
}, 100);
|
||||
|
||||
})
|
||||
|
||||
sheet_member_profile.on('hidden.rc.sheet', function (event) {
|
||||
var sheet = $(this);
|
||||
sheet.find('[data-role="nic"]').text('');
|
||||
sheet.find('[data-role="avatar"]').removeAttr('src');
|
||||
sheet.find('[data-role="bio"]').text('');
|
||||
sheet.find('[data-toggle="profile"]').removeAttr('data-url').removeAttr('data-mbruid').removeAttr('data-nic');
|
||||
})
|
||||
|
||||
|
||||
$(document).on('click','[data-toggle="profile"]',function(){
|
||||
var button = $(this);
|
||||
var mbruid = button.attr('data-mbruid');
|
||||
var target = button.attr('data-target');
|
||||
var url = button.attr('data-url');
|
||||
var nic = button.attr('data-nic');
|
||||
var modal_id = 'modal-member-profile-'+mbruid;
|
||||
var modal = $('#'+modal_id);
|
||||
var zindex = button.attr('data-zindex');
|
||||
var delay = 10;
|
||||
|
||||
if (!modal.length) {
|
||||
var _modal = $(target).clone().appendTo('[data-role="profile-wapper"]');
|
||||
_modal.attr('id',modal_id);
|
||||
modal = _modal;
|
||||
}
|
||||
if (button.attr('data-change')){
|
||||
history.back();
|
||||
delay = 250;
|
||||
}
|
||||
|
||||
modal.css('z-index','');
|
||||
if (zindex) modal.css('z-index',zindex);
|
||||
|
||||
setTimeout(function(){
|
||||
modal.attr('data-mbruid',mbruid);
|
||||
modal.find('.bar-header-secondary .nav-inline').empty();
|
||||
modal.find('.bar').css('background-color','');
|
||||
modal.modal({
|
||||
title: nic,
|
||||
url : url
|
||||
});
|
||||
modal.find('.content').loader({ position: 'inside' });
|
||||
getPofileView(modal,mbruid)
|
||||
}, delay);
|
||||
});
|
||||
|
||||
$(document).on('click','[data-toggle="follow"]',function(){
|
||||
var button = $(this);
|
||||
var mbruid = button.attr('data-mbruid');
|
||||
var url = '/?r='+raccount+'&m=member&a=profile_follow&mbruid='+mbruid;
|
||||
if (memberid) {
|
||||
button.toggleClass('active');
|
||||
getIframeForAction('');
|
||||
frames.__iframe_for_action__.location.href = url;
|
||||
} else {
|
||||
var title = button.attr('data-title')
|
||||
var subtext = button.attr('data-subtext')
|
||||
popup_login_guide.find('[data-role="title"]').text(title);
|
||||
popup_login_guide.find('[data-role="subtext"]').text(subtext);
|
||||
popup_login_guide.popup('show');
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('shown.rc.modal', '[id*="modal-member-profile"]', function (event) {
|
||||
$('.modal.miniplayer').addClass('no-bartab');
|
||||
});
|
||||
$(document).on('hidden.rc.modal', '[id*="modal-member-profile"]', function (event) {
|
||||
$('.modal.miniplayer').removeClass('no-bartab');
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
<!--
|
||||
회원 모듈 프로필 포론트 컴포넌트 모음
|
||||
|
||||
1. 페이지 : 프로필 메인
|
||||
1. 모달 : 프로필 메인
|
||||
|
||||
-->
|
||||
|
||||
<div data-role="profile-wapper">
|
||||
|
||||
<div id="modal-member-profile" class="modal fast" data-mbruid="" data-role="profile">
|
||||
<header class="bar bar-nav px-0 border-bottom-0" data-snap-ignore="true">
|
||||
<a class="icon material-icons pull-left px-3" role="button" data-history="back">arrow_back</a>
|
||||
<a class="icon material-icons pull-right pl-2 pr-3" role="button" data-toggle="modal" data-target="#modal-search">search</a>
|
||||
<h1 class="title title-left" data-history="back">
|
||||
<span data-role="title"></span>
|
||||
</h1>
|
||||
</header>
|
||||
<div class="bar bar-header-secondary border-bottom-0 p-x-0 shadow-sm">
|
||||
<nav class="nav nav-inline" style="margin-top: 0.1875rem;"></nav>
|
||||
</div>
|
||||
<div class="content bg-white" data-control="scroll" data-type="updown" data-defaultHeight="180"></div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
</div>
|
||||
|
||||
<div id="sheet-member-profile" class="sheet shadow-sm">
|
||||
<div class="content-padded py-1">
|
||||
<div class="media" data-history="back">
|
||||
<span class="media-left media-middle">
|
||||
<img data-role="avatar" class="border rounded-circle" style="width:4.6875rem">
|
||||
</span>
|
||||
<div class="media-body">
|
||||
<h6 class="media-heading mb-2">
|
||||
<span data-role="nic"></span>
|
||||
<small class="ml-1 text-muted" data-role="ismy"></small>
|
||||
</h6>
|
||||
<p class="text-muted f12 mb-1 pr-2 line-clamp-3" data-role="bio" style="line-height: 1.35"></p>
|
||||
<div class="d-flex justify-content-between align-items-end">
|
||||
<div class="">
|
||||
<span class="badge badge-inverted">구독자 <span class="ml-1" data-role="num_follower"></span></span>
|
||||
<span class="badge badge-inverted">포스트 <span class="ml-1" data-role="num_post"></span></span>
|
||||
<span class="badge badge-inverted">리스트 <span class="ml-1" data-role="num_list"></span></span>
|
||||
</div>
|
||||
<div class="">
|
||||
|
||||
</div>
|
||||
</div><!-- /.d-flex -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="table-view mb-0">
|
||||
<li class="table-view-cell" data-role="follower">
|
||||
구독
|
||||
<span class="badge badge-pill d-none" data-role="isfollowing">구독중</span>
|
||||
<button type="button" class="btn btn-outline-primary d-none"
|
||||
data-title="채널을 구독하시겠습니까?"
|
||||
data-subtext="채널을 구독하려면 로그인하세요."
|
||||
data-toggle="follow"
|
||||
data-mbruid="">
|
||||
구독하기
|
||||
</button>
|
||||
</li>
|
||||
<li class="table-view-cell">
|
||||
<a class="navigate-right" data-toggle="profile" data-target="#modal-member-profile" data-change="true">
|
||||
채널 바로가기
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script src="/modules/member/themes/<?php echo $d['member']['theme_mobile']?>/profile/profile.js<?php echo $g['wcache']?>" ></script>
|
||||
<script src="/modules/member/themes/<?php echo $d['member']['theme_mobile']?>/profile/component.js<?php echo $g['wcache']?>" ></script>
|
||||
25
modules/member/themes/_mobile/rc-default/profile/main.php
Normal file
25
modules/member/themes/_mobile/rc-default/profile/main.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<div data-role="loader">
|
||||
<div class="d-flex justify-content-center align-items-center text-muted" style="height:90vh">
|
||||
<div class="spinner-border" role="status"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-center align-items-center text-muted" style="height:80vh">
|
||||
<button class="btn btn-secondary btn-block"
|
||||
data-toggle="profile"
|
||||
data-target="#modal-member-profile"
|
||||
data-mbruid="<?php echo $_MP['uid'] ?>"
|
||||
data-title="<?php echo $mbrid ?>"
|
||||
data-url="/@<?php echo $mbrid ?>">
|
||||
프로필 열기
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$( document ).ready(function() {
|
||||
$('[data-role="loader"]').addClass('d-none');
|
||||
$('[data-toggle="profile"]').click();
|
||||
});
|
||||
|
||||
</script>
|
||||
250
modules/member/themes/_mobile/rc-default/profile/profile.js
Normal file
250
modules/member/themes/_mobile/rc-default/profile/profile.js
Normal file
@@ -0,0 +1,250 @@
|
||||
// RGB 코드 헥사코드 변환
|
||||
function RGBToHex(rgb) {
|
||||
let sep = rgb.indexOf(",") > -1 ? "," : " ";
|
||||
rgb = rgb.substr(4).split(")")[0].split(sep);
|
||||
let r = (+rgb[0]).toString(16),
|
||||
g = (+rgb[1]).toString(16),
|
||||
b = (+rgb[2]).toString(16);
|
||||
if (r.length == 1)
|
||||
r = "0" + r;
|
||||
if (g.length == 1)
|
||||
g = "0" + g;
|
||||
if (b.length == 1)
|
||||
b = "0" + b;
|
||||
return "#" + r + g + b;
|
||||
}
|
||||
|
||||
// 배경밝기에 따라 반전된 폰트 칼라 적용
|
||||
function convertColor(hex) {
|
||||
hex = hex.replace('#', '');
|
||||
r = parseInt(hex.substring(0, 2), 16);
|
||||
g = parseInt(hex.substring(2, 4), 16);
|
||||
b = parseInt(hex.substring(4, 6), 16);
|
||||
var o = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
|
||||
if (o > 125) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getPofileView(modal,mbruid) {
|
||||
$.post(rooturl+'/?r='+raccount+'&m=member&a=get_profileData',{
|
||||
mbruid : mbruid,
|
||||
type : 'modal'
|
||||
},function(response){
|
||||
var result = $.parseJSON(response);
|
||||
var profile=result.profile;
|
||||
var nic=result.nic;
|
||||
modal.find('[data-role="title"]').text(nic);
|
||||
modal.find('.content').html(profile);
|
||||
|
||||
modal.find('[data-role="cover"]').load(function(){
|
||||
var colorThief = new ColorThief();
|
||||
var coverImage = modal.find('[data-role="cover"]')[0];
|
||||
var cover_rgb = colorThief.getColor(coverImage);
|
||||
modal.find('.bar').css('background-color', 'rgb(' + cover_rgb + ')');
|
||||
var _cover_rgb = modal.find('.bar').css('background-color');
|
||||
var cover_hex = RGBToHex(_cover_rgb)
|
||||
|
||||
if (convertColor(cover_hex)) {
|
||||
modal.find('.bar').removeClass('bar-dark').addClass('bar-light');
|
||||
} else {
|
||||
modal.find('.bar').removeClass('bar-light').addClass('bar-dark');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
modal.find('.content [data-plugin="timeago"]').timeago();
|
||||
var nav_control = modal.find('.profile-nav-control')
|
||||
var swiper_member_profile = new Swiper('#modal-member-profile-'+mbruid+' .swiper-container', {
|
||||
autoHeight: true,
|
||||
pagination: {
|
||||
el: '#modal-member-profile-'+mbruid+' .bar-header-secondary .nav-inline',
|
||||
clickable: true,
|
||||
autoHeight: true,
|
||||
effect : 'fade',
|
||||
spaceBetween: 30,
|
||||
slideActiveClass :'active',
|
||||
bulletClass : 'nav-link',
|
||||
bulletActiveClass : 'active' ,
|
||||
autoHeight : true,
|
||||
renderBullet: function (index, className) {
|
||||
var title;
|
||||
if (index === 0) title = '홈';
|
||||
if (index === 1) title = '동영상'
|
||||
if (index === 2) title = '재생목록'
|
||||
if (index === 3) title = '커뮤니티'
|
||||
if (index === 4) title = '채널'
|
||||
if (index === 5) title = '정보'
|
||||
return '<a class="' + className + '">'+title+'</a>';
|
||||
},
|
||||
},
|
||||
on: {
|
||||
init: function () {
|
||||
console.log('swiper 초기화');
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
swiper_member_profile.on('slideChange', function () {
|
||||
var index = swiper_member_profile.activeIndex
|
||||
nav_control.find('.nav-link').removeClass('active')
|
||||
nav_control.find('[data-index="'+index+'"]').addClass('active')
|
||||
setTimeout(function(){
|
||||
modal.find('.content').animate({scrollTop:0}, '400');
|
||||
}, 600);
|
||||
|
||||
var currentPage =1; // 처음엔 무조건 1, 아래 더보기 진행되면서 +1 증가
|
||||
var recnum = 10;
|
||||
|
||||
//무한 스크롤 환경 초기화
|
||||
modal.find('.infinitescroll-end').remove();
|
||||
modal.find('.content .content-padded [data-role="list"]').empty();
|
||||
// var content_markup = modal.find('.content').clone().wrapAll("<div/>").parent().html();
|
||||
// modal.find('.content').infinitescroll('destroy');
|
||||
// modal.append(content_markup);
|
||||
|
||||
if (index==0) { // 프로필 홈
|
||||
|
||||
}
|
||||
|
||||
if (index==1) { // 동영상
|
||||
modal.find('[data-role="postList"] [data-role="list"]').loader({ position: 'inside' });
|
||||
$.post(rooturl+'/?r='+raccount+'&m=member&a=get_profilePost',{
|
||||
mbruid : mbruid,
|
||||
format : 2, //video
|
||||
type : 'modal',
|
||||
recnum : recnum
|
||||
},function(response){
|
||||
var result = $.parseJSON(response);
|
||||
var postlist=result.list;
|
||||
var postnum=result.num;
|
||||
var totalPage=result.tpg;
|
||||
modal.find('[data-role="postList"] [data-role="list"]').html(postlist);
|
||||
|
||||
if (postnum) {
|
||||
modal.find('[data-role="postList"] .btn').show();
|
||||
|
||||
if (postnum>recnum) {
|
||||
//무한 스크롤
|
||||
modal.find('.content').infinitescroll({
|
||||
dataSource: function(helpers, callback){
|
||||
var nextPage = parseInt(currentPage)+1;
|
||||
if (totalPage>currentPage) {
|
||||
$.post(rooturl+'/?r='+raccount+'&m=member&a=get_profilePost',{
|
||||
mbruid : mbruid,
|
||||
format : 2, //video
|
||||
type : 'modal',
|
||||
recnum : recnum,
|
||||
p : nextPage
|
||||
},function(response) {
|
||||
var result = $.parseJSON(response);
|
||||
var error = result.error;
|
||||
var list=result.list;
|
||||
if(error) alert(result.error);
|
||||
callback({ content: list });
|
||||
|
||||
currentPage++; // 현재 페이지 +1
|
||||
console.log(currentPage+'페이지 불러옴')
|
||||
wrapper.find('[data-plugin="timeago"]').timeago();
|
||||
//wrapper.find('[data-plugin="markjs"]').mark(keyword); // marks.js
|
||||
swiper_member_profile.updateAutoHeight(100);
|
||||
});
|
||||
} else {
|
||||
callback({ end: true });
|
||||
console.log('더이상 불러올 페이지가 없습니다.')
|
||||
}
|
||||
},
|
||||
appendToEle : modal.find('[data-role="postList"] .content-padded'),
|
||||
percentage : 85, // 95% 아래로 스크롤할때 다움페이지 호출
|
||||
hybrid : false // true: 버튼형, false: 자동
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
modal.find('[data-role="postList"] .btn').hide();
|
||||
}
|
||||
|
||||
swiper_member_profile.updateAutoHeight(100);
|
||||
modal.find('[data-role="postList"] [data-role="list"] [data-plugin="timeago"]').timeago();
|
||||
});
|
||||
}
|
||||
|
||||
if (index==2) { // 리스트
|
||||
modal.find('[data-role="listList"] [data-role="list"]').loader({ position: 'inside' });
|
||||
$.post(rooturl+'/?r='+raccount+'&m=member&a=get_profileList',{
|
||||
mbruid : mbruid,
|
||||
type : 'modal'
|
||||
},function(response){
|
||||
var result = $.parseJSON(response);
|
||||
var listlist=result.list;
|
||||
var listnum=result.num;
|
||||
modal.find('[data-role="listList"] [data-role="list"]').html(listlist);
|
||||
if (listnum) modal.find('[data-role="listList"] .btn').show();
|
||||
else modal.find('[data-role="listList"] .btn').hide();
|
||||
swiper_member_profile.updateAutoHeight(100);
|
||||
modal.find('[data-role="listList"] [data-role="list"] [data-plugin="timeago"]').timeago();
|
||||
});
|
||||
}
|
||||
|
||||
if (index==3) { // 커뮤니티
|
||||
modal.find('[data-role="commList"] [data-role="list"]').loader({ position: 'inside' });
|
||||
$.post(rooturl+'/?r='+raccount+'&m=member&a=get_profileComm',{
|
||||
mbruid : mbruid,
|
||||
type : 'modal'
|
||||
},function(response){
|
||||
var result = $.parseJSON(response);
|
||||
var commlist=result.list;
|
||||
var commnum=result.num;
|
||||
modal.find('[data-role="commList"] [data-role="list"]').html(commlist);
|
||||
swiper_member_profile.updateAutoHeight(100);
|
||||
modal.find('[data-role="commList"] [data-role="list"] [data-plugin="timeago"]').timeago();
|
||||
});
|
||||
}
|
||||
|
||||
if (index==4) { // 채널
|
||||
modal.find('[data-role="followList"] [data-role="list"]').loader({ position: 'inside' });
|
||||
$.post(rooturl+'/?r='+raccount+'&m=member&a=get_profileFollow',{
|
||||
mbruid : mbruid,
|
||||
type : 'modal'
|
||||
},function(response){
|
||||
var result = $.parseJSON(response);
|
||||
var followlist=result.list;
|
||||
var follownum=result.num;
|
||||
modal.find('[data-role="followList"] [data-role="list"]').html(followlist);
|
||||
swiper_member_profile.updateAutoHeight(100);
|
||||
modal.find('[data-role="followList"] [data-role="list"] [data-plugin="timeago"]').timeago();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
nav_control.find('.nav-link').click(function(){
|
||||
var index = $(this).data('index')
|
||||
swiper_member_profile.slideTo(index);
|
||||
});
|
||||
});
|
||||
|
||||
// edgeEffect
|
||||
var wrapper_startY = 0;
|
||||
modal.find('.content').on('touchstart',function(event){
|
||||
wrapper_startY = event.originalEvent.changedTouches[0].pageY;
|
||||
});
|
||||
modal.find('.content').on('touchmove',function(event){
|
||||
var wrapper_moveY = event.originalEvent.changedTouches[0].pageY;
|
||||
var wrapper_contentY = $(this).scrollTop();
|
||||
if (wrapper_contentY === 0 && wrapper_moveY > wrapper_startY) {
|
||||
if (wrapper_moveY-wrapper_startY>80) {
|
||||
edgeEffect(modal,'top','show');
|
||||
}
|
||||
}
|
||||
if( (wrapper_moveY < wrapper_startY) && ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight)) {
|
||||
if (wrapper_startY-wrapper_moveY>80) {
|
||||
edgeEffect(modal,'bottom','show');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} // getPofileView
|
||||
Reference in New Issue
Block a user