Commit 465e9148 authored by IvyXia123's avatar IvyXia123

20191009-打卡

parent ae07b3e9
This diff is collapsed.
<template>
<div class="guidelines">
<div class="zhiying" v-if="micromessenger == 0">
<img :src="zhiying" alt="">
</div>
</div>
</template>
<script>
import common from '../../util/common'
import zhiying from "../../assets/punchTheClock/zhiying.png"
import zhufubao from "../../assets/punchTheClock/zhifubaotup.png"
export default {
name: "guidelines",
data() {
return {
micromessenger: 0, // 判断在微信里还是在浏览器里
zhiying: zhiying, // 图片
zhufubao: zhufubao
}
},
mounted() {
// 0 -> 微信 1 -> 支付宝
this.micromessenger = common.isWeixinBrowser()
// 到浏览器里支付宝支付
if (this.micromessenger == 1) {
location.href = this.$route.query.pay_url
}
}
}
</script>
<style scoped lang="less">
@import "../../util/public";
.guidelines {
width: 100%;
height: 100%;
padding-top: 3 * @toVw;
background: #F3F2F7;
text-align: center;
.zhiying {
width: 244 * @toVw;
height: 361 * @toVw;
margin-left: 112 * @toVw;
box-sizing: border-box;
img {
width: 100%;
height: 100%;
}
}
}
</style>
......@@ -11,7 +11,7 @@
<div class="punch-the-clock-name-bg">
<div class="punch-the-clock-name-content">
<!-- 倒计时 hasEnded 指是否在规定时间内完成学习 -->
<div class="punch-the-clock-name-contentText" v-if="!hasEnded && forthRate != 100">很遗憾,您未在指定时间内完成任务哦</div>
<div class="punch-the-clock-name-contentText" v-if="!hasEnded">很遗憾,您未在指定时间内完成任务哦</div>
<div class="punch-the-clock-name-content-timer" v-if="hasEnded">
<span>剩余完成时间</span>
<span class="timer">{{ countDownDay }}</span>
......
......@@ -10,12 +10,10 @@ import VueClipboard from 'vue-clipboard2'
import sa from 'sa-sdk-javascript';
import 'mint-ui/lib/style.css'
import scroll from "./base/scroll/scroll"
import {Popup, Lazyload, Button, Dialog, Toast} from 'vant';
import {getBillRefreshApi, getStatusWechatApi,getCourseInfoApi} from './service/api'
import './util/vancs.less'
import { Popup, Lazyload, Button, Dialog, Toast } from 'vant';
import * as fundebug from 'fundebug-javascript';
import fundebugVue from 'fundebug-vue';
fundebug.apikey = '4d414770c72b034dfa896048206a72258ede4e4ad5f9c6c4320d19b7f91a567e';
fundebugVue(fundebug, Vue);
......@@ -48,62 +46,12 @@ Vue.prototype.$sa.quick('autoTrack')
Vue.use(VueClipboard);
Vue.use(Popup).use(Lazyload).use(Button).use(Dialog).use(Toast);
Vue.component('scroll', scroll);
// 支付宝支付完成,订单状态查询
let timer = null;
if (window.localStorage.out_trade_no) {
timer = setInterval(() => {
let outTradEno = JSON.parse(window.localStorage.out_trade_no);
getBillRefreshApi({outTradeNo: outTradEno.out_trade_no}).then(res => {
// 支付成功
if (res.status === "SUCCESS") {
getCourseInfoApi().then(response => {
this.userCourse = JSON.parse(JSON.stringify(response));
console.log(this.userCourse)
localStorage.setItem("userCourse", JSON.stringify(this.userCourse));
localStorage.setItem("buyindex", 1);
Dialog.confirm({title: '标题', message: '支付成功', confirmButtonText: '去查看'}).then(() => {
if (response.teacher_alias && response.teacher_alias.substr(0, 1) == 1 && outTradEno.goods_type != 4 && outTradEno.is_subscribe == 1) {
clearInterval(timer);
router.push({ name: "guide", query: {shopId: outTradEno.shopId} });
localStorage.removeItem('out_trade_no')
}else {
if (res.buy_type == 1) {
clearInterval(timer);
router.push({name: "buySuccess", query: outTradEno});
localStorage.removeItem('out_trade_no')
} else {
clearInterval(timer);
router.push({name: "success", query: outTradEno});
localStorage.removeItem('out_trade_no')
}
}
}).catch(() => {
clearInterval(timer);
localStorage.removeItem('out_trade_no')
});
});
} else if (res.status === "NO_SYNC") {
Dialog.confirm({title: '标题', message: '您有一笔未支付的订单', confirmButtonText: '去查看'}).then(() => {
clearInterval(timer);
location.href = `http://${window.location.host}/#/guidelines?pay_url=${encodeURI(window.localStorage.pay_url)}`
localStorage.removeItem('out_trade_no')
}).catch(() => {
clearInterval(timer);
localStorage.removeItem('out_trade_no')
});
}
})
}, 6000)
}
// 全局错误日志
const errorHandler = (error, vm) => {
Vue.prototype.$post(`api/client/report/errors/log`, {'routes_url': vm.$route.name, 'result_text': error.toString()})
const errorHandler = (error, vm)=>{
Vue.prototype.$post(`api/client/report/errors/log`,{'routes_url':vm.$route.name,'result_text':error.toString()})
}
Vue.config.errorHandler = errorHandler;
Vue.prototype.$throw = (error) => errorHandler(error, this);
Vue.prototype.$throw = (error)=> errorHandler(error,this);
Vue.prototype.$common = common
//VConsole关闭屏蔽代码
if (process.env.NODE_ENV != 'production') {
......@@ -122,16 +70,13 @@ router.beforeEach((to, from, next) => {
}
})
new Vue({
el: '#app',
router,
store,
components: {App},
components: { App },
template: '<App/>'
});
if (!Array.prototype.find) {
Array.prototype.find = function (predicate) {
'use strict';
......
......@@ -39,6 +39,7 @@ const router = new Router({
deep: 0,
}
},
{
path: '/extensionV1Shop',
name: 'extensionV1Shop',
......@@ -570,12 +571,6 @@ const router = new Router({
name: 'punchTheClock',
component: e => require(['@/components/punchTheClock'], e)
},
// 微信跳转支付宝
{
path: '/guidelines',
name: 'guidelines',
component: e => require(['@/components/buy/guidelines'], e)
},
{
path: '*',
component: () => import('@/components/error'),
......@@ -604,16 +599,6 @@ router.beforeEach((to, from, next) => {
next({ name: 'noWechat', query: { url: encodeURIComponent(to.fullPath) } });
}
}
/*let micromessenger = common.isWeixinBrowser();
if(micromessenger == 2){
alert(micromessenger);
alert(999999)
// location.href = `http://${ window.location.host }/#/guidelines`
next({ path: 'guidelines' })
return false;
}*/
// 移动端判断
store.dispatch('isMobile', browser.versions.mobile);
// 默认title
......@@ -625,9 +610,9 @@ router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title;
}
let goOn = function () {
if (localStorage.getItem('retUrl') && localStorage.getItem('retUrl') !== null && localStorage.getItem('retUrl') !== '') {
console.log(localStorage.getItem('retUrl'))
let retUrl = localStorage.getItem('retUrl').toString();
localStorage.removeItem('retUrl');
next(retUrl);
......@@ -636,30 +621,22 @@ router.beforeEach((to, from, next) => {
}
};
if (window.location.href.indexOf('gdt_vid') > -1) {
console.log(3333333, common.getUrlParam())
localStorage.setItem('gdt_vid', common.getUrlParam().gdt_vid);
localStorage.setItem('cct_user_id', common.getUrlParam().cct_user_id);
localStorage.setItem('redeem_code', common.getUrlParam().cct_user_id);
// localStorage.setItem('redeem_code', common.getParamhref().redeem_code);
}
// 在支付宝里跳转
let micromessenger = common.isWeixinBrowser();
if(micromessenger == 2){
// alert("支付成功啦,请回到唱唱公众号继续操作!")
// location.href = "https://wechat-pre.changchangenglish.com/#/weixin"
location.href = "https://static-cdn.changchangenglish.com/public/images/alipay_success.png"
// location.href = "https://www.changchangenglish.com/zhifubao.html"
return ;
}
// extensionV1Shop
// extensionV1
if (to.name === 'starRankV2' || to.name === 'order' || to.name === 'buySuccess' || to.name === 'success' || to.name === 'guidelines' || to.name === 'spcShop' || to.name === 'mpShop' || to.name === 'extensionV1Shop' || to.name === 'extensionV1' || to.name === 'author' || to.name === 'bindMobile' || to.name === 'noWechat' || to.name === 'inspectorActivit' || to.name === 'buyDetail'|| to.name === 'passShop'|| to.name === 'ybIndex' ) {
if (to.name === 'spcShop' || to.name === 'mpShop' || to.name === 'extensionV1Shop' || to.name === 'extensionV1' || to.name === 'author' || to.name === 'bindMobile' || to.name === 'noWechat' || to.name === 'inspectorActivit' || to.name === 'buyDetail'|| to.name === 'passShop'|| to.name === 'ybIndex' ) {
// 无需登录的页面
console.log(899, to.name)
console.log(488)
next()
} else if (window.location.href.indexOf('token') > -1 && to.name === 'index') {
console.log(99000)
let token = common.getUrlParam().token || to.query.token;
console.log(common.getUrlParam())
console.log(to.name)
// debugger
store.dispatch('setToken', token);
getUserDetailApi().then(res => {
......
......@@ -431,8 +431,3 @@ const getNewCashUrl = `${_baseUrl}api/client/new/return/cash/`
export const getNewCashApi = function (element_id, category_id, periods_id, json) {
return Vue.prototype.$fetch(`${getNewCashUrl}${element_id}/${category_id}/${periods_id}`, json)
};
const getBillRefreshUrl = `${_baseUrl}api/client/bill/refresh`
export const getBillRefreshApi = function (json) {
return Vue.prototype.$fetch(getBillRefreshUrl, json)
};
......@@ -118,32 +118,5 @@ export default {
}
}
return newObj;
},
/**
* 判断是否在那个浏览器里
* @returns {number}
*/
isWeixinBrowser() {
var ui = 0
// 0 -> 微信 2 -> 支付宝 1 -> 其他
if (/MicroMessenger/.test(window.navigator.userAgent)) {
ui = 0
} else if (/AlipayClient/.test(window.navigator.userAgent)) {
ui = 2
} else {
ui = 1
}
return ui;
},
/**
* 获取链接后的参数
* @param name
* @param url
* @returns {RegExpExecArray | string}
*/
getParamByName(name, url) {
url = url || window.location;
var match = RegExp('[?&]' + name + '=([^&]*)').exec(url);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '))
}
}
.van-dialog {
border-radius: 15px;
padding-bottom: 25px;
.van-dialog__header {
opacity: 0;
}
.van-button__text {
display: inline-block;
width: 98px;
height: 44px;
color: #FFFFFF;
border-radius: 25px;
}
[class*=van-hairline]::after {
border: none
}
.van-button::before {
}
border-color: transparent;
//background-color: transparent;
.van-dialog__cancel {
.van-button__text {
background: #97A0BB;
}
}
.van-dialog__confirm {
.van-button__text {
background: #40A9FF;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment