Merge pull request #12 from Anankke/dev

Merge
no_ymq_dev
GeekQu 8 years ago committed by GitHub
commit 75f72c8f9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -887,6 +887,7 @@ class UserController extends BaseController
$user->invite_num += $num;
$user->money -= $amount;
$user->save();
$res['invite_num'] = $user->invite_num;
$res['ret'] = 1;
$res['msg'] = "邀请次数添加成功";
return $response->getBody()->write(json_encode($res));

@ -162,6 +162,7 @@ class VueController extends BaseController {
"paybacks" => $paybacks,
"paybacks_sum" => $paybacks_sum,
"invitePrice" => Config::get('invite_price'),
"customPrice" => Config::get('custom_invite_price'),
);
$res['ret'] = 1;
@ -208,4 +209,23 @@ class VueController extends BaseController {
return $response->getBody()->write(json_encode($res));
}
public function getNewInviteCode($request, $response, $args)
{
$user = $this->user;
$user->clear_inviteCodes();
$code = InviteCode::where('user_id', $this->user->id)->first();
if ($code == null) {
$this->user->addInviteCode();
$code = InviteCode::where('user_id', $this->user->id)->first();
}
$res['arr'] = array(
"code" => $code,
);
$res['ret'] = 1;
return $response->getBody()->write(json_encode($res));
}
}

@ -377,6 +377,7 @@ $app->get('/getuserinviteinfo', 'App\Controllers\VueController:getUserInviteInfo
$app->get('/getusershops', 'App\Controllers\VueController:getUserShops');
$app->get('/getcredit', 'App\Controllers\VueController:getCredit');
$app->get('/getnewsubtoken', 'App\Controllers\VueController:getNewSubToken');
$app->get('/getnewinvotecode', 'App\Controllers\VueController:getNewInviteCode');
/**
* chenPay

@ -53,6 +53,10 @@ a {
text-align: right;
}
.text-red {
color: #D1335B;
}
.margin-nobottom {
margin-bottom: 0 !important;
}
@ -230,7 +234,8 @@ button.btn-user.index-btn-active {
input.checkbox,
.buy-submit,
.font-light,
.list-shop {
.list-shop,
.user-config {
transition: all .3s;
}
@ -280,15 +285,18 @@ input.checkbox,
}
.auth-submit:hover,
.auth-submit:focus, {
.auth-submit:focus,
{
background-color: #d6d6d6;
border-color: #d6d6d6;
}
.buy-submit:disabled {
.buy-submit:disabled,
button.tips:disabled {
color: #858585;
border-color: #858585;
cursor: not-allowed;
background-color: transparent;
}
.auth,
@ -534,6 +542,11 @@ select {
border-color: #faad14;
}
.tips-gold-trans.tips-gold {
color: white;
background-color: #faad14;
}
.tips-green {
color: #52c41a;
border-color: #52c41a;
@ -549,6 +562,14 @@ select {
border-color: #D1335B;
}
.font-red-trans {
color: #D1335B;
}
button.tips {
background-color: transparent;
}
.tips-blue:hover,
.tips-gold:hover,
.tips-green:hover,
@ -629,6 +650,38 @@ select {
font-size: 14px;
}
.invite-tools {
position: relative;
margin-left: .75rem;
}
.invite-tools .tips.tips-red {
position: relative;
top: 1px;
}
.invite-tools.tips-green {
padding: 3.5px .7rem;
bottom: 1px;
margin-left: .55rem;
}
.invite-link {
width: 100%;
}
.user-invite-title .uim-tooltip {
width: 100%;
}
.user-invite-title .uim-tooltip button {
border: 0;
}
.user-invite-title .tips {
position: relative;
}
.list-shop {
padding: .5rem;
font-size: 1.2rem;
@ -641,7 +694,7 @@ select {
}
.list-shop:hover {
transform: translate3D(1rem,0,0);
transform: translate3D(1rem, 0, 0);
}
.coupon-checker {
@ -704,7 +757,8 @@ button[name=reset] {
word-break: break-all;
}
.sublink-reset.tips-blue {
.sublink-reset.tips-blue,
.invite-reset.tips-blue {
background-color: #1997c6;
color: white;
}
@ -781,6 +835,15 @@ button[name=reset] {
.link-reset .uim-tooltip-top {
width: 230px;
}
.invite-link {
width: 450px;
}
.user-invite-title .tips {
margin-bottom: .5rem;
margin-left: .75rem;
}
}
@media screen and (min-width:48em) {
@ -1067,7 +1130,7 @@ button.uim-modal-confirm {
/* switch */
.uim-switch-body {
.uim-switch-body {
background-color: #ccc;
border-radius: 25px;
cursor: pointer;

@ -224,7 +224,10 @@ const UserTmp = {
},
SET_USERMONEY (state,number) {
state.userCon.money = number;
}
},
SET_INVITE_NUM (state,number) {
state.userCon.invite_num = number;
},
},
actions: {
@ -1078,12 +1081,69 @@ const UserInvite = {
mixins: [userMixin,storeMap],
template: /*html*/ `
<div>
<div class="card-title">邀请链接</div>
<div class="user-invite-title flex align-center">
<div class="card-title">邀请链接</div>
<div class="relative flex align-center justify-center text-center">
<transition name="fade" mode="out-in">
<label v-show="showToolInput" class="relative" for="">
<input @keyup.13="submitToolInput" v-model="toolInputContent" :data-type="toolInputType" class="coupon-checker tips tips-blue" type="text" :placeholder="placeholder">
<button @click="submitToolInput" class="btn-forinput" name="check"><span class="fa fa-arrow-up"></span></button>
<button @click="hideToolInput" class="btn-forinput" name="reset"><span class="fa fa-refresh"></span></button>
</label>
</transition>
<transition name="fade" mode="out-in">
<uim-tooltip v-show="showOrderCheck" class="uim-tooltip-top flex justify-center">
<div slot="tooltip-inner">
<span v-if="toolInputType === 'buy'"><div>确认购买 <span class="text-red">$[toolInputContent]$</span> 个吗?总价为 <span class="text-red">¥$[totalPrice]$</span></div></span>
<span v-if="toolInputType === 'custom'">确认定制链接后缀为 <span class="text-red">$[toolInputContent]$</span> 吗?价格为 <span class="text-red">¥$[customPrice]$</span></span>
<div>
<button @click="submitOrder" class="tips tips-green"><span class="fa fa-fw fa-check"></span></button>
<button @click="hideOrderCheck" class="tips tips-red"><span class="fa fa-fw fa-remove"></span></button>
</div>
</div>
</uim-tooltip>
</transition>
</div>
<transition name="fade" mode="out-in">
<div v-show="showToolInput">
<div class="flex align-center" v-if="toolInputType === 'buy'" key="buy">
<span v-show="toolInputType === 'buy'" class="tips tips-green">¥$[invitePrice]$/次</span>
<span v-show="toolInputType === 'buy'" class="tips tips-gold">总价:¥$[totalPrice]$</span>
</div>
<div class="flex align-center" v-else key="custom">
<span v-show="toolInputType === 'custom'" class="tips tips-green">价格:¥$[customPrice]$</span>
</div>
</div>
</transition>
</div>
<div class="card-body">
<div class="user-invite">
<div v-if="userCon.class !== 0">
<input type="button" class="tips tips-blue" :value="inviteLink">
<h5>邀请链接剩余次数: <span class="invite-number tips tips-gold">$[userCon.invite_num]$次</span></h5>
<div class="flex align-center wrap">
<input type="input" :class="{ 'invite-reset':inviteLinkTrans }" class="invite-link tips tips-blue" :value="inviteLink" disabled>
<span class="invite-tools link-reset relative flex justify-center text-center">
<button @click="showInviteReset" class="tips tips-red"><span class="fa fa-refresh"> 重置</button>
<transition name="fade" mode="out-in">
<uim-tooltip v-show="inviteResetConfirm" class="uim-tooltip-top flex justify-center">
<div slot="tooltip-inner">
<span>确定要重置邀请链接?</span>
<div>
<button @click="resetInviteLink" class="tips tips-green"><span class="fa fa-fw fa-check"></span></button>
<button @click="hideInviteReset" class="tips tips-red"><span class="fa fa-fw fa-remove"></span></button>
</div>
</div>
</uim-tooltip>
</transition>
</span>
<span v-if="customPrice >= 0" class="invite-tools relative flex justify-center text-center">
<button @click="showCustomToolInput" :disabled="isToolDisabled" class="tips tips-cyan"><span class="fa fa-pencil"> 定制</button>
</span>
</div>
<h5>邀请链接剩余次数: <span :class="{ 'tips-gold-trans':inviteTimeTrans }" class="invite-number tips tips-gold">$[userCon.invite_num]$次</span>
<span v-if="invitePrice >= 0">
<button @click="showBuyToolInput" :disabled="isToolDisabled" class="invite-tools invite-number tips tips-green"><span class="fa fa-cny"></span> 购买</button>
</span>
</h5>
</div>
<div v-else>
<h3>$[userCon.user_name]$,您不是VIP暂时无法使用邀请链接,<slot name='inviteToShop'></slot></h3>
@ -1095,17 +1155,207 @@ const UserInvite = {
computed: {
inviteLink: function() {
return this.baseURL + '/#/auth/register?code=' + this.code;
}
},
totalPriceCa: function() {
return parseInt(this.toolInputContent)*parseInt(this.invitePrice);
},
totalPrice: function() {
return isNaN(this.totalPriceCa) ? '' : this.totalPriceCa;
},
},
data: function() {
return {
oldCode: '',
code: '',
invitePrice: '',
customPrice: '',
toolInputContent: '',
placeholder: '',
toolInputType: '',
orderCheckContent: '',
inviteResetConfirm: false,
inviteLinkTrans: false,
inviteTimeTrans: false,
showToolInput: false,
isToolDisabled: false,
showOrderCheck: false,
theUnWatch: '',
}
},
methods: {
destoryWatch() {
if (this.theUnWatch !== '') {
this.theUnWatch();
}
},
showInviteReset() {
this.inviteResetConfirm = true;
},
hideInviteReset() {
this.inviteResetConfirm = false;
},
showLinkTrans() {
this.inviteLinkTrans = true;
setTimeout(() => {
this.inviteLinkTrans = false;
}, 300);
},
showInviteTimeTrans() {
this.inviteTimeTrans = true;
setTimeout(() => {
this.inviteTimeTrans = false;
}, 300);
},
resetInviteLink() {
_get('/getnewinvotecode','include').then((r)=>{
console.log(r);
this.code = r.arr.code.code;
this.hideInviteReset();
this.showLinkTrans();
let callConfig = {
msg: '已重置您的邀请链接,复制您的邀请链接发送给其他人!',
icon: 'fa-bell',
time: 1500,
}
tmp.dispatch('CALL_MSGR',callConfig);
});
},
hideToolInput() {
this.showToolInput = false;
this.isToolDisabled = false;
this.hideOrderCheck();
this.destoryWatch();
setTimeout(() => {
this.toolInputContent = '';
}, 300);
},
submitToolInput() {
switch(this.toolInputType) {
case 'buy':
this.buyOrdercheck();
break;
case 'custom':
this.customOrderCheck();
break;
}
},
showBuyToolInput() {
this.showToolInput = true;
this.isToolDisabled = true;
this.placeholder = '输入购买数量';
this.toolInputType = 'buy';
},
showCustomToolInput() {
this.showToolInput = true;
this.isToolDisabled = true;
this.placeholder = '输入链接后缀';
this.toolInputType = 'custom';
let unwatchCustom = this.$watch('toolInputContent',function(newVal, oldVal) {
this.code = newVal;
this.oldCode = oldVal;
});
this.theUnWatch = unwatchCustom;
},
hideOrderCheck() {
this.showOrderCheck = false;
},
buyOrdercheck() {
if (isNaN(parseInt(this.toolInputContent)) || this.toolInputContent === '') {
let callConfig = {
msg: '请输入数字',
icon: 'fa-times-circle-o',
time: 1500,
}
tmp.dispatch('CALL_MSGR',callConfig);
} else {
this.showOrderCheck = true;
}
},
customOrderCheck() {
if (this.toolInputContent === '') {
let callConfig = {
msg: '后缀不能为空',
icon: 'fa-times-circle-o',
time: 1500,
}
tmp.dispatch('CALL_MSGR',callConfig);
} else {
this.showOrderCheck = true;
}
},
submitOrder() {
switch(this.toolInputType) {
case 'buy':
this.buyInvite();
break;
case 'custom':
this.customInvite();
break;
}
},
buyInvite() {
let ajaxBody = {
num: parseInt(this.toolInputContent),
}
_post('/user/buy_invite',JSON.stringify(ajaxBody),'include').then((r)=>{
this.hideToolInput();
if(r.ret) {
this.resetCredit();
this.showInviteTimeTrans();
tmp.commit('SET_INVITE_NUM',r.invite_num);
let callConfig = {
msg: r.msg,
icon: 'fa-check-square-o',
time: 1000,
};
tmp.dispatch('CALL_MSGR',callConfig);
} else {
let callConfig = {
msg: r.msg,
icon: 'fa-times-circle-o',
time: 1000,
};
tmp.dispatch('CALL_MSGR',callConfig);
}
});
},
customInvite() {
this.hideToolInput();
let ajaxBody = {
customcode: this.toolInputContent,
};
_post('/user/custom_invite',JSON.stringify(ajaxBody),'include').then((r)=>{
if (r.ret) {
console.log(r);
this.resetCredit();
this.showLinkTrans();
this.code = this.toolInputContent;
let callConfig = {
msg: r.msg,
icon: 'fa-check-square-o',
time: 1000,
};
tmp.dispatch('CALL_MSGR',callConfig);
} else {
let callConfig = {
msg: r.msg,
icon: 'fa-times-circle-o',
time: 1000,
};
tmp.dispatch('CALL_MSGR',callConfig);
}
});
},
},
watch: {
toolInputType: 'destoryWatch',
},
mounted() {
_get('getuserinviteinfo','include').then((r)=>{
console.log(r);
this.code = r.inviteInfo.code.code;
this.invitePrice = r.inviteInfo.invitePrice;
this.customPrice = r.inviteInfo.customPrice;
console.log(this.userCon);
});
}
@ -1327,7 +1577,7 @@ const Panel = {
<p class="tips tips-blue">VIP等级</p>
<p class="font-light">Lv. $[userCon.class]$</p>
<p class="tips tips-blue">余额</p>
<p class="font-light">$[userCon.money]$</p>
<p class="font-light"><span class="user-config" :class="{ 'font-red-trans':userCreditTrans }">$[userCon.money]$</span></p>
</div>
</div>
</div>
@ -1366,7 +1616,7 @@ const Panel = {
</uim-dropdown>
</div>
</transition>
<h5 class="pure-u-1 flex space-between">
<h5 class="pure-u-1 flex align-center space-between">
<span>订阅链接</span>
<span class="link-reset relative flex justify-center text-center">
<button @click="showToolTip('resetConfirm')" class="tips tips-red"><span class="fa fa-refresh"> 重置链接</button>
@ -1512,6 +1762,7 @@ const Panel = {
resetConfirm: false,
},
subLinkTrans: false,
userCreditTrans: false,
tipsLink: [
{
name: '端口',
@ -1728,6 +1979,9 @@ const Panel = {
currentDlType: 'SSR',
}
},
watch: {
'userCon.money': 'showCreditTrans',
},
methods: {
logout() {
let callConfig = {
@ -1778,6 +2032,12 @@ const Panel = {
tmp.dispatch('CALL_MSGR',callConfig);
});
},
showCreditTrans() {
this.userCreditTrans = true;
setTimeout(() => {
this.userCreditTrans = false;
}, 300);
},
},
mounted() {
let self = this;

Loading…
Cancel
Save