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
},
"usingComponents" : true,
"permission" : {
"scope.userFuzzyLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示"
}
},
"permission" : {},
"requiredPrivateInfos" : [ "chooseLocation" ]
},
"mp-alipay" : {


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

@ -13,11 +13,18 @@
<canvas id="myCanvas" type="2d" canvas-id="firstCanvas1"></canvas>
<view class="btn"
v-if="imagePath"
@click="preservationImg(imagePath)">
保存到相册
</view>
</view>
</template>
<script>
import { mapState } from 'vuex'
import index from '../../uni_modules/uv-ui-tools'
export default {
name: 'Promotion',
computed: {
@ -30,6 +37,7 @@
baseUrl: 'https://image.hhlm1688.com/',
canvas: {},
imagePath: '',
index : 0,
}
},
onShow() {
@ -98,6 +106,7 @@
const coderImage = canvas.createImage()
coderImage.src = this.baseUrl + this.url
let size = 0;
bgImage.onload = () => {
canvas.width = bgImage.width
@ -105,19 +114,24 @@
ctx.drawImage(bgImage,
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(){
this.index++
if(this.index < 2){
return
}
//
setTimeout(() => {
wx.canvasToTempFilePath({
@ -179,7 +193,7 @@
}
.image{
width: 100%;
height: calc(100vh - 200rpx);
height: calc(100vh - 300rpx);
}
#myCanvas {
@ -194,4 +208,19 @@
background-color: rgba(255, 255, 255, 1);
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>

Loading…
Cancel
Save