mirror of
				https://github.com/yangjian102621/geekai.git
				synced 2025-11-04 08:13:43 +08:00 
			
		
		
		
	Merge branch 'main' into husm_2024-09-02
This commit is contained in:
		@@ -384,7 +384,7 @@ const submitRegister = () => {
 | 
			
		||||
  if ((activeName.value === 'mobile' || activeName.value === 'email') && data.value.code === '') {
 | 
			
		||||
    return ElMessage.error('请输入验证码');
 | 
			
		||||
  }
 | 
			
		||||
  if (enableVerify.value) {
 | 
			
		||||
  if (enableVerify.value && activeName.value === 'username') {
 | 
			
		||||
    captchaRef.value.loadCaptcha()
 | 
			
		||||
    action.value = "register"
 | 
			
		||||
  } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -90,12 +90,22 @@ const items = [
 | 
			
		||||
    index: '/admin/user',
 | 
			
		||||
    title: '用户管理',
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  {
 | 
			
		||||
    icon: 'menu',
 | 
			
		||||
    index: '/admin/app',
 | 
			
		||||
    index: '1',
 | 
			
		||||
    title: '应用管理',
 | 
			
		||||
    subs: [
 | 
			
		||||
      {
 | 
			
		||||
        index: '/admin/app',
 | 
			
		||||
        title: '应用列表',
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        index: '/admin/app/type',
 | 
			
		||||
        title: '应用分类',
 | 
			
		||||
      },
 | 
			
		||||
    ],
 | 
			
		||||
  },
 | 
			
		||||
  
 | 
			
		||||
  {
 | 
			
		||||
    icon: 'api-key',
 | 
			
		||||
    index: '/admin/apikey',
 | 
			
		||||
 
 | 
			
		||||
@@ -173,6 +173,12 @@ const routes = [
 | 
			
		||||
                meta: {title: '应用管理'},
 | 
			
		||||
                component: () => import('@/views/admin/Apps.vue'),
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                path: '/admin/app/type',
 | 
			
		||||
                name: 'admin-app-type',
 | 
			
		||||
                meta: {title: '应用管理'},
 | 
			
		||||
                component: () => import('@/views/admin/AppType.vue'),
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                path: '/admin/apikey',
 | 
			
		||||
                name: 'admin-apikey',
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,6 @@ import {arrayContains, removeArrayItem, substr} from "@/utils/libs";
 | 
			
		||||
import {useRouter} from "vue-router";
 | 
			
		||||
import {useSharedStore} from "@/store/sharedata";
 | 
			
		||||
import ItemList from "@/components/ItemList.vue";
 | 
			
		||||
import {Plus} from "@element-plus/icons-vue";
 | 
			
		||||
 | 
			
		||||
const listBoxHeight = window.innerHeight - 87
 | 
			
		||||
const list = ref([])
 | 
			
		||||
@@ -72,7 +71,7 @@ const roles = ref([])
 | 
			
		||||
const store = useSharedStore();
 | 
			
		||||
 | 
			
		||||
onMounted(() => {
 | 
			
		||||
  httpGet("/api/role/list").then((res) => {
 | 
			
		||||
  httpGet("/api/app/list").then((res) => {
 | 
			
		||||
    const items = res.data
 | 
			
		||||
    // 处理 hello message
 | 
			
		||||
    for (let i = 0; i < items.length; i++) {
 | 
			
		||||
@@ -112,7 +111,7 @@ const updateRole = (row, opt) => {
 | 
			
		||||
      }
 | 
			
		||||
      roles.value = removeArrayItem(roles.value, row.key)
 | 
			
		||||
    }
 | 
			
		||||
    httpPost("/api/role/update", {keys: roles.value}).then(() => {
 | 
			
		||||
    httpPost("/api/app/update", {keys: roles.value}).then(() => {
 | 
			
		||||
      ElMessage.success({message: title.value + "成功!", duration: 1000})
 | 
			
		||||
    }).catch(e => {
 | 
			
		||||
      ElMessage.error(title.value + "失败:" + e.message)
 | 
			
		||||
 
 | 
			
		||||
@@ -364,7 +364,7 @@ const initData = () => {
 | 
			
		||||
      modelID.value = models.value[0].id
 | 
			
		||||
    }
 | 
			
		||||
    // 加载角色列表
 | 
			
		||||
    httpGet(`/api/role/list`,{id:roleId.value}).then((res) => {
 | 
			
		||||
    httpGet(`/api/app/list/user`,{id:roleId.value}).then((res) => {
 | 
			
		||||
      roles.value = res.data;
 | 
			
		||||
      if (!roleId.value) {
 | 
			
		||||
        roleId.value = roles.value[0]['id']
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@
 | 
			
		||||
                  <div class="block">
 | 
			
		||||
                    <el-input placeholder="手机号码"
 | 
			
		||||
                              size="large"
 | 
			
		||||
                              v-model="data.username"
 | 
			
		||||
                              v-model="data.mobile"
 | 
			
		||||
                              maxlength="11"
 | 
			
		||||
                              autocomplete="off">
 | 
			
		||||
                      <template #prefix>
 | 
			
		||||
@@ -41,7 +41,7 @@
 | 
			
		||||
                        </el-input>
 | 
			
		||||
                      </el-col>
 | 
			
		||||
                      <el-col :span="12">
 | 
			
		||||
                        <send-msg size="large" :receiver="data.username" type="mobile"/>
 | 
			
		||||
                        <send-msg size="large" :receiver="data.mobile" type="mobile"/>
 | 
			
		||||
                      </el-col>
 | 
			
		||||
                    </el-row>
 | 
			
		||||
                  </div>
 | 
			
		||||
@@ -195,6 +195,8 @@ const title = ref('');
 | 
			
		||||
const logo = ref("")
 | 
			
		||||
const data = ref({
 | 
			
		||||
  username: '',
 | 
			
		||||
  mobile: '',
 | 
			
		||||
  email: '',
 | 
			
		||||
  password: '',
 | 
			
		||||
  code: '',
 | 
			
		||||
  repass: '',
 | 
			
		||||
@@ -250,15 +252,15 @@ getLicenseInfo().then(res => {
 | 
			
		||||
 | 
			
		||||
// 注册操作
 | 
			
		||||
const submitRegister = () => {
 | 
			
		||||
  if (data.value.username === '') {
 | 
			
		||||
  if (activeName.value === 'username' && data.value.username === '') {
 | 
			
		||||
    return showMessageError('请输入用户名');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (activeName.value === 'mobile' && !validateMobile(data.value.username)) {
 | 
			
		||||
  if (activeName.value === 'mobile' && !validateMobile(data.value.mobile)) {
 | 
			
		||||
    return showMessageError('请输入合法的手机号');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (activeName.value === 'email' && !validateEmail(data.value.username)) {
 | 
			
		||||
  if (activeName.value === 'email' && !validateEmail(data.value.email)) {
 | 
			
		||||
    return showMessageError('请输入合法的邮箱地址');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -273,7 +275,8 @@ const submitRegister = () => {
 | 
			
		||||
    return showMessageError('请输入验证码');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (enableVerify.value) {
 | 
			
		||||
  // 如果是用户名和密码登录,那么需要加载验证码
 | 
			
		||||
  if (enableVerify.value && activeName.value === 'username') {
 | 
			
		||||
    captchaRef.value.loadCaptcha()
 | 
			
		||||
  } else {
 | 
			
		||||
    doSubmitRegister({})
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								web/src/views/admin/AppType.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								web/src/views/admin/AppType.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="container app-type" >
 | 
			
		||||
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="stylus" scoped>
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
@@ -18,6 +18,8 @@
 | 
			
		||||
            <el-image v-if="scope.row.vip" :src="vipImg" style="height: 20px;position: relative; top:5px; left: 5px"/>
 | 
			
		||||
          </template>
 | 
			
		||||
        </el-table-column>
 | 
			
		||||
        <el-table-column prop="mobile" label="手机"/>
 | 
			
		||||
        <el-table-column prop="email" label="邮箱"/>
 | 
			
		||||
        <el-table-column prop="nickname" label="昵称"/>
 | 
			
		||||
        <el-table-column prop="power" label="剩余算力"/>
 | 
			
		||||
        <el-table-column label="状态" width="80">
 | 
			
		||||
@@ -73,6 +75,12 @@
 | 
			
		||||
        <el-form-item label="账号:" prop="username">
 | 
			
		||||
          <el-input v-model="user.username" autocomplete="off"/>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item label="手机:" prop="mobile">
 | 
			
		||||
          <el-input v-model="user.mobile" autocomplete="off"/>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item label="邮箱:" prop="email">
 | 
			
		||||
          <el-input v-model="user.email" autocomplete="off"/>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item v-if="add" label="密码:" prop="password">
 | 
			
		||||
          <el-input v-model="user.password" autocomplete="off" placeholder="8-16位"/>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,7 @@ checkSession().then((user) => {
 | 
			
		||||
  loginUser.value = user
 | 
			
		||||
  isLogin.value = true
 | 
			
		||||
  // 加载角色列表
 | 
			
		||||
  httpGet(`/api/role/list`).then((res) => {
 | 
			
		||||
  httpGet(`/api/app/list/user`).then((res) => {
 | 
			
		||||
    if (res.data) {
 | 
			
		||||
      const items = res.data
 | 
			
		||||
      for (let i = 0; i < items.length; i++) {
 | 
			
		||||
@@ -139,7 +139,7 @@ checkSession().then((user) => {
 | 
			
		||||
  finished.value = true
 | 
			
		||||
 | 
			
		||||
  // 加载角色列表
 | 
			
		||||
  httpGet('/api/role/list').then((res) => {
 | 
			
		||||
  httpGet('/api/app/list/user').then((res) => {
 | 
			
		||||
    if (res.data) {
 | 
			
		||||
      const items = res.data
 | 
			
		||||
      for (let i = 0; i < items.length; i++) {
 | 
			
		||||
 
 | 
			
		||||
@@ -186,7 +186,7 @@ httpGet('/api/model/list').then(res => {
 | 
			
		||||
  }
 | 
			
		||||
  modelValue.value = getModelName(modelId.value)
 | 
			
		||||
  // 加载角色列表
 | 
			
		||||
  httpGet(`/api/role/list`).then((res) => {
 | 
			
		||||
  httpGet(`/api/app/list/user`).then((res) => {
 | 
			
		||||
    roles.value = res.data;
 | 
			
		||||
    if (!roleId.value) {
 | 
			
		||||
      roleId.value = roles.value[0]['id']
 | 
			
		||||
 
 | 
			
		||||
@@ -109,7 +109,7 @@ onMounted(() => {
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const fetchApps = () => {
 | 
			
		||||
  httpGet("/api/role/list").then((res) => {
 | 
			
		||||
  httpGet("/api/app/list/user").then((res) => {
 | 
			
		||||
    const items = res.data
 | 
			
		||||
    // 处理 hello message
 | 
			
		||||
    for (let i = 0; i < items.length; i++) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user