Commit 25312e45 by 张宸

Merge remote-tracking branch 'origin/master'

parents 6b463d17 15d232ff
<template>
<div class="flex-container">
<!-- &lt;!&ndash; 查询区域 &ndash;&gt;
<a-upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
listType="picture"
@change="transformFile"
:beforeUpload="beforeUpload"
:showUploadList="false"
>
<a-button> <a-icon type="upload" />上传图片</a-button>
</a-upload>-->
<a-upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
:beforeUpload="transformFile"
>
<a-button> <a-icon type="upload" /> 上传图片 </a-button>
</a-upload>
<div class="table-page-search-wrapper">
<div class="table-page-search-wrapper" >
<!-- 搜索区域 -->
<a-form layout="inline">
<a-row :gutter="24">
<a-col :md="4" :sm="12">
<a-form-item label="是否启用:">
<a-select v-model="queryParam.enable" style="width: 120px">
<a-select-option value>全部</a-select-option>
<a-select-option value="0">不启用</a-select-option>
<a-select-option value="1">启用</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="12">
<a-button @click="search()" type="primary">查询</a-button>
<a-divider type="vertical"/>
<a-upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
:beforeUpload="uploadPicture"
>
<a-button> <a-icon type="upload" /> 上传图片 </a-button>
</a-upload>
</a-col>
</a-row>
</a-form>
</div>
<new-poster ref="model1"></new-poster>
......@@ -30,24 +34,25 @@
{{ text | dayjs}}
</template>
<template slot="picture" slot-scope="text">
<img src="">
<!--<img :src="text">-->
<img style="height: 50px" src="http://yrym.winsun-aly.com/gdtel-xyzx-hhr/images/yrym-ruanyan-logo.png">
</template>
<template slot="enable" slot-scope="text">
<span v-if="text == 0">不启用</span>
<span v-if="text == 1">启用</span>
</template>
<template slot="operation" slot-scope="text">
<!-- <a-form layout="inline">
<a-row :gutter="24">
<span class="table-page-search-submitButtons" style="float: left; overflow: hidden;">
<a-col :md="6" :sm="24">
<a-button @click="addPoster()" type="primary">新建海报</a-button>
</a-col>
</span>
</a-row>
</a-form>-->
<template slot="operation" slot-scope="text, record">
<span>
<a @click="addPoster()">新建海报</a>
<a @click="addPoster(record.picture)">新建海报</a>
<a-divider type="vertical"/>
<a-popconfirm title="是否要删除此行?" @confirm="remove(record.id)">
<a>删除</a>
</a-popconfirm>
<a-divider type="vertical"/>
<a v-show="record.enable == '0'"
@click="updateEnable(record.id,'1')">启用</a>
<a v-show="record.enable == '1'"
@click="updateEnable(record.id,'0')">不启用</a>
</span>
</template>
</s-table>
......@@ -60,8 +65,8 @@
<script>
import STable from '@/components/table';
import {universityList,universityDelete,universityInsert,universityUpdate} from "@/api/school-center/productAPI"
import {uploadPicture} from "@/api/school-center/qrCode"
import {universityDelete,universityInsert,universityUpdate} from "@/api/school-center/productAPI"
import {listPicture,uploadPicture,deletePicture,updateEnable} from "@/api/school-center/qrCode"
import {cloneObject} from '@/utils/util';
import newPoster from './newPoster'
function getBase64(img, callback) {
......@@ -82,8 +87,7 @@
modifyvisible: false,
add: true,
queryParam: {
universityName :'', //学校
universityRegion :'', // 区域
enable :'', //是否启用
},
modelData:{
universityName:'',
......@@ -103,8 +107,8 @@
},
columns: [
{dataIndex: 'picture', title: '图片 ', scopedSlots: {customRender: 'picture'}},
{dataIndex: 'createTime', width: 150, title: '创建时间 ', scopedSlots: {customRender: 'createTime'}},
{dataIndex: 'enable', width: 50, title: '是否启用 ', scopedSlots: {customRender: 'enable'}},
{dataIndex: 'createTime', width: 100, title: '创建时间 ', scopedSlots: {customRender: 'createTime'}},
{dataIndex: 'enable', width: 50, title: '启用状态', scopedSlots: {customRender: 'enable'}},
{
dataIndex: 'operation',
width: 100,
......@@ -116,11 +120,10 @@
rowdata: parameter => {
let params = {
pageNo: parameter.pageNo,
pageSize: parameter.pageSize
pageSize: parameter.pageSize,
enable:this.queryParam.enable
}
let obj = cloneObject(this.queryParam)
//表示
return universityList(Object.assign(params,obj)).then(res => {
return listPicture(params).then(res => {
let data = {}
if (res.state !== 'success') {
data = {
......@@ -143,7 +146,7 @@
}
},
methods:{
transformFile(file) {
uploadPicture(file) {
return new Promise(resolve => {
const reader = new FileReader();
reader.readAsDataURL(file);
......@@ -162,12 +165,12 @@
ctx.fillRect(0,0,canvas.width,canvas.height)
ctx.drawImage(img,0,0,width,height)
const picture = canvas.toDataURL('image/jpeg')
console.log(picture)
return uploadPicture({picture}).then(res => {
if(res.state == 'error'){
this.$message.error(res.msg,5);
if(res == 'error'){
this.$message.error('删除失败!',5);
}
if(res.state == 'success'){
this.search()
this.$message.success(res.data,5);
}
})
......@@ -175,31 +178,42 @@
};
});
},
addPoster(){
this.$refs.model1.showModal();
addPoster(picture){
picture = 'http://yrym.winsun-aly.com/gdtel-xyzx-hhr/images/yrym-ruanyan-logo.png'
this.$refs.model1.showModal(picture);
},
search() {
this.$refs.table.refresh({search: true})
},
uploadPicture(){
remove(id) {
deletePicture(id).then((res) => {
if(res.state=="success"){
this.$notification.success({message: res.data, description: '', duration: 4})
this.search()
}
if(res.state=="error"){
this.$notification.error({message: res.msg, description: '', duration: 4})
}
})
},
beforeUpload(file) {
updateEnable(id,enable) {
updateEnable(id,{enable}).then((res) => {
if(res.state=="success"){
this.$notification.success({message: res.data, description: '', duration: 4})
this.search()
}
if(res.state=="error"){
this.$notification.error({message: res.msg, description: '', duration: 4})
}
})
},
remove(id) {
universityDelete(id).then((res) => {
if(res.state=="success"){
this.$notification.success({message: res.data, description: '', duration: 4})
}
this.$refs.table.refresh({search: true})
})
},
modifyfunction(data){
if(data != undefined ){
setTimeout(()=>{
......
......@@ -12,10 +12,10 @@
<div class="meun-box">
<a-row>
<a-col :span="6">
<div class="select-btn">
<!-- <div class="select-btn">
<span>选择图片</span>
<input ref="selectImgae" class="seletImg" type="file" @change="selectImage" />
</div>
</div>-->
<a-button @click="toImage" v-if="images != ''">生成图片</a-button>
</a-col>
<a-col :span="6" v-if="images!=''">
......@@ -50,7 +50,8 @@ export default {
};
},
methods: {
showModal() {
showModal(picture) {
this.images=picture
this.visible = true;
},
onClose() {
......@@ -64,6 +65,7 @@ export default {
var reader = new FileReader();
reader.onload = evt => {
let result = evt.target.result;
debugger
this.images = result;
};
reader.readAsDataURL(file.files[0]);
......
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