分类管理增删改查完成
This commit is contained in:
		
							
								
								
									
										51
									
								
								frontend/src/api/shop-cate.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								frontend/src/api/shop-cate.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,51 @@
 | 
			
		||||
import send_request from '../utils/send_request';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 获取商品列表
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
export function getCateList(params) {
 | 
			
		||||
    return send_request({
 | 
			
		||||
        url: '/shop/good/manage/getCategoryList',
 | 
			
		||||
        method: 'GET',
 | 
			
		||||
        params: params,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 添加/修改商品信息
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
export function editCate(params) {
 | 
			
		||||
    return send_request({
 | 
			
		||||
        url: '/shop/good/manage/editCategory',
 | 
			
		||||
        method: 'POST',
 | 
			
		||||
        useQS: true,
 | 
			
		||||
        params: params,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 删除商品
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
export function deleteCate(params) {
 | 
			
		||||
    return send_request({
 | 
			
		||||
        url: '/shop/good/manage/deleteCategory',
 | 
			
		||||
        method: 'POST',
 | 
			
		||||
        useQS: true,
 | 
			
		||||
        params: params,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 导出商品列表
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
export function exportCateList(params) {
 | 
			
		||||
    return send_request({
 | 
			
		||||
        url: '/shop/good/manage/exportCategoryList',
 | 
			
		||||
        method: 'GET',
 | 
			
		||||
        params: params,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
@@ -31,9 +31,6 @@
 | 
			
		||||
                    </span>
 | 
			
		||||
                    <template #dropdown>
 | 
			
		||||
                        <el-dropdown-menu>
 | 
			
		||||
                            <a href="https://github.com/lin-xin/vue-manage-system" target="_blank">
 | 
			
		||||
                                <el-dropdown-item>项目仓库</el-dropdown-item>
 | 
			
		||||
                            </a>
 | 
			
		||||
                            <el-dropdown-item command="user">个人中心</el-dropdown-item>
 | 
			
		||||
                            <el-dropdown-item divided command="loginout">退出登录</el-dropdown-item>
 | 
			
		||||
                        </el-dropdown-menu>
 | 
			
		||||
 
 | 
			
		||||
@@ -28,14 +28,18 @@ const emit = defineEmits(['change'])
 | 
			
		||||
 | 
			
		||||
const handleHttpRequest = async (data: UploadRequestOptions) => {
 | 
			
		||||
    console.log('httpRequest', data)
 | 
			
		||||
    await cos.upload(data.file)
 | 
			
		||||
    let result = await cos.upload(data.file)
 | 
			
		||||
    console.log("result", result)
 | 
			
		||||
    return result
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const handleSuccess: UploadProps['onSuccess'] = (
 | 
			
		||||
    response,
 | 
			
		||||
    response, // 这里的 response 就是 handleHttpRequest 返回的结果
 | 
			
		||||
    uploadFile
 | 
			
		||||
) => {
 | 
			
		||||
    let url = URL.createObjectURL(uploadFile.raw!)
 | 
			
		||||
    console.log("response", response)
 | 
			
		||||
    // let url = URL.createObjectURL(uploadFile.raw!)
 | 
			
		||||
    let url = "//" + response.Location
 | 
			
		||||
    emit('change', url)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -73,9 +73,14 @@ const items = [
 | 
			
		||||
    {
 | 
			
		||||
        icon: 'OfficeBuilding',
 | 
			
		||||
        index: '/shop',
 | 
			
		||||
        title: '商品管理',
 | 
			
		||||
        title: '生活物资',
 | 
			
		||||
        permiss: 'shop',
 | 
			
		||||
        subs: [
 | 
			
		||||
            {
 | 
			
		||||
                index: '/shop-cate-setting',
 | 
			
		||||
                title: '分类管理',
 | 
			
		||||
                permiss: 'shop-cate-setting',
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                index: '/shop-good-setting',
 | 
			
		||||
                title: '商品管理',
 | 
			
		||||
@@ -86,7 +91,7 @@ const items = [
 | 
			
		||||
    {
 | 
			
		||||
        icon: 'Avatar',
 | 
			
		||||
        index: '/privilege',
 | 
			
		||||
        title: '用户管理',
 | 
			
		||||
        title: '系统管理',
 | 
			
		||||
        permiss: 'privilege',
 | 
			
		||||
        subs: [
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,15 @@ const routes: RouteRecordRaw[] = [
 | 
			
		||||
                },
 | 
			
		||||
                component: () => import('../views/shop-good-setting.vue'),
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                path: '/shop-cate-setting',
 | 
			
		||||
                name: 'shop-cate-setting',
 | 
			
		||||
                meta: {
 | 
			
		||||
                    title: '分类管理',
 | 
			
		||||
                    permiss: 'shop-good-setting',
 | 
			
		||||
                },
 | 
			
		||||
                component: () => import('../views/shop-cate-setting.vue'),
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                path: '/privilege-user-setting',
 | 
			
		||||
                name: 'privilege-user-setting',
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ interface ObjectList {
 | 
			
		||||
export const usePermissStore = defineStore('permiss', {
 | 
			
		||||
    state: () => {
 | 
			
		||||
        return {
 | 
			
		||||
            // 系统管理员
 | 
			
		||||
            "1": [
 | 
			
		||||
                "default",
 | 
			
		||||
 | 
			
		||||
@@ -16,10 +17,13 @@ export const usePermissStore = defineStore('permiss', {
 | 
			
		||||
 | 
			
		||||
                "shop",
 | 
			
		||||
                "shop-good-setting",
 | 
			
		||||
                "shop-cate-setting",
 | 
			
		||||
 | 
			
		||||
                "privilege",
 | 
			
		||||
                "privilege-user-setting",
 | 
			
		||||
            ],
 | 
			
		||||
 | 
			
		||||
            // 社区管理员
 | 
			
		||||
            "2": [
 | 
			
		||||
                "default",
 | 
			
		||||
 | 
			
		||||
@@ -27,6 +31,7 @@ export const usePermissStore = defineStore('permiss', {
 | 
			
		||||
 | 
			
		||||
                "shop",
 | 
			
		||||
                "shop-good-setting",
 | 
			
		||||
                "shop-cate-setting",
 | 
			
		||||
 | 
			
		||||
                "privilege",
 | 
			
		||||
                "privilege-user-setting",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								frontend/src/views/shop-cate-setting.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/shop-cate-setting.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <manageList :list-func="shopCateApi.getCateList" :add-func="shopCateApi.editCate" :edit-func="shopCateApi.editCate"
 | 
			
		||||
            :delete-func="shopCateApi.deleteCate" :export-func="shopCateApi.exportCateList" edit-permiss="shop-cate-setting" />
 | 
			
		||||
    </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup lang="ts">
 | 
			
		||||
import manageList from '../components/manage-list.vue';
 | 
			
		||||
import * as shopCateApi from '../api/shop-cate';
 | 
			
		||||
</script>
 | 
			
		||||
		Reference in New Issue
	
	Block a user