liujq 4 rokov pred
rodič
commit
628d493ca7

+ 4 - 0
src/main.js

@@ -27,12 +27,16 @@ Vue.noEmpty = Vue.prototype.noEmpty = noEmpty
 import TableList from '@/components/Common/TableList'
 import BaseForm from '@/components/Common/BaseForm'
 import HeaderCollapse from '@/components/Common/HeaderCollapse'
+
 Vue.component(TableList.name, TableList)
 Vue.component(BaseForm.name, BaseForm)
 Vue.component(HeaderCollapse.name, HeaderCollapse)
 import storage from '@/utils/storage'
 Vue.use(storage)
 
+import imgMark from '@/utils/imgMark'
+Vue.use(imgMark)
+
 import VueAMap from 'vue-amap' // 高德
 Vue.use(VueAMap)
 VueAMap.initAMapApiLoader({

+ 20 - 0
src/utils/imgMark.js

@@ -0,0 +1,20 @@
+const imgMark = (Vue) => {
+  Vue.prototype.IMadd = function (url) { // 图片添加水印
+    if (url && url.indexOf('_adm0') === -1) {
+      return `${url}_adm0`
+    } else {
+      return url
+    }
+  }
+  
+  Vue.prototype.IMdel = function (url) { // 图片删除水印
+    if (url && url.indexOf('_adm0') > -1) {
+      return url.substring(0, url.length - 5)
+    } else {
+      return url
+    }
+  }
+  
+}
+
+export default imgMark

+ 16 - 0
src/utils/index.js

@@ -161,3 +161,19 @@ export function strTrim(str) { // 删除左右两端的空格
   return str.replace(/(^\s*)|(\s*$)/g, '')
 }
 
+
+export function imgMarkAdd (url) { // 图片添加水印
+  if (url && url.indexOf('_adm0') === -1) {
+    return `${url}_adm0`
+  } else {
+    return url
+  }
+}
+
+export function imgMarkDel (url) { // 图片删除水印
+  if (url && url.indexOf('_adm0') > -1) {
+    return url.substring(0, url.length - 5)
+  } else {
+    return url
+  }
+}

+ 3 - 1
src/views/house/components/popup/IndexEdit.vue

@@ -64,7 +64,7 @@
                         :on-error="roomAreaUploadError"
                         :before-upload="roomAreaUploadBefore"
                       >
-                        <img v-if="area.img_url" :src="area.img_url" class="img" @click="roomAreaUploadImg(one, two, three)">
+                        <img v-if="area.img_url" :src="area.img_url + '_adm0'" class="img" @click="roomAreaUploadImg(one, two, three)">
                         <i v-else class="el-icon-plus icon" @click="roomAreaUploadImg(one, two, three)"/>
                         <img :src="area.img_url" class="ri-img-big">
                       </el-upload>
@@ -362,6 +362,7 @@ export default {
         { label: '楼盘图', key: 'pri_image', class: 'c-3', type: 'upload', rules: 1 },
         { label: '简评', key: 'remarked', class: 'c-3s', type: 'textarea' },
       ]
+      params.pri_image = this.IMadd(params.pri_image)
       this.setDefaultValue(params)
     },
     close (str) {
@@ -414,6 +415,7 @@ export default {
             }
             let apiStr = 'admestateadd'
             if (this.curObj.id) apiStr = 'admestateedit'
+            newForm.pri_image = this.IMdel(newForm.pri_image)
             this.$api.house[apiStr](newForm).then(data => {
               this.$msgs(newForm.id ? '编辑成功' : '新增成功')
               this.productData = []

+ 1 - 1
src/views/house/components/popup/NewsEdit.vue

@@ -15,7 +15,7 @@
         <div slot="otherItem">
           <div class="scoped-img-area">
             <div class="sia-op" v-for="(imgsrc,index) in imagesArr" :key="index">
-              <img class="img" :src="imgsrc" alt="img">
+              <img class="img" :src="imgsrc + '_adm0'" alt="img">
               <span class="close" @click="imgDel(index)"></span>
             </div>
             <el-upload

+ 3 - 1
src/views/house/components/popup/OldEdit.vue

@@ -15,7 +15,7 @@
         <div slot="OI8">
           <div class="scoped-img-area">
             <div class="sia-op" v-for="(imgsrc,index) in imagesArr" :key="index">
-              <img class="img" :src="imgsrc" alt="img">
+              <img class="img" :src="imgsrc + '_adm0'" alt="img">
               <span class="close" @click="imgDel(index)"></span>
             </div>
             <el-upload
@@ -130,6 +130,7 @@ export default {
         { label: '房源简介', key: 'remarked', class: 'c-3s', type: 'textarea' },
         { label: '房源地址', key: 'address' },
       ]
+      params.pri_image = this.IMadd(params.pri_image)
       this.setDefaultValue(params)
     },
     getImgUrl (str) {
@@ -161,6 +162,7 @@ export default {
               return urlStr
             })
             newForm.images = imgUrlArr.join(',')
+            newForm.pri_image = this.IMdel(newForm.pri_image)
             let apiStr = 'admoldhouseadd'
             if (this.curObj.id) apiStr = 'admoldhouseedit'
             this.$api.house[apiStr](newForm).then(data => {

+ 1 - 1
src/views/house/components/popup/PhotoEdit.vue

@@ -14,7 +14,7 @@
       <div class="scoped-img-area" v-for="(item, iIndex) in imagesArr" :key="iIndex">
         <div class="sia-title">{{item.key}}</div>
         <div class="sia-op" v-for="(imgsrc,index) in item.urls" :key="index">
-          <img class="img" :src="imgsrc" alt="img">
+          <img class="img" :src="imgsrc + '_adm0'" alt="img">
           <span class="close" @click="imgDel(iIndex, index)"></span>
         </div>
         <el-upload

+ 1 - 0
src/views/house/del.vue

@@ -45,6 +45,7 @@ export default {
     tableData2() {
       const arr = [...this.tableData]
       arr.map(item => {
+        item.pri_image = this.IMadd(item.pri_image)
         const metro_type = item.metro_type ? item.metro_type.split(',') : []
         const metroTypeName = metro_type.map(v => {
           return arrToObj(this.$dictData.metro_type)[v]

+ 1 - 0
src/views/house/index.vue

@@ -69,6 +69,7 @@ export default {
     tableData2() {
       const arr = [...this.tableData]
       arr.map(item => {
+        item.pri_image = this.IMadd(item.pri_image)
         const metro_type = item.metro_type ? item.metro_type.split(',') : []
         const metroTypeName = metro_type.map(v => {
           return arrToObj(this.$dictData.metro_type)[v]

+ 1 - 0
src/views/house/old.vue

@@ -54,6 +54,7 @@ export default {
     tableData2() {
       const arr = [...this.tableData]
       arr.map(item => {
+        item.pri_image = this.IMadd(item.pri_image)
         const metro_type = item.metro_type ? item.metro_type.split(',') : []
         const metroTypeName = metro_type.map(v => {
           return arrToObj(this.$dictData.metro_type)[v]

+ 1 - 1
src/views/news/components/popup/IndexEdit.vue

@@ -77,7 +77,7 @@ export default {
         { label: '作者', key: 'author', class: 'c-2' },
         { label: '状态', key: 'hide_status', type: 'select', class: 'c-2', options: this.$dictData.hide_status },
         { label: '发布时间', key: 'create_at', class: 'c-2', type: 'datePicker', type2: 'date'},
-        { label: '主图', key: 'pri_image', type: 'upload', class: 'c-2' },
+        { label: '主图', key: 'pri_image', type: 'uploads', class: 'c-2' },
         { label: '关联楼盘', key: 'estate_id_list', type: 'selectRemote', multiple: true, changeHandle: this.deviceChange,
           remoteParams: { skey: 'estate_name', api: `house.admestatelist?search_EQ_status=1`, opKey: 'estate_name', opVal: 'id' },
           remoteOptions: remoteOptionsIds

+ 1 - 1
src/views/news/components/popup/IndexEditSelf.vue

@@ -80,7 +80,7 @@ export default {
         { label: '分类', key: 'information_category', type: 'select', class: 'c-2', options: this.$dictData.information_category },
         { label: '作者', key: 'author', class: 'c-2' },
         { label: '状态', key: 'hide_status', type: 'select', class: 'c-2', options: this.$dictData.hide_status },
-        { label: '主图', key: 'pri_image', type: 'upload', class: 'c-2' },
+        { label: '主图', key: 'pri_image', type: 'uploads', class: 'c-2' },
         { label: '关联楼盘', key: 'estate_id_list', type: 'selectRemote', multiple: true, changeHandle: this.deviceChange,
           remoteParams: { skey: 'estate_name', api: `house.admestatelist?search_EQ_status=1`, opKey: 'estate_name', opVal: 'id' },
           remoteOptions: remoteOptionsIds

+ 1 - 1
src/views/news/index.vue

@@ -76,7 +76,7 @@ export default {
       const defaultImg = require('@/assets/ex_test.jpg')
       const arr = [...this.tableData]
       arr.map(item => {
-        item.pri_image = item.pri_image || defaultImg
+        item.pri_image = this.IMadd(item.pri_image)
         item.linkStr = `${item.link.length}---${item.link.substring(item.link.length-16, item.link.length-1)}`
         item.hideStatus = Number(item.hide_status)
       })

+ 5 - 0
src/views/school/components/popup/IndexEdit.vue

@@ -89,6 +89,7 @@ export default {
       } else {
         params.estate_gh_list = []
       }
+
       if (params.school_type === '2') {
         this.formData = [
           { label: '学校名称', key: 'school_name' },
@@ -138,6 +139,8 @@ export default {
           { label: '学校评价', key: 'remarked', type: 'textarea'},
         ]
       }
+      params.pri_image = this.IMadd(params.pri_image)
+      params.district_img = this.IMadd(params.district_img)
       this.setDefaultValue(params)
     },
     typeChange () {
@@ -162,6 +165,8 @@ export default {
             }
             newForm.longitude = this.cObj.longitude
             newForm.latitude = this.cObj.latitude
+            newForm.pri_image = this.IMdel(newForm.pri_image)
+            newForm.district_img = this.IMdel(newForm.district_img)
             if (!newForm.longitude) return this.$msgw('请选择经度!')
             else if (!newForm.latitude) return this.$msgw('请选择纬度!')
             let apiStr = 'admschooladd'

+ 3 - 1
src/views/school/index.vue

@@ -60,7 +60,9 @@ export default {
         // {id: 5, aa: '南师附小', bb: require('@/assets/ex_test.jpg'), eee: '学校的具体地址~',  cc: '华润万象城', gg: '红谷滩区', hh: '华润物业', updateByName: 'liujq', updateTime: '2021-01-13 10:25'},
         // {id: 6, aa: '南师附小', bb: require('@/assets/ex_test.jpg'), eee: '学校的具体地址~',  cc: '华润万象城', gg: '红谷滩区', hh: '华润物业', updateByName: 'liujq', updateTime: '2021-01-13 10:25'},
       ]
-      arr.map(item => {})
+      arr.map(item => {
+        item.pri_image = this.IMadd(item.pri_image)
+      })
       return arr
     }
   },

+ 2 - 0
src/views/tupai/components/popup/IndexEdit.vue

@@ -112,6 +112,7 @@ export default {
         { label: '地块位置', key: 'land_name', class: 'c-2', type: 'textarea' },
         { label: '土拍主图', key: 'pri_image', type: 'upload', class: 'c-2' },
       ]
+      params.pri_image = this.IMadd(params.pri_image)
       this.setDefaultValue(params)
     },
     finalPriceChange () {
@@ -135,6 +136,7 @@ export default {
             if (this.curObj.id) newForm.id = this.curObj.id
             let apiStr = 'admlandadd'
             if (newForm.id) apiStr = 'admlandedit'
+            newForm.pri_image = this.IMdel(newForm.pri_image)
             this.$api.house[apiStr](newForm).then(data => {
               this.$msgs(newForm.id ? '编辑成功' : '新增成功')
               this.$emit('close', newForm)

+ 1 - 0
src/views/tupai/index.vue

@@ -52,6 +52,7 @@ export default {
     tableData2() {
       const arr = [...this.tableData]
       arr.map(item => {
+        item.pri_image = this.IMadd(item.pri_image)
       })
       return arr
     }