Merge branch 'dev_vite' of ssh://18.167.251.121:10002/aidlab/aida_front into dev_vite
This commit is contained in:
@@ -17,7 +17,8 @@
|
|||||||
<div class="generalModel_btn">
|
<div class="generalModel_btn">
|
||||||
<div class="generalModel_closeIcon" @click.stop="cancelDsign()">
|
<div class="generalModel_closeIcon" @click.stop="cancelDsign()">
|
||||||
<svg
|
<svg
|
||||||
width="100%" height="100%"
|
width="100%"
|
||||||
|
height="100%"
|
||||||
viewBox="0 0 46 46"
|
viewBox="0 0 46 46"
|
||||||
fill="none"
|
fill="none"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@@ -49,7 +50,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="allUserPoeration_center admin_page">
|
<div class="allUserPoeration_center admin_page">
|
||||||
<div class="admin_state_item">
|
<div class="admin_state_item">
|
||||||
<span>{{ $t('admin.UserName') }}: <span>*</span></span>
|
<span>
|
||||||
|
{{ $t('admin.UserName') }}:
|
||||||
|
<span>*</span>
|
||||||
|
</span>
|
||||||
<input
|
<input
|
||||||
v-model="userName"
|
v-model="userName"
|
||||||
:placeholder="$t('admin.enterUserName')"
|
:placeholder="$t('admin.enterUserName')"
|
||||||
@@ -58,7 +62,10 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="admin_state_item">
|
<div class="admin_state_item">
|
||||||
<span>{{ $t('admin.UserEmail') }}: <span>*</span></span>
|
<span>
|
||||||
|
{{ $t('admin.UserEmail') }}:
|
||||||
|
<span>*</span>
|
||||||
|
</span>
|
||||||
<input
|
<input
|
||||||
v-model="userEmail"
|
v-model="userEmail"
|
||||||
:placeholder="$t('admin.enterEmail')"
|
:placeholder="$t('admin.enterEmail')"
|
||||||
@@ -67,7 +74,10 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="admin_state_item">
|
<div class="admin_state_item">
|
||||||
<span>{{ $t('admin.Password') }}: <span>*</span></span>
|
<span>
|
||||||
|
{{ $t('admin.Password') }}:
|
||||||
|
<span>*</span>
|
||||||
|
</span>
|
||||||
<input
|
<input
|
||||||
@focus="focus"
|
@focus="focus"
|
||||||
@blur="blur"
|
@blur="blur"
|
||||||
@@ -87,7 +97,10 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="admin_state_item" v-if="title?.value == 'Edit'">
|
<div class="admin_state_item" v-if="title?.value == 'Edit'">
|
||||||
<span>{{ $t('admin.SubscribePlan') }}: <span>*</span></span>
|
<span>
|
||||||
|
{{ $t('admin.SubscribePlan') }}:
|
||||||
|
<span>*</span>
|
||||||
|
</span>
|
||||||
<a-select
|
<a-select
|
||||||
v-model:value="subscriptionPlanId"
|
v-model:value="subscriptionPlanId"
|
||||||
style="width: 250px"
|
style="width: 250px"
|
||||||
@@ -115,13 +128,13 @@ import {
|
|||||||
onMounted,
|
onMounted,
|
||||||
nextTick,
|
nextTick,
|
||||||
toRefs,
|
toRefs,
|
||||||
computed,
|
computed
|
||||||
} from "vue";
|
} from 'vue'
|
||||||
import { Https } from "@/tool/https";
|
import { Https } from '@/tool/https'
|
||||||
import { Modal, message } from "ant-design-vue";
|
import { Modal, message } from 'ant-design-vue'
|
||||||
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
|
||||||
import { formatTime, isEmail } from "@/tool/util";
|
import { formatTime, isEmail } from '@/tool/util'
|
||||||
import md5 from "md5";
|
import md5 from 'md5'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {},
|
components: {},
|
||||||
@@ -131,9 +144,9 @@ export default defineComponent({
|
|||||||
default: () => []
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ["searchHistoryList"],
|
emits: ['searchHistoryList'],
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const {t} = useI18n()
|
const { t } = useI18n()
|
||||||
const { planOptions } = toRefs(props)
|
const { planOptions } = toRefs(props)
|
||||||
// 筛选出状态为 ACTIVE 的订阅计划
|
// 筛选出状态为 ACTIVE 的订阅计划
|
||||||
const activePlanOptions = computed(() => {
|
const activePlanOptions = computed(() => {
|
||||||
@@ -146,83 +159,83 @@ export default defineComponent({
|
|||||||
operationsModal: false,
|
operationsModal: false,
|
||||||
operationsEdit: false,
|
operationsEdit: false,
|
||||||
loadingShow: false,
|
loadingShow: false,
|
||||||
title: null,
|
title: null
|
||||||
});
|
})
|
||||||
let operationsData = reactive({
|
let operationsData = reactive({
|
||||||
accountId: -1,
|
accountId: -1,
|
||||||
userName: "",
|
userName: '',
|
||||||
userEmail: "",
|
userEmail: '',
|
||||||
password: "",
|
password: '',
|
||||||
oldPassword: "",
|
oldPassword: '',
|
||||||
credits: "",
|
credits: '',
|
||||||
subscriptionPlanId: "",
|
subscriptionPlanId: '',
|
||||||
oldSubscriptionPlanId: ""
|
oldSubscriptionPlanId: ''
|
||||||
});
|
})
|
||||||
let state = ref([
|
let state = ref([
|
||||||
{
|
{
|
||||||
label: "visitor",
|
label: 'visitor',
|
||||||
value: "0",
|
value: '0'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "yearly",
|
label: 'yearly',
|
||||||
value: "1",
|
value: '1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "monthly",
|
label: 'monthly',
|
||||||
value: "2",
|
value: '2'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "trial",
|
label: 'trial',
|
||||||
value: "3",
|
value: '3'
|
||||||
},
|
}
|
||||||
]);
|
])
|
||||||
let init = (funStr, data) => {
|
let init = (funStr, data) => {
|
||||||
operations.operationsModal = true;
|
operations.operationsModal = true
|
||||||
operations.operationsEdit = true;
|
operations.operationsEdit = true
|
||||||
operations.title = funStr;
|
operations.title = funStr
|
||||||
if (funStr.value == "Add") operations.operationsEdit = false;
|
if (funStr.value == 'Add') operations.operationsEdit = false
|
||||||
if (funStr.value == "Edit") {
|
if (funStr.value == 'Edit') {
|
||||||
operationsData.accountId = data.id;
|
operationsData.accountId = data.id
|
||||||
operationsData.userName = data.userName;
|
operationsData.userName = data.userName
|
||||||
operationsData.userEmail = data.userEmail;
|
operationsData.userEmail = data.userEmail
|
||||||
operationsData.password = data.userPassword?data.userPassword:null;
|
operationsData.password = data.userPassword ? data.userPassword : null
|
||||||
operationsData.oldPassword = data.userPassword;
|
operationsData.oldPassword = data.userPassword
|
||||||
// operationsData.validStartTime='2024-08-05T00:00:06'
|
// operationsData.validStartTime='2024-08-05T00:00:06'
|
||||||
// operationsData.validEndTime='2024-08-05T00:00:06'
|
// operationsData.validEndTime='2024-08-05T00:00:06'
|
||||||
operationsData.credits = data.creditsUsageLimit;
|
operationsData.credits = data.creditsUsageLimit
|
||||||
operationsData.subscriptionPlanId = data.subscriptionPlanId || "";
|
operationsData.subscriptionPlanId = data.subscriptionPlanId || ''
|
||||||
operationsData.oldSubscriptionPlanId = data.subscriptionPlanId || "";
|
operationsData.oldSubscriptionPlanId = data.subscriptionPlanId || ''
|
||||||
// operationsData.accountId = data.accountId
|
// operationsData.accountId = data.accountId
|
||||||
// operationsData.userName = data.userName
|
// operationsData.userName = data.userName
|
||||||
// operationsData.userEmail = data.userEmail
|
// operationsData.userEmail = data.userEmail
|
||||||
// operationsData.validStartTime = formatTime(data.validStartTime)
|
// operationsData.validStartTime = formatTime(data.validStartTime)
|
||||||
// operationsData.validEndTime = formatTime(data.validEndTime)
|
// operationsData.validEndTime = formatTime(data.validEndTime)
|
||||||
}
|
}
|
||||||
if (funStr.value == "Add") {
|
if (funStr.value == 'Add') {
|
||||||
operationsData.subscriptionPlanId = "";
|
operationsData.subscriptionPlanId = ''
|
||||||
operationsData.oldSubscriptionPlanId = "";
|
operationsData.oldSubscriptionPlanId = ''
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
let focus = (event) => {
|
let focus = event => {
|
||||||
if (operationsData.password == operationsData.oldPassword) {
|
if (operationsData.password == operationsData.oldPassword) {
|
||||||
operationsData.password = "";
|
operationsData.password = ''
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
let blur = (event) => {
|
let blur = event => {
|
||||||
console.log(operationsData.password == "" && operationsData.oldPassword);
|
console.log(operationsData.password == '' && operationsData.oldPassword)
|
||||||
if (operationsData.password == "" && operationsData.oldPassword) {
|
if (operationsData.password == '' && operationsData.oldPassword) {
|
||||||
operationsData.password = operationsData.oldPassword;
|
operationsData.password = operationsData.oldPassword
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
let setAddData = () => {
|
let setAddData = () => {
|
||||||
return {
|
return {
|
||||||
creditsUsageLimit: operationsData.credits,
|
creditsUsageLimit: operationsData.credits,
|
||||||
userEmail: operationsData.userEmail,
|
userEmail: operationsData.userEmail,
|
||||||
userPassword: operationsData.password?md5(operationsData.password + "abc"):'',
|
userPassword: operationsData.password ? md5(operationsData.password + 'abc') : '',
|
||||||
userName: operationsData.userName,
|
userName: operationsData.userName,
|
||||||
subscriptionPlanId: operationsData.subscriptionPlanId
|
subscriptionPlanId: operationsData.subscriptionPlanId
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
let setEditData = () => {
|
let setEditData = () => {
|
||||||
return {
|
return {
|
||||||
id: operationsData.accountId,
|
id: operationsData.accountId,
|
||||||
@@ -232,75 +245,63 @@ export default defineComponent({
|
|||||||
userPassword:
|
userPassword:
|
||||||
operationsData.password == operationsData.oldPassword
|
operationsData.password == operationsData.oldPassword
|
||||||
? null
|
? null
|
||||||
: md5(operationsData.password + "abc"),
|
: md5(operationsData.password + 'abc'),
|
||||||
subscriptionPlanId: operationsData.subscriptionPlanId
|
subscriptionPlanId: operationsData.subscriptionPlanId
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
let cancelDsign = () => {
|
let cancelDsign = () => {
|
||||||
operationsData.accountId = -1;
|
operationsData.accountId = -1
|
||||||
operationsData.userName = "";
|
operationsData.userName = ''
|
||||||
operationsData.userEmail = "";
|
operationsData.userEmail = ''
|
||||||
operationsData.password = "";
|
operationsData.password = ''
|
||||||
operationsData.credits = "";
|
operationsData.credits = ''
|
||||||
operationsData.subscriptionPlanId = "";
|
operationsData.subscriptionPlanId = ''
|
||||||
operationsData.oldSubscriptionPlanId = "";
|
operationsData.oldSubscriptionPlanId = ''
|
||||||
operations.operationsModal = false;
|
operations.operationsModal = false
|
||||||
};
|
}
|
||||||
let setOk = () => {
|
let setOk = () => {
|
||||||
let data;
|
let data
|
||||||
if (operations.title?.value == "Add") {
|
if (operations.title?.value == 'Add') {
|
||||||
data = setAddData();
|
data = setAddData()
|
||||||
if (!isEmail(data.userEmail)) {
|
if (!isEmail(data.userEmail)) {
|
||||||
message.info(t('admin.jsContent1'));
|
message.info(t('admin.jsContent1'))
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (
|
if (!data.userName || !data.userEmail || !data.userPassword)
|
||||||
!data.userName ||
|
return message.warning(t('admin.jsContent2'))
|
||||||
!data.userEmail ||
|
Https.axiosPost(Https.httpUrls.addOrUpdateSubAccount, data).then(rv => {
|
||||||
!data.userPassword
|
if (rv) {
|
||||||
)
|
cancelDsign()
|
||||||
return message.warning(t('admin.jsContent2'));
|
emit('searchHistoryList')
|
||||||
Https.axiosPost(Https.httpUrls.addOrUpdateSubAccount, data).then(
|
|
||||||
(rv) => {
|
|
||||||
if (rv) {
|
|
||||||
cancelDsign();
|
|
||||||
emit("searchHistoryList");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
})
|
||||||
} else {
|
} else {
|
||||||
data = setEditData();
|
data = setEditData()
|
||||||
if (!isEmail(data.userEmail)) {
|
if (!isEmail(data.userEmail)) {
|
||||||
message.info("The email format is incorrect");
|
message.info('The email format is incorrect')
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (!data.userName || !data.userEmail || !data.subscriptionPlanId)
|
if (!data.userName || !data.userEmail || !data.subscriptionPlanId)
|
||||||
return message.warning("Please check the input box marked with *");
|
return message.warning('Please check the input box marked with *')
|
||||||
const needSwitchPlan =
|
const needSwitchPlan =
|
||||||
operationsData.subscriptionPlanId &&
|
operationsData.subscriptionPlanId &&
|
||||||
operationsData.subscriptionPlanId !==
|
operationsData.subscriptionPlanId !== operationsData.oldSubscriptionPlanId
|
||||||
operationsData.oldSubscriptionPlanId;
|
Https.axiosPost(Https.httpUrls.addOrUpdateSubAccount, data).then(async rv => {
|
||||||
Https.axiosPost(Https.httpUrls.addOrUpdateSubAccount, data).then(
|
if (rv) {
|
||||||
(rv) => {
|
if (needSwitchPlan) {
|
||||||
if (rv) {
|
await Https.axiosGet(Https.httpUrls.switchSubAccountSubscribePlan, {
|
||||||
if (needSwitchPlan) {
|
params: {
|
||||||
Https.axiosGet(
|
targetSubscriptionPlanId: operationsData.subscriptionPlanId,
|
||||||
Https.httpUrls.switchSubAccountSubscribePlan,
|
subAccId: operationsData.accountId
|
||||||
{
|
}
|
||||||
params: {
|
})
|
||||||
targetSubscriptionPlanId: operationsData.subscriptionPlanId,
|
|
||||||
subAccId: operationsData.accountId,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
cancelDsign();
|
|
||||||
emit("searchHistoryList");
|
|
||||||
}
|
}
|
||||||
|
cancelDsign()
|
||||||
|
emit('searchHistoryList')
|
||||||
}
|
}
|
||||||
);
|
})
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
return {
|
return {
|
||||||
...toRefs(operations),
|
...toRefs(operations),
|
||||||
...toRefs(operationsData),
|
...toRefs(operationsData),
|
||||||
@@ -312,14 +313,14 @@ export default defineComponent({
|
|||||||
setOk,
|
setOk,
|
||||||
planOptions,
|
planOptions,
|
||||||
activePlanOptions
|
activePlanOptions
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {}
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {},
|
methods: {}
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
:deep(.allUserPoeration_modal) {
|
:deep(.allUserPoeration_modal) {
|
||||||
|
|||||||
@@ -171,7 +171,6 @@ import {
|
|||||||
computed,
|
computed,
|
||||||
reactive,
|
reactive,
|
||||||
toRefs,
|
toRefs,
|
||||||
onMounted,
|
|
||||||
unref,
|
unref,
|
||||||
watch
|
watch
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
@@ -650,12 +649,35 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let historyTable: any = this.$refs.historyTable
|
this.updateTableHeight()
|
||||||
this.historyTableHeight = historyTable.clientHeight - 200
|
window.addEventListener('resize', this.updateTableHeight)
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
window.removeEventListener('resize', this.updateTableHeight)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
updateTableHeight() {
|
||||||
|
const historyTable: any = this.$refs.historyTable
|
||||||
|
if (historyTable) {
|
||||||
|
// 为底部分页器预留固定空间,使表格部分高度固定且分页器始终可见
|
||||||
|
this.historyTableHeight = historyTable.clientHeight - 200
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
.admin_page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.admin_table_content {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
.admin_page .admin_table_search .admin_state {
|
.admin_page .admin_table_search .admin_state {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
|
|||||||
@@ -249,6 +249,7 @@
|
|||||||
value-format="X"
|
value-format="X"
|
||||||
style="width: 250px"
|
style="width: 250px"
|
||||||
:disabledDate="disabledDate"
|
:disabledDate="disabledDate"
|
||||||
|
:show-time="{ format: 'HH:mm' }"
|
||||||
class="range_picker"
|
class="range_picker"
|
||||||
placeholder="Select the start time"
|
placeholder="Select the start time"
|
||||||
>
|
>
|
||||||
@@ -265,6 +266,8 @@
|
|||||||
<a-date-picker
|
<a-date-picker
|
||||||
v-model:value="formState.currentPeriodEnd"
|
v-model:value="formState.currentPeriodEnd"
|
||||||
value-format="X"
|
value-format="X"
|
||||||
|
:show-time="{ format: 'HH:mm' }"
|
||||||
|
:disabledDate="disabledDate"
|
||||||
style="width: 250px"
|
style="width: 250px"
|
||||||
class="range_picker"
|
class="range_picker"
|
||||||
placeholder="Select the end time"
|
placeholder="Select the end time"
|
||||||
|
|||||||
Reference in New Issue
Block a user