Commit bc9fb94e authored by 黄奎's avatar 黄奎

页面修改

parent a13da573
...@@ -60,6 +60,37 @@ export function UploadSelfFile(path, file, callback, configObj) { ...@@ -60,6 +60,37 @@ export function UploadSelfFile(path, file, callback, configObj) {
} }
} }
//上传视频文件到本地服务器
export function UploadViittoFile(path, file, callback) {
var uploadLoadding = Loading;
uploadLoadding.show({
message: '正在上传文件,请稍后...'
})
let viewFileUrl = 'http://192.168.20.214:8130';
let vtUploadUrl = "http://192.168.20.214:8120";
let locationName = window.location.hostname;
if (locationName.indexOf('testerp.oytour') !== -1) {
vtUploadUrl = "http://upload.oytour.com";
viewFileUrl = "https://imgfile.oytour.com";
} else if (locationName.indexOf('oytour') !== -1) {
vtUploadUrl = "http://upload.oytour.com";
viewFileUrl = "https://imgfile.oytour.com";
}
var UploadConfig = {
Bucket: "系统",
CustomDomain: viewFileUrl,
Region: "成都",
SecretId: "SecreId",
SecretKey: "SecreKey",
StoreType: 3,
UploadDomain: vtUploadUrl,
};
var configObj = {
isCreateCover: 1
}
UploadFileToSystem(UploadConfig, path, file, uploadLoadding, callback, configObj)
}
/** /**
* 上传到当前站点 * 上传到当前站点
*/ */
...@@ -115,6 +146,9 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo ...@@ -115,6 +146,9 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
if (configObj.isTrans && configObj.isTrans == 1) { if (configObj.isTrans && configObj.isTrans == 1) {
url += "&isTrans=1" url += "&isTrans=1"
} }
if (configObj.isCreateCover && configObj.isCreateCover == 1) {
url += "&isCreateCover=1"
}
} }
let formData = new FormData() let formData = new FormData()
formData.append('myfile', fileObj) formData.append('myfile', fileObj)
......
<template> <template>
<div class="ChooseImg materialMan page-body"> <div class="ChooseImg materialMan page-body">
<q-btn color="accent" size="sm" class="q-mr-md" label="返回" @click="goBack" /> <q-btn color="accent" size="sm" class="q-mr-md" label="返回" @click="goBack" />
<div v-loading="loading" style="margin-top:10px;background:#fff;padding:20px"> <div v-loading="loading" style="margin-top:10px;background:#fff;padding:20px">
<div class="TabDiv"> <div class="TabDiv">
<span :class="commonType==1?'spanActive':''" @click="handleClick(1)">图片</span> <span :class="commonType==1?'spanActive':''" @click="handleClick(1)">图片</span>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<!-- <span :class="commonType==3?'spanActive':''" @click="handleClick(3)">其他</span> --> <!-- <span :class="commonType==3?'spanActive':''" @click="handleClick(3)">其他</span> -->
</div> </div>
<div> <div>
<div style="height: 718px;display:flex;" flex="box:first" > <div style="height: 718px;display:flex;" flex="box:first">
<div style="margin-right: 15px;width: auto;-webkit-box-flex: 0;flex-shrink: 0;flex-grow: 0;"> <div style="margin-right: 15px;width: auto;-webkit-box-flex: 0;flex-shrink: 0;flex-grow: 0;">
<q-btn @click="addGroup" style="margin-bottom: 12px;" color="accent" size="sm">添加分组</q-btn> <q-btn @click="addGroup" style="margin-bottom: 12px;" color="accent" size="sm">添加分组</q-btn>
<div style="border: 1px solid rgb(227, 227, 227);width:250px"> <div style="border: 1px solid rgb(227, 227, 227);width:250px">
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
<span>{{item.Name}}</span> <span>{{item.Name}}</span>
</el-col> </el-col>
<el-col class="blue" :span="6"> <el-col class="blue" :span="6">
<span @click.prevent="EditGroup(item)">编辑 |</span> <span @click.prevent="EditGroup(item)">编辑 |</span>
<span @click.prevent="delGroup(item)">删除</span> <span @click.prevent="delGroup(item)">删除</span>
</el-col> </el-col>
</div> </div>
</li> </li>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</div> </div>
<el-checkbox style="margin-left:12px" :indeterminate="isIndeterminate" v-model="checkAll" <el-checkbox style="margin-left:12px" :indeterminate="isIndeterminate" v-model="checkAll"
@change="CheckAllChange">全选</el-checkbox> @change="CheckAllChange">全选</el-checkbox>
<el-button @click="DeletePage" style="margin:0 12px" size="small">删除 <el-button @click="DeletePage" style="margin:0 12px" size="small">删除
</el-button> </el-button>
<!-- <el-dropdown v-if="scgroupMsg.Recycled==1" size="small" split-button> <!-- <el-dropdown v-if="scgroupMsg.Recycled==1" size="small" split-button>
移动至 移动至
...@@ -64,14 +64,15 @@ ...@@ -64,14 +64,15 @@
</el-dropdown> --> </el-dropdown> -->
</div> </div>
</div> </div>
<div style="border: 1px solid rgb(227, 227, 227);height:674px;overflow: scroll;width:100%"> <div style="border: 1px solid rgb(227, 227, 227);height:674px;overflow: scroll;width:100%">
<div class="basefix app-attachment-list"> <div class="basefix app-attachment-list">
<template v-if="PageMsg.Type==1"> <template v-if="PageMsg.Type==1">
<div class="material-item material-upload"> <div class="material-item material-upload">
<el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp" <el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp"
:show-file-list="false" :http-request="UploadImage" multiple> :show-file-list="false" :http-request="UploadImage" multiple>
<div class="app-upload" flex="main:center cross:center" style="width: 140px; height: 140px;display:flex;justify-content:center;align-items:center"> <div class="app-upload" flex="main:center cross:center"
style="width: 140px; height: 140px;display:flex;justify-content:center;align-items:center">
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
</div> </div>
</el-upload> </el-upload>
...@@ -98,7 +99,8 @@ ...@@ -98,7 +99,8 @@
<el-upload class="avatar-uploader" action="" :before-upload="beforeAvatarUpload" <el-upload class="avatar-uploader" action="" :before-upload="beforeAvatarUpload"
accept="video/mp4,video/ogg,video/webm" :show-file-list="false" :http-request="UploadVideo" accept="video/mp4,video/ogg,video/webm" :show-file-list="false" :http-request="UploadVideo"
multiple> multiple>
<div class="app-upload" flex="main:center cross:center" style="width: 140px; height: 140px;display:flex;justify-content:center;align-items:center"> <div class="app-upload" flex="main:center cross:center"
style="width: 140px; height: 140px;display:flex;justify-content:center;align-items:center">
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
</div> </div>
</el-upload> </el-upload>
...@@ -127,7 +129,8 @@ ...@@ -127,7 +129,8 @@
<div class="material-item material-upload"> <div class="material-item material-upload">
<el-upload class="avatar-uploader" action="" accept=".pdf,.PDF,.ppt,.PPT,.doc,.docx" <el-upload class="avatar-uploader" action="" accept=".pdf,.PDF,.ppt,.PPT,.doc,.docx"
:show-file-list="false" :http-request="UploadpdfFile" multiple> :show-file-list="false" :http-request="UploadpdfFile" multiple>
<div class="app-upload" flex="main:center cross:center" style="width: 140px; height: 140px;display:flex;justify-content:center;align-items:center"> <div class="app-upload" flex="main:center cross:center"
style="width: 140px; height: 140px;display:flex;justify-content:center;align-items:center">
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
</div> </div>
</el-upload> </el-upload>
...@@ -158,14 +161,14 @@ ...@@ -158,14 +161,14 @@
</el-tooltip> </el-tooltip>
</template> </template>
</div> </div>
</div> </div>
<div style="padding-top:10px;float:right"> <div style="padding-top:10px;float:right">
<el-pagination style="text-align:right width:100%" background :current-page="currentPage4" <el-pagination style="text-align:right width:100%" background :current-page="currentPage4"
@current-change="handleCurrentChange" :page-size="PageMsg.pageSize" @current-change="handleCurrentChange" :page-size="PageMsg.pageSize" layout="prev, pager, next,jumper"
layout="prev, pager, next,jumper" :total="total"> :total="total">
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -207,6 +210,9 @@ ...@@ -207,6 +210,9 @@
</div> </div>
</template> </template>
<script> <script>
import {
UploadViittoFile
} from "../../api/common/common";
export default { export default {
name: 'ChooseImg', name: 'ChooseImg',
data() { data() {
...@@ -222,9 +228,9 @@ ...@@ -222,9 +228,9 @@
Name: '', Name: '',
Type: 1, Type: 1,
// Recycled: 1, // Recycled: 1,
ActivityId:0, ActivityId: 0,
pageIndex:1, pageIndex: 1,
pageSize:10, pageSize: 10,
}, },
isIndeterminate: false, isIndeterminate: false,
...@@ -234,7 +240,7 @@ ...@@ -234,7 +240,7 @@
Name: '', Name: '',
Type: '', Type: '',
Sort: '', Sort: '',
ActivityId:0 ActivityId: 0
}, },
addGroupMsgrules: { addGroupMsgrules: {
Name: [{ Name: [{
...@@ -254,7 +260,7 @@ ...@@ -254,7 +260,7 @@
Name: '', Name: '',
Type: 1, Type: 1,
// Recycled: 1, // Recycled: 1,
ActivityId:0, ActivityId: 0,
pageIndex: 1, pageIndex: 1,
pageSize: 20, pageSize: 20,
GroupId: 0, GroupId: 0,
...@@ -270,8 +276,8 @@ ...@@ -270,8 +276,8 @@
Image: '', Image: '',
VideoTime: 0, VideoTime: 0,
WithHeight: 0, WithHeight: 0,
PathType:0, PathType: 0,
ActivityId:0, ActivityId: 0,
}, },
pageMsgDig: false, pageMsgDig: false,
checkList: [], checkList: [],
...@@ -281,11 +287,11 @@ ...@@ -281,11 +287,11 @@
} }
}, },
created() { created() {
if(this.$route.query.Id){ if (this.$route.query.Id) {
this.scgroupMsg.ActivityId=this.$route.query.Id this.scgroupMsg.ActivityId = this.$route.query.Id
this.addGroupMsg.ActivityId=this.$route.query.Id this.addGroupMsg.ActivityId = this.$route.query.Id
this.PageMsg.ActivityId=this.$route.query.Id this.PageMsg.ActivityId = this.$route.query.Id
this.addpageMsg.ActivityId=this.$route.query.Id this.addpageMsg.ActivityId = this.$route.query.Id
} }
this.GetMemberGradeList(); this.GetMemberGradeList();
this.GetPageList(); this.GetPageList();
...@@ -297,18 +303,18 @@ ...@@ -297,18 +303,18 @@
}, },
methods: { methods: {
goBack(){ goBack() {
this.$router.go(-1) this.$router.go(-1)
}, },
//登录后获取上传配置 //登录后获取上传配置
getUpConfig(){ getUpConfig() {
this.apipostDS("/api/MallBase/GetDefaultFileStore", {}, res => { this.apipostDS("/api/MallBase/GetDefaultFileStore", {}, res => {
if(res.data.resultCode == 1){ if (res.data.resultCode == 1) {
console.log(312,res) console.log(312, res)
var upData = res.data.data; var upData = res.data.data;
localStorage.uploadInfo = JSON.stringify(upData); localStorage.uploadInfo = JSON.stringify(upData);
}else{ } else {
this.Error(res.data.message); this.Error(res.data.message);
} }
}) })
...@@ -377,7 +383,7 @@ ...@@ -377,7 +383,7 @@
}, },
// 删除素材 // 删除素材
DeletePage() { DeletePage() {
let that=this let that = this
this.checkList = []; this.checkList = [];
this.PageList.forEach(item => { this.PageList.forEach(item => {
if (item.Selected) { if (item.Selected) {
...@@ -388,73 +394,73 @@ ...@@ -388,73 +394,73 @@
this.Error("至少选择一项!"); this.Error("至少选择一项!");
return; return;
} }
that.$confirm('是否删除?', '提示', { that.$confirm('是否删除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
let MaterialIds = this.checkList.join(","); let MaterialIds = this.checkList.join(",");
this.loading = true; this.loading = true;
this.apipostDS("/api/Education/DelMaterialInfo", { this.apipostDS("/api/Education/DelMaterialInfo", {
MaterialIds: MaterialIds MaterialIds: MaterialIds
}, res => { }, res => {
this.loading = false; this.loading = false;
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.GetPageList(); this.GetPageList();
this.checkList = []; this.checkList = [];
} }
}) })
}).catch(() => {}); }).catch(() => {});
}, },
// 还原 // 还原
HYPage() { HYPage() {
// this.checkList = []; // this.checkList = [];
// this.PageList.forEach(item => { // this.PageList.forEach(item => {
// if (item.Selected) { // if (item.Selected) {
// this.checkList.push(item.Id) // this.checkList.push(item.Id)
// } // }
// }) // })
// if (this.checkList.length == 0) { // if (this.checkList.length == 0) {
// this.Error("至少选择一项!"); // this.Error("至少选择一项!");
// return; // return;
// } // }
// let MaterialIds = this.checkList.join(","); // let MaterialIds = this.checkList.join(",");
// this.loading = true; // this.loading = true;
// this.apipostDS("/api/product/SetMaterialInfoRestore", { // this.apipostDS("/api/product/SetMaterialInfoRestore", {
// MaterialIds: MaterialIds // MaterialIds: MaterialIds
// }, res => { // }, res => {
// this.loading = false; // this.loading = false;
// if (res.data.resultCode == 1) { // if (res.data.resultCode == 1) {
// this.GetPageList(); // this.GetPageList();
// this.checkList = []; // this.checkList = [];
// } // }
// }) // })
}, },
// // 回收 // // 回收
HsPage() { HsPage() {
// this.checkList = []; // this.checkList = [];
// this.PageList.forEach(item => { // this.PageList.forEach(item => {
// if (item.Selected) { // if (item.Selected) {
// this.checkList.push(item.Id) // this.checkList.push(item.Id)
// } // }
// }) // })
// if (this.checkList.length == 0) { // if (this.checkList.length == 0) {
// this.Error("至少选择一项!"); // this.Error("至少选择一项!");
// return; // return;
// } // }
// let MaterialIds = this.checkList.join(","); // let MaterialIds = this.checkList.join(",");
// this.loading = true; // this.loading = true;
// this.apipostDS("/api/product/SetMaterialInfoRecycled", { // this.apipostDS("/api/product/SetMaterialInfoRecycled", {
// MaterialIds: MaterialIds // MaterialIds: MaterialIds
// }, res => { // }, res => {
// this.loading = false; // this.loading = false;
// if (res.data.resultCode == 1) { // if (res.data.resultCode == 1) {
// this.GetPageList(); // this.GetPageList();
// this.checkList = []; // this.checkList = [];
// } // }
// }) // })
}, },
// 单个删除 // 单个删除
...@@ -534,8 +540,8 @@ ...@@ -534,8 +540,8 @@
//上传视频 //上传视频
UploadVideo(file) { UploadVideo(file) {
var that = this; var that = this;
this.UploadSelfFile(this.FileType().Video, file.file, res => { UploadViittoFile('Edu/Video', file.file, res => {
console.log(526,res) console.log("res",res);
if (res.resultCode == 1) { if (res.resultCode == 1) {
that.addpageMsg.Image = res.VideoCoverImg; that.addpageMsg.Image = res.VideoCoverImg;
that.addpageMsg.Path = res.FileUrl; that.addpageMsg.Path = res.FileUrl;
...@@ -566,8 +572,8 @@ ...@@ -566,8 +572,8 @@
// 新增素材信息 // 新增素材信息
addPageList() { addPageList() {
var upInfo = JSON.parse(localStorage.uploadInfo); var upInfo = JSON.parse(localStorage.uploadInfo);
if(upInfo){ if (upInfo) {
this.addpageMsg.PathType=upInfo.StoreType; this.addpageMsg.PathType = upInfo.StoreType;
} }
this.apipostDS("/api/Education/SetGetMaterialInfo", this.addpageMsg, res => { this.apipostDS("/api/Education/SetGetMaterialInfo", this.addpageMsg, res => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
...@@ -593,8 +599,8 @@ ...@@ -593,8 +599,8 @@
} }
}, },
// 删除分组 // 删除分组
delGroup(item){ delGroup(item) {
let that = this; let that = this;
that.$confirm('是否删除?', '提示', { that.$confirm('是否删除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -691,10 +697,10 @@ ...@@ -691,10 +697,10 @@
// Type: this.commonType, // Type: this.commonType,
// Sort: '', // Sort: '',
// } // }
this.addGroupMsg.Id=0 this.addGroupMsg.Id = 0
this.addGroupMsg.Name="" this.addGroupMsg.Name = ""
this.addGroupMsg.Type=this.commonType this.addGroupMsg.Type = this.commonType
this.addGroupMsg.Sort="" this.addGroupMsg.Sort = ""
}, },
// 修改图片视频分组 // 修改图片视频分组
GroupsubmitForm(formName) { GroupsubmitForm(formName) {
...@@ -723,8 +729,8 @@ ...@@ -723,8 +729,8 @@
this.loading = true; this.loading = true;
this.apipostDS("/api/Education/GetMaterialGroupList", this.scgroupMsg, res => { this.apipostDS("/api/Education/GetMaterialGroupList", this.scgroupMsg, res => {
this.loading = false; this.loading = false;
if(res.data.resultCode===1){ if (res.data.resultCode === 1) {
this.groupList = res.data.data; this.groupList = res.data.data;
} }
}) })
......
...@@ -83,9 +83,9 @@ export default { ...@@ -83,9 +83,9 @@ export default {
let domainUrl = 'http://192.168.20.24'; let domainUrl = 'http://192.168.20.24';
let viewFileUrl = 'http://192.168.20.214:8120'; let viewFileUrl = 'http://192.168.20.214:8120';
let mallUrl = "http://192.168.20.17:8014"; let mallUrl = "http://192.168.20.17:8014";
let vtUploadUrl = "http://192.168.20.214:8120"; let vtUploadUrl = "http://192.168.20.24:8120";
// let vtUploadUrl = "http://upload.oytour.com"; // let vtUploadUrl = "http://upload.oytour.com";
let vtViewUrl = "http://192.168.20.214:8130"; let vtViewUrl = "http://192.168.20.24:8130";
let locationName = window.location.hostname; let locationName = window.location.hostname;
if (locationName.indexOf('testerp.oytour') !== -1) { if (locationName.indexOf('testerp.oytour') !== -1) {
domainUrl = "http://testapi.oytour.com"; domainUrl = "http://testapi.oytour.com";
...@@ -533,31 +533,6 @@ export default { ...@@ -533,31 +533,6 @@ export default {
//是否是线上环境【发布时修改为true】 //是否是线上环境【发布时修改为true】
Vue.prototype.isOnline = function () { Vue.prototype.isOnline = function () {
return process.env.NODE_ENV !== 'development'; return process.env.NODE_ENV !== 'development';
},
//上传文件到本地服务器
Vue.prototype.UploadSelfFile = function (path, file, callback) {
var that = this;
that.Info('上传中...')
var newPath = '/Upload/' + path + "/";
var formData = new FormData();
var uploadUrl = that.domainManager().VTUploadUrl + "/Upload?filePath=" + newPath + "&isCreateCover=1";
formData.append("myfile", file);
that.$http.post(uploadUrl, formData, {})
.then(res => {
if (res && res.status == 200 && res.data && res.data.FilePath) {
var uploadResult = {
resultCode: 1,
FileName: file.name,
FileUrl: that.domainManager().VTViewUrl + res.data.FilePath,
VideoCoverImg: that.domainManager().VTViewUrl + res.data.VideoCoverImg
}
if (callback) {
callback(uploadResult);
}
}
}).catch(function (reason) {
console.log(reason)
});
} }
} }
} }
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