123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- <template>
- <view class="andr-shQ-padL30 andr-shQ-padR30 andr-shQ-Flex andr-shQ-FlexDirC">
- <view class="andr-shQ-w100B andr-shQ-Flex andr-shQ-JusCC">
- <swiper class="imgw750h375 matop" :indicator-dots="false" :current="current" @change="currentChange">
-
- <swiper-item v-for="(item, index) in rwmListArr" :key="index">
- <image :src="item.wap_poster" mode="aspectFit" class="imgw750h375" />
- </swiper-item>
-
-
- <swiper-item v-for="(item, index) in rwmListArr" :key="index">
- <image :src="item.poster" mode="aspectFit" class="imgw750h375" />
- </swiper-item>
-
- </swiper>
- </view>
-
-
-
-
-
- <view class="baocun" @click="seav">保存分享海报</view>
-
-
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- import {
- spreadBanner
- } from '@/api/user.js';
- import {
- interceptor,
- saveUrl
- } from '@/utils/loginUtils';
-
- import {
- weixindata
- } from '@/utils/wxAuthorized';
-
- export default {
- data() {
- return {
- rwmListArr: [],
- current: 0,
- imgSrc: ''
- };
- },
- onLoad(option) {
- uni.showLoading({
- title: '邀请图生成中',
- mask: true
- });
-
- this.loadCodeList();
-
- uni.authorize({
- scope: 'scope.writePhotosAlbum',
- complete() {}
- });
-
- },
- onShow() {
- if (this.loginInterceptor && !this.hasLogin) {
- saveUrl();
-
- interceptor();
- }
- },
-
- onPullDownRefresh() {
- let obj = this;
-
- setTimeout(function() {
- obj.loadCodeList();
- uni.stopPullDownRefresh();
- }, 1000);
- },
- computed: {
- ...mapState(['weichatObj', 'baseURL', 'urlFile']),
- ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
- },
- methods: {
- comfirm(text) {
-
- console.log(text);
- const result = this.uniCopy(text);
- if (result === false) {
- uni.showToast({
- title: '不支持'
- });
- } else {
- uni.showToast({
- title: '复制成功',
- icon: 'none'
- });
- }
-
- },
- uniCopy(content) {
-
-
- uni.setClipboardData({
- data: content,
- success: function() {
- console.log('success');
- return true;
- }
- });
-
-
-
- if (!document.queryCommandSupported('copy')) {
-
-
- return false;
- }
- let textarea = document.createElement('textarea');
- textarea.value = content;
- textarea.readOnly = 'readOnly';
- document.body.appendChild(textarea);
- textarea.select();
- textarea.setSelectionRange(0, content.length);
- let result = document.execCommand('copy');
- textarea.remove();
- return result;
-
- },
- loadCodeList() {
- let self = this;
-
-
- spreadBanner({
-
- type: 2,
-
-
- type: 1,
-
- }).then(e => {
- if (e.status == 200) {
- console.log(e.data)
- self.rwmListArr = e.data;
-
- self.imgSrc = self.rwmListArr[0].wap_poster;
-
-
- self.imgSrc = self.rwmListArr[0].poster;
-
- }
- uni.hideLoading();
- });
- },
- currentChange(e) {
- this.current = e.detail.current;
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- seav() {
- uni.getImageInfo({
- src: this.imgSrc,
- complete: function(result) {
- let path = result.path;
- uni.getSetting({
- success(res) {
- console.log(res)
- if (!res.authSetting['scope.writePhotosAlbum']) {
- uni.authorize({
- scope: 'scope.writePhotosAlbum',
- success(res) {
- uni.saveImageToPhotosAlbum({
- filePath: path,
- complete(result) {}
- });
- },
- complete(result) {
- uni.showToast({
- title: '请先授权保存图片',
- duration: 2000,
- icon: 'none'
- });
- obj.seav();
- }
- })
- } else {
- uni.saveImageToPhotosAlbum({
- filePath: path,
- complete(result) {
- uni.showToast({
- title: '保存图片成功!',
- duration: 2000,
- icon: 'none'
- });
- }
- });
- }
- }
- });
- }
- });
- }
-
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100%;
- }
- .imgw750h375 {
- width: 100%;
- height: 958rpx;
- }
- .matop {
- // margin-top: 40rpx;
- }
- .andr-shQ-padL30 {
- // padding-left: 30rpx;
- }
- .andr-shQ-padR30 {
- // padding-right: 30rpx;
- }
- .andr-shQ-Flex {
- // display: flex;
- }
- .andr-shQ-FlexDirC {
- flex-direction: column;
- }
- .andr-shQ-w100B {
- // width: 100%;
- }
- .andr-shQ-JusCC {
- justify-content: center;
- }
- .andr-shQ-marginT30 {
- // margin-top: 30rpx;
- }
- .andr-shQ-bgc06B163 {
- background-color: $base-color;
- }
- .andr-shQ-cFFF {
- color: #ffffff;
- }
- .andr-shQ-bdR50 {
- border-radius: 50rpx;
- }
- .andr-shQ-h86 {
- height: 86rpx;
- }
- .andr-shQ-AIC {
- align-items: center;
- }
- .baocun {
- color: #ffffff;
- background: $base-color;
- text-align: center;
- width: 80%;
- margin: 50rpx auto;
- font-size: 28rpx;
- padding: 25rpx 0rpx;
- border-radius: 50rpx;
- }
- .btn {
- padding: 0rpx 0rpx !important;
- margin: 0rpx auto;
- margin-bottom: 100rpx;
- }
- /* #ifdef H5 */
- .cbnagan {
- width: 80%;
- background: $base-color;
- margin: 50rpx auto;
- font-size: 28rpx;
- text-align: center;
- }
- /* #endif */
- </style>
|