From 796d09f1edb2d5366516a78a42efec3c5efc0482 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 12 六月 2025 17:05:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- manager/src/views/activity/index.vue | 188 ++++++++------------ manager/src/components/editor/upload-image.vue | 5 manager/src/libs/axios.js | 23 + manager/src/views/customer/customer-tag/index.vue | 295 ++++++++++++++++++++++++++++++++ 4 files changed, 394 insertions(+), 117 deletions(-) diff --git a/manager/src/components/editor/upload-image.vue b/manager/src/components/editor/upload-image.vue index 071c73a..7bd329f 100644 --- a/manager/src/components/editor/upload-image.vue +++ b/manager/src/components/editor/upload-image.vue @@ -39,7 +39,7 @@ ref="upload" :action="uploadFileUrl" :format="['jpg', 'jpeg', 'png']" - :headers="{ ...accessToken }" + :max-size="10240" :on-exceeded-size="handleMaxSize" :on-format-error="handleFormatError" @@ -121,7 +121,8 @@ // sku鍥剧墖涓婁紶鎴愬姛 handleSuccessGoodsPicture(res, file) { if (file.response) { - file.url = file.response.result; + file.url = file.response.data.url; + file.fileKey = file.response.data.fileKey this.images.push(file); } }, diff --git a/manager/src/libs/axios.js b/manager/src/libs/axios.js index c6b3a39..be90be5 100644 --- a/manager/src/libs/axios.js +++ b/manager/src/libs/axios.js @@ -16,7 +16,7 @@ ? BASE.API_DEV.manager : BASE.API_PROD.manager) + BASE.PREFIX; // 鏂囦欢涓婁紶鎺ュ彛 -export const uploadFile = commonUrl + "/common/common/upload/file"; +export const uploadFile = commonUrl + "/common/lmk/file/upload"; const service = axios.create({ @@ -60,8 +60,8 @@ } switch (data.code) { case 400: - if (data.message !== null) { - Message.error(data.message); + if (data.msg !== null) { + Message.error(data.msg); } else { Message.error("绯荤粺寮傚父"); } @@ -72,8 +72,8 @@ Cookies.set("userInfoManager", ""); setStore("accessToken", ""); if (router.history.current.name != "login") { - if (data.message !== null) { - Message.error(data.message); + if (data.msg !== null) { + Message.error(data.msg); } else { Message.error("鏈煡閿欒锛岃閲嶆柊鐧诲綍"); } @@ -83,8 +83,8 @@ break; case 500: // 绯荤粺寮傚父 - if (data.message !== null) { - Message.error(data.message); + if (data.msg !== null) { + Message.error(data.msg); } else { Message.error("绯荤粺寮傚父"); } @@ -333,6 +333,15 @@ }); }; +export const uploadFileByLmk = (params) =>{ + return service({ + url: "/common/upload/file", + method: "POST", + headers:{'Content-Type': 'multipart/form-data'}, + data: params + }) +} + /** * 鏃犻渶token楠岃瘉鐨勮姹� 閬垮厤鏃oken杩囨湡瀵艰嚧璇锋眰澶辫触 * @param {*} url diff --git a/manager/src/views/activity/index.vue b/manager/src/views/activity/index.vue index 31cd43b..b1f49f2 100644 --- a/manager/src/views/activity/index.vue +++ b/manager/src/views/activity/index.vue @@ -34,7 +34,7 @@ :value="item.value" :key="item.id" > - {{ item.value }} + {{ item.label }} </Option> </Select> </FormItem> @@ -91,7 +91,7 @@ <template slot-scope="{ row }" slot="url"> <div class="media-container"> <!-- 鍥剧墖绫诲瀷 --> - <template v-if="row.coverType === '鍥剧墖'"> + <template v-if="row.coverType === 'image'"> <img :src="row.url" alt="娲诲姩灏侀潰" @@ -100,7 +100,7 @@ > </template> <!-- 瑙嗛绫诲瀷 --> - <template v-else-if="row.coverType === '瑙嗛'"> + <template v-else-if="row.coverType === 'video'"> <video :src="row.url" class="video-player" @@ -128,10 +128,10 @@ <Button type="primary" size="small" - @click="changeStatus(row, row.status === '宸插彂甯�' ? '涓嬫灦' : '鍙戝竷')" + @click="changeStatus(row, row.publish ? '涓嬫灦' : '鍙戝竷')" :loading="row.statusLoading" > - {{ row.status === '宸插彂甯�' ? '涓嬫灦' : '鍙戝竷' }} + {{ row.publish ? '涓嬫灦' : '鍙戝竷' }} </Button> <Button type="info" @@ -188,7 +188,7 @@ </FormItem> </Col> <Col span="12"> - <FormItem label="娲诲姩绫诲瀷" prop="activityType"> + <FormItem label="娲诲姩绫诲瀷" prop="activityType" :label-width="100"> <Select v-model="activityFrom.activityType" placeholder="璇烽�夋嫨娲诲姩绫诲瀷" @@ -199,7 +199,7 @@ :value="item.value" :key="item.id" > - {{ item.value }} + {{ item.label }} </Option> </Select> </FormItem> @@ -226,12 +226,11 @@ ></DatePicker> </FormItem> </Col> - <Col span="24"> - <FormItem label="灏侀潰绫诲瀷" prop="coverType"> + <Col span="12"> + <FormItem label="灏侀潰绫诲瀷" prop="coverType" :labelWidth="100"> <Select v-model="coverType" placeholder="璇烽�夋嫨灏侀潰绫诲瀷" - clearable @on-change="handleCoverTypeChange" > <Option @@ -265,15 +264,15 @@ accept="image/*,video/*" > <Button icon="ios-cloud-upload-outline">涓婁紶灏侀潰鏂囦欢</Button> - <div class="upload-tip">鏀寔鍥剧墖鎴栬棰戞枃浠讹紝鏈�澶�20MB</div> </Upload> - <div v-if="file" class="upload-file-info">c + <div v-if="file" class="upload-file-info"> 宸查�夋枃浠�: {{ file.name }} <Button type="text" @click="handleRemove">鍒犻櫎</Button> </div> </FormItem> </Col> + <!-- 杩欎袱涓〃鍗曢」鍦ㄥ悓涓�Row鍐咃紝浼氭樉绀哄湪鍚屼竴琛� --> <Col span="12"> <FormItem label="浜烘暟闄愬埗" prop="limitUserNum"> <InputNumber @@ -293,18 +292,8 @@ </FormItem> </Col> <Col span="24"> - <Form :model="videoDownForm" :rules="videoDownRule" ref="videoDownForm"> -<!-- <FormItem label="涓嬫灦鍘熷洜锛�" :labelWidth="100" prop="activityContent">--> -<!-- <editor ref="editor" @input="getReason" />--> -<!-- </FormItem>--> - </Form> - <FormItem label="娲诲姩鍐呭" prop="activityContent"> - <Input - v-model="activityFrom.activityContent" - type="textarea" - :rows="4" - placeholder="璇疯緭鍏ユ椿鍔ㄨ缁嗗唴瀹�" - /> + <FormItem label="娲诲姩鍐呭锛�" prop="activityContent"> + <editor ref="editor" @input="getReason" /> </FormItem> </Col> </Row> @@ -372,27 +361,6 @@ components: {Editor}, data() { return { - videoDownForm :{ - id: '', - reason: '' - }, - videoDownRule: { - reason: [ - { - require: true, - message: '璇疯緭鍏ユ椿鍔ㄥ唴瀹�', - trigger: 'blur', - validator: (rule, value, callback) => { - if (value === null || value === '') { - callback(new Error('璇疯緭鍏ユ椿鍔ㄥ唴瀹�')); - } else { - callback(); - } - } - } - ] - }, - loading: false, membersLoading: false, submitLoading: false, @@ -415,8 +383,8 @@ // 娲诲姩绫诲瀷閫夐」 typeSelect: [ - { id: 1, value: '绾夸笂' }, - { id: 2, value: '绾夸笅' } + { id: 1, value: 'online',label:'绾夸笂' }, + { id: 2, value: 'offline',label:'绾夸笅' } ], // 灏侀潰绫诲瀷閫夐」 @@ -444,7 +412,7 @@ endTime: '', recommend: false, limitUserNum: 0, - activityLocation: '' + activityLocation: '', }, // 琛ㄥ崟楠岃瘉瑙勫垯 @@ -466,6 +434,9 @@ ], cover: [ { required: true, message: '璇疯緭鍏ュ皝闈㈠唴瀹�', trigger: 'blur' } + ], + coverType: [ + { required: true, message: '璇烽�夋嫨灏侀潰绫诲瀷', trigger: 'blur' } ], limitUserNum: [ { required: true, type: 'number', message: '璇疯緭鍏ヤ汉鏁伴檺鍒�', trigger: 'blur' }, @@ -497,7 +468,11 @@ title: '娲诲姩绫诲瀷', key: 'activityType', width: 100, - align: 'center' + align: 'center', + render: (h, params) => { + return h('Tag', { + }, params.row.activityType === 'online' ? '绾夸笂' : '绾夸笅') + } }, { title: '鎺ㄨ崘', @@ -513,27 +488,37 @@ } }, { - title: '鐘舵��', - key: 'status', + title: '鍙戝竷', + key: 'publish', width: 100, align: 'center', render: (h, params) => { return h('Tag', { props: { - color: params.row.status === '宸插彂甯�' ? 'blue' : 'orange' + color: params.row.publish ? 'green' : 'default' } - }, params.row.status) + }, params.row.publish ? '宸插彂甯�' : '鏈彂甯�') } }, { - title: '鎶ュ悕鏃堕棿娈�', - key: 'reportTimeRange', - width: 300, + title: '鐘舵��', + key: 'status', + width: 100, + align: 'center', render: (h, params) => { - return h('div', [ - h('div', `寮�濮�: ${this.formatDate(params.row.reportStartTime)}`), - h('div', `缁撴潫: ${this.formatDate(params.row.reportEndTime)}`) - ]) + const status = params.row.status; + const statusMap = { + 'noStart': { text: '鏈紑濮�', color: 'default' }, + 'report': { text: '鎶ュ悕涓�', color: 'green' }, + 'inProgress':{ text:'杩涜涓�',color:'cyan'}, + 'end': { text: '宸茬粨鏉�', color: 'red' } + }; + const currentStatus = statusMap[status] || { text: status, color: 'default' }; + return h('Tag', { + props: { + color: currentStatus.color + } + }, currentStatus.text); } }, { @@ -558,7 +543,16 @@ title: '灏侀潰绫诲瀷', key: 'coverType', width: 100, - align: 'center' + align: 'center', + render: (h, params) => { + const typeMap = { + text: '鏂囨湰', + video: '瑙嗛', + image: '鍥剧墖' + }; + const text = typeMap[params.row.coverType] || params.row.coverType; + return h('span', text); + } }, { title: '浜烘暟闄愬埗', @@ -653,8 +647,7 @@ methods: { // 鑾峰彇瀵屾枃鏈紪杈戝櫒鐨勫唴瀹� getReason(content) { - this.videoDownForm.reason = content - console.log(content) + this.activityFrom.activityContent = content }, // 鍒濆鍖栨暟鎹� init() { @@ -674,8 +667,6 @@ statusLoading: false })) this.total = res.total - } else { - this.$Message.error(res.msg || '鑾峰彇娲诲姩鍒楄〃澶辫触') } }).catch(() => { this.loading = false @@ -724,7 +715,7 @@ openAdd() { this.modelTitle = '鏂板娲诲姩' this.modelShow = true - this.coverType = '' + this.coverType = '杈撳叆鏂囧瓧灏侀潰' this.file = null this.$refs.form.resetFields() this.activityFrom.id = '' @@ -736,7 +727,6 @@ this.modelShow = true this.$nextTick(() => { this.$refs.form.resetFields() - // 濉厖琛ㄥ崟鏁版嵁 this.activityFrom = { id: row.id, @@ -762,9 +752,9 @@ limitUserNum: row.limitUserNum, activityLocation: row.activityLocation } - + this.$refs.editor.setContent(this.activityFrom.activityLocation) // 璁剧疆灏侀潰绫诲瀷 - this.coverType = row.coverType === '鏂囧瓧' ? '杈撳叆鏂囧瓧灏侀潰' : '閫夋嫨鏂囦欢灏侀潰' + this.coverType = row.coverType === 'text' ? '杈撳叆鏂囧瓧灏侀潰' : '閫夋嫨鏂囦欢灏侀潰' }) }, @@ -773,11 +763,16 @@ this.modelShow = false this.file = null this.submitLoading = false + this.handleRemove(); this.$refs.form.resetFields() }, // 淇濆瓨鎴栨洿鏂版椿鍔� saveOrUpdate() { + // 璁剧疆灏侀潰绫诲瀷 + this.activityFrom.coverType = this.coverType === '杈撳叆鏂囧瓧灏侀潰' ? '鏂囧瓧' : + this.file ? this.getFileCategory(this.file.type) : + this.activityFrom.coverType this.$refs.form.validate(valid => { if (valid) { this.submitLoading = true @@ -793,11 +788,6 @@ this.activityFrom.endTime = this.formatDate(this.activityFrom.time[1], 'YYYY-MM-DD HH:mm:ss') } - // 璁剧疆灏侀潰绫诲瀷 - this.activityFrom.coverType = this.coverType === '杈撳叆鏂囧瓧灏侀潰' ? '鏂囧瓧' : - this.file ? this.getFileCategory(this.file.type) : - this.activityFrom.coverType - const api = this.activityFrom.id ? editActivity : addActivity api(this.activityFrom).then(res => { this.submitLoading = false @@ -805,8 +795,6 @@ this.$Message.success(res.msg) this.modelClose() this.getActivityList() - } else { - this.$Message.error(res.msg || '鎿嶄綔澶辫触') } }).catch(() => { this.submitLoading = false @@ -825,8 +813,6 @@ if (res.code === 200) { this.$Message.success(res.msg) this.getActivityList() - } else { - this.$Message.error(res.msg || '鍒犻櫎澶辫触') } }) } @@ -871,8 +857,6 @@ if (res.code === 200) { this.$Message.success(res.msg) row.recommend = recommend - } else { - this.$Message.error(res.msg || '鎿嶄綔澶辫触') } }).catch(() => { row.recommendLoading = false @@ -882,18 +866,16 @@ // 鏀瑰彉娲诲姩鐘舵�� changeStatus(row, action) { row.statusLoading = true - const status = action === '鍙戝竷' ? '宸插彂甯�' : '宸蹭笅鏋�' + const publish = action === '鍙戝竷' activityChangeStatus({ id: row.id, - status: status + publish: publish }).then(res => { row.statusLoading = false if (res.code === 200) { this.$Message.success(res.msg) - row.status = status - } else { - this.$Message.error(res.msg || '鎿嶄綔澶辫触') + row.publish = publish } }).catch(() => { row.statusLoading = false @@ -917,8 +899,6 @@ if (res.code === 200) { this.membersList = res.data this.memberTotal = res.total - } else { - this.$Message.error(res.msg || '鑾峰彇鎶ュ悕浜哄憳澶辫触') } }).catch(() => { this.membersLoading = false @@ -986,8 +966,6 @@ if (res.code === 200) { this.activityFrom.cover = res.data.fileKey this.$Message.success('涓婁紶鎴愬姛') - } else { - this.$Message.error(res.msg || '涓婁紶澶辫触') } }).catch(() => { this.submitLoading = false @@ -996,24 +974,18 @@ // 鍒犻櫎鏂囦欢 handleRemove() { + //鐐瑰嚮鍏抽棴绐楀彛鏃剁‘淇濇枃浠跺凡琚竻闄� + if(this.file === null){ + return; + } if (!this.activityFrom.cover) { this.file = null return } - - this.$Modal.confirm({ - title: '纭鍒犻櫎', - content: '纭畾瑕佸垹闄ゅ凡涓婁紶鐨勬枃浠跺悧?', - onOk: () => { - delByKey(this.activityFrom.cover).then(res => { - if (res.code === 200) { - this.$Message.success(res.msg) - this.file = null - this.activityFrom.cover = '' - } else { - this.$Message.error(res.msg || '鍒犻櫎澶辫触') - } - }) + delByKey(this.activityFrom.cover).then(res => { + if (res.code === 200) { + this.file = null + this.activityFrom.cover = '' } }) }, @@ -1027,14 +999,14 @@ // 鑾峰彇鏂囦欢鍒嗙被 getFileCategory(mimeType) { const typeMap = { - 'image': '鍥剧墖', - 'video': '瑙嗛', - 'audio': '闊抽', - 'application': '鏂囨。' + 'image': 'image', + 'video': 'video', + 'audio': 'audio', + 'application': 'application' } const typePrefix = mimeType.split('/')[0] - return typeMap[typePrefix] || '鏈煡' + return typeMap[typePrefix] || 'unknown' }, // 鏍煎紡鍖栨棩鏈� diff --git a/manager/src/views/customer/customer-tag/index.vue b/manager/src/views/customer/customer-tag/index.vue new file mode 100644 index 0000000..8bbc2ac --- /dev/null +++ b/manager/src/views/customer/customer-tag/index.vue @@ -0,0 +1,295 @@ +<template> + <div> + <card> + <Form + ref="searchForm" + @keydown.enter.native="handleSearch" + :model="searchForm" + inline + :label-width="70" + class="search-form" + > + <Form-item label="鏍囩鍚嶇О" prop="tagName"> + <Input + type="text" + v-model="searchForm.tagName" + clearable + @on-clear="handleSearch" + @on-change="handleSearch" + style="width: 160px" + /> + </Form-item> + <Form-item label="鏍囩鏉ユ簮" prop="createType"> + <Select + v-model="searchForm.createType" + clearable + @on-clear="handleSearch" + @on-change="handleSearch" + style="width: 160px" + > + <Option value="SYSTEM">绯荤粺鍒涘缓</Option> + <Option value="USER">鐢ㄦ埛鍒涘缓</Option> + </Select> + </Form-item> + <Button + @click="handleSearch" + type="primary" + icon="ios-search" + class="search-btn" + >鎼滅储</Button + > + </Form> + + <Row class="operation padding-row"> + <Button @click="openAdd" type="info">娣诲姞</Button> + <Button @click="delBatch" type="error">鎵归噺鍒犻櫎</Button> + </Row> + + <Table + :loading="loading" + border + :columns="columns" + :data="tagList" + ref="table" + sortable="custom" + @on-sort-change="changeSort" + @on-selection-change="showSelect" + > + <template slot-scope="{ row, index }" slot="action"> + <Button type="info" size="small" style="margin-right: 5px" @click="openEdit(row)">缂栬緫鏍囩</Button> + <Button type="error" size="small" style="margin-right: 5px" @click="del(row)">鍒犻櫎鏍囩</Button> + </template> + </Table> + + <Row type="flex" justify="end" class="mt_10"> + <Page + :current="searchForm.pageNumber" + :total="total" + :page-size="searchForm.pageSize" + @on-change="changePage" + @on-page-size-change="changePageSize" + :page-size-opts="[10, 20, 50]" + size="small" + show-total + show-elevator + show-sizer + ></Page> + </Row> + + <Modal + v-model="modelShow" + :title="modelTitle" + > + <Form ref="form" :model="form" :label-width="70" :rules="rules"> + <FormItem label="鏍囩鍚嶇О" prop="tagName"> + <Input v-model="form.tagName" autocomplete="off"/> + </FormItem> + </Form> + <div slot="footer"> + <Button type="text" @click="modelClose">鍙栨秷</Button> + <Button type="primary" :loading="submitLoading" @click="saveOrUpdate">鎻愪氦</Button> + </div> + </Modal> + </card> + </div> +</template> + +<script> +import JsonExcel from "vue-json-excel"; +import {getPageTagList,addCustomerTag,editTag,} from "@/api/customer"; + + + +export default { + name:"customer-tag", + components:{ + "download-excel": JsonExcel, + }, + data(){ + return{ + loading:false, + columns:[ + { + type: 'selection', + width: 60, + align: 'center' + }, + { + title:'鏍囩鍚嶇О', + key: 'tagName', + minWidth: 60, + tooltip: true, + }, + { + title: '鎿嶄綔', + key: 'action', + slot: 'action', + minWidth: 150, + align: 'center' + } + ], + total:0, + tagList:[], + + searchForm: { + // 鎼滅储妗嗗垵濮嬪寲瀵硅薄 + pageNumber: 1, // 褰撳墠椤垫暟 + pageSize: 10, // 椤甸潰澶у皬 + tagName: '', // 鏍囩鍚嶇О + createType: '', // 鍒涘缓鏂瑰紡 + + }, + // 瀵硅瘽妗嗘爣棰� + modelTitle:'', + modelShow:false, + submitLoading:false, + // 琛ㄥ崟 + form: { + id: '', + tagName: '', + createType: 'SYSTEM' + }, + rules: { + tagName: [ + {required: true, message: "鏍囩鍚嶇О涓嶈兘涓虹┖", trigger: "blur"} + ], + }, + + //澶氶�� + selectCount: 0, // 宸查�夋暟閲� + selectList: [], // 宸查�夋暟鎹垪琛� + } + }, + mounted(){ + this.init(); + }, + methods:{ + init(){ + this.getTagList() + }, + getTagList(){ + this.loading = true; + getPageTagList(this.searchForm).then((res) => { + this.loading = false; + if (res.code === 200) { + this.tagList = res.data; + this.total = res.total; + } + }); + this.loading = false; + }, + handleSearch(){ + this.searchForm.pageNumber = 1; + this.searchForm.pageSize = 10; + this.getTagList(); + }, + openAdd(){ + this.modelTitle = "鏂板鏍囩" + this.modelShow = true + }, + saveOrUpdate() { + this.$refs.form.validate(valid => { + if (valid) { + this.submitLoading = true + if (this.form.id) { + // 淇敼 + editTag(this.form).then(res => { + if (res.code === 200) { + this.$Message.success("淇敼鎴愬姛"); + this.modelClose() + this.getTagList() + } + }) + } else { + // 鏂板 + addCustomerTag(this.form).then(res => { + if (res.code === 200) { + this.$Message.success("娣诲姞鎴愬姛"); + this.modelClose() + this.getTagList() + } + }) + } + } + }); + }, + // 鍏抽棴寮圭獥 + modelClose() { + this.submitLoading = false + this.modelShow = false + }, + delBatch(){ + if (this.selectCount <= 0) { + this.$Message.warning("鎮ㄨ繕鏈�夋嫨瑕佸垹闄ょ殑鏁版嵁"); + return; + } + this.$Modal.confirm({ + title: "纭鍒犻櫎", + content: "鎮ㄧ‘璁よ鍒犻櫎鎵�閫夌殑 " + this.selectCount + " 鏉℃暟鎹�?", + loading: true, + onOk: () => { + + } + }); + }, + + openEdit(row){ + + }, + del(row){ + + }, + + + + + // 鍒嗛〉 鏀瑰彉椤电爜 + changePage(v) { + this.searchForm.pageNumber = v; + this.getTagList(); + }, + // 鍒嗛〉 鏀瑰彉椤垫暟 + changePageSize(v) { + this.searchForm.pageNumber = 1; + this.searchForm.pageSize = v; + this.getTagList(); + }, + + changeSort(){ + + }, + showSelect(){ + this.selectList = e.map(d => d.id); + this.selectCount = e.length; + }, + } +} + +</script> +<style lang="scss" scoped> +.export { + margin: 10px 20px 10px 0; +} +.export-excel-wrapper { + display: inline; +} +.order-tab { + width: 950px; + height: 36px; + display: flex; + align-items: center; + justify-content: space-between; + background-color: #f0f0f0; + padding: 0 10px; + margin-bottom: 10px; + div { + text-align: center; + padding: 4px 12px; + border-radius: 4px; + cursor: pointer; + } + .current { + background-color: #ffffff; + } +} +</style> -- Gitblit v1.8.0