| | |
| | | return http.post('/sccg/message/sendMessage', params); |
| | | } |
| | | |
| | | export function updateMessage(id, params) { |
| | | return http.post('/sccg/message/update/' + id, params); |
| | | export function updateMessage(params) { |
| | | return http.post('/sccg/message/update', params); |
| | | } |
| | |
| | | <div class="my-upload"> |
| | | <div v-if="pictureList.length > 0" class="image-box"> |
| | | <div v-for="image in pictureList" class="image-box-item"> |
| | | <i @click="handleDeletePicture(image)" class="el-icon-delete image-delete-icon"></i> |
| | | <i v-if="isShowUpload" @click="handleDeletePicture(image)" class="el-icon-delete image-delete-icon"></i> |
| | | <el-image :key="image" class="image-content" :src="image" ></el-image> |
| | | </div> |
| | | </div> |
| | | <el-upload |
| | | v-if="isShowUpload" |
| | | :file-list="fileList" |
| | | action="/sccg/file/medias" |
| | | :multiple="multiple" |
| | |
| | | :limit="limit" |
| | | :on-success="handleSuccess" |
| | | :on-error="handleError" |
| | | :list-type="listType" |
| | | :on-remove="handleRemove" |
| | | :list-type="listType" |
| | | :headers="getToken()"> |
| | | <div class="upload-btn"> |
| | | <i class="el-icon-plus"></i> |
| | |
| | | return { Authorization: tokenHead + token } |
| | | } |
| | | }, |
| | | // 移除文件 |
| | | handleRemove(file, fileList){ |
| | | this.$emit('delPictureUrl',{url:file.response.data.url1}); |
| | | }, |
| | | |
| | | handleDeletePicture(imageUrl) { |
| | | this.$emit('delPictureUrl', { url: imageUrl }); |
| | |
| | | pictureList: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | isShowUpload: { |
| | | type: Boolean, |
| | | default: () => true |
| | | } |
| | | }, |
| | | } |
| | |
| | | checkUser() { |
| | | this.$refs.userForm.validate((valid) => { |
| | | if (valid) { |
| | | this.userFlag = false; |
| | | this.evidence.userInfo = this.user.name + '...'; |
| | | this.userFlag = false; |
| | | } else { |
| | | this.evidence.userInfo = false; |
| | | return false; |
| | | this.evidence.userInfo = null; |
| | | this.$message.warning('请检查必填项'); |
| | | } |
| | | }) |
| | | }, |
| | |
| | | <el-input v-model="imagedata.id"></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="url" label="图片:" min-width="8"> |
| | | <el-upload |
| | | class="avatar-uploader" |
| | | action="" |
| | | ref="image" |
| | | :show-file-list="false" |
| | | :auto-upload="true" |
| | | :http-request="imageUpload"> |
| | | <img v-if="imagedata.url" :src="imagedata.url" class="avatar" width="100px" height="100px"> |
| | | <i v-else class="el-icon-plus avatar-uploader-icon"></i> |
| | | </el-upload> |
| | | <my-upload :picture-list="imageList" :is-show-upload="dialogType !== 'view'" @setPictureUrl="setPictureUrl" @delPictureUrl="delPictureUrl"></my-upload> |
| | | </el-form-item> |
| | | <div v-if="!isDisabled" class="optionBtn"> |
| | | <el-button type="primary" class="btn submit" @click.native.prevent="onSubmit">提交</el-button> |
| | |
| | | import { deepClone, RESOURCE_TYPE } from "@/utils/helper"; |
| | | import imageManagement from "@/api/operate/imageManagement"; |
| | | import { FILE_ORIGINAL_URL } from "@/utils"; |
| | | import MyUpload from "@/components/myUpload"; |
| | | |
| | | export default { |
| | | components: { MyUpload }, |
| | | data() { |
| | | const validateImageUrl = (rule, value, callback) => { |
| | | if (this.imagedata.url) { |
| | |
| | | url: [{ required: true, validator: validateImageUrl }], |
| | | type: [{ required: true, trigger: ['blur', 'change'], message: '请选择类型' }] |
| | | }, |
| | | isDisabled: false |
| | | isDisabled: false, |
| | | imageList: [] |
| | | } |
| | | }, |
| | | |
| | | created() { |
| | | this.imagedata = deepClone(this.originalData); |
| | | if (this.dialogType !== 'create') { |
| | | this.imagedata.url = this.imagedata.url.split(',')[0]; |
| | | this.imageList = this.imagedata.url.split(','); |
| | | } |
| | | this.isDisabled = this.dialogType === 'view'; |
| | | }, |
| | |
| | | } |
| | | }) |
| | | }, |
| | | imageUpload(file) { |
| | | const formData = new FormData(); |
| | | formData.append('file', file.file); |
| | | imageManagement.importImage(formData) |
| | | .then(res => { |
| | | this.$refs.image.clearFiles(); |
| | | this.$set(this.imagedata, 'url', FILE_ORIGINAL_URL + res.url1); |
| | | this.$message.success('上传成功'); |
| | | }) |
| | | .catch(err => { |
| | | this.$message.error(`${err}`); |
| | | this.$refs.image.clearFiles(); |
| | | }) |
| | | setPictureUrl({ url }) { |
| | | this.imageList.push(`${FILE_ORIGINAL_URL}${url}`); |
| | | this.imagedata.url = this.imageList.join(','); |
| | | }, |
| | | delPictureUrl({ url }) { |
| | | this.imageList = this.imageList.filter(item => item !== url); |
| | | this.imagedata.url = this.imageList.join(','); |
| | | }, |
| | | getResourceType(value) { |
| | | return value ? RESOURCE_TYPE.find(item => item.value === value) : RESOURCE_TYPE; |
| | |
| | | }) |
| | | ); |
| | | } else { |
| | | updateMessage(params) |
| | | updateMessage({ id: this.myDataRow.id, ...params }) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | |
| | | { required: true, trigger: ['blur', 'change'], validator: validateMessageContent } |
| | | ] |
| | | }, |
| | | colList: [{ id: "1", columnName: "验证码模板"}, {id: "2",columnName: "活动模板"}], |
| | | colList: [{ id: 1, columnName: "验证码模板"}, {id: 2, columnName: "活动模板"}], |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | |
| | | computed: { |
| | | formDisabled() { |
| | | return this.dialogType !== 'create'; |
| | | return this.dialogType === 'view'; |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | <el-table-column prop="operation" label="操作" min-width="15"> |
| | | <template slot-scope="scope"> |
| | | <div class="operation"> |
| | | <el-link icon="el-icon-view" :underline="false" @click="handleView(scope.row)">查看</el-link> |
| | | <el-link icon="el-icon-view" :underline="false" @click="handleView(scope.row, 'view')">查看</el-link> |
| | | <el-link icon="el-icon-edit" class="leftPx" :underline="false" @click="handleEdit(scope.row)">编辑</el-link> |
| | | <el-link class="leftPx" icon="el-icon-delete-solid" :underline="false" |
| | | @click="handleDelete([scope.row.id])">删除</el-link> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 新建消息 --> |
| | | <el-dialog :title="dialogType === 'create' ? '新建短信模板' : '查看短信模板'" :visible.sync="isShowDialog" width="80%" |
| | | <el-dialog :title="dialogType === 'view' ? '查看短信模板' : '更新短信模板'" :visible.sync="isShowDialog" width="80%" |
| | | :before-close="handleConfirmClose"> |
| | | <MyCreate v-if="isShowDialog" @closeMyDialog="handleConfirmClose" :dialogType="dialogType" :tableRowData="messageTemplateData"></MyCreate> |
| | | </el-dialog> |