Commit b862f0cc806a49077672bb0431117fcd0936056e

Authored by vking
1 parent 24a7b019

painter

@@ -7,7 +7,7 @@ Component({ @@ -7,7 +7,7 @@ Component({
7 * 组件的属性列表 7 * 组件的属性列表
8 */ 8 */
9 properties: { 9 properties: {
10 - 10 + filePath:String,
11 }, 11 },
12 12
13 /** 13 /**
@@ -29,11 +29,13 @@ Component({ @@ -29,11 +29,13 @@ Component({
29 * 组件的方法列表 29 * 组件的方法列表
30 */ 30 */
31 methods: { 31 methods: {
32 - saveFile(filePath=''){  
33 - filePath=filePath?filePath:this.data.filePath 32 + saveFile(){
  33 + let filePath=this.data.filePath
  34 + console.log('saveFile.filePath',filePath)
34 wx.saveImageToPhotosAlbum({ 35 wx.saveImageToPhotosAlbum({
35 filePath:filePath, 36 filePath:filePath,
36 - fail:()=>{ 37 + fail:(efail)=>{
  38 + console.log('saveImageToPhotosAlbum.fail',efail)
37 wx.showModal({ 39 wx.showModal({
38 title: '授权提示', 40 title: '授权提示',
39 content: '您拒绝了保存文件,请点击确定打开授权', 41 content: '您拒绝了保存文件,请点击确定打开授权',
@@ -92,23 +92,100 @@ Page({ @@ -92,23 +92,100 @@ Page({
92 }) 92 })
93 }, 93 },
94 initImage(){ 94 initImage(){
95 - this.setData({  
96 - palette:{ 95 + let palette={}
  96 + if(this.options.act=='quanzi'){
  97 + let seller=this.data.seller
  98 + let pw=getApp().system.windowWidth-20;
  99 + let ph=pw/355*558;
  100 + if(seller.activity.length==0){
  101 + ph=pw/355*500;
  102 + }
  103 + let cai_jiu_bao=[]//菜酒包
  104 + if(seller.cate.length>0){
  105 + cai_jiu_bao.push(seller.cate[0])
  106 + }
  107 + cai_jiu_bao.push(seller.is_belt_wine==1?'不可带酒水':'可自带酒水');
  108 + if(seller.room_num>0){
  109 + cai_jiu_bao.push(seller.room_num+'个包间')
  110 + }
  111 + cai_jiu_bao=cai_jiu_bao.join(' | ')
  112 + let tags=['明星老板','湖景餐厅'];
  113 + tags=tags.join(' | ')
  114 + palette={
97 background: '#fff', 115 background: '#fff',
98 - width: getApp().system.windowWidth+'px',  
99 - height: getApp().system.windowHeight+'px', 116 + width: pw+'px',
  117 + height: ph+'px',
100 views: [ 118 views: [
101 { 119 {
102 type:'image', 120 type:'image',
103 - url:'https://xt04.colorcun.com/sellerShare/Share_'+this.options.id+'.png', 121 + url:this.data.seller.share_image+'?imageView2/1/w/750/h/500/q/100',
104 css:{ 122 css:{
105 - width:getApp().system.windowWidth+'px',  
106 - height:(480*(getApp().system.windowWidth/600))+'px', 123 + width:710+'rpx',
  124 + height:470+'rpx',
107 mode:'aspectFill' 125 mode:'aspectFill'
108 } 126 }
109 }, 127 },
110 { 128 {
111 type:'text', 129 type:'text',
  130 + text: this.data.seller.sellername,
  131 + id:'seller-name',
  132 + css:{
  133 + fontSize:'36rpx',
  134 + color:'#353535',
  135 + top:520+'rpx',
  136 + left:'30rpx',
  137 + fontWeight:'bold',
  138 + }
  139 + },
  140 + {
  141 + type:'text',
  142 + text: '优选餐厅',
  143 + css:{
  144 + fontSize:'20rpx',
  145 + color:'#ffffff',
  146 + top:531+'rpx',
  147 + left:['60rpx', 'seller-name', 1] ,
  148 + background:'#F57E32',
  149 + padding:'2rpx 8rpx',
  150 + lineHeight:'28rpx'
  151 + }
  152 + },
  153 + {
  154 + type:'text',
  155 + text: cai_jiu_bao,
  156 + css:{
  157 + fontSize:'26rpx',
  158 + color:'#999999',
  159 + top: '578rpx',
  160 + left: '30rpx',
  161 + }
  162 + },
  163 + {
  164 + type:'text',
  165 + text: tags,
  166 + css:{
  167 + fontSize:'22rpx',
  168 + color:'#C0A369',
  169 + top: '638rpx',
  170 + left: '42rpx',
  171 + background:'#FFEFDF',
  172 + lineHeight:'28rpx',
  173 + padding:'10rpx 12rpx',
  174 + }
  175 + },
  176 + {
  177 + type:'rect',
  178 + css:{
  179 + color:'#F5F5F5',
  180 + top:'694rpx',
  181 + left:'30rpx',
  182 + width:(pw-30)+'px',
  183 + height:'1px'
  184 + }
  185 + },
  186 + /*
  187 + {
  188 + type:'text',
112 text: "陕西风味面馆", 189 text: "陕西风味面馆",
113 css:{ 190 css:{
114 fontSize:'14px', 191 fontSize:'14px',
@@ -130,18 +207,54 @@ Page({ @@ -130,18 +207,54 @@ Page({
130 height:'34px' 207 height:'34px'
131 } 208 }
132 }, 209 },
  210 + */
133 { 211 {
134 type: 'image', 212 type: 'image',
135 url: this.data.qrcode, 213 url: this.data.qrcode,
136 css: { 214 css: {
137 - bottom: '48rpx',  
138 - right: '48rpx',  
139 - width: '192rpx',  
140 - height: '192rpx', 215 + bottom: '112rpx',
  216 + left: (pw / 2) + 'px',
  217 + width: '140rpx',
  218 + height: '140rpx',
  219 + align: 'center',
  220 + },
  221 + },
  222 + {
  223 + type:'text',
  224 + text: '长按或扫描二维码,预订、导航',
  225 + css:{
  226 + fontSize:'22rpx',
  227 + color:'#999999',
  228 + bottom: '50rpx',
  229 + left: (pw / 2) + 'px',
  230 + align: 'center',
  231 + }
  232 + },
  233 + ],
  234 + }
  235 + if(seller.cate.length>0){
  236 + //活动
  237 + }
  238 + }else{
  239 + palette={
  240 + background: '#fff',
  241 + width: '400rpx',
  242 + height: '400rpx',
  243 + views: [
  244 + {
  245 + type: 'image',
  246 + url: this.data.qrcode,
  247 + css: {
  248 + mode:'scaleToFill',
  249 + width: '400rpx',
  250 + height: '400rpx',
141 }, 251 },
142 } 252 }
143 ], 253 ],
144 } 254 }
  255 + }
  256 + this.setData({
  257 + palette:palette
145 }) 258 })
146 }, 259 },
147 onImgOK(e){ 260 onImgOK(e){
@@ -149,7 +262,7 @@ Page({ @@ -149,7 +262,7 @@ Page({
149 wx.getImageInfo({ 262 wx.getImageInfo({
150 src:e.detail.path, 263 src:e.detail.path,
151 success:res=>{ 264 success:res=>{
152 - let w=getApp().system.windowWidth 265 + let w=getApp().system.windowWidth-24
153 console.log('getImageInfo',res) 266 console.log('getImageInfo',res)
154 this.setData({ 267 this.setData({
155 paletteImageWidth:w, 268 paletteImageWidth:w,
@@ -5,11 +5,19 @@ @@ -5,11 +5,19 @@
5 <painter palette="{{palette}}" bind:imgOK="onImgOK" bind:imgErr="onImgOK"/> 5 <painter palette="{{palette}}" bind:imgOK="onImgOK" bind:imgErr="onImgOK"/>
6 </view> 6 </view>
7 <view wx:if="{{paletteImageSrc}}" class="pages"> 7 <view wx:if="{{paletteImageSrc}}" class="pages">
8 - <image src="{{paletteImageSrc}}" 8 + <view class="pages-view" wx:if="{{actType=='quanzi'}}">
  9 + <image src="{{paletteImageSrc}}"
9 bindtap="reviewImage" 10 bindtap="reviewImage"
10 style="width:{{paletteImageWidth}}px;height:{{paletteImageHeight}}px;"></image> 11 style="width:{{paletteImageWidth}}px;height:{{paletteImageHeight}}px;"></image>
  12 + </view>
  13 + <view class="pages-view flex-vc" wx:else="">
  14 + <image src="{{paletteImageSrc}}"
  15 + bindtap="reviewImage"
  16 + style="width:400rpx;height:400rpx; margin-top: 90rpx;"></image>
  17 + <view class="qrcode-text">{{seller.sellername}}</view>
  18 + </view>
11 <view class="save"> 19 <view class="save">
12 - <savefile> 20 + <savefile filePath="{{paletteImageSrc}}">
13 <view class="save-but flex-cc"> 21 <view class="save-but flex-cc">
14 <view class="save-but-icon"></view> 22 <view class="save-but-icon"></view>
15 <view class="save-but-text">保存到相册</view> 23 <view class="save-but-text">保存到相册</view>
1 /* pages/reserve/share.wxss */ 1 /* pages/reserve/share.wxss */
  2 +page{
  3 + background-color: #EEF2F2;
  4 +}
  5 +.pages{
  6 + padding-bottom: 160rpx;
  7 + width: 100%;
  8 + padding-top: 20rpx;
  9 +}
  10 +.pages-view{
  11 + width: calc(100% - 24px);
  12 + margin: 0 auto;
  13 + background-color: #fefefe;
  14 +}
2 .save{ 15 .save{
3 position: fixed; 16 position: fixed;
4 bottom: 0; 17 bottom: 0;
5 width: 100%; 18 width: 100%;
6 } 19 }
7 .save-but{ 20 .save-but{
8 - width: 90%; 21 + width: calc(100% - 24px);
9 height: 100rpx; 22 height: 100rpx;
10 margin: 0 auto 30rpx; 23 margin: 0 auto 30rpx;
11 background-color: #C0A369; 24 background-color: #C0A369;
@@ -23,4 +36,9 @@ @@ -23,4 +36,9 @@
23 height:40rpx; 36 height:40rpx;
24 line-height: 40rpx; 37 line-height: 40rpx;
25 margin-left: 20rpx; 38 margin-left: 20rpx;
  39 +}
  40 +.qrcode-text{
  41 + font-size: 34rpx;
  42 + margin-top: 40rpx;
  43 + margin-bottom: 90rpx;
26 } 44 }
@@ -450,10 +450,10 @@ @@ -450,10 +450,10 @@
450 "scene": null 450 "scene": null
451 }, 451 },
452 { 452 {
453 - "id": -1, 453 + "id": 54,
454 "name": "pages/reserve/share 在线订座 ", 454 "name": "pages/reserve/share 在线订座 ",
455 "pathName": "pages/reserve/share", 455 "pathName": "pages/reserve/share",
456 - "query": "id=999&act=quanzi", 456 + "query": "id=1&act=quanzi",
457 "scene": null 457 "scene": null
458 } 458 }
459 ] 459 ]