Explorar el Código

fix: 图片修改

allen hace 2 años
padre
commit
b6f3e2da0f
Se han modificado 4 ficheros con 180 adiciones y 168 borrados
  1. 11 1
      src/main.js
  2. 164 162
      src/router/index.js
  3. 3 3
      src/views/waterSubsidy/components/newPolicy.vue
  4. 2 2
      src/views/waterSubsidy/index.vue

+ 11 - 1
src/main.js

@@ -1,7 +1,7 @@
 import Vue from 'vue';
 
 import Cookies from 'store';
-
+import { startsWith } from 'lodash-es';
 import Element from 'element-ui';
 import './assets/styles/element-variables.scss';
 import 'fontawesome-free-6.2.1/css/all.min.css';
@@ -49,7 +49,17 @@ import VueMeta from 'vue-meta';
 import DictData from '@/components/DictData';
 
 import VueAMap from 'vue-amap';
+function formatImg(url) {
+  const prefix = process.env.VUE_APP_BASE_API;
+
+  if (!url) {
+    return '-';
+  }
+
+  return startsWith(url, 'http') ? url : prefix + url;
+}
 
+Vue.filter('formatImg', formatImg);
 // 全局方法挂载
 Vue.prototype.getDataByDatatypeCode = getDataByDatatypeCode;
 Vue.prototype.getConfigKey = getConfigKey;

+ 164 - 162
src/router/index.js

@@ -49,168 +49,170 @@ export const constantRoutes = [
       }
     ]
   },
-  {
-    path: '/waterCardManageDataDetail',
-    component: () => import('@/views/waterCardManage/dataDetail'),
-    hidden: true
-  },
-  {
-    path: '/',
-    component: Layout,
-    redirect: '/home',
-    children: [
-      {
-        path: 'home',
-        name: 'home',
-        meta: { title: '首页', icon: 'peoples' },
-        component: () => import('@/views/home')
-      }
-    ]
-  },
-  {
-    path: '/gisShow',
-    component: Layout,
-    redirect: '/gisShow',
-    children: [
-      {
-        path: 'gisShow',
-        name: 'gisShow',
-        meta: { title: 'GIS 展示', icon: 'shopping' },
-        component: () => import('@/views/gisShow')
-      }
-    ]
-  },
-  {
-    path: '/monitoringMamage',
-    component: Layout,
-    redirect: '/monitoringMamage',
-    children: [
-      {
-        path: 'monitoringMamage',
-        name: 'monitoringMamage',
-        meta: { title: '监测管理', icon: 'shopping' },
-        component: () => import('@/views/monitoringMamage')
-      }
-    ]
-  },
-  {
-    path: '/peasantHouseholdManage',
-    component: Layout,
-    redirect: '/peasantHouseholdManage',
-    children: [
-      {
-        path: 'peasantHouseholdManage',
-        name: 'peasantHouseholdManage',
-        meta: { title: '农户管理', icon: 'peoples' },
-        component: () => import('@/views/peasantHouseholdManage')
-      }
-    ]
-  },
-  {
-    path: '/waterCardManage',
-    component: Layout,
-    redirect: '/waterCardManage',
-    children: [
-      {
-        path: 'waterCardManage',
-        name: 'waterCardManage',
-        meta: { title: '水卡管理', icon: 'shopping' },
-        component: () => import('@/views/waterCardManage')
-      }
-    ]
-  },
-  {
-    path: '/infrastructure',
-    component: Layout,
-    redirect: '/waterEstablishment',
-    meta: { title: '基础设施', icon: 'peoples' },
-    children: [
-      {
-        path: 'waterEstablishment',
-        name: 'waterEstablishment',
-        meta: { title: '水权设置', icon: 'shopping' },
-        component: () => import('@/views/infrastructure/waterEstablishment')
-      },
-      {
-        path: 'waterElectricityPriceSetting',
-        name: 'waterElectricityPriceSetting',
-        meta: { title: '水电价设置', icon: 'shopping' },
-        component: () =>
-          import('@/views/infrastructure/waterElectricityPriceSetting')
-      },
-      {
-        path: 'deviceSetup',
-        name: 'deviceSetup',
-        meta: { title: '设备管理', icon: 'shopping' },
-        component: () => import('@/views/infrastructure/deviceSetup')
-      }
-    ]
-  },
-  {
-    path: '/dataReport',
-    component: Layout,
-    redirect: '/intakeWaterAnalysis',
-    meta: { title: '数据报表', icon: 'peoples' },
-    children: [
-      {
-        path: 'intakeWaterAnalysis',
-        name: 'intakeWaterAnalysis',
-        meta: { title: '用水统计(组织)', icon: 'shopping' },
-        component: () => import('@/views/dataReport/intakeWaterAnalysis')
-      },
-      {
-        path: 'saveWaterAnalysis',
-        name: 'saveWaterAnalysis',
-        meta: { title: '节水分析(农户)', icon: 'shopping' },
-        component: () => import('@/views/dataReport/saveWaterAnalysis')
-      },
-      {
-        path: 'waterConsumption',
-        name: 'waterConsumption',
-        meta: { title: '取水分析(机井)', icon: 'shopping' },
-        component: () => import('@/views/dataReport/waterConsumption')
-      }
-    ]
-  },
-  {
-    path: '/waterSubsidy',
-    component: Layout,
-    redirect: '/waterSubsidy',
-    children: [
-      {
-        path: 'waterSubsidy',
-        name: 'waterSubsidy',
-        meta: { title: '节水政策补贴', icon: 'shopping' },
-        component: () => import('@/views/waterSubsidy')
-      }
-    ]
-  },
-  {
-    path: '/waterMarket',
-    component: Layout,
-    redirect: '/waterMarket',
-    children: [
-      {
-        path: 'waterMarket',
-        name: 'waterMarket',
-        meta: { title: '水权交易', icon: 'shopping' },
-        component: () => import('@/views/waterMarket')
-      }
-    ]
-  },
-  {
-    path: '/waterManage',
-    component: Layout,
-    redirect: '/waterManage',
-    children: [
-      {
-        path: 'waterManage',
-        name: 'waterManage',
-        meta: { title: '用水协会管理', icon: 'shopping' },
-        component: () => import('@/views/waterManage')
-      }
-    ]
-  },
+
+  // {
+  //   path: '/waterCardManageDataDetail',
+  //   component: () => import('@/views/waterCardManage/dataDetail'),
+  //   hidden: true
+  // },
+  // {
+  //   path: '/',
+  //   component: Layout,
+  //   redirect: '/home',
+  //   children: [
+  //     {
+  //       path: 'home',
+  //       name: 'home',
+  //       meta: { title: '首页', icon: 'peoples' },
+  //       component: () => import('@/views/home')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/gisShow',
+  //   component: Layout,
+  //   redirect: '/gisShow',
+  //   children: [
+  //     {
+  //       path: 'gisShow',
+  //       name: 'gisShow',
+  //       meta: { title: 'GIS 展示', icon: 'shopping' },
+  //       component: () => import('@/views/gisShow')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/monitoringMamage',
+  //   component: Layout,
+  //   redirect: '/monitoringMamage',
+  //   children: [
+  //     {
+  //       path: 'monitoringMamage',
+  //       name: 'monitoringMamage',
+  //       meta: { title: '监测管理', icon: 'shopping' },
+  //       component: () => import('@/views/monitoringMamage')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/peasantHouseholdManage',
+  //   component: Layout,
+  //   redirect: '/peasantHouseholdManage',
+  //   children: [
+  //     {
+  //       path: 'peasantHouseholdManage',
+  //       name: 'peasantHouseholdManage',
+  //       meta: { title: '农户管理', icon: 'peoples' },
+  //       component: () => import('@/views/peasantHouseholdManage')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/waterCardManage',
+  //   component: Layout,
+  //   redirect: '/waterCardManage',
+  //   children: [
+  //     {
+  //       path: 'waterCardManage',
+  //       name: 'waterCardManage',
+  //       meta: { title: '水卡管理', icon: 'shopping' },
+  //       component: () => import('@/views/waterCardManage')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/infrastructure',
+  //   component: Layout,
+  //   redirect: '/waterEstablishment',
+  //   meta: { title: '基础设施', icon: 'peoples' },
+  //   children: [
+  //     {
+  //       path: 'waterEstablishment',
+  //       name: 'waterEstablishment',
+  //       meta: { title: '水权设置', icon: 'shopping' },
+  //       component: () => import('@/views/infrastructure/waterEstablishment')
+  //     },
+  //     {
+  //       path: 'waterElectricityPriceSetting',
+  //       name: 'waterElectricityPriceSetting',
+  //       meta: { title: '水电价设置', icon: 'shopping' },
+  //       component: () =>
+  //         import('@/views/infrastructure/waterElectricityPriceSetting')
+  //     },
+  //     {
+  //       path: 'deviceSetup',
+  //       name: 'deviceSetup',
+  //       meta: { title: '设备管理', icon: 'shopping' },
+  //       component: () => import('@/views/infrastructure/deviceSetup')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/dataReport',
+  //   component: Layout,
+  //   redirect: '/intakeWaterAnalysis',
+  //   meta: { title: '数据报表', icon: 'peoples' },
+  //   children: [
+  //     {
+  //       path: 'intakeWaterAnalysis',
+  //       name: 'intakeWaterAnalysis',
+  //       meta: { title: '用水统计(组织)', icon: 'shopping' },
+  //       component: () => import('@/views/dataReport/intakeWaterAnalysis')
+  //     },
+  //     {
+  //       path: 'saveWaterAnalysis',
+  //       name: 'saveWaterAnalysis',
+  //       meta: { title: '节水分析(农户)', icon: 'shopping' },
+  //       component: () => import('@/views/dataReport/saveWaterAnalysis')
+  //     },
+  //     {
+  //       path: 'waterConsumption',
+  //       name: 'waterConsumption',
+  //       meta: { title: '取水分析(机井)', icon: 'shopping' },
+  //       component: () => import('@/views/dataReport/waterConsumption')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/waterSubsidy',
+  //   component: Layout,
+  //   redirect: '/waterSubsidy',
+  //   children: [
+  //     {
+  //       path: 'waterSubsidy',
+  //       name: 'waterSubsidy',
+  //       meta: { title: '节水政策补贴', icon: 'shopping' },
+  //       component: () => import('@/views/waterSubsidy')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/waterMarket',
+  //   component: Layout,
+  //   redirect: '/waterMarket',
+  //   children: [
+  //     {
+  //       path: 'waterMarket',
+  //       name: 'waterMarket',
+  //       meta: { title: '水权交易', icon: 'shopping' },
+  //       component: () => import('@/views/waterMarket')
+  //     }
+  //   ]
+  // },
+  // {
+  //   path: '/waterManage',
+  //   component: Layout,
+  //   redirect: '/waterManage',
+  //   children: [
+  //     {
+  //       path: 'waterManage',
+  //       name: 'waterManage',
+  //       meta: { title: '用水协会管理', icon: 'shopping' },
+  //       component: () => import('@/views/waterManage')
+  //     }
+  //   ]
+  // },
+
   {
     path: '/login',
     component: () => import('@/views/login'),

+ 3 - 3
src/views/waterSubsidy/components/newPolicy.vue

@@ -16,6 +16,7 @@
       :model="baseForm"
       :rules="rules"
       size="small"
+      style="height:600px;"
     >
       <el-row>
         <el-form-item label="标题:" prop="subsidypolicyTitle">
@@ -38,7 +39,7 @@
              name="file"
              :headers="headers"
              :before-upload="beforeAvatarUpload">
-             <img v-if="baseForm.src" :src="baseForm.src" class="avatar">
+             <img v-if="baseForm.src" :src="baseForm.src | formatImg" class="avatar">
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
            <span style="color:#F56C6C">仅支持上传jpg/jpeg/png且大小不超过5M的图片</span>
@@ -47,7 +48,7 @@
       <el-row style="height: 200px;">
         <el-form-item label="内容:" prop="subsidypolicyContent">
           <Editor
-            style="height: 150px"
+            style="height: 300px"
             v-model="baseForm.subsidypolicyContent"
             :mode="mode"
             @onCreated="onCreated"
@@ -166,7 +167,6 @@ export default {
       deep: true
     },
     'baseForm.src'(val) {
-      console.log(val, 'valvalvlalvalslsdkal12312')
       if(val) this.$refs.baseForm.clearValidate(['src'])
     },
     'baseForm.subsidypolicyContent'(val) {

+ 2 - 2
src/views/waterSubsidy/index.vue

@@ -45,7 +45,7 @@
           >
             <template #styleImg="scope">
               <el-image
-                :src="dialogImageUrl + scope.row.previews || ''"
+                :src="scope.row.previews | formatImg"
                 :preview-src-list="[dialogImageUrl + scope.row.previews || '']"
                 slot="error"
                 class="image-slot"
@@ -211,7 +211,7 @@ export default {
       this.policyType = 'edit'
       const params = {
         subsidypolicyTitle: row?.subsidypolicyTitle,
-        src: this.dialogImageUrl + row?.previews,
+        src: row?.previews,
         subsidypolicyContent: row?.subsidypolicyContent,
         subsidypolicyId: row?.subsidypolicyId,
         resIds: row?.resIds