Commit b862f0cc806a49077672bb0431117fcd0936056e

Authored by vking
1 parent 24a7b019

painter

... ... @@ -7,7 +7,7 @@ Component({
* 组件的属性列表
*/
properties: {
filePath:String,
},
/**
... ... @@ -29,11 +29,13 @@ Component({
* 组件的方法列表
*/
methods: {
saveFile(filePath=''){
filePath=filePath?filePath:this.data.filePath
saveFile(){
let filePath=this.data.filePath
console.log('saveFile.filePath',filePath)
wx.saveImageToPhotosAlbum({
filePath:filePath,
fail:()=>{
fail:(efail)=>{
console.log('saveImageToPhotosAlbum.fail',efail)
wx.showModal({
title: '授权提示',
content: '您拒绝了保存文件,请点击确定打开授权',
... ...
... ... @@ -92,23 +92,100 @@ Page({
})
},
initImage(){
this.setData({
palette:{
let palette={}
if(this.options.act=='quanzi'){
let seller=this.data.seller
let pw=getApp().system.windowWidth-20;
let ph=pw/355*558;
if(seller.activity.length==0){
ph=pw/355*500;
}
let cai_jiu_bao=[]//菜酒包
if(seller.cate.length>0){
cai_jiu_bao.push(seller.cate[0])
}
cai_jiu_bao.push(seller.is_belt_wine==1?'不可带酒水':'可自带酒水');
if(seller.room_num>0){
cai_jiu_bao.push(seller.room_num+'个包间')
}
cai_jiu_bao=cai_jiu_bao.join(' | ')
let tags=['明星老板','湖景餐厅'];
tags=tags.join(' | ')
palette={
background: '#fff',
width: getApp().system.windowWidth+'px',
height: getApp().system.windowHeight+'px',
width: pw+'px',
height: ph+'px',
views: [
{
type:'image',
url:'https://xt04.colorcun.com/sellerShare/Share_'+this.options.id+'.png',
url:this.data.seller.share_image+'?imageView2/1/w/750/h/500/q/100',
css:{
width:getApp().system.windowWidth+'px',
height:(480*(getApp().system.windowWidth/600))+'px',
width:710+'rpx',
height:470+'rpx',
mode:'aspectFill'
}
},
{
type:'text',
text: this.data.seller.sellername,
id:'seller-name',
css:{
fontSize:'36rpx',
color:'#353535',
top:520+'rpx',
left:'30rpx',
fontWeight:'bold',
}
},
{
type:'text',
text: '优选餐厅',
css:{
fontSize:'20rpx',
color:'#ffffff',
top:531+'rpx',
left:['60rpx', 'seller-name', 1] ,
background:'#F57E32',
padding:'2rpx 8rpx',
lineHeight:'28rpx'
}
},
{
type:'text',
text: cai_jiu_bao,
css:{
fontSize:'26rpx',
color:'#999999',
top: '578rpx',
left: '30rpx',
}
},
{
type:'text',
text: tags,
css:{
fontSize:'22rpx',
color:'#C0A369',
top: '638rpx',
left: '42rpx',
background:'#FFEFDF',
lineHeight:'28rpx',
padding:'10rpx 12rpx',
}
},
{
type:'rect',
css:{
color:'#F5F5F5',
top:'694rpx',
left:'30rpx',
width:(pw-30)+'px',
height:'1px'
}
},
/*
{
type:'text',
text: "陕西风味面馆",
css:{
fontSize:'14px',
... ... @@ -130,18 +207,54 @@ Page({
height:'34px'
}
},
*/
{
type: 'image',
url: this.data.qrcode,
css: {
bottom: '48rpx',
right: '48rpx',
width: '192rpx',
height: '192rpx',
bottom: '112rpx',
left: (pw / 2) + 'px',
width: '140rpx',
height: '140rpx',
align: 'center',
},
},
{
type:'text',
text: '长按或扫描二维码,预订、导航',
css:{
fontSize:'22rpx',
color:'#999999',
bottom: '50rpx',
left: (pw / 2) + 'px',
align: 'center',
}
},
],
}
if(seller.cate.length>0){
//活动
}
}else{
palette={
background: '#fff',
width: '400rpx',
height: '400rpx',
views: [
{
type: 'image',
url: this.data.qrcode,
css: {
mode:'scaleToFill',
width: '400rpx',
height: '400rpx',
},
}
],
}
}
this.setData({
palette:palette
})
},
onImgOK(e){
... ... @@ -149,7 +262,7 @@ Page({
wx.getImageInfo({
src:e.detail.path,
success:res=>{
let w=getApp().system.windowWidth
let w=getApp().system.windowWidth-24
console.log('getImageInfo',res)
this.setData({
paletteImageWidth:w,
... ...
... ... @@ -5,11 +5,19 @@
<painter palette="{{palette}}" bind:imgOK="onImgOK" bind:imgErr="onImgOK"/>
</view>
<view wx:if="{{paletteImageSrc}}" class="pages">
<image src="{{paletteImageSrc}}"
<view class="pages-view" wx:if="{{actType=='quanzi'}}">
<image src="{{paletteImageSrc}}"
bindtap="reviewImage"
style="width:{{paletteImageWidth}}px;height:{{paletteImageHeight}}px;"></image>
</view>
<view class="pages-view flex-vc" wx:else="">
<image src="{{paletteImageSrc}}"
bindtap="reviewImage"
style="width:400rpx;height:400rpx; margin-top: 90rpx;"></image>
<view class="qrcode-text">{{seller.sellername}}</view>
</view>
<view class="save">
<savefile>
<savefile filePath="{{paletteImageSrc}}">
<view class="save-but flex-cc">
<view class="save-but-icon"></view>
<view class="save-but-text">保存到相册</view>
... ...
/* pages/reserve/share.wxss */
page{
background-color: #EEF2F2;
}
.pages{
padding-bottom: 160rpx;
width: 100%;
padding-top: 20rpx;
}
.pages-view{
width: calc(100% - 24px);
margin: 0 auto;
background-color: #fefefe;
}
.save{
position: fixed;
bottom: 0;
width: 100%;
}
.save-but{
width: 90%;
width: calc(100% - 24px);
height: 100rpx;
margin: 0 auto 30rpx;
background-color: #C0A369;
... ... @@ -23,4 +36,9 @@
height:40rpx;
line-height: 40rpx;
margin-left: 20rpx;
}
.qrcode-text{
font-size: 34rpx;
margin-top: 40rpx;
margin-bottom: 90rpx;
}
\ No newline at end of file
... ...
... ... @@ -450,10 +450,10 @@
"scene": null
},
{
"id": -1,
"id": 54,
"name": "pages/reserve/share 在线订座 ",
"pathName": "pages/reserve/share",
"query": "id=999&act=quanzi",
"query": "id=1&act=quanzi",
"scene": null
}
]
... ...