裂变星小程序-25.03.04
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

96 lines
2.1 KiB

<template>
<view class="page">
<navbar title="分享好友" leftClick @leftClick="$utils.navigateBack" />
<view class="flex content">
<image class="bg" :src="imgurl"></image>
<view class="flex btns">
<button class="btn btn-back" @click="$utils.navigateBack">返回</button>
<button plain class="btn btn-save" @click="saveImg" >保存到相册</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
imgurl: null,
}
},
onLoad() {
// todo: fetch imgurl
this.imgurl = 'https://thumbnail0.baidupcs.com/thumbnail/e197d6114s94f565050bdb6183d0f342?fid=3983569511-250528-62736802919901&time=1742544000&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-SVTG9Opgq1cgWFL%2Fl97Up9GXZgo%3D&expires=8h&chkv=0&chkbd=0&chkpc=&dp-logid=8765779362428703473&dp-callid=0&file_type=0&size=c850_u580&quality=100&vuk=-&ft=video'
},
methods: {
saveImg(){
this.$authorize('scope.writePhotosAlbum').then((res) => {
this.imgApi(this.imgurl)
})
},
imgApi(image) {
/* 获取图片的信息 */
uni.getImageInfo({
src: image,
success: function(image) {
/* 保存图片到手机相册 */
uni.saveImageToPhotosAlbum({
filePath: image.path,
success: function() {
uni.showModal({
title: '保存成功',
content: '图片已成功保存到相册',
showCancel: false
});
},
complete(res) {
console.log(res);
}
});
}
});
},
},
}
</script>
<style scoped lang="scss">
.page {
background-color: #111317;
height: 100vh;
}
.content {
margin-top: 79rpx;
flex-direction: column;
}
.bg {
width: 598rpx;
height: 1063rpx;
}
.btns {
justify-content: space-between;
margin-top: 53rpx;
width: 598rpx;
}
.btn {
width: 280rpx;
height: 90rpx;
font-size: 36rpx;
color: #FFFFFF;
border-radius: 45rpx;
margin: 0;
&-back {
background-color: #4E5053;
}
&-save {
background-image: linear-gradient(to right, #02DED6, #05D9A2);
}
}
</style>