|
|
@@ -0,0 +1,108 @@
|
|
|
+<template>
|
|
|
+ <view class="app-content">
|
|
|
+ <view class="img_box">
|
|
|
+ <image :src="imgUrl" mode="heightFix" class="img_url"></image>
|
|
|
+ </view>
|
|
|
+ <view style="margin:50upx 0 0 30upx;font-size:30upx;">保存图片到手机,可分享或打印张贴</view>
|
|
|
+ <view class="confirm-btn">
|
|
|
+ <button class="admin-button-com big blue" @click="downloadImg">保存图片</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ <script>
|
|
|
+ import { getRechargeCode } from '@/api/recharge'
|
|
|
+ import { getWeixinId } from "@/api/invite";
|
|
|
+ import { mapGetters } from "vuex";
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ imgUrl: '',
|
|
|
+ getappIdList: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({ loginInfo: "getLoginInfo" })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ this.getImg()
|
|
|
+ getWeixinId().then(res => {
|
|
|
+ this.getappIdList = res.data
|
|
|
+ });
|
|
|
+ },
|
|
|
+ downloadImg(){
|
|
|
+ let that = this
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ let platformType = uni.getSystemInfoSync().platform
|
|
|
+ if(platformType == 'android'){
|
|
|
+ let store = plus.navigator.checkPermission('android.permission.READ_EXTERNAL_STORAGE')
|
|
|
+ if(store != 'authorized'){
|
|
|
+ this.$util.confirmModal({content:'将申请您的存储权限,用于保存小程序码'},() => {
|
|
|
+ this.downloadImg2()
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.downloadImg2()
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.downloadImg2()
|
|
|
+ }
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ this.downloadImg2()
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ downloadImg2(){
|
|
|
+ uni.downloadFile({
|
|
|
+ url: this.imgUrl,
|
|
|
+ success: (res) => {
|
|
|
+ if (res.statusCode === 200) {
|
|
|
+ console.log(res)
|
|
|
+ uni.saveImageToPhotosAlbum({
|
|
|
+ filePath: res.tempFilePath,
|
|
|
+ success: function (data) {
|
|
|
+ console.log(data)
|
|
|
+ uni.showToast({title:'下载成功!'})
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getImg() {
|
|
|
+ getRechargeCode().then(res => {
|
|
|
+ this.imgUrl = res.data.imgUrl
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ <style lang="scss" scoped>
|
|
|
+ .app-content{
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ .img_box{
|
|
|
+ height: 450upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ &>.img_url{
|
|
|
+ height: 450upx;
|
|
|
+ width: auto;
|
|
|
+ margin: 100upx auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 按钮
|
|
|
+ .confirm-btn {
|
|
|
+ width: calc(100% - 60upx);
|
|
|
+ margin: 30upx 30upx 20upx;
|
|
|
+ .admin-button-com {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 按钮
|
|
|
+ .confirm-btn1 {
|
|
|
+ width: calc(100% - 60upx);
|
|
|
+ margin: 30upx 30upx 20upx;
|
|
|
+ .admin-button-com {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </style>
|