Browse Source

上传

hfll
前端-胡立永 2 months ago
parent
commit
b43e2b4102
2 changed files with 38 additions and 13 deletions
  1. +1
    -5
      manifest.json
  2. +37
    -8
      pages_order/mine/promotion.vue

+ 1
- 5
manifest.json View File

@ -57,11 +57,7 @@
"urlCheck" : false "urlCheck" : false
}, },
"usingComponents" : true, "usingComponents" : true,
"permission" : {
"scope.userFuzzyLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示"
}
},
"permission" : {},
"requiredPrivateInfos" : [ "chooseLocation" ] "requiredPrivateInfos" : [ "chooseLocation" ]
}, },
"mp-alipay" : { "mp-alipay" : {


+ 37
- 8
pages_order/mine/promotion.vue View File

@ -13,11 +13,18 @@
<canvas id="myCanvas" type="2d" canvas-id="firstCanvas1"></canvas> <canvas id="myCanvas" type="2d" canvas-id="firstCanvas1"></canvas>
<view class="btn"
v-if="imagePath"
@click="preservationImg(imagePath)">
保存到相册
</view>
</view> </view>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import index from '../../uni_modules/uv-ui-tools'
export default { export default {
name: 'Promotion', name: 'Promotion',
computed: { computed: {
@ -30,6 +37,7 @@
baseUrl: 'https://image.hhlm1688.com/', baseUrl: 'https://image.hhlm1688.com/',
canvas: {}, canvas: {},
imagePath: '', imagePath: '',
index : 0,
} }
}, },
onShow() { onShow() {
@ -98,6 +106,7 @@
const coderImage = canvas.createImage() const coderImage = canvas.createImage()
coderImage.src = this.baseUrl + this.url coderImage.src = this.baseUrl + this.url
let size = 0;
bgImage.onload = () => { bgImage.onload = () => {
canvas.width = bgImage.width canvas.width = bgImage.width
@ -105,19 +114,24 @@
ctx.drawImage(bgImage, ctx.drawImage(bgImage,
0, 0, bgImage.width, bgImage.height) 0, 0, bgImage.width, bgImage.height)
let size = Math.floor(canvas.width / 3)
coderImage.onload = () => {
ctx.drawImage(coderImage,
canvas.width / 2 - (size / 2), canvas.height * 0.6, size, size)
this.canvasToTempFilePath()
}
size = Math.floor(canvas.width / 3)
this.canvasToTempFilePath()
}
coderImage.onload = () => {
ctx.drawImage(coderImage,
canvas.width / 2 - (size / 2), canvas.height * 0.6, size, size)
this.canvasToTempFilePath()
} }
}) })
}, },
canvasToTempFilePath(){ canvasToTempFilePath(){
this.index++
if(this.index < 2){
return
}
// //
setTimeout(() => { setTimeout(() => {
wx.canvasToTempFilePath({ wx.canvasToTempFilePath({
@ -179,7 +193,7 @@
} }
.image{ .image{
width: 100%; width: 100%;
height: calc(100vh - 200rpx);
height: calc(100vh - 300rpx);
} }
#myCanvas { #myCanvas {
@ -194,4 +208,19 @@
background-color: rgba(255, 255, 255, 1); background-color: rgba(255, 255, 255, 1);
text-align: center; text-align: center;
} }
.btn{
position: fixed;
// top: 58vh;
bottom: 0;
margin: 0;
width: 750rpx;
height: 100rpx;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
background-color: #fff;
color: $uni-color;
}
</style> </style>

Loading…
Cancel
Save