提交 ef9aa8ce 作者: 施汉文

同步pc修改转端筛选

上级 d631131e
......@@ -63,7 +63,7 @@
:key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween"
>
<p>{{ items.game_name + "/" + items.game_id }}</p>
<p>{{ items.game_name + '/' + items.game_id }}</p>
<el-popover placement="top" width="160" trigger="hover">
<div>
<p
......@@ -99,9 +99,24 @@
</p>
<!-- h5 安卓游戏 IOS游戏 发送分身包 -->
<div v-if="[2].includes(item.game_type)">
<p class="sendLink" @click="sendTransferCloneGame(2,items)">发送分身包-H5</p>
<p class="sendLink" @click="sendTransferCloneGame(3,items)">发送分身包-安卓</p>
<p class="sendLink" @click="sendTransferCloneGame(4,items)">发送分身包-IOS</p>
<p
class="sendLink"
@click="sendTransferCloneGame(2, items)"
>
发送分身包-H5
</p>
<p
class="sendLink"
@click="sendTransferCloneGame(3, items)"
>
发送分身包-安卓
</p>
<p
class="sendLink"
@click="sendTransferCloneGame(4, items)"
>
发送分身包-IOS
</p>
</div>
</div>
<el-button
......@@ -179,7 +194,7 @@
:key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween"
>
<p>{{ items.game_name + "/" + items.game_id }}</p>
<p>{{ items.game_name + '/' + items.game_id }}</p>
<el-button
slot="reference"
size="mini"
......@@ -282,27 +297,67 @@
:key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween"
>
<p>{{ items.label + "/" + items.id }}</p>
<p>{{ items.label + '/' + items.id }}</p>
<!--game_type: 1 微信小游戏 2 H5 游戏 3 安卓游戏 4 IOS 游戏 5 抖音小游戏 -->
<!-- 微信小游戏 安卓游戏 IOS游戏 处理逻辑 -->
<el-popover v-if="items.game_type == 1 || items.game_type == 3 || items.game_type == 4 || items.game_type == 5" placement="top" trigger="click">
<div v-if="items.game_type!=5">
<p class="sendLink" @click="sendChannelGame(items, item)">发送链接/渠道二维码</p>
<p class="sendLink" @click="handleGameType(items, item, item.game_type, index)">发送落地页</p>
<el-popover
v-if="
items.game_type == 1 ||
items.game_type == 3 ||
items.game_type == 4 ||
items.game_type == 5
"
placement="top"
trigger="click"
>
<div v-if="items.game_type != 5">
<p class="sendLink" @click="sendChannelGame(items, item)">
发送链接/渠道二维码
</p>
<p
class="sendLink"
@click="
handleGameType(items, item, item.game_type, index)
"
>
发送落地页
</p>
<div v-if="items.game_type == 1">
<!-- 发送 H5 安卓分身包 -->
<p class="sendLink" @click="sendH5CloneGame(items, 'android')">发送H5-安卓分身包</p>
<!-- 发送 H5 IOS 分身包 -->
<p class="sendLink" @click="sendH5CloneGame(items, 'ios')">发送H5-IOS分身包</p>
</div>
</div>
<!-- 抖音小游戏发送落地页 -->
<div v-else>
<p class="sendLink" @click="handleGameType(items, item, item.game_type, index)">发送落地页</p>
<div v-if="items.game_type == 1">
<!-- 发送 H5 安卓分身包 -->
<p
class="sendLink"
@click="sendH5CloneGame(items, 'android')"
>
发送H5-安卓分身包
</p>
<!-- 发送 H5 IOS 分身包 -->
<p
class="sendLink"
@click="sendH5CloneGame(items, 'ios')"
>
发送H5-IOS分身包
</p>
</div>
<el-button slot="reference" size="mini" :disabled="accountSelect == ''">发送</el-button>
</el-popover>
</div>
<!-- 抖音小游戏发送落地页 -->
<div v-else>
<p
class="sendLink"
@click="
handleGameType(items, item, item.game_type, index)
"
>
发送落地页
</p>
</div>
<el-button
slot="reference"
size="mini"
:disabled="accountSelect == ''"
>发送</el-button
>
</el-popover>
<el-button
v-else
size="mini"
......@@ -393,7 +448,7 @@
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from "vuex";
import { mapState, mapMutations, mapActions } from 'vuex';
import {
memberExtensionGameList,
passwardEncryption,
......@@ -407,8 +462,8 @@ import {
getClonePackageLink,
getLandingPageConfig,
getMemberTransStatus,
memberRegGameCloneLink
} from "@/api/game";
memberRegGameCloneLink,
} from '@/api/game';
import {
getRecentSendLog,
markTransScene,
......@@ -416,20 +471,20 @@ import {
getZqCserWxBelong,
getMediaId,
send_log_add,
} from "@/api/works";
import { companyviewConfig } from "@/api/user";
import { throttle, throttleStart } from "@/utils/index";
import createChannel from "./sendGame/createChannel";
import sendPage from "./sendGame/SendTransPage.vue";
import SendTransWxGame from "./sendGame/SendTransWxGame.vue";
import SendTransAppGame from "./sendGame/SendTransAppGame.vue";
import selectChannel from "./sendGame/selectChannel.vue";
import sendSelectChannel from "./sendGame/sendSelectChannel.vue";
import gameLogMixin from "@/mixins/gameLogMixin";
import { sendChatMessage } from "@/utils/index";
import QrcodeVue from "qrcode.vue";
} from '@/api/works';
import { companyviewConfig } from '@/api/user';
import { throttle, throttleStart } from '@/utils/index';
import createChannel from './sendGame/createChannel';
import sendPage from './sendGame/SendTransPage.vue';
import SendTransWxGame from './sendGame/SendTransWxGame.vue';
import SendTransAppGame from './sendGame/SendTransAppGame.vue';
import selectChannel from './sendGame/selectChannel.vue';
import sendSelectChannel from './sendGame/sendSelectChannel.vue';
import gameLogMixin from '@/mixins/gameLogMixin';
import { sendChatMessage } from '@/utils/index';
import QrcodeVue from 'qrcode.vue';
export default {
name: "sendGame",
name: 'sendGame',
mixins: [gameLogMixin],
components: {
createChannel,
......@@ -453,15 +508,15 @@ export default {
weixin_blongs_id: [],
regGameList: [],
allRegGameList: [],
filterGameText: "",
filterGameText: '',
channelselectList: [],
webForm: {
channel_id: "",
channel_id: '',
},
sendLoading: false,
belongList: [], // 项目列表
activeName: "1", // 转端 1 转游 2 召回 3
sendType: "", // 1 进发送链接 2 仅发送账号密码 3 发送链接和账号密码
activeName: '1', // 转端 1 转游 2 召回 3
sendType: '', // 1 进发送链接 2 仅发送账号密码 3 发送链接和账号密码
showCreateChannel: false,
showImageComposer: false,
showWxGameDrawer: false,
......@@ -475,7 +530,7 @@ export default {
channelInfoList: {},
transMemberStatus: true,
h5CloneGameInfo: {},
qrCodeValue: "", // 二维码内容
qrCodeValue: '', // 二维码内容
qrCodeSize: 200, // 二维码大小
};
},
......@@ -484,14 +539,14 @@ export default {
this.sendGameInfo();
},
computed: {
...mapState("game", [
"accountSelect",
"bindGameUserList",
"chatUserInfo",
"gameUserInfo",
"send_game_log",
...mapState('game', [
'accountSelect',
'bindGameUserList',
'chatUserInfo',
'gameUserInfo',
'send_game_log',
]),
...mapState("user", ["userInfo", "corp_id"]),
...mapState('user', ['userInfo', 'corp_id']),
},
// props: [ 'chatUserInfo', 'chatUser'],
watch: {
......@@ -499,7 +554,7 @@ export default {
// 切换 w 账号的时候清空 conversionGameList 数据
this.conversionGameList = [];
this.getMemberTransStatus();
if (newVal && newVal !== "" && this.bindGameUserList.length > 0) {
if (newVal && newVal !== '' && this.bindGameUserList.length > 0) {
this.disabled = false;
} else {
this.disabled = true;
......@@ -511,14 +566,14 @@ export default {
},
},
methods: {
...mapMutations("game", ["set_send_game_log"]),
...mapMutations('game', ['set_send_game_log']),
initDisable() {
// 切换 w 账号的时候清空 conversionGameList 数据
this.conversionGameList = [];
this.getMemberTransStatus();
if (
this.accountSelect &&
this.accountSelect !== "" &&
this.accountSelect !== '' &&
this.bindGameUserList.length > 0
) {
this.disabled = false;
......@@ -538,20 +593,20 @@ export default {
async sendH5CloneGame(items, type) {
const res = await getClonePackageLink({ mini_game_id: items.id });
if (res.status_code == 1) {
if (type == "android" && !res?.data?.data?.android_download_url) {
this.$message.warning("安卓分身包链接不存在,请联系掌游配置");
if (type == 'android' && !res?.data?.data?.android_download_url) {
this.$message.warning('安卓分身包链接不存在,请联系掌游配置');
return;
} else if (type == "ios" && !res?.data?.data?.ios_download_url) {
this.$message.warning("IOS分身包链接不存在,请联系掌游配置");
} else if (type == 'ios' && !res?.data?.data?.ios_download_url) {
this.$message.warning('IOS分身包链接不存在,请联系掌游配置');
return;
}
let srt = "";
if (type == "android") {
srt = "安卓分身包链接: " + res.data.data.android_download_url;
let srt = '';
if (type == 'android') {
srt = '安卓分身包链接: ' + res.data.data.android_download_url;
} else {
srt = "IOS分身包链接: " + res.data.data.ios_download_url;
srt = 'IOS分身包链接: ' + res.data.data.ios_download_url;
}
sendChatMessage(srt, "text");
sendChatMessage(srt, 'text');
} else {
this.$message.warning(res.msg);
}
......@@ -566,7 +621,7 @@ export default {
},
// 请求当前 W 账号是否符合转端条件 如果不符合 提示 当前w账号不满足转端要求,请联系组长处理
async getMemberTransStatus() {
if (this.accountSelect && this.accountSelect !== "") {
if (this.accountSelect && this.accountSelect !== '') {
const res = await getMemberTransStatus({
member_id: this.accountSelect,
});
......@@ -578,11 +633,11 @@ export default {
}
},
recallTabChange() {
this.activeName = "3";
this.activeName = '3';
this.sendGameRecallList();
},
async requestGameSendLog() {
this.filterGameText = "";
this.filterGameText = '';
const res = await getRecentSendLog();
if (res.status_code == 1) {
if (res.status_code == 1 && res.data.length > 0) {
......@@ -593,22 +648,22 @@ export default {
}
// 检查是否已经存在"最近发送"项
const recentSendIndex = this.regGameList.findIndex(
(item) => item.label === "最近发送"
(item) => item.label === '最近发送',
);
if (recentSendIndex !== -1) {
// 如果已存在,更新它
this.$set(this.regGameList[recentSendIndex], "children", res.data);
this.$set(this.regGameList[recentSendIndex], 'children', res.data);
} else {
// 如果不存在,添加它
this.regGameList.unshift({
label: "最近发送",
label: '最近发送',
children: res.data,
});
}
}
},
async sendGameInfo() {
this.activeName = "1";
this.activeName = '1';
this.conversionGameList = [];
this.recallGameList = [];
this.getMemberTransStatus();
......@@ -616,15 +671,15 @@ export default {
this.sendGameList();
},
requestRegGameList() {
this.activeName = "2";
this.activeName = '2';
if (
this.gameUserInfo.main_game_id ||
this.gameUserInfo.main_game_id == 0
) {
this.contentLoading = true;
const data = {
type: "gameListWithType",
value: "",
type: 'gameListWithType',
value: '',
use_type: 2,
game_id: this.gameUserInfo.main_game_id,
use_user_id: this.userInfo.id,
......@@ -635,7 +690,7 @@ export default {
if (res.status_code == 1) {
// 暂时隐藏快手小游戏
const ksGameIndex = res.data.data.findIndex(
(item) => item.label === "快手小游戏"
(item) => item.label === '快手小游戏',
);
if (ksGameIndex !== -1) {
res.data.data.splice(ksGameIndex, 1);
......@@ -655,26 +710,26 @@ export default {
// 召回发送渠道
sendChannel(items, type) {
items.type = 3;
type ? (this.sendType = type) : "";
type ? (this.sendType = type) : '';
this.channelList(items);
},
// 转游发送渠道
sendChannelGame(items, item, type) {
console.log(items, "items", item);
type ? (this.sendType = type) : "";
console.log(items, 'items', item);
type ? (this.sendType = type) : '';
const gameInfo = this.$clone(items);
gameInfo.type = 2;
this.channelList(gameInfo);
},
changeGameText() {
console.log(this.filterGameText);
if (this.filterGameText.trim() === "") {
if (this.filterGameText.trim() === '') {
this.regGameList = this.allRegGameList;
} else {
const list = JSON.parse(JSON.stringify(this.allRegGameList));
list.map((item, index) => {
item.children = item.children.filter(
(items) => items.label.indexOf(this.filterGameText) !== -1
(items) => items.label.indexOf(this.filterGameText) !== -1,
);
});
this.regGameList = list;
......@@ -682,7 +737,7 @@ export default {
},
// 获取渠道列表
channelList(items) {
console.log(items, "items");
console.log(items, 'items');
const data = {
game_id: items.game_id || items.id,
page_size: 200,
......@@ -691,7 +746,7 @@ export default {
weixin_blongs_id: items.weixin_blongs_id
? [items.weixin_blongs_id]
: this.weixin_blongs_id,
request_system: "company_wx",
request_system: 'company_wx',
member_id: this.accountSelect,
use_type: this.activeName,
};
......@@ -712,7 +767,7 @@ export default {
}
this.sendGameLog(items);
} else {
this.$message.warning("请到掌游创建运营渠道");
this.$message.warning('请到掌游创建运营渠道');
}
});
},
......@@ -727,7 +782,7 @@ export default {
this.contentLoading = false;
if (res.status_code === 1 && res.data.data.length > 0) {
const ksGameIndex = res.data.data.findIndex(
(item) => item.game_type == 6
(item) => item.game_type == 6,
);
if (ksGameIndex != -1) {
res.data.data.splice(ksGameIndex, 1);
......@@ -742,7 +797,7 @@ export default {
}
},
async conversionChangeOld(value) {
console.log("请求数据", this.conversionGameList);
console.log('请求数据', this.conversionGameList);
if (this.isReqeustData) {
return;
}
......@@ -765,7 +820,7 @@ export default {
// 使用解构赋值简化数据设置
const updates = {
children: reslist.data?.length > 0 ? reslist.data : [],
send_trans_page_id: "", // 转端要发送的游戏 ID
send_trans_page_id: '', // 转端要发送的游戏 ID
isReqeustData: true,
};
......@@ -776,17 +831,17 @@ export default {
} catch (error) {
console.error(
`Failed to fetch game list for index ${index}:`,
error
error,
);
// 设置空数组作为默认值
this.$set(this.conversionGameList[index], "children", []);
this.$set(this.conversionGameList[index], 'children', []);
}
});
await Promise.all(promiseList);
this.handleConversionGameList();
} catch (error) {
console.error("Failed to fetch conversion game lists:", error);
console.error('Failed to fetch conversion game lists:', error);
} finally {
this.gameLoding = false;
this.isReqeustData = false;
......@@ -803,56 +858,72 @@ export default {
item.children.length > 0
) {
const filteredChildren = item.children.filter((child) => {
return child.game_id !== "912" && child.game_id != "784";
return child.game_id !== '912' && child.game_id != '784';
});
this.$set(
this.conversionGameList[index],
"children",
filteredChildren
'children',
filteredChildren,
);
}
// 隐藏安卓游戏 安卓游戏 game_type: 3
// 隐藏神权之战 这里根据游戏名称判断 因为 game_id 是会变化的
if (
item.game_type === 3 &&
item.children &&
item.children.length > 0
) {
// 过滤掉 game_name 为"破日开天"的数据 英雄霸业 741:独步天龙 912:神权之战 繁华梦/2274
const filterList = [
'2365',
'2378',
'2431',
'2437',
'2439',
'2440',
'2441',
'2442',
'2443',
];
// 过滤掉 game_name 为"破日开天"的数据 英雄霸业 741:独步天龙 912:神权之战 繁华梦/2274 黑夜传奇/685 深海花园/2326
const filteredChildren = item.children.filter((child) => {
return (
child.game_name !== "破日开天" &&
child.game_name !== "英雄霸业" &&
child.game_id !== "741" &&
child.game_id !== "912" &&
child.game_name !== '神权之战' &&
child.game_id !== '741' &&
child.game_id !== '2274' &&
child.game_name !== '繁华梦'
child.game_name !== '破日开天' &&
child.game_name !== '英雄霸业' &&
child.game_name !== '神权之战' &&
child.game_id != '741' &&
child.game_id != '2274' &&
!filterList.includes(child.game_id) &&
child.game_name !== '繁华梦' &&
Number(child.game_id) !== 685
);
});
this.$set(
this.conversionGameList[index],
"children",
filteredChildren
'children',
filteredChildren,
);
}
// 隐藏 IOS 游戏 雄霸天下 有两个包 1 个是 691 一个是 819 王鑫说 暂时先隐藏 691 的功能
// 隐藏神权之战 这里根据游戏名称判断 因为 game_id 是会变化的
if (
item.game_type === 4 &&
item.children &&
item.children.length > 0
) {
const filteredChildren = item.children.filter((child) => {
return Number(child.game_id) !== 691;
return (
Number(child.game_id) !== 691 &&
child.game_name !== '神权之战' &&
child.game_id != '2393'
);
});
this.$set(
this.conversionGameList[index],
"children",
filteredChildren
'children',
filteredChildren,
);
}
});
console.log(this.conversionGameList, "conversionGameList");
}
},
// 转端展开
......@@ -860,7 +931,7 @@ export default {
if (value && value.length > 0) {
const gameType = value[value.length - 1];
const gameIndex = this.conversionGameList.findIndex(
(item) => item.game_type === gameType
(item) => item.game_type === gameType,
);
if (
!this.conversionGameList[gameIndex].children ||
......@@ -881,11 +952,11 @@ export default {
if (reslist.status_code === 1 && reslist.data.data.length > 0) {
this.$set(
this.conversionGameList[gameIndex],
"children",
reslist.data.data
'children',
reslist.data.data,
);
} else {
this.$set(this.conversionGameList[gameIndex], "children", []);
this.$set(this.conversionGameList[gameIndex], 'children', []);
}
setTimeout(() => {
this.gameLoding = false;
......@@ -902,7 +973,7 @@ export default {
this.contentLoading = false;
if (res.status_code === 1 && res.data.data.length > 0) {
const ksGameIndex = res.data.data.findIndex(
(item) => item.game_type == 6
(item) => item.game_type == 6,
);
if (ksGameIndex !== -1) {
res.data.data.splice(ksGameIndex, 1);
......@@ -921,7 +992,7 @@ export default {
if (value && value.length > 0) {
const gameType = value[value.length - 1];
const gameIndex = this.recallGameList.findIndex(
(item) => item.game_type === gameType
(item) => item.game_type === gameType,
);
if (
!this.recallGameList[gameIndex].children ||
......@@ -943,17 +1014,17 @@ export default {
if (reslist.status_code === 1 && reslist.data.data.length > 0) {
this.$set(
this.recallGameList[gameIndex],
"children",
reslist.data.data
'children',
reslist.data.data,
);
} else {
this.$set(this.recallGameList[gameIndex], "children", []);
this.$set(this.recallGameList[gameIndex], 'children', []);
}
setTimeout(() => {
this.gameLoding = false;
}, 2000);
} else {
console.log("之前请求过了");
console.log('之前请求过了');
}
}
},
......@@ -967,7 +1038,7 @@ export default {
handleAccount() {
if (this.bindGameUserList.length > 0) {
const account = this.bindGameUserList.find(
(item) => item.member_id == this.accountSelect
(item) => item.member_id == this.accountSelect,
);
if (account) {
return true;
......@@ -980,60 +1051,60 @@ export default {
},
sendLink: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning("当前w账号不满足转端要求,请联系组长处理");
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
console.log(item, "转端发送仅发送链接");
console.log(item, '转端发送仅发送链接');
const result = this.handleAccount();
if (!result) {
this.$message.warning("请稍后再试");
this.$message.warning('请稍后再试');
return false;
}
let str = "";
let str = '';
if (type == 2) {
str = "网页游戏链接:";
str = '网页游戏链接:';
} else if (type == 3) {
str = "安卓游戏链接:";
str = '安卓游戏链接:';
} else if (type == 4) {
str = "IOS游戏链接:";
str = 'IOS游戏链接:';
} else {
}
// const list = [
// { msgtype: 'text', text: { content: `${str}${item.url}` }}
// ]
this.sendChatMessage(`${str}${item.url}`, "text");
this.sendChatMessage(`${str}${item.url}`, 'text');
this.markTransScene(type);
item.type = 1;
this.sendGameLog(item);
}, 500),
sendPassword: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning("当前w账号不满足转端要求,请联系组长处理");
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
console.log(item, "转端仅发送账号密码");
console.log(item, '转端仅发送账号密码');
const result = this.handleAccount();
if (!result) {
this.$message.warning("请稍后再试");
this.$message.warning('请稍后再试');
return false;
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
(items) => items.member_id == this.accountSelect,
).username;
passwardEncryption({ member_id: this.accountSelect })
.then((res) => {
this.sendChatMessage(
`账号:${username} \n密码:${res.data.password}`,
"text"
'text',
);
this.markTransScene(type);
this.sendGameLog(item);
})
.catch((err) => {
const list = [
{ msgtype: "text", text: { content: `账号:${username}` } },
{ msgtype: 'text', text: { content: `账号:${username}` } },
];
this.sendChatMessage(`账号:${username}`, "text");
this.sendChatMessage(`账号:${username}`, 'text');
item.type = 1;
this.sendGameLog(item);
console.log(err);
......@@ -1041,31 +1112,31 @@ export default {
}, 500),
sendMessage: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning("当前w账号不满足转端要求,请联系组长处理");
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
const result = this.handleAccount();
if (!result) {
this.$message.warning("请稍后再试");
this.$message.warning('请稍后再试');
return false;
}
let str = "";
let str = '';
if (type == 2) {
str = "网页游戏链接:";
str = '网页游戏链接:';
} else if (type == 3) {
str = "安卓游戏链接:";
str = '安卓游戏链接:';
} else if (type == 4) {
str = "IOS游戏链接:";
str = 'IOS游戏链接:';
} else {
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
(items) => items.member_id == this.accountSelect,
).username;
passwardEncryption({ member_id: this.accountSelect })
.then((res) => {
const list = [
{
msgtype: "text",
msgtype: 'text',
text: {
content: `${str}${item.url} \n账号:${username} \n密码:${res.data.password}`,
key: res.data.key,
......@@ -1075,7 +1146,7 @@ export default {
];
this.sendChatMessage(
`${str}${item.url} \n账号:${username} \n密码:${res.data.password}`,
"text"
'text',
);
this.markTransScene(type);
item.type = 1;
......@@ -1084,102 +1155,106 @@ export default {
.catch((err) => {
const list = [
{
msgtype: "text",
msgtype: 'text',
text: { content: `${str}${item.url} \n账号:${username}` },
},
];
this.sendChatMessage(`${str}${item.url} \n账号:${username}`, "text");
this.sendChatMessage(`${str}${item.url} \n账号:${username}`, 'text');
this.sendGameLog(item);
console.log(err);
});
}, 500),
// 发送游戏落地页
startSendPage(value) {
console.log(value, "value");
this.getMediaId(value, "image");
console.log(value, 'value');
this.getMediaId(value, 'image');
},
// 转端发送落地页面
sendDownLoadPage: throttleStart(function (items, type, index) {
if (!this.transMemberStatus) {
this.$message.warning("当前w账号不满足转端要求,请联系组长处理");
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
this.$set(
this.conversionGameList[index],
"send_trans_page_id",
items.game_id
'send_trans_page_id',
items.game_id,
);
this.showSendPage = true;
}, 500),
// 转端发送游戏分身包 h5 安卓游戏 IOS游戏 发送分身包
async sendTransferCloneGame(type,items) {
if(!this.h5CloneGameInfo?.data?.h5_download_url){
this.h5CloneGameInfo = await memberRegGameCloneLink({ member_id: this.accountSelect ,game_id:items.game_id}) || {}
async sendTransferCloneGame(type, items) {
if (!this.h5CloneGameInfo?.data?.h5_download_url) {
this.h5CloneGameInfo =
(await memberRegGameCloneLink({
member_id: this.accountSelect,
game_id: items.game_id,
})) || {};
}
if (this.h5CloneGameInfo?.status_code == 1) {
// 通过 type 判断 用 switch
switch (type) {
case 2:
if (!this.h5CloneGameInfo?.data?.h5_download_url) {
this.$message.warning('H5安卓分身包链接不存在,请联系掌游配置')
return
this.$message.warning('H5安卓分身包链接不存在,请联系掌游配置');
return;
}
break
break;
case 3:
if (!this.h5CloneGameInfo?.data?.android_download_url) {
this.$message.warning('安卓分身包链接不存在,请联系掌游配置')
return
this.$message.warning('安卓分身包链接不存在,请联系掌游配置');
return;
}
break
break;
case 4:
if (!this.h5CloneGameInfo?.data?.ios_download_url) {
this.$message.warning('IOS分身包链接不存在,请联系掌游配置')
return
this.$message.warning('IOS分身包链接不存在,请联系掌游配置');
return;
}
break
break;
default:
this.$message.warning('不支持的游戏类型')
return
this.$message.warning('不支持的游戏类型');
return;
}
let srt = ''
let srt = '';
switch (type) {
case 2:
srt = this.h5CloneGameInfo?.data?.h5_download_url
break
srt = this.h5CloneGameInfo?.data?.h5_download_url;
break;
case 3:
srt = this.h5CloneGameInfo?.data?.android_download_url
break
srt = this.h5CloneGameInfo?.data?.android_download_url;
break;
case 4:
srt = this.h5CloneGameInfo?.data?.ios_download_url
break
srt = this.h5CloneGameInfo?.data?.ios_download_url;
break;
}
this.sendChatMessage(srt, "text");
this.sendChatMessage(srt, 'text');
} else {
this.$message.warning(this.h5CloneGameInfo?.msg)
this.$message.warning(this.h5CloneGameInfo?.msg);
}
},
// 转端发送游戏二维码
sendDownLoadQrCode: throttleStart(async function (items, type, index) {
if (!this.transMemberStatus) {
this.$message.warning("当前w账号不满足转端要求,请联系组长处理");
this.$message.warning('当前w账号不满足转端要求,请联系组长处理');
return;
}
const result = this.handleAccount();
if (!result) {
this.$message.warning("请稍后再试");
this.$message.warning('请稍后再试');
return false;
}
try {
this.sendLoading = true;
// 获取游戏落地页链接
let landingPageUrl = "";
let landingPageUrl = '';
if (items.url) {
landingPageUrl = items.url;
}
if (!landingPageUrl) {
this.$message.error("没有有效的链接可生成二维码");
this.$message.error('没有有效的链接可生成二维码');
return;
}
......@@ -1190,23 +1265,23 @@ export default {
await this.$nextTick();
// 获取二维码canvas并转换为Blob
const canvas = this.$refs.qrcode.$el.querySelector("canvas");
const canvas = this.$refs.qrcode.$el.querySelector('canvas');
if (!canvas) {
throw new Error("获取二维码canvas失败");
throw new Error('获取二维码canvas失败');
}
const blob = await new Promise((resolve) => {
canvas.toBlob((blob) => {
resolve(blob);
}, "image/png");
}, 'image/png');
});
// 创建File对象
blob.name = "qrcode.png";
blob.name = 'qrcode.png';
// 上传图片
const uploadConfig = {
dir: "/company_wx/service/avatars/",
dir: '/company_wx/service/avatars/',
};
const uploadResult = await this.uploading(blob, uploadConfig);
debugger;
......@@ -1225,17 +1300,17 @@ export default {
// };
// console.log(image, 12312321);
this.sendChatMessage(uploadResult.data, "image");
this.sendChatMessage(uploadResult.data, 'image');
this.markTransScene(type);
items.type = 1;
this.sendGameLog(items);
this.$message.success("二维码发送成功");
this.$message.success('二维码发送成功');
} else {
throw new Error("上传失败");
throw new Error('上传失败');
}
} catch (error) {
console.error("发送二维码失败:", error);
this.$message.error("发送二维码失败,请重试");
console.error('发送二维码失败:', error);
this.$message.error('发送二维码失败,请重试');
} finally {
this.sendLoading = false;
}
......@@ -1248,10 +1323,10 @@ export default {
};
const res = await markTransScene(data);
if (res.status_code == 1) {
console.log("标记转端成功");
console.log('标记转端成功');
if (
this.chatUserInfo.trans_scene &&
this.chatUserInfo.trans_scene !== "" &&
this.chatUserInfo.trans_scene !== '' &&
this.chatUserInfo.trans_scene != type
) {
this.chatUserInfo.trans_scene = type;
......@@ -1269,14 +1344,14 @@ export default {
return {
value: item.value,
label:
item.label && item.label.split("-")[0]
? item.label.split("-")[0]
: "",
item.label && item.label.split('-')[0]
? item.label.split('-')[0]
: '',
};
});
resolve(this.belongList);
} else {
this.$message.warning("暂无绑定项目,请先绑定项目");
this.$message.warning('暂无绑定项目,请先绑定项目');
reject(null);
}
});
......@@ -1297,7 +1372,7 @@ export default {
belonsList.length > 0
) {
groupItem = group.data.data[0];
const group_name_list = groupItem.label.split("-");
const group_name_list = groupItem.label.split('-');
const data = {
blongs_name: belonsList[0].label,
member_id: this.accountSelect,
......@@ -1305,7 +1380,7 @@ export default {
use_user_name: this.userInfo.username,
group_id: groupItem.value,
group_name: group_name_list[group_name_list.length - 1],
game_type: this.chatUserInfo.trans_scene || "",
game_type: this.chatUserInfo.trans_scene || '',
};
this.sendLoading = true;
try {
......@@ -1320,11 +1395,11 @@ export default {
this.$message.success(res.msg);
}
} catch (error) {
this.$message.error("获取召回链接失败,请重新再试");
this.$message.error('获取召回链接失败,请重新再试');
this.sendLoading = false;
}
} else {
this.$message.error("获取分组失败,请到掌权添加分组");
this.$message.error('获取分组失败,请到掌权添加分组');
return;
}
},
......@@ -1342,11 +1417,11 @@ export default {
*/
handleSendType(data) {
console.log(data, "获取一键发送的信息");
console.log(data, '获取一键发送的信息');
// 转端发送优先逻辑 不需要了 现在发送当前会话框选中的账号对应的注册游戏
data?.game_data?.game_type
? (this.chatUserInfo.trans_scene = data.game_data.game_type)
: "";
: '';
if (this.chatUserInfo.trans_scene && this.chatUserInfo.trans_scene != 1) {
this.sendCreateChannel(data.game_data, data.game_data.game_type);
} else {
......@@ -1362,13 +1437,13 @@ export default {
page: data.share_data.page,
imgUrl: data.share_data.share_img,
};
this.sendChatMessage(miniprogramInfo, "miniprogram");
this.sendChatMessage(miniprogramInfo, 'miniprogram');
const game_data = this.$clone(data.game_data);
game_data.type = 3;
console.log(game_data, "data----------");
console.log(game_data, 'data----------');
this.sendGameLog(game_data);
} else {
this.getMediaId(data.game_data.game_url, "image");
this.getMediaId(data.game_data.game_url, 'image');
this.sendGameLog(data.game_data);
}
}
......@@ -1386,26 +1461,26 @@ export default {
sendCreateChannel: throttle(function (item, type) {
const result = this.handleAccount();
if (!result) {
this.$message.warning("请稍后再试");
this.$message.warning('请稍后再试');
return false;
}
let str = "";
let str = '';
if (type == 2) {
str = "网页游戏链接:";
str = '网页游戏链接:';
} else if (type == 3) {
str = "安卓游戏链接:";
str = '安卓游戏链接:';
} else if (type == 4) {
str = "IOS游戏链接:";
str = 'IOS游戏链接:';
} else {
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
(items) => items.member_id == this.accountSelect,
).username;
passwardEncryption({ member_id: this.accountSelect }).then((res) => {
const list = [
{
msgtype: "text",
msgtype: 'text',
// 一键发送渠道任务相关的参数
taskInfo: {
task_id: this.chatUser.task_id,
......@@ -1422,7 +1497,7 @@ export default {
];
this.sendChatMessage(
`${str}${item.game_url} \n账号:${username} \n密码:${res.data.password}`,
"text"
'text',
);
item.type = 3;
this.sendGameLog(item);
......@@ -1433,7 +1508,12 @@ export default {
const params = {
main_game_id: items.main_game_id,
weixin_blongs_id: items.weixin_blongs_id,
type: items.game_type == 1 || items.game_type == 5 ? 2 : items.game_type == 3 || items.game_type == 4 ? 1 : ''
type:
items.game_type == 1 || items.game_type == 5
? 2
: items.game_type == 3 || items.game_type == 4
? 1
: '',
};
const res = await getLandingPageConfig(params);
if (res.status_code === 1 && res.data) {
......@@ -1457,7 +1537,7 @@ export default {
this.showWxGameDrawer = true;
return true;
} catch (error) {
console.error("处理微信小游戏失败:", error);
console.error('处理微信小游戏失败:', error);
return false;
}
},
......@@ -1468,12 +1548,12 @@ export default {
return targetList.filter(
(game) =>
game.weixin_blongs_id === sourceGame.weixin_blongs_id &&
game.main_game_id === sourceGame.main_game_id
game.main_game_id === sourceGame.main_game_id,
);
},
handleAndroidList(items, item) {
const androidGameList = this.regGameList.find((item) =>
item.label.includes("安卓")
item.label.includes('安卓'),
);
if (
androidGameList &&
......@@ -1482,7 +1562,7 @@ export default {
) {
androidGameList.children = this.filterGameList(
items,
androidGameList.children
androidGameList.children,
);
} else {
androidGameList.children = [];
......@@ -1496,7 +1576,7 @@ export default {
},
handleIosList(items, item) {
const IOSGameList = this.regGameList.find((item) =>
item.label.includes("IOS" || "ios")
item.label.includes('IOS' || 'ios'),
);
IOSGameList.game_type = 4;
if (
......@@ -1519,13 +1599,20 @@ export default {
this.showAppGameDrawer = true;
const androidGameList = this.handleAndroidList(items, item);
const IOSGameList = this.handleIosList(items, item);
androidGameList ? this.selectedAppGameList.push(androidGameList) : "";
IOSGameList ? this.selectedAppGameList.push(IOSGameList) : "";
console.log(this.selectedAppGameList, "selectedAppGameList");
androidGameList ? this.selectedAppGameList.push(androidGameList) : '';
IOSGameList ? this.selectedAppGameList.push(IOSGameList) : '';
console.log(this.selectedAppGameList, 'selectedAppGameList');
},
// 主方法
async handleGameType(items, item, type, index) {
if ((items.game_type == 1 || items.game_type == 3 || items.game_type == 4 || items.game_type == 5) && items.main_game_id && items.weixin_blongs_id) {
if (
(items.game_type == 1 ||
items.game_type == 3 ||
items.game_type == 4 ||
items.game_type == 5) &&
items.main_game_id &&
items.weixin_blongs_id
) {
const result = await this.getLandingPageConfig(items, item);
if (result && result.data?.data?.tag) {
if (items.game_type == 1 || items.game_type == 5) {
......@@ -1548,8 +1635,8 @@ export default {
},
// 小游戏游戏确认
async handleWxGameConfirm(value) {
console.log(value, "value");
this.getMediaId(value, "image");
console.log(value, 'value');
this.getMediaId(value, 'image');
},
SendTransAppGameClose() {
this.selectedAppGameList = [];
......@@ -1562,17 +1649,17 @@ export default {
this.selectedAppGameList = [];
this.sendChatMessage(
`游戏地址:${data.landing_page_url} \n账号:${data.username} \n密码:${data.password}`,
"text"
'text',
);
},
async getMediaId(picurl) {
// 发送图片作为链接消息
if (picurl) {
this.sendChatMessage(picurl, "image");
this.sendChatMessage(picurl, 'image');
} else {
// 如果没有图片URL,提示用户
this.$message.error("图片链接不存在,无法发送");
this.$message.error('图片链接不存在,无法发送');
}
},
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论