Ver Fonte

默认图片替换

zhaoxiaohai há 4 anos atrás
pai
commit
4e93430338

+ 3 - 9
components/My_ChangeUser/index.js

@@ -1,4 +1,4 @@
-// components/My_ChangeUser/index.js
+const setData = require('../../utils/processingData');
 Component({
     options: {
         addGlobalClass: true,
@@ -24,14 +24,8 @@ Component({
     lifetimes: {
         attached: function () {
             // 在组件实例进入页面节点树时执行
-            let userList = getApp().globalData.account_list;
-            for (let i = 0; i < userList.length; i++) {
-                let attinfos = [];
-                for (let k = 0; k < userList[i].attinfos.length; k++) {
-                    if (userList[i].attinfos[k].ftype == 'headportrait') attinfos.push(userList[i].attinfos[k])
-                }
-                userList[i].attinfos = attinfos;
-            }
+            let list = getApp().globalData.account_list;
+            const userList = setData.imageType(list, "headportrait");
             this.setData({
                 userList
             });

+ 1 - 1
components/My_ChangeUser/index.wxml

@@ -1,7 +1,7 @@
 <scroll-view scroll-y>
     <view class="input_text_box {{userIndex==index?'optfor':''}}" data-index="{{index}}" bindtap="userChange" wx:for="{{userList}}">
         <image wx:if="{{item.attinfos[0].fobsurl}}" class="input_text_img" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
-        <image wx:else class="input_text_img" src="/static/userImage.png" mode="aspectFill"></image>
+        <image wx:else class="input_text_img" src="/static/tacitly-approve/MRuserImg.png" mode="aspectFill"></image>
         <view class="text_box">
             <view class="user_name u-line-1">
                 {{item.fname}}

+ 4 - 2
components/My_DisplayItem/index.wxml

@@ -2,7 +2,7 @@
     <!-- 展示图片 -->
     <view class="display-item-image">
         <image wx:if="{{content.attinfos[0]}}" src="{{content.attinfos[0].fobsurl}}" mode="aspectFill"></image>
-        <image wx:else src="/static/userImage.png" mode="aspectFit"></image>
+        <image wx:else src="/static/tacitly-approve/MRproduct.png" mode="aspectFit"></image>
     </view>
     <!-- 展示文本信息 -->
     <view class="display-item-textExplain">
@@ -10,7 +10,9 @@
         <view class="textExplain-explain u-line-1">{{content.fcontent}}</view>
         <view class="textExplain-userData-time">
             <view class="textExplain-userData">
-                <image src="{{content.headportraiturl}}" mode="aspectFit"></image>{{anonymity?'匿名用户':content.createby}}
+                <image wx:if="{{content.headportraiturl}}" src="{{content.headportraiturl}}" mode="aspectFill"></image>
+                <image wx:else src="/static/tacitly-approve/MRuserImg.png" mode="aspectFit"></image>
+                {{anonymity?'匿名用户':content.createby}}
                 <slot name="button">
 
                 </slot>

+ 1 - 1
components/My_MembersAndProducts/index.wxml

@@ -3,7 +3,7 @@
         <!-- 图片 -->
         <view class="grey_rectangle_image" style="height: {{imgSize}}; width:{{imgSize}}; border-radius: {{radius}};">
             <image wx:if="{{attinfos.fobsurl}}" src="{{attinfos.fobsurl}}" mode="aspectFill"></image>
-            <image wx:else src="/static/userImage.png" mode="aspectFit"></image>
+            <image wx:else src="/static/tacitly-approve/MRproduct.png" mode="aspectFit"></image>
         </view>
         <!-- 文本信息 -->
         <view class="grey_rectangle_text">

+ 4 - 3
components/My_VerticalBox/index.wxml

@@ -1,6 +1,7 @@
 <view class="VerticalBox" wx:if="{{pageType=='home'}}">
     <view class="VerticalBox-item" wx:for="{{list}}" data-index="{{index}}" catchtap="homeToPage">
-        <image class="VerticalBox-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+        <image wx:if='{{item.attinfos[0]}}' class="VerticalBox-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+        <image wx:else class="VerticalBox-image" src="/static/tacitly-approve/MRlogo.png" mode="aspectFill"></image>
         <view class="VerticalBox-title u-line-1">{{item.fbrand}}</view>
         <view class="VerticalBox-explain u-line-1">{{item.saleprodclass[0]}}{{item.saleprodclass[1]!=undefined?'-'+item.saleprodclass[1]:''}}</view>
     </view>
@@ -8,8 +9,8 @@
 
 <view class="VerticalBox zhanhui" wx:else>
     <view class="VerticalBox-item" wx:for="{{list}}">
-        <image wx:if="{{item.attinfos[0].fobsurl}}" class="VerticalBox-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
-        <image wx:else class="VerticalBox-image" src="/static/userImage.png" mode="aspectFill"></image>
+        <image wx:if="{{item.attinfos[0]}}" class="VerticalBox-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+        <image wx:else class="VerticalBox-image" src="/static/tacitly-approve/MRlogo.png" mode="aspectFill"></image>
         <view class="VerticalBox-title  u-line-1">{{(item.fprodname==null)?'暂无':item.fprodname}}</view>
         <view class="VerticalBox-explain  u-line-1">{{(item.fprodclassname==null)?'暂无':item.fprodclassname}}</view>
     </view>

+ 2 - 1
pages/businessPartner/details.wxml

@@ -4,7 +4,8 @@
             <view class="right-text">{{partnerDetails.fbrand}}</view>
         </My_GreyRectangleForm>
         <My_GreyRectangleForm title="商户logo" required>
-            <image style="z-index: 9;" class="logo" src="{{partnerDetails.attinfos[0].fobsurl}}" mode="aspectFill" catchtap="previewImg"></image>
+            <image wx:if="{{partnerDetails.attinfos[0].fobsurl}}" style="z-index: 9;" class="logo" src="{{partnerDetails.attinfos[0].fobsurl}}" mode="aspectFill" catchtap="previewImg"></image>
+            <image wx:else style="z-index: 9;" class="logo" src="/static/tacitly-approve/MRlogo.png" mode="aspectFill" catchtap="previewImg"></image>
         </My_GreyRectangleForm>
         <My_GreyRectangleForm title="是否合作">
             <van-switch checked="{{ checked }}" size="24px" active-color="#4CBECF" bind:change="onChange" />

+ 2 - 1
pages/businessPartner/index.wxml

@@ -6,7 +6,8 @@
     <image slot="display-box-img" class="display-title_image" src="/static/icon-05.png" mode="aspectFit"></image>
     <scroll-view class="list-scroll-view" scroll-y bindscrolltolower="scrolltolower">
         <view class="company-data" wx:for="{{cooperationList}}" data-index="{{index}}" bindtap="showBtnIndex">
-            <image class="company-data-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+            <image wx:if="{{item.attinfos[0]}}" class="company-data-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+            <image wx:else class="company-data-image" src="/static/tacitly-approve/MRuserImg.png" mode="aspectFill"></image>
             <view class="company-data-text">
                 <view class="company-data-brandName u-line-1">{{item.fbrand}}</view>
                 <view wx:if="{{item.ftype==1}}">合作方式:上游</view>

+ 6 - 2
pages/tabbar-pages/home/index.js

@@ -119,7 +119,8 @@ Page({
                 title: res.data,
                 icon: "none"
             });
-            const partnerList = handleList.twoDimensionalArr(res.data, 3);
+            let data = handleList.imageType(res.data, 'brandlogo')
+            const partnerList = handleList.twoDimensionalArr(data, 3);
             this.setData({
                 partnerList
             })
@@ -132,7 +133,10 @@ Page({
     },
     /* 一键联系 */
     contact() {
-        console.log('一键联系')
+        /* wx.showToast({
+            title: '功能尚在开发',
+            icon: "none"
+        }) */
     },
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 1 - 1
pages/tabbar-pages/user/index.wxml

@@ -7,7 +7,7 @@
             <!-- 头像 -->
             <view class="user_headPortrait">
                 <image wx:if="{{userMessage.attinfos[0].fobsurl}}" src="{{userMessage.attinfos[0].fobsurl}}" mode="aspectFill"></image>
-                <image wx:else src="/static/userImage.png" mode="aspectFit"></image>
+                <image wx:else src="/static/tacitly-approve/MRuserImg.png" mode="aspectFit"></image>
             </view>
             <!-- 信息 -->
             <view class="user_message" bindtap="toUserCenter">

+ 3 - 1
pages/userCenter/index.wxml

@@ -5,7 +5,9 @@
             <!-- 头像 -->
             <view class="user_headPortrait">
                 <image wx:if="{{attinfos[0].url}}" src="{{attinfos[0].url}}" mode="aspectFill"></image>
-                <image wx:else src="/static/userImage.png" mode="aspectFit"></image>
+                <view wx:else class="MRuserImg">
+                    <image src="/static/icon-10.png"></image>
+                </view>
             </view>
             <!-- 修改头像 -->
             <My_UploadFiles id="UploadFiles" upType="userImage" bind:imageChange="userImageChange" fileList="{{attinfos}}" UploadShow='3' lineHeight="130rpx">

+ 16 - 0
pages/userCenter/index.wxss

@@ -32,6 +32,22 @@
     box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.1);
 }
 
+.MRuserImg {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    width: 100%;
+    height: 100%;
+    border-radius: 50%;
+    background-color: #F6F7F8;
+}
+
+.MRuserImg image {
+
+    width: 60rpx;
+    height: 60rpx;
+}
+
 /* 修改头像 */
 .changeImage {
     font-size: 32rpx;

BIN
static/tacitly-approve/MRlogo.png


BIN
static/tacitly-approve/MRproduct.png


BIN
static/tacitly-approve/MRuserImg.png


+ 15 - 2
utils/processingData.js

@@ -1,3 +1,15 @@
+/* 图片类型 */
+function imageType(data, type) {
+    for (let i = 0; i < data.length; i++) {
+        let attinfos = [];
+        for (let k = 0; k < data[i].attinfos.length; k++) {
+            if (data[i].attinfos[k].ftype == type) attinfos.push(data[i].attinfos[k])
+        }
+        data[i].attinfos = attinfos;
+    }
+    return data;
+}
+
 /* 二维数组 */
 function twoDimensionalArr(data, nub, max = 3) {
     let list = data,
@@ -12,7 +24,7 @@ function twoDimensionalArr(data, nub, max = 3) {
 function checkdate(data) {
     for (let i = 0; i < data.length; i++) {
         let checkdate = data[i].checkdate;
-        if(checkdate == String) data[i].checkdate = checkdate.slice(0, checkdate.lastIndexOf('.'));
+        if (checkdate == String) data[i].checkdate = checkdate.slice(0, checkdate.lastIndexOf('.'));
     }
     return data;
 }
@@ -44,5 +56,6 @@ module.exports = {
     checkdate,
     listOrdering,
     getYTD,
-    twoDimensionalArr
+    twoDimensionalArr,
+    imageType
 }