Commit 3502f4d1 by 匡雅琴

Merge branch 'kuangyq_dev_v3.2.0' into 'v3.2.0'

Kuangyq dev v3.2.0

See merge request !68
2 parents f7fab727 900e60d3
......@@ -20,7 +20,8 @@
"sass-loader": "7.3.1",
"sha1": "^1.1.1",
"md5": "^2.3.0",
"vue": "^2.6.11"
"vue": "^2.6.11",
"swiper": "^4.0.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
......
......@@ -44,5 +44,10 @@ const taskApi = {
data.method = 'merchants.api.mission.updateMission'
return request(data, 'post')
},
// 查询任务总数
getStaticMission(data) {
data.method = 'merchants.api.mission.staticMission'
return request(data, 'post')
},
}
export { taskApi }
......@@ -10,7 +10,6 @@ import '@/styles/index.css'
// 组件
import '@/components'
import { Util } from './common/util'
// import _ from 'lodash'
// import axios from 'axios'
Vue.prototype.btn_size = 'mini'
......
......@@ -341,6 +341,7 @@ import wTextarea from './tag-textarea'
// import vuedraggable from 'vuedraggable'
import { utils } from 'glsx-common'
import { set } from 'vue'
import { commonApi } from '../../api/commonApi'
export default {
name: 'GLEditor',
components: {
......@@ -603,6 +604,60 @@ export default {
}
}
},
getImgUrl(url, multiple = 3) {
return new Promise((resolve, reject) => {
var canvas = document.createElement('canvas') // 获取 canvas 对象
const ctx = canvas.getContext('2d') // 绘制2d
let video = document.getElementById('video')
video.src = url
video.crossOrigin = 'anonymous' // 解决跨域问题,也就是提示污染资源无法转换视频
video.currentTime = 1 // 第一帧
video.oncanplay = async () => {
canvas.width = video.clientWidth * multiple // 获取视频宽度
canvas.height = video.clientHeight * multiple // 获取视频高度
// 利用canvas对象方法绘图
ctx.drawImage(
video,
0,
0,
video.clientWidth * multiple,
video.clientHeight * multiple
)
console.log(canvas, 'canvas')
// 转换成base64形式
var oGrayImg = canvas.toDataURL('image/png') // 截取后的视频封面
const file = this.dataURLtoFile(oGrayImg)
const imgUrl = await this.uploadImg(file)
resolve(imgUrl)
}
})
},
//将base64转换为文件
dataURLtoFile(dataurl, filename = '1.png') {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], filename, { type: mime })
},
uploadImg(fileInfo) {
return new Promise((resolve, reject) => {
var reader = new FileReader()
reader.readAsDataURL(fileInfo)
reader.onload = (e) => {
const imgFile = e.target.result
const base64 =
fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
commonApi.uploadImgApi({ file: base64 }).then((res) => {
resolve(res)
})
}
})
},
// 上传视频
async handleVideoChange(e) {
// 判断是否有链接
......@@ -633,6 +688,14 @@ export default {
materialType: that.ATT_TYPE.VEDIO,
materialContent: res,
})
that.$nextTick(() => {
const videoUrl = res
that.getImgUrl(videoUrl).then((res) => {
console.log(res, 'videoimg')
that.$emit('getVideoImg', res.data.data)
that.$emit('getEditor')
})
})
},
})
this.$notify({
......
<template>
<div>
<el-dialog
title="选择任务开始日期"
:visible.sync="activityDateVisible"
width="800px"
:before-close="handleClose"
>
<div>修改任务开始日期不能晚于活动开始日期且不能早于当前日期。</div>
<el-date-picker
v-model="selectDateItem"
type="date"
placeholder="选择日期"
:picker-options="pickerOptions"
@change="selectDateChange"
>
</el-date-picker>
<span slot="footer" class="dialog-footer">
<el-button @click="activityDateVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmActivityDate">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'activityDia',
data() {
return {
activityDateVisible: false,
selectDateItem: '',
time: '',
pickerOptions: {
disabledDate: (time) => {
return (
time.getTime() < Date.now() - 8.64e7 || time.getTime() > this.time
)
},
},
}
},
methods: {
init(time) {
this.activityDateVisible = true
var date = new Date(time)
var time1 = date.setDate(date.getDate() - 1)
console.log(time1)
this.time = time1
},
selectDateChange() {
console.log(this.selectDateItem)
},
// 关闭弹窗
handleClose() {
this.selectDateItem = ''
this.activityDateVisible = false
},
confirmActivityDate() {
var time = new Date(this.selectDateItem)
var newTime =
time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate()
console.log(newTime)
this.$emit('selectActivityDate', newTime)
this.handleClose()
},
},
}
</script>
<style lang="scss" scoped></style>
......@@ -100,23 +100,23 @@ export default {
this.activityData.map((item) => {
item.startTime = dayjs(item.startTime).format('YYYY-MM-DD')
item.endTime = dayjs(item.endTime).format('YYYY-MM-DD')
if (this.isClone) {
let activityDays = this.getDateByDays(item.startTime, item.endTime)
if (activityDays != this.taskDateNum) {
item.taskStatus = 1
}
}
// if (this.isClone) {
// let activityDays = this.getDateByDays(item.startTime, item.endTime)
// if (activityDays != this.taskDateNum) {
// item.taskStatus = 1
// }
// }
})
})
},
// 根据日期获取天数
getDateByDays(startDate, endDdate) {
let d1 = Date.parse(new Date(startDate))
let d2 = Date.parse(new Date(endDdate))
// 时间戳相减 / 天数
let day = parseInt((d2 - d1) / (1000 * 60 * 60 * 24)) + 1
return day
},
// getDateByDays(startDate, endDdate) {
// let d1 = Date.parse(new Date(startDate))
// let d2 = Date.parse(new Date(endDdate))
// // 时间戳相减 / 天数
// let day = parseInt((d2 - d1) / (1000 * 60 * 60 * 24)) + 1
// return day
// },
handleSelectItem(item) {
this.selectItem = item
},
......
......@@ -50,6 +50,24 @@
>添加任务</el-button
>
</div>
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane
:label="'全部' + '(' + listCount.totalCount + ')'"
name=""
></el-tab-pane>
<el-tab-pane
:label="'未发布' + '(' + listCount.draftCount + ')'"
:name="statusNum.UNPUBLISH"
></el-tab-pane>
<el-tab-pane
:label="'已发布' + '(' + listCount.upCount + ')'"
:name="statusNum.PUBLISHED"
></el-tab-pane>
<el-tab-pane
:label="'已结束' + '(' + listCount.downCount + ')'"
:name="statusNum.FINISHIED"
></el-tab-pane>
</el-tabs>
<div>
<d2-table
ref="taskTable"
......@@ -187,6 +205,7 @@ export default {
activityName: '',
activityStatus: '',
},
listCount: {},
// 表格参数
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
......@@ -240,9 +259,21 @@ export default {
// 获取订单列表
getListApi: taskApi.findMissionList,
status: false,
activeName: '',
}
},
mounted() {
this.handleSearchTaskNum()
},
methods: {
// 查询任务状态数量
handleSearchTaskNum() {
console.log(222)
taskApi.getStaticMission({}).then((res) => {
console.log(res)
this.listCount = res.data
})
},
// 搜索框搜索
handleSearch() {
this.$refs.taskTable.refreshTable()
......@@ -259,6 +290,13 @@ export default {
this.$refs.taskTable.refreshTable()
})
},
// tab切换
handleTabClick(tab, event) {
this.searchForm.activityStatus = tab.name
this.$nextTick(() => {
this.$refs.taskTable.refreshTable()
})
},
// 编辑
handleEdit(item, type) {
this.status = true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!