diff --git a/src/api/all/propertyMarketing.ts b/src/api/all/propertyMarketing.ts index fe8d6cd..bae28e9 100644 --- a/src/api/all/propertyMarketing.ts +++ b/src/api/all/propertyMarketing.ts @@ -35,8 +35,9 @@ export const getMediaAccountsDetail = (id: string) => { }; // 媒体账号-修改 -export const putMediaAccounts = (id: string) => { - return Http.put(`/v1/media-accounts/${id}`); +export const putMediaAccounts = (params = {}) => { + const { id, ...rest } = params as { id: string; [key: string]: any }; + return Http.put(`/v1/media-accounts/${id}`, rest); }; // 媒体账号-删除 @@ -105,3 +106,18 @@ export const batchPutTag = (params = {}) => { export const batchPutGroup = (params = {}) => { return Http.put(`/v1/media-accounts/batch-group`, params); }; + +// 媒体账号-暂停爬取 +export const pausePatchAccount = (id: string) => { + return Http.patch(`/v1/media-accounts/${id}/pause`); +}; + +// 媒体账号-开始爬取 +export const startPatchAccount = (id: string) => { + return Http.patch(`/v1/media-accounts/${id}/start`); +}; + +// 媒体账号-获取授权图片 +export const getAuthorizedImage = (id: string) => { + return Http.get(`/v1/media-accounts/${id}/authorized-image`); +}; diff --git a/src/assets/img/media-account/icon-feedback-fail.png b/src/assets/img/media-account/icon-feedback-fail.png new file mode 100644 index 0000000..75003e9 Binary files /dev/null and b/src/assets/img/media-account/icon-feedback-fail.png differ diff --git a/src/assets/img/media-account/icon-feedback-success.png b/src/assets/img/media-account/icon-feedback-success.png new file mode 100644 index 0000000..38e859f Binary files /dev/null and b/src/assets/img/media-account/icon-feedback-success.png differ diff --git a/src/assets/img/media-account/icon-warn-2.png b/src/assets/img/media-account/icon-warn-2.png new file mode 100644 index 0000000..e80a01c Binary files /dev/null and b/src/assets/img/media-account/icon-warn-2.png differ diff --git a/src/views/property-marketing/media-account/account-manage/components/account-table/index.vue b/src/views/property-marketing/media-account/account-manage/components/account-table/index.vue index f929af4..3530eaa 100644 --- a/src/views/property-marketing/media-account/account-manage/components/account-table/index.vue +++ b/src/views/property-marketing/media-account/account-manage/components/account-table/index.vue @@ -10,9 +10,7 @@

{{ item.name }}

状态 -
- {{ STATUS_LIST.find((v) => v.value === item.status)?.label ?? '-' }} -
+
平台 @@ -37,31 +35,66 @@
标签
-
+ +
+ {{ `+${item.tags.length - 2}` }} +
+
+ +
{{ tag.name }}
- + - - - + + + + + + +
+ + + diff --git a/src/views/property-marketing/media-account/account-manage/components/authorized-account-modal/style.scss b/src/views/property-marketing/media-account/account-manage/components/authorized-account-modal/style.scss new file mode 100644 index 0000000..a476920 --- /dev/null +++ b/src/views/property-marketing/media-account/account-manage/components/authorized-account-modal/style.scss @@ -0,0 +1,49 @@ +@import '@/views/property-marketing/component.scss'; + +.authorized-account-modal { + border-radius: 8px; + .img-box { + position: relative; + .mask { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0.8; + background: #000; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + color: #fff; + .s1 { + color: var(--BG-White, #fff); + text-align: center; + font-family: 'Alibaba PuHuiTi'; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 22px; + } + } + } + .s2 { + color: var(--Text-1, #211f24); + font-family: 'Alibaba PuHuiTi'; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 22px; + } + .red-text { + overflow: hidden; + color: var(--Functional-Red-6, #f64b31); + text-overflow: ellipsis; + font-family: 'Alibaba PuHuiTi'; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 22px; + } +} diff --git a/src/views/property-marketing/media-account/account-manage/components/batch-group-modal/index.vue b/src/views/property-marketing/media-account/account-manage/components/batch-group-modal/index.vue index 21f7de8..d1bfc55 100644 --- a/src/views/property-marketing/media-account/account-manage/components/batch-group-modal/index.vue +++ b/src/views/property-marketing/media-account/account-manage/components/batch-group-modal/index.vue @@ -75,14 +75,13 @@ const form = reactive({ group_id: null, }); -const accounts = ref([]); // [{id, name}] const accountGroupList = ref([]); // [{id, name, group_id: null}] +const isAllEdit = computed(() => editType.value === 'all'); const open = (accountList = []) => { editType.value = 'all'; groupOptions.value = []; form.group_id = null; - accounts.value = accountList; accountGroupList.value = accountList.map((acc) => ({ ...acc, group_id: null, @@ -114,21 +113,31 @@ const getTags = async () => { const onClose = () => { visible.value = false; - form.tag_ids = []; + form.group_id = null; }; const onSubmit = async () => { + if (isAllEdit.value) { + if (form.group_id === null) { + AMessage.error('请选择分组'); + return; + } + } else { + if (accountGroupList.value.some((item) => item.group_id === null)) { + AMessage.error('请选择分组'); + return; + } + } + + const media_accounts = accountGroupList.value.map((item) => ({ + id: item.id, + group_id: isAllEdit.value ? form.group_id : item.group_id, + })); + // 这里处理批量标签的提交逻辑 - const _params = - editType.value === 'all' - ? { id: -1, group_id: form.group_id } - : accountGroupList.value.map((item) => ({ - id: item.id, - group_id: item.group_id, - })); - const { code } = await batchPutGroup({ media_accounts: _params }); + const { code } = await batchPutGroup({ media_accounts }); if (code === 200) { - AMessage.success('批量分组成功'); + AMessage.success('设置分组成功'); emits('update'); visible.value = false; } diff --git a/src/views/property-marketing/media-account/account-manage/components/batch-tag-modal/index.vue b/src/views/property-marketing/media-account/account-manage/components/batch-tag-modal/index.vue index 99cfceb..7946ecd 100644 --- a/src/views/property-marketing/media-account/account-manage/components/batch-tag-modal/index.vue +++ b/src/views/property-marketing/media-account/account-manage/components/batch-tag-modal/index.vue @@ -31,7 +31,7 @@ @@ -90,18 +90,17 @@ const tagOptions = ref([]); const formRef = ref(); const editType = ref('all'); const form = reactive({ - tag_ids: [], + tags: [], }); -const accounts = ref([]); // [{id, name}] const accountTagList = ref([]); // [{id, name, tags: []}] +const isAllEdit = computed(() => editType.value === 'all'); // 打开弹窗时请求标签数据 const open = (accountList = []) => { editType.value = 'all'; tagOptions.value = []; - form.tag_ids = []; - accounts.value = accountList; + form.tags = []; accountTagList.value = accountList.map((acc) => ({ ...acc, tags: [], @@ -114,19 +113,19 @@ const open = (accountList = []) => { const getTags = async () => { tagOptions.value = [ { - label: '测试', - value: '1', + label: '测试1', + value: '测试1', }, { - label: 'ceshi2', - value: 2, + label: '测试2', + value: '测试2', }, ]; const { code, data } = await fetchAccountTags(); if (code === 200) { tagOptions.value = data.map((item) => ({ label: item.name, - value: item.id, + value: item.name, })); } }; @@ -138,26 +137,36 @@ const handleCreateTag = (inputValue, idx) => { if (typeof idx === 'number') { accountTagList.value[idx].tags.push(inputValue); } else { - form.tag_ids.push(inputValue); + form.tags.push(inputValue); } }; const onClose = () => { visible.value = false; - form.tag_ids = []; + form.tags = []; }; const onSubmit = async () => { - const _params = - editType.value === 'all' - ? { tag_ids: form.tag_ids } - : accountTagList.value.map((item) => ({ - id: item.id, - tag_ids: item.tags, - })); - const { code } = await batchPutTag({ media_accounts: _params }); + if (isAllEdit.value) { + if (form.tags.length === 0) { + AMessage.error('请输入标签'); + return; + } + } else { + if (accountTagList.value.some((item) => item.tags.length === 0)) { + AMessage.error('请输入标签'); + return; + } + } + + const media_accounts = accountTagList.value.map((item) => ({ + id: item.id, + tags: isAllEdit.value ? form.tags : item.tags, + })); + console.log({ media_accounts }); + const { code } = await batchPutTag({ media_accounts }); if (code === 200) { - AMessage.success('批量标签成功'); + AMessage.success('设置标签成功'); emits('update'); visible.value = false; } diff --git a/src/views/property-marketing/media-account/account-manage/components/filter-block/index.vue b/src/views/property-marketing/media-account/account-manage/components/filter-block/index.vue index 87d4a77..cec8c08 100644 --- a/src/views/property-marketing/media-account/account-manage/components/filter-block/index.vue +++ b/src/views/property-marketing/media-account/account-manage/components/filter-block/index.vue @@ -1,3 +1,4 @@ + - - - - - diff --git a/src/views/property-marketing/media-account/account-manage/components/qrCode-modal/style.scss b/src/views/property-marketing/media-account/account-manage/components/qrCode-modal/style.scss deleted file mode 100644 index 8c1aba1..0000000 --- a/src/views/property-marketing/media-account/account-manage/components/qrCode-modal/style.scss +++ /dev/null @@ -1,19 +0,0 @@ -.qrCode-modal { - border-radius: 8px; - - .arco-modal-header { - border-bottom: none; - height: 56px; - padding: 22px 24px 16px 24px; - .arco-modal-title { - justify-content: flex-start; - } - } - .arco-modal-body { - padding: 20px 24px 20px; - } - .arco-modal-footer { - border-top: none; - padding: 0; - } -} diff --git a/src/views/property-marketing/media-account/account-manage/components/reauthorize-account-modal/index.vue b/src/views/property-marketing/media-account/account-manage/components/reauthorize-account-modal/index.vue new file mode 100644 index 0000000..ef84c93 --- /dev/null +++ b/src/views/property-marketing/media-account/account-manage/components/reauthorize-account-modal/index.vue @@ -0,0 +1,201 @@ + + + + + + diff --git a/src/views/property-marketing/media-account/account-manage/components/reauthorize-account-modal/style.scss b/src/views/property-marketing/media-account/account-manage/components/reauthorize-account-modal/style.scss new file mode 100644 index 0000000..40b1640 --- /dev/null +++ b/src/views/property-marketing/media-account/account-manage/components/reauthorize-account-modal/style.scss @@ -0,0 +1,57 @@ +@import '@/views/property-marketing/component.scss'; + +.reauthorize-account-modal { + border-radius: 8px; + .img-box { + position: relative; + .mask { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0.8; + background: #000; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + color: #fff; + .s1 { + color: var(--BG-White, #fff); + text-align: center; + font-family: 'Alibaba PuHuiTi'; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 22px; + } + } + } + .s2 { + color: var(--Text-1, #211f24); + font-family: 'Alibaba PuHuiTi'; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 22px; + } + .red-text { + overflow: hidden; + color: var(--Functional-Red-6, #f64b31); + text-overflow: ellipsis; + font-family: 'Alibaba PuHuiTi'; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 22px; + } + .account-tip-box { + // margin-left: 32px; + width: 100%; + padding: 8px 0px 8px 12px; + + border-radius: 4px; +background: var(--BG-200, #F2F3F5); + } +} diff --git a/src/views/property-marketing/media-account/account-manage/components/status-box/index.vue b/src/views/property-marketing/media-account/account-manage/components/status-box/index.vue new file mode 100644 index 0000000..9a94451 --- /dev/null +++ b/src/views/property-marketing/media-account/account-manage/components/status-box/index.vue @@ -0,0 +1,96 @@ + + + + + + diff --git a/src/views/property-marketing/media-account/account-manage/constants.ts b/src/views/property-marketing/media-account/account-manage/constants.ts index 39ae6fd..967b937 100644 --- a/src/views/property-marketing/media-account/account-manage/constants.ts +++ b/src/views/property-marketing/media-account/account-manage/constants.ts @@ -22,17 +22,46 @@ export const PLATFORM_LIST = [ }, ]; +export enum EnumStatus { + NORMAL = 1, + PAUSE = 3, + UNAUTHORIZED = 0, + ABNORMAL = 2, + ABNORMAL_LOGIN = 4, + ABNORMAL_REQUEST = 5, + ABNORMAL_FREEZE = 6, +} + export const STATUS_LIST = [ { - label: '未授权', - value: 0, + label: '正常', + value: EnumStatus.NORMAL, }, { - label: '正常', - value: 1, + label: '暂停同步', + value: EnumStatus.PAUSE, + }, + { + label: '未授权', + value: EnumStatus.UNAUTHORIZED, }, { label: '异常', - value: 2, + value: EnumStatus.ABNORMAL, + }, + { + label: '异常', + value: EnumStatus.ABNORMAL_LOGIN, + tooltip: '登录状态失效,需重新扫码授权', + }, + { + label: '异常', + value: EnumStatus.ABNORMAL_REQUEST, + tooltip: '请求过于频繁,需等待24小时后重试', + }, + { + label: '异常', + value: EnumStatus.ABNORMAL_FREEZE, + tooltip: '账号被冻结/封禁', }, ]; diff --git a/src/views/property-marketing/media-account/account-manage/index.vue b/src/views/property-marketing/media-account/account-manage/index.vue index bc6fe2f..f21fdbe 100644 --- a/src/views/property-marketing/media-account/account-manage/index.vue +++ b/src/views/property-marketing/media-account/account-manage/index.vue @@ -28,7 +28,7 @@ - +
- + @@ -84,6 +84,7 @@ :selectedItems="selectedItems" @selectionChange="handleSelectionChange" @delete="handleDelete" + @openEdit="handleOpenEdit" />
{ }); const getData = async () => { + console.log('getData'); // const { page, pageSize } = pageInfo; // const { code, data, total } = await getMediaAccounts({ // page, @@ -176,7 +178,7 @@ const getData = async () => { name: '全球', account_id: 1, mobile: 1777777, - status: 1, + status: 0, platform: 0, operator: { name: '小周', @@ -191,6 +193,15 @@ const getData = async () => { { name: '标签2', }, + { + name: '标签3', + }, + { + name: '标签4', + }, + { + name: '标签5', + }, ], }, { @@ -198,7 +209,7 @@ const getData = async () => { name: '全球2', account_id: 1, mobile: 1777777, - status: 1, + status: 4, platform: 0, operator: { name: '小周', @@ -217,13 +228,16 @@ const getData = async () => { }, ]; }; -const handleSearch = (newQuery) => { - query.value = { ...newQuery }; +const reload = () => { + pageInfo.page = 1; + getData(); +}; +const handleSearch = () => { getData(); }; const handleReset = () => { query.value = cloneDeep(INITIAL_QUERY); - getData(); + reload(); }; const onPageChange = (current) => { @@ -232,8 +246,7 @@ const onPageChange = (current) => { }; const onPageSizeChange = (pageSize) => { pageInfo.pageSize = pageSize; - pageInfo.page = 1; - getData(); + reload(); }; const handleOpenGroupModal = () => { @@ -262,12 +275,12 @@ const handleChangeAll = (val) => { }; const handleBatchDelete = () => { const ids = selectedItems.value.map((item) => item.id); - const names = selectedItems.value.map((item) => `“${item.name}”`).join(','); + const names = selectedItems.value.map((item) => `"${item.name}"`).join(','); deleteAccountRef.value?.open({ id: ids, name: names }); }; const handleDelete = (item) => { const { id, name } = item; - deleteAccountRef.value?.open({ id, name: `“${name}”` }); + deleteAccountRef.value?.open({ id, name: `"${name}"` }); }; const handleCloseTip = () => { selectedItems.value = []; @@ -279,6 +292,10 @@ const handleBatchTag = () => { const handleBatchGroup = () => { batchGroupModalRef.value?.open(selectedItems.value); }; +const handleOpenAbnormalAccount = () => { + query.value.status = 2; + reload(); +};