提交 02cd9bd4 authored 作者: zyx's avatar zyx

合并冲突

......@@ -13,6 +13,18 @@ module.exports = {
},
devServer: {
proxy: {
// '/api/passport': {
// target: 'https://passport.ezijing.com',
// pathRewrite: {
// '^/api/passport': '/' // 需要rewrite重写的
// }
// },
// '/usercenter': {
// target: 'https://api-usercenter.ezijing.com',
// pathRewrite: {
// '^/usercenter': '/' // 需要rewrite重写的
// }
// }
/* 多个代理 */
// '/api': {
// target: $GLOBAL.webConf.url,
......@@ -32,10 +44,6 @@ module.exports = {
}
}
},
ProvidePlugin: {
},
others: {
}
ProvidePlugin: {},
others: {}
}
module.exports = {
url: '//api.ezijing.com',
url: '/api',
DesDir: './client-dist',
apiBaseURL: '//api.ezijing.com/',
apiBaseURL: '/api',
isUploadStatic: false,
webpack: {
externals: {
......
module.exports = {
url: 'https://transport2.ezijing.com/api',
DesDir: './client-dist',
// apiBaseURL: 'https://transport2.ezijing.com/api',
apiBaseURL: 'https://transport2.ezijing.com/api',
isUploadStatic: false,
webpack: {
externals: {
......
......@@ -94,7 +94,7 @@ export default class API {
const { status, data } = res.response
if (data) {
if (status === 402) {
window.G.$instance_vue.$router.push({
window.G.$instance_vue.$router.replace({
path: '/pay'
})
}
......
......@@ -9,6 +9,13 @@ export function getGoodsDetails(id) {
return httpRequest.get(`/zy/v2/mall/product/${id}`)
}
/**
* 获取我的购买订单
*/
export function getMyOrder() {
return httpRequest.get('/zy/v2/mall/order/my')
}
/* 模拟考试设置角色 */
export function setRole(data) {
return httpRequest.post('/zy/v2/examination/role', data, {
......
......@@ -47,6 +47,7 @@ export default {
.course-item-pic {
width: 2.4rem;
height: 1.35rem;
margin-right: 10px;
border-radius: 6px;
overflow: hidden;
margin-right: 0.2rem;
......@@ -66,6 +67,7 @@ export default {
overflow: hidden;
}
.course-item__text {
max-height: 0.68rem;
font-size: 0.26rem;
color: #999;
display: -webkit-box;
......
......@@ -50,6 +50,7 @@ export default {
.course-item-pic {
width: 2.4rem;
height: 1.35rem;
margin-left: 10px;
border-radius: 6px;
overflow: hidden;
img {
......
......@@ -39,7 +39,7 @@ export default {
},
methods: {
bindFocus() {
this.formInput.focus()
this.focus && this.formInput.focus()
},
onChange() {
this.$emit('input', this.currentValue)
......
......@@ -4,6 +4,9 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="origin" name="referrer">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>道路运输安全知识线上课</title>
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
</head>
......
......@@ -140,6 +140,9 @@ export default {
}
},
computed: {
isWeapp() {
return this.$store.state.isWeapp
},
swiper() {
return this.$refs.mySwiper.$swiper
}
......@@ -174,20 +177,19 @@ export default {
methods: {
async submitShowPop() {
const isLogin = await this.$store.dispatch('checkLogin')
console.log(isLogin)
if (!isLogin) {
if (this.isWeapp) {
// 小程序
wx.miniProgram.navigateTo({
url: `/pages/login/index?redirect_uri=${encodeURIComponent(
`/pages/web/index?src=${window.location.origin}/course/learn`
`/exam/result?type=${this.$route.query.type}&is_create=0&papersUrl=${this.$route.query.papersUrl}`
)}`
})
} else {
this.$router.push({
path: '/login',
query: {
redirect_uri: `/exam/answer?type=${this.$route.query.type}&is_create=0&papersUrl=${this.$route.query.papersUrl}`
redirect_uri: `/exam/result?type=${this.$route.query.type}&is_create=0&papersUrl=${this.$route.query.papersUrl}`
}
})
}
......@@ -376,7 +378,7 @@ export default {
},
initData(n) {
const param = this.requestParam
if (window.localStorage.userId) {
if (window.localStorage.userId !== 'undefined') {
param.user_id = window.localStorage.userId
}
Exam.getExam(param, this.requestParam.papersUrl).then(res => {
......
<template>
<div></div>
<div class="messages"></div>
</template>
<script>
import MessageCard from './messageCard.vue'
import * as api from '@/api/course.js'
export default {
props: {},
components: { MessageCard },
data() {
return {}
return {
messageList: []
}
},
getCourseTag() {
api.getCourseTag(this.courseId).then(response => {
console.log(response)
})
}
}
</script>
<style lang="scss" scoped>
.messages {
background: #eee;
}
</style>
<template>
<div class="message-card">
<div class="message-card-hd">
<div class="message-card__title">{{data.name}}</div>
</div>
<div class="message-card-bd">
<ul v-if="data.tag && data.tag.length">
<li v-for="item in data.tag" :key="item.id">{{item.title}}</li>
</ul>
</div>
<div class="message-card-ft">更多</div>
</div>
</template>
<script>
export default {
name: 'MessageCard',
props: {
data: { type: Object }
}
}
</script>
......@@ -6,6 +6,8 @@
<script>
export default {
mounted() {
},
methods: {
goExamResult(e) {
this.$router.replace({
......@@ -23,6 +25,7 @@ export default {
}
},
beforeDestroy() {
// this.$router.back()
window.localStorage.isBack = true
}
}
......
......@@ -115,7 +115,7 @@ export default {
}
},
mounted() {
this.getCourseChapterList()
// this.getCourseChapterList()
this.scrollDom()
this.init()
},
......@@ -128,7 +128,6 @@ export default {
if (isLogin) {
api.getExamStatus(param).then(res => {
if (res.status === '0' || res.status === '3') {
console.log(11111)
this.isExamPopTo = true
}
})
......@@ -193,18 +192,21 @@ export default {
async tab(e) {
const isLogin = await this.$store.dispatch('checkLogin')
console.log(isLogin)
if (!isLogin) {
if (this.isWeapp) {
// 小程序
wx.miniProgram.navigateTo({
url: `/pages/login/index?redirect_uri=${encodeURIComponent(
`/pages/web/index?src=${window.location.origin}/course/learn`
)}`
})
} else {
this.$router.push({ name: 'login' })
if (e === 1 || e === 2) {
this.getCourseChapterList()
if (!isLogin) {
if (this.isWeapp) {
// 小程序
wx.miniProgram.navigateTo({
url: `/pages/login/index?redirect_uri=${encodeURIComponent(
`/pages/web/index?src=${window.location.origin}/course/learn`
)}`
})
} else {
this.$router.push({ name: 'login' })
}
return
}
return
}
this.tabNav.navIndex = e
this.scrollDom()
......
......@@ -4,7 +4,10 @@
<div class="banner">
<van-swipe class="banner-swipe" :autoplay="3000" indicator-color="white">
<van-swipe-item>
<img src="../../assets/images/banner.png" />
<img src="../../assets/images/banner.png" @click="onClickNav('pay')" />
</van-swipe-item>
<van-swipe-item>
<img src="../../assets/images/banner.png" @click="onClickNav('examIndex')" />
</van-swipe-item>
</van-swipe>
</div>
......@@ -21,7 +24,7 @@
</li>
</ul>
</div>
<card title="课程试听" style="padding-bottom:40px;">
<card title="课程试听" style="padding-bottom:60px;">
<free-course-item v-for="item in courseList" :data="item" :key="item.course_id"></free-course-item>
</card>
</div>
......@@ -66,7 +69,8 @@ export default {
async onClickNav(name, requireLogin) {
const map = {
courseLearn: `/pages/web/index?src=${window.location.origin}/course/learn`,
examIndex: `/pages/web/index?src=${window.location.origin}/exam/index?isBack=1`
examIndex: `/pages/web/index?src=${window.location.origin}/exam/index?isBack=1`,
pay: `/pages/web/index?src=${window.location.origin}/pay`
}
const isLogin = requireLogin
? await this.$store.dispatch('checkLogin')
......@@ -101,6 +105,9 @@ export default {
</script>
<style lang="scss" scoped>
.main-container {
padding-bottom: env(safe-area-inset-bottom);
}
.banner {
height: 2.4rem;
img {
......@@ -126,4 +133,7 @@ export default {
height: 100%;
}
}
::v-deep .course-item:last-child {
border-bottom: 0;
}
</style>
......@@ -6,24 +6,24 @@
</h1>
<div class="login-box">
<div class="login-hd">
<h2 class="login-title">登录</h2>
<h2 class="login-title">绑定</h2>
</div>
<div class="login-bd">
<div class="login-form">
<!-- 账号登录 -->
<account-login ref="form" @submit="onSubmit"></account-login>
<!-- <account-login ref="form" @submit="onSubmit" v-if="!this.isWechat"></account-login> -->
<!-- 验证码登录 -->
<!-- <code-login ref="form" @submit="onSubmit"></code-login> -->
<div class="login-button" @click="handleSubmit">立即登录</div>
<code-login ref="form" @submit="onSubmit"></code-login>
<div class="login-button" @click="handleSubmit">立即绑定</div>
</div>
</div>
<div class="login-ft">
<!-- <div class="login-ft">
<ul>
<li @click="wechatLogin">
<img src="../../assets/images/login_wechat.png" alt="微信登录" />微信登录
</li>
</ul>
</div>
</div>-->
</div>
</div>
</template>
......@@ -40,16 +40,16 @@ export default {
const UA = navigator.userAgent.toLowerCase()
return {
ruleForm: {
type: 1,
type: 2,
account: '',
code: '',
password: '',
RememberMe: true,
service: 'https://h5.ezijing.com'
},
passwordVisible: false,
isWechat: /micromessenger/.test(UA),
unionid: Cookies.get('wechat_login_no_phone_error'),
redirectUrl: ''
unionid: Cookies.get('wechat_login_no_phone_error')
}
},
computed: {
......@@ -83,10 +83,13 @@ export default {
})
},
// 绑定微信并登录
bindWechat() {
const data = Object.assign({}, this.ruleForm, { unionid: this.unionid })
bindWechat(data) {
const params = Object.assign({}, this.ruleForm, data, {
unionid: this.unionid,
code: data.password
})
api
.bindWechat(data)
.bindWechat(params)
.then(response => {
this.loginSuccess(response)
})
......@@ -95,7 +98,7 @@ export default {
})
},
// 登录成功
loginSuccess(response) {
loginSuccess(response, delta = 2) {
if (response.code === 0) {
Cookies.remove('wechat_login_error', { domain: '.ezijing.com' })
Cookies.remove('wechat_login_no_phone_error', {
......@@ -104,7 +107,7 @@ export default {
this.$store.commit('setToken', response.data.TGC)
if (this.isWeapp) {
wx.miniProgram.postMessage({ data: { token: response.data.TGC } })
wx.miniProgram.navigateBack()
wx.miniProgram.navigateBack({ delta })
return
}
if (this.redirectURI) {
......@@ -119,7 +122,7 @@ export default {
wechatLogin() {
const appId = 'wx451c01d40d090d7a'
// 回调地址
const redirectURI = `https://passport.ezijing.com/rest/wechat/oauth-callback?needCheck=false&identity=transport&redirectUrl=${window.location.origin}/login`
const redirectURI = `https://passport.ezijing.com/rest/wechat/oauth-callback?needCheck=false&identity=transport&redirectUrl=${window.location.href}`
// 微信的地址
const wechatUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(
redirectURI
......@@ -134,14 +137,16 @@ export default {
)
}
},
async created() {
const isLogin = await this.$store.dispatch('checkLogin')
console.log(!this.checkWechatLogin(), '==============')
if (!isLogin) {
if (this.isWechat && !this.checkWechatLogin()) {
this.wechatLogin()
beforeMount() {
this.$store.dispatch('checkLogin').then(isLogin => {
if (isLogin) {
this.loginSuccess({ code: 0, data: { TGC: Cookies.get('TGC') } }, 1)
} else {
if (this.isWechat && !this.checkWechatLogin()) {
this.wechatLogin()
}
}
}
})
}
}
</script>
......
<template>
<div>
<div class="order-list">
<ul>
<li>
<div class="order-info">
<img src="../../assets/images/tx.png" alt="">
<div class="txt">
课程标题道路旅客运输企业课
程标题道路旅客运输企业
</div>
</div>
<div class="deti">
<div class="tit">课程状态:</div>
<div class="val">已付款/未付款</div>
</div>
<div class="deti">
<div class="tit">共计:</div>
<div class="val">$199.00</div>
</div>
<div class="deti">
<div class="val col">
继续购买
</div>
</div>
</li>
</ul>
</div>
</div>
</template>
<script>
import * as api from '@/api/pay.js'
export default {
mounted() {
this.getMyOrder()
},
methods: {
getMyOrder() {
api.getMyOrder().then(res => {
console.log(res)
})
}
}
}
</script>
<style lang="scss" scoped>
.order-list{
li{
padding: .1rem .4rem;
margin-bottom: .4rem;
}
.order-info{
display: flex;
img{
width: 2.4rem;
height: 2.4rem;
display: block;
}
.txt{
margin-left: .2rem;
font-size: .3rem;
color: #222;
word-wrap: break-word;
}
}
.deti{
display: flex;
margin-bottom: .4rem;
.tit{
font-size: .26rem;
color: #222;
}
.val{
font-size: .26rem;
color: #222;
margin-left: auto;
}
.col{
color: #FF6767;
font-size: .3rem;
}
}
}
</style>
<template>
<van-button type="default" @click="logout">退出登录</van-button>
<div>
<div class="info-box">
<img src="../../assets/images/tx.png" alt="">
<div class="name">点击登录</div>
</div>
<ul>
<li v-for="(item, index) in navList" :key="index" @click="go(item.url)">
<div class="title">{{ item.title }}</div>
<van-icon name="arrow" class="icon"/>
</li>
</ul>
<!-- <van-button type="default" @click="logout">退出登录</van-button> -->
</div>
</template>
<script>
import { logout } from '@/api/account.js'
export default {
name: 'my',
data() {
return {
navList: [
{
title: '已购课程',
url: '/my/buyCourses'
},
{
title: '已做试题',
url: '/my/buyCourses'
},
{
title: '已学课程',
url: '/my/buyCourses'
},
{
title: '消息/通知',
url: '/my/buyCourses'
},
{
title: '意见反馈',
url: '/my/buyCourses'
}
]
}
},
methods: {
logout() {
logout().then(response => {
this.$toast('退出成功')
})
},
go(url) {
this.$router.push(url)
}
}
}
</script>
<style lang="scss" scoped>
.info-box{
display: flex;
align-items: center;
height: 2rem;
img{
width: 1.2rem;
height: 1.2rem;
margin:0 .2rem 0 .4rem;
}
.name{
font-size: .34rem;
color: #222;
}
}
ul{
padding: 0 .4rem;
li{
height: 1.1rem;
border-bottom: .01rem solid rgba(238,238,238,1);
display: flex;
align-items: center;
.title{
font-size: .3rem;
color: #222;
}
.icon{
margin-left: auto;
}
}
li:last-child{
border: none;
}
}
</style>
......@@ -5,8 +5,7 @@
</div>
</template>
<script>
import Cookies from 'js-cookie'
import * as api from '@/api/pay.js'
// import * as api from '@/api/pay.js'
export default {
components: {
},
......@@ -22,14 +21,20 @@ export default {
}
},
mounted() {
console.log(Cookies.get('TGC'))
this.getOpenid()
this.getGoodsDetail()
},
methods: {
getOpenid() {
console.log(window.G, '======')
// api.getOpenid().then(res => {
// console.log(res)
// })
},
getGoodsDetail() {
api.getGoodsDetails('6682927830365372416').then(res => {
console.log(res)
})
// api.getGoodsDetails('6682927830365372416').then(res => {
// console.log(res)
// })
},
goPay () {
this.VueEvent.$emit('pay-wx-h5', {
......
<template>
<div class="main-list">
<ul v-if="list.length">
<li v-for="item in list" :key="item.course_id">{{item.chapter_name}}</li>
<li v-for="item in list" :key="item.course_id" @click="onClick(item)">{{item.course_name}}</li>
</ul>
<template v-else>
<slot name="empty">
......@@ -46,6 +46,9 @@ export default {
// 刷新
refresh() {
this.getList()
},
onClick(data) {
this.$router.push({ name: 'courseLearnItem', params: { id: data.id } })
}
},
beforeMount() {
......
<template>
<div class="main-list">
<ul v-if="list.length">
<li v-for="item in list" :key="item.id">{{item.title}}</li>
<li v-for="item in list" :key="item.id" @click="onClick">{{item.title}}</li>
</ul>
<template v-else>
<slot name="empty">
......@@ -46,6 +46,10 @@ export default {
// 刷新
refresh() {
this.getList()
},
onClick() {
window.alert('开发中')
// this.$router.push({ name: 'courseLearnItem', params: { id } })
}
},
beforeMount() {
......
......@@ -2,7 +2,7 @@
<div class="main-list">
<template v-if="list.length">
<ul>
<li v-for="item in list" :key="item.id">{{item.chapter_name}}</li>
<li v-for="item in list" :key="item.id" @click="onClick(item)">{{item.chapter_name}}</li>
</ul>
</template>
<template v-else>
......@@ -39,6 +39,11 @@ export default {
}
}
},
computed: {
isWeapp() {
return this.$store.state.isWeapp
}
},
methods: {
getList() {
api.getCourseVideoSearchList(this.requestParams).then(response => {
......@@ -48,6 +53,15 @@ export default {
// 刷新
refresh() {
this.getList()
},
onClick(data) {
if (this.isWeapp) {
wx.miniProgram.navigateTo({
url: `/pages/course/item?id=${data.course_id}&chapter_id=${data.id}`
})
} else {
window.alert('请在微信小程序中打开')
}
}
},
beforeMount() {
......
......@@ -76,6 +76,12 @@ export default [
name: 'my',
component: () => import('../pages/my/index.vue')
},
// 我的-已购课程
{
path: '/my/buyCourses',
name: 'buyCourses',
component: () => import('../pages/my/buyCourses.vue')
},
// 支付
{
path: '/pay',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论