Commit ce4ebd3c authored by Mac's avatar Mac

1

parent eed46dfb
......@@ -390,3 +390,31 @@ export function EduDownLoad(cmd, msg, fileName, callBack) {
}
})
}
/**
* 上传文件 企微写死阿里云
*/
export function wechatUploadSelfFile(path, file, callback, configObj) {
//用户登录缓存
//配置写死的 阿里云
var uploadConfig = {
Region:"oss-cn-chengdu",
SecretId:"LTAIwE7l9dImZSa3",
SecretKey:"j47Ajn0d0WzUCIX8Biyj3P2r8QDltI",
Bucket: "vt-im-bucket"
};
//获取文件扩展名
var index = file.name.lastIndexOf(".");
var suffix = file.name.substr(index);
var timestamp1 = Date.parse(new Date()) + "_" + (Math.ceil(Math.random() * 1000));
let str = '/Test';
var newPath = "/EduSystem" + str + '/Upload/' + path;
var uploadLoadding = Loading;
uploadLoadding.show({
message: '正在上传文件,请稍后...'
})
if (uploadConfig) {
newPath += "/" + timestamp1 + "" + suffix;
UploadFileToALi(uploadConfig, newPath, file, uploadLoadding, callback);
}
}
\ No newline at end of file
......@@ -41,8 +41,8 @@
<el-upload class="avatar-uploader materialupload" action="" :before-upload="uploadFile"
accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp" :show-file-list="false">
<i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;"
v-if="addMsg.ImageModel && addMsg.ImageModel.ImagePath==''"></i>
<q-img v-else :src="addMsg.ImageModel && addMsg.ImageModel.ImagePath"
v-if=" addMsg.ImageModel.ImagePath==''"></i>
<q-img v-else :src="addMsg.ImageModel.ImagePath"
style="width: 110px;height: 110px;border-radius: 6px;display: flex;">
</q-img>
</el-upload>
......@@ -56,7 +56,7 @@
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn class="q-mr-md" label="取消" @click="getcancel" />
<q-btn color="accent" class="q-mr-md" label="添加" @click="submit()" />
<q-btn color="accent" class="q-mr-md" label="添加" @click="saveImage()" />
</q-card-actions>
</q-card>
</q-dialog>
......@@ -68,7 +68,7 @@
<script>
import {
UploadFileToALi
wechatUploadSelfFile
} from "../../../api/common/common"; //上传图片
import {
setWeChatMediumInfo,//新增修改素材
......@@ -136,7 +136,7 @@
message: res.Message,
position: 'top'
})
this.addMsg = Object.assign({}, addobj)
this.gettype()
this.$emit('editsuccess')
})
},
......@@ -190,20 +190,38 @@
position: 'top'
})
} else {
Uploadwechat('wechat',files,res=>{
wechatUploadSelfFile('wechatcatalogue',files,res=>{
if (res.Code == 1) {
this.addMsg.ImageModel.ImageName = res.FileName;
this.addMsg.ImageModel.ImagePath = res.FileUrl;
this.$forceUpdate();
}
})
// UploadSelfFile("course", files, res => {
// if (res.Code == 1) {
// this.addMsg.ImageModel.ImageName = res.FileName;
// this.addMsg.ImageModel.ImagePath = res.FileUrl;
// }
// });
}
},
saveImage(){
if (this.addMsg.MediaGroupId == '') {
this.$q.notify({
type: 'negative',
message: `分组选择`,
position: 'top'
})
return
}
if (this.addMsg.ImageModel.ImagePath == '') {
this.$q.notify({
type: 'negative',
message: `请上传图片`,
position: 'top'
})
return
}
this.setWeChat()
}
}
}
......
......@@ -6,10 +6,10 @@
<q-btn color="accent" style="float:right;" size="sm" class="q-mr-md" icon="cloud_upload" label="上传图片"
@click="goadd()"></q-btn>
</div>
<div style="width: 100%;display: flex;align-items: center;flex-wrap: wrap;padding: 10px 20px;">
<div style="width: 100%;display: flex;align-items: center;flex-wrap: wrap;padding: 10px 20px;" v-if="dataList.length>0">
<q-card class="imgcard" v-for="(x,y) in dataList" :key='y'
:style="{border:x.check==true?'2px solid #91d5ff':'2px solid #FFF'}"
@click="data[y].check = !data[y].check">
@click="dataList[y].check = !dataList[y].check,$forceUpdate();">
<q-card-section>
<div
style="display:flex;align-items: center;justify-content: space-between;margin-bottom: 5px;">
......@@ -17,22 +17,23 @@
<!-- <q-btn class="q-mr-md" label="编辑" size="xs" color="accent" style="margin-right: 0;" @click.stop="goedit(x)" /> -->
<i class="el-icon-edit-outline" style="font-size: 20px;color: #1890ff;" @click.stop="goedit(x)"></i>
</div>
<q-img :src="x.Content" class="imgstyle">
<q-img :src="x.ImageModel && x.ImageModel.ImagePath?x.ImageModel.ImagePath:''" class="imgstyle">
<div class="absolute-bottom text-subtitle1 text-center onetext"
style="padding: 0;padding: 0 5px;font-size: 12px;">
{{x.title}}
style="padding: 0;padding: 0 5px;font-size: 12px;" v-if='x.ImageModel'>
{{x.ImageModel.ImageName}}
</div>
</q-img>
<div class="onetext" style="margin-top: 5px;">上传者:{{x.CreatorName}}</div>
<div class="onetext" style="margin-top: 5px;">来源:{{x.source}}</div>
<div class="onetext" style="margin-top: 5px;">上传者:{{x.UpdateByName}}</div>
<div class="onetext" style="margin-top: 5px;">分组:{{x.MediumGroupName}}</div>
</q-card-section>
</q-card>
<div style="width: 100%;height: 50px;line-height: 50px;text-align: center;">暂无数据</div>
</div>
<div style="width: 100%;height: 50px;line-height: 50px;text-align: center;" v-if="dataList.length==0">暂无数据</div>
</div>
<div v-if="Isadd==true">
<alladdsc :allclassifyList="allclassifyList" type='2' @editsuccess="getchildren" @getcancel='Isadd=false'></alladdsc>
<alladdsc :allclassifyList="allclassifyList" type='2' @editsuccess="getchildren" :editobj='editobj' @getcancel='Isadd=false'></alladdsc>
</div>
</div>
......@@ -41,7 +42,6 @@
<script>
import alladdsc from './allAddSC'
const addobj={ Id: 0, classifyId: '', img: '',}
export default {
name: "imgmaterial",
components: {
......@@ -61,42 +61,32 @@
return {
loading: false,
Isadd: false,
addMsg: Object.assign({}, addobj)
editobj:null
}
},
created() {
},
methods: {
changePage(e) {
},
goadd() {
this.Isadd = true;
this.addMsg= Object.assign({}, addobj)
this.editobj=null
},
goedit(x){
goedit(row){
this.Isadd = true;
this.addMsg.img= x.Content
},
getchildren(){
this.$emit('editsuccess')
this.Isadd = false
},
goedits(row){
this.editobj= {}
this.editobj.Id = row.Id;
this.editobj.MediaGroupId = row.MediaGroupId;
this.editobj.Type = row.Type;
this.editobj.TextModel = JSON.parse(JSON.stringify(row.TextModel)) ;
this.editobj.ImageModel = JSON.parse(JSON.stringify(row.ImageModel)) ;
this.Isadd = true
console.log(row,'row')
},
submit(){//提交
}
getchildren(){
this.$emit('editsuccess')
this.Isadd = false
},
}
}
......
......@@ -7,9 +7,9 @@
@click="goadd()"></q-btn>
</div>
<div style="width: 100%;display: flex;align-items: center;flex-wrap: wrap;padding: 10px 20px;">
<q-card class="imgcard" v-for="(x,y) in data" :key='y'
<q-card class="imgcard" v-for="(x,y) in dataList" :key='y'
:style="{border:x.check==true?'2px solid #91d5ff':'2px solid #FFF'}"
@click="data[y].check = !data[y].check">
@click="dataList[y].check = !dataList[y].check">
<q-card-section>
<div
style="display:flex;align-items: center;justify-content: space-between;margin-bottom: 5px;">
......@@ -28,6 +28,7 @@
<div class="onetext" style="margin-top: 5px;">来源:{{x.source}}</div>
</q-card-section>
</q-card>
<div style="width: 100%;height: 50px;line-height: 50px;text-align: center;" v-if="dataList.length==0">暂无数据</div>
</div>
</div>
......@@ -79,79 +80,52 @@
import {
UploadSelfFile
} from "../../../api/common/common"; //上传图片
const addobj = { Id: 0, classifyId: '', img: '', title: '', content: '', }
import alladdsc from './allAddSC'
export default {
name: "imgtextmaterial",
components: {
alladdsc,
},
props: {
dataList: {
type: Array,
default: [],
},
allclassifyList:{
type: Array,
default: [],
}
},
data() {
return {
loading: false,
Isadd: false,
data: [{
Type: 1,
title: '测试文本.png',
Content: 'http://imgfile.oytour.com/EduSystem/Test/Upload/course/202107070330161360000000064.jpg',
source: '本地上传',
CreatorName: '小张',
check: false,
UpdateTime: '2021-08-04 15:48'
}, {
Type: 1,
title: '测试文本.png',
Content: 'http://imgfile.oytour.com/EduSystem/Test/Upload/course/202107090216027320000000011.jpg',
source: '本地上传',
CreatorName: '小张',
check: false,
UpdateTime: '2021-08-04 15:48'
}, {
Type: 1,
title: '测试文本.png',
Content: 'http://imgfile.oytour.com/EduSystem/Test/Upload/course/202107090302364350000000080.jpg',
source: '本地上传',
CreatorName: '小张',
check: false,
UpdateTime: '2021-08-04 15:48'
},],
pageCount: 0,
msg: {
pageIndex: 1,
pageSize: 18,
},
classifyList: [
{ Name: '活动', ID: 1, },
{ Name: '产品', ID: 2, },
{ Name: '校园', ID: 3, },
],
addMsg: Object.assign({}, addobj)
editobj:null
}
},
created() {
},
methods: {
changePage(e) {
},
goadd() {
this.Isadd = true;
this.addMsg = Object.assign({}, addobj)
this.editobj=null
},
goedit(x) {
goedit(row){
this.Isadd = true;
this.addMsg.img = x.Content
this.editobj= {}
this.editobj.Id = row.Id;
this.editobj.MediaGroupId = row.MediaGroupId;
this.editobj.Type = row.Type;
this.editobj.ImageModel = JSON.parse(JSON.stringify(row.ImageModel)) ;
this.Isadd = true
console.log(row)
},
uploadFile(files) {//图片上传
UploadSelfFile("course", files, res => {
if (res.Code == 1) {
this.addMsg.img = res.FileUrl;
}
});
getchildren(){
this.$emit('editsuccess')
this.Isadd = false
},
submit() {//提交
}
}
}
......
......@@ -12,12 +12,12 @@
</template>
<template v-slot:body-cell-title="props">
<q-td :props="props">
<span>{{props.row.TextModel.Title}}</span>
<span>{{props.row.TextModel && props.row.TextModel.Title?:props.row.TextModel.Title:''}}</span>
</q-td>
</template>
<template v-slot:body-cell-Content="props">
<q-td :props="props">
<span>{{props.row.TextModel.Content}}</span>
<span>{{props.row.TextModel && props.row.TextModel.Content?:props.row.TextModel.Content:''}}</span>
</q-td>
</template>
<template v-slot:bottom>
......@@ -144,7 +144,6 @@
this.editobj.Type = row.Type;
this.editobj.TextModel = JSON.parse(JSON.stringify(row.TextModel)) ;
this.Isadd = true
console.log(row,'row')
},
goDetailed(row){//删除
let delMsg = {
......
......@@ -29,7 +29,7 @@
 <imgmaterial :dataList='dataList' :allclassifyList='allclassifyList' @editsuccess="getchildren"></imgmaterial>
</div>
<div v-if="tabCheck=='3'">
 <imgtextmaterial></imgtextmaterial>
 <imgtextmaterial :dataList='dataList' :allclassifyList='allclassifyList' @editsuccess="getchildren"></imgtextmaterial>
</div>
<div v-if="tabCheck=='4'">
 <audiomaterial></audiomaterial>
......@@ -90,7 +90,7 @@
pageSize: 10,
rowsPerPage: 10,
MediaGroupId: 0,//分组
Type: 0,//类型
Type: 1,//类型
Content: '',
},
classifyList: [],
......@@ -125,6 +125,10 @@
getWeChatMediumPageList(this.msg).then(res => {
this.dataList = res.Data.PageData;
this.PageCount = res.Data.PageCount
this.dataList.forEach(x=>{
x.check= false
})
console.log( this.dataList)
})
},
......
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