打包测试

This commit is contained in:
yuanteng 2024-11-03 19:00:42 +08:00
parent df41a86572
commit 0f33730f93
3 changed files with 796 additions and 2090 deletions

2629
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,4 +18,5 @@ app.use(ElementPlus, {size: 'small'})
app.use(router) app.use(router)
//使用pinia //使用pinia
app.use(pinia) app.use(pinia)
app.mount('#app') app.mount('#app')

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <!-- <div>
<div> <div>
<el-input style="width: 200px; height: 30px; margin-right: 10px;" suffix-icon="Search" placeholder="请输入商品名称" v-model="username"></el-input> <el-input style="width: 200px; height: 30px; margin-right: 10px;" suffix-icon="Search" placeholder="请输入商品名称" v-model="username"></el-input>
<el-form-item label="商品类型" style="width: 200px; margin-right: 10px;display: inline-block"> <el-form-item label="商品类型" style="width: 200px; margin-right: 10px;display: inline-block">
@ -243,138 +243,138 @@
<el-button type="primary" @click="saveEdit">保存</el-button> <el-button type="primary" @click="saveEdit">保存</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import instance from '@/utils/request';
import { ElMessage } from 'element-plus';
import { ref, onMounted } from 'vue';
const pageNum = ref(0);
const pageSize = ref(0);
const total = ref(0);
const selectedItems = ref([]);
onMounted(() => {
load();
});
const handleSelectionChange = (row: any) => {
selectedItems.value = JSON.parse(JSON.stringify(row));
};
const username = ref('');
const detailDialogVisible = ref(false);
const editDialogVisible = ref(false);
const resources = ref('');
const Region = ref('');
let selectedProduct = ref('');
let editForm = ref({
selectedItems: '',
img: '',
name: '',
price: '',
resource: '',
quantity: '',
state: '',
attribute:'',
region: '',
label: '',
desc: '',
});
const handleView = (index: number, row: any) => {
selectedProduct = row;
detailDialogVisible.value = true;
};
const handleRevise = (index: number, row: any) => {
selectedProduct = row;
editDialogVisible.value = true;
editForm.value = row;
};
const handleOff = (index: number, row: any) => {
if (row.attribute === '上架') {
row.state = '上架';
row.attribute = '下架';
} else if (row.attribute === '下架') {
row.state = '下架';
row.attribute = '上架';
}
};
const handleDelete = (index: number, row: any) => {
const confirmDelete = window.confirm('您确定要删除该商品吗?');
if (confirmDelete) {
tableData.value = tableData.value.filter((item, i) => i!== index);
ElMessage({
message: '删除成功',
type: 'success',
});
}
};
const tableData = [ // import { ElMessage } from 'element-plus';
{ // import { ref, onMounted } from 'vue';
selectedItems: '001', // const pageNum = ref(0);
img: 'https://s21.ax1x.com/2024/10/24/pAdzjZ6.png', // const pageSize = ref(0);
name: '随便起的', // const total = ref(0);
price: '300rmb', // const selectedItems = ref([]);
resource: '头饰', // onMounted(() => {
quantity: '10', // load();
state: '上架', // });
region: '是', // const handleSelectionChange = (row: any) => {
label: '送礼好物', // selectedItems.value = JSON.parse(JSON.stringify(row));
desc: '描述', // };
attribute:'下架', // const username = ref('');
}, // const detailDialogVisible = ref(false);
]; // const editDialogVisible = ref(false);
const list = { // const resources = ref('');
region: '', // const Region = ref('');
label: [], // let selectedProduct = ref('');
desc: '', // let editForm = ref({
}; // selectedItems: '',
const reset = () => { // img: '',
username.value = ''; // name: '',
resources.value = ''; // price: '',
Region.value = ''; // resource: '',
}; // quantity: '',
const saveEdit = () => { // state: '',
const indexToUpdate = tableData.findIndex(item => item.selectedItems === editForm.value.selectedItems); // attribute:'',
if (indexToUpdate!== -1) { // region: '',
tableData[indexToUpdate] = { // label: '',
...tableData[indexToUpdate], // desc: '',
...editForm.value, // });
}; // const handleView = (index: number, row: any) => {
ElMessage({ // selectedProduct = row;
message: '编辑成功', // detailDialogVisible.value = true;
type: 'success', // };
}); // const handleRevise = (index: number, row: any) => {
editDialogVisible.value = false; // selectedProduct = row;
}; // editDialogVisible.value = true;
}; // editForm.value = row;
// };
// const handleOff = (index: number, row: any) => {
// if (row.attribute === '') {
// row.state = '';
// row.attribute = '';
// } else if (row.attribute === '') {
// row.state = '';
// row.attribute = '';
// }
// };
// const handleDelete = (index: number, row: any) => {
// const confirmDelete = window.confirm('');
// if (confirmDelete) {
// tableData.value = tableData.value.filter((item, i) => i!== index);
// ElMessage({
// message: '',
// type: 'success',
// });
// }
// };
const load = async () => { // const tableData = [
await instance.get('/admin/findAllUsers').then(res => { // {
console.log(res.data.data); // selectedItems: '001',
res.data.data.forEach(item => { // img: 'https://s21.ax1x.com/2024/10/24/pAdzjZ6.png',
console.log(item); // name: '便',
}); // price: '300rmb',
tableData.value = res.data.data; // resource: '',
}); // quantity: '10',
}; // state: '',
const delBatchSuccess = () => { // region: '',
ElMessage({ // label: '',
message: '批量删除成功', // desc: '',
type: 'success', // attribute:'',
}); // },
}; // ];
const delBatch = async () => { // const list = {
await instance.post('').then(res => { // region: '',
if (res.data.code === '200') { // label: [],
load(); // desc: '',
} else { // };
ElMessage({ // const reset = () => {
message: '批量删除失败', // username.value = '';
type: 'error', // resources.value = '';
}); // Region.value = '';
} // };
}); // const saveEdit = () => {
}; // const indexToUpdate = tableData.findIndex(item => item.selectedItems === editForm.value.selectedItems);
// if (indexToUpdate!== -1) {
// tableData[indexToUpdate] = {
// ...tableData[indexToUpdate],
// ...editForm.value,
// };
// ElMessage({
// message: '',
// type: 'success',
// });
// editDialogVisible.value = false;
// };
// };
// const load = async () => {
// await instance.get('/admin/findAllUsers').then(res => {
// console.log(res.data.data);
// res.data.data.forEach(item => {
// console.log(item);
// });
// tableData.value = res.data.data;
// });
// };
// const delBatchSuccess = () => {
// ElMessage({
// message: '',
// type: 'success',
// });
// };
// const delBatch = async () => {
// await instance.post('').then(res => {
// if (res.data.code === '200') {
// load();
// } else {
// ElMessage({
// message: '',
// type: 'error',
// });
// }
// });
// };
</script> </script>
<style scoped> <style scoped>