123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- <template>
- <view>
- <uni-popup-ori ref="showshare" type="bottom">
- <view class="uni-share">
- <text class="uni-share-title">分享到</text>
- <view class="uni-share-content">
- <view v-for="(item, index) in bottomData" :key="index" class="uni-share-content-box" @click="shareTo(item.name)">
- <view class="uni-share-content-image"><image :src="item.icon" class="content-image" mode="widthFix" /></view>
- <text class="uni-share-content-text">{{ item.text }}</text>
- </view>
- </view>
- <text class="uni-share-btn" @click="cancel()">取消分享</text>
- </view>
- </uni-popup-ori>
- <uni-popup-ori ref="showPast" type="center" class="popupPast">
- <view class="backPop">
- <view class="popPast">
- <view class="popTitle">口令已复制</view>
- <view class="popContent">
- <view>{{ describe }}</view>
- </view>
- <view class="popBtn" @click="goWhere(1)" v-if="popType == 'wx'">
- <!-- <image src="../../static/spend/wxin.png" mode="widthFix"></image> -->
- <view>去微信粘贴给好友</view>
- </view>
- <view class="popBtn" @click="goWhere(2)" v-if="popType == 'timeline'">
- <!-- <image src="../../static/spend/wechat.png" mode="widthFix"></image> -->
- <view>粘贴到朋友圈</view>
- </view>
- </view>
- <icon type="cancel" size="26" color="white" style="margin-top: 40rpx;" @click="cancelPo" />
- </view>
- </uni-popup-ori>
- </view>
- </template>
- <script>
- import uniPopupOri from '@/components/uni-popup/uni-popup-ori.vue';
- import { mapState, mapMutations } from 'vuex';
- import { getActionPage } from '@/utils/loginUtils.js';
- export default {
- name: 'SharePopup',
- components: {
- uniPopupOri
- },
- props: ['opt', 'type','option'],
- data() {
- return {
- describe: '',
- shareoption: '',
- bottomData: [
- {
- text: '微信',
- icon: '../../static/spend/wxin.png',
- name: 'wx'
- },
- {
- text: '朋友圈',
- icon: '../../static/spend/wechat.png',
- name: 'timeline'
- }
- ],
- popType: '',
- uid: ''
- };
- },
- computed: {
- ...mapState(['userInfo', 'baseURL'])
- },
- mounted() {},
- methods: {
- loadData() {
- try {
- let prePage = getActionPage();
- var path = prePage.route;
- this.uid = this.userInfo.uid;
- //获取object转化成
- var parm = '';
- var i = 0;
- var option = this.option; //其他页面传值
- console.log(option,'option')
- if(this.type == 4){
- parm = parm + '?' + 'promo_code=' + option;
- }else{
- for (let item in option) {
- //拼接参数
- if (i == 0) {
- parm = '?' + item + '=' + option[item];
- } else {
- parm = parm + '&' + item + '=' + option[item];
- }
- i++;
- }
- }
- if(this.type == 4){
- var url = 'pages/index/index' + parm;
- }else{
- var url = path + parm;
- }
- console.log(path,'path')
- console.log(parm,'parm')
- //用后台加密
- //第一个参数是判断是不是我们的链接
- //第二个参数是访问地址
- //第三个参数是,类型,type:0商品,type=1拼团,type=2邀请注册,type=3邀请好友参团,type=4邀请好友助力
- //第四个参数是share的id
- console.log(option,'option')
- if(this.type == 4){
- this.describe = this.baseURL + '@' + url + '@' + this.type + '@' + this.uid + '@复制这段话进入美美赚,自动打开页面';
- }else{
- this.describe = this.baseURL + '@' + url + '@' + this.type + '@' + this.uid + '@复制这段话进入美美赚,自动打开页面';
- }
- console.log(this.describe);
- let obj = this;
- // #ifndef H5
- uni.setClipboardData({
- data: this.describe,
- success: function () {
- uni.hideToast();
- }
- });
- // #endif
- } catch (e) {
- console.log(e);
- //TODO handle the exception
- }
- },
- goWhere(type) {
- this.$api.msg('复制成功');
- },
- cancelPo() {
- this.$nextTick(() => {
- this.$refs['showPast'].close();
- });
- },
- shareTo(name) {
- this.popType = name;
- this.$nextTick(() => {
- this.$refs.showPast.open();
- this.$refs['showshare'].close();
- });
- },
- cancel() {
- this.$nextTick(() => {
- this.$refs['showshare'].close();
- });
- },
- open() {
- this.$nextTick(() => {
- this.$refs['showshare'].open();
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .backPop {
- padding: 0rpx 25rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- .popupPast {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- text-align: center;
- }
- .popPast {
- display: flex;
- flex-direction: column;
- justify-content: center;
- padding: 40rpx 30rpx;
- width: 90%;
- background-color: white;
- border-radius: 18rpx;
- align-items: center;
- .popTitle {
- color: #2f2f2f;
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 40rpx;
- }
- .popContent {
- background-color: #f4f4f4;
- padding: 30rpx 24rpx;
- border-radius: 16rpx;
- view {
- font-size: 24rpx;
- color: #939393;
- }
- margin-bottom: 40rpx;
- }
- .popBtn {
- display: flex;
- align-items: center;
- padding: 20rpx 40rpx;
- background-color: #04be02;
- border-radius: 60rpx;
- image {
- width: 36rpx;
- }
- view {
- color: white;
- font-size: 36rpx;
- margin-left: 10rpx;
- }
- }
- }
- /* 底部分享 */
- .uni-share {
- /* #ifndef APP-NVUE */
- display: flex;
- flex-direction: column;
- /* #endif */
- background-color: #fff;
- }
- .uni-share-title {
- line-height: 60rpx;
- font-size: 24rpx;
- padding: 15rpx 0;
- text-align: center;
- }
- .uni-share-content {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: center;
- padding: 15px;
- }
- .uni-share-content-box {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: column;
- align-items: center;
- width: 200rpx;
- }
- .uni-share-content-image {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- justify-content: center;
- align-items: center;
- width: 60rpx;
- height: 60rpx;
- overflow: hidden;
- border-radius: 10rpx;
- }
- .content-image {
- width: 60rpx;
- height: 60rpx;
- }
- .uni-share-content-text {
- font-size: 26rpx;
- color: #333;
- padding-top: 5px;
- padding-bottom: 10px;
- }
- .uni-share-btn {
- height: 90rpx;
- line-height: 90rpx;
- font-size: 14px;
- border-top-color: #f5f5f5;
- border-top-width: 1px;
- border-top-style: solid;
- text-align: center;
- color: #666;
- }
- </style>
|