From 9801aace65eb919461fb667798e988f7a036282d Mon Sep 17 00:00:00 2001 From: laurieryayoi <14360417+laurieryayoi@users.noreply.github.com> Date: Sun, 20 Jan 2019 21:08:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=95=86=E5=BA=97=E6=A8=A1=E5=9D=97&post?= =?UTF-8?q?=E9=99=84=E5=B8=A6cookie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/VueController.php | 15 +- config/routes.php | 1 + public/theme/material/css/index.css | 224 ++++++++++++++++++------ resources/views/material/index.tpl | 128 ++++++++++++-- resources/views/material/user/index.tpl | 6 - 5 files changed, 297 insertions(+), 77 deletions(-) diff --git a/app/Controllers/VueController.php b/app/Controllers/VueController.php index 3190a2d3..a8f871f0 100644 --- a/app/Controllers/VueController.php +++ b/app/Controllers/VueController.php @@ -8,6 +8,7 @@ use App\Models\Code; use App\Models\Payback; use App\Models\Paylist; use App\Models\Ann; +use App\Models\Shop; use App\Services\Auth; use App\Services\Config; use App\Services\Payment; @@ -152,7 +153,7 @@ class VueController extends BaseController { if (!$paybacks_sum = Payback::where("ref_by", $this->user->id)->sum('ref_get')) { $paybacks_sum = 0; } - $paybacks->setPath('/user/invite'); + $paybacks->setPath('/#/user/panel'); $res['inviteInfo'] = array( "code" => $code, @@ -166,4 +167,16 @@ class VueController extends BaseController { return $response->getBody()->write(json_encode($res)); } + public function getUserShops($request, $response, $args) + { + $shops = Shop::where("status", 1)->orderBy("name")->get(); + + $res['arr'] = array( + 'shops' => $shops, + ); + $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 14cc7339..c381ec09 100755 --- a/config/routes.php +++ b/config/routes.php @@ -374,6 +374,7 @@ $app->get('/logout', 'App\Controllers\VueController:vuelogout'); $app->get('/globalconfig', 'App\Controllers\VueController:getGlobalConfig'); $app->get('/getuserinfo', 'App\Controllers\VueController:getUserInfo'); $app->get('/getuserinviteinfo', 'App\Controllers\VueController:getUserInviteInfo'); +$app->get('/getusershops', 'App\Controllers\VueController:getUserShops'); /** * chenPay diff --git a/public/theme/material/css/index.css b/public/theme/material/css/index.css index acf6d63b..85d1c558 100755 --- a/public/theme/material/css/index.css +++ b/public/theme/material/css/index.css @@ -49,6 +49,10 @@ a { margin-bottom: 0 !important; } +.relative { + position: relative; +} + [v-cloak] { display: none; } @@ -206,12 +210,19 @@ button.btn-user.index-btn-active { color: #D1335B; } +.card, +.tips, +.btn-inline, +.btn-forinput, .staff a, .input-control input, .auth-submit, .button-round, .button-index, -input.checkbox { +input.checkbox, +.buy-submit, +.font-light, +.list-shop { transition: all .3s; } @@ -231,7 +242,8 @@ input.checkbox { border-color: #adadad; } -.auth-submit { +.auth-submit, +.buy-submit { border-radius: 3px; color: #D1335B; background: white; @@ -242,12 +254,28 @@ input.checkbox { width: 81%; } +.buy-submit { + min-height: unset; + width: unset; + margin: 0; + font-size: 16px; + padding: .15rem .5rem; + width: 48%; +} + .auth-submit:hover, -.auth-submit:focus { +.auth-submit:focus, +.buy-submit:hover, +.buy-submit:focus { background-color: #d6d6d6; border-color: #d6d6d6; } +.buy-submit:disabled { + color: #858585; + cursor: not-allowed; +} + .auth, .user, .pw { @@ -408,9 +436,11 @@ select { #register { margin-top: 2rem; } + #embed-captcha-reg { min-height: 44px; } + #embed-captcha-reg .geetest_btn { margin-left: auto; margin-right: auto; @@ -420,9 +450,11 @@ select { .auth-tg { margin-top: 2rem; } + .auth-tg p { padding: 0 2rem; } + .auth-tg p a { color: #D1335B; } @@ -430,14 +462,14 @@ select { .card { border: 1px solid #434857; margin-bottom: 1.5rem; - transition: all .3s; } .user-btngroup { margin-bottom: 1.5rem; } -.card:hover { +.card:hover, +.list-shop:hover { border: 1px solid white; box-shadow: 0 0 5px 1px gray; } @@ -462,7 +494,6 @@ select { overflow: hidden; color: #b1b3bb; margin: .75rem 0; - transition: all .3s; } .font-light:hover { @@ -476,29 +507,53 @@ select { border: 1px solid; font-size: 14px; border-radius: 3px; - transition: all .3s; } .tips-blue { color: #1997c6; border-color: #1997c6; } + .tips-gold { color: #faad14; border-color: #faad14; } -.tips-blue:hover { +.tips-green { + color: #52c41a; + border-color: #52c41a; +} + +.tips-cyan { + color: #13c2c2; + border-color: #13c2c2; +} + +.tips-blue:hover, +.tips-gold:hover, +.tips-green:hover, +.tips-cyan:hover { color: white; - background: #1997c6; } + +.tips-blue:hover { + background-color: #1997c6; +} + .tips-gold:hover { - color: white; background-color: #faad14; } +.tips-green:hover { + background-color: #52c41a; +} + +.tips-cyan:hover { + background-color: #13c2c2; +} + .ann { - background-color: rgba(255,255,255,0.2); + background-color: rgba(255, 255, 255, 0.2); border-radius: 5px; padding: .1rem 1rem; } @@ -514,7 +569,7 @@ select { .input-copy input { height: unset; - background: rgba(255,255,255,0); + background: rgba(255, 255, 255, 0); cursor: pointer; } @@ -529,7 +584,7 @@ select { .user-invite input, .btn-inline { - background: rgba(255,255,255,0); + background: rgba(255, 255, 255, 0); } .btn-inline { @@ -538,8 +593,8 @@ select { border-radius: 3px; font-size: 14px; padding: .3rem .8rem; - transition: all .3s; } + .btn-inline:hover { background: #D1335B; color: white; @@ -549,10 +604,54 @@ select { font-size: 14px; } +.list-shop { + padding: .5rem; + font-size: 1.2rem; + border: 1px solid #434857; + margin-bottom: .7rem; + width: 95%; +} + +.list-shop:hover { + transform: translateX(1rem); +} + +.coupon-checker { + height: 30px; + background-color: rgba(255, 255, 255, 0); + padding: 0 .5rem; + margin-bottom: .5rem; +} +.coupon-checker:hover, +.coupon-checker, +.btn-forinput { + background-color: rgba(255, 255, 255, 0); +} + +.btn-forinput { + color: #1997c6; + border: none; + outline: none; + position: absolute; + top: .3rem; + font-size: 14px; + z-index: 1; +} +.btn-forinput:hover { + color: white; +} +button[name=check] { + right: 1.5rem; +} +button[name=reset] { + right: .2rem; +} + @media screen and (min-width:35.5em) { .auth-tg { margin-top: 0; } + .auth-sm a { min-width: 120px; } @@ -611,7 +710,8 @@ select { padding-right: 3rem; } - .ann { + .ann, + .user-shop { max-height: 385px; overflow: auto; } @@ -763,7 +863,7 @@ input[type=checkbox].uim-checkbox { padding: 0; text-align: center; border: 1px solid #1997c6; - box-shadow: 0 0 5px 1px gray; + box-shadow: 0 0 5px 1px gray; } .uim-dropdown-menu li { @@ -788,11 +888,13 @@ input[type=checkbox].uim-checkbox { min-width: 120px; } -.dropdown-fade-enter-active,.dropdown-fade-leave-active { +.dropdown-fade-enter-active, +.dropdown-fade-leave-active { transition: all .2s ease; } -.dropdown-fade-enter,.dropdown-fade-leave-to { +.dropdown-fade-enter, +.dropdown-fade-leave-to { transform-origin: top; transform: scaleY(0); opacity: 0; @@ -852,47 +954,67 @@ input[type=checkbox].uim-checkbox { height: 32px; position: relative; transition: all .3s; - } - - .cube1, .cube2 { +} + +.cube1, +.cube2 { background-color: white; width: 30px; height: 30px; position: absolute; top: 0; left: 0; - + -webkit-animation: cubemove 1.8s infinite ease-in-out; animation: cubemove 1.8s infinite ease-in-out; - } - - .cube2 { +} + +.cube2 { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; - } - - @-webkit-keyframes cubemove { - 25% { -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5) } - 50% { -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg) } - 75% { -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5) } - 100% { -webkit-transform: rotate(-360deg) } - } - - @keyframes cubemove { +} + +@-webkit-keyframes cubemove { + 25% { + -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5) + } + + 50% { + -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg) + } + + 75% { + -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5) + } + + 100% { + -webkit-transform: rotate(-360deg) + } +} + +@keyframes cubemove { 25% { - transform: translateX(42px) rotate(-90deg) scale(0.5); - -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5); - } 50% { - transform: translateX(42px) translateY(42px) rotate(-179deg); - -webkit-transform: translateX(42px) translateY(42px) rotate(-179deg); - } 50.1% { - transform: translateX(42px) translateY(42px) rotate(-180deg); - -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg); - } 75% { - transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); - -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); - } 100% { - transform: rotate(-360deg); - -webkit-transform: rotate(-360deg); - } - } + transform: translateX(42px) rotate(-90deg) scale(0.5); + -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5); + } + + 50% { + transform: translateX(42px) translateY(42px) rotate(-179deg); + -webkit-transform: translateX(42px) translateY(42px) rotate(-179deg); + } + + 50.1% { + transform: translateX(42px) translateY(42px) rotate(-180deg); + -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg); + } + + 75% { + transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); + -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); + } + + 100% { + transform: rotate(-360deg); + -webkit-transform: rotate(-360deg); + } +} \ No newline at end of file diff --git a/resources/views/material/index.tpl b/resources/views/material/index.tpl index 6209beff..2cf3d2ba 100755 --- a/resources/views/material/index.tpl +++ b/resources/views/material/index.tpl @@ -147,13 +147,14 @@ * @param {string} method * @returns {function} - A Promise Object */*} -const _request = (url, body, method) => +const _request = (url, body, method,credentials) => fetch(url, { method: method, body: body, headers: { 'content-type': 'application/json' - } + }, + credentials: credentials, }).then(resp => { return Promise.all([resp.ok, resp.status, resp.json()]); }).then(([ok, status, json]) => { @@ -205,7 +206,7 @@ const _get = (url,credentials) => * _post('https://example.com', JSON.stringify(data)).then(resp => { console.log(resp) }) */*} -const _post = (url, body) => _request(url, body, 'POST'); +const _post = (url, body, credentials) => _request(url, body, 'POST', credentials); let validate,captcha; @@ -290,7 +291,7 @@ const tmp = new Vuex.Store({ commit('ISSHOW_MSGR',true); window.setTimeout(function() { commit('ISSHOW_MSGR',false); - },1000) + },config.time) } } }); @@ -318,7 +319,7 @@ var storeAuth = { if (this.globalConfig.captchaProvider === 'geetest') { this.$nextTick(function(){ - _get('/auth/login_getCaptcha') + _get('/auth/login_getCaptcha','include') .then((r) => { let GeConfig = { gt: r.GtSdk.gt, @@ -550,10 +551,11 @@ const Login = { } } - _post('/auth/login', JSON.stringify(ajaxCon)).then((r) => { + _post('/auth/login', JSON.stringify(ajaxCon),'include').then((r) => { if (r.ret === 1) { callConfig.msg += '登录成功Kira~'; callConfig.icon += 'fa-check-square-o'; + callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(() => { tmp.commit('SET_LOGINTOKEN',1); @@ -562,6 +564,7 @@ const Login = { } else { callConfig.msg += '登录失败Boommm'; callConfig.icon += 'fa-times-circle-o'; + callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ this.isDisabled = false; @@ -598,17 +601,18 @@ const Login = { _post('/auth/qrcode_check', JSON.stringify({ token: this.globalConfig.login_token, number: this.globalConfig.login_number, - })).then((r) => { + }),'include').then((r) => { if(r.ret > 0) { clearTimeout(tid); _post('/auth/qrcode_login',JSON.stringify({ token: this.globalConfig.login_token, number: this.globalConfig.login_number, - })).then(r=>{ + }),'include').then(r=>{ if (r.ret) { callConfig.msg += '登录成功Kira~'; callConfig.icon += 'fa-check-square-o'; + callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ tmp.commit('SET_LOGINTOKEN',1); @@ -772,10 +776,11 @@ const Register = { } } - _post('/auth/register', JSON.stringify(ajaxCon)).then((r)=>{ + _post('/auth/register', JSON.stringify(ajaxCon),'omit').then((r)=>{ if (r.ret == 1) { callConfig.msg += '注册成功meow~'; callConfig.icon += 'fa-check-square-o'; + callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ this.$router.replace('/auth/login'); @@ -783,6 +788,7 @@ const Register = { } else { callConfig.msg += 'WTF……注册失败'; callConfig.icon += 'fa-times-circle-o'; + callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ this.isDisabled = false; @@ -846,17 +852,19 @@ const Register = { email: this.email, } - _post('auth/send', JSON.stringify(ajaxCon)).then((r)=>{ + _post('auth/send', JSON.stringify(ajaxCon),'omit').then((r)=>{ if (r.ret) { let callConfig = { msg: 'biu~邮件发送成功', icon: 'fa-check-square-o', + time: 1000, }; tmp.dispatch('CALL_MSGR',callConfig); } else { let callConfig = { msg: 'emm……邮件发送失败', icon: 'fa-times-circle-o', + time: 1000, }; tmp.dispatch('CALL_MSGR',callConfig); } @@ -937,10 +945,11 @@ const Reset = { _post('/password/reset', JSON.stringify({ email: this.email, - })).then(r => { + }),'omit').then(r => { if (r.ret == 1) { callConfig.msg += '邮件发送成功kira~'; callConfig.icon += 'fa-check-square-o'; + callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(() => { this.$router.push('/auth/login'); @@ -948,6 +957,7 @@ const Reset = { } else { callConfig.msg += 'WTF……邮件发送失败,请检查邮箱地址'; callConfig.icon += 'fa-times-circle-o'; + callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ this.isDisabled = false; @@ -969,6 +979,7 @@ const User = { }; const userMixin = { + delimiters: ['$[',']$'], props: ['annC','thisuser','baseURL'], } @@ -985,7 +996,6 @@ const UserAnnouncement = { }; const UserInvite = { - delimiters: ['$[',']$'], mixins: [userMixin], template: /*html*/ `
@@ -1014,24 +1024,103 @@ const UserInvite = { } }, mounted() { - _get('getuserinviteinfo').then((r)=>{ + _get('getuserinviteinfo','include').then((r)=>{ console.log(r); this.code = r.inviteInfo.code.code; console.log(this.thisuser); - }) + }); } }; const UserShop = { mixins: [userMixin], template: /*html*/ ` -
-
套餐购买
+
+
+
+
套餐购买
+ + + +
+
-
+
+
+
+ $[shop.name]$ + VIP $[shop.details.class]$ + ¥$[shop.price]$ + $[shop.details.bandwidth]$G+$[shop.details.reset_value]$G/($[shop.details.reset]$天/$[shop.details.reset_exp]$天) + $[shop.details.class_expire]$天 +
+
+
+
`, + data: function() { + return { + shops: '', + isDisabled: false, + coupon: '', + isCheckerShow: false, + ajaxBody: { + shop: '', + autorenew: '', + }, + } + }, + methods: { + buy(id,autoRenew) { + this.isDisabled = true; + this.isCheckerShow = true; + let callConfig = { + msg: '请输入优惠码,如没有请直接确认', + icon: 'fa-bell', + time: 3000, + }; + tmp.dispatch('CALL_MSGR',callConfig); + id = (id).toString(); + Vue.set(this.ajaxBody,'shop',id); + Vue.set(this.ajaxBody,'autorenew',autoRenew); + }, + couponCheck() { + let ajaxCon = { + coupon: this.coupon, + shop: this.ajaxBody.shop, + }; + _post('/user/coupon_check',JSON.stringify(ajaxCon),'include').then((r)=>{ + if (r.ret) { + console.log(r); + this.isCheckerShow = false; + } else { + console.log(r); + } + }); + }, + orderCheck() { + + }, + hideChecker() { + this.isCheckerShow = false; + this.isDisabled = false; + }, + }, + mounted() { + _get('/getusershops','include').then((r)=>{ + this.shops = r.arr.shops; + this.shops.forEach((el,index)=>{ + Vue.set(this.shops[index],'details',JSON.parse(el.content)) + }); + console.log(this.shops); + }); + }, }; const UserGuide = { @@ -1434,10 +1523,11 @@ const Panel = { msg: '', icon: '', }; - _get('/logout').then((r)=>{ + _get('/logout','include').then((r)=>{ if (r.ret === 1) { callConfig.msg += '账户成功登出Kira~'; callConfig.icon += 'fa-check-square-o'; + callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(() => { tmp.commit('SET_LOGINTOKEN',0); @@ -1569,7 +1659,7 @@ const Router = new VueRouter({ Router.beforeEach((to,from,next)=>{ if (!globalConfig) { - _get('/globalconfig').then((r)=>{ + _get('/globalconfig','include').then((r)=>{ if (r.ret == 1) { globalConfig = r.globalConfig; if (globalConfig.geetest_html && globalConfig.geetest_html.success) { diff --git a/resources/views/material/user/index.tpl b/resources/views/material/user/index.tpl index 5a42af32..9f6622b9 100644 --- a/resources/views/material/user/index.tpl +++ b/resources/views/material/user/index.tpl @@ -718,12 +718,6 @@ ;(function(){ 'use strict' -fetch('/getuserinfo').then((r)=>{ - return r.json(); -}).then((r)=>{ - console.log(r); -}) - let onekeysubBTN = document.querySelectorAll('[data-onekeyfor]'); for (let i=0;i{ From 2ce7b69054325ddcc9478ba9526672d32ee52145 Mon Sep 17 00:00:00 2001 From: laurieryayoi <14360417+laurieryayoi@users.noreply.github.com> Date: Sun, 20 Jan 2019 21:26:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmessager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/material/index.tpl | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/resources/views/material/index.tpl b/resources/views/material/index.tpl index 2cf3d2ba..77ed5caa 100755 --- a/resources/views/material/index.tpl +++ b/resources/views/material/index.tpl @@ -532,6 +532,7 @@ const Login = { let callConfig = { msg: '', icon: '', + time: 1000, }; if (this.globalConfig.enableLoginCaptcha !== 'false') { @@ -555,7 +556,6 @@ const Login = { if (r.ret === 1) { callConfig.msg += '登录成功Kira~'; callConfig.icon += 'fa-check-square-o'; - callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(() => { tmp.commit('SET_LOGINTOKEN',1); @@ -564,7 +564,6 @@ const Login = { } else { callConfig.msg += '登录失败Boommm'; callConfig.icon += 'fa-times-circle-o'; - callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ this.isDisabled = false; @@ -597,6 +596,7 @@ const Login = { let callConfig = { msg: '', icon: '', + time: 1000, }; _post('/auth/qrcode_check', JSON.stringify({ token: this.globalConfig.login_token, @@ -612,7 +612,6 @@ const Login = { if (r.ret) { callConfig.msg += '登录成功Kira~'; callConfig.icon += 'fa-check-square-o'; - callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ tmp.commit('SET_LOGINTOKEN',1); @@ -746,6 +745,7 @@ const Register = { let callConfig = { msg: '', icon: '', + time: 1000, }; if (this.globalConfig.isEmailVeryify === 'true') { @@ -780,7 +780,6 @@ const Register = { if (r.ret == 1) { callConfig.msg += '注册成功meow~'; callConfig.icon += 'fa-check-square-o'; - callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ this.$router.replace('/auth/login'); @@ -788,7 +787,6 @@ const Register = { } else { callConfig.msg += 'WTF……注册失败'; callConfig.icon += 'fa-times-circle-o'; - callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ this.isDisabled = false; @@ -941,6 +939,7 @@ const Reset = { let callConfig = { msg: '', icon: '', + time: 1000, }; _post('/password/reset', JSON.stringify({ @@ -949,7 +948,6 @@ const Reset = { if (r.ret == 1) { callConfig.msg += '邮件发送成功kira~'; callConfig.icon += 'fa-check-square-o'; - callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(() => { this.$router.push('/auth/login'); @@ -957,7 +955,6 @@ const Reset = { } else { callConfig.msg += 'WTF……邮件发送失败,请检查邮箱地址'; callConfig.icon += 'fa-times-circle-o'; - callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(()=>{ this.isDisabled = false; @@ -1522,12 +1519,12 @@ const Panel = { let callConfig = { msg: '', icon: '', + time: 1000, }; _get('/logout','include').then((r)=>{ if (r.ret === 1) { callConfig.msg += '账户成功登出Kira~'; callConfig.icon += 'fa-check-square-o'; - callConfig.time += 1000; tmp.dispatch('CALL_MSGR',callConfig); window.setTimeout(() => { tmp.commit('SET_LOGINTOKEN',0); From 6d44af18b325e7dae10a690c4be6b8a7adca2c36 Mon Sep 17 00:00:00 2001 From: laurieryayoi <14360417+laurieryayoi@users.noreply.github.com> Date: Mon, 21 Jan 2019 01:48:32 +0800 Subject: [PATCH 3/4] =?UTF-8?q?modal=E7=BB=84=E4=BB=B6&=E8=B4=AD=E4=B9=B0?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/theme/material/css/index.css | 96 ++++++++++++++++++++++ resources/views/material/index.tpl | 119 ++++++++++++++++++++++++++-- 2 files changed, 209 insertions(+), 6 deletions(-) diff --git a/public/theme/material/css/index.css b/public/theme/material/css/index.css index 85d1c558..f472d4c7 100755 --- a/public/theme/material/css/index.css +++ b/public/theme/material/css/index.css @@ -33,6 +33,10 @@ a { align-items: center; } +.justify-center { + justify-content: center; +} + .wrap { flex-wrap: wrap; } @@ -622,6 +626,7 @@ select { padding: 0 .5rem; margin-bottom: .5rem; } + .coupon-checker:hover, .coupon-checker, .btn-forinput { @@ -637,16 +642,23 @@ select { font-size: 14px; z-index: 1; } + .btn-forinput:hover { color: white; } + button[name=check] { right: 1.5rem; } + button[name=reset] { right: .2rem; } +.order-checker-content { + margin: .5rem 0 +} + @media screen and (min-width:35.5em) { .auth-tg { margin-top: 0; @@ -906,6 +918,90 @@ input[type=checkbox].uim-checkbox { width: 100%; } +/* modal */ + +.uim-modal-mask, +.uim-modal { + position: fixed; + top: 0; + left: 0; + height: 100vh; + width: 100vw; + background-color: black; + opacity: .4; + z-index: 20; +} + +.uim-modal { + opacity: 1; + background-color: unset; + display: flex; + justify-content: center; +} + +.uim-modal-card { + z-index: 21; + margin-top: 6rem; + background-color: white; + width: 450px; + border-radius: 7px; + color: #434857; + margin-bottom: auto; + box-shadow: 0 0 5px 2px gray; + position: relative; +} + +.uim-modal-title { + border-bottom: 1px solid; +} + +.uim-modal-title h3 { + padding: .22rem 1.5rem; + margin: 1rem 0; +} + +.uim-modal-body { + font-size: 18px; + padding: 1rem 0 1rem 2rem; +} + +.uim-modal-body div { + flex-basis: 100%; +} + +.uim-modal-footer { + display: flex; + padding: .75rem 0; + border-top: 1px solid; +} + +.uim-modal-footer div { + flex-basis: 50%; +} + +.uim-modal-footer div:last-of-type { + text-align: right; +} + +button.uim-modal-confirm { + margin-right: 1.5rem; + padding: .5rem .4rem; + min-width: 80px; + background-color: #2d8cf0; + border-radius: 4px; + border: 1px solid; + color: white; +} + +.uim-modal-close { + position: absolute; + right: .75rem; + top: .45rem; + font-size: 1.5rem; + padding: .5rem .75rem; + cursor: pointer; +} + /* loading 动画 */ .spinner { width: 60px; diff --git a/resources/views/material/index.tpl b/resources/views/material/index.tpl index 77ed5caa..d58eb9d8 100755 --- a/resources/views/material/index.tpl +++ b/resources/views/material/index.tpl @@ -107,6 +107,7 @@ $[msgrCon.msg]$ +
@@ -222,6 +223,12 @@ const tmp = new Vuex.Store({ icon: ['fa','fa-check-square-o'], isShow: false, }, + modalCon: { + isMaskShow: false, + isCardShow: false, + title: '订单确认', + bodyContent: '', + }, globalConfig: { captchaProvider: '', recaptchaSiteKey: '', @@ -259,6 +266,12 @@ const tmp = new Vuex.Store({ ISSHOW_MSGR (state,boolean) { state.msgrCon.isShow = boolean; }, + ISSHOW_MODAL_MASK (state,boolean) { + state.modalCon.isMaskShow = boolean; + }, + ISSHOW_MODAL_CARD (state,boolean) { + state.modalCon.isCardShow = boolean; + }, SET_GLOBALCONFIG (state,config) { state.logintoken = config.isLogin state.globalConfig.base_url = config.base_url; @@ -292,7 +305,20 @@ const tmp = new Vuex.Store({ window.setTimeout(function() { commit('ISSHOW_MSGR',false); },config.time) - } + }, + CALL_MODAL ({ commit,state },config) { + if (state.modalCon.isMaskShow === false) { + commit('ISSHOW_MODAL_MASK',true); + window.setTimeout(() => { + commit('ISSHOW_MODAL_CARD',true) + }, 300); + } else { + commit('ISSHOW_MODAL_CARD',false); + window.setTimeout(() => { + commit('ISSHOW_MODAL_MASK',false) + }, 300); + } + }, } }); @@ -300,6 +326,7 @@ var storeMap = { store: tmp, computed: Vuex.mapState({ msgrCon: 'msgrCon', + modalCon: 'modalCon', globalConfig: 'globalConfig', logintoken: 'logintoken', isLoading: 'isLoading', @@ -1030,7 +1057,7 @@ const UserInvite = { }; const UserShop = { - mixins: [userMixin], + mixins: [userMixin,storeMap], template: /*html*/ `
@@ -1055,10 +1082,23 @@ const UserShop = { $[shop.details.bandwidth]$G+$[shop.details.reset_value]$G/($[shop.details.reset]$天/$[shop.details.reset_exp]$天) $[shop.details.class_expire]$天
-
+
+ + + +

$[modalCon.title]$

+
+
商品名称:$[orderCheckerContent.name]$
+
优惠额度:$[orderCheckerContent.credit]$
+
总金额:$[orderCheckerContent.total]$
+
+
+
+
+ `, data: function() { @@ -1071,10 +1111,17 @@ const UserShop = { shop: '', autorenew: '', }, + isMaskShow: false, + isCardShow: false, + orderCheckerContent: { + name: '', + credit: '', + total: '', + }, } }, methods: { - buy(id,autoRenew) { + buy(shop) { this.isDisabled = true; this.isCheckerShow = true; let callConfig = { @@ -1083,9 +1130,22 @@ const UserShop = { time: 3000, }; tmp.dispatch('CALL_MSGR',callConfig); - id = (id).toString(); + let id = (shop.id).toString(); Vue.set(this.ajaxBody,'shop',id); - Vue.set(this.ajaxBody,'autorenew',autoRenew); + Vue.set(this.ajaxBody,'autorenew',shop.autoRenew); + }, + callOrderChecker() { + if (this.isMaskShow === false) { + this.isMaskShow = true; + setTimeout(() => { + this.isCardShow = true + }, 300); + } else { + this.isCardShow = false; + setTimeout(() => { + this.isMaskShow = false + }, 300); + } }, couponCheck() { let ajaxCon = { @@ -1096,13 +1156,25 @@ const UserShop = { if (r.ret) { console.log(r); this.isCheckerShow = false; + this.orderCheckerContent.name = r.name; + this.orderCheckerContent.credit = r.credit; + this.orderCheckerContent.total = r.total; + this.callOrderChecker(); } else { console.log(r); } }); }, orderCheck() { + let ajaxCon = { + coupon: this.coupon, + shop: this.ajaxBody.shop, + autorenew: this.ajaxBody.autorenew, + disableothers: this.disableothers, + }; + _post('/user/buy',JSON.stringify(ajaxCon),'include').then((r)=>{ + }); }, hideChecker() { this.isCheckerShow = false; @@ -1768,6 +1840,41 @@ Vue.component('uim-dropdown',{ } }) +Vue.component('uim-modal',{ + delimiters: ['$[',']$'], + mixins: [storeMap], + template:/*html*/ ` +
+ +
+
+ +
+
+
+
+ +
+
+
+ `, + props: ['bindMask','bindCard'], +}) + +Vue.component('uim-switch',{ + delimiters: ['$[',']$'], + template:/*html*/ ` +
+ + + +
+ ` +}) + const indexPage = new Vue({ router: Router, el: '#index', From 8285d0d6ff4b5061e5d8d49dc1c37dedf5627dc5 Mon Sep 17 00:00:00 2001 From: laurieryayoi <14360417+laurieryayoi@users.noreply.github.com> Date: Mon, 21 Jan 2019 15:21:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B4=AD=E4=B9=B0=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 | 12 +++ config/routes.php | 1 + public/theme/material/css/index.css | 56 ++++++++++- resources/views/material/index.tpl | 148 ++++++++++++++++++++++------ 4 files changed, 186 insertions(+), 31 deletions(-) diff --git a/app/Controllers/VueController.php b/app/Controllers/VueController.php index a8f871f0..501a98dc 100644 --- a/app/Controllers/VueController.php +++ b/app/Controllers/VueController.php @@ -179,4 +179,16 @@ class VueController extends BaseController { return $response->getBody()->write(json_encode($res)); } + public function getCredit($request, $response, $args) + { + $user = $this->user; + + $res['arr'] = array( + 'credit' => $user->money, + ); + $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 c381ec09..0ac303dd 100755 --- a/config/routes.php +++ b/config/routes.php @@ -375,6 +375,7 @@ $app->get('/globalconfig', 'App\Controllers\VueController:getGlobalConfig'); $app->get('/getuserinfo', 'App\Controllers\VueController:getUserInfo'); $app->get('/getuserinviteinfo', 'App\Controllers\VueController:getUserInviteInfo'); $app->get('/getusershops', 'App\Controllers\VueController:getUserShops'); +$app->get('/getcredit', 'App\Controllers\VueController:getCredit'); /** * chenPay diff --git a/public/theme/material/css/index.css b/public/theme/material/css/index.css index f472d4c7..7916e466 100755 --- a/public/theme/material/css/index.css +++ b/public/theme/material/css/index.css @@ -973,13 +973,18 @@ input[type=checkbox].uim-checkbox { display: flex; padding: .75rem 0; border-top: 1px solid; + align-items: center; } .uim-modal-footer div { flex-basis: 50%; } -.uim-modal-footer div:last-of-type { +.uim-modal-footer>div:first-of-type { + padding-left: 1.5rem; +} + +.uim-modal-footer>div:last-of-type { text-align: right; } @@ -1002,6 +1007,55 @@ button.uim-modal-confirm { cursor: pointer; } +/* switch */ + +.uim-switch-body { + background-color: #ccc; + border-radius: 25px; + cursor: pointer; +} + +.uim-switch-body:after { + content: ""; + height: 20px; + width: 20px; + border-radius: 50%; + position: absolute; + background-color: white; + top: 2px; + left: 2px; +} + +.uim-switch-body, +.uim-switch-body:after { + transition: all .3s; + display: inline-block; +} + +.uim-switch-body input, +.uim-switch-body { + height: 24px; + width: 46px; + position: relative; +} + +.uim-switch-body input { + z-index: 1; + opacity: 0; +} + +.uim-switch-body-active:after { + transform: translateX(22px); +} + +.uim-switch-body-active { + background-color: #2d8cf0; +} + +.switch-text { + font-size: 14px; +} + /* loading 动画 */ .spinner { width: 60px; diff --git a/resources/views/material/index.tpl b/resources/views/material/index.tpl index d58eb9d8..4c2ffeb5 100755 --- a/resources/views/material/index.tpl +++ b/resources/views/material/index.tpl @@ -105,6 +105,7 @@ $[msgrCon.msg]$ +
@@ -213,6 +214,23 @@ let validate,captcha; let globalConfig; +const UserTmp = { + state: { + userCon: '', + }, + mutations: { + SET_USERCON (state,config) { + state.userCon = config; + }, + SET_USERMONEY (state,number) { + state.userCon.money = number; + } + }, + actions: { + + }, +} + const tmp = new Vuex.Store({ state: { isLoading: 'loading', @@ -220,6 +238,7 @@ const tmp = new Vuex.Store({ logintoken: false, msgrCon: { msg: '操作成功', + html: '', icon: ['fa','fa-check-square-o'], isShow: false, }, @@ -262,6 +281,7 @@ const tmp = new Vuex.Store({ SET_MSGRCON (state,config) { state.msgrCon.msg = config.msg; state.msgrCon.icon[1] = config.icon; + state.msgrCon.html = config.html; }, ISSHOW_MSGR (state,boolean) { state.msgrCon.isShow = boolean; @@ -299,12 +319,19 @@ const tmp = new Vuex.Store({ }, }, actions: { - CALL_MSGR ({ commit,state },config) { - commit('SET_MSGRCON',config); - commit('ISSHOW_MSGR',true); - window.setTimeout(function() { + CALL_MSGR ({ dispatch,commit,state },config) { + if (state.msgrCon.isShow === true) { commit('ISSHOW_MSGR',false); - },config.time) + setTimeout(() => { + dispatch('CALL_MSGR',config); + }, 300); + } else { + commit('SET_MSGRCON',config); + commit('ISSHOW_MSGR',true); + window.setTimeout(function() { + commit('ISSHOW_MSGR',false); + },config.time) + } }, CALL_MODAL ({ commit,state },config) { if (state.modalCon.isMaskShow === false) { @@ -319,6 +346,9 @@ const tmp = new Vuex.Store({ }, 300); } }, + }, + modules: { + userState: UserTmp, } }); @@ -330,6 +360,7 @@ var storeMap = { globalConfig: 'globalConfig', logintoken: 'logintoken', isLoading: 'isLoading', + userCon: state => state.userState.userCon, }), } @@ -1004,11 +1035,22 @@ const User = { const userMixin = { delimiters: ['$[',']$'], - props: ['annC','thisuser','baseURL'], + props: ['annC','baseURL'], + methods: { + resetCredit() { + _get('/getcredit','include').then((r)=>{ + console.log(r.arr); + this.updateCredit(r.arr.credit); + }); + }, + updateCredit(credit) { + tmp.commit('SET_USERMONEY',credit); + }, + } } const UserAnnouncement = { - mixins: [userMixin], + mixins: [userMixin,storeMap], template: `
公告栏
@@ -1020,18 +1062,18 @@ const UserAnnouncement = { }; const UserInvite = { - mixins: [userMixin], + mixins: [userMixin,storeMap], template: /*html*/ `
邀请链接
-
+
-
邀请链接剩余次数: $[thisuser.invite_num]$次
+
邀请链接剩余次数: $[userCon.invite_num]$次
-

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

+

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

@@ -1051,7 +1093,7 @@ const UserInvite = { _get('getuserinviteinfo','include').then((r)=>{ console.log(r); this.code = r.inviteInfo.code.code; - console.log(this.thisuser); + console.log(this.userCon); }); } }; @@ -1079,7 +1121,7 @@ const UserShop = { $[shop.name]$ VIP $[shop.details.class]$ ¥$[shop.price]$ - $[shop.details.bandwidth]$G+$[shop.details.reset_value]$G/($[shop.details.reset]$天/$[shop.details.reset_exp]$天) + $[shop.details.bandwidth]$G+$[shop.details.reset_value]$G/($[shop.details.reset]$天/$[shop.details.reset_exp]$天) $[shop.details.class_expire]$天
@@ -1095,7 +1137,7 @@ const UserShop = {
优惠额度:$[orderCheckerContent.credit]$
总金额:$[orderCheckerContent.total]$
-
+
关闭旧套餐自动续费
@@ -1117,6 +1159,7 @@ const UserShop = { name: '', credit: '', total: '', + disableothers: true, }, } }, @@ -1127,7 +1170,7 @@ const UserShop = { let callConfig = { msg: '请输入优惠码,如没有请直接确认', icon: 'fa-bell', - time: 3000, + time: 1500, }; tmp.dispatch('CALL_MSGR',callConfig); let id = (shop.id).toString(); @@ -1144,6 +1187,7 @@ const UserShop = { this.isCardShow = false; setTimeout(() => { this.isMaskShow = false + this.hideChecker(); }, 300); } }, @@ -1154,14 +1198,18 @@ const UserShop = { }; _post('/user/coupon_check',JSON.stringify(ajaxCon),'include').then((r)=>{ if (r.ret) { - console.log(r); this.isCheckerShow = false; this.orderCheckerContent.name = r.name; this.orderCheckerContent.credit = r.credit; this.orderCheckerContent.total = r.total; this.callOrderChecker(); } else { - console.log(r); + let callConfig = { + msg: r.msg, + icon: 'fa-times-circle-o', + time: 1000, + }; + tmp.dispatch('CALL_MSGR',callConfig); } }); }, @@ -1173,7 +1221,31 @@ const UserShop = { disableothers: this.disableothers, }; _post('/user/buy',JSON.stringify(ajaxCon),'include').then((r)=>{ - + if (r.ret) { + console.log(r); + this.callOrderChecker(); + this.resetCredit(); + } else { + console.log(r); + let self = this; + let animation = new Promise(function(resolve) { + self.callOrderChecker(); + setTimeout(() => { + resolve('done'); + }, 600); + }); + let message = r.msg + let subPosition = message.indexOf('
'); + let callConfig = { + msg: message.substr(0,subPosition), + html: message.substr(subPosition), + icon: 'fa-times-circle-o', + time: 6000, + }; + animation.then((r)=>{ + tmp.dispatch('CALL_MSGR',callConfig); + }) + } }); }, hideChecker() { @@ -1193,7 +1265,7 @@ const UserShop = { }; const UserGuide = { - mixins: [userMixin], + mixins: [userMixin,storeMap], template: /*html*/ `
配置指南
@@ -1329,7 +1401,7 @@ const Panel = {
- + @@ -1359,7 +1431,6 @@ const Panel = { data: function() { return { userLoadState: 'beforeload', - userCon: '', ann: { content: '', date: '', @@ -1619,7 +1690,8 @@ const Panel = { _get('/getuserinfo','include').then((r) => { if (r.ret === 1) { console.log(r.info); - this.userCon = r.info.user; + tmp.commit('SET_USERCON',r.info.user); + console.log(this.userCon); if (r.info.ann) { this.ann = r.info.ann; } @@ -1633,7 +1705,6 @@ const Panel = { this.tipsLink[3].content = this.userCon.protocol; this.tipsLink[4].content = this.userCon.obfs; this.tipsLink[5].content = this.userCon.obfs_param; - console.log(this.userCon); } }).then((r)=>{ setTimeout(()=>{ @@ -1767,7 +1838,7 @@ Vue.component('uim-messager',{ delimiters: ['$[',']$'], template: /*html*/ `
-
+
`, }) @@ -1866,13 +1937,30 @@ Vue.component('uim-modal',{ Vue.component('uim-switch',{ delimiters: ['$[',']$'], + model: { + prop: 'isBtnActive', + event: 'change', + }, + props: ['isBtnActive'], template:/*html*/ ` -
- - - -
- ` + + + + `, + data: function() { + return { + switchStatus: this.isBtnActive, + } + }, + methods: { + btnSwitch() { + if (this.switchStatus === false) { + this.switchStatus = true; + } else { + this.switchStatus = false; + } + }, + }, }) const indexPage = new Vue({