@@ -11,15 +11,3 @@ export function getMenuNavApi() { | |||
method: 'get', | |||
}) | |||
} | |||
/** | |||
* @description:用户角色 | |||
* @param | |||
* @return: | |||
*/ | |||
export function getUser() { | |||
return request({ | |||
url: `/user/getUser`, | |||
method: 'get', | |||
}) | |||
} |
@@ -50,6 +50,18 @@ export function saveMallUserInfo(data) { | |||
}) | |||
} | |||
/** | |||
* @description 修改登录账号 详情 | |||
* @param {*} data | |||
* @returns data | |||
*/ | |||
export function getMallUserInfo(id) { | |||
return request({ | |||
url: `/serviceInfo/getMallUserInfo?serviceId=${id}`, | |||
method: 'get' | |||
}) | |||
} | |||
/** | |||
* @description 设置时长 | |||
* @param {*} data | |||
@@ -0,0 +1,36 @@ | |||
import request from "@/utils/request.js"; | |||
/** | |||
* @description:用户角色 | |||
* @param | |||
* @return: | |||
*/ | |||
export function getUser() { | |||
return request({ | |||
url: `/user/getUser`, | |||
method: 'get', | |||
}) | |||
} | |||
/** | |||
* @description: api 剩余时长 | |||
* @param | |||
* @return: | |||
*/ | |||
export function current() { | |||
return request({ | |||
url: `/serviceInfo/current`, | |||
method: 'get', | |||
}) | |||
} | |||
/** | |||
* @description: 私有化 剩余时长 | |||
* @param | |||
* @return: | |||
*/ | |||
export function privateDeployAdminCurrent() { | |||
return request({ | |||
url: `/serviceInfo/privateDeployAdminCurrent`, | |||
method: 'get', | |||
}) | |||
} |
@@ -17,6 +17,19 @@ export function loginApi(data) { | |||
}) | |||
} | |||
/** | |||
* @description 退出登录 | |||
* @params email,password,code | |||
* @returns data | |||
*/ | |||
export function logoutApi(data) { | |||
return request({ | |||
// url: `/api/user/loginByEmail`, | |||
url: `/logout`, | |||
method: 'get' | |||
}) | |||
} | |||
/** | |||
/** | |||
* @description:重新发送邮件 | |||
@@ -0,0 +1,13 @@ | |||
import request from "@/utils/request.js"; | |||
/** | |||
* @description 获取合作商列表 | |||
* @param {*} (pageNum,pageSize) | |||
* @returns data | |||
*/ | |||
export function templateListApi(pageNum, pageSize) { | |||
return request({ | |||
url: `/personMould/serviceMouldList?pageNum=${pageNum}&pageSize=${pageSize}`, | |||
method: 'get' | |||
}) | |||
} |
@@ -1,3 +1,10 @@ | |||
<!-- | |||
* @Autor: Chutingting | |||
* @Date: 2023-11-02 11:32:51 | |||
* @LastEditors: Chutingting | |||
* @LastEditTime: 2023-11-08 16:06:12 | |||
* @Description: | |||
--> | |||
<script setup lang="ts"> | |||
import { useTagsViewStore } from "@/store/modules/tagsView"; | |||
@@ -23,6 +30,7 @@ const tagsViewStore = useTagsViewStore(); | |||
width: 100%; | |||
/* 50= navbar 50 */ | |||
min-height: calc(100vh - 80px); | |||
background: #fff; | |||
// overflow: hidden; | |||
// background-color: var(--el-bg-color-page); | |||
// background-color: #000; | |||
@@ -17,71 +17,23 @@ | |||
background-color="#000" | |||
text-color="#fff" | |||
class="el-menu-vertical-demo"> | |||
<el-menu-item index="1" @click="router.push('/apiManage')"> | |||
<el-menu-item index="1" @click="router.push('/home')"> | |||
<el-icon><i-ep-House /></el-icon> | |||
<span>首页</span> | |||
</el-menu-item> | |||
<el-menu-item index="2" @click="router.push('/apiManage')"> | |||
<el-icon><i-ep-link /></el-icon> | |||
<span>API接入方管理</span> | |||
</el-menu-item> | |||
<el-menu-item index="2" @click="router.push('/privatization')"> | |||
<el-menu-item index="3" @click="router.push('/privatization')"> | |||
<el-icon><i-ep-edit /></el-icon> | |||
<span>私有化客户管理</span> | |||
</el-menu-item> | |||
<el-menu-item index="3" @click="router.push('/editPass')"> | |||
<el-menu-item index="4" @click="router.push('/template')"> | |||
<el-icon><i-ep-edit /></el-icon> | |||
<span>修改密码</span> | |||
<span>模版管理</span> | |||
</el-menu-item> | |||
</el-menu> | |||
<!-- 动态路由 --> | |||
<!-- <div | |||
v-for="item in MenuList" | |||
:key="item.id" | |||
class="myRouter-item" | |||
@click="showChildrenRouter = item.name" | |||
> | |||
<div class="icon"> | |||
<el-icon><i-ep-edit /></el-icon> | |||
<span>{{ item.name }}</span> | |||
</div> | |||
<div | |||
v-show="showChildrenRouter == item.name" | |||
v-for="childrens in item.children" | |||
:key="childrens.id" | |||
class="childrenRouter" | |||
@click="router.push(`/${childrens.url}`)" | |||
> | |||
{{ childrens.name }} | |||
</div> | |||
</div> --> | |||
<!-- 固定路由 --> | |||
<!-- <div class="myRouter-item" @click="router.push('/apiManage')"> | |||
<div class="icon"> | |||
<el-icon><i-ep-edit /></el-icon> | |||
API接入方管理 | |||
</div> | |||
</div> | |||
<div class="myRouter-item" @click="router.push('/model')"> | |||
<div class="icon"> | |||
<el-icon><i-ep-edit /></el-icon> | |||
私有化客户管理 | |||
</div> | |||
</div> | |||
<div class="myRouter-item" @click="router.push('/model')"> | |||
<div class="icon"> | |||
<el-icon><i-ep-edit /></el-icon> | |||
密钥查看 | |||
</div> | |||
</div> | |||
<div class="myRouter-item" @click="router.push('/model')"> | |||
<div class="icon"> | |||
<el-icon><i-ep-edit /></el-icon> | |||
模板管理 | |||
</div> | |||
</div> | |||
<div class="myRouter-item" @click="router.push('/editPass')"> | |||
<div class="icon"> | |||
<el-icon><i-ep-edit /></el-icon> | |||
修改密码 | |||
</div> | |||
</div> --> | |||
</div> | |||
</div> | |||
<!-- 右边显示部分 --> | |||
@@ -99,30 +51,13 @@ | |||
<lang-select class="navItem" /> | |||
</el-tooltip> | |||
<!-- 登录 --> | |||
<el-dropdown> | |||
<span class="el-dropdown-link"> | |||
我的 | |||
<el-icon class="el-icon--right"> | |||
<arrow-down /> | |||
</el-icon> | |||
</span> | |||
<template #dropdown> | |||
<el-dropdown-menu> | |||
<el-dropdown-item>账户时长</el-dropdown-item> | |||
<el-dropdown-item>密钥查看</el-dropdown-item> | |||
<el-dropdown-item>模板管理</el-dropdown-item> | |||
<el-dropdown-item @click="showEditPasswordDialog = true">修改密码</el-dropdown-item> | |||
</el-dropdown-menu> | |||
</template> | |||
</el-dropdown> | |||
<div class="navItem" v-if="!AccessToken" @click="router.push('login')"> | |||
<div class="navItem" v-if="!isLogin" @click="router.push('login')"> | |||
{{ $t("navbar.goLogin") }} | |||
</div> | |||
<!-- 注销 --> | |||
<div | |||
v-if="isLogin" | |||
class="navItem" | |||
v-if="AccessToken" | |||
@click="logout" | |||
style="margin-left: 10px" | |||
> | |||
@@ -150,8 +85,9 @@ import { useAppStore } from "@/store/modules/app"; | |||
// import { useSettingsStore } from "@/store/modules/settings"; | |||
import { useRoute, useRouter } from "vue-router"; | |||
import { useI18n } from "vue-i18n"; | |||
import { getMenuNavApi, getUser } from "@/apis/Permission.js"; | |||
import { getMenuNavApi } from "@/apis/Permission.js"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
import { logoutApi } from '@/apis/login.js' | |||
const userInfoPinia = userInfoModules(); | |||
const route = useRoute(); | |||
@@ -174,8 +110,10 @@ function logout() { | |||
confirmButtonText: confirm, | |||
cancelButtonText: cancel, | |||
}).then(() => { | |||
userInfoPinia.loginOut(); | |||
router.push(`/login`); | |||
logoutApi().then(res => { | |||
userInfoPinia.loginOut(); | |||
router.push(`/login`); | |||
}) | |||
localStorage.removeItem("AccessToken"); | |||
}); | |||
} | |||
@@ -213,7 +151,6 @@ function handleOutsideClick() { | |||
onMounted(() => { | |||
getMenuNavFunc(); | |||
isAdminFn() | |||
}); | |||
//#region 联系我们弹窗 | |||
const showTalkUsDialog = ref(false); | |||
@@ -239,18 +176,8 @@ const showChildrenRouter = ref(""); | |||
//#endregion ------------------------------------ | |||
// 修改密码 | |||
const showEditPasswordDialog = ref(false); | |||
const updateShowEditPassDialog = () => { | |||
showEditPasswordDialog.value = false | |||
} | |||
const isLogin = ref(false); | |||
const isAdmin = ref(''); | |||
function isAdminFn() { | |||
getUser().then(res => { | |||
isAdmin.value = res.data.isAdmin // isAdmin=1,为管理人员(邃芒后台) , isAdmin=0,为API接入方登录后台 | |||
}) | |||
} | |||
</script> | |||
@@ -154,28 +154,21 @@ export const constantRoutes: RouteRecordRaw[] = [ | |||
{ | |||
path: "/", | |||
component: Layout, | |||
redirect: "/editPass", | |||
redirect: "/home", | |||
children: [ | |||
{ | |||
path: "editPass", | |||
component: () => import("@/views/editPass/index.vue"), | |||
name: "editPass", | |||
path: "/home", | |||
component: () => import("@/views/home/index.vue"), | |||
name: "home", | |||
meta: { | |||
title: "editPass", | |||
icon: "homepage", | |||
title: "home", | |||
icon: "home", | |||
affix: true, | |||
name: "ruleListMangage.title", | |||
}, | |||
}, | |||
], | |||
}, | |||
{ | |||
path: "/", | |||
component: Layout, | |||
redirect: "/apiManage", | |||
children: [ | |||
{ | |||
path: "apiManage", | |||
path: "/apiManage", | |||
component: () => import("@/views/apiManage/index.vue"), | |||
name: "apiManage", | |||
meta: { | |||
@@ -185,15 +178,8 @@ export const constantRoutes: RouteRecordRaw[] = [ | |||
name: "ruleListMangage.title", | |||
}, | |||
}, | |||
], | |||
}, | |||
{ | |||
path: "/", | |||
component: Layout, | |||
redirect: "/privatization", | |||
children: [ | |||
{ | |||
path: "privatization", | |||
path: "/privatization", | |||
component: () => import("@/views/privatization/index.vue"), | |||
name: "privatization", | |||
meta: { | |||
@@ -203,6 +189,17 @@ export const constantRoutes: RouteRecordRaw[] = [ | |||
name: "ruleListMangage.title", | |||
}, | |||
}, | |||
{ | |||
path: "/template", | |||
component: () => import("@/views/template/index.vue"), | |||
name: "template", | |||
meta: { | |||
title: "template", | |||
icon: "homepage", | |||
affix: true, | |||
name: "ruleListMangage.title", | |||
}, | |||
}, | |||
], | |||
} | |||
]; | |||
@@ -25,6 +25,7 @@ export const useUserStore = defineStore("user", () => { | |||
* @returns | |||
*/ | |||
function login(loginData: LoginData) { | |||
debugger | |||
return new Promise<void>((resolve, reject) => { | |||
loginApi(loginData) | |||
.then((response) => { | |||
@@ -1,3 +1,10 @@ | |||
/* | |||
* @Autor: Chutingting | |||
* @Date: 2023-11-02 11:32:51 | |||
* @LastEditors: Chutingting | |||
* @LastEditTime: 2023-11-08 10:26:54 | |||
* @Description: | |||
*/ | |||
import { defineStore } from "pinia"; | |||
import { store } from "@/store"; | |||
import { | |||
@@ -14,6 +14,7 @@ declare module '@vue/runtime-core' { | |||
EditPosition: typeof import('./../components/EditPosition.vue')['default'] | |||
'EditPosition copy': typeof import('./../components/EditPosition copy.vue')['default'] | |||
ElButton: typeof import('element-plus/es')['ElButton'] | |||
ElCard: typeof import('element-plus/es')['ElCard'] | |||
ElDialog: typeof import('element-plus/es')['ElDialog'] | |||
ElDropdown: typeof import('element-plus/es')['ElDropdown'] | |||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] | |||
@@ -35,11 +36,17 @@ declare module '@vue/runtime-core' { | |||
GithubCorner: typeof import('./../components/GithubCorner/index.vue')['default'] | |||
Hamburger: typeof import('./../components/Hamburger/index.vue')['default'] | |||
IconSelect: typeof import('./../components/IconSelect/index.vue')['default'] | |||
IEpAvatar: typeof import('~icons/ep/avatar')['default'] | |||
IEpClock: typeof import('~icons/ep/clock')['default'] | |||
IEpDocument: typeof import('~icons/ep/document')['default'] | |||
IEpEdit: typeof import('~icons/ep/edit')['default'] | |||
IEpHouse: typeof import('~icons/ep/house')['default'] | |||
IEpIconMenu: typeof import('~icons/ep/icon-menu')['default'] | |||
IEpLink: typeof import('~icons/ep/link')['default'] | |||
IEpPlus: typeof import('~icons/ep/plus')['default'] | |||
IEpPointer: typeof import('~icons/ep/pointer')['default'] | |||
IEpUser: typeof import('~icons/ep/user')['default'] | |||
IEpUserFilled: typeof import('~icons/ep/user-filled')['default'] | |||
LangSelect: typeof import('./../components/LangSelect/index.vue')['default'] | |||
MultiUpload: typeof import('./../components/Upload/MultiUpload.vue')['default'] | |||
MyLoading: typeof import('./../components/myLoading.vue')['default'] | |||
@@ -27,11 +27,11 @@ const request = axios.create({ | |||
request.interceptors.request.use( | |||
function (config) { | |||
// 给所有授权的请求提供token | |||
const AccessToken = localStorage.getItem("AccessToken") | |||
if (AccessToken) { | |||
config.headers.token = AccessToken | |||
} | |||
// // 给所有授权的请求提供token | |||
// const AccessToken = localStorage.getItem("AccessToken") | |||
// if (AccessToken) { | |||
// config.headers.token = AccessToken | |||
// } | |||
return config | |||
}, | |||
function (error) { | |||
@@ -1,411 +0,0 @@ | |||
<template> | |||
<div class="page justify-around"> | |||
<div class="addbtn"> | |||
<el-button type="primary" @click="dialogVisible = true"><el-icon><i-ep-plus /></el-icon>新增</el-button> | |||
</div> | |||
<el-table | |||
:data="tableData" | |||
style="width: 100%; height: 90%" | |||
size="large" | |||
border | |||
> | |||
<el-table-column | |||
prop="name" | |||
:label="$t('businessMangage.name')" | |||
align="center" | |||
/> | |||
<el-table-column | |||
prop="address" | |||
:label="$t('businessMangage.address')" | |||
align="center" | |||
/> | |||
<el-table-column | |||
prop="status" | |||
:label="$t('businessMangage.status')" | |||
align="center" | |||
> | |||
<template #default="scope"> | |||
<span | |||
:style="1 * scope.row.status ? 'color: #ff0000' : 'color: #36db43'" | |||
>{{ getStatus(scope.row.status) }}</span | |||
> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="code" | |||
:label="$t('businessMangage.code')" | |||
width="200" | |||
align="center" | |||
/> | |||
<el-table-column | |||
prop="createTime" | |||
:label="$t('businessMangage.createTime')" | |||
width="200" | |||
align="center" | |||
> | |||
<template #default="scope"> | |||
{{ getDate(scope.row.createTime) }} | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
fixed="right" | |||
:label="$t('keyMangage.operations')" | |||
width="200" | |||
align="center" | |||
> | |||
<template #default="scope"> | |||
<el-button | |||
link | |||
type="primary" | |||
size="small" | |||
@click="showDetail(scope.row.id)" | |||
>查看密钥</el-button | |||
> | |||
<el-button | |||
link | |||
type="primary" | |||
size="small" | |||
@click="showDetail(scope.row.id)" | |||
>充值时长</el-button> | |||
<el-button | |||
link | |||
type="primary" | |||
size="small" | |||
@click="showDetail(scope.row.id)" | |||
>已关联模版</el-button> | |||
<el-button | |||
link | |||
type="primary" | |||
size="small" | |||
@click="showDetail(scope.row.id)" | |||
>关联模版</el-button> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<el-dialog | |||
v-model="dialogVisible" | |||
:title="$t('businessMangage.addNew')" | |||
width="35%" | |||
:before-close="handleClose" | |||
> | |||
<div class="formData"> | |||
<el-form | |||
ref="ruleForm" | |||
label-position="left" | |||
label-width="120px" | |||
:model="formData" | |||
:rules="rules" | |||
> | |||
<el-form-item :label="'用户名' + ':'" prop="username"> | |||
<el-input | |||
v-model="formData.username" | |||
:placeholder="$t('businessMangage.nameInputText')" | |||
/> | |||
</el-form-item> | |||
<el-form-item | |||
:label="'姓名' + ':'" | |||
prop="name" | |||
> | |||
<el-input | |||
v-model="formData.name" | |||
:placeholder="$t('businessMangage.addressInputText')" | |||
/> | |||
</el-form-item> | |||
<el-form-item :label="'密码' + ':'" prop="password"> | |||
<el-input | |||
v-model="formData.password" | |||
:placeholder="$t('businessMangage.codeInputText')" | |||
/> | |||
</el-form-item> | |||
<el-form-item | |||
:label="'手机号' + ':'" | |||
prop="phone" | |||
> | |||
<el-input | |||
v-model="formData.phone" | |||
:placeholder="$t('businessMangage.codeInputText')" | |||
/> | |||
</el-form-item> | |||
</el-form> | |||
</div> | |||
<template #footer> | |||
<span class="dialog-footer"> | |||
<el-button @click="dialogVisible = false">{{ | |||
$t("businessMangage.cancel") | |||
}}</el-button> | |||
<el-button type="primary" @click="addNew(ruleForm)"> | |||
{{ $t("businessMangage.confirm") }} | |||
</el-button> | |||
</span> | |||
</template> | |||
</el-dialog> | |||
<!-- 设置时长 --> | |||
<!-- <el-dialog | |||
v-model="dialogVisible" | |||
:title="$t('businessMangage.addNew')" | |||
width="35%" | |||
:before-close="handleClose" | |||
> | |||
<div class="formData"> | |||
<el-form | |||
ref="ruleForm" | |||
label-position="left" | |||
label-width="120px" | |||
:model="formDataTime" | |||
:rules="rulesTime" | |||
> | |||
<el-form-item :label="'时长' + ':'" prop="times"> | |||
<el-input v-model="formData.times" placeholder="请输入时长"> | |||
<template #append>秒</template> | |||
</el-input> | |||
</el-form-item> | |||
</el-form> | |||
</div> | |||
<template #footer> | |||
<span class="dialog-footer"> | |||
<el-button @click="dialogVisible = false">{{ | |||
$t("businessMangage.cancel") | |||
}}</el-button> | |||
<el-button type="primary" @click="addNew(ruleForm)"> | |||
{{ $t("businessMangage.confirm") }} | |||
</el-button> | |||
</span> | |||
</template> | |||
</el-dialog> --> | |||
<div class="pagination"> | |||
<el-pagination | |||
v-model:current-page="pageNum" | |||
v-model:page-size="pageSize" | |||
:page-sizes="[10, 50, 100]" | |||
:small="false" | |||
:disabled="false" | |||
:background="true" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="total" | |||
@size-change="handleSizeChange" | |||
@current-change="handleCurrentChange" | |||
/> | |||
</div> | |||
</div> | |||
</template> | |||
<!-- videoType==1为竖,==2为横 --> | |||
<script setup> | |||
//#region 导入 | |||
import { linkEmits } from "element-plus"; | |||
import { getCurrentInstance } from "vue"; | |||
import { apiManageListApi, addApiManage } from "@/apis/apiManage.js"; | |||
import { useI18n } from "vue-i18n"; | |||
import dayjs from "dayjs"; | |||
import { useRoute, useRouter } from "vue-router"; | |||
const route = useRoute(); | |||
const router = useRouter(); | |||
const { locale } = useI18n(); | |||
const lanChange = ref(locale); | |||
const tableData = ref([]); | |||
const dialogVisible = ref(false); | |||
const showDetail = (id) => { | |||
router.push({ | |||
path: "/businessCheck", | |||
query: { | |||
id, | |||
}, | |||
}); | |||
}; | |||
const pageNum = ref(1); | |||
const pageSize = ref(10); | |||
const total = ref(0); | |||
const getStatus = (val) => { | |||
return val * 1 ? "锁定" : "正常"; | |||
}; | |||
const getDate = (val) => { | |||
return dayjs(val).format("YYYY-MM-DD"); | |||
}; | |||
const handleSizeChange = (val) => { | |||
pageSize.value = val; | |||
getApiManageListFunc(pageNum.value, pageSize.value); | |||
}; | |||
const handleCurrentChange = (val) => { | |||
pageNum.value = val; | |||
getApiManageListFunc(pageNum.value, pageSize.value); | |||
}; | |||
const getApiManageListFunc = async (PageNum, PageSize) => { | |||
try { | |||
const res = await apiManageListApi(PageNum, PageSize); | |||
console.log(res, "res"); | |||
tableData.value = res.data.list; | |||
total.value = res.data.total * 1; | |||
} catch (error) { | |||
console.log(error, "err"); | |||
} | |||
}; | |||
const formData = ref({ | |||
id: "", | |||
username: "", | |||
name: "", | |||
password: "", | |||
phone: "" | |||
}); | |||
const rules = { | |||
username: [ | |||
{ | |||
required: true, | |||
message: "Please input username", | |||
trigger: "blur", | |||
}, | |||
], | |||
name: [ | |||
{ | |||
required: true, | |||
message: "Please input name", | |||
trigger: "blur", | |||
}, | |||
], | |||
password: [ | |||
{ | |||
required: true, | |||
message: "Please input code", | |||
trigger: "blur", | |||
}, | |||
], | |||
phone: [ | |||
{ | |||
required: true, | |||
message: "Please select access methods", | |||
trigger: "blur", | |||
}, | |||
], | |||
}; | |||
const accessMethods = ref([ | |||
{ | |||
label: "api接入", | |||
value: 1, | |||
}, | |||
{ | |||
label: "私有化接入", | |||
value: 2, | |||
}, | |||
]); | |||
const handleClose = () => { | |||
dialogVisible.value = false; | |||
setTimeout(() => { | |||
formData.value = { | |||
id: "", | |||
username: "", | |||
name: "", | |||
password: "", | |||
phone: "" | |||
}; | |||
}, 500); | |||
}; | |||
const ruleForm = ref(); | |||
const addNew = async (refForm) => { | |||
if (!refForm) return; | |||
await refForm.validate(async (valid, fields) => { | |||
if (valid) { | |||
const data = formData.value; | |||
try { | |||
const res = await addApiManage(data); | |||
console.log(res, "res"); | |||
if (res.code == 200) { | |||
ElMessage.success("添加成功!"); | |||
dialogVisible.value = false; | |||
} | |||
getApiManageListFunc(1, 10); | |||
pageNum.value = 1; | |||
pageSize.value = 10; | |||
} catch (error) { | |||
console.log(error, "err"); | |||
ElMessage.error(error.message); | |||
} | |||
} else { | |||
ElMessage.error("请完善信息!"); | |||
} | |||
}); | |||
}; | |||
// 设置时长 | |||
const formDataTime = ref({ | |||
times: "" | |||
}); | |||
const rulesTime = { | |||
times: [ | |||
{ | |||
required: true, | |||
message: "Please input times", | |||
trigger: "blur", | |||
}, | |||
] | |||
}; | |||
onMounted(() => { | |||
getApiManageListFunc(1, 10); | |||
}); | |||
</script> | |||
<style lang="scss" scoped> | |||
.page { | |||
height: calc(100vh - 80px); | |||
// height: calc(100vh - 80px); | |||
background-color: #ffffff; | |||
border-radius: 30px 0 0 0; | |||
overflow: hidden; | |||
padding: 10vh; | |||
.addbtn { | |||
margin-bottom: 2vh; | |||
text-align: right; | |||
} | |||
.formData { | |||
padding: 5vh 3vh; | |||
} | |||
.pagination { | |||
position: fixed; | |||
left: 55%; | |||
bottom: 8vh; | |||
transform: translateX(-50%); | |||
border-radius: 5px; | |||
padding: 10px 20px; | |||
z-index: 99; | |||
transition: all 0.3s; | |||
cursor: pointer; | |||
&:hover { | |||
background-color: #b8b8b873; | |||
} | |||
} | |||
} | |||
</style> |
@@ -198,7 +198,7 @@ | |||
import { linkEmits } from "element-plus"; | |||
import { getCurrentInstance } from "vue"; | |||
import { businessListApi, addBusinessApi, setRemainingTimes, saveMallUserInfo } from '@/apis/apiManage.js' | |||
import { businessListApi, addBusinessApi, setRemainingTimes, saveMallUserInfo, getMallUserInfo } from '@/apis/apiManage.js' | |||
import { useI18n } from "vue-i18n"; | |||
@@ -379,11 +379,21 @@ const accountDialogVisible = ref(false); | |||
const mallUserInfoFlag = ref(false); | |||
const loginAccount = (item) => { | |||
if (item.mallUserInfo) { | |||
formData.value.name = item.name | |||
formData.value.username = item.username | |||
getMallUserInfo(item.id).then(res => { | |||
if (res.code === 200) { | |||
formData2.value = { | |||
serviceId: item.id, | |||
username: res.data.username, | |||
name: res.data.name, | |||
password: '', | |||
phone: res.data.phone | |||
}; | |||
} | |||
}) | |||
} else { | |||
formData2.value.serviceId = item.id | |||
} | |||
mallUserInfoFlag.value = item.mallUserInfo ? true : false | |||
formData2.value.serviceId = item.id | |||
accountDialogVisible.value = true | |||
} | |||
@@ -2,7 +2,7 @@ | |||
* @Autor: Chutingting | |||
* @Date: 2023-11-05 19:03:11 | |||
* @LastEditors: Chutingting | |||
* @LastEditTime: 2023-11-07 17:55:54 | |||
* @LastEditTime: 2023-11-08 16:45:31 | |||
* @Description: 修改密码 | |||
--> | |||
<template> | |||
@@ -16,9 +16,9 @@ | |||
class="editPass" | |||
> | |||
<el-form-item label="用户名" prop="pass"> | |||
<el-input v-model="ruleForm.username" disabled type="password" autocomplete="off" /> | |||
<el-input v-model="ruleForm.userName" disabled autocomplete="off" /> | |||
</el-form-item> | |||
<el-form-item label="原密码" prop="pass"> | |||
<el-form-item label="密码" prop="pass"> | |||
<el-input v-model="ruleForm.pass" type="password" autocomplete="off" /> | |||
</el-form-item> | |||
<el-form-item label="确认密码" prop="checkPass"> | |||
@@ -40,6 +40,12 @@ | |||
import { reactive, ref } from 'vue' | |||
import type { FormInstance, FormRules } from 'element-plus' | |||
import { updatepwd } from "@/apis/editPass.js"; | |||
import { logoutApi } from '@/apis/login.js' | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
import { useRoute, useRouter } from "vue-router"; | |||
const userInfoPinia = userInfoModules(); | |||
const router = useRouter(); | |||
const emit = defineEmits(["close"]); | |||
const ruleFormRef = ref<FormInstance>() | |||
@@ -65,6 +71,7 @@ const validatePass2 = (rule: any, value: any, callback: any) => { | |||
} | |||
const ruleForm = reactive({ | |||
userName: localStorage.getItem("username"), | |||
pass: '', | |||
checkPass: '' | |||
}) | |||
@@ -76,16 +83,23 @@ const rules = reactive<FormRules<typeof ruleForm>>({ | |||
const submitForm = (formEl: FormInstance | undefined) => { | |||
if (!formEl) return | |||
formEl.validate((valid) => { | |||
formEl.validate(async (valid) => { | |||
if (valid) { | |||
const data = ruleForm; | |||
const data = { | |||
userName: ruleForm.userName, | |||
pwd: ruleForm.checkPass | |||
}; | |||
try { | |||
const res = updatepwd(data); | |||
console.log(res, "res"); | |||
// if (res.code == 200) { | |||
// ElMessage.success("修改成功!"); | |||
// handleClose(ruleFormRef.value) | |||
// } | |||
const res = await updatepwd(data); | |||
if (res.code == 200) { | |||
ElMessage.success("修改成功!"); | |||
logoutApi().then(d => { | |||
userInfoPinia.loginOut(); | |||
router.push(`/login`); | |||
}) | |||
localStorage.removeItem("AccessToken"); | |||
handleClose(ruleFormRef.value) | |||
} | |||
} catch (error) { | |||
console.log(error, "err"); | |||
// ElMessage.error(error.message); | |||
@@ -96,16 +110,9 @@ const submitForm = (formEl: FormInstance | undefined) => { | |||
} | |||
}) | |||
} | |||
</script> | |||
<style lang="scss" scoped> | |||
.page { | |||
height: calc(100vh - 80px); | |||
// height: calc(100vh - 80px); | |||
background-color: #ffffff; | |||
border-radius: 30px 0 0 0; | |||
overflow: hidden; | |||
padding: 10vh; | |||
const handleClose = (formEl: FormInstance | undefined) => { | |||
if (!formEl) return | |||
formEl.resetFields() | |||
emit("close"); | |||
} | |||
</style> | |||
</script> |
@@ -0,0 +1,90 @@ | |||
<template> | |||
<div class="page"> | |||
<el-card class="box-card"> | |||
<div slot="header" class="clearfix"> | |||
<span>个人信息</span> | |||
</div> | |||
<div> | |||
<div style="text-align: center"> | |||
<div class="el-upload"> | |||
<img :src="Avatar" class="avatar"> | |||
<p>{{ userData.username }},欢迎您</p> | |||
</div> | |||
</div> | |||
<ul class="user-info"> | |||
<li><div style="height: 100%"><el-icon><i-ep-UserFilled /></el-icon> 登录账号<div class="user-right">{{ userData.username }}</div></div></li> | |||
<li><el-icon><i-ep-Avatar /></el-icon> 用户昵称 <div class="user-right">{{ userData.name }}</div></li> | |||
<li><el-icon><i-ep-User /></el-icon> 当前账户时长 <div class="user-right"> {{ userData.remainingTimes }} (秒)</div></li> | |||
<li><el-icon><i-ep-User /></el-icon> 手机号 <div class="user-right"> {{ userData.phone }}</div></li> | |||
<li> | |||
<el-icon><i-ep-edit /></el-icon> 安全设置 | |||
<div class="user-right"> | |||
<a @click="editDialogVisible = true">修改密码</a> | |||
</div> | |||
</li> | |||
<template v-if="userData.isAdmin === '1' && !userData.localDeploy"> | |||
<li><el-icon><i-ep-User /></el-icon> 剩余时长 <div class="user-right"> {{ }}(秒)</div></li> | |||
<li> | |||
<el-icon><i-ep-Pointer /></el-icon> 视频制作统计 | |||
<div class="user-right"> | |||
<a>查看</a> | |||
</div> | |||
</li> | |||
</template> | |||
</ul> | |||
</div> | |||
</el-card> | |||
<el-dialog v-model="editDialogVisible" title="修改密码" width="40%" :before-close="handleClose" > | |||
<edit-pass @close="handleClose"></edit-pass> | |||
</el-dialog> | |||
</div> | |||
</template> | |||
<script setup lang="ts"> | |||
import editPass from '../editPass/index.vue' | |||
import { getUser, privateDeployAdminCurrent, current } from "@/apis/home.js"; | |||
const Avatar = ref('https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png') | |||
const editDialogVisible = ref(false) | |||
const handleClose = () => { | |||
editDialogVisible.value = false; | |||
}; | |||
const userData = ref({}); | |||
function getUserFn() { | |||
getUser().then(res => { | |||
userData.value = res.data | |||
localStorage.setItem("username", res.data.username); | |||
localStorage.setItem("isAdmin", res.data.isAdmin); // isAdmin=1,为管理人员(邃芒后台) , isAdmin=0,为API接入方登录后台 isAmin=1&&localDeploy=true,就是私有化部署的管理后台 | |||
if (res.data.isAdmin === 1 && res.data.localDeploy || res.data.isAdmin === 0) { | |||
getTime() | |||
} | |||
}) | |||
} | |||
async function getTime() { | |||
let res = userData.isAdmin === 1 && userData.localDeploy ? await privateDeployAdminCurrent() : await current() | |||
userData.value.remainingTimes = res.data.remainingTimes | |||
} | |||
onMounted(() => { | |||
getUserFn() | |||
}); | |||
</script> | |||
<style lang="scss" scoped> | |||
.page{ | |||
padding: 30px | |||
} | |||
.user-info { | |||
padding-left: 0; | |||
list-style: none; | |||
li{ | |||
border-bottom: 1px solid #F0F3F4; | |||
padding: 11px 0; | |||
font-size: 13px; | |||
} | |||
.user-right { | |||
float: right; | |||
a{ | |||
color: #317EF3; | |||
} | |||
} | |||
} | |||
</style> |
@@ -1218,7 +1218,7 @@ async function doLogin(data: any) { | |||
// await checkInviteCode(); | |||
// userInfoPinia.getUserInfo(); //保存邮箱到pinia | |||
ElMessage.success(msg); | |||
router.push("/model"); | |||
router.push("/home"); | |||
}) | |||
.catch((err) => { | |||
console.log(err, "err"); | |||
@@ -0,0 +1,129 @@ | |||
<template> | |||
<div class="page justify-around"> | |||
<el-table | |||
:data="tableData" | |||
style="width: 100%; height: 90%" | |||
size="large" | |||
align="center" | |||
border | |||
> | |||
<el-table-column | |||
prop="title" | |||
label="名称" | |||
align="center" | |||
/> | |||
<el-table-column | |||
prop="address" | |||
label="图片" | |||
align="center" | |||
/> | |||
<el-table-column | |||
prop="createTime" | |||
label="创建时间" | |||
align="center" | |||
> | |||
<template #default="scope"> | |||
{{ getDate(scope.row.createTime) }} | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<div class="pagination"> | |||
<el-pagination | |||
v-model:current-page="pageNum" | |||
v-model:page-size="pageSize" | |||
:page-sizes="[10, 50, 100]" | |||
:small="false" | |||
:disabled="false" | |||
:background="true" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="total" | |||
@size-change="handleSizeChange" | |||
@current-change="handleCurrentChange" | |||
/> | |||
</div> | |||
</div> | |||
</template> | |||
<!-- videoType==1为竖,==2为横 --> | |||
<script setup> | |||
//#region 导入 | |||
import { templateListApi } from '@/apis/template.js' | |||
import { useI18n } from "vue-i18n"; | |||
import dayjs from "dayjs"; | |||
import { useRoute, useRouter } from "vue-router"; | |||
const route = useRoute(); | |||
const router = useRouter(); | |||
const tableData = ref([]); | |||
const pageNum = ref(1); | |||
const pageSize = ref(10); | |||
const total = ref(0); | |||
const getDate = (val) => { | |||
return dayjs(val).format("YYYY-MM-DD"); | |||
}; | |||
const handleSizeChange = (val) => { | |||
pageSize.value = val; | |||
getBusinessListFunc(pageNum.value, pageSize.value); | |||
}; | |||
const handleCurrentChange = (val) => { | |||
pageNum.value = val; | |||
getBusinessListFunc(pageNum.value, pageSize.value); | |||
}; | |||
const getBusinessListFunc = async (PageNum, PageSize) => { | |||
try { | |||
const res = await templateListApi(PageNum, PageSize); | |||
console.log(res, "res"); | |||
tableData.value = res.data.list; | |||
total.value = res.data.total * 1; | |||
} catch (error) { | |||
console.log(error, "err"); | |||
} | |||
}; | |||
onMounted(() => { | |||
getBusinessListFunc(1, 10); | |||
}); | |||
</script> | |||
<style lang="scss" scoped> | |||
.page { | |||
height: calc(100vh - 80px); | |||
// height: calc(100vh - 80px); | |||
background-color: #ffffff; | |||
border-radius: 30px 0 0 0; | |||
overflow: hidden; | |||
padding: 10vh; | |||
.addbtn { | |||
margin-bottom: 2vh; | |||
} | |||
.formData { | |||
padding: 5vh 3vh; | |||
} | |||
.pagination { | |||
position: fixed; | |||
left: 55%; | |||
bottom: 8vh; | |||
transform: translateX(-50%); | |||
border-radius: 5px; | |||
padding: 10px 20px; | |||
z-index: 99; | |||
transition: all 0.3s; | |||
cursor: pointer; | |||
&:hover { | |||
background-color: #b8b8b873; | |||
} | |||
} | |||
} | |||
</style> |