|
@@ -0,0 +1,282 @@
|
|
|
+<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>
|