Browse Source

1. 新增复制链接

MONSTER-ygh 11 months ago
parent
commit
c0a57c361f
3 changed files with 84 additions and 0 deletions
  1. 8 0
      common/config.js
  2. 18 0
      components/customPromotionCode/customPromotionCode.vue
  3. 58 0
      link.html

+ 8 - 0
common/config.js

@@ -4,18 +4,21 @@
 const node_dev = process.env.H_NODE_ENV;
 // //运行到浏览器用的
 let baseUrl = null // 后端服务接口
+let linkUrl = null // 链接
 let upFileUrl= null // 后端上传接口
 let staticUrl= null // 静态文件地址
 let redirectUri = null
 // 本地
 // #ifdef MP
 	baseUrl='https://greath5.dev.gztjy.top/serviceapi';
+	linkUrl='';
 	upFileUrl='';
 	staticUrl='';
 	redirectUri= 'https://h5.wdzzgs.com/distribution/pages/login/index'
 // #endif
 // #ifdef H5
 	baseUrl='/api';
+	linkUrl='https://greath5.dev.gztjy.top/distributionlink/link.html';
 	upFileUrl='';
 	staticUrl='https://greath5.dev.gztjy.top/distribution/static/';
 	redirectUri= 'https://greath5.dev.gztjy.top/distribution/pages/login/index'
@@ -25,11 +28,13 @@ let redirectUri = null
 if (node_dev =='development') { // 分销测试
  // #ifdef MP
  	baseUrl='';
+	linkUrl='';
  	upFileUrl='';
  	staticUrl='';
  // #endif
  // #ifdef H5
  	baseUrl='https://greath5.dev.gztjy.top/serviceapi';
+	linkUrl='https://greath5.dev.gztjy.top/distributionlink/link.html';
  	upFileUrl='h';
  	staticUrl='https://greath5.dev.gztjy.top/distribution/static/';
 	redirectUri= 'https://greath5.dev.gztjy.top/distribution/pages/login/index'
@@ -38,12 +43,14 @@ if (node_dev =='development') { // 分销测试
 if (node_dev =='production') { // 分销正式
  // #ifdef MP
  	baseUrl='';
+	linkUrl='';
  	upFileUrl='';
  	staticUrl='';
 	redirectUri= 'https://h5.wdzzgs.com/distribution/pages/login/index'
  // #endif
  // #ifdef H5
  	baseUrl='https://h5.wdzzgs.com/serviceapi';
+	linkUrl='https://h5.wdzzgs.com/distributionlink/link.html'
  	upFileUrl='';
  	staticUrl='https://h5.wdzzgs.com/distribution/static/';
 	redirectUri= 'https://h5.wdzzgs.com/distribution/pages/login/index'
@@ -56,6 +63,7 @@ const commonConfig = {
 	appid: 'wx6490eaa0d20d2be2', // 公众号
 	redirectUri: encodeURIComponent(redirectUri), //
 	baseUrl: baseUrl, // 服务器地址
+	linkUrl: linkUrl,
 	uploadFileUrl: upFileUrl, // 上传文件路径
 	staticUrl:staticUrl,
 	paginationConfig:{

+ 18 - 0
components/customPromotionCode/customPromotionCode.vue

@@ -21,6 +21,9 @@
 			<view class="promotion-code-but" @click="saveImage()">
 				保存至相册
 			</view>
+			<view class="promotion-code-but" @click="copyText()">
+				复制链接
+			</view>
 			<view v-if="!posterShow" class="promotion-code-clear" @click="show=false">
 				<u-icon name="close-circle-fill" color="var(--gd-bgm-color)" size="28"></u-icon>
 			</view>
@@ -30,6 +33,7 @@
 
 <script>
 import { nextTick } from "vue"
+import { commonConfig } from '@/common/config.js';
 	export default {
 		data() {
 			return {
@@ -39,6 +43,7 @@ import { nextTick } from "vue"
 				posterShow:false,
 				posterSrc:'',
 				posterSrcType:null,
+				linkText: null,
 				performInfo:{
 					posterImg: 'https://img1.baidu.com/it/u=3302184040,3713353210&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1703178000&t=3902211e35b62703882329c63cf27129',//'../../static/customPromotionCode/bgm1.png', // 剧目背景
 					appletQrcode: 'https://t7.baidu.com/it/u=1127963623,72784497&fm=218&app=126&size=f242,150&n=0&f=JPEG&fmt=auto?s=361C1DC71A5A34D6877C593B0300C002&sec=1703178000&t=cc1d7c4413380f1e8769bae6ac5a66af', // '../../static/customPromotionCode/bgm2.png', // 二维码
@@ -243,6 +248,19 @@ import { nextTick } from "vue"
 					}
 				});
 			},
+		
+			copyText() {
+			    uni.setClipboardData({
+			        data: commonConfig.linkUrl + '?personsId='+this.distribution_user_info.userId,
+			        success: function () {
+			          uni.showToast({
+			            title: '复制成功',
+			            icon: 'success',
+			            duration: 2000
+			          });
+			        }
+			    });
+			}
 		}
 	}
 </script>

+ 58 - 0
link.html

@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html lang="zh">
+<head>
+	<meta charset="UTF-8">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+	<title>Document</title>
+	<style>
+		#info {
+			width: 100%;
+		}
+		#code {
+			width: 100%;
+			display: flex;
+			justify-content: center;
+			align-items: center;
+		}
+		#code_img {
+			width: 80px;
+			height: 80px;
+		}
+	</style>
+</head>
+<body>
+	<div id="info">
+		
+	</div>
+	<div id='code'>
+		<img id='code_img' src="" alt="" />
+	</div>
+	<script>
+		getCodeInfo()
+		function getCodeInfo() {
+			let urlObj = new URL(window.location.href);
+			let protocol = urlObj.protocol; // 获取协议
+			let host = urlObj.host; // 获取主机部分(包括端口)
+			let hostname = urlObj.hostname; // 获取主机名部分
+			let port = urlObj.port; // 获取端口
+			let pathname = urlObj.pathname; // 获取路径
+			let search = urlObj.search; // 获取查询参数部分
+			console.log("获取地址===",urlObj)
+			let request = new XMLHttpRequest();
+			let url = origin + '/serviceapi/member/marketPersons/getShareRetailQrcode'+search
+			request.open('GET', url, true);
+			request.setRequestHeader('Content-Type', 'application/json;charset=utf-8');
+			request.onreadystatechange = function() {
+			    if (request.readyState === 4 && request.status === 200) {
+			        let data = JSON.parse(request.responseText);
+			        // 处理数据
+					console.log("data=====",data)
+					document.getElementById('info').innerHTML = data.data.posterContent?data.data.posterContent:'暂无内容'
+					document.getElementById('code_img').src = data.data.url
+			    }
+			};
+			request.send();
+		}
+	</script>
+</body>
+</html>