From 4285a63fecd1ea0c6cddc360706136f8d4e75e3d Mon Sep 17 00:00:00 2001 From: laurieryayoi <14360417+laurieryayoi@users.noreply.github.com> Date: Tue, 22 Jan 2019 02:57:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=82=80=E8=AF=B7=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/VueController.php | 19 ++++++++++ config/routes.php | 1 + public/theme/material/css/index.css | 27 ++++++++++++++ resources/views/material/index.tpl | 58 +++++++++++++++++++++++++++-- 4 files changed, 101 insertions(+), 4 deletions(-) diff --git a/app/Controllers/VueController.php b/app/Controllers/VueController.php index c7dc7638..8b09a518 100644 --- a/app/Controllers/VueController.php +++ b/app/Controllers/VueController.php @@ -208,4 +208,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)); + } + } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index baf1cd5c..beb4d884 100755 --- a/config/routes.php +++ b/config/routes.php @@ -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 diff --git a/public/theme/material/css/index.css b/public/theme/material/css/index.css index 396b4758..bae783e5 100755 --- a/public/theme/material/css/index.css +++ b/public/theme/material/css/index.css @@ -549,6 +549,10 @@ select { border-color: #D1335B; } +button.tips { + background-color: transparent; +} + .tips-blue:hover, .tips-gold:hover, .tips-green:hover, @@ -629,6 +633,25 @@ select { font-size: 14px; } +.invite-tools { + position: relative; + margin-left: .75rem; +} +.invite-tools .tips.tips-red { + position: relative; + top: 2px; +} + +.invite-tools.tips-green { + padding: 3.5px .7rem; + bottom: 1px; + margin-left: .55rem; +} + +.invite-link { + width: 100%; +} + .list-shop { padding: .5rem; font-size: 1.2rem; @@ -781,6 +804,10 @@ button[name=reset] { .link-reset .uim-tooltip-top { width: 230px; } + + .invite-link { + width: 450px; + } } @media screen and (min-width:48em) { diff --git a/resources/views/material/index.tpl b/resources/views/material/index.tpl index 94a29ca9..e52b9e76 100755 --- a/resources/views/material/index.tpl +++ b/resources/views/material/index.tpl @@ -1078,12 +1078,37 @@ const UserInvite = { mixins: [userMixin,storeMap], template: /*html*/ `
-
邀请链接
+
+
邀请链接
+ + + +
- -
邀请链接剩余次数: $[userCon.invite_num]$次
+
+ + + + + +
+ 确定要重置邀请链接? +
+ + +
+
+
+
+
+
+
邀请链接剩余次数: $[userCon.invite_num]$次

$[userCon.user_name]$,您不是VIP暂时无法使用邀请链接,

@@ -1100,12 +1125,37 @@ const UserInvite = { data: function() { return { code: '', + invitePrice: '', + inviteResetConfirm: false, } }, + methods: { + showInviteReset() { + this.inviteResetConfirm = true; + }, + hideInviteReset() { + this.inviteResetConfirm = false; + }, + resetInviteLink() { + _get('/getnewinvotecode','include').then((r)=>{ + console.log(r); + this.code = r.arr.code.code; + this.hideInviteReset(); + let callConfig = { + msg: '已重置您的邀请链接,复制您的邀请链接发送给其他人!', + icon: 'fa-bell', + time: 1500, + } + tmp.dispatch('CALL_MSGR',callConfig); + }); + }, + }, mounted() { _get('getuserinviteinfo','include').then((r)=>{ console.log(r); this.code = r.inviteInfo.code.code; + this.invitePrice = r.inviteInfo.invitePrice; + console.log(this.invitePrice); console.log(this.userCon); }); } @@ -1366,7 +1416,7 @@ const Panel = {
-
+
订阅链接 From 2bde5ee5347fa9be9cc3f067065f34716b2462a7 Mon Sep 17 00:00:00 2001 From: laurieryayoi <14360417+laurieryayoi@users.noreply.github.com> Date: Tue, 22 Jan 2019 05:51:46 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=82=80=E8=AF=B7=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0&=E7=BB=86=E8=8A=82=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/UserController.php | 1 + public/theme/material/css/index.css | 31 +++++- resources/views/material/index.tpl | 158 +++++++++++++++++++++++++--- 3 files changed, 174 insertions(+), 16 deletions(-) diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index b75a47c0..69b35d57 100755 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -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)); diff --git a/public/theme/material/css/index.css b/public/theme/material/css/index.css index bae783e5..e5164824 100755 --- a/public/theme/material/css/index.css +++ b/public/theme/material/css/index.css @@ -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; } @@ -285,10 +290,12 @@ input.checkbox, 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 +541,11 @@ select { border-color: #faad14; } +.tips-gold-trans.tips-gold { + color: white; + background-color: #faad14; +} + .tips-green { color: #52c41a; border-color: #52c41a; @@ -549,6 +561,10 @@ select { border-color: #D1335B; } +.font-red-trans { + color: #D1335B; +} + button.tips { background-color: transparent; } @@ -652,6 +668,14 @@ button.tips { width: 100%; } +.user-invite-title .uim-tooltip { + width: 100%; +} + +.user-invite-title .uim-tooltip button { + border: 0; +} + .list-shop { padding: .5rem; font-size: 1.2rem; @@ -727,7 +751,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; } diff --git a/resources/views/material/index.tpl b/resources/views/material/index.tpl index e52b9e76..a919aa3c 100755 --- a/resources/views/material/index.tpl +++ b/resources/views/material/index.tpl @@ -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,21 +1081,34 @@ const UserInvite = { mixins: [userMixin,storeMap], template: /*html*/ `
-
+
邀请链接
- - - +
+ + + + + +
+ +
+ + +
+
+
+
+
- + @@ -1108,7 +1124,7 @@ const UserInvite = {
-
邀请链接剩余次数: $[userCon.invite_num]$次
+
邀请链接剩余次数: $[userCon.invite_num]$次

$[userCon.user_name]$,您不是VIP暂时无法使用邀请链接,

@@ -1120,13 +1136,22 @@ const UserInvite = { computed: { inviteLink: function() { return this.baseURL + '/#/auth/register?code=' + this.code; - } + }, }, data: function() { return { code: '', invitePrice: '', + toolInputContent: '', + placeholder: '', + toolInputType: '', + orderCheckContent: '', inviteResetConfirm: false, + inviteLinkTrans: false, + inviteTimeTrans: false, + showToolInput: false, + isToolDisabled: false, + showOrderCheck: false, } }, methods: { @@ -1136,11 +1161,24 @@ const UserInvite = { 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', @@ -1149,6 +1187,90 @@ const UserInvite = { tmp.dispatch('CALL_MSGR',callConfig); }); }, + hideToolInput() { + this.showToolInput = false; + this.isToolDisabled = false; + this.hideOrderCheck(); + 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'; + }, + hideOrderCheck() { + this.showOrderCheck = false; + }, + buyOrdercheck() { + if (isNaN(parseInt(this.toolInputContent))) { + let callConfig = { + msg: '请输入数字', + icon: 'fa-times-circle-o', + time: 1500, + } + tmp.dispatch('CALL_MSGR',callConfig); + } else { + let total = parseInt(this.toolInputContent)*parseInt(this.invitePrice); + this.orderCheckContent = /*html*/ ` +
确认购买 ${ this.toolInputContent } 个吗?总价为 ¥${ total }
+ ` + this.showOrderCheck = true; + } + }, + customOrderCheck() { + + }, + 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)=>{ + if(r.ret) { + console.log(r); + this.hideToolInput(); + 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 { + this.hideToolInput(); + let callConfig = { + msg: r.msg, + icon: 'fa-times-circle-o', + time: 1000, + }; + tmp.dispatch('CALL_MSGR',callConfig); + } + }); + }, }, mounted() { _get('getuserinviteinfo','include').then((r)=>{ @@ -1377,7 +1499,7 @@ const Panel = {

VIP等级

Lv. $[userCon.class]$

余额

-

$[userCon.money]$

+

$[userCon.money]$

@@ -1562,6 +1684,7 @@ const Panel = { resetConfirm: false, }, subLinkTrans: false, + userCreditTrans: false, tipsLink: [ { name: '端口', @@ -1778,6 +1901,9 @@ const Panel = { currentDlType: 'SSR', } }, + watch: { + 'userCon.money': 'showCreditTrans', + }, methods: { logout() { let callConfig = { @@ -1828,6 +1954,12 @@ const Panel = { tmp.dispatch('CALL_MSGR',callConfig); }); }, + showCreditTrans() { + this.userCreditTrans = true; + setTimeout(() => { + this.userCreditTrans = false; + }, 300); + }, }, mounted() { let self = this; From 18eae1836694fd1f7932d8b85adb946b936a2f3b Mon Sep 17 00:00:00 2001 From: laurieryayoi <14360417+laurieryayoi@users.noreply.github.com> Date: Tue, 22 Jan 2019 08:39:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=82=80=E8=AF=B7=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0&=E5=AE=9A=E5=88=B6=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/VueController.php | 1 + public/theme/material/css/index.css | 19 ++++-- resources/views/material/index.tpl | 102 ++++++++++++++++++++++++---- 3 files changed, 106 insertions(+), 16 deletions(-) diff --git a/app/Controllers/VueController.php b/app/Controllers/VueController.php index 8b09a518..018ed6a6 100644 --- a/app/Controllers/VueController.php +++ b/app/Controllers/VueController.php @@ -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; diff --git a/public/theme/material/css/index.css b/public/theme/material/css/index.css index e5164824..8990a4ef 100755 --- a/public/theme/material/css/index.css +++ b/public/theme/material/css/index.css @@ -285,7 +285,8 @@ input.checkbox, } .auth-submit:hover, -.auth-submit:focus, { +.auth-submit:focus, + { background-color: #d6d6d6; border-color: #d6d6d6; } @@ -653,9 +654,10 @@ button.tips { position: relative; margin-left: .75rem; } + .invite-tools .tips.tips-red { position: relative; - top: 2px; + top: 1px; } .invite-tools.tips-green { @@ -676,6 +678,10 @@ button.tips { border: 0; } +.user-invite-title .tips { + position: relative; +} + .list-shop { padding: .5rem; font-size: 1.2rem; @@ -688,7 +694,7 @@ button.tips { } .list-shop:hover { - transform: translate3D(1rem,0,0); + transform: translate3D(1rem, 0, 0); } .coupon-checker { @@ -833,6 +839,11 @@ button[name=reset] { .invite-link { width: 450px; } + + .user-invite-title .tips { + margin-bottom: .5rem; + margin-left: .75rem; + } } @media screen and (min-width:48em) { @@ -1119,7 +1130,7 @@ button.uim-modal-confirm { /* switch */ -.uim-switch-body { +.uim-switch-body { background-color: #ccc; border-radius: 25px; cursor: pointer; diff --git a/resources/views/material/index.tpl b/resources/views/material/index.tpl index a919aa3c..e842bae4 100755 --- a/resources/views/material/index.tpl +++ b/resources/views/material/index.tpl @@ -1094,7 +1094,8 @@ const UserInvite = {
- +
确认购买 $[toolInputContent]$ 个吗?总价为 ¥$[totalPrice]$
+ 确认定制链接后缀为 $[toolInputContent]$ 吗?价格为 ¥$[customPrice]$
@@ -1103,6 +1104,17 @@ const UserInvite = {
+ +
+
+ ¥$[invitePrice]$/次 + 总价:¥$[totalPrice]$ +
+
+ 价格:¥$[customPrice]$ +
+
+
@@ -1123,8 +1135,15 @@ const UserInvite = { + + +
-
邀请链接剩余次数: $[userCon.invite_num]$次
+
邀请链接剩余次数: $[userCon.invite_num]$次 + + + +

$[userCon.user_name]$,您不是VIP暂时无法使用邀请链接,

@@ -1137,11 +1156,19 @@ const UserInvite = { 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: '', @@ -1152,9 +1179,15 @@ const UserInvite = { showToolInput: false, isToolDisabled: false, showOrderCheck: false, + theUnWatch: '', } }, methods: { + destoryWatch() { + if (this.theUnWatch !== '') { + this.theUnWatch(); + } + }, showInviteReset() { this.inviteResetConfirm = true; }, @@ -1191,6 +1224,7 @@ const UserInvite = { this.showToolInput = false; this.isToolDisabled = false; this.hideOrderCheck(); + this.destoryWatch(); setTimeout(() => { this.toolInputContent = ''; }, 300); @@ -1211,11 +1245,22 @@ const UserInvite = { 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))) { + if (isNaN(parseInt(this.toolInputContent)) || this.toolInputContent === '') { let callConfig = { msg: '请输入数字', icon: 'fa-times-circle-o', @@ -1223,15 +1268,20 @@ const UserInvite = { } tmp.dispatch('CALL_MSGR',callConfig); } else { - let total = parseInt(this.toolInputContent)*parseInt(this.invitePrice); - this.orderCheckContent = /*html*/ ` -
确认购买 ${ this.toolInputContent } 个吗?总价为 ¥${ total }
- ` 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) { @@ -1248,9 +1298,8 @@ const UserInvite = { num: parseInt(this.toolInputContent), } _post('/user/buy_invite',JSON.stringify(ajaxBody),'include').then((r)=>{ + this.hideToolInput(); if(r.ret) { - console.log(r); - this.hideToolInput(); this.resetCredit(); this.showInviteTimeTrans(); tmp.commit('SET_INVITE_NUM',r.invite_num); @@ -1261,7 +1310,6 @@ const UserInvite = { }; tmp.dispatch('CALL_MSGR',callConfig); } else { - this.hideToolInput(); let callConfig = { msg: r.msg, icon: 'fa-times-circle-o', @@ -1271,13 +1319,43 @@ const UserInvite = { } }); }, + 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; - console.log(this.invitePrice); + this.customPrice = r.inviteInfo.customPrice; console.log(this.userCon); }); }