|
@@ -0,0 +1,181 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <view class="app-content">
|
|
|
|
|
+
|
|
|
|
|
+ <view class="img_box" style="margin-top:30upx;">
|
|
|
|
|
+ <image :src="albumUrl" mode="heightFix" class="img_url"></image>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view style="margin:20upx auto 20upx auto;width:50vw;font-size:35upx;font-weight:bold;text-align:center;">相册</view>
|
|
|
|
|
+ <div class="confirm-btn">
|
|
|
|
|
+ <button class="admin-button-com big blue" style="width:60vw;" @click="downloadImg(albumUrl)">保存图片</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="confirm-btn1">
|
|
|
|
|
+ <button class="admin-button-com big" style="width:60vw;" @click="goToMallPt('pages/home/mall')">直接打开</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <view class="confirm-btn1" style="margin-top:100upx;">
|
|
|
|
|
+ <button class="admin-button-com big" style="width:60vw;" @click="copyLink">复制链接</button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ </view>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+import { mainGetAlbumPoster } from '@/api/main'
|
|
|
|
|
+import { getWeixinId } from "@/api/invite";
|
|
|
|
|
+import { mapGetters } from "vuex";
|
|
|
|
|
+export default {
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ albumUrl:'',
|
|
|
|
|
+ albumLink:'',
|
|
|
|
|
+ getappIdList: {}
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ ...mapGetters({ loginInfo: "getLoginInfo",dictInfo:"getDictionariesInfo" })
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ copyLink() {
|
|
|
|
|
+ let text = "点击下面链接,打开相册\n\n"+this.albumLink+"\n\n链接是我们小程序,放心点击"
|
|
|
|
|
+ uni.setClipboardData({
|
|
|
|
|
+ data: text,
|
|
|
|
|
+ success: () => {
|
|
|
|
|
+ this.$msg('已复制')
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: () => {
|
|
|
|
|
+ this.$msg('复制失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ init() {
|
|
|
|
|
+ this.getImg()
|
|
|
|
|
+ getWeixinId().then(res => {
|
|
|
|
|
+ this.getappIdList = res.data
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ downloadImg(url){
|
|
|
|
|
+ // #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(url)
|
|
|
|
|
+ })
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.downloadImg2(url)
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.downloadImg2(url)
|
|
|
|
|
+ }
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ this.downloadImg2(url)
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ },
|
|
|
|
|
+ downloadImg2(url){
|
|
|
|
|
+ uni.downloadFile({
|
|
|
|
|
+ url: url,
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ if (res.statusCode === 200) {
|
|
|
|
|
+ uni.saveImageToPhotosAlbum({
|
|
|
|
|
+ filePath: res.tempFilePath,
|
|
|
|
|
+ success: function (data) {
|
|
|
|
|
+ uni.showToast({title:'下载成功!'})
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ getImg() {
|
|
|
|
|
+ mainGetAlbumPoster().then(res => {
|
|
|
|
|
+ this.albumUrl = res.data.albumUrl
|
|
|
|
|
+ this.albumLink = res.data.albumLink
|
|
|
|
|
+ }).catch(err => {})
|
|
|
|
|
+ },
|
|
|
|
|
+ goToMallPt (url) {
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ let self = this
|
|
|
|
|
+ uni.navigateToMiniProgram({
|
|
|
|
|
+ appId: this.getappIdList.mall.miniAppId,
|
|
|
|
|
+ path: url + '?account=' + self.loginInfo.shopId,
|
|
|
|
|
+ //develop 开发版 trial 体验版 release 正式版
|
|
|
|
|
+ envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
|
|
|
|
|
+ extraData: {
|
|
|
|
|
+ 'hdShopAdminId': self.loginInfo.shopAdminId
|
|
|
|
|
+ },
|
|
|
|
|
+ success (res) {}
|
|
|
|
|
+ })
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ // #ifdef APP-PLUS
|
|
|
|
|
+ let that = this
|
|
|
|
|
+
|
|
|
|
|
+ if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
|
|
|
|
|
+ plus.share.getServices(function(s){
|
|
|
|
|
+ var sweixin
|
|
|
|
|
+ for (var i = 0; i < s.length; i++) {
|
|
|
|
|
+ var t = s[i];
|
|
|
|
|
+ if (t.id == 'weixin') {
|
|
|
|
|
+ sweixin = t;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sweixin && sweixin.nativeClient) {
|
|
|
|
|
+ let miniOriginalId = that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.mall ? that.dictInfo.miniOriginalId.current.mall : ''
|
|
|
|
|
+ console.log(miniOriginalId)
|
|
|
|
|
+ sweixin.launchMiniProgram({
|
|
|
|
|
+ id: miniOriginalId,
|
|
|
|
|
+ path: '/'+url+'?account='+that.loginInfo.shopId,
|
|
|
|
|
+ type: 0
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$msg("没有找到微信服务")
|
|
|
|
|
+ //that.$msg("获取微信失败:" + e.message)
|
|
|
|
|
+ console.log(JSON.stringify(e));
|
|
|
|
|
+ }
|
|
|
|
|
+ }, function(e){
|
|
|
|
|
+ that.$msg("没有找到微信服务哦")
|
|
|
|
|
+ //that.$msg("获取微信失败:" + e.message)
|
|
|
|
|
+ console.log(JSON.stringify(e));
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$msg("即将跳转小程序,请安装微信")
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.app-content{
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+}
|
|
|
|
|
+.img_box{
|
|
|
|
|
+ height:400upx;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ &>.img_url{
|
|
|
|
|
+ height:400upx;
|
|
|
|
|
+ width: auto;
|
|
|
|
|
+ margin: 20upx auto;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+// 按钮
|
|
|
|
|
+.confirm-btn {
|
|
|
|
|
+ width: calc(100% - 60upx);
|
|
|
|
|
+ margin: 30upx 30upx 20upx;
|
|
|
|
|
+ text-align:center;
|
|
|
|
|
+ .admin-button-com {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+// 按钮
|
|
|
|
|
+.confirm-btn1 {
|
|
|
|
|
+ width: calc(100% - 60upx);
|
|
|
|
|
+ margin: 30upx 30upx 20upx;
|
|
|
|
|
+ text-align:center;
|
|
|
|
|
+ .admin-button-com {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|