Commit 3937354e7a5d87d9c57b5b1462c67ef0fefc8bed

Authored by vking
1 parent 863af818

painter

@@ -14,8 +14,6 @@ Page({ @@ -14,8 +14,6 @@ Page({
14 pagesHeight:'auto', 14 pagesHeight:'auto',
15 current:0, 15 current:0,
16 currentView:1, 16 currentView:1,
17 - paletteImageSrc:'',  
18 - palette:null,  
19 }, 17 },
20 18
21 /** 19 /**
@@ -32,68 +30,6 @@ Page({ @@ -32,68 +30,6 @@ Page({
32 IsCollectionSeller:res.data, 30 IsCollectionSeller:res.data,
33 }) 31 })
34 }) 32 })
35 - wx.request({  
36 - url:'https://cli.im/mina/generate_qrcode',  
37 - data:{  
38 - tpl_id: 25415,  
39 - code_type: 'wxcode',  
40 - 'param_value[0]':80  
41 - },  
42 - success:res=>{  
43 - console.log('cli.im.res:',res.data.data);  
44 - this.setData({  
45 - palette:{  
46 - background: '#fff',  
47 - width: getApp().system.windowWidth+'px',  
48 - height: getApp().system.windowHeight+'px',  
49 - views: [  
50 - {  
51 - type:'image',  
52 - url:'https://xt04.colorcun.com/sellerShare/Share_'+this.options.id+'.png',  
53 - css:{  
54 - width:getApp().system.windowWidth+'px',  
55 - height:(480*(getApp().system.windowWidth/600))+'px',  
56 - mode:'aspectFill'  
57 - }  
58 - },  
59 - {  
60 - type:'text',  
61 - text: "陕西风味面馆",  
62 - css:{  
63 - fontSize:'14px',  
64 - color:'#f00',  
65 - background:'#ff0',  
66 - padding:'8px 20px',  
67 - top:(480*(getApp().system.windowWidth/600)+20)+'px',  
68 - left:'16px',  
69 - lineHeight:'18px'  
70 - }  
71 - },  
72 - {  
73 - type:'rect',  
74 - css:{  
75 - color:'rgba(0,0,0,0.5)',  
76 - top:(480*(getApp().system.windowWidth/600)+12)+'px',  
77 - left:'0px',  
78 - width:'320px',  
79 - height:'34px'  
80 - }  
81 - },  
82 - {  
83 - type: 'image',  
84 - url: res.data.data,  
85 - css: {  
86 - bottom: '48rpx',  
87 - right: '48rpx',  
88 - width: '192rpx',  
89 - height: '192rpx',  
90 - },  
91 - }  
92 - ],  
93 - }  
94 - })  
95 - }  
96 - })  
97 }, 33 },
98 GetSellerDetail(){ 34 GetSellerDetail(){
99 let options=this.options 35 let options=this.options
@@ -8,14 +8,18 @@ Page({ @@ -8,14 +8,18 @@ Page({
8 * 页面的初始数据 8 * 页面的初始数据
9 */ 9 */
10 data: { 10 data: {
11 - 11 + seller:{},
  12 + paletteImageSrc:'',
  13 + palette:null,
  14 + hasLoadData:false,
  15 + act:'',
12 }, 16 },
13 -  
14 /** 17 /**
15 * 生命周期函数--监听页面加载 18 * 生命周期函数--监听页面加载
16 */ 19 */
17 onLoad: function (options) { 20 onLoad: function (options) {
18 - 21 + this.options=options;
  22 + this.GetSellerDetail();
19 }, 23 },
20 24
21 /** 25 /**
@@ -59,11 +63,87 @@ Page({ @@ -59,11 +63,87 @@ Page({
59 onReachBottom: function () { 63 onReachBottom: function () {
60 64
61 }, 65 },
62 - 66 + GetSellerDetail(){
  67 + let options=this.options
  68 + App.Customer.GetSellerDetail({
  69 + sid:options.id,
  70 + }).then(async res=>{
  71 + if(res.ret==200){
  72 + let seller=res.data
  73 + console.log('App',App)
  74 + let qrcode=await App.Other.generate_qrcode({
  75 + tpl_id: 25415,
  76 + code_type: 'wxcode',
  77 + 'param_value[0]':80
  78 + });
  79 + this.setData({
  80 + seller:seller,
  81 + qrcode:qrcode.data,
  82 + hasLoadData:true,
  83 + })
  84 + setTimeout(()=>{
  85 + this.initImage()
  86 + },0);
  87 + }
  88 + })
  89 + },
  90 + initImage(){
  91 + this.setData({
  92 + palette:{
  93 + background: '#fff',
  94 + width: getApp().system.windowWidth+'px',
  95 + height: getApp().system.windowHeight+'px',
  96 + views: [
  97 + {
  98 + type:'image',
  99 + url:'https://xt04.colorcun.com/sellerShare/Share_'+this.options.id+'.png',
  100 + css:{
  101 + width:getApp().system.windowWidth+'px',
  102 + height:(480*(getApp().system.windowWidth/600))+'px',
  103 + mode:'aspectFill'
  104 + }
  105 + },
  106 + {
  107 + type:'text',
  108 + text: "陕西风味面馆",
  109 + css:{
  110 + fontSize:'14px',
  111 + color:'#f00',
  112 + background:'#ff0',
  113 + padding:'8px 20px',
  114 + top:(480*(getApp().system.windowWidth/600)+20)+'px',
  115 + left:'16px',
  116 + lineHeight:'18px'
  117 + }
  118 + },
  119 + {
  120 + type:'rect',
  121 + css:{
  122 + color:'rgba(0,0,0,0.5)',
  123 + top:(480*(getApp().system.windowWidth/600)+12)+'px',
  124 + left:'0px',
  125 + width:'320px',
  126 + height:'34px'
  127 + }
  128 + },
  129 + {
  130 + type: 'image',
  131 + url: this.data.qrcode,
  132 + css: {
  133 + bottom: '48rpx',
  134 + right: '48rpx',
  135 + width: '192rpx',
  136 + height: '192rpx',
  137 + },
  138 + }
  139 + ],
  140 + }
  141 + })
  142 + },
63 onImgOK(e){ 143 onImgOK(e){
64 console.log('onImgOK',e.detail.path) 144 console.log('onImgOK',e.detail.path)
65 this.setData({ 145 this.setData({
66 - paletteImageSrc:e.detail.path 146 + paletteImageSrc:e.detail.path,
67 }) 147 })
68 }, 148 },
69 }) 149 })
1 <!--pages/reserve/share.wxml--> 1 <!--pages/reserve/share.wxml-->
2 <nav>{{true?'分享图':'二维码下载'}}</nav> 2 <nav>{{true?'分享图':'二维码下载'}}</nav>
3 -<view style="position: fixed;top:-9999rpx;" wx:if="{{palette}}"> 3 +<loading wx:if="{{!hasLoadData || !paletteImageSrc}}">图片生成中</loading>
  4 +<view wx:if="{{hasLoadData}}" style="position: fixed;top:-9999rpx;">
4 <painter palette="{{palette}}" bind:imgOK="onImgOK" bind:imgErr="onImgOK"/> 5 <painter palette="{{palette}}" bind:imgOK="onImgOK" bind:imgErr="onImgOK"/>
5 - <painter palette="{{paletteCode}}" bind:imgOK="onImgOKCode" bind:imgErr="onImgOKCode"/>  
6 </view> 6 </view>
  7 +<view wx:if="{{paletteImageSrc}}" class="pages">
  8 + <image src="{{paletteImageSrc}}" style="width:100%;height:999px;"></image>
  9 +</view>
  10 +
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 "list": [] 45 "list": []
46 }, 46 },
47 "miniprogram": { 47 "miniprogram": {
48 - "current": 39, 48 + "current": 54,
49 "list": [ 49 "list": [
50 { 50 {
51 "id": 0, 51 "id": 0,
@@ -448,6 +448,13 @@ @@ -448,6 +448,13 @@
448 "pathName": "pack-book/pages/book/b_desk", 448 "pathName": "pack-book/pages/book/b_desk",
449 "query": "rdate=1559617200-1559631600&tid=0&pnum=6&checked_tids=760,761&rid=", 449 "query": "rdate=1559617200-1559631600&tid=0&pnum=6&checked_tids=760,761&rid=",
450 "scene": null 450 "scene": null
  451 + },
  452 + {
  453 + "id": -1,
  454 + "name": "pages/reserve/share 在线订座 ",
  455 + "pathName": "pages/reserve/share",
  456 + "query": "id=999&act=quanzi",
  457 + "scene": null
451 } 458 }
452 ] 459 ]
453 } 460 }
@@ -249,4 +249,10 @@ export default { @@ -249,4 +249,10 @@ export default {
249 openid:'openid', 249 openid:'openid',
250 cachetime: 60, 250 cachetime: 60,
251 }, 251 },
  252 +
  253 + //获得小程序码
  254 + 'App.Other.generate_qrcode':{
  255 + host: 'https://cli.im/mina/',
  256 + alias:'generate_qrcode'
  257 + }
252 } 258 }