使用后台的进行验证

This commit is contained in:
luyuan 2020-11-16 11:44:46 +08:00
parent edcee2f592
commit 1242882785
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
3 changed files with 32 additions and 11 deletions

View File

@ -2,20 +2,21 @@ import zh from "./zh"
import en from "./en" import en from "./en"
import { getset } from '@/api'; import { getset } from '@/api';
import { geti18n } from '@/utils/i18n'; import { geti18n } from '@/utils/i18n';
import store from '@/store';
getset().then((res: any)=>{ getset().then((res: any)=>{
zh.shichangtishi = `最短${res.timeLowerLimit}min, 最长${res.timeCeiling}min` zh.shichangtishi = `最短${res.timeLowerLimit}min, 最长${res.timeCeiling}min`
en.shichangtishi = `The shortest is ${res.timeLowerLimit}min and the longest is ${res.timeCeiling}min` en.shichangtishi = `The shortest is ${res.timeLowerLimit}min and the longest is ${res.timeCeiling}min`
zh.renshutishi = `最少${res.lowerLimit}人, 最多${res.numberCeiling}` zh.renshutishi = `最少${res.lowerLimit}人, 最多${res.numberCeiling}`
en.renshutishi = `At least ${res.lowerLimit}, at most ${res.numberCeiling}` en.renshutishi = `At least ${res.lowerLimit}, at most ${res.numberCeiling}`
en.shichangtishi = `Minimum ${res.lowerLimit} person, maximum ${res.numberCeiling} people` // en.shichangtishi = `Minimum ${res.lowerLimit} person, maximum ${res.numberCeiling} people`
zh.tixianzhu = `注:每笔提现收取${res.sxf}服务费,最低${ res.symbol + res.minmoney }` zh.tixianzhu = `注:每笔提现收取${res.sxf}服务费,最低${ res.symbol + res.minmoney }`
en.tixianzhu = `Note: ${res.sxf} service fee will be charged for each withdrawal, with a minimum of ${ res.symbol + res.minmoney }` en.tixianzhu = `Note: ${res.sxf} service fee will be charged for each withdrawal, with a minimum of ${ res.symbol + res.minmoney }`
// const i18n = geti18n(); const i18n = geti18n();
// const loc = i18n.locale.value; const loc = i18n.locale.value;
// i18n.locale.value = ''; i18n.locale.value = '';
// i18n.locale.value = loc; i18n.locale.value = loc;
console.log('i18n') console.log('i18n')
store.commit("setseting", res)
}) })
export default { export default {

View File

@ -52,9 +52,23 @@ export default createStore({
zoneid: 1, zoneid: 1,
symbol: "$" symbol: "$"
}, },
islogin: false islogin: false,
seting:{
lowerLimit: "",
minmoney: 0,
minwithdraw: "",
numberCeiling: "",
sxf: "",
symbol: "",
timeCeiling: "",
timeLowerLimit: "",
}
}, },
mutations: { mutations: {
setseting(state, info){
console.log(info, 112)
state.seting = info
},
setUserInfo(state, userinfo){ setUserInfo(state, userinfo){
userinfo.money = userinfo.money.toString() userinfo.money = userinfo.money.toString()
state.userinfo = userinfo state.userinfo = userinfo

View File

@ -221,6 +221,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { import {
computed,
defineComponent, defineComponent,
onBeforeUpdate, onBeforeUpdate,
onMounted, onMounted,
@ -242,6 +243,7 @@ import dayjs from "dayjs";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import router from "@/router"; import router from "@/router";
import { useI18n } from "@/utils/i18n"; import { useI18n } from "@/utils/i18n";
import store from '@/store';
export default defineComponent({ export default defineComponent({
name: "ReleaseWebcast", name: "ReleaseWebcast",
@ -361,6 +363,7 @@ export default defineComponent({
form.value = res; form.value = res;
}); });
} }
const seting = computed(() => store.state.seting)
const onSubmit = (e: FromSend) => { const onSubmit = (e: FromSend) => {
if(!issum){ if(!issum){
message.error(lan.$t("shangchuanwancheng")) message.error(lan.$t("shangchuanwancheng"))
@ -369,6 +372,8 @@ export default defineComponent({
e.preventDefault(); e.preventDefault();
validate() validate()
.then(() => { .then(() => {
console.log(seting.value)
console.log(toRaw(form), 111); console.log(toRaw(form), 111);
const subdata: any = toRaw(form.value); const subdata: any = toRaw(form.value);
if (subdata.title == "") { if (subdata.title == "") {
@ -390,12 +395,13 @@ export default defineComponent({
message.error(lan.$t('zhiborenshuweikong')); message.error(lan.$t('zhiborenshuweikong'));
return; return;
} else { } else {
if(subdata.livetime < 30 || subdata.livetime > 120){ if(subdata.livetime < parseInt(seting.value.timeLowerLimit) || subdata.livetime > parseInt(seting.value.timeCeiling)){
message.error("直播时长最短30min, 最长120min"); // console.log(subdata.livetime, subdata.livetime < seting.value.timeLowerLimit || subdata.livetime > seting.value.timeCeiling)
message.error(lan.$t('shichangtishi'));
return ; return ;
} }
if(subdata.livenumber > 4 || subdata.livenumber < 1){ if(subdata.livenumber > parseInt(seting.value.numberCeiling) || subdata.livenumber < parseInt(seting.value.lowerLimit)){
message.error("直播人数最少1人, 最多4人"); message.error(lan.$t('renshutishi'));
return ; return ;
} }
if (!lives.value.status) { if (!lives.value.status) {