Commit 9dffd164 by zhangxw

优化

1 parent 1e56a612
...@@ -12,21 +12,28 @@ Component({ ...@@ -12,21 +12,28 @@ Component({
data: { data: {
type: Object, type: Object,
observer(val) { observer(val) {
let _this = this
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
this.setData({ _this.setData({
navHeight: thisPage.data.navHeight navHeight: thisPage.data.navHeight
}) })
if (val.showSharePopup) { if (val.showSharePopup) {
val.boxImageHeight = 66 val.boxImageHeight = 66
// 计算弹窗图片区域最大高度 // 计算弹窗图片区域最大高度
wx.$util.getViewInfo('.layout', res => { wx.$util.getViewInfo('.layout', res => {
this.setData({ _this.setData({
postersBoxHeight: res.height * 0.7, postersBoxHeight: res.height * 0.7,
postersImageHeight: (res.height / res.width ) * 247
}) })
val.postersBoxHeight = res.height * 0.7, wx.getImageInfo({
val.postersImageHeight = (res.height / res.width ) * 247 src: val.posterImg,
this.init(val) success(e) {
_this.setData({
postersImageHeight: (e.height / e.width ) * 247
})
val.postersImageHeight = (e.height / e.width ) * 247
_this.init(val)
}
})
}) })
} }
...@@ -49,8 +56,8 @@ Component({ ...@@ -49,8 +56,8 @@ Component({
async init(n) { async init(n) {
wx.$api.showLoading() wx.$api.showLoading()
const drawfun = new Draw({ const drawfun = new Draw({
width: 280, width: 279,
height: n.postersImageHeight + 80, height: n.postersImageHeight + 76,
borderRadius: 8 borderRadius: 8
}, this), }, this),
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</view> </view>
</view> </view>
<view class="share-popup-content" style="max-height: {{postersBoxHeight}}px;"> <view class="share-popup-content" style="max-height: {{postersBoxHeight}}px;">
<image style="height: {{postersImageHeight + 80}}px;" mode="widthFix" src="{{poster}}"></image> <image style="height: {{postersImageHeight + 76}}px;" src="{{poster}}"></image>
</view> </view>
<view class="btn-box"> <view class="btn-box">
<view class="btn" bind:tap="saveImage">保存至相册</view> <view class="btn" bind:tap="saveImage">保存至相册</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!