Ver código fonte

feat: banner

chenjj 3 semanas atrás
pai
commit
0c13f2b400

+ 23 - 0
src/api/system/banner.js

@@ -0,0 +1,23 @@
+import request from '@/utils/request'
+export function add(data) {
+  return request({
+    url: '/web/core/slideshow',
+    method: 'post',
+    data: data
+  })
+}
+
+export function list(query) {
+  return request({
+    url: '/web/core/slideshow/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function delbanner(slideshowIds) {
+  return request({
+    url: '/web/core/slideshow/' + slideshowIds,
+    method: 'delete'
+  })
+}

+ 1 - 1
src/components/FileUpload/index.vue

@@ -145,7 +145,7 @@ function handleUploadError(err) {
 // 上传成功回调
 function handleUploadSuccess(res, file) {
   if (res.code === 200) {
-    uploadList.value.push({ name: res.fileName, url: res.fileName });
+    uploadList.value.push({ name: res.fileName, url: res.url });
     uploadedSuccessfully();
   } else {
     number.value--;

+ 3 - 1
src/views/components/DialogForm/index.vue

@@ -4,7 +4,9 @@
             <template v-for="item in column" :key="item.prop">
                 <!-- 输入框 -->
                 <el-form-item :label="item.label" v-if="item.type === 'input'" :prop="item.prop" :rules="item.rules">
-                    <el-input v-model="form[item.prop]" :placeholder="'请输入' + item.label" clearable  :disabled="disables[item.prop]"/>
+                    <el-input v-model="form[item.prop]" :placeholder="'请输入' + item.label" clearable  :disabled="disables[item.prop]">
+                        <template v-if="item.dese" #append>{{ item.dese }}</template>
+                    </el-input>
                 </el-form-item>
                 <!-- 文本域 -->
                 <el-form-item :label="item.label" v-if="item.type === 'textarea'" :prop="item.prop" :rules="item.rules">

+ 15 - 11
src/views/staff/volunteer/manage/index.vue

@@ -164,28 +164,30 @@ const dialogData = reactive({
             label: '家庭地址',
             prop: 'address',
             type: 'input',
-
         },
         {
             label: '服务项目/类别',
-            prop: 'businessManagementId',
-            type: 'cascader',
-            isSearch: true,
+            prop: 'businessTierName',
+            type: 'input',
             options: options,
             props: { label: 'businessName', value: 'id', checkStrictly:true },
-
         },
         {
-            label: '身份证件',
-            prop: 'idCardPicture',
-            type: 'img',
-
+            label: '服务时长',
+            prop: 'businessDuration',
+            type: 'input',
+            dese:'分钟'
+        },
+        {
+            label: '服务价格',
+            prop: 'businessPrice',
+            type: 'input',
+            dese:'元'
         },
         {
             label: '职业证书',
             prop: 'certificationPicture',
             type: 'img',
-
         },
         {
             label: '技能简介',
@@ -233,7 +235,9 @@ const openDialog = (row, type) => {
             phonenumber: true,
             address: true,
             skillDescribe: true,
-            businessManagementId: true,
+            businessTierName: true,
+            businessDuration:true,
+            businessPrice:true
         }
 
         if (type) {

+ 141 - 0
src/views/system/banner/index.vue

@@ -0,0 +1,141 @@
+<template>
+    <div>
+        <ListPage tableKey="businessbannerId" :column="listPageData.tableColumn" :tableApi="listPageData.tableApi"
+            :isSelect="listPageData.isSelect" :scopeBtns="listPageData.scopeBtns" :searchBtns="listPageData.searchBtns"
+            ref="userTableRef" />
+
+        <el-dialog :title="title" v-model="open" width="500" :before-close="cancel">
+            <div style="padding: 20px;">
+                <FileUpload :fileType="['png', 'jpg', 'jpeg']" @update:modelValue="fileUpdata" :modelValue="files"/>
+            </div>
+            <template #footer>
+                <div class="dialog-footer">
+                    <el-button type="primary" @click="submitForm">确 定</el-button>
+                    <el-button @click="cancel">取 消</el-button>
+                </div>
+            </template>
+        </el-dialog>
+    </div>
+</template>
+
+<script setup>
+import { onMounted, ref, render } from 'vue';
+import ListPage from '@/views/components/ListPage/index.vue';
+import { add, list,delbanner } from "@/api/system/banner";
+
+const { proxy } = getCurrentInstance();
+
+const userTableRef = ref();
+const uploadRef = ref([]);
+const listPageData = reactive({
+    tableColumn: [
+         {
+            label: '创建人',
+            prop: 'createBy',
+            type:'input',
+            isSearch: true,
+        },
+        {
+            label: '创建时间',
+            prop: 'createTime',
+
+        },
+        {
+            label: '图片',
+            prop: 'picture',
+            type: 'img',
+        },
+
+    ],
+    searchBtns: [
+        {
+            label: '新增',
+            func: () => {
+                console.log('新增')
+                openDialog();
+            },
+            key: 'add',
+            hasPermi: ['banner:add'],
+            icon: 'Plus',
+            type: 'primary'
+        }
+    ],
+    tableApi: list,//接口地址
+    isSelect: false,//是否勾选
+    scopeBtns: [
+        {
+            label: '编辑',
+            type: 'primary',
+            hasPermi: ['banner:edit'],
+            key: 'edit',
+            func: (row) => {
+                console.log(row)
+                openDialog(row);
+
+            }
+        },
+        {
+            label: '删除',
+            type: 'danger',
+            hasPermi: ['banner:delete'],
+            key: 'edit',
+            func: (row) => {
+                console.log(row)
+                handleDelete([row.slideshowId])
+            }
+        }
+    ]
+})
+
+const open = ref(false);
+const files = ref('');
+const fileUpdata = (file) => {
+    console.log(file);
+    files.value = file;
+}
+
+const openDialog = async (row) => {
+
+    try {
+        if(row){
+            files.value = row.picture;
+        }
+
+    } catch (error) {
+
+
+
+    } finally {
+        open.value = true;
+    }
+}
+
+const handleDelete = (ids) => {
+    console.log('ids', ids);
+
+    proxy.$modal.confirm('是否确认删除编号为"' + ids + '"的数据项?').then(function () {
+        return delbanner(ids)
+    }).then(() => {
+        userTableRef.value.resetForm();
+    }).catch(() => { });
+}
+const submitForm = () => {
+    console.log('submit', files.value);
+    const parmas = JSON.parse(JSON.stringify(files.value))
+    add({picture: parmas }).then(res => {
+        if (res.code === 200) {
+            proxy.$modal.msgSuccess("新增成功");
+            cancel()
+            return;
+        }
+        proxy.$modal.msgSuccess(res.msg);
+    })
+}
+const cancel = () => {
+    userTableRef.value.resetForm();
+    files.value ='';
+    open.value = false;
+}
+</script>
+
+<style lang='scss' scoped></style>

+ 1 - 1
vite.config.js

@@ -32,7 +32,7 @@ export default defineConfig(({ mode, command }) => {
         // https://cn.vitejs.dev/config/#server-proxy
         '/dev-api': {
           // target: 'http://localhost:9527',
-        target: 'http://192.168.100.121:9527',
+        target: 'http://192.168.100.94:9527',
           changeOrigin: true,
           rewrite: (p) => p.replace(/^\/dev-api/, '')
         }