提交 2b83926d authored 作者: haodaking's avatar haodaking

Merge branch 'master' into sofia

......@@ -87,6 +87,11 @@ export default class API {
*/
_reqSuccess(res) {
const { data } = res
// token 失效
if (data.code === 1001) {
window.location.href = `${webConf.others.loginUrl}?rd=${encodeURIComponent(window.location.href)}`
return Promise.reject(data)
}
/* 带 code 参数,新接口模型 */
if (data.code !== undefined) {
if (data.code !== 0 && !/getinfo$/gi.test(res.config.url)) {
......
......@@ -117,3 +117,17 @@ export function getGraduationProductList(data) {
export function mergeGraduationProduct(data) {
return httpRequest.post('/api/pay/v1/product/create-by-details', data)
}
/**
* 创建订单
* */
export function createOrder(data) {
return httpRequest.post('/api/shop/order/add', data, { headers: { 'Content-Type': 'application/json' } })
}
/**
* 获取订单
* */
export function getOrderList(data) {
return httpRequest.post('/api/shop/order/search', data, { headers: { 'Content-Type': 'application/json' } })
}
......@@ -29,7 +29,7 @@ import QrcodeVue from 'qrcode.vue'
export default {
props: {
payment: { type: String }, // 支付方式
productId: { type: String, required: true }, // 商品ID
product: { type: Object, required: true }, // 商品信息
num: { type: [Number, String], default: 1 } // 购买数量
},
components: { QrcodeVue },
......@@ -42,33 +42,45 @@ export default {
},
computed: {
qrcodeValue() {
return this.order.url
return this.order.payment_url
},
pid() {
return this.$route.params.id
},
notifyUrl() {
return `${webConf.apiBaseURL}/api/lms/v2/lobby/update-status-api/${this.pid}/sofia`
return `${webConf.apiBaseURL}/api/lms/v2/lobby/update-status-api/${this.pid}`
}
},
methods: {
// 创建微信订单
createWxPayOrder(productId, num = 1) {
return api.createWxpayOrder('ezijing', productId, { num, notify_url: this.notifyUrl }).then(response => {
this.order = response
return response
})
},
// 创建支付宝订单
createAliPayOrder(productId, num = 1) {
return api.createAlipayOrder(productId, { type: 2, num, notify_url: this.notifyUrl }).then(response => {
// 创建订单
createOrder() {
// 支付类型(1:微信扫码支付,2:微信小程序支付,3:微信JSAPI支付,4:微信h5支付,11:支付宝扫码支付,12:支付宝手机网站支付,13:支付宝网站支付)
const payment = { 1: '11', 2: '1' }
const params = {
buy_count: this.num + '',
payment_method: payment[this.payment],
shop_id: this.product.shop_id,
spu_id: this.product.spu_id,
sku_id: this.product.sku_id,
notify_url: this.notifyUrl
}
return api.createOrder(params).then(response => {
if (response.code === 0) {
this.order = response
} else {
this.$message.error(response.msg)
}
return response
})
},
getOrder() {
return api.getOrder(this.order.order_no).then(response => {
const { order } = response
const params = {
shop_id: this.product.shop_id,
spu_id: this.product.spu_id,
order_id: this.order.order_id
}
return api.getOrderList(params).then(response => {
const [order = {}] = response.data
this.rawOrder = order
return order
})
......@@ -77,7 +89,7 @@ export default {
this.timer = setInterval(() => {
this.getOrder().then(response => {
// 支付成功
if (response.status === 1) {
if (response.order_status === '4') {
this.$emit('success')
this.clearTimer()
}
......@@ -89,13 +101,8 @@ export default {
}
},
mounted() {
if (this.payment === '2') {
// 微信支付
this.createWxPayOrder(this.productId, this.num).then(this.setTimer)
} else if (this.payment === '1') {
// 支付宝支付
this.createAliPayOrder(this.productId, this.num).then(this.setTimer)
}
if (this.payment === '3') return
this.createOrder().then(this.setTimer)
},
destroyed() {
this.clearTimer()
......
......@@ -89,7 +89,7 @@ export default {
methods: {
getTypes() {
api.getAffairType().then(response => {
response = response.concat([{ affair_name: '毕业典礼', form_name: 'graduation', id: 'graduation' }])
// response = response.concat([{ affair_name: '毕业典礼', form_name: 'graduation', id: 'graduation' }])
const [first = {}] = response
this.active = first
this.types = response
......
......@@ -34,8 +34,7 @@
</el-form-item>
<el-form-item label="需打印份数" prop="number">
<el-select v-model="ruleForm.number" :disabled="isPaid">
<el-option v-for="item in productList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
<el-option v-for="item in productList" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="支付方式" prop="payment">
......@@ -64,9 +63,7 @@
</el-form-item>
</template>
<el-form-item v-if="!this.isView">
<el-button type="primary" :loading="submitLoading" @click="handleSubmit(handleSubmitSuccess)" v-if="!isPaid"
>去支付</el-button
>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit(handleSubmitSuccess)" v-if="!isPaid">去支付</el-button>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit" v-else>保存并提交</el-button>
<el-button type="info" @click="onRemove" v-if="hasAbort">撤回申请</el-button>
</el-form-item>
......@@ -75,7 +72,7 @@
</div>
<el-dialog title="支付" width="400px" :visible.sync="payVisible">
<pay :payment="ruleForm.payment" :productId="productId" @success="handlePaySuccess" v-if="payVisible"></pay>
<pay :payment="ruleForm.payment" :product="product" @success="handlePaySuccess" v-if="payVisible"></pay>
</el-dialog>
</div>
</template>
......@@ -111,9 +108,9 @@ export default {
email: [{ required: true, message: '请输入邮寄地址', trigger: 'blur' }]
},
productList: [
{ label: '1份—¥127元', value: '1', product_id: '6747325185390542848' },
{ label: '2份—¥203元', value: '2', product_id: '6747325279879823360' },
{ label: '3份—¥278元', value: '3', product_id: '6747325351686307840' }
{ label: '1份—¥127元', value: '1', shop_id: '6816247184455892992', spu_id: '6869466274636759040', sku_id: '6869466274674507776' },
{ label: '2份—¥203元', value: '2', shop_id: '6816247184455892992', spu_id: '6869466274636759040', sku_id: '6869466274737422336' },
{ label: '3份—¥278元', value: '3', shop_id: '6816247184455892992', spu_id: '6869466274636759040', sku_id: '6869466274800336896' }
],
payVisible: false
}
......@@ -129,9 +126,8 @@ export default {
}
},
computed: {
productId() {
const found = this.productList.find(item => item.value === this.ruleForm.number)
return found ? found.product_id : ''
product() {
return this.productList.find(item => item.value === this.ruleForm.number)
}
},
methods: {
......
......@@ -3,15 +3,7 @@
<div class="con-title">重修申请</div>
<div class="con-box">
<el-button type="text" @click="goBack">返回列表</el-button>
<el-form
ref="ruleForm"
:model="ruleForm"
:rules="rules"
:disabled="isView"
label-width="100px"
class="main-form"
v-loading="loading"
>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" :disabled="isView" label-width="100px" class="main-form" v-loading="loading">
<el-form-item label="姓名" prop="personal_name">
<el-input v-model="ruleForm.personal_name" :disabled="disabledInfo" readonly />
</el-form-item>
......@@ -22,22 +14,14 @@
<el-input v-model="ruleForm.sofia_id" :disabled="disabledInfo" readonly />
</el-form-item>
<el-form-item label="重修时间" prop="semester_name">
<el-radio-group
v-model="ruleForm.semester_name"
:disabled="disabledInfo"
style="line-height: 30px; margin-top: 10px"
>
<el-radio-group v-model="ruleForm.semester_name" :disabled="disabledInfo" style="line-height: 30px; margin-top: 10px">
<div v-for="item in semesterList" :key="item.value">
<el-radio :label="item.value"></el-radio>
</div>
</el-radio-group>
</el-form-item>
<el-form-item label="重修课程" prop="course_id">
<el-checkbox-group
v-model="ruleForm.course_id"
:disabled="disabledInfo"
style="line-height: 24px; margin-top: 10px"
>
<el-checkbox-group v-model="ruleForm.course_id" :disabled="disabledInfo" style="line-height: 24px; margin-top: 10px">
<div v-for="item in currentCourseList" :key="item.id">
<el-checkbox :label="item.id">{{ item.course_name }}</el-checkbox>
</div>
......@@ -81,13 +65,7 @@
</div>
<el-dialog title="支付" width="400px" :visible.sync="payVisible">
<pay
:payment="ruleForm.payment"
:productId="productId"
:num="detail.form.credit"
@success="handlePaySuccess"
v-if="payVisible"
></pay>
<pay :payment="ruleForm.payment" :product="product" :num="detail.form.credit" @success="handlePaySuccess" v-if="payVisible"></pay>
</el-dialog>
</div>
</template>
......@@ -118,7 +96,7 @@ export default {
},
courseList: [], // 课程列表
submitedCourseList: [], // 提交的课程列表
productId: '6745273257873637376', // 商品ID
product: { shop_id: '6816247184455892992', spu_id: '6869463821962969088', sku_id: '6869463822004912128' }, // 商品
payVisible: false
}
},
......@@ -184,14 +162,7 @@ export default {
})
}
// 设置表单数据
const ruleForm = this.$_.pick(response.form, [
'personal_name',
'class_name',
'sofia_id',
'semester_name',
'course_id',
'payment'
])
const ruleForm = this.$_.pick(response.form, ['personal_name', 'class_name', 'sofia_id', 'semester_name', 'course_id', 'payment'])
Object.assign(this.ruleForm, ruleForm)
// 设置接口返回的数据
this.detail = response
......
......@@ -186,3 +186,13 @@ export function getChapterHomeworkOtherAll(semesterId, courseId, chapterId, para
export function addChapterHomeworkComment(data) {
return httpRequest.post('/api/lms/v2/education/homeworks/comment', data)
}
/**
* 我收到的评论
* @param {string} semesterId 学期ID
* @param {string} courseId 课程ID
* @param {string} chapterId 章节ID
*/
export function getChapterHomeworkComment(params) {
return httpRequest.get('/api/lms/v2/education/homeworks/fmcomment', params)
}
......@@ -62,10 +62,12 @@
</div>
</template>
</container>
<!-- 我收到的作业评论 -->
<chapter-work-comment-to-me :id="detail.id" v-if="showComment"></chapter-work-comment-to-me>
<!-- 评论同学作业 -->
<chapter-work-comment
id="comment"
:endDate="commentEndDate"
:endTime="commentEndTime"
:status="detail.status2"
@update="$emit('updateHomework')"
v-if="showComment"
......@@ -122,13 +124,14 @@ import Base64 from 'Base64'
import Container from '../common/container.vue'
import ExamItem from './examItem.vue'
import ChapterWorkComment from './chapterWorkComment.vue'
import ChapterWorkCommentToMe from './chapterWorkCommentToMe.vue'
// api
import * as api from '../../api'
// 章节作业
export default {
name: 'ChapterWork',
components: { Container, ExamItem, ChapterWorkComment },
components: { Container, ExamItem, ChapterWorkComment, ChapterWorkCommentToMe },
props: {
// 当前选中的
chapter: { type: Object, default: () => ({}) },
......@@ -148,7 +151,9 @@ export default {
hasUpload: true, // 是否可以上传
isAnonymous: false, // 是否匿名
hasComment: false, // 是否评论
commentEndDate: '',
commentStartTime: '', // 评论开始时间
commentEndTime: '', // 评论结束时间
serverTime: Date.now(), // 服务器时间
rules: {
user_answer: [{ required: true, message: '请输入', trigger: 'change' }]
},
......@@ -208,8 +213,8 @@ export default {
return true
}
// 大于开始时间,小于结束时间
const endTime = +new Date(this.deadline)
const currentTime = new Date().getTime()
const endTime = +new Date(this.deadline.replace(/-/g, '/'))
const currentTime = +new Date(this.serverTime.replace(/-/g, '/'))
return currentTime < endTime
},
hasScore() {
......@@ -218,16 +223,20 @@ export default {
},
// 显示作业评论
showComment() {
const currentTime = new Date().getTime()
const endTime = +new Date(this.deadline)
return this.hasComment && currentTime > endTime && this.detail.status !== 1
},
disabled() {
if (this.detail.status === 1) {
if (!this.detail.id) {
return false
}
// -1未处理 0已处理 1驳回
return this.detail.status === 0 || !this.isWorkTime
const currentTime = +new Date(this.serverTime.replace(/-/g, '/'))
const startTime = +new Date(this.commentStartTime.replace(/-/g, '/'))
return this.hasComment && currentTime >= startTime && this.detail.status !== 1
},
disabled() {
return this.detail.status === 0
// if (this.detail.status === 1) {
// return false
// }
// // -1未处理 0已处理 1驳回
// return this.detail.status === 0 || !this.isWorkTime
},
dialogTitle() {
if (this.detail.status === 1 && this.detail.status2 === 1) {
......@@ -249,7 +258,9 @@ export default {
this.hasUpload = response.pdf !== 0
this.isAnonymous = !!response.anonymous
this.hasComment = !!response.comment
this.commentEndDate = response.comment_end
this.commentStartTime = response.comment_begin
this.commentEndTime = response.comment_end
this.serverTime = response.server_time
})
},
// 组装问题数据
......
......@@ -11,13 +11,7 @@
ref="form"
>
<el-form-item prop="comment">
<chapter-work-comment-item
:data="item"
:index="index"
:endDate="endDate"
:disabled="disabled"
:key="item.id"
/> </el-form-item
<chapter-work-comment-item :data="item" :index="index" :disabled="disabled" :key="item.id" /> </el-form-item
></el-form>
</template>
<div class="button" v-if="status !== 0">
......@@ -25,7 +19,7 @@
$t('viewerWork.commentSubmitText')
}}</el-button>
<p v-if="status === 1">注:重新提交后不可修改,请检查好作业内容再做提交。</p>
<p v-else>{{ $t('viewerWork.commentSubmitTips', { date: endDate }) }}</p>
<p v-else>{{ $t('viewerWork.commentSubmitTips', { date: endTime }) }}</p>
</div>
<slot></slot>
<div class="more">
......@@ -45,7 +39,7 @@ import ChapterWorkCommentItem from './chapterWorkCommentItem.vue'
export default {
components: { Container, ChapterWorkCommentItem },
props: { endDate: { type: String }, status: { type: Number } },
props: { endTime: { type: String }, status: { type: Number } },
data() {
return {
list: [],
......@@ -70,17 +64,20 @@ export default {
},
isSubmitTime() {
// 大于开始时间,小于结束时间
const endTime = +new Date(this.endDate)
const endTime = +new Date(this.endTime.replace(/-/g, '/'))
const currentTime = new Date().getTime()
return currentTime < endTime
},
// 是否禁用
disabled() {
// -1未处理 0已处理 1驳回
if (this.status === 1) {
return false
if (this.status === 0) {
return true
}
return !this.isSubmitTime
// -1未处理 0已处理 1驳回
// if (this.status === 1) {
// return false
// }
// return !this.isSubmitTime
}
},
methods: {
......
......@@ -11,7 +11,7 @@ import ChapterWorkAnswerItem from './chapterWorkAnswerItem.vue'
import VEditor from '@/components/tinymce'
export default {
props: { endDate: { type: String }, data: { type: Object, default: () => ({}) }, disabled: { type: Boolean } },
props: { data: { type: Object, default: () => ({}) }, disabled: { type: Boolean } },
components: { ChapterWorkAnswerItem, VEditor },
data() {
return {}
......
<template>
<container :title="$t('viewerWork.commentToMeTitle')">
<template v-for="(item, index) in list">
<div class="module-item" :key="index">
<div class="module-item-hd">{{ $t('viewerWork.comment') }}{{ index + 1 }}:</div>
<div class="module-item-bd">
<show-more>
<div v-html="item.comment"></div>
</show-more>
</div>
</div>
</template>
</container>
</template>
<script>
// api
import * as api from '../../api'
// componets
import Container from '../common/container.vue'
import showMore from '@/components/showMore'
export default {
props: { id: { type: String } },
components: { Container, showMore },
data() {
return {
list: []
}
},
computed: {},
methods: {
getList() {
api.getChapterHomeworkComment({ homework_id: this.id }).then(response => {
this.list = response
})
}
},
beforeMount() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.module-item {
margin-bottom: 20px;
}
.module-item + .module-item {
margin-top: 10px;
}
.module-item-hd {
margin-bottom: 10px;
}
.module-item-bd {
padding: 10px;
border-radius: 8px;
background-color: #fff;
img {
max-width: 100%;
}
}
</style>
......@@ -48,7 +48,7 @@
<p>{{ $t('viewerWork.correctionTime') }}{{ detail.check_date }}</p>
<div class="paper-check-item">
<b>{{ $t('viewerWork.score') }}</b>
{{ detail.score }}
{{ detail.grade || detail.score }}
</div>
<div class="paper-check-item">
<b>{{ $t('viewerWork.comments') }}</b>
......
......@@ -78,7 +78,9 @@ export default {
commentSubmitTips: 'Deadline: {date} Modifications can be made any time before deadline.',
answerMoreButtonText: 'Check other students assignments',
submittedAssignments: 'Submitted Assignments',
student: 'student'
student: 'student',
commentToMeTitle: '我收到的评论',
comment: '评论'
},
viewerExam: {},
viewerRead: {
......
......@@ -77,7 +77,9 @@ export default {
commentSubmitText: '提交评价',
answerMoreButtonText: '去看其他同学作业',
submittedAssignments: '同学提交的作业',
student: '同学'
student: '同学',
commentToMeTitle: '我收到的评论',
comment: '评论'
},
viewerRead: {
download: '下载',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论