|
@@ -206,6 +206,7 @@
|
|
<el-switch
|
|
<el-switch
|
|
v-if="item.type == 2 || item.type == 7"
|
|
v-if="item.type == 2 || item.type == 7"
|
|
v-model="item.checked"
|
|
v-model="item.checked"
|
|
|
|
+ @change="formSwitchChange($event, item)"
|
|
/>
|
|
/>
|
|
<img
|
|
<img
|
|
v-if="item.type == 3"
|
|
v-if="item.type == 3"
|
|
@@ -318,7 +319,7 @@ import { getInviteGuildInfo } from "@/http/discordApi";
|
|
import { payCalcFee, getPayConfig } from "@/http/pay";
|
|
import { payCalcFee, getPayConfig } from "@/http/pay";
|
|
import { getFrontConfig } from "@/http/account";
|
|
import { getFrontConfig } from "@/http/account";
|
|
import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
|
|
import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
|
|
-import { throttle } from "@/uilts/help"
|
|
+import { debounce } from "@/uilts/help"
|
|
import Report from "@/log-center/log"
|
|
import Report from "@/log-center/log"
|
|
import { ElMessage, ElLoading } from "element-plus";
|
|
import { ElMessage, ElLoading } from "element-plus";
|
|
import "element-plus/es/components/message/style/css";
|
|
import "element-plus/es/components/message/style/css";
|
|
@@ -467,7 +468,7 @@ let formList = reactive([
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label: "Join Discord",
|
|
label: "Join Discord",
|
|
- icon: require("@/assets/svg/icon-discord.svg"),
|
|
+ icon: require("@/assets/svg/icon-discord-mini.svg"),
|
|
nodeType: "input",
|
|
nodeType: "input",
|
|
text: '',
|
|
text: '',
|
|
type: 7,
|
|
type: 7,
|
|
@@ -747,9 +748,12 @@ const submitRequest = async () => {
|
|
let relatedUsers = formList[i]["text"];
|
|
let relatedUsers = formList[i]["text"];
|
|
item.relatedUsers = relatedUsers;
|
|
item.relatedUsers = relatedUsers;
|
|
finishConditions.push(item);
|
|
finishConditions.push(item);
|
|
- } else if (formList[i]["checked"] && formList[i]["text"] && formList[i]["type"] == 7) {
|
|
+ } else if (formList[i]["type"] == 7) {
|
|
- item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
|
|
+ // join discord
|
|
- finishConditions.push(item);
|
|
+ if(formList[i]["checked"] && formList[i]["text"]) {
|
|
|
|
+ item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
|
|
|
|
+ finishConditions.push(item);
|
|
|
|
+ }
|
|
} else if (formList[i]["checked"]) {
|
|
} else if (formList[i]["checked"]) {
|
|
finishConditions.push(item);
|
|
finishConditions.push(item);
|
|
}
|
|
}
|
|
@@ -1004,39 +1008,66 @@ const onIptSetErrorTxt = () => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const formSwitchChange = (val, params) => {
|
|
|
|
+ if(!val) {
|
|
|
|
+ if(params.type == 7) {
|
|
|
|
+ // 清空discord错误校验
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
const onIptDiscordAddress = (e, index) => {
|
|
const onIptDiscordAddress = (e, index) => {
|
|
let val = formList[index].text;
|
|
let val = formList[index].text;
|
|
|
|
|
|
|
|
+ onIptDiscordDebounce({value: val, checked: formList[index].checked})
|
|
}
|
|
}
|
|
|
|
|
|
const onBlurDiscordAddress = (e, index) => {
|
|
const onBlurDiscordAddress = (e, index) => {
|
|
let val = formList[index].text;
|
|
let val = formList[index].text;
|
|
|
|
|
|
- getDiscordInviteInfo(val);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const onIptDiscordDebounce = debounce(function({value, checked}) {
|
|
|
|
+ if(value && checked) {
|
|
|
|
+ let validata = checkInviteUrl(value);
|
|
|
|
+ if(validata) {
|
|
|
|
+ getDiscordInviteInfo(value, (res) => {
|
|
|
|
+ if(res.code != 0) {
|
|
|
|
+ // 错误提示
|
|
|
|
+ } else {
|
|
|
|
+ // 预览 服务器 showDiscordInvitePop
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ // 错误提示
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}, 800)
|
|
|
|
+
|
|
const checkInviteUrl = (inviteUrl) => {
|
|
const checkInviteUrl = (inviteUrl) => {
|
|
let flag = true;
|
|
let flag = true;
|
|
const INVITE_URL_PREFIX = 'https://discord.gg/';
|
|
const INVITE_URL_PREFIX = 'https://discord.gg/';
|
|
const INVITE_URL_PREFIX_OLD = 'https://discord.com/invite/';
|
|
const INVITE_URL_PREFIX_OLD = 'https://discord.com/invite/';
|
|
|
|
|
|
- if(inviteUrl == INVITE_URL_PREFIX || inviteUrl == INVITE_URL_PREFIX_OLD ||
|
|
+ if(inviteUrl) {
|
|
- (!inviteUrl.startsWith(INVITE_URL_PREFIX) && !inviteUrl.startsWith(INVITE_URL_PREFIX_OLD))) {
|
|
+ if(inviteUrl == INVITE_URL_PREFIX || inviteUrl == INVITE_URL_PREFIX_OLD ||
|
|
- flag = false;
|
|
+ (!inviteUrl.startsWith(INVITE_URL_PREFIX) && !inviteUrl.startsWith(INVITE_URL_PREFIX_OLD))) {
|
|
|
|
+ flag = false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
|
|
-const getDiscordInviteInfo = (inviteUrl) => {
|
|
+const getDiscordInviteInfo = (inviteUrl, cb) => {
|
|
- let validata = checkInviteUrl(inviteUrl);
|
|
+ if(!inviteUrl) return;
|
|
- console.log(validata, 'validata')
|
|
|
|
- if(!validata) return;
|
|
|
|
getInviteGuildInfo({
|
|
getInviteGuildInfo({
|
|
params: {
|
|
params: {
|
|
inviteUrl
|
|
inviteUrl
|
|
}
|
|
}
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
|
+ cb && cb(res)
|
|
if(res.code == 0) {
|
|
if(res.code == 0) {
|
|
discordInviteInfo.value = res.data;
|
|
discordInviteInfo.value = res.data;
|
|
}
|
|
}
|