Browse Source

服务设置 传引用bug修复

pull/87/head
pengda 1 day ago
parent
commit
738a41c5eb
  1. 207
      src/components/ImgUpload.vue
  2. 26
      src/components/preview/logoBack_color.vue
  3. 2
      src/components/site/serviceSetting/domainSet.vue
  4. 2
      src/components/site/serviceSetting/linkSet.vue
  5. 49
      src/components/site/serviceSetting/menuColorSet.vue
  6. 4
      src/components/site/serviceSetting/paymentSet.vue
  7. 132
      src/components/site/serviceSetting/priceSet.vue
  8. 2
      src/components/site/serviceSetting/reportSeoSet.vue
  9. 22
      src/components/site/serviceSetting/showSet.vue
  10. 2
      src/components/site/serviceSetting/submitSeoSet.vue
  11. 2
      src/views/agent/siteServiceEdit.vue

207
src/components/ImgUpload.vue

@ -0,0 +1,207 @@
<template>
<div class="upload-wrapper">
<!-- 预览图片 -->
<div class="image-list" v-if="previewList.length>0">
<div class="image-box"
v-for="(item, index) in previewList" :key="index">
<img :src="item.url" class="image-preview" />
<!-- <i class="el-icon-close delete-icon" @click.stop="removeImage(index)" />-->
</div>
</div>
<!-- 上传按钮 -->
<el-upload
class="image-uploader"
action=""
:http-request="uploadHandler"
:show-file-list="false"
:before-upload="beforeUpload"
:accept="acceptMime"
>
<GuipButton class="upload-button" type="ignore" :btnstyle="btnStyle">
<div class="bgImg"></div>
<span>选择图片</span>
</GuipButton>
</el-upload>
</div>
</template>
<script>
import GuipButton from "@/components/GuipButton.vue";
export default {
name: "ImgUpload",
components: {GuipButton},
props: {
value: {
type: [Array, File, null],
default: () => []
},
defaultUrls: {
type: Array,
default: () => []
},
acceptTypes: {
type: Array,
default: () => ['jpg', 'png']
},
sizeLimit: {
type: Number,
default: 2 // MB
},
btnStyle:{
type: Object,
default() {
return {
width: '118px',
color: '#23242B',
border: '1px solid #BABDC2',
background: '#F2F3F5',
'border-radius': '4px'
};
}
},
maxCount: {
type: Number,
default: 1
}
},
data() {
return {
previewList: [],
initialized: false
};
},
watch: {
defaultUrls(newUrls) {
if (!this.initialized && Array.isArray(newUrls) && newUrls.length) {
this.previewList = newUrls
.filter(url => !!url)
.map(url => ({ url }));
this.initialized = true;
}
}
},
computed: {
// MIME <el-upload accept="">
acceptMime() {
const map = {
jpg: 'image/jpeg',
jpeg: 'image/jpeg',
png: 'image/png',
webp: 'image/webp',
gif: 'image/gif'
};
return this.acceptTypes
.map(ext => map[ext.toLowerCase()])
.filter(Boolean)
.join(',');
}
},
methods: {
beforeUpload(file) {
if(this.maxCount === 1){
this.previewList = []
}
if (this.previewList.length >= this.maxCount) {
this.$message.warning(`最多只能上传 ${this.maxCount} 张图片`);
return false;
}
const isImage = file.type.startsWith("image/");
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isImage) {
this.$message.error("只能上传图片格式!");
return false;
}
if (!isLt2M) {
this.$message.error("图片大小不能超过 2MB!");
return false;
}
const allowedTypes = this.acceptMime.split(',');
if (!allowedTypes.includes(file.type)) {
this.$message.error(`只允许上传 ${this.acceptTypes.join('/').toUpperCase()} 格式图片!`);
return false;
}
const url = URL.createObjectURL(file);
if(this.maxCount === 1){
this.previewList = [{ file, url }];
this.$emit('input', { file, url });
} else {
this.previewList.push({ file, url });
const files = this.previewList
.filter(item => item.file)
.map(item => item.file);
this.$emit('input', files);
}
return false;
},
uploadHandler() {
// 使 file
},
removeImage(index) {
this.previewList.splice(index, 1);
const files = this.previewList
.filter(item => item.file)
.map(item => item.file);
this.$emit('input', files);
}
}
};
</script>
<style scoped>
.upload-wrapper {
}
.image-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 10px;
}
.image-box {
position: relative;
width: 100px;
height: 100px;
}
.image-preview {
width: 100%;
height: 100%;
object-fit: cover;
border: 1px solid #ccc;
border-radius: 4px;
}
.delete-icon {
position: absolute;
top: -6px;
right: -6px;
font-size: 16px;
color: white;
background: #f56c6c;
border-radius: 50%;
padding: 2px;
cursor: pointer;
}
.bgImg{
width: 20px;
height: 16px;
margin-right: 6px;
background-image: url(@/assets/site/uploadIcon.svg);
}
.upload-button:hover{
border: 1px solid #006AFF!important;
}
.upload-button:hover .bgImg {
background-image: url(@/assets/site/uploadIcon_light.svg);
}
.upload-button:hover span {
color: #006AFF;
}
</style>

26
src/components/preview/logoBack_color.vue

@ -1,6 +1,6 @@
<template>
<div class="preview_color">
<div class="top" :style="{backgroundColor:themeColor}">品牌LOGO</div>
<div class="top" :style="{backgroundColor:effectiveThemeColor}">品牌LOGO</div>
<div class="bottom flex">
<div class="left">
<span class="desc">获取帮助</span>
@ -10,14 +10,14 @@
</div>
<div class="right">
<p class="scroll" >正在检测文章的滚动条</p>
<div class="tab flex" :style="{backgroundColor:navColor}">
<div class="tab_item" :style="{backgroundColor:tabColor}">检测论文</div>
<div class="tab flex" :style="{backgroundColor:effectiveNavColor}">
<div class="tab_item" :style="{backgroundColor:effectiveTabColor}">检测论文</div>
<div class="tab_item">下载检测报告</div>
<div class="tab_item">下载检测报告</div>
</div>
<div class="right_bot column">
<b>检测上传板块</b>
<button :style="{backgroundColor:themeColor}">提交论文</button>
<button :style="{backgroundColor:effectiveThemeColor}">提交论文</button>
</div>
</div>
</div>
@ -42,8 +42,22 @@ export default {
default: '#70A6FF'
},
},
components: {
computed: {
effectiveThemeColor() {
return this.themeColor && this.themeColor.trim() !== ''
? this.themeColor
: '#3B82F6';
},
effectiveNavColor() {
return this.navColor && this.navColor.trim() !== ''
? this.navColor
: '#3B82F6';
},
effectiveTabColor() {
return this.tabColor && this.tabColor.trim() !== ''
? this.tabColor
: '#70A6FF';
}
},
data() {
return {

2
src/components/site/serviceSetting/domainSet.vue

@ -94,7 +94,7 @@ export default {
}
},
mounted() {
this.info = this.serviceInfo
this.info = JSON.parse(JSON.stringify(this.serviceInfo))
this.domainOptions = this.info.domain_list.map(item => ({
label: item.ext,
value: item.ext

2
src/components/site/serviceSetting/linkSet.vue

@ -68,7 +68,7 @@ export default {
}
},
mounted() {
this.info = this.serviceInfo
this.info = JSON.parse(JSON.stringify(this.serviceInfo))
},
methods: {
toggleSetSyncHome(){

49
src/components/site/serviceSetting/menuColorSet.vue

@ -9,22 +9,14 @@
<el-form ref="formRef">
<div class="flex-wrap">
<div class="flex-left">
<GuipFormItem column="column" label="提交页Logo上传">
<hover-button slot="formDom" ref="GuipInput" button-text="选择图片"
:default-icon="require('@/assets/upLoad_grey.svg')"
:hover-icon="require('@/assets/upLoad_active.svg')" default-text-color="#23242B"
hover-text-color="#006AFF" />
</GuipFormItem>
<GuipFormItem column="column" label="提交页Logo上传"></GuipFormItem>
<ImgUpload @input="onUploadSub" :accept-types="['jpg', 'png']" :maxCount="1" :defaultUrls="[info.submit_logo_url]"></ImgUpload>
<div slot="tip" class="el-upload__tip desc">支持pngjpg格式尺寸32PX*32PX</div>
</div>
<div class="flex-line "></div>
<div class="flex-right">
<GuipFormItem column="column" label="报告页Logo上传">
<hover-button slot="formDom" ref="GuipInput" button-text="选择图片"
:default-icon="require('@/assets/upLoad_grey.svg')"
:hover-icon="require('@/assets/upLoad_active.svg')" default-text-color="#23242B"
hover-text-color="#006AFF" />
</GuipFormItem>
<GuipFormItem column="column" label="报告页Logo上传"></GuipFormItem>
<ImgUpload @input="onUploadRep" :accept-types="['jpg', 'png']" :maxCount="1" :defaultUrls="[info.report_logo_url]"></ImgUpload>
<div slot="tip" class="el-upload__tip desc">支持pngjpg格式尺寸32PX*32PX</div>
</div>
</div>
@ -88,13 +80,13 @@
</template>
<script>
import HoverButton from "@/components/HoverButton.vue";
import GuipFormItem from "@/components/GuipFormItem.vue";
import PromptText from "@/components/PromptText.vue";
import GuipButton from "@/components/GuipButton.vue";
import DevicePreview from "@/components/PreviewTab.vue";
import LogoBackColor from "@/components/preview/logoBack_color.vue";
import GuipInput from '@/components/GuipInput.vue';
import ImgUpload from "@/components/ImgUpload.vue";
export default {
name: 'menuColorSet',
@ -105,10 +97,10 @@ export default {
}
},
components: {
ImgUpload,
GuipButton,
PromptText,
GuipFormItem,
HoverButton,
DevicePreview,
LogoBackColor,
GuipInput
@ -129,10 +121,12 @@ export default {
themeColor: undefined,
navColor: undefined,
tabColor: undefined,
sub_logo_file: {},
rep_logo_file: {},
}
},
mounted() {
this.info = this.serviceInfo
this.info = JSON.parse(JSON.stringify(this.serviceInfo))
if(this.info.color_info){
this.themeColor = '#'+ this.info.color_info.link_btn_color
this.navColor = '#'+ this.info.color_info.selected_nav_bgcolor
@ -140,18 +134,26 @@ export default {
}
},
methods: {
onUploadSub(fileObj){
this.info.submit_logo_url = fileObj.url
this.sub_logo_file = fileObj.file
},
onUploadRep(fileObj){
this.info.report_logo_url = fileObj.url
this.rep_logo_file = fileObj.file
},
changeThemeColor(val){
if (!val.trim().startsWith("#")){
if (val.length > 0 && !val.trim().startsWith("#")){
this.themeColor = '#'+ val.trim()
}
},
changetabColor(val){
if (!val.trim().startsWith("#")){
if (val.length > 0 && !val.trim().startsWith("#")){
this.tabColor = '#'+ val.trim()
}
},
changeNavColor(val){
if (!val.trim().startsWith("#")){
if (val.length > 0 && !val.trim().startsWith("#")){
this.navColor = '#'+ val.trim()
}
},
@ -163,10 +165,19 @@ export default {
obj.link_btn_color = this.themeColor.replace('#','')
obj.selected_nav_bgcolor = this.navColor.replace('#','')
if(!this.sub_logo_file || !this.rep_logo_file){
this.$message.warning(`请上传logo图`);
return false;
}
obj.submit_logo = this.sub_logo_file
obj.report_logo = this.rep_logo_file
const that = this
this.$http('POST', '/agentnew/ajax_update_service_style', obj,{
headers:{
'Auth': this.token
'Auth': this.token,
'Content-Type':'multipart/form-data'
}
}).then(response => {
if(response.status){

4
src/components/site/serviceSetting/paymentSet.vue

@ -48,8 +48,8 @@ export default {
}
},
mounted() {
this.info = this.serviceInfo
this.payList = this.serviceInfo.paylist
this.info = JSON.parse(JSON.stringify(this.serviceInfo))
this.payList = this.info.paylist
},
methods:{
confirmPayment(payList){

132
src/components/site/serviceSetting/priceSet.vue

@ -3,10 +3,47 @@
<div class="pageheader">
<span class="pagetitle">{{info.type_desc}}-价格设置</span>
</div>
<div class="flex-common">
<h3>网页支付与售价</h3>
<el-form ref="formRef">
<div class="flex-wrap">
<div class="flex-left">
<div class="set-item">
<div class="set-title flex flex-between">
<p>售价管理</p>
<p>供货价格3.5/</p>
</div>
<div class="set-content flex">
<GuipSelect width="264px" prop="card" :options="options" class="mr12"/>
<GuipInput v-if="!info.price" width="264px" v-model="info.price" ref="GuipInput" unit="元/篇"></GuipInput>
<template v-else>
<GuipInput width="180px" v-model="info.price" ref="GuipInput" unit="元"></GuipInput>
<span class="mr12"></span>
<GuipInput v-model="info.unit_num" ref="GuipInput" width="180px" unit="字符"></GuipInput>
</template>
</div>
</div>
</div>
<div class="flex-line"></div>
<div class="flex-right">
</div>
</div>
</el-form>
</div>
<div class="save-button">
<GuipButton type="primary" :btnstyle="saveBtnStyleObj" @click="saveConfirm">保存</GuipButton>
</div>
</div>
</template>
<script>
import GuipButton from "@/components/GuipButton.vue";
import GuipInput from "@/components/GuipInput.vue";
import GuipSelect from "@/components/GuipSelect.vue";
export default {
name: 'priceSet',
props: {
@ -16,6 +53,9 @@ export default {
}
},
components: {
GuipSelect,
GuipInput,
GuipButton
},
data(){
@ -29,16 +69,106 @@ export default {
borderRadius: '4px',
background: '#006AFF',
},
options: [{
value: '选项1',
label1: '黄金hhhhhh',
id1: '1',
id2: '啊11哈哈',
label: '黄金糕'
}, {
value: '选项2',
id1: '12',
id2: '啊22哈哈',
label1: '双皮奶hhhhhhhhh',
label: '双皮奶'
}, {
value: '选项3',
id1: '13',
id2: '啊33哈哈',
label1: '蚵仔煎hhhhhhhhh',
label: '蚵仔煎'
}, {
value: '选项4',
id1: '14',
id2: '啊444哈哈',
label1: '双皮奶hhhhhhhhh',
label: '龙须面'
}, {
value: '选项5',
id1: '155',
id2: '啊55哈哈',
label1: '双皮奶hhhhhhhhh',
label: '北京烤鸭'
}],
form: {
username: '',
language: '',
domain_set: '',
domainSuffix: '11',
domainSuffix1: '.chachongz.com',
card: '1',
input1: '跨年的烟火,绽放天空',
input2: '',
input3: '',
},
}
},
mounted() {
this.info = this.serviceInfo
this.info = JSON.parse(JSON.stringify(this.serviceInfo))
},
methods:{
saveConfirm() {
let obj = {}
obj.uid = this.info.uid
obj.type = this.info.type
obj.logo_bgcolor = this.tabColor.replace('#','')
obj.link_btn_color = this.themeColor.replace('#','')
obj.selected_nav_bgcolor = this.navColor.replace('#','')
const that = this
this.$http('POST', '/agentnew/ajax_update_service_style', obj,{
headers:{
'Auth': this.token
}
}).then(response => {
if(response.status){
that.$message.success('保存成功');
let color_info = {}
color_info.logo_bgcolor = obj.logo_bgcolor
color_info.link_btn_color = obj.link_btn_color
color_info.selected_nav_bgcolor = obj.selected_nav_bgcolor
that.info.color_info = color_info
that.$emit('saveEvent', that.info)
return true;
}
that.$message.success(response.info);
}).catch(error => {
console.error(error, 'error')
})
},
}
}
</script>
<style lang="scss">
.mr12{
margin-right: 12px;
}
.set-item{
width: 540px;
letter-spacing: 0.08em;
.set-title{
font-size: 14px;
color: #1E2226;
margin-bottom: 12px;
p:last-child{
color: #8A9099;
}
}
.set-content{
width: 100%;
}
}
</style>

2
src/components/site/serviceSetting/reportSeoSet.vue

@ -72,7 +72,7 @@ export default {
}
},
mounted() {
this.info = this.serviceInfo
this.info = JSON.parse(JSON.stringify(this.serviceInfo))
},
methods: {
saveConfirm() {

22
src/components/site/serviceSetting/showSet.vue

@ -31,11 +31,8 @@
</div>
<div class="flex-line "></div>
<div class="flex-right">
<GuipFormItem column="column" label="服务Logo">
<hover-button slot="formDom" ref="GuipInput" button-text="选择图片" :default-icon="require('@/assets/upLoad_grey.svg')"
:hover-icon="require('@/assets/upLoad_active.svg')" default-text-color="#23242B"
hover-text-color="#006AFF"/>
</GuipFormItem>
<GuipFormItem column="column" label="服务Logo"></GuipFormItem>
<ImgUpload @input="onUpload" :accept-types="['jpg', 'png']" :maxCount="1" :defaultUrls="[info.logo_url]"></ImgUpload>
<div slot="tip" class="el-upload__tip desc">支持pngjpg格式尺寸32PX*32PX</div>
</div>
</div>
@ -137,12 +134,12 @@
</template>
<script>
import HoverButton from "@/components/HoverButton.vue";
import GuipFormItem from "@/components/GuipFormItem.vue";
import GuipSwitch from "@/components/GuipSwitch.vue";
import PromptText from "@/components/PromptText.vue";
import GuipInput from "@/components/GuipInput.vue";
import GuipButton from "@/components/GuipButton.vue";
import ImgUpload from "@/components/ImgUpload.vue";
export default {
name: 'showSet',
@ -154,7 +151,7 @@ export default {
},
components: {
GuipButton,
GuipInput, PromptText, GuipSwitch, GuipFormItem, HoverButton
GuipInput, PromptText, GuipSwitch, GuipFormItem, ImgUpload
},
data(){
return {
@ -168,12 +165,17 @@ export default {
borderRadius: '4px',
background: '#006AFF',
},
logo_file: {},
}
},
mounted() {
this.info = this.serviceInfo
this.info = JSON.parse(JSON.stringify(this.serviceInfo))
},
methods:{
onUpload(fileObj) {
this.info.logo_url = fileObj.url
this.logo_file = fileObj.file
},
saveBack(){
this.saveSuccess = false
},
@ -191,11 +193,13 @@ export default {
obj.is_display_price = this.info.is_display_price
obj.is_index_display = this.info.is_index_display
obj.is_recommend = this.info.is_recommend
obj.logo = this.logo_file
const that = this
this.$http('POST', '/agentnew/ajax_update_service_show', obj,{
headers:{
'Auth': this.token
'Auth': this.token,
'Content-Type':'multipart/form-data'
}
}).then(response => {
if(response.status){

2
src/components/site/serviceSetting/submitSeoSet.vue

@ -72,7 +72,7 @@ export default {
}
},
mounted() {
this.info = this.serviceInfo
this.info = JSON.parse(JSON.stringify(this.serviceInfo))
},
methods: {
saveConfirm() {

2
src/views/agent/siteServiceEdit.vue

@ -73,7 +73,7 @@ export default {
},
methods: {
handleSaveEvent(payload) {
console.log('收到子组件事件:', payload);
this.siteServiceInfo = payload
},
getSiteServiceInfo() {
const that = this

Loading…
Cancel
Save