Commit 42dacac1 authored by xiaoman's avatar xiaoman

Merge branch 'feature/develop_0713' of...

Merge branch 'feature/develop_0713' of http://gitlab.wanwudezhi.work/quanku/qk_admin into feature/develop_0713
parents 5ee03723 a6051574
......@@ -26,8 +26,8 @@ export function publishGoods(data) {
export function detailGoods(id) {
return request({
url: '/item/findDetail',
method: 'post',
url: '/goods/detail',
method: 'get',
params: { id }
})
}
......
import request from '@/utils/request'
export function detailGoods(params) {
return request({
url: '/item/findDetail',
method: 'post',
data: params
})
}
export function editGoods(params) {
return request({
url: '/item/setCoin',
method: 'post',
data: params
})
}
<template>
<el-dialog
:visible.sync="showLamaDialog"
:before-close="handleClose"
title="去水印"
width="1000px">
<div >
......@@ -34,6 +35,9 @@ export default {
},
// vue实例销毁时销毁一些监听事件
methods: {
handleClose() {
this.$emit('closeLamaDialog')
},
handleMessage(event) {
console.log('===从子应用的传递的===', event.data)
const data = event.data
......
......@@ -21,6 +21,7 @@
<LamaImageDialog
v-if="showLamaImageDialog"
:show-lama-dialog="showLamaImageDialog"
@closeLamaDialog="showLamaImageDialog = false"
@imageBase64="handleGetImageBase64" />
</div>
......@@ -68,6 +69,10 @@ export default {
this.$message.error('请选择图片')
return
}
if (this.imageList[this.currentPosition].indexOf('https://cdn.wanwudezhi.com') === -1) {
this.$message.error('该图片不支持该操作')
return
}
if (this.selectType === 1) { // 去水印
const result = this.copyContent(this.imageList[this.currentPosition])
if (result) {
......
......@@ -4,14 +4,14 @@
<el-button round @click="handleCancel">取消</el-button>
<el-button type="primary" style="margin-right: 20px" round @click="handlePublish">发布</el-button>
<el-button-group>
<el-button type="primary" icon="el-icon-arrow-left">上一个</el-button>
<el-button type="primary">下一个<i class="el-icon-arrow-right el-icon--right" /></el-button>
<el-button :disabled="previousDisabled" type="primary" icon="el-icon-arrow-left" @click="handlePrevious">上一个</el-button>
<el-button type="primary" @click="handleNext">下一个<i class="el-icon-arrow-right el-icon--right"/></el-button>
</el-button-group>
</div>
<el-card class="box-card">
<div class="detail">
<div class="detail_title">{{ `名称:` }}</div>
<div class="detail_desc">{{ `详细介绍:` }}</div>
<div class="detail_title">{{ `名称:${goodsParams.name || ''}` }}</div>
<div class="detail_desc">{{ `详细介绍:${goodsParams.detail || ''}` }}</div>
<div class="detail_image">
<div class="detail_title">{{ `钱币图片:` }}</div>
<div class="list">
......@@ -34,7 +34,7 @@
<div class="tool">
<div>第二步:对去完水印的图片进行抠图</div>
<div v-if="!src && isShowCutImage" class="select">
<el-button style="width: 95px" @click="handleSelectImage">在线选图</el-button>
<el-button style="width: 95px" @click="handleSelectImage(0)">在线选图</el-button>
<el-button
type="primary"
style="position: relative;overflow: hidden;margin-top: 20px;margin-left: 0px; ">本地上传
......@@ -161,23 +161,23 @@
@change="handleCategoryChange"/>
</el-form-item>
<el-form-item label="直径(mm):" prop="name">
<el-input v-model="goodsParams.name" :style="{ 'width':'300px' }" placeholder="请输入直径(mm)" />
<el-input v-model="goodsParams.diameter" :style="{ 'width':'300px' }" placeholder="请输入直径(mm)" />
</el-form-item>
<el-form-item label="厚度(mm):" prop="name">
<el-input v-model="goodsParams.name" :style="{ 'width':'300px' }" placeholder="请输入厚度(mm)" />
<el-input v-model="goodsParams.thickness" :style="{ 'width':'300px' }" placeholder="请输入厚度(mm)" />
</el-form-item>
<el-form-item label="质量(g):" prop="name">
<el-input v-model="goodsParams.name" :style="{ 'width':'300px' }" placeholder="请输入质量(g)" />
<el-input v-model="goodsParams.weight" :style="{ 'width':'300px' }" placeholder="请输入质量(g)" />
</el-form-item>
<el-form-item label="是否作为标准货币:" prop="isOnSale">
<el-radio-group v-model="goodsParams.isOnSale">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
<el-radio-group v-model="goodsParams.isStd">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="goodsParams.traceMsg"
v-model="goodsParams.remark"
:rows="5"
maxlength="50"
type="textarea"
......@@ -188,6 +188,7 @@
</el-card>
</div>
<SelectImageDialog
v-if="dialogVisible"
:select-image-dialog-visible="dialogVisible"
:select-type="selectDialogType"
:image-list="goodsParams.images"
......@@ -202,7 +203,8 @@
import { VuePictureCut, VuePictureCutMask, VuePictureCutMenu } from 'vue-picture-cut'
import { getToken } from '@/utils/auth'
import SelectImageDialog from './components/selectImageDialog'
import { detailGoods, listCategories } from '@/api/business/goods'
import { listCategories } from '@/api/business/goods'
import { detailGoods, editGoods } from '@/api/business/goodsNew'
export default {
name: 'InfoSet',
......@@ -237,9 +239,9 @@ export default {
categoryList: [], // 所属分类
categoryIds: [],
goodsParams: { images: [] },
goodId: '',
goodIdList: [],
goodItemIndex: -1
currentIndex: 0,
isDisabledNext: false
}
},
......@@ -259,6 +261,9 @@ export default {
},
newSecondSrc() {
return this.blobSecond ? URL.createObjectURL(this.blobSecond) : ''
},
previousDisabled() {
return !(this.currentIndex - 1 >= 0 && this.currentIndex - 1 < this.goodIdList.length)
}
},
watch: {
......@@ -279,20 +284,7 @@ export default {
if (this.$route.query.id == null) {
return
}
this.goodId = this.$route.query.id
detailGoods(this.goodId).then(response => {
this.goodsParams = response.data.data.goods
this.categoryIds = response.data.data.categoryIds
this.itemImages = []
for (let i = 0; i < this.goodsParams.images.length; i++) {
this.itemImages.push({
url: this.goodsParams.images[i]
})
}
})
this.handleGetDetail(this.$route.query.id)
listCategories().then(response => {
this.categoryList = response.data.data.categoryList
})
......@@ -306,6 +298,52 @@ export default {
}, 1000)
}
},
handleGetDetail(id, type) {
const param = {
id: id,
idExcludeList: this.goodIdList || []
}
detailGoods(param).then(response => {
this.handleClearInfo()
if (type === 1) { // 上一个
this.currentIndex -= 1
} else if (type === 2) { // 下一个
this.currentIndex += 1
} else if (type === 3) {
this.currentIndex += 1
if (this.goodIdList.indexOf(response.data.data.id) === -1) {
this.goodIdList[this.goodIdList.length] = response.data.data.id
}
} else {
if (this.goodIdList.indexOf(response.data.data.id) === -1) {
this.goodIdList[this.goodIdList.length] = response.data.data.id
}
}
console.log('===list==', this.goodIdList)
this.goodsParams = response.data.data
this.goodsParams.isStd = response.data.data.isStd === true ? 1 : 0
if (this.goodsParams.cid) {
this.categoryIds = [this.goodsParams.cid]
}
if (response.data.data.images) {
this.goodsParams.images = response.data.data.images.split(';') || []
}
if (this.goodsParams.topImage) {
const list = [this.goodsParams.topImage]
this.goodsParams.images = list.concat(this.goodsParams.images)
}
})
},
handleClearInfo() {
this.goodsParams = {}
this.base64 = ''
this.base64Second = ''
this.blob = ''
this.blobSecond = ''
this.src = ''
this.compositeImageSrc = ''
},
// 选择图片结果
fileChange(e) {
if (e.target.files.length) {
......@@ -319,7 +357,10 @@ export default {
},
// 发布
handlePublish() {
editGoods(this.goodsParams).then(response => {
this.$message.success('发布成功')
this.handleNext()
})
},
// 选择形状
handleChangeShape(type) {
......@@ -457,12 +498,32 @@ export default {
// 转换base64格式的图片
setTimeout(() => {
this.compositeImageSrc = canvas.toDataURL('image/png')
this.goodsParams.imgBaseStr = this.compositeImageSrc
console.log('=====img==', this.compositeImageSrc)
}, 1000)
},
// 分类结果
handleCategoryChange(value) {
this.goodsParams.cid = value[value.length - 1]
},
// 上一个
handlePrevious() {
const preIndex = this.currentIndex - 1
if (preIndex >= 0 && preIndex < this.goodIdList.length) {
const id = this.goodIdList[preIndex]
this.handleGetDetail(id, 1)
} else {
this.$message.info('已经是第一个了哦~')
}
},
handleNext() {
const nextIndex = this.currentIndex + 1
if (nextIndex >= 0 && nextIndex < this.goodIdList.length) {
const id = this.goodIdList[nextIndex]
this.handleGetDetail(id, 2)
} else {
this.handleGetDetail('', 3)
}
}
}
}
......@@ -562,8 +623,7 @@ export default {
.cut {
width: 100%;
height: 280px;
overflow: hidden;
height: 400px;
margin-top: 20px;
}
......
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