Commit 24a7b0191b8600519d7f65cedca4d107ff5f13a3

Authored by vking
1 parent 3937354e

painter

... ... @@ -12,16 +12,15 @@
width: 140rpx;
height: 140rpx;
background-size: 100% 100%;
background-color: #cccccc;
}
.share-img.wechat{
background-image: url("http://");
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201906251004331.png");
}
.share-img.quanzi{
background-image: url("http://");
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190625100433.png");
}
.share-img.qrcode{
background-image: url("http://");
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201906251004332.png");
}
.share-name{
margin-top: 20rpx;
... ...
// component/menu/addDelete.js
import util from '../../utils/util';
import App from '../../utils/api';
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
attached(){
},
ready () {
},
detached(){
},
/**
* 组件的方法列表
*/
methods: {
saveFile(filePath=''){
filePath=filePath?filePath:this.data.filePath
wx.saveImageToPhotosAlbum({
filePath:filePath,
fail:()=>{
wx.showModal({
title: '授权提示',
content: '您拒绝了保存文件,请点击确定打开授权',
confirmColor: '#199095',
cancelColor: '#999',
success: function (res) {
if (res.confirm) {
util.setting();
}
}
})
},
})
},
}
})
... ...
{
"component": true,
"usingComponents": {
"formids": "/components/formids/formids"
}
}
\ No newline at end of file
... ...
<formids bindclick="saveFile" style="width: 100%;">
<slot></slot>
</formids>
\ No newline at end of file
... ...
@import "../../app.wxss";
\ No newline at end of file
... ...
... ... @@ -13,12 +13,16 @@ Page({
palette:null,
hasLoadData:false,
act:'',
hasActName:'',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.options=options;
this.setData({
actType:options.act
})
this.GetSellerDetail();
},
... ... @@ -142,8 +146,22 @@ Page({
},
onImgOK(e){
console.log('onImgOK',e.detail.path)
this.setData({
paletteImageSrc:e.detail.path,
wx.getImageInfo({
src:e.detail.path,
success:res=>{
let w=getApp().system.windowWidth
console.log('getImageInfo',res)
this.setData({
paletteImageWidth:w,
paletteImageHeight:w/res.width*res.height,
paletteImageSrc:e.detail.path,
})
}
})
},
reviewImage(){
wx.previewImage({
urls:[this.data.paletteImageSrc],
})
}
})
\ No newline at end of file
... ...
{
"usingComponents": {
"nav":"/components/nav/nav",
"painter":"/components/painter/painter"
"painter":"/components/painter/painter",
"savefile":"/components/userinfo/savefile"
}
}
... ...
<!--pages/reserve/share.wxml-->
<nav>{{true?'分享图':'二维码下载'}}</nav>
<nav>{{actType=='quanzi'?'分享图':'二维码下载'}}</nav>
<loading wx:if="{{!hasLoadData || !paletteImageSrc}}">图片生成中</loading>
<view wx:if="{{hasLoadData}}" style="position: fixed;top:-9999rpx;">
<painter palette="{{palette}}" bind:imgOK="onImgOK" bind:imgErr="onImgOK"/>
</view>
<view wx:if="{{paletteImageSrc}}" class="pages">
<image src="{{paletteImageSrc}}" style="width:100%;height:999px;"></image>
<image src="{{paletteImageSrc}}"
bindtap="reviewImage"
style="width:{{paletteImageWidth}}px;height:{{paletteImageHeight}}px;"></image>
<view class="save">
<savefile>
<view class="save-but flex-cc">
<view class="save-but-icon"></view>
<view class="save-but-text">保存到相册</view>
</view>
</savefile>
</view>
</view>
... ...
/* pages/reserve/share.wxss */
\ No newline at end of file
/* pages/reserve/share.wxss */
.save{
position: fixed;
bottom: 0;
width: 100%;
}
.save-but{
width: 90%;
height: 100rpx;
margin: 0 auto 30rpx;
background-color: #C0A369;
font-size: 32rpx;
color: #fefefe;
border-radius: 10rpx;
}
.save-but-icon{
width: 40rpx;
height: 40rpx;
background-size: 100% 100%;
background-image: url("http://qn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201906251004333.png");
}
.save-but-text{
height:40rpx;
line-height: 40rpx;
margin-left: 20rpx;
}
\ No newline at end of file
... ...