Commit 3a595e4c by 高淑倩

formateUrl

parent 22c344e2
......@@ -14,9 +14,11 @@ Component({
value: null
}
},
attached () {
},
attached() {
this.setData({
baseImgUrl: app.globalData.imageUrl
})
},
/**
* 组件的初始数据
*/
......
<!--component/announcement/announcement.wxml-->
<wxs src="../../wxs/utils.wxs" module="utils" />
<view class="announcement df" style="background-color:{{notice.backgroundColor}}" data-redirectId="{{notice.redirectId}}" bindtap="handelToAnn">
<view class="horn">
<image class="img" src="{{notice.iconImageUrl? 'notice.iconImageUrl': '/assets/imgs/7_1_0/notice.png'}}" mode="widthFix" lazy-load="false" binderror="" bindload="" />
<image class="img" src="{{notice.iconImageUrl? utils.formateUrl(notice.iconImageUrl,baseImgUrl) : '/assets/imgs/7_1_0/notice.png'}}" mode="widthFix" />
<!--<image class="img" src="{{notice.iconImageUrl? 'notice.iconImageUrl': '/assets/imgs/7_1_0/notice.png'}}" mode="widthFix" />-->
</view>
<text class="text" style="color:{{notice.fontColor}}">{{notice.content}}</text>
</view>
\ No newline at end of file
<!--component/imageSwiper/imageSwiper.wxml-->
<wxs src="../../wxs/utils.wxs" module="utils" />
<swiper
class="image-swiper"
indicator-dots="{{indicatorDots}}"
......@@ -18,7 +19,7 @@
data-item="{{item}}"
bindtap='preview'
>
<image bindload="imageLoad" src="{{item.imageUrl}}" id="swiperImg{{index}}" mode="widthFix" class="slide-image" />
<image bindload="imageLoad" src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}" id="swiperImg{{index}}" mode="widthFix" class="slide-image" />
</view>
</swiper-item>
</block>
......
<!--component/personCenter/personCenter.wxml-->
<wxs src="../../wxs/utils.wxs" module="utils" />
<view wx:if='{{!currentMobile}}' class="member-unActive {{personCenter.noactiveBackgroundImageUrl ?'':'member-unActive-bgc'}}" bindtap="handleTtoActiveMemebr">
<image wx:if="{{baseImgUrl}}" src="{{baseImgUrl}}{{personCenter.noactiveBackgroundImageUrl}}" class="no-active-img" mode="widthFix"></image>
<image src="{{utils.formateUrl(personCenter.noactiveBackgroundImageUrl,baseImgUrl)}}" class="no-active-img" mode="widthFix"></image>
</view>
<view wx:if='{{currentMobile}}' catchtap="handleToMemberOfOwn" class="activation-content activation-bg {{true ? 'user-content' : ''}}" style="{{personData.backgroundImageUrl ? 'background-image: url('+ baseImgUrl +''+ personData.backgroundImageUrl +');' : 'background-color: ' + baseUrl + ';'}}">
<view class='user-info' wx:if='{{currentMobile}}'>
......
<!--component/picNav/picNav.wxml-->
<wxs src="../../wxs/utils.wxs" module="utils" />
<view class="pic-nav">
<view
wx:for="{{picNav}}"
......@@ -10,7 +11,7 @@
wx:if="{{baseImgUrl}}"
class="pic-img"
style="width: {{100}}%;height: {{100}}px;"
src="{{item.imageUrl}}"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
......
......@@ -39,7 +39,7 @@
"list": []
},
"miniprogram": {
"current": 40,
"current": 13,
"list": [
{
"id": -1,
......@@ -123,7 +123,7 @@
"id": 13,
"name": "subPage",
"pathName": "subPackage/page/pages/subPage/subPage",
"query": "pageId=14",
"query": "pageId=16",
"scene": null
},
{
......
......@@ -20,8 +20,16 @@ function handerNickName (nickName,limitLength) {
return nickName || ''
}
// 处理 http 地址
function formateUrl(url, BASE_IMG_URL){
if(url){
url = url.indexOf('http') > -1 ? url : BASE_IMG_URL + url;
}
return url;
}
module.exports = {
formateUrl:formateUrl,
numberFormat: numberFormat,
date: date,
handerNickName: handerNickName
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment