Procházet zdrojové kódy

判断图片是否为空

guo00guo před 5 roky
rodič
revize
8fcbb262a5

+ 1 - 1
src/components/project/ProjectCreate.vue

@@ -282,7 +282,7 @@ export default {
           {required: true, message: '预算不可为空', trigger: 'blur'},
           {
             validator: (rule, value, callback) => {
-              if(value < 0){
+              if(parseInt(value) < 0){
                 callback(new Error('请输入不小于0的数'))
               } else {
                 callback()

+ 2 - 2
src/components/task/Task.vue

@@ -323,8 +323,8 @@
             {required: true, message: '预算不可为空', trigger: 'blur'},
             {
               validator: (rule, value, callback) => {
-                if (value <= 0) {
-                  callback(new Error('请输入于0的数'))
+                if (value < 0) {
+                  callback(new Error('请输入不小于0的数'))
                 } else {
                   callback()
                 }

+ 2 - 1
src/pages/DetailPage/AgencyDetail.vue

@@ -8,7 +8,7 @@
           <span>
           <el-image
             style="width: 100px;"
-            :src="authentication.agencyPhoto"
+            :src="authentication.agencyPhoto==null?defaultValue.image:authentication.agencyPhoto"
             fit="scale-down"></el-image>
         </span>
         </el-form-item>
@@ -73,6 +73,7 @@
         userId: 0,
         resourceTypes: [],
         serviceTypes: [],
+        defaultValue:defaultValue,
         authentication: {
           mobile: '',
           evaluationAgencyName: '',

+ 3 - 2
src/pages/DetailPage/UserDetail.vue

@@ -7,7 +7,7 @@
         </el-form-item>
         <el-form-item label="用户图标" prop="photo">
           <!--          <span  class="badge">{{user.photo}}</span>-->
-          <img :src="user.photo" style="width: 50px; height: 50px;"/>
+          <img :src="user.photo==null?defaultValue.image:user.photo" style="width: 50px; height: 50px;"/>
         </el-form-item>
         <el-form-item label="性别" prop="count" v-if="this.gender != null &&  this.gender != ''">
           <span>{{user.gender}}</span>
@@ -30,7 +30,7 @@
   import Http from '@/js/http.js'
   import Apis from '@/js/api.js'
   import {notify} from '@/constants/index'
-  import {getAllReportTypes, storageGet} from '@/js/index'
+  import {getAllReportTypes, storageGet,defaultValue} from '@/js/index'
 
   export default {
     name: 'UserDetail',
@@ -39,6 +39,7 @@
       return {
         user: {},
         loading: false,
+        defaultValue: defaultValue,
         id: 0,
         user: {
           name: '',

+ 7 - 1
src/pages/Homepage/BrandCard.vue

@@ -7,7 +7,7 @@
     <div style="height: 96px">
       <el-row :gutter="15">
         <el-col v-for="item in residentAgencyList" :key="item.id" :span="6" style="height: 70px">
-          <img :src="item.agencyPhoto" :alt="item.evaluationAgencyName" style="width: 70%;height: 100%; cursor: pointer;" @click="goToDetail(item.userId)"/>
+          <img :src="item.agencyPhoto==null?defaultValue.image:item.agencyPhoto" :alt="item.evaluationAgencyName" style="width: 70%;height: 100%; cursor: pointer;" @click="goToDetail(item.userId)"/>
         </el-col>
       </el-row>
     </div>
@@ -15,9 +15,15 @@
 </template>
 
 <script>
+  import {defaultValue} from '@/js/index.js'
   export default {
     name: "BrandCard",
     props:['residentAgencyList'],
+    data() {
+      return{
+        defaultValue: defaultValue,
+      }
+    },
     methods:{
         goToMoreAgency(){
             this.$router.push({

+ 7 - 1
src/pages/Homepage/HotAgency.vue

@@ -8,7 +8,7 @@
     <div class="popular-list">
       <el-row class="popular-list-item" v-for="item in agencyRank" :key="item.id">
         <el-col :span="19">
-          <img :src="item.agencyPhoto" alt="logo-project" class="pull-left project-logo-img" style="cursor: pointer" @click="goToDetail(item.userId)">
+          <img :src="item.agencyPhoto==null?defaultValue.image:item.agencyPhoto" alt="logo-project" class="pull-left project-logo-img" style="cursor: pointer" @click="goToDetail(item.userId)">
           <div style="margin-left: 55px; cursor: pointer;" @click="goToDetail(item.userId)"  >
             <div class="list-item-title">
               {{item.evaluationAgencyName}}
@@ -29,10 +29,16 @@
 </template>
 
 <script>
+  import {defaultValue} from '@/js/index.js'
   import Http from '@/js/http.js';
   export default {
     name: 'HotAgency',
     props:['agencyRank'],
+    data() {
+      return{
+        defaultValue: defaultValue,
+      }
+    },
     methods:{
         goToMoreAgency(){
             this.$router.push({

+ 7 - 1
src/pages/Homepage/HotUser.vue

@@ -8,7 +8,7 @@
     <div class="popular-list">
       <el-row class="popular-list-item" v-for="item in userRank" :key="item.id">
         <el-col :span="19">
-          <img :src="item.photoUrl" alt="logo-project" class="pull-left project-logo-img" style="cursor: pointer" @click="goToDetail(item.id)">
+          <img :src="item.photoUrl==null?defaultValue.image:item.photoUrl" alt="logo-project" class="pull-left project-logo-img" style="cursor: pointer" @click="goToDetail(item.id)">
           <div style="margin-left: 55px;cursor: pointer;" @click="goToDetail(item.id)">
             <div class="list-item-title">
               {{item.name}}
@@ -29,9 +29,15 @@
 </template>
 
 <script>
+  import {defaultValue} from '@/js/index.js'
   export default {
     name: 'HotCrowd',
     props:['userRank'],
+    data() {
+      return{
+        defaultValue: defaultValue,
+      }
+    },
     methods:{
         getMore(){
             this.$router.push({

+ 3 - 2
src/pages/HomepageSearch/AgencyList.vue

@@ -44,7 +44,7 @@
               <el-table-column
                 label="头像"
                 width="100">
-                <template slot-scope="scope"><img :src="scope.row.agencyPhoto" style="width: 50px; height: 50px;"/>
+                <template slot-scope="scope"><img :src="scope.row.agencyPhoto==null?defaultValue.image:scope.row.agencyPhoto" style="width: 50px; height: 50px;"/>
                 </template>
               </el-table-column>
               <el-table-column
@@ -91,7 +91,7 @@
 <script>
     import Http from '@/js/http.js';
     import TopSearch from "../../components/commons/TopSearch";
-    import {storageGet} from '@/js/index.js'
+    import {storageGet,defaultValue} from '@/js/index.js'
     import {notify} from "../../constants";
 
     export default {
@@ -101,6 +101,7 @@
             return {
                 isLogin: false,
                 loading: false,
+                defaultValue: defaultValue,
                 searchVal: '',
                 searchType: '1',
                 searchTypeArr: [

+ 3 - 2
src/pages/HomepageSearch/AgencyResidentList.vue

@@ -44,7 +44,7 @@
               <el-table-column
                 label="头像"
                 width="100">
-                <template slot-scope="scope"><img :src="scope.row.agencyPhoto" style="width: 50px; height: 50px;"/></template>
+                <template slot-scope="scope"><img :src="scope.row.agencyPhoto==null?defaultValue.image:scope.row.agencyPhoto" style="width: 50px; height: 50px;"/></template>
               </el-table-column>
               <el-table-column
                 prop="name"
@@ -85,7 +85,7 @@
 <script>
     import Http from '@/js/http.js';
     import TopSearch from "../../components/commons/TopSearch";
-    import {storageGet} from '@/js/index.js'
+    import {storageGet,defaultValue} from '@/js/index.js'
     import {notify} from "../../constants";
 
     export default {
@@ -97,6 +97,7 @@
                 isLogin: false,
                 searchType: '0',
                 loading: false,
+                defaultValue: defaultValue,
                 searchTypeArr: [
                     {
                         "name": "入驻机构",

+ 3 - 2
src/pages/HomepageSearch/CompetitionList.vue

@@ -44,7 +44,7 @@
               <el-table-column
                 label="图标"
                 width="100">
-                <template slot-scope="scope"><img :src="scope.row.image" style="width: 50px; height: 50px;"/></template>
+                <template slot-scope="scope"><img :src="scope.row.image==null?defaultValue.image:scope.row.image" style="width: 50px; height: 50px;"/></template>
               </el-table-column>
               <el-table-column
                 label="名称"
@@ -83,7 +83,7 @@
 <script>
     import Http from '@/js/http.js';
     import TopSearch from "../../components/commons/TopSearch";
-    import {storageGet} from '@/js/index.js'
+    import {storageGet,defaultValue} from '@/js/index.js'
     import {notify} from "../../constants";
 
     export default {
@@ -95,6 +95,7 @@
                 isLogin: false,
                 // searchVal: '',
                 searchType: '0',
+                defaultValue: defaultValue,
                 searchTypeArr: [
                     {
                         "name": "大赛",

+ 3 - 2
src/pages/HomepageSearch/UserList.vue

@@ -44,7 +44,7 @@
               <el-table-column
                 label="头像"
                 width="100">
-                <template slot-scope="scope"><img :src="scope.row.photoUrl" style="width: 50px; height: 50px;"/></template>
+                <template slot-scope="scope"><img :src="scope.row.photoUrl==null?defaultValue.image:scope.row.photoUrl" style="width: 50px; height: 50px;"/></template>
               </el-table-column>
               <el-table-column
                 prop="name"
@@ -95,7 +95,7 @@
 <script>
     import Http from '@/js/http.js';
     import TopSearch from "../../components/commons/TopSearch";
-    import {storageGet} from '@/js/index.js'
+    import {storageGet,defaultValue} from '@/js/index.js'
     import {notify} from "../../constants";
 
     export default {
@@ -114,6 +114,7 @@
                         "value": "0"
                     }],
                 curUserList: this.userList,
+                defaultValue: defaultValue,
                 activePage: 1,
                 totalElements: 0
             }