e030f06f by simon

Merge branch 'master' of 120.27.44.69:dev/trimble-admin-pro

2 parents 784bb708 364a2d3e
......@@ -19,7 +19,7 @@ let requestDomain = "https://ow.go.qudone.com";
if (location.href.indexOf("://k.wxpai.cn") > 0 || location.href.indexOf("://h5.k.wxpai.cn") > 0) {
requestDomain = "https://api.k.wxpai.cn/bizproxy";
}
//requestDomain = 'http://localhost:6400'
/**
* header不加session的白名单
*/
......@@ -99,7 +99,7 @@ export const formdata = (url, data) => {
}
export const request = {
/*export const request = {
post(url, data) {
return axios.post(`${requestDomain}${url}`, data);
},
......@@ -127,5 +127,106 @@ export const request = {
}
return fullUrl;
},
/!*test*!/
};*/
export const request = {
post(url, data) {
//return axios.post(`${requestDomain}${url}`, data);
let requestUrl = url.indexOf('://') >= 0 ? `${url}` : `${requestDomain}${url}`
return axios.post(requestUrl, data)
},
get(url, data) {
//return axios.get(`${requestDomain}${url}`, { params: data });
let requestUrl = url.indexOf('://') >= 0 ? `${url}` : `${requestDomain}${url}`
return axios.get(requestUrl, {
params: data
})
},
form(url, params) {
let formData = new FormData() //使用formData对象
for (let key in params) {
formData.append(key, params[key])
}
let requestUrl = url.indexOf('://') >= 0 ? `${url}` : `${requestDomain}${url}`
return axios.post(requestUrl, formData, formDataHeaders)
},
build(url, params) {
let fullUrl = `${requestDomain}${url}`
let split = ''
for (let key in params) {
if (split) {
split = '&'
} else {
split = '?'
}
fullUrl += split + key + '=' + params[key]
}
return fullUrl
},
/*test*/
};
postTest(url, data) {
axios({ // 用axios发送post请求
method: 'post',
url: `${requestDomain}${url}`, // 请求地址
data: data, // 参数
responseType: 'blob' // 表明返回服务器返回的数据类型
}).then(res => { // 处理返回的文件流
console.log('请求头:', res.headers)
console.log('res的数据:', res)
const filename = res.headers['content-disposition'].split('=')[1]
console.log('文件名:', filename)
const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })//new Blob([res])中不加data就会返回下图中[objece objece]内容(少取一层)
const elink = document.createElement('a')
elink.download = filename
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
document.body.removeChild(elink)
URL.revokeObjectURL(elink.href) // 释放URL 对象
})
var xhr = new XMLHttpRequest()
//xhr.open("POST", "https://ow.go.qudone.com/zlzmapi/admin/member/export/test", true);
xhr.open('POST', 'http://127.0.0.1:8011/zlzmapi/admin/member/export/test', true)
xhr.setRequestHeader('adminSessionId', 'a91986990ed049bebd0b4ab67d346229')
xhr.responseType = 'blob'
xhr.onload = function() {
if (this.status === 200) {
//var blob = new Blob([this.response], {type: 'application/vnd.ms-excel;charset=ISO8859-1'});
var blob = new Blob([this.response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
console.log('打印response:', this)
var a = document.createElement('a')
var url = window.URL.createObjectURL(blob)
a.href = url
document.body.appendChild(a)
a.click()
}
}
xhr.send()
/* return axios.post(`${requestDomain}${url}`, data, formDataHeaders).then(res => {
let fileName = res.headers['Content-Disposition']
console.log('文件名:', fileName)
console.log('res的数据:', res)
console.log('res的data的数据:', res.data)
console.log('测试导出2')
//将文件流转成blob形式
const blob = new Blob([res.data], { type: 'application/vnd.ms-excel;charset=utf-8' })
console.log('blob的值:', blob)
const elink = document.createElement('a')
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
/!* let objectUrl = URL.createObjectURL(blob)
window.location.href = objectUrl
*!/
})*/
}
}
......
<template>
<el-upload
class="avatar-uploader"
:action="uploadUrl"
:http-request="uploadSumit"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img v-if="currentValue" :src="currentValue" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
<div class="el-upload__tip" slot="tip" :class="{error:tipsError}">{{tips}}</div>
</el-upload>
</template>
<script>
import { request } from "@/api/fetch-api.js";
/**
* 外层插件可通过监听:v-on:before-upload;v-on:after-upload两个事件监听上传结果
* after-upload(success, src)
*/
export default {
props: ["value"],
data() {
return {
imageUrl: this.value,
uploadUrl: "https://api.k.wxpai.cn/bizproxy/kdapi/file/upload",
tips: "只能上传jpg/png文件,且不超过500kb",
tipsError: false,
uploadInterval: 0
};
},
methods: {
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
},
beforeAvatarUpload(file) {
const isJPG = file.type === "image/jpeg" || file.type === "image/png";
const isLt2M = file.size / 1024 < 500;
if (!isJPG) {
this.tipsError = true;
this.tips = "上传图片只能是 JPG|PNG 格式!";
// this.$message.error("");
}
if (!isLt2M) {
this.tipsError = true;
this.tips = "上传图片大小不能超过 500kb!";
}
return isJPG && isLt2M;
},
uploadSumit(params) {
this.tipsError = false;
this.uploadStart();
this.$emit("before-upload");
let data = {
path: "/pro/tianbao",
file: params.file
};
request
.form(this.uploadUrl, data)
.then(result => {
this.uploadEnd();
this.imageUrl = result.content;
this.$emit("input", this.imageUrl);
this.$emit("after-upload", { success: true, src: this.imageUrl });
})
.catch(res => {
this.uploadEnd();
this.$emit("after-upload", { success: false, src: this.imageUrl });
});
},
uploadStart() {
let that = this;
let times = 0;
this.uploadInterval = setInterval(function() {
times++;
let t = times % 4;
let s = "";
for (let i = 0; i < t; i++) {
s += ".";
}
that.tips = "上传中" + s;
}, 500);
},
uploadEnd() {
clearInterval(this.uploadInterval);
this.tips = "只能上传jpg/png文件,且不超过500kb";
}
},
computed: {
currentValue: function() {
return this.value;
}
}
};
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
padding: 10px;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
max-width: 120px;
max-height: 120px;
display: block;
}
.error {
color: red;
}
</style>
......@@ -150,6 +150,98 @@ export const constantRouterMap = [{
}]
},
{
path: '/edu',
component: Layout,
redirect: '/edu/live',
name: 'live',
meta: {
title: '教育教学',
icon: 'nested'
},
children: [
{
path: '/edu/live',
name: 'live',
component: () => import('@/views/live/index'),
meta: {
title: '直播课程',
icon: ''
}
},
{
path: '/edu/public',
name: 'public',
component: () => import('@/views/public/index'),
meta: {
title: '公开课',
icon: ''
}
},
{
path: '/edu/playback',
name: 'playback',
component: () => import('@/views/playback/index'),
meta: {
title: '回放视频',
icon: ''
}
},
{
path: '/edu/playbackType',
name: 'playbackType',
component: () => import('@/views/playbackType/index'),
meta: {
title: '回放视频类型',
icon: ''
}
},
{
path: '/edu/video',
name: 'video',
component: () => import('@/views/video/index'),
meta: {
title: '视频演示',
icon: ''
}
},
{
path: '/edu/videoType',
name: 'video',
component: () => import('@/views/videoType/index'),
meta: {
title: '视频演示类型',
icon: ''
}
},
]
},
// {
// path: '/live',
// component: Layout,
// children: [
// {
// path: 'index',
// name: 'Live',
// component: () => import('@/views/live/index'),
// meta: { title: '直播课程', icon: 'form' }
// }
// ]
// },
// {
// path: '/public',
// component: Layout,
// children: [
// {
// path: 'index',
// name: 'public',
// component: () => import('@/views/public/index'),
// meta: { title: '公开课', icon: 'form' }
// }
// ]
// },
// {
// path: '/example',
......
<template>
<div>
<el-dialog
:title="title"
:visible.sync="dialogVisible"
:before-close="handleCloseDialog">
<el-form :model="liveForm" ref="liveForm" :rules="liveRules" label-width="130px">
<el-form-item label="时间:" prop="liveTime">
<el-date-picker
v-model="liveForm.liveTime"
type="datetime"
value-format="timestamp"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="内容:" prop="liveContent">
<el-input type="textarea" v-model="liveForm.liveContent" maxlength="500" show-word-limit></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('liveForm')">提交</el-button>
<el-button @click="handleCloseDialog">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { request } from '@/api/fetch-api'
let urls = {
liveSaveUrl: '/tianbao_edu_api/admin/live/save',
}
export default {
props: ['dialogVisible', 'title', 'liveTemp'],
data() {
return {
title: '',
liveForm:{},
liveRules:{
liveTime: [
{required: true, message: '请选择时间', trigger: 'blur'}
],
liveContent: [
{required: true, message: '请输入内容', trigger: 'blur'}
],
}
}
},
methods: {
handleCloseDialog() {
this.$emit('closedialog', false)
},
init(){
if (JSON.parse(JSON.stringify(this.liveTemp)) == null) {
this.title='创建'
} else {
this.title="修改"
this.liveForm = JSON.parse(JSON.stringify(this.liveTemp))
}
},
submitForm(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.liveSaveUrl, this.liveForm).then(response => {
this.$emit('initLive')
this.$emit('closedialog', false)
this.$message.success("保存成功")
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
}
},
created() {
this.init()
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-button type="primary" @click="createLive">创建</el-button>
</el-header>
<el-main>
<el-table
:data="liveList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="时间" prop="liveTime">
<template slot-scope="scope">
{{timestampToTime(scope.row.liveTime)}}
</template>
</el-table-column>
<el-table-column label="直播内容" prop="liveContent"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="editLive(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="deleteLive(scope.row.liveCode)">删除</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer height>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<live-save-dialog
v-if="dialogVisible"
:dialog-visible="dialogVisible"
:live-temp="liveTemp"
@closedialog="closedialog"
@initLive="initLive">
</live-save-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import liveSaveDialog from './components/liveSaveDialog'
let urls = {
liveListUrl: '/tianbao_edu_api/admin/live/list',
liveSaveUrl: '/tianbao_edu_api/admin/live/save',
liveDelUrl:'/tianbao_edu_api/admin/live/delete'
}
export default {
components: {liveSaveDialog},
data() {
return {
liveList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10
},
dialogVisible:false,
liveTemp:{},
}
},
methods: {
initLive() {
this.loading = true
request.get(urls.liveListUrl, this.queryForm).then(data => {
this.loading = false
this.liveList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
editLive(row){
this.liveTemp=row
this.dialogVisible=true
},
createLive(){
this.liveTemp=null
this.dialogVisible=true
},
closedialog() {
this.dialogVisible = false
},
deleteLive(code){
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request.post(urls.liveDelUrl, {liveCode: code}).then(data => {
this.$message.success("删除成")
this.initLive()
}).catch(() => {
})
}).catch(() => {
})
},
timestampToTime(row) {
if (row === 0) {
return ''
}
var date = new Date(row)
var Y = date.getFullYear() + '-'
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return Y + M + D + h + m + s
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initLive()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initLive()
},
},
created() {
this.initLive()
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-input v-model="queryForm.title" style="width: 200px" placeholder="视频名称" clearable></el-input>
<el-select v-model="queryForm.playbackTypeCode" placeholder="请选择" clearable @change="searchPlayback">
<el-option
v-for="item in playbackTypeList"
:key="item.playbackTypeCode"
:label="item.typeName"
:value="item.playbackTypeCode">
</el-option>
</el-select>
<el-button @click="searchPlayback" type="primary">搜索</el-button>
<el-button type="primary" @click="playbackCreate">创建</el-button>
</el-header>
<el-main>
<el-table
:data="playbackList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="名称" prop="title"></el-table-column>
<el-table-column label="视频链接" prop="videoUrl"></el-table-column>
<el-table-column label="类型" prop="typeName"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="playbackEdit(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="playbackDelete(scope.row.playbackCode)">删除 &nbsp;</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<el-dialog
width="60%"
:title="title"
:visible.sync="dialogVisible">
<el-form :model="playbackForm" ref="playbackForm" :rules="playbackRules" label-width="180px">
<el-form-item label="名称:" prop="title">
<el-input v-model="playbackForm.title" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="视频链接:" prop="videoUrl">
<el-input v-model="playbackForm.videoUrl" maxlength="100" show-word-limit></el-input>
<div>视频链接提取方法:
<div>1.电脑打开qq视频链接
2.鼠标移动至视频左下角分享按钮
3.点击复制通用代码
4.取复制内容中src的值
</div>
</div>
</el-form-item>
<el-form-item label="类型:" prop="playbackTypeCode">
<el-select v-model="playbackForm.playbackTypeCode" placeholder="请选择">
<el-option
v-for="item in playbackTypeList"
:key="item.playbackTypeCode"
:label="item.typeName"
:value="item.playbackTypeCode">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('playbackForm')">提交</el-button>
<el-button @click="cancelCreate">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import UploadItem from '@/components/UploadItem'
let urls = {
playbackTypeListUrl: '/tianbao_edu_api/admin/playbackType/list',
playbackListUrl: '/tianbao_edu_api/admin/playback/list',
playbackSaveUrl: '/tianbao_edu_api/admin/playback/save',
playbackDelUrl: '/tianbao_edu_api/admin/playback/delete',
}
export default {
components: {UploadItem},
data() {
return {
playbackList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10,
playbackTypeCode: '',
title: ''
},
dialogVisible: false,
title: '',
playbackForm: {},
playbackRules: {
title: [{required: true, message: '请输入名称', trigger: 'blur'}],
videoUrl: [{required: true, message: '请输入视频链接', trigger: 'blur'}],
playbackTypeCode: [{required: true, message: '请选择', trigger: 'blur'}]
},
playbackTypeList: []
}
},
methods: {
searchPlayback() {
this.queryForm.page = 1
this.initPlayBack()
},
initPlayBack() {
this.loading = true
request.get(urls.playbackListUrl, this.queryForm).then(data => {
this.loading = false
this.playbackList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
initPlayBackType() {
let form = {
page: 1,
size: 1000,
}
request.get(urls.playbackTypeListUrl, form).then(data => {
this.playbackTypeList = data.content.list
}).catch(() => {
})
},
playbackEdit(row) {
this.title = '编辑'
this.dialogVisible = true
this.playbackForm = JSON.parse(JSON.stringify(row))
},
playbackDelete(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let form = {
playbackCode: code
}
request.post(urls.playbackDelUrl, form).then(data => {
this.initPlayBack()
this.$message.success("删除成功")
}).catch(() => {
})
}).catch(() => {
})
},
cancelCreate() {
this.dialogVisible = false
this.playbackForm = {}
},
playbackCreate() {
this.playbackForm = {}
this.dialogVisible = true
this.title = '创建'
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.playbackSaveUrl, this.playbackForm).then(response => {
this.dialogVisible = false
this.$message.success("保存成功")
this.initPlayBack()
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initPlayBack()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initPlayBack()
},
},
created() {
this.initPlayBack()
this.initPlayBackType()
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-button type="primary" @click="playbackTypeCreate">创建</el-button>
</el-header>
<el-main>
<el-table
:data="playbackTypeList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="名称" prop="typeName"></el-table-column>
<el-table-column label="图片" prop="typeImage">
<template slot-scope="scope">
<a :href="scope.row.typeImage" target="_blank">
<div style="width: 100px;">
<el-image :src="scope.row.typeImage"></el-image>
</div>
</a>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="playbackTypeEdit(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="playbackTypeDelete(scope.row.playbackTypeCode)">删除 &nbsp;</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<el-dialog
width="60%"
:title="title"
:visible.sync="dialogVisible">
<el-form :model="playbackTypeForm" ref="playbakcForm" :rules="playbackTypeRules" label-width="180px">
<el-form-item label="名称:" prop="typeName">
<el-input v-model="playbackTypeForm.typeName" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="图片:" prop="typeImage">
<upload-item
v-model="playbackTypeForm.typeImage"
v-on:before-upload="loading=true"
v-on:after-upload="loading=false"
></upload-item>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('playbakcForm')">提交</el-button>
<el-button @click="cancelCreate">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import UploadItem from '@/components/UploadItem'
let urls = {
playbackTypeListUrl: '/tianbao_edu_api/admin/playbackType/list',
playbackTypeSaveUrl: '/tianbao_edu_api/admin/playbackType/save',
playbackTypeDelUrl: '/tianbao_edu_api/admin/playbackType/delete',
}
export default {
components: {UploadItem},
data() {
return {
playbackTypeList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10
},
dialogVisible: false,
title: '',
playbackTypeForm: {},
playbackTypeRules: {
typeName: [{required: true, message: '请输入名称', trigger: 'blur'}],
typeImage: [{required: true, message: '上传缩略图', trigger: 'blur'}]
}
}
},
methods: {
initPlayBackType() {
this.loading = true
request.get(urls.playbackTypeListUrl, this.queryForm).then(data => {
this.loading = false
this.playbackTypeList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
playbackTypeEdit(row) {
this.title = '编辑'
this.dialogVisible = true
this.playbackTypeForm = JSON.parse(JSON.stringify(row))
},
playbackTypeDelete(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let form = {
playbackTypeCode: code
}
request.post(urls.playbackTypeDelUrl, form).then(data => {
this.initPlayBackType()
this.$message.success("删除成功")
}).catch(() => {
})
}).catch(() => {
})
},
cancelCreate() {
this.dialogVisible = false
this.playbackTypeForm = {}
},
playbackTypeCreate() {
this.playbackTypeForm = {}
this.dialogVisible = true
this.title = '创建'
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.playbackTypeSaveUrl, this.playbackTypeForm).then(response => {
this.dialogVisible = false
this.$message.success("保存成功")
this.initPlayBackType()
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initPlayBackType()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initPlayBackType()
},
},
created() {
this.initPlayBackType()
}
}
</script>
<style scoped>
</style>
<template>
<div>
<el-dialog
:title="title2"
:visible.sync="dialogVisible"
:before-close="handleCloseDialog">
<el-form :model="publicForm" ref="publicForm" :rules="publicRules" label-width="130px">
<el-form-item label="标题:" prop="title">
<el-input v-model="publicForm.title" maxlength="50" show-word-limit></el-input>
</el-form-item>
<el-form-item label="开始时间:" prop="startT">
<el-date-picker
v-model="publicForm.startT"
type="datetime"
value-format="timestamp"
placeholder="选择日期时间">
</el-date-picker>
<!-- <el-date-picker
v-model="publicForm.startDate"
type="date"
placeholder="选择日期(必填)"
format="yyyy年MM月dd日"
value-format="yyyy年MM月dd日"
:picker-options="pickerOptionsStart">
</el-date-picker>
<el-time-picker
v-model="publicForm.startTime"
format="HH:mm:ss"
value-format="HH:mm:ss"
placeholder="选择时间">
</el-time-picker>-->
</el-form-item>
<el-form-item label="结束时间:" prop="endT">
<el-date-picker
v-model="publicForm.endT"
type="datetime"
value-format="timestamp"
placeholder="选择日期时间">
</el-date-picker>
<!-- <el-date-picker
v-model="publicForm.endDate"
type="date"
placeholder="选择日期(必填)"
format="yyyy年MM月dd日"
value-format="yyyy年MM月dd日"
:picker-options="pickerOptionsEnd"
>
</el-date-picker>
<el-time-picker
v-model="publicForm.endTime"
format="HH:mm:ss"
value-format="HH:mm:ss"
placeholder="选择时间">
</el-time-picker>-->
</el-form-item>
<el-form-item label="地点:" prop="city">
<el-input v-model="publicForm.city" maxlength="100"
show-word-limit></el-input>
<!-- <el-row :gutter="5">
<el-col :span="7">
<el-select
v-model="publicForm.province"
filterable
placeholder="省"
@change="provinceSelectChangeHandler"
>
<el-option
v-for="(item,index) in provinceList"
:key="index"
:label="item.areaName"
:value="item.areaName"
></el-option>
</el-select>
</el-col>
<el-col :span="7">
<el-select
v-model="publicForm.city"
filterable
placeholder="市"
>
<el-option
v-for="(item,index) in cityList"
:key="index"
:label="item.areaName"
:value="item.areaName"
></el-option>
</el-select>
</el-col>
</el-row>-->
</el-form-item>
<el-form-item label="注册/回放:" prop="enroll">
<el-input v-model="publicForm.enroll" maxlength="200"
show-word-limit></el-input>
</el-form-item>
<el-form-item label="团队:" prop="team">
<el-input v-model="publicForm.team" maxlength="100"
show-word-limit></el-input>
</el-form-item>
<el-form-item label="内容:" prop="content">
<el-input v-model="publicForm.content" type="textarea" maxlength="500"
show-word-limit></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('publicForm')">提交</el-button>
<el-button @click="handleCloseDialog">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
let urls = {
publicSaveUrl: '/tianbao_edu_api/admin/public/save',
areaUrl: 'https://api.k.wxpai.cn/bizproxy/kdapi/area',
}
export default {
props: ['dialogVisible', 'publicTemp'],
data() {
return {
title2: '',
publicForm: {},
publicRules: {
title: [{required: true, message: '请输入标题', trigger: 'blur'}],
startT: [{required: true, message: '请选择开始时间', trigger: 'blur'}],
endT: [{required: true, message: '请选择结束时间', trigger: 'blur'}],
enroll: [{required: true, message: '请填写报名', trigger: 'blur'}],
city: [{required: true, message: '请选择省市', trigger: 'blur'}],
content: [{required: true, message: '请输入内容', trigger: 'blur'}],
team: [{required: true, message: '请输入团队', trigger: 'blur'}],
},
provinceList: [],
cityList: [],
pickerOptionsStart: {
disabledDate: time => {
let endDateVal = this.publicForm.endDate;
if (endDateVal) {
return time.getTime() >= new Date(endDateVal).getTime();
}
}
},
pickerOptionsEnd: {
disabledDate: time => {
let beginDateVal = this.publicForm.startDate;
if (beginDateVal) {
return (
time.getTime() < new Date(beginDateVal).getTime()-24*60*60*1000
);
}
},
},
}
},
methods: {
handleCloseDialog() {
this.$emit('closedialog', false)
},
init() {
if (JSON.parse(JSON.stringify(this.publicTemp)) == null) {
this.title2 = '创建'
} else {
this.title2 = "修改"
this.publicForm = JSON.parse(JSON.stringify(this.publicTemp))
}
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.publicSaveUrl, this.publicForm).then(response => {
this.$emit('initPublic')
this.$emit('closedialog', false)
this.$message.success("保存成功")
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
getProvince() {
request.post(urls.areaUrl, {}).then(res => {
this.provinceList = res.content
})
},
provinceSelectChangeHandler(province) {
this.cityList = null
let areaId = this.findAreaId(
this.provinceList,
province
)
request.post(urls.areaUrl, {parentId: areaId}).then(res => {
this.cityList = res.content
})
},
findAreaId(areaList, name) {
let areaId = ''
areaList.forEach(element => {
if (element.areaName == name) {
areaId = element.areaId
}
})
return areaId
},
changeStart() {
this.pickerOptionsStart = Object.assign({}, this.pickerOptionsStart, {
// 可通过箭头函数的方式访问到this
disabledDate: (time) => {
var times = '';
times = this.publicForm.endDate < time.getTime() || time.getTime() < new Date(new Date().toLocaleDateString())
.getTime();
return times
}
})
},
//开始时间 控制结束时间
changeEnd() {
this.pickerOptionsEnd = Object.assign({}, this.pickerOptionsEnd, {
disabledDate: (time) => {
return time.getTime() > this.publicForm.startDate
}
})
},
},
created() {
this.init()
this.getProvince()
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-button type="primary" @click="createPublic">创建</el-button>
</el-header>
<el-main>
<el-table
:data="publicList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="活动标题" prop="title"></el-table-column>
<el-table-column label="地点" prop="city">
</el-table-column>
<el-table-column label="注册/回放" prop="enroll"></el-table-column>
<el-table-column label="团队" prop="team"></el-table-column>
<el-table-column label="开始时间">
<template slot-scope="scope">
<!--{{scope.row.startDate}} &nbsp; {{scope.row.startTime}}-->
{{timestampToTime(scope.row.startT)}}
</template>
</el-table-column>
<el-table-column label="结束时间">
<template slot-scope="scope">
<!--{{scope.row.endDate}} &nbsp; {{scope.row.endTime}}-->
{{timestampToTime(scope.row.endT)}}
</template>
</el-table-column>
<el-table-column label="直播内容" prop="content"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="editPublic(scope.row)">编辑&nbsp;</el-link>
<el-link type="primary" @click="deletePublic(scope.row.publicCode)">删除</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer height>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<public-save-dialog
v-if="dialogVisible"
:dialog-visible="dialogVisible"
:public-temp="publicTemp"
@closedialog="closedialog"
@initPublic="initPublic">
</public-save-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import publicSaveDialog from './components/publicSaveDialog'
let urls = {
publicListUrl: '/tianbao_edu_api/admin/public/list',
publicSaveUrl: '/tianbao_edu_api/admin/public/save',
publicDelUrl: '/tianbao_edu_api/admin/public/delete'
}
export default {
components: {publicSaveDialog},
data() {
return {
publicList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10
},
dialogVisible: false,
publicTemp: {},
}
},
methods: {
initPublic() {
this.loading = true
request.get(urls.publicListUrl, this.queryForm).then(data => {
this.loading = false
this.publicList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
editPublic(row) {
this.publicTemp = row
this.dialogVisible = true
},
createPublic() {
this.publicTemp = null
this.dialogVisible = true
},
closedialog() {
this.dialogVisible = false
},
deletePublic(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request.post(urls.publicDelUrl, {publicCode: code}).then(data => {
this.$message.success("删除成")
this.initPublic()
}).catch(() => {
})
}).catch(() => {
})
},
timestampToTime(row) {
if (row === 0) {
return ''
}
var date = new Date(row)
var Y = date.getFullYear() + '-'
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return Y + M + D + h + m + s
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initPublic()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initPublic()
},
timestampToTime(row) {
if (row === 0) {
return ''
}
var date = new Date(row)
var Y = date.getFullYear() + '-'
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return Y + M + D + h + m + s
},
},
created() {
this.initPublic()
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-input type="primary" v-model="queryForm.videoName" placeholder="视频名" style="width: 200px" clearable></el-input>
<el-select v-model="queryForm.videoTypeCode" placeholder="请选择" clearable @change="searchVideo">
<el-option
v-for="item in videoTypeList"
:key="item.videoTypeCode"
:label="item.typeName"
:value="item.videoTypeCode">
<span style="float: left">{{ item.typeName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===1">软件</span>
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===0">硬件</span>
</el-option>
</el-select>
<el-button type="primary" @click="searchVideo">搜索</el-button>
<el-button type="primary" @click="videoCreate">创建</el-button>
</el-header>
<el-main>
<el-table
:data="videoList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="名称" prop="videoName"></el-table-column>
<el-table-column label="视频链接" prop="videoUrl">
<!--<template slot-scope="scope">-->
<!--<video :src="scope.row.videoUrl" controls="controls"></video>-->
<!--</template>-->
</el-table-column>
<el-table-column label="类型" prop="typeName">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="videoEdit(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="videoDelete(scope.row.videoCode)">删除 &nbsp;</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<el-dialog
width="60%"
:title="title"
:visible.sync="dialogVisible">
<el-form :model="videoForm" ref="videoForm" :rules="videoRules" label-width="180px">
<el-form-item label="名称:" prop="videoName">
<el-input v-model="videoForm.videoName" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="视频链接:" prop="videoUrl">
<el-input v-model="videoForm.videoUrl" maxlength="255" show-word-limit></el-input>
</el-form-item>
<el-form-item label="类型:" prop="videoTypeCode">
<el-select v-model="videoForm.videoTypeCode" placeholder="请选择">
<el-option
v-for="item in videoTypeList"
:key="item.videoTypeCode"
:label="item.typeName"
:value="item.videoTypeCode">
<span style="float: left">{{ item.typeName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===1">软件</span>
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===0">硬件</span>
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('videoForm')">提交</el-button>
<el-button @click="cancelCreate">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import UploadItem from '@/components/UploadItem'
let urls = {
videoTypeListUrl: '/tianbao_edu_api/admin/videoType/list',
videoListUrl: '/tianbao_edu_api/admin/video/list',
videoSaveUrl: '/tianbao_edu_api/admin/video/save',
videoDelUrl: '/tianbao_edu_api/admin/video/delete',
}
export default {
components: {UploadItem},
data() {
return {
videoList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10,
videoName: '',
videoTypeCode:''
},
dialogVisible: false,
title: '',
videoForm: {},
videoRules: {
videoName: [{required: true, message: '请输入名称', trigger: 'blur'}],
videoUrl: [{required: true, message: '上传缩略图', trigger: 'blur'}],
videoTypeCode: [{required: true, message: '请选择', trigger: 'blur'}]
},
videoTypeList: []
}
},
methods: {
initVideo() {
this.loading = true
request.get(urls.videoListUrl, this.queryForm).then(data => {
this.loading = false
this.videoList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
initVideoType() {
let form = {
page: 1,
size: 1000
}
request.get(urls.videoTypeListUrl, this.form).then(data => {
this.videoTypeList = data.content.list
}).catch(() => {
})
},
searchVideo(){
this.queryForm.page=1
this.initVideo()
},
videoEdit(row) {
this.title = '编辑'
this.dialogVisible = true
this.videoForm = JSON.parse(JSON.stringify(row))
},
videoDelete(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let form = {
videoCode: code
}
request.post(urls.videoDelUrl, form).then(data => {
this.initVideo()
this.$message.success("删除成功")
}).catch(() => {
})
}).catch(() => {
})
},
cancelCreate() {
this.dialogVisible = false
this.videoForm = {}
},
videoCreate() {
this.videoForm = {}
this.dialogVisible = true
this.title = '创建'
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.videoSaveUrl, this.videoForm).then(response => {
this.dialogVisible = false
this.$message.success("保存成功")
this.initVideo()
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initVideo()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initVideo()
},
},
created() {
this.initVideo();
this.initVideoType();
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-button type="primary" @click="videoTypeCreate">创建</el-button>
</el-header>
<el-main>
<el-table
:data="videoTypeList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="名称" prop="typeName"></el-table-column>
<el-table-column label="图片" prop="typeImage">
<template slot-scope="scope">
<a :href="scope.row.typeImage" target="_blank">
<div style="width: 100px;">
<el-image :src="scope.row.typeImage"></el-image>
</div>
</a>
</template>
</el-table-column>
<el-table-column label="软/硬件" prop="machine">
<template slot-scope="scope">
<span v-if="scope.row.machine===1">软件</span>
<span v-if="scope.row.machine===0">硬件</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="videoTypeEdit(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="videoTypeDelete(scope.row.videoTypeCode)">删除 &nbsp;</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<el-dialog
width="60%"
:title="title"
:visible.sync="dialogVisible">
<el-form :model="videoTypeForm" ref="videoTypeForm" :rules="videoTypeRules" label-width="180px">
<el-form-item label="名称:" prop="typeName">
<el-input v-model="videoTypeForm.typeName" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="图片:" prop="typeImage">
<upload-item
v-model="videoTypeForm.typeImage"
v-on:before-upload="loading=true"
v-on:after-upload="loading=false"
></upload-item>
</el-form-item>
<el-form-item label="软/硬件:" prop="machine">
<el-select v-model="videoTypeForm.machine" placeholder="请选择">
<el-option
v-for="item in machineOption"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('videoTypeForm')">提交</el-button>
<el-button @click="cancelCreate">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import UploadItem from '@/components/UploadItem'
let urls = {
videoTypeListUrl: '/tianbao_edu_api/admin/videoType/list',
videoTypeSaveUrl: '/tianbao_edu_api/admin/videoType/save',
videoTypeDelUrl: '/tianbao_edu_api/admin/videoType/delete',
}
export default {
components: {UploadItem},
data() {
return {
videoTypeList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10
},
dialogVisible: false,
title: '',
videoTypeForm: {},
videoTypeRules: {
typeName: [{required: true, message: '请输入名称', trigger: 'blur'}],
typeImage: [{required: true, message: '上传缩略图', trigger: 'blur'}],
machine: [{required: true, message: '请选择', trigger: 'blur'}]
},
machineOption: [
{label: '软件', value: 1},
{label: '硬件', value: 0},
]
}
},
methods: {
initVideoType() {
this.loading = true
request.get(urls.videoTypeListUrl, this.queryForm).then(data => {
this.loading = false
this.videoTypeList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
videoTypeEdit(row) {
this.title = '编辑'
this.dialogVisible = true
this.videoTypeForm = JSON.parse(JSON.stringify(row))
},
videoTypeDelete(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let form = {
videoTypeCode: code
}
request.post(urls.videoTypeDelUrl, form).then(data => {
this.initVideoType()
this.$message.success("删除成功")
}).catch(() => {
})
}).catch(() => {
})
},
cancelCreate() {
this.dialogVisible = false
this.videoTypeForm = {}
},
videoTypeCreate() {
this.videoTypeForm = {}
this.dialogVisible = true
this.title = '创建'
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.videoTypeSaveUrl, this.videoTypeForm).then(response => {
this.dialogVisible = false
this.$message.success("保存成功")
this.initVideoType()
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initVideoType()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initVideoType()
},
},
created() {
this.initVideoType()
}
}
</script>
<style scoped>
</style>
# chmod u+x sync.sh
cp -R dist/* G:\\workspaceAll\\IdeaProjects\\wzhi
cd G:\\workspaceAll\\IdeaProjects\\wzhi
read -p "请输入commit提交的描述: " msg
if [[ $msg == "" ]]; then
msg="默认提交"
fi
git add -A
git commit -m $msg
git push
git status