Merge pull request #14 from Anankke/dev

merge
king_uim
Rico 8 years ago committed by GitHub
commit 55df0719bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,28 @@ 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));
}
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));
}
}

@ -374,6 +374,8 @@ $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');
$app->get('/getcredit', 'App\Controllers\VueController:getCredit');
/**
* chenPay

@ -33,6 +33,10 @@ a {
align-items: center;
}
.justify-center {
justify-content: center;
}
.wrap {
flex-wrap: wrap;
}
@ -49,6 +53,10 @@ a {
margin-bottom: 0 !important;
}
.relative {
position: relative;
}
[v-cloak] {
display: none;
}
@ -206,12 +214,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 +246,8 @@ input.checkbox {
border-color: #adadad;
}
.auth-submit {
.auth-submit,
.buy-submit {
border-radius: 3px;
color: #D1335B;
background: white;
@ -242,12 +258,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 +440,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 +454,11 @@ select {
.auth-tg {
margin-top: 2rem;
}
.auth-tg p {
padding: 0 2rem;
}
.auth-tg p a {
color: #D1335B;
}
@ -430,14 +466,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 +498,6 @@ select {
overflow: hidden;
color: #b1b3bb;
margin: .75rem 0;
transition: all .3s;
}
.font-light:hover {
@ -476,29 +511,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 +573,7 @@ select {
.input-copy input {
height: unset;
background: rgba(255,255,255,0);
background: rgba(255, 255, 255, 0);
cursor: pointer;
}
@ -529,7 +588,7 @@ select {
.user-invite input,
.btn-inline {
background: rgba(255,255,255,0);
background: rgba(255, 255, 255, 0);
}
.btn-inline {
@ -538,8 +597,8 @@ select {
border-radius: 3px;
font-size: 14px;
padding: .3rem .8rem;
transition: all .3s;
}
.btn-inline:hover {
background: #D1335B;
color: white;
@ -549,10 +608,62 @@ 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;
}
.order-checker-content {
margin: .5rem 0
}
@media screen and (min-width:35.5em) {
.auth-tg {
margin-top: 0;
}
.auth-sm a {
min-width: 120px;
}
@ -611,7 +722,8 @@ select {
padding-right: 3rem;
}
.ann {
.ann,
.user-shop {
max-height: 385px;
overflow: auto;
}
@ -763,7 +875,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 +900,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;
@ -804,6 +918,144 @@ 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;
align-items: center;
}
.uim-modal-footer div {
flex-basis: 50%;
}
.uim-modal-footer>div:first-of-type {
padding-left: 1.5rem;
}
.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;
}
/* 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;
@ -852,47 +1104,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);
}
}

@ -105,8 +105,10 @@
<uim-messager v-show="msgrCon.isShow">
<i slot="icon" :class="msgrCon.icon"></i>
<span slot="msg">$[msgrCon.msg]$</span>
<div v-if="msgrCon.html !== ''" slot="html" v-html="msgrCon.html"></div>
</uim-messager>
</transition>
</div>
</transition>
</div>
@ -147,13 +149,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,12 +208,29 @@ 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;
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',
@ -218,9 +238,16 @@ const tmp = new Vuex.Store({
logintoken: false,
msgrCon: {
msg: '操作成功',
html: '',
icon: ['fa','fa-check-square-o'],
isShow: false,
},
modalCon: {
isMaskShow: false,
isCardShow: false,
title: '订单确认',
bodyContent: '',
},
globalConfig: {
captchaProvider: '',
recaptchaSiteKey: '',
@ -254,10 +281,17 @@ 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;
},
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;
@ -285,13 +319,36 @@ 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);
},1000)
}
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) {
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);
}
},
},
modules: {
userState: UserTmp,
}
});
@ -299,9 +356,11 @@ var storeMap = {
store: tmp,
computed: Vuex.mapState({
msgrCon: 'msgrCon',
modalCon: 'modalCon',
globalConfig: 'globalConfig',
logintoken: 'logintoken',
isLoading: 'isLoading',
userCon: state => state.userState.userCon,
}),
}
@ -318,7 +377,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,
@ -531,6 +590,7 @@ const Login = {
let callConfig = {
msg: '',
icon: '',
time: 1000,
};
if (this.globalConfig.enableLoginCaptcha !== 'false') {
@ -550,7 +610,7 @@ 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';
@ -594,18 +654,19 @@ const Login = {
let callConfig = {
msg: '',
icon: '',
time: 1000,
};
_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';
@ -742,6 +803,7 @@ const Register = {
let callConfig = {
msg: '',
icon: '',
time: 1000,
};
if (this.globalConfig.isEmailVeryify === 'true') {
@ -772,7 +834,7 @@ 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';
@ -846,17 +908,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);
}
@ -933,11 +997,12 @@ const Reset = {
let callConfig = {
msg: '',
icon: '',
time: 1000,
};
_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';
@ -969,11 +1034,23 @@ const User = {
};
const userMixin = {
props: ['annC','thisuser','baseURL'],
delimiters: ['$[',']$'],
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: `
<div>
<div class="card-title">公告栏</div>
@ -985,19 +1062,18 @@ const UserAnnouncement = {
};
const UserInvite = {
delimiters: ['$[',']$'],
mixins: [userMixin],
mixins: [userMixin,storeMap],
template: /*html*/ `
<div>
<div class="card-title">邀请链接</div>
<div class="card-body">
<div class="user-invite">
<div v-if="thisuser.class !== 0">
<div v-if="userCon.class !== 0">
<input type="button" class="tips tips-blue" :value="inviteLink">
<h5>邀请链接剩余次数: <span class="invite-number tips tips-gold">$[thisuser.invite_num]$次</span></h5>
<h5>邀请链接剩余次数: <span class="invite-number tips tips-gold">$[userCon.invite_num]$次</span></h5>
</div>
<div v-else>
<h3>$[thisuser.user_name]$,您不是VIP暂时无法使用邀请链接,<slot name='inviteToShop'></slot></h3>
<h3>$[userCon.user_name]$,您不是VIP暂时无法使用邀请链接,<slot name='inviteToShop'></slot></h3>
</div>
</div>
</div>
@ -1014,28 +1090,182 @@ 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);
})
console.log(this.userCon);
});
}
};
const UserShop = {
mixins: [userMixin],
mixins: [userMixin,storeMap],
template: /*html*/ `
<div >
<div class="card-title">套餐购买</div>
<div>
<div class="pure-g">
<div class="pure-u-20-24 flex align-center">
<div class="card-title">套餐购买</div>
<transition name="fade" mode="out-in">
<label v-if="isCheckerShow" class="relative" for="">
<input class="coupon-checker tips tips-blue" v-model="coupon" type="text" placeholder="优惠码">
<button @click="couponCheck" class="btn-forinput" name="check"><span class="fa fa-arrow-up"></span></button>
<button @click="hideChecker" class="btn-forinput" name="reset"><span class="fa fa-refresh"></span></button>
</label>
</transition>
</div>
</div>
<div class="card-body">
<div class="shop"></div>
<div class="user-shop">
<div v-for="shop in shops" class="list-shop pure-g" :key="shop.id">
<div class="pure-u-20-24">
<span>$[shop.name]$</span>
<span class="tips tips-gold">VIP $[shop.details.class]$</span>
<span class="tips tips-green">¥$[shop.price]$</span>
<span class="tips tips-cyan">$[shop.details.bandwidth]$G<span v-if="shop.details.reset">+$[shop.details.reset_value]$G/($[shop.details.reset]$天/$[shop.details.reset_exp]$天)</span></span>
<span class="tips tips-blue">$[shop.details.class_expire]$天</span>
</div>
<div class="pure-u-4-24 text-right"><button :disabled="isDisabled" class="buy-submit" @click="buy(shop)">购买</button></div>
</div>
</div>
</div>
<transition name="fade" mode="out-in">
<uim-modal v-on:closeModal="callOrderChecker" v-on:callOrderChecker="orderCheck" :bindMask="isMaskShow" :bindCard="isCardShow" v-if="isMaskShow">
<h3 slot="uim-modal-title">$[modalCon.title]$</h3>
<div class="flex align-center justify-center wrap" slot="uim-modal-body">
<div class="order-checker-content">商品名称:<span>$[orderCheckerContent.name]$</span></div>
<div class="order-checker-content">优惠额度:<span>$[orderCheckerContent.credit]$</span></div>
<div class="order-checker-content">总金额:<span>$[orderCheckerContent.total]$</span></div>
</div>
<div class="flex align-center" slot="uim-modal-footer"><uim-switch @click.native="test" v-model="orderCheckerContent.disableothers"></uim-switch> <span class="switch-text">关闭旧套餐自动续费</span></div>
</uim-modal>
</transition>
</div>
`,
data: function() {
return {
shops: '',
isDisabled: false,
coupon: '',
isCheckerShow: false,
ajaxBody: {
shop: '',
autorenew: '',
},
isMaskShow: false,
isCardShow: false,
orderCheckerContent: {
name: '',
credit: '',
total: '',
disableothers: true,
},
}
},
methods: {
buy(shop) {
this.isDisabled = true;
this.isCheckerShow = true;
let callConfig = {
msg: '请输入优惠码,如没有请直接确认',
icon: 'fa-bell',
time: 1500,
};
tmp.dispatch('CALL_MSGR',callConfig);
let id = (shop.id).toString();
Vue.set(this.ajaxBody,'shop',id);
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
this.hideChecker();
}, 300);
}
},
couponCheck() {
let ajaxCon = {
coupon: this.coupon,
shop: this.ajaxBody.shop,
};
_post('/user/coupon_check',JSON.stringify(ajaxCon),'include').then((r)=>{
if (r.ret) {
this.isCheckerShow = false;
this.orderCheckerContent.name = r.name;
this.orderCheckerContent.credit = r.credit;
this.orderCheckerContent.total = r.total;
this.callOrderChecker();
} else {
let callConfig = {
msg: r.msg,
icon: 'fa-times-circle-o',
time: 1000,
};
tmp.dispatch('CALL_MSGR',callConfig);
}
});
},
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)=>{
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('</br>');
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() {
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 = {
mixins: [userMixin],
mixins: [userMixin,storeMap],
template: /*html*/ `
<div>
<div class="card-title">配置指南</div>
@ -1171,7 +1401,7 @@ const Panel = {
</div>
</div>
<transition name="fade" mode="out-in">
<component :is="currentCardComponent" :baseURL="baseUrl" :thisuser="userCon" :annC="ann" class="card margin-nobottom">
<component :is="currentCardComponent" :baseURL="baseUrl" :annC="ann" class="card margin-nobottom">
<button @click="componentChange" class="btn-inline" :data-component="menuOptions[3].id" slot="inviteToShop">成为VIP请点击这里</button>
</component>
</transition>
@ -1201,7 +1431,6 @@ const Panel = {
data: function() {
return {
userLoadState: 'beforeload',
userCon: '',
ann: {
content: '',
date: '',
@ -1433,8 +1662,9 @@ const Panel = {
let callConfig = {
msg: '',
icon: '',
time: 1000,
};
_get('/logout').then((r)=>{
_get('/logout','include').then((r)=>{
if (r.ret === 1) {
callConfig.msg += '账户成功登出Kira~';
callConfig.icon += 'fa-check-square-o';
@ -1460,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;
}
@ -1474,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(()=>{
@ -1569,7 +1799,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) {
@ -1608,7 +1838,7 @@ Vue.component('uim-messager',{
delimiters: ['$[',']$'],
template: /*html*/ `
<div class="uim-messager">
<div><slot name="icon"></slot><slot name="msg"></slot></div>
<div><slot name="icon"></slot><slot name="msg"></slot><slot name="html"></slot></div>
</div>
`,
})
@ -1681,6 +1911,58 @@ Vue.component('uim-dropdown',{
}
})
Vue.component('uim-modal',{
delimiters: ['$[',']$'],
mixins: [storeMap],
template:/*html*/ `
<div class="uim-modal">
<transition name="fade" mode="out-in">
<div v-show="bindMask" class="uim-modal-mask"></div>
</transition>
<transition name="slide-fade" mode="out-in">
<div v-show="bindCard" class="uim-modal-card">
<div @click="$emit('closeModal')" class="uim-modal-close"><span class="fa fa-close"></span></div>
<div class="uim-modal-title"><slot name="uim-modal-title"></slot></div>
<div class="uim-modal-body"><slot name="uim-modal-body"></slot></div>
<div class="uim-modal-footer">
<div><slot name="uim-modal-footer"></slot></div>
<div><button @click="$emit('callOrderChecker')" class="uim-modal-confirm">确认</button></div>
</div>
</div>
</transition>
</div>
`,
props: ['bindMask','bindCard'],
})
Vue.component('uim-switch',{
delimiters: ['$[',']$'],
model: {
prop: 'isBtnActive',
event: 'change',
},
props: ['isBtnActive'],
template:/*html*/ `
<span @click="btnSwitch" :class="{ 'uim-switch-body-active':switchStatus }" class="uim-switch-body">
<input :checked="isBtnActive" v-on:change="$emit('change',$event.target.checked)" type="checkbox">
</span>
`,
data: function() {
return {
switchStatus: this.isBtnActive,
}
},
methods: {
btnSwitch() {
if (this.switchStatus === false) {
this.switchStatus = true;
} else {
this.switchStatus = false;
}
},
},
})
const indexPage = new Vue({
router: Router,
el: '#index',

@ -794,12 +794,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<onekeysubBTN.length;i++) {
onekeysubBTN[i].addEventListener('click',()=>{

Loading…
Cancel
Save