提交 1afeb6e9 作者: 施汉文

新增异步对话框组件及相关逻辑,支持高风险用户确认发送操作

上级 01abd744
import Vue from 'vue'
import AsyncDialog from './index.vue'
let instance = null
let mountNode = null
function createInstance() {
if (instance && !instance._isDestroyed) {
return instance
}
const ComponentConstructor = Vue.extend(AsyncDialog)
mountNode = document.createElement('div')
document.body.appendChild(mountNode)
instance = new ComponentConstructor()
instance.$mount(mountNode)
return instance
}
export function getAsyncDialogInstance() {
return createInstance()
}
export function openAsyncDialog(options = {}) {
return createInstance().open(options)
}
export function closeAsyncDialog(action = 'close') {
if (!instance || instance._isDestroyed) {
return
}
instance.close(action)
}
export function destroyAsyncDialog() {
if (!instance) {
return
}
instance.$destroy()
if (instance.$el && instance.$el.parentNode) {
instance.$el.parentNode.removeChild(instance.$el)
}
if (mountNode && mountNode.parentNode) {
mountNode.parentNode.removeChild(mountNode)
}
instance = null
mountNode = null
}
export default openAsyncDialog
......@@ -463,6 +463,7 @@ import {
getLandingPageConfig,
getMemberTransStatus,
memberRegGameCloneLink,
getMemberLabel,
} from '@/api/game';
import {
getRecentSendLog,
......@@ -483,6 +484,7 @@ import sendSelectChannel from './sendGame/sendSelectChannel.vue';
import gameLogMixin from '@/mixins/gameLogMixin';
import { sendChatMessage } from '@/utils/index';
import QrcodeVue from 'qrcode.vue';
import { openAsyncDialog } from '@/components/AsyncDialog';
export default {
name: 'sendGame',
mixins: [gameLogMixin],
......@@ -532,6 +534,11 @@ export default {
h5CloneGameInfo: {},
qrCodeValue: '', // 二维码内容
qrCodeSize: 200, // 二维码大小
transRiskMemberId: '',
transRiskInfo: {
isHighRisk: false,
isPhishing: false,
},
};
},
mounted() {
......@@ -553,6 +560,11 @@ export default {
accountSelect(newVal, oldVal) {
// 切换 w 账号的时候清空 conversionGameList 数据
this.conversionGameList = [];
this.transRiskMemberId = '';
this.transRiskInfo = {
isHighRisk: false,
isPhishing: false,
};
this.getMemberTransStatus();
if (newVal && newVal !== '' && this.bindGameUserList.length > 0) {
this.disabled = false;
......@@ -1049,11 +1061,102 @@ export default {
return false;
}
},
sendLink: throttle(function (item, type) {
isTruthyFlag(value) {
return value === true || value === 1 || value === '1';
},
async getTransRiskInfo() {
const localRiskInfo = {
isHighRisk:
Boolean(this.gameUserInfo && this.gameUserInfo.exp_ip) ||
this.isTruthyFlag(this.gameUserInfo && this.gameUserInfo.change_risk),
isPhishing:
this.isTruthyFlag(
this.chatUserInfo && this.chatUserInfo.is_phishing_account,
) ||
this.isTruthyFlag(
this.chatUserInfo && this.chatUserInfo.change_appraisal,
) ||
this.isTruthyFlag(
this.gameUserInfo && this.gameUserInfo.change_appraisal,
),
};
if (!this.accountSelect) {
return localRiskInfo;
}
if (this.transRiskMemberId === this.accountSelect) {
return {
isHighRisk:
localRiskInfo.isHighRisk || this.transRiskInfo.isHighRisk,
isPhishing:
localRiskInfo.isPhishing || this.transRiskInfo.isPhishing,
};
}
try {
const res = await getMemberLabel({
member_id: this.accountSelect,
label_type: [4, 6],
});
const memberLabelList = res?.data?.data || [];
const riskLabel = memberLabelList.find(
(item) => item.label_type == 4,
);
const phishingLabel = memberLabelList.find(
(item) => item.label_type == 6,
);
this.transRiskMemberId = this.accountSelect;
this.transRiskInfo = {
isHighRisk: this.isTruthyFlag(riskLabel && riskLabel.label_value),
isPhishing: this.isTruthyFlag(
phishingLabel && phishingLabel.label_value,
),
};
} catch (error) {
console.log(error);
this.transRiskMemberId = this.accountSelect;
this.transRiskInfo = {
isHighRisk: false,
isPhishing: false,
};
}
return {
isHighRisk: localRiskInfo.isHighRisk || this.transRiskInfo.isHighRisk,
isPhishing: localRiskInfo.isPhishing || this.transRiskInfo.isPhishing,
};
},
async confirmTransRiskBeforeSend() {
const riskInfo = await this.getTransRiskInfo();
if (!riskInfo.isHighRisk && !riskInfo.isPhishing) {
return true;
}
try {
await openAsyncDialog({
title: '确认发送',
message:
'当前用户为钓鱼号/高风险用户,请与组长确认是否发送转端链接',
countdown: 3,
confirmText: '确 定',
cancelText: '取 消',
});
return true;
} catch (error) {
return false;
}
},
sendLink: throttle(async function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
if (!(await this.confirmTransRiskBeforeSend())) {
return;
}
console.log(item, '转端发送仅发送链接');
const result = this.handleAccount();
if (!result) {
......@@ -1077,11 +1180,14 @@ export default {
item.type = 1;
this.sendGameLog(item);
}, 500),
sendPassword: throttle(function (item, type) {
sendPassword: throttle(async function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
if (!(await this.confirmTransRiskBeforeSend())) {
return;
}
console.log(item, '转端仅发送账号密码');
const result = this.handleAccount();
if (!result) {
......@@ -1110,11 +1216,14 @@ export default {
console.log(err);
});
}, 500),
sendMessage: throttle(function (item, type) {
sendMessage: throttle(async function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
if (!(await this.confirmTransRiskBeforeSend())) {
return;
}
const result = this.handleAccount();
if (!result) {
this.$message.warning('请稍后再试');
......@@ -1170,11 +1279,14 @@ export default {
this.getMediaId(value, 'image');
},
// 转端发送落地页面
sendDownLoadPage: throttleStart(function (items, type, index) {
sendDownLoadPage: throttleStart(async function (items, type, index) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
if (!(await this.confirmTransRiskBeforeSend())) {
return;
}
this.$set(
this.conversionGameList[index],
'send_trans_page_id',
......@@ -1184,6 +1296,13 @@ export default {
}, 500),
// 转端发送游戏分身包 h5 安卓游戏 IOS游戏 发送分身包
async sendTransferCloneGame(type, items) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
if (!(await this.confirmTransRiskBeforeSend())) {
return;
}
if (!this.h5CloneGameInfo?.data?.h5_download_url) {
this.h5CloneGameInfo =
(await memberRegGameCloneLink({
......@@ -1239,6 +1358,9 @@ export default {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
if (!(await this.confirmTransRiskBeforeSend())) {
return;
}
const result = this.handleAccount();
if (!result) {
this.$message.warning('请稍后再试');
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论