Commit ce4ebd3c authored by Mac's avatar Mac

1

parent eed46dfb
...@@ -390,3 +390,31 @@ export function EduDownLoad(cmd, msg, fileName, callBack) { ...@@ -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 @@ ...@@ -41,8 +41,8 @@
<el-upload class="avatar-uploader materialupload" action="" :before-upload="uploadFile" <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"> 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;" <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;"
v-if="addMsg.ImageModel && addMsg.ImageModel.ImagePath==''"></i> v-if=" addMsg.ImageModel.ImagePath==''"></i>
<q-img v-else :src="addMsg.ImageModel && addMsg.ImageModel.ImagePath" <q-img v-else :src="addMsg.ImageModel.ImagePath"
style="width: 110px;height: 110px;border-radius: 6px;display: flex;"> style="width: 110px;height: 110px;border-radius: 6px;display: flex;">
</q-img> </q-img>
</el-upload> </el-upload>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white"> <q-card-actions align="right" class="bg-white">
<q-btn class="q-mr-md" label="取消" @click="getcancel" /> <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-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<script> <script>
import { import {
UploadFileToALi wechatUploadSelfFile
} from "../../../api/common/common"; //上传图片 } from "../../../api/common/common"; //上传图片
import { import {
setWeChatMediumInfo,//新增修改素材 setWeChatMediumInfo,//新增修改素材
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
message: res.Message, message: res.Message,
position: 'top' position: 'top'
}) })
this.addMsg = Object.assign({}, addobj) this.gettype()
this.$emit('editsuccess') this.$emit('editsuccess')
}) })
}, },
...@@ -190,20 +190,38 @@ ...@@ -190,20 +190,38 @@
position: 'top' position: 'top'
}) })
} else { } 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 @@ ...@@ -6,10 +6,10 @@
<q-btn color="accent" style="float:right;" size="sm" class="q-mr-md" icon="cloud_upload" label="上传图片" <q-btn color="accent" style="float:right;" size="sm" class="q-mr-md" icon="cloud_upload" label="上传图片"
@click="goadd()"></q-btn> @click="goadd()"></q-btn>
</div> </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' <q-card class="imgcard" v-for="(x,y) in dataList" :key='y'
:style="{border:x.check==true?'2px solid #91d5ff':'2px solid #FFF'}" :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> <q-card-section>
<div <div
style="display:flex;align-items: center;justify-content: space-between;margin-bottom: 5px;"> style="display:flex;align-items: center;justify-content: space-between;margin-bottom: 5px;">
...@@ -17,22 +17,23 @@ ...@@ -17,22 +17,23 @@
<!-- <q-btn class="q-mr-md" label="编辑" size="xs" color="accent" style="margin-right: 0;" @click.stop="goedit(x)" /> --> <!-- <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> <i class="el-icon-edit-outline" style="font-size: 20px;color: #1890ff;" @click.stop="goedit(x)"></i>
</div> </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" <div class="absolute-bottom text-subtitle1 text-center onetext"
style="padding: 0;padding: 0 5px;font-size: 12px;"> style="padding: 0;padding: 0 5px;font-size: 12px;" v-if='x.ImageModel'>
{{x.title}} {{x.ImageModel.ImageName}}
</div> </div>
</q-img> </q-img>
<div class="onetext" style="margin-top: 5px;">上传者:{{x.CreatorName}}</div> <div class="onetext" style="margin-top: 5px;">上传者:{{x.UpdateByName}}</div>
<div class="onetext" style="margin-top: 5px;">来源:{{x.source}}</div> <div class="onetext" style="margin-top: 5px;">分组:{{x.MediumGroupName}}</div>
</q-card-section> </q-card-section>
</q-card> </q-card>
<div style="width: 100%;height: 50px;line-height: 50px;text-align: center;">暂无数据</div>
</div> </div>
<div style="width: 100%;height: 50px;line-height: 50px;text-align: center;" v-if="dataList.length==0">暂无数据</div>
</div> </div>
<div v-if="Isadd==true"> <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>
</div> </div>
...@@ -41,7 +42,6 @@ ...@@ -41,7 +42,6 @@
<script> <script>
import alladdsc from './allAddSC' import alladdsc from './allAddSC'
const addobj={ Id: 0, classifyId: '', img: '',}
export default { export default {
name: "imgmaterial", name: "imgmaterial",
components: { components: {
...@@ -61,42 +61,32 @@ ...@@ -61,42 +61,32 @@
return { return {
loading: false, loading: false,
Isadd: false, Isadd: false,
addMsg: Object.assign({}, addobj) editobj:null
} }
}, },
created() { created() {
}, },
methods: { methods: {
changePage(e) {
},
goadd() { goadd() {
this.Isadd = true; this.Isadd = true;
this.addMsg= Object.assign({}, addobj) this.editobj=null
}, },
goedit(x){ goedit(row){
this.Isadd = true; this.Isadd = true;
this.addMsg.img= x.Content
},
getchildren(){
this.$emit('editsuccess')
this.Isadd = false
},
goedits(row){
this.editobj= {} this.editobj= {}
this.editobj.Id = row.Id; this.editobj.Id = row.Id;
this.editobj.MediaGroupId = row.MediaGroupId; this.editobj.MediaGroupId = row.MediaGroupId;
this.editobj.Type = row.Type; 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 this.Isadd = true
console.log(row,'row')
}, },
submit(){//提交
} getchildren(){
this.$emit('editsuccess')
this.Isadd = false
},
} }
} }
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
@click="goadd()"></q-btn> @click="goadd()"></q-btn>
</div> </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;">
<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'}" :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> <q-card-section>
<div <div
style="display:flex;align-items: center;justify-content: space-between;margin-bottom: 5px;"> style="display:flex;align-items: center;justify-content: space-between;margin-bottom: 5px;">
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<div class="onetext" style="margin-top: 5px;">来源:{{x.source}}</div> <div class="onetext" style="margin-top: 5px;">来源:{{x.source}}</div>
</q-card-section> </q-card-section>
</q-card> </q-card>
<div style="width: 100%;height: 50px;line-height: 50px;text-align: center;" v-if="dataList.length==0">暂无数据</div>
</div> </div>
</div> </div>
...@@ -79,79 +80,52 @@ ...@@ -79,79 +80,52 @@
import { import {
UploadSelfFile UploadSelfFile
} from "../../../api/common/common"; //上传图片 } from "../../../api/common/common"; //上传图片
const addobj = { Id: 0, classifyId: '', img: '', title: '', content: '', } import alladdsc from './allAddSC'
export default { export default {
name: "imgtextmaterial", name: "imgtextmaterial",
components: {
alladdsc,
},
props: {
dataList: {
type: Array,
default: [],
},
allclassifyList:{
type: Array,
default: [],
}
},
data() { data() {
return { return {
loading: false, loading: false,
Isadd: false, Isadd: false,
data: [{ editobj:null
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)
} }
}, },
created() { created() {
}, },
methods: { methods: {
changePage(e) {
},
goadd() { goadd() {
this.Isadd = true; this.Isadd = true;
this.addMsg = Object.assign({}, addobj) this.editobj=null
}, },
goedit(x) { goedit(row){
this.Isadd = true; 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) {//图片上传 getchildren(){
UploadSelfFile("course", files, res => { this.$emit('editsuccess')
if (res.Code == 1) { this.Isadd = false
this.addMsg.img = res.FileUrl;
}
});
}, },
submit() {//提交
}
} }
} }
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
</template> </template>
<template v-slot:body-cell-title="props"> <template v-slot:body-cell-title="props">
<q-td :props="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> </q-td>
</template> </template>
<template v-slot:body-cell-Content="props"> <template v-slot:body-cell-Content="props">
<q-td :props="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> </q-td>
</template> </template>
<template v-slot:bottom> <template v-slot:bottom>
...@@ -144,7 +144,6 @@ ...@@ -144,7 +144,6 @@
this.editobj.Type = row.Type; this.editobj.Type = row.Type;
this.editobj.TextModel = JSON.parse(JSON.stringify(row.TextModel)) ; this.editobj.TextModel = JSON.parse(JSON.stringify(row.TextModel)) ;
this.Isadd = true this.Isadd = true
console.log(row,'row')
}, },
goDetailed(row){//删除 goDetailed(row){//删除
let delMsg = { let delMsg = {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
 <imgmaterial :dataList='dataList' :allclassifyList='allclassifyList' @editsuccess="getchildren"></imgmaterial>  <imgmaterial :dataList='dataList' :allclassifyList='allclassifyList' @editsuccess="getchildren"></imgmaterial>
</div> </div>
<div v-if="tabCheck=='3'"> <div v-if="tabCheck=='3'">
 <imgtextmaterial></imgtextmaterial>  <imgtextmaterial :dataList='dataList' :allclassifyList='allclassifyList' @editsuccess="getchildren"></imgtextmaterial>
</div> </div>
<div v-if="tabCheck=='4'"> <div v-if="tabCheck=='4'">
 <audiomaterial></audiomaterial>  <audiomaterial></audiomaterial>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
pageSize: 10, pageSize: 10,
rowsPerPage: 10, rowsPerPage: 10,
MediaGroupId: 0,//分组 MediaGroupId: 0,//分组
Type: 0,//类型 Type: 1,//类型
Content: '', Content: '',
}, },
classifyList: [], classifyList: [],
...@@ -125,6 +125,10 @@ ...@@ -125,6 +125,10 @@
getWeChatMediumPageList(this.msg).then(res => { getWeChatMediumPageList(this.msg).then(res => {
this.dataList = res.Data.PageData; this.dataList = res.Data.PageData;
this.PageCount = res.Data.PageCount 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