ソースを参照

删除商店、商品部分

chillqi 2 年 前
コミット
b2f524cd37

+ 0 - 3
components.d.ts

@@ -7,7 +7,6 @@ export {}
 
 declare module 'vue' {
   export interface GlobalComponents {
-    CommentItem: typeof import('./src/components/CommentItem.vue')['default']
     ElAlert: typeof import('element-plus/es')['ElAlert']
     ElAside: typeof import('element-plus/es')['ElAside']
     ElAvatar: typeof import('element-plus/es')['ElAvatar']
@@ -40,10 +39,8 @@ declare module 'vue' {
     ElUpload: typeof import('element-plus/es')['ElUpload']
     Footer: typeof import('./src/components/Footer.vue')['default']
     Header: typeof import('./src/components/Header.vue')['default']
-    ProductItem: typeof import('./src/components/ProductItem.vue')['default']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
-    StoreItem: typeof import('./src/components/StoreItem.vue')['default']
   }
   export interface ComponentCustomProperties {
     vLoading: typeof import('element-plus/es')['ElLoadingDirective']

+ 0 - 6
src/api/_prefix.ts

@@ -2,9 +2,3 @@ export const API_MODULE = '/api'
 
 //用户模块
 export const USER_MODULE= `${API_MODULE}/users`
-//商店模块
-export const STORE_MODULE= `${API_MODULE}/stores`
-//商品模块
-export const PRODUCT_MODULE= `${API_MODULE}/products`
-//订单模块
-export const ORDER_MODULE= `${API_MODULE}/orders`

+ 0 - 43
src/api/product.ts

@@ -1,43 +0,0 @@
-import {axios} from '../utils/request'
-import {PRODUCT_MODULE} from './_prefix'
-
-// 创建商品
-export const createProduct = payload => {
-    return axios.post(`${PRODUCT_MODULE}/`, payload,
-        {headers: {'Content-Type': 'application/json'}})
-        .then(res => {
-            return res
-        })
-}
-
-// 获取商店下所有商品
-export const getProductsByStoreId = storeId => {
-    return axios.get(`${PRODUCT_MODULE}/?storeId=${storeId}`)
-        .then(res => {
-            return res
-        })
-}
-
-// 根据商品Id获取商品信息
-export const getProductById = productId => {
-    return axios.get(`${PRODUCT_MODULE}/${productId}`)
-        .then(res => {
-            return res;
-        })
-}
-
-// 添加库存
-export const addStock = (id, number) => {
-    return axios.post(`${PRODUCT_MODULE}/${id}/stock?number=${number}`)
-        .then(res => {
-            return res;
-        })
-}
-
-//根据商品Id获取商品评论
-export const getCommentsById = productId => {
-    return axios.get(`${PRODUCT_MODULE}/comment/?productId=${productId}`)
-        .then(res => {
-            return res;
-        })
-}

+ 0 - 27
src/api/store.ts

@@ -1,27 +0,0 @@
-import {axios} from '../utils/request'
-import {STORE_MODULE} from './_prefix'
-
-// 创建商店
-export const createStore = payload => {
-    return axios.post(`${STORE_MODULE}/`, payload,
-        {headers: {'Content-Type': 'application/json'}})
-        .then(res => {
-            return res
-        })
-}
-
-// 获取全部商店
-export const getAllStore = () => {
-    return axios.get(`${STORE_MODULE}/`, )
-        .then(res => {
-            return res
-        })
-}
-
-// 根据商店Id获取指定商店
-export const getStoreById = storeId => {
-    return axios.get(`${STORE_MODULE}/${storeId}`)
-        .then(res => {
-            return res
-        })
-}

+ 0 - 14
src/api/tools.ts

@@ -1,14 +0,0 @@
-import {axios} from '../utils/request'
-import {API_MODULE} from './_prefix'
-
-// 上传图片文件
-export const uploadImage = payload => {
-    return axios.post(`${API_MODULE}/images`, payload, {
-        headers:{
-            'Content-Type': "multipart/form-data;"
-        }
-    })
-        .then(res => {
-            return res
-        })
-}

+ 0 - 60
src/components/CommentItem.vue

@@ -1,60 +0,0 @@
-<script setup lang="ts">
-import {ref} from "vue"
-
-const props = defineProps({
-  commentVO: {
-    type: Object,
-    required: true
-  }
-})
-
-const userName = ref('')
-const time = ref('')
-const rating = ref(0)
-const comment = ref('')
-
-userName.value = props.commentVO.userName
-time.value = parseTime(props.commentVO.time)
-rating.value = props.commentVO.rating
-comment.value = props.commentVO.comment
-
-function parseTime(time: string) {
-  let times = time.split(/T|\./)
-  return times[0] + " " + times[1]
-}
-</script>
-
-
-<template>
-  <el-card class="comment-item-card" :body-style="{ padding: '0px' }" shadow="hover">
-    <div class="comment-item-main">
-      <el-row>
-        用户“{{ userName }}”于 {{ time }} 为商品打分:
-        <el-rate
-            v-model="rating"
-            disabled
-            show-score
-            text-color="#ff9900"
-            score-template="{value} 分"
-            size="small"
-        />
-      </el-row>
-      并发布评论:{{ comment }}
-    </div>
-  </el-card>
-
-</template>
-
-
-<style scoped>
-.comment-item-card {
-  margin: 20px;
-  border-radius: 8px;
-  width: 60%;
-}
-
-.comment-item-main {
-  margin: 20px;
-  line-height: 30px;
-}
-</style>

+ 1 - 1
src/components/Header.vue

@@ -42,7 +42,7 @@ function parseRole() {
     <el-row :gutter="10" :justify="'space-around'">
 
       <el-col :span="3" class="header-icon">
-        <router-link to="/allStore" v-slot="{navigate}" class="no-link">
+        <router-link to="/dashboard" v-slot="{navigate}" class="no-link">
           <h1 @click="navigate" class="header-text"> 蓝鲸在线购物</h1>
         </router-link>
       </el-col>

+ 0 - 110
src/components/ProductItem.vue

@@ -1,110 +0,0 @@
-<script setup lang="ts">
-import {ref} from "vue";
-import {getProductById} from "../api/product.ts";
-
-// 使用props接收父界面传来的数据
-const props = defineProps({
-  productId: {
-    type: Number,
-    required: true
-  }
-})
-
-const storeId = ref(0)
-const name = ref('')
-const photoUrlList = ref([])
-const rating = ref(0)
-const number = ref(0)
-const salesAmount = ref(0)
-const stock = ref(0)
-const category = ref()
-const price = ref()
-const photoUrl = ref('')
-
-getProductById(props.productId).then(res => {
-  storeId.value = res.result.storeId
-  name.value = res.result.name
-  photoUrlList.value = res.result.photoUrlList
-  rating.value = res.result.rating
-  number.value = res.result.number
-  salesAmount.value = res.result.salesAmount
-  stock.value = res.result.stock
-  category.value = res.result.category
-  price.value = res.result.price
-
-  photoUrl.value = photoUrlList.value[0]
-})
-
-function parseCategory(category) {
-  if (category === 'FOOD') {
-    return "食品"
-  } else if (category === 'CLOTHES') {
-    return "服饰"
-  } else if (category === 'FURNITURE') {
-    return "家具"
-  } else if (category === 'ELECTRONICS') {
-    return "电子产品"
-  } else if (category === 'ENTERTAINMENT') {
-    return "娱乐"
-  } else if (category === 'SPORTS') {
-    return "体育产品"
-  } else if (category === 'LUXURY') {
-    return "奢侈品"
-  }
-}
-</script>
-
-
-<template>
-  <el-card class="product-item-card" shadow="hover">
-    <div class="photo-div">
-      <el-image class="photo-image" :src="photoUrl"/>
-    </div>
-    <div style="padding: 14px">
-      <h1> {{ name }} </h1>
-      <el-descriptions :column="1">
-        <el-descriptions-item style="font-size: 10px" label="品类">
-          {{ parseCategory(category) }}
-        </el-descriptions-item>
-        <el-descriptions-item style="font-size: 10px" label="价格">
-          {{ price }} 元
-        </el-descriptions-item>
-        <el-descriptions-item style="font-size: 10px" label="评分">
-          <el-rate
-              v-model="rating"
-              disabled
-              show-score
-              text-color="#ff9900"
-              score-template="{value} 分"
-              size="small"
-          />
-          (共 {{ number }} 人打分)
-        </el-descriptions-item>
-        <el-descriptions-item style="font-size: 10px" label="销量">
-          {{ salesAmount }} 件
-        </el-descriptions-item>
-        <el-descriptions-item style="font-size: 10px" label="库存">
-          {{ stock }} 件
-        </el-descriptions-item>
-      </el-descriptions>
-    </div>
-  </el-card>
-</template>
-
-
-<style scoped>
-.product-item-card {
-  margin: 8px;
-  border-radius: 8px;
-  min-width: 31%;
-}
-
-.photo-div {
-  display: flex;
-  justify-content: center;
-}
-
-.photo-image {
-  height: 200px;
-}
-</style>

+ 0 - 68
src/components/StoreItem.vue

@@ -1,68 +0,0 @@
-<script setup lang="ts">
-import {ref} from "vue"
-import {getStoreById} from "../api/store.ts"
-
-// 使用props接收父界面传来的数据
-const props = defineProps({
-  storeId: {
-    type: Number,
-    required: true
-  }
-})
-
-const name = ref('')
-const logoUrl = ref('')
-const rating = ref(0)
-const number = ref(0)
-const location = ref('')
-
-getStoreById(props.storeId).then(res => {
-  name.value = res.result.name
-  logoUrl.value = res.result.logoUrl
-  rating.value = res.result.rating
-  number.value = res.result.number
-  location.value = res.result.location
-})
-</script>
-
-
-<template>
-  <el-card class="store-item-card" :body-style="{ padding: '0px' }" shadow="hover">
-    <el-image class="logo-image" :src="logoUrl"/>
-
-    <div style="padding: 14px">
-      <h1> {{ name }} </h1>
-      <el-descriptions :column="1">
-        <el-descriptions-item style="font-size: 10px" label="评分">
-          <el-rate
-              v-model="rating"
-              disabled
-              show-score
-              text-color="#ff9900"
-              score-template="{value} 分"
-              size="small"
-          />
-          (共 {{ number }} 人打分)
-        </el-descriptions-item>
-        <el-descriptions-item style="font-size: 10px" label="地址">
-          {{ location }}
-        </el-descriptions-item>
-      </el-descriptions>
-    </div>
-  </el-card>
-</template>
-
-
-<style scoped>
-.store-item-card {
-  margin: 20px;
-  border-radius: 8px;
-  min-width: 25%;
-  max-width: 30px;
-}
-
-.logo-image {
-  height: 250px;
-  display: block;
-}
-</style>

+ 1 - 40
src/router/index.ts

@@ -13,14 +13,9 @@ const router = createRouter({
         component: () => import('../views/user/Register.vue'),
     }, {
         path: '/home',
-        redirect: '/allStore',
+        redirect: '/dashboard',
         component: () => import('../views/Home.vue'),
         children: [
-            {
-                path: '/allStore',
-                name: 'allStore',
-                component: () => import('../views/store/AllStore.vue'),
-            },
             {
                 path: '/dashboard',
                 name: 'Dashboard',
@@ -29,40 +24,6 @@ const router = createRouter({
                     title: '个人信息'
                 }
             },
-            {
-                path: '/storeDetail/:storeId',
-                name: 'storeDetail',
-                component: () => import('../views/store/StoreDetail.vue'),
-                meta: {
-                    title: '店铺详情'
-                }
-            },
-            {
-                path: '/createProduct/:storeId',
-                name: 'createProduct',
-                component: () => import('../views/product/CreateProduct.vue'),
-                meta: {
-                    title: '创建商品',
-                    permission: ['STAFF', 'MANAGER']
-                }
-            },
-            {
-                path: '/productDetail/:productId',
-                name: 'productDetail',
-                component: () => import('../views/product/ProductDetail.vue'),
-                meta: {
-                    title: '商品详情'
-                }
-            },
-            {
-                path: '/createStore',
-                name: 'createStore',
-                component: () => import('../views/store/CreateStore.vue'),
-                meta: {
-                    title: '创建店铺',
-                    permission: ['MANAGER']
-                }
-            },
         ]
     }, {
         path: '/404',

+ 0 - 145
src/views/product/CreateProduct.vue

@@ -1,145 +0,0 @@
-<script setup lang="ts">
-import {ref, computed} from "vue"
-import {router} from '../../router'
-import {Back, UploadFilled} from "@element-plus/icons-vue"
-import {createProduct} from "../../api/product.ts"
-import {uploadImage} from "../../api/tools.ts"
-
-const storeId = router.currentRoute.value.params.storeId
-const name = ref('')
-const category = ref()
-const price = ref()
-const photoUrlList = ref([])
-
-const imageFileList = ref([])
-
-const hasNameInput = computed(() => name.value != '')
-const hasCategoryInput = computed(() => category.value != null)
-const hasPriceInput = computed(() => price.value != '')
-const hasImageFile = computed(() => imageFileList.value.length != 0)
-const createProductDisabled = computed(() => {
-  return !(hasNameInput.value && hasCategoryInput.value && hasPriceInput.value && hasImageFile.value);
-})
-
-function handleCreateProduct() {
-  const payload = {
-    storeId: storeId,
-    name: name.value,
-    category: category.value,
-    price: price.value,
-    photoUrlList: photoUrlList.value
-  };
-  createProduct(payload).then(res => {
-    if (res.code === '000') {
-      ElMessage({
-        message: '添加商品成功!',
-        type: 'success',
-        center: true,
-      })
-      name.value = '';
-      category.value = '';
-      price.value = '';
-      photoUrlList.value = [];
-      imageFileList.value = [];
-    } else if (res.code === '400') {
-      ElMessage({
-        message: res.msg,
-        type: 'error',
-        center: true,
-      })
-    }
-  })
-}
-
-function handleChange(file, fileList) {
-  imageFileList.value = fileList
-  let formData = new FormData();
-  formData.append('file', file.raw);
-  uploadImage(formData).then(res => {
-    photoUrlList.value.push(res.result);
-  });
-}
-
-function uploadHttpRequest() {
-}
-
-function toBackPage() {
-  router.push("/storeDetail/" + storeId)
-}
-</script>
-
-
-<template>
-  <el-main>
-    <el-button @click="toBackPage()" type="primary" circle plain>
-      <el-icon><Back/></el-icon>
-    </el-button>
-
-    <h1 class="create-product-title">新建商品</h1>
-
-    <el-form label-position="left" label-width="90px" size="large" class="create-product-form">
-
-      <el-form-item label="商品名">
-        <el-input id="name" v-model="name"
-                  required
-                  placeholder="请输入商品名"/>
-      </el-form-item>
-
-      <el-form-item label="品类">
-        <el-select id="category" v-model="category" placeholder="请选择">
-          <el-option value="FOOD" label="食品"/>
-          <el-option value="CLOTHES" label="服饰"/>
-          <el-option value="FURNITURE" label="家具"/>
-          <el-option value="ELECTRONICS" label="电子产品"/>
-          <el-option value="ENTERTAINMENT" label="娱乐"/>
-          <el-option value="SPORTS" label="体育产品"/>
-          <el-option value="LUXURY" label="奢侈品"/>
-        </el-select>
-      </el-form-item>
-
-      <el-form-item label="单价">
-        <el-input id="price" v-model="price"
-                  required
-                  placeholder="请输入商品单价,单位(元)"/>
-      </el-form-item>
-
-      <el-form-item label="商品照片">
-        <el-upload
-            v-model:file-list="imageFileList"
-            :on-change="handleChange"
-            :on-remove="handleChange"
-            class="upload-demo"
-            list-type="picture"
-            :http-request="uploadHttpRequest"
-            drag>
-          <el-icon class="el-icon--upload">
-            <upload-filled/>
-          </el-icon>
-          <div class="el-upload__text">
-            将文件拖到此处或单击此处上传。
-          </div>
-        </el-upload>
-
-      </el-form-item>
-
-      <el-form-item>
-        <el-button @click.prevent="handleCreateProduct()" :disabled="createProductDisabled"
-                   type="primary" plain>
-          创建商品
-        </el-button>
-      </el-form-item>
-    </el-form>
-  </el-main>
-</template>
-
-
-<style scoped>
-.create-product-title {
-  margin-left: 25%;
-}
-
-.create-product-form {
-  margin-left: 25%;
-  width: 50%;
-}
-</style>

+ 0 - 210
src/views/product/ProductDetail.vue

@@ -1,210 +0,0 @@
-<script setup lang="ts">
-import {ref, computed} from "vue"
-import {router} from '../../router'
-import {Back} from "@element-plus/icons-vue"
-import {addStock, getProductById} from "../../api/product.ts"
-
-const role = sessionStorage.getItem("role")
-
-const productId = router.currentRoute.value.params.productId
-const productVO = ref()
-const storeId = ref(0)
-const name = ref('')
-const photoUrlList = ref([])
-const rating = ref(0)
-const number = ref(0)
-const salesAmount = ref(0)
-const stock = ref(0)
-const category = ref('')
-const price = ref(0)
-
-const addStockNumber = ref('')
-
-const hasAddStockInput = computed(() => addStockNumber.value != '')
-const addStockDisabled = computed(() => {
-  return !(hasAddStockInput.value)
-})
-
-getProductDetail()
-
-function getProductDetail() {
-  getProductById(productId).then(res => {
-    productVO.value = res.result
-    storeId.value = productVO.value.storeId
-    name.value = productVO.value.name
-    photoUrlList.value = productVO.value.photoUrlList
-    rating.value = productVO.value.rating
-    number.value = productVO.value.number
-    salesAmount.value = productVO.value.salesAmount
-    stock.value = productVO.value.stock
-    category.value = productVO.value.category
-    price.value = productVO.value.price
-  })
-}
-
-// 添加库存按钮
-function AddStock() {
-  addStock(productId, addStockNumber.value).then(res => {
-    if (res.code === '000') {
-      ElMessage({
-        message: '添加库存成功!',
-        type: 'success',
-        center: true,
-      })
-      addStockNumber.value = null
-      getProductDetail()
-    } else if (res.code === '400') {
-      ElMessage({
-        message: res.msg,
-        type: 'error',
-        center: true,
-      })
-    }
-  })
-}
-
-function parseCategory(category) {
-  if (category === 'FOOD') {
-    return "食品"
-  } else if (category === 'CLOTHES') {
-    return "服饰"
-  } else if (category === 'FURNITURE') {
-    return "家具"
-  } else if (category === 'ELECTRONICS') {
-    return "电子产品"
-  } else if (category === 'ENTERTAINMENT') {
-    return "娱乐"
-  } else if (category === 'SPORTS') {
-    return "体育产品"
-  } else if (category === 'LUXURY') {
-    return "奢侈品"
-  }
-}
-
-function toBackPage() {
-  router.push("/storeDetail/" + storeId.value)
-}
-</script>
-
-
-<template>
-  <el-container>
-    <el-aside width="25%" class="page-aside">
-      <div class="product-detail-aside">
-        <el-button @click="toBackPage()"
-                   type="primary" circle plain class="back-button">
-          <el-icon>
-            <Back/>
-          </el-icon>
-        </el-button>
-
-        <el-carousel trigger="click" arrow="always" indicator-position="outside">
-          <el-carousel-item v-for="item in photoUrlList" :key="item">
-            <el-image class="logo-image" :src="item" />
-          </el-carousel-item>
-        </el-carousel>
-
-        <span class="product-title">{{ name }}</span>
-
-        <el-descriptions :column="1">
-          <el-descriptions-item style="font-size: 10px" label="品类">
-            {{ parseCategory(category) }}
-          </el-descriptions-item>
-
-          <el-descriptions-item style="font-size: 10px" label="价格">
-            {{ price }} 元
-          </el-descriptions-item>
-
-          <el-descriptions-item style="font-size: 10px" label="评分">
-            <el-rate
-                v-model="rating"
-                disabled
-                show-score
-                text-color="#ff9900"
-                score-template="{value} 分"
-                size="small"
-            />
-            (共 {{ number }} 人打分)
-          </el-descriptions-item>
-
-          <el-descriptions-item style="font-size: 10px" label="销量">
-            {{ salesAmount }} 件
-          </el-descriptions-item>
-
-          <el-descriptions-item style="font-size: 10px" label="库存">
-            {{ stock }} 件
-          </el-descriptions-item>
-        </el-descriptions>
-      </div>
-    </el-aside>
-
-    <el-main>
-      <div v-if="role === 'STAFF'">
-        <div>
-          <span class="main-title">添加库存</span>
-        </div>
-        <div class="add-stock-main">
-          <el-input class="add-stock-number-input"
-                    v-model="addStockNumber" placeholder="请输入添加库存数">
-            <template #append>件</template>
-          </el-input>
-          <br>
-          <el-button @click="AddStock" :disabled="addStockDisabled"
-                     class="add-stock-button" type="primary" plain>
-            新增库存
-          </el-button>
-        </div>
-      </div>
-    </el-main>
-  </el-container>
-</template>
-
-
-<style scoped>
-.page-aside {
-  border-right: lightgrey solid 1px;
-}
-
-.back-button {
-  margin-top: 20px;
-  margin-bottom: 20px;
-}
-
-.product-title {
-  font-size: 30px;
-  margin-bottom: 20px;
-}
-
-.product-detail-aside {
-  width: 80%;
-  margin-left: 10%;
-  display: flex;
-  flex-direction: column;
-  justify-content: start;
-}
-
-.logo-image {
-  width: 100%;
-}
-
-.add-stock-number-input {
-  width: 300px;
-  margin-bottom: 20px;
-}
-
-.add-stock-button {
-  margin-bottom: 40px;
-}
-
-.main-title {
-  font-size: 30px;
-  margin-top: 20px;
-  margin-bottom: 20px;
-  margin-left: 20px;
-}
-
-.add-stock-main {
-  margin-top: 20px;
-  margin-left: 30px;
-}
-</style>

+ 0 - 56
src/views/store/AllStore.vue

@@ -1,56 +0,0 @@
-<script setup lang="ts">
-import {ref} from "vue"
-import {router} from '../../router'
-import {getAllStore} from "../../api/store.ts"
-import StoreItem from "../../components/StoreItem.vue"
-
-const role = sessionStorage.getItem("role")
-
-const storeList = ref()
-
-// 获取商店列表
-getAllStore().then(res => {
-  storeList.value = res.result
-})
-
-// 点击创建商店按钮,跳转到创建商店界面
-function toCreateStorePage() {
-  router.push("/createStore")
-}
-
-// 点击商店卡片,跳转到对应的商店界面
-function toStoreDetailPage(storeId: Number) {
-  router.push("/storeDetail/" + storeId)
-}
-</script>
-
-
-<template>
-  <el-main>
-    <div v-if="role === 'MANAGER' || role === 'CEO'">
-      <el-button class="add-store-button" type="primary" plain
-                 @click="toCreateStorePage()">
-        添加商店
-      </el-button>
-    </div>
-
-    <div class="store-item-list">
-      <StoreItem v-for="storeVO in storeList" :storeId="storeVO.id" @click="toStoreDetailPage(storeVO.id)"/>
-    </div>
-  </el-main>
-</template>
-
-
-<style scoped>
-.add-store-button {
-  margin-left: 30px;
-}
-
-.store-item-list {
-  display: flex;
-  padding: 2px;
-  flex-flow: wrap;
-  justify-content: center;
-  align-content: start;
-}
-</style>

+ 0 - 130
src/views/store/CreateStore.vue

@@ -1,130 +0,0 @@
-<script setup lang="ts">
-import {computed, ref} from 'vue'
-import {router} from '../../router'
-import {Back, UploadFilled} from "@element-plus/icons-vue"
-import {createStore} from "../../api/store.ts"
-import {uploadImage} from "../../api/tools.ts"
-
-// 输入框值(需要前端阻拦不合法输入)
-const name = ref('')
-const location = ref('')
-const imageFileList = ref([])
-const logoUrl = ref('')
-
-const hasNameInput = computed(() => name.value != '')
-const hasLocationInput = computed(() => location.value != '')
-const hasImageFile = computed(() => logoUrl.value != '')
-const createDisabled = computed(() => {
-  return !(hasNameInput.value && hasLocationInput.value && hasImageFile.value)
-})
-
-// 创建商店按钮触发
-function handleCreateStore() {
-  const payload = {
-    name: name.value,
-    location: location.value,
-    logoUrl: logoUrl.value
-  };
-  createStore(payload).then(res => {
-    if (res.code === '000') {
-      ElMessage({
-        message: '添加商户成功!',
-        type: 'success',
-        center: true,
-      })
-      name.value = ''
-      location.value = ''
-      logoUrl.value = ''
-      imageFileList.value.splice(0)
-    } else if (res.code === '400') {
-      ElMessage({
-        message: res.msg,
-        type: 'error',
-        center: true,
-      })
-    }
-  })
-}
-
-function handleChange(file, fileList) {
-  imageFileList.value = fileList
-  let formData = new FormData()
-  formData.append('file', file.raw)
-  uploadImage(formData).then(res => {
-    logoUrl.value = res.result
-  })
-}
-
-function handleExceed() {
-  ElMessage.warning(`当前限制选择 1 个文件`);
-}
-
-function uploadHttpRequest() {
-}
-
-function toBackPage() {
-  router.push("/allStore")
-}
-</script>
-
-
-<template>
-  <el-main>
-    <el-button @click="toBackPage()" type="primary" circle plain>
-      <el-icon><Back/></el-icon>
-    </el-button>
-
-    <h1 class="create-store-title">新建商店</h1>
-
-    <el-form label-position="left" label-width="90px" size="large" class="create-store-form">
-
-      <el-form-item label="商店名">
-        <el-input id="name" v-model="name" required placeholder="请输入商店名"/>
-      </el-form-item>
-
-      <el-form-item label="商店地址">
-        <el-input id="location" v-model="location" required placeholder="楼层-门牌号 如:3楼-305"/>
-      </el-form-item>
-
-      <el-form-item label="商店Logo">
-        <el-upload
-            v-model:file-list="imageFileList"
-            :limit="1"
-            :on-change="handleChange"
-            :on-exceed="handleExceed"
-            :on-remove="handleChange"
-            class="upload-demo"
-            list-type="picture"
-            :http-request="uploadHttpRequest"
-            drag>
-          <el-icon class="el-icon--upload">
-            <upload-filled/>
-          </el-icon>
-          <div class="el-upload__text">
-            将文件拖到此处或单击此处上传。
-          </div>
-        </el-upload>
-
-      </el-form-item>
-
-      <el-form-item>
-        <el-button @click.prevent="handleCreateStore()" :disabled="createDisabled"
-                   type="primary" plain>
-          创建商店
-        </el-button>
-      </el-form-item>
-    </el-form>
-  </el-main>
-</template>
-
-
-<style scoped>
-.create-store-title {
-  margin-left: 25%;
-}
-
-.create-store-form {
-  margin-left: 25%;
-  width: 50%;
-}
-</style>

+ 0 - 146
src/views/store/StoreDetail.vue

@@ -1,146 +0,0 @@
-<script setup lang="ts">
-import {ref} from "vue"
-import {router} from '../../router'
-import {getStoreById} from "../../api/store.ts"
-import {getProductsByStoreId} from "../../api/product.ts"
-import {Back} from "@element-plus/icons-vue"
-import ProductItem from "../../components/ProductItem.vue"
-
-const role = sessionStorage.getItem("role")
-// 从当前router地址中获得storeId参数值
-const storeId = router.currentRoute.value.params.storeId
-const storeVO = ref()
-const name = ref('')
-const logoUrl = ref('')
-const rating = ref(0)
-const number = ref(0)
-const location = ref('')
-const productList = ref()
-
-getStoreById(storeId).then(res => {
-  storeVO.value = res.result
-  name.value = storeVO.value.name
-  logoUrl.value = storeVO.value.logoUrl
-  rating.value = storeVO.value.rating
-  number.value = storeVO.value.number
-  location.value = storeVO.value.location
-})
-
-getProductsByStoreId(storeId).then(res => {
-  productList.value = res.result
-})
-
-function toCreateProductPage() {
-  router.push("/createProduct/" + storeId)
-}
-
-function toProductDetailPage(productId) {
-  router.push("/productDetail/" + productId)
-}
-
-function toBackPage() {
-  router.push("/allStore")
-}
-</script>
-
-
-<template>
-  <el-container>
-    <el-aside width="25%" class="page-aside">
-      <div class="store-detail-main">
-        <el-button @click="toBackPage()"
-                   type="primary" circle plain class="back-button">
-          <el-icon>
-            <Back/>
-          </el-icon>
-        </el-button>
-
-        <el-image class="logo-image" :src="logoUrl"/>
-
-        <span class="store-title">{{ name }}</span>
-
-        <el-descriptions :column="1">
-          <el-descriptions-item style="font-size: 10px" label="评分">
-            <el-rate
-                v-model="rating"
-                disabled
-                show-score
-                text-color="#ff9900"
-                score-template="{value} 分"
-                size="small"
-            />
-            (共 {{ number }} 人打分)
-          </el-descriptions-item>
-          <el-descriptions-item style="font-size: 10px" label="地址">
-            {{ location }}
-          </el-descriptions-item>
-        </el-descriptions>
-
-        <el-button class="create-product-button" type="primary" plain
-                   @click="toCreateProductPage()" v-if="role === 'STAFF' || role === 'MANAGER'">新增商品
-        </el-button>
-      </div>
-    </el-aside>
-
-    <el-main>
-      <div>
-        <span class="product-list-title">商品列表</span>
-      </div>
-      <div class="all-product-main">
-        <productItem class="product-item-list"
-                     v-for="productVO in productList" :productId="productVO.id"
-                     @click="toProductDetailPage(productVO.id)"/>
-      </div>
-    </el-main>
-  </el-container>
-
-</template>
-
-
-<style scoped>
-.page-aside {
-  border-right: lightgrey solid 1px;
-}
-
-.back-button {
-  margin-top: 20px;
-  margin-bottom: 20px;
-}
-
-.store-title {
-  font-size: 30px;
-  margin-bottom: 20px;
-}
-
-.store-detail-main {
-  width: 80%;
-  margin-left: 10%;
-  display: flex;
-  flex-direction: column;
-  justify-content: start;
-}
-
-.logo-image {
-  width: 100%;
-}
-
-.create-product-button {
-  margin-top: 20px;
-}
-
-.product-list-title {
-  font-size: 30px;
-  margin-top: 20px;
-  margin-bottom: 20px;
-  margin-left: 20px;
-}
-
-.all-product-main {
-  display: flex;
-  flex-direction: row;
-  padding: 20px;
-  flex-flow: wrap;
-  align-content: start;
-  justify-content: start;
-}
-</style>

+ 1 - 1
src/views/user/Login.vue

@@ -41,7 +41,7 @@ function handleLogin() {
       userInfo().then(res => {
         sessionStorage.setItem('name', res.result.name)
         sessionStorage.setItem('role', res.result.role)
-        router.push({path: "/allStore"})
+        router.push({path: "/dashboard"})
       })
     } else if (res.code === '400') {
       ElMessage({