Commit fd4eacef by cwq0219

修改

1 parent 61fa563b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 19:06:01 * @Date: 2019-09-01 19:06:01
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2020-11-12 19:10:13 * @Last Modified time: 2020-11-15 11:24:23
*/ */
// import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account' // import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
...@@ -76,33 +76,33 @@ export const ghUserType = { ...@@ -76,33 +76,33 @@ export const ghUserType = {
// 品牌商 // 品牌商
export const brandMerchantList = [{ export const brandMerchantList = [{
confId: 1, confId: '1',
confValue: '3M/福膜' confValue: '3M/福膜'
}, { }, {
confId: 2, confId: '2',
confValue: '强生/福膜' confValue: '强生/福膜'
}, { }, {
confId: 3, confId: '3',
confValue: '强生/斯帝飞' confValue: '强生/斯帝飞'
}, { }, {
confId: 4, confId: '4',
confValue: '3M/斯帝飞' confValue: '3M/斯帝飞'
}, { }, {
confId: 5, confId: '5',
confValue: '3M/今蓝' confValue: '3M/今蓝'
}, { }, {
confId: 6, confId: '6',
confValue: '量子/今蓝' confValue: '量子/今蓝'
}, { }, {
confId: 7, confId: '7',
confValue: '强生' confValue: '强生'
}, { }, {
confId: 8, confId: '8',
confValue: '今蓝' confValue: '今蓝'
}, { }, {
confId: 9, confId: '9',
confValue: '琥珀' confValue: '琥珀'
}, { }, {
confId: 10, confId: '10',
confValue: '嘀嘀虎' confValue: '嘀嘀虎'
}] }]
...@@ -156,21 +156,18 @@ ...@@ -156,21 +156,18 @@
<template v-else-if="item.type === 'photo'"> <template v-else-if="item.type === 'photo'">
<p class="photo-top-tips">{{item.topTips}}</p> <p class="photo-top-tips">{{item.topTips}}</p>
<div <div
class="activity-img" class="activity-img img-w-h"
:class="[disabled ? 'input-bg':'']" :class="[disabled ? 'input-bg':'']"
> >
<div <div
class="add" class="add"
v-show="!formData[item.name] || (item.maxPhotoNum > 1 && (formData[item.name].length < item.maxPhotoNum))" v-show="formData[item.name].length < item.maxPhotoNum"
>+</div> >+</div>
<span <!-- <span
class="number" class="number"
v-if="!formData[item.name] && item.maxPhotoNum === 1" v-if="!formData[item.name] && item.maxPhotoNum === 1"
>0/{{item.maxPhotoNum}}</span> >0/{{item.maxPhotoNum}}</span> -->
<span <span class="number">{{formData[item.name].length}}/{{item.maxPhotoNum}}</span>
class="number"
v-else-if="item.maxPhotoNum > 1 && (formData[item.name].length < item.maxPhotoNum)"
>{{formData[item.name].length}}/{{item.maxPhotoNum}}</span>
<!-- <span <!-- <span
v-show="!formData[item.name]" v-show="!formData[item.name]"
class="close" class="close"
...@@ -178,19 +175,19 @@ ...@@ -178,19 +175,19 @@
> >
<i class="el-icon-delete"></i> <i class="el-icon-delete"></i>
</span> --> </span> -->
<template> <!-- <template>
<img <img
v-if="formData[item.name] && item.maxPhotoNum === 1" v-if="!formData[item.name].content && item.maxPhotoNum === 1"
:src="formData[item.name]" :src="formData[item.name].content"
alt="" alt=""
> >
</template> </template> -->
<input <input
type="file" type="file"
name='thumbUrl' name='thumbUrl'
:id="item.name + 'file'" :id="item.name + 'file'"
ref="file" ref="file"
class="activity-img" class="activity-img img-w-h"
accept="image/png, image/jpeg, image/gif, image/jpg" accept="image/png, image/jpeg, image/gif, image/jpg"
@click="handleAddClick(item)" @click="handleAddClick(item)"
@change="e => handleImgChange(e, item)" @change="e => handleImgChange(e, item)"
...@@ -198,13 +195,16 @@ ...@@ -198,13 +195,16 @@
> >
</div> </div>
<template> <template>
<div v-if="item.maxPhotoNum > 1 && formData[item.name].length"> <div v-if="formData[item.name].length && ((item.maxPhotoNum === 1 && formData[item.name].content) || (item.maxPhotoNum > 1))">
<span <span
class="muti-imgs" class="muti-imgs"
v-for="(subItem, subIndex) in formData[item.name]" v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex" :key="subIndex"
> >
<img :src="subItem.content" /> <img
class="img-w-h"
:src="subItem.content"
/>
<span <span
class="close" class="close"
@click='handleImgDelete(item, subIndex)' @click='handleImgDelete(item, subIndex)'
...@@ -232,20 +232,23 @@ ...@@ -232,20 +232,23 @@
placeholder="请输入详情内容" placeholder="请输入详情内容"
></el-input> ></el-input>
<div <div
class="descList-img" class="descList-img img-w-h"
v-else-if="subItem.resType === 1" v-else-if="subItem.resType === 1"
> >
<img :src="subItem.content" /> <img :src="subItem.content" />
<input <input
type="file" type="file"
class="activity-img" class="activity-Input img-w-h"
accept="image/png, image/jpeg, image/gif, image/jpg" accept="image/png, image/jpeg, image/gif, image/jpg"
@click="handleAddClick(item)" @click="handleAddClick(item)"
@change="e => handleImgChange(e, item, subIndex)" @change="e => handleImgChange(e, item, subIndex)"
style="opacity: 0;" style="opacity: 0;"
> >
</div> </div>
<i class="el-icon-delete"></i> <i
class="el-icon-delete"
@click='handleImgDelete(item, subIndex)'
></i>
</el-row> </el-row>
</template> </template>
<span v-else>{{item.name ? formData[item.name] : item.value}}</span> <span v-else>{{item.name ? formData[item.name] : item.value}}</span>
...@@ -425,16 +428,23 @@ export default { ...@@ -425,16 +428,23 @@ export default {
uploadImg({ file: base64 }).then(res => { uploadImg({ file: base64 }).then(res => {
console.log(res) console.log(res)
// this.formData[targetItem.name].push() // this.formData[targetItem.name].push()
if (!Array.isArray(this.formData[targetItem.name])) { // if (!Array.isArray(this.formData[targetItem.name])) {
console.log(targetItem) // console.log(targetItem)
this.formData[targetItem.name] = res // this.formData[targetItem.name] = res
} else { // } else {
if (targetItem.maxPhotoNum === 1) {
this.formData[targetItem.name] = [{
content: res
}]
// this.$nextTick(() => { })
return true
}
if (targetItem.name === 'goodsImgList') { if (targetItem.name === 'goodsImgList') {
this.formData[targetItem.name].push({ content: res }) this.formData[targetItem.name].push({ content: res })
} else { } else {
this.formData[targetItem.name][subIndex].content = res this.formData[targetItem.name][subIndex].content = res
} }
} // }
console.log(this.formData[targetItem.name]) console.log(this.formData[targetItem.name])
}) })
} }
...@@ -512,25 +522,35 @@ export default { ...@@ -512,25 +522,35 @@ export default {
margin: 0 0; margin: 0 0;
color: #999999; color: #999999;
} }
.d2-form .img-w-h {
width: 88px;
height: 74px;
}
.d2-form .activity-img, .d2-form .activity-img,
.d2-form .descList-img { .d2-form .descList-img {
position: relative; position: relative;
width: 88px; /* width: 88px;
height: 74px; height: 74px; */
color: #999999; color: #999999;
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
cursor: pointer; cursor: pointer;
margin-right: 10px; margin-right: 10px;
} }
.d2-form .activity-Input {
position: absolute;
top: 0;
left: 0;
}
.d2-form .muti-imgs { .d2-form .muti-imgs {
position: relative; position: relative;
} }
.d2-form .muti-imgs img { /* .d2-form .muti-imgs img {
width: 88px; width: 88px;
height: 74px; height: 74px;
} } */
.activity-img img { .activity-img img {
width: 100%; width: 100%;
...@@ -563,7 +583,9 @@ export default { ...@@ -563,7 +583,9 @@ export default {
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
opacity: 1; opacity: 1;
} }
.d2-form .el-icon-delete {
cursor: pointer;
}
.activity-img .close i { .activity-img .close i {
width: 18px; width: 18px;
height: 18px; height: 18px;
......
...@@ -92,7 +92,8 @@ service.interceptors.response.use( ...@@ -92,7 +92,8 @@ service.interceptors.response.use(
const ruleResult = baseConfig.axios.result const ruleResult = baseConfig.axios.result
// 这个状态码是和后端约定的 // 这个状态码是和后端约定的
// 有 code 代表这是一个后端接口 可以进行进一步的判断 // 有 code 代表这是一个后端接口 可以进行进一步的判断
if (dataAxios[ruleResult.code_key] === '21') { var goBackArr = ['20', '21']
if (goBackArr.includes(dataAxios[ruleResult.code_key])) {
// await store.dispatch('d2admin/account/logout') // await store.dispatch('d2admin/account/logout')
util.cookies.remove('token') util.cookies.remove('token')
router.replace('/login') router.replace('/login')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 17:56:57 * @Date: 2019-09-01 17:56:57
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2020-11-11 17:42:11 * @Last Modified time: 2020-11-15 10:22:06
*/ */
import { import {
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
getChannelType({}), getChannelType({}),
getProductType({}) getProductType({})
]).then(async([channelType, productType]) => { ]).then(async([channelType, productType]) => {
state.channelType = channelType state.channelType = channelType.slice(0, 2)
state.productType = productType state.productType = productType
await dispatch('save2db', { await dispatch('save2db', {
name: '', name: '',
......
...@@ -29,8 +29,9 @@ export default { ...@@ -29,8 +29,9 @@ export default {
rules: { rules: {
goodsName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }], goodsName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }],
goodsType: [{ required: true, message: '请选择分类', trigger: 'blur' }], goodsType: [{ required: true, message: '请选择分类', trigger: 'blur' }],
thumbUrl: [{ required: true, message: '请选择缩略图', trigger: 'change' }], // thumbUrl: [{ required: true, message: '请选择缩略图', trigger: 'change' }],
goodsImgList: [{ required: true, message: '请选择产品主图', trigger: 'change' }] thumbUrlList: [{ required: true, message: '请选择缩略图', trigger: 'blur' }],
goodsImgList: [{ required: true, message: '请选择产品主图', trigger: 'blur' }]
}, },
editData: { editData: {
goodsName: '', goodsName: '',
...@@ -40,6 +41,7 @@ export default { ...@@ -40,6 +41,7 @@ export default {
brandMerchantCode: '', brandMerchantCode: '',
brandMerchantName: '', brandMerchantName: '',
thumbUrl: '', thumbUrl: '',
thumbUrlList: [],
goodsImgList: [], goodsImgList: [],
goodsDescList: [{ goodsDescList: [{
resType: 2, resType: 2,
...@@ -78,7 +80,7 @@ export default { ...@@ -78,7 +80,7 @@ export default {
optionId: 'confId', optionId: 'confId',
optionLabel: 'confValue' optionLabel: 'confValue'
}, { }, {
name: 'thumbUrl', name: 'thumbUrlList',
label: '缩略图', label: '缩略图',
type: 'photo', type: 'photo',
topTips: '用于在小程序主页的商品列表展示', topTips: '用于在小程序主页的商品列表展示',
...@@ -106,6 +108,8 @@ export default { ...@@ -106,6 +108,8 @@ export default {
if (this.addOrEdit === 'edit') { if (this.addOrEdit === 'edit') {
this.show = false this.show = false
this.editData = _.cloneDeep(this.$route.params.form) this.editData = _.cloneDeep(this.$route.params.form)
this.editData.thumbUrlList = []
this.editData.thumbUrlList[0] = { content: this.editData.thumbUrl }
console.log(this.editData) console.log(this.editData)
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true
...@@ -136,6 +140,7 @@ export default { ...@@ -136,6 +140,7 @@ export default {
handleAddConfirm(data) { handleAddConfirm(data) {
data.goodsDescList = data.goodsDescList.filter(item => item.content) data.goodsDescList = data.goodsDescList.filter(item => item.content)
data.goodsTypeName = this.baseData.productType.find(item => item.goodsType === data.goodsType).goodsTypeName data.goodsTypeName = this.baseData.productType.find(item => item.goodsType === data.goodsType).goodsTypeName
data.thumbUrl = data.thumbUrlList[0].content
console.log(data) console.log(data)
data.brandMerchantCode && (data.brandMerchantName = brandMerchantList.find(item => item.confId === data.brandMerchantCode).confValue) data.brandMerchantCode && (data.brandMerchantName = brandMerchantList.find(item => item.confId === data.brandMerchantCode).confValue)
if (this.addOrEdit === 'edit') { if (this.addOrEdit === 'edit') {
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
<script> <script>
import { getUserInfo } from '@api/personalInfo' import { getUserInfo } from '@api/personalInfo'
import { userType, ghUserType } from '@/common/constants'
export default { export default {
name: 'personalInfo', name: 'personalInfo',
data() { data() {
...@@ -62,7 +63,7 @@ export default { ...@@ -62,7 +63,7 @@ export default {
name: 'shortName', name: 'shortName',
label: '商户简称' label: '商户简称'
}, { }, {
name: 'userType', name: 'userTypeName',
label: '商户分类' label: '商户分类'
}, { }, {
name: 'addr', name: 'addr',
...@@ -97,6 +98,8 @@ export default { ...@@ -97,6 +98,8 @@ export default {
this.formData = res.detail this.formData = res.detail
this.formData.addr = (this.formData.provinceName || '') + (this.formData.cityName || '') + (this.formData.areaName || '') + (this.formData.address || '') this.formData.addr = (this.formData.provinceName || '') + (this.formData.cityName || '') + (this.formData.areaName || '') + (this.formData.address || '')
this.formData.carBrandListNoRepeat = [...new Set(this.formData.carBrandList.map(item => item.brandName))] this.formData.carBrandListNoRepeat = [...new Set(this.formData.carBrandList.map(item => item.brandName))]
var typeList = this.formData.channelId === 2 ? ghUserType : userType
this.formData.userTypeName = typeList[this.formData.userType]
}) })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!