增加分销二维码邀请
This commit is contained in:
@@ -38,10 +38,39 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
|
||||||
import ymfShare from '@/components/ymf-components/ymf-share.vue';
|
import ymfShare from '@/components/ymf-components/ymf-share.vue';
|
||||||
import wQrcode from '@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue';
|
import wQrcode from '@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue';
|
||||||
import { desensitizePhone } from '@/utils/util.js';
|
import { desensitizePhone } from '@/utils/util.js';
|
||||||
import { ref } from 'vue';
|
import { ref, onMounted, nextTick } from 'vue';
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
setTimeout(async () => {
|
||||||
|
await nextTick();
|
||||||
|
const query = await returnQuery();
|
||||||
|
codeOptions.value.code = `https://cashier.sxczgkj.com/invite?${removeQAndAfter(query)}`;
|
||||||
|
console.log('codeOptions.value', codeOptions.value);
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 截取字符串,移除 &q 及后面的所有内容
|
||||||
|
* @param {string} str - 原始字符串
|
||||||
|
* @returns {string} 处理后的字符串
|
||||||
|
*/
|
||||||
|
function removeQAndAfter(str) {
|
||||||
|
// 检查是否为空字符串
|
||||||
|
if (!str || typeof str !== 'string') {
|
||||||
|
return str || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 找到 &q 的起始位置
|
||||||
|
const qIndex = str.indexOf('&q');
|
||||||
|
|
||||||
|
// 如果找到 &q,截取前面的部分;否则返回原字符串
|
||||||
|
return qIndex !== -1 ? str.slice(0, qIndex) : str;
|
||||||
|
}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
inviteCode: {
|
inviteCode: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -52,10 +81,13 @@ const props = defineProps({
|
|||||||
default: () => {}
|
default: () => {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const codeOptions = ref({
|
const codeOptions = ref({
|
||||||
|
padding: 10,
|
||||||
size: 200,
|
size: 200,
|
||||||
code: props.inviteCode
|
code: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
function copyCode() {
|
function copyCode() {
|
||||||
uni.setClipboardData({
|
uni.setClipboardData({
|
||||||
data: props.inviteCode,
|
data: props.inviteCode,
|
||||||
|
|||||||
@@ -497,12 +497,13 @@ onShareAppMessage(async (res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onLoad(async (opt) => {
|
onLoad(async (opt) => {
|
||||||
await handleMixinOnLoad(opt);
|
|
||||||
if (opt.q) {
|
if (opt.q) {
|
||||||
const q = decodeURIComponent(opt.q);
|
const q = decodeURIComponent(opt.q);
|
||||||
const params = parseQueryString(q.split('?')[1]);
|
const params = parseQueryString(q.split('?')[1]);
|
||||||
|
await handleMixinOnLoad(params);
|
||||||
Object.assign(options, params);
|
Object.assign(options, params);
|
||||||
} else {
|
} else {
|
||||||
|
await handleMixinOnLoad(opt);
|
||||||
Object.assign(options, opt);
|
Object.assign(options, opt);
|
||||||
}
|
}
|
||||||
console.log(options);
|
console.log(options);
|
||||||
|
|||||||
Reference in New Issue
Block a user