Browse Source

发放空投,转赠页面

dev
caoyizhong 3 years ago
parent
commit
e4134448d3
  1. 44
      src/api/wjnft/donation.js
  2. 320
      src/views/wjnft/donation/index.vue
  3. 11
      src/views/wjnft/information/index.vue
  4. 254
      src/views/wjnft/mycollection/index.vue

44
src/api/wjnft/donation.js

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询用户转赠记录列表
export function listDonation(query) {
return request({
url: '/wjnft/donation/list',
method: 'get',
params: query
})
}
// 查询用户转赠记录详细
export function getDonation(id) {
return request({
url: '/wjnft/donation/' + id,
method: 'get'
})
}
// 新增用户转赠记录
export function addDonation(data) {
return request({
url: '/wjnft/donation',
method: 'post',
data: data
})
}
// 修改用户转赠记录
export function updateDonation(data) {
return request({
url: '/wjnft/donation',
method: 'put',
data: data
})
}
// 删除用户转赠记录
export function delDonation(id) {
return request({
url: '/wjnft/donation/' + id,
method: 'delete'
})
}

320
src/views/wjnft/donation/index.vue

@ -0,0 +1,320 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="被转赠人电话" prop="donationPhone" label-width="50">
<el-input
v-model="queryParams.donationPhone"
placeholder="请输入被转赠人电话"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="" prop="informationId" label-width="50">-->
<!-- <el-input-->
<!-- v-model="queryParams.informationId"-->
<!-- placeholder="请输入藏品信息表id"-->
<!-- clearable-->
<!-- size="small"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- <el-row :gutter="10" class="mb8">-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['wjnft:donation:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['wjnft:donation:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['wjnft:donation:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['wjnft:donation:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!-- </el-row>-->
<el-table v-loading="loading" :data="donationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index"/>
<el-table-column label="用户名称" align="center" prop="usersId" />
<el-table-column label="被转赠人电话" align="center" prop="donationPhone" />
<el-table-column label="被转赠人名称" align="center" prop="donationPersonId" />
<!-- <el-table-column label="转赠作品图片" align="center" prop="myCollectionId" />-->
<el-table-column label="转赠作品" align="center" prop="informationId" />
<el-table-column label="创建时间" align="center" prop="createdTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="修改时间" align="center" prop="updatedTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['wjnft:donation:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['wjnft:donation:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改用户转赠记录对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户id" prop="usersId">
<el-input v-model="form.usersId" placeholder="请输入用户id" />
</el-form-item>
<el-form-item label="被转赠人电话" prop="donationPhone">
<el-input v-model="form.donationPhone" placeholder="请输入被转赠人电话" />
</el-form-item>
<el-form-item label="被转赠人ID" prop="donationPersonId">
<el-input v-model="form.donationPersonId" placeholder="请输入被转赠人ID" />
</el-form-item>
<el-form-item label="转赠作品id" prop="myCollectionId">
<el-input v-model="form.myCollectionId" placeholder="请输入转赠作品id" />
</el-form-item>
<el-form-item label="藏品信息表id" prop="informationId">
<el-input v-model="form.informationId" placeholder="请输入藏品信息表id" />
</el-form-item>
<el-form-item label="创建时间" prop="createdTime">
<el-date-picker clearable size="small"
v-model="form.createdTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="修改时间" prop="updatedTime">
<el-date-picker clearable size="small"
v-model="form.updatedTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择修改时间">
</el-date-picker>
</el-form-item>
<el-form-item label="删除时间" prop="deletedTime">
<el-date-picker clearable size="small"
v-model="form.deletedTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择删除时间">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDonation, getDonation, delDonation, addDonation, updateDonation } from "@/api/wjnft/donation";
export default {
name: "Donation",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
donationList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
usersId: null,
donationPhone: null,
donationPersonId: null,
myCollectionId: null,
informationId: null,
createdTime: null,
updatedTime: null,
deletedTime: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询用户转赠记录列表 */
getList() {
this.loading = true;
listDonation(this.queryParams).then(response => {
this.donationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
usersId: null,
donationPhone: null,
donationPersonId: null,
myCollectionId: null,
informationId: null,
createdTime: null,
updatedTime: null,
deletedTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加用户转赠记录";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDonation(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改用户转赠记录";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDonation(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDonation(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除用户转赠记录编号为"' + ids + '"的数据项?').then(function() {
return delDonation(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('wjnft/donation/export', {
...this.queryParams
}, `donation_${new Date().getTime()}.xlsx`)
}
}
};
</script>

11
src/views/wjnft/information/index.vue

@ -182,6 +182,14 @@
{{ scope.row.state === 1 ? '已出售': '' }}
</template>
</el-table-column>
<el-table-column label="上链状态" align="center" prop="currentNumber" >
<template slot-scope="scope">
<span v-if="scope.row.onChainStatus === 0">{{ "待铸造" }}</span>
<span v-if="scope.row.onChainStatus === 1">{{ "已铸造" }}</span>
<span v-if="scope.row.onChainStatus === 2">{{ "链上确认" }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="创建人" align="center" prop="createdBy" />-->
<!-- <el-table-column label="创建时间" align="center" prop="createdTime" width="180">-->
<!-- <template slot-scope="scope">-->
@ -210,7 +218,7 @@
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['wjnft:information:remove']"-->
<!-- >转赠</el-button>-->
<!-- >修改</el-button>-->
</template>
</el-table-column>
</el-table>
@ -459,6 +467,7 @@ export default {
airPhone : this.air.airPhone,
}
airInformation(num).then(()=>{
this.$message.success("赠送成功");
this.getList();
});
this.stepLoading = false;

254
src/views/wjnft/mycollection/index.vue

@ -132,6 +132,25 @@
<el-table-column label="用户姓名" align="center" prop="userName" />
<el-table-column label="用户电话" align="center" prop="phone" />
<el-table-column label="作品信息ID" align="center" prop="informationTableId" />
<el-table-column label="作品图片" align="center" prop="collPath">
<template slot-scope="scope">
<div class="demo-image">
<div class="block">
<el-image
style="
width: 50px;
height: 51px;
border-radius: 6px;
z-index: 2;
"
:src="scope.row.collPath"
:preview-src-list="srcList"
>
</el-image>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="作品状态" align="center" prop="onChainStatus">
<template slot-scope="scope">
<span v-if="scope.row.onChainStatus === 0">待铸造</span>
@ -156,14 +175,14 @@
<span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- ></el-button>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="collectionChanges(scope.row)"
>作品更</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
@ -171,8 +190,8 @@
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['wjnft:mycollection:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</template>
</el-table-column>
</el-table>
<pagination
@ -182,6 +201,69 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改我的作品 对话框 -->
<el-dialog :title="title" :visible.sync="collChanges" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="作品图片" prop="onChainStatus">
<!-- <el-input v-model="form.onChainStatus" placeholder="请选择作品状态" />-->
<div>
<el-upload
ref="upload"
:action="action"
:headers="headers"
:limit="1"
:on-exceed="handleExceed"
list-type="picture-card"
:on-success="handleSuccess"
:auto-upload="true"
:before-upload="beforeUpload"
:file-list="imgList"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img
class="el-upload-list__item-thumbnail"
:src="file.url" alt=""
>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in"></i>
</span>
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<i class="el-icon-download"></i>
</span>
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
</div>
<span> 上传文件只能是<b style="color: #C03639">pngjpegjpg</b >,<b style="color: #C03639">3M</b> </span>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitCollForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改我的作品 对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
@ -249,11 +331,44 @@
<script>
import { listMycollection, getMycollection, delMycollection, addMycollection, updateMycollection } from "@/api/wjnft/mycollection";
import { updateInformation } from "@/api/wjnft/information";
import {getToken} from "@/utils/auth";
const client = 1;
export default {
name: "Mycollection",
props:{
// (MB)
fileSize: {
type: Number,
default: 3,
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["png", "jpg", "jpeg"],
},
//
isShowTip: {
type: Boolean,
default: true
},
},
data() {
return {
pictureUrl:[],
dialogImageUrl: '',
dialogVisible: false,
//
disabled: false,
imgList:[],
//
collChanges:false,
informAbleId:null,
//
srcList:[],
//
loading: true,
//
@ -279,6 +394,7 @@ export default {
userId: null,
userName:null,
informationTableId: null,
collPath: null,
onChainStatus:null,
deletedTime: null,
createdBy: null,
@ -304,6 +420,21 @@ export default {
}
};
},
computed: {
headers() {
return {
Authorization: "Bearer " + getToken()
}
},
//
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
action() {
return process.env.VUE_APP_BASE_API + "/wjnft/oss/upload/" + client
}
},
created() {
this.getList();
},
@ -313,6 +444,9 @@ export default {
this.loading = true;
listMycollection(this.queryParams).then(response => {
this.mycollectionList = response.rows;
response.rows.forEach( rest => {
this.srcList.push(rest.collPath);
})
this.total = response.total;
this.loading = false;
});
@ -320,6 +454,9 @@ export default {
//
cancel() {
this.open = false;
this.collChanges = false;
this.informAbleId = null;
this.imgList = [];
this.reset();
},
//
@ -359,6 +496,16 @@ export default {
this.open = true;
this.title = "添加我的作品 ";
},
/** 藏品修改按钮 */
collectionChanges(row){
this. informAbleId = row.informationTableId;
let obj = {}
obj.url = row.collPath
this.imgList.push(obj)
this.collChanges = true;
this.title = "修改作品图片 ";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
@ -395,6 +542,33 @@ export default {
}
},
/** 提交藏品修改按钮 */
submitCollForm() {
//console.log(this.imgList);
// console.log(this.pictureUrl);
let path = null;
if(this.imgList.length > 0){
path = this.imgList[0].url;
}else if(this.pictureUrl != null){
path = this.pictureUrl[0];
}
if(this.informAbleId != null){
let nub = {
id : this.informAbleId ,
collectionPath : path,
};
console.log(nub);
updateInformation(nub).then( () => {
this.imgList = [];
this.$message.success("修改成功!")
this.getList();
this.collChanges = false;
})
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
@ -431,7 +605,65 @@ export default {
this.download('wjnft/mycollection/export', {
...this.queryParams
}, `mycollection_${new Date().getTime()}.xlsx`)
}
},
//
beforeUpload(file) {
//console.log(file)
let testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
const extension = testmsg === "png";
const extension1 = testmsg === "jpg";
const extension2 = testmsg === "jpeg";
const isLt32M = file.size / 1024 / 1024 < 3;
if (!extension && !extension2 && !extension1) {
this.$message.warning('上传文件只能是png,jpeg,jpg格式!');
}
if (!isLt32M) {
this.$message.warning('上传文件大小不能超过3MB!');
}
return (extension || extension2 || extension1) && isLt32M;
},
//
handleExceed(files, fileList) {
this.$message.warning('当前只允许上传一个文件');
},
//
handleSuccess(res, file) {
this.imagesUrl = res.data;
//
console.log(res);
this.pictureUrl.push( res.url);
return this.imgList;
},
//
handleRemove(file) {
if(file.name !== undefined){
console.log(this.$refs.upload.uploadFiles);
// this.$refs.upload.clearFiles()
let n = this.$refs.upload.uploadFiles;
const finde = n.map(f => f.name).indexOf(file.name);
if(finde > -1) {
n.splice(finde, 1);
}
}else{
const findex = this.imgList.map(f => f.url).indexOf(file.url);
if(findex > -1) {
this.imgList.splice(findex, 1);
}
}
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
handleDownload(file) {
console.log(file);
},
}
};
</script>

Loading…
Cancel
Save