123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <template>
- <view class="container">
- <view class="message-form">
- <u-cell-group :border="false">
- <u-field type="textarea" placeholder="请输入留言" v-model="formData.leaMsgContent" label-width="0"></u-field>
- </u-cell-group>
- <!-- <u-upload :action="uploadUrl" max-count="5" :form-data="uploadData" @on-success="uploadSuccess" @on-error="uploadError" @on-remove="uploadRemove"></u-upload> -->
- </view>
- <view class="form-handle">
- <u-button type="success" shape="circle" :ripple="true" @click="submitData" class="handle-custom">发布</u-button>
- </view>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- data() {
- return {
- formData: {
- orderId: '',
- tenantCode: '',
- leaMsgContent: '',
- },
- uploadData: {
- folderId: 0,
- },
- uploadUrl: '',
- fileList: []
- }
- },
- onLoad(options) {
- this.uploadUrl = API.uploadFile
- this.formData.orderId = options.orderId
- this.formData.tenantCode = options.tenantCode
- },
- methods: {
- // 文件上传成功回调
- uploadSuccess(res, index, lists, name) {
- this.fileList.push(res.data.url)
- this.$refs.uTips.show({
- title: '文件上传成功',
- type: 'success',
- })
- return true
- },
- // 文件上传失败回调
- uploadError(res, index, lists, name) {
- this.$refs.uTips.show({
- title: '文件上传失败',
- type: 'warning',
- })
- },
- // 移除文件回调
- uploadRemove(index, lists, name) {
- this.fileList.splice(index, 1)
- },
- // 提交数据
- submitData() {
- NET.request(API.addMessage, {
- ...this.formData,
- leaMsgType: 1,
- mid: uni.getStorageSync("userData").userId,
- orderLeaImgResVOs: this.fileList.map((site, index) => {
- return {
- fileType: 1,
- imgUrl: site,
- sortOrder: index + 1,
- }
- })
- }, 'POST').then(res => {
- this.$refs.uTips.show({
- title: '留言成功',
- type: 'success',
- })
- setTimeout(() => {
- uni.navigateBack()
- }, 1000)
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.data.msg,
- type: 'warning',
- })
- })
- },
- },
- }
- </script>
- <style lang="less" scoped>
- page {
- width: 100%;
- height: 100%;
- }
- .container {
- width: 100%;
- height: 100%;
- float: left;
- box-sizing: border-box;
- background-color: #FFFFFF;
- padding-bottom: 70px;
- overflow-y: auto;
- .message-form {
- width: 100%;
- float: left;
- box-sizing: border-box;
- padding: 0 15px;
- background-color: #ffffff;
- /deep/.u-field {
- padding-left: 0px;
- padding-right: 0px;
- }
- /deep/.u-cell {
- padding-left: 0px;
- padding-right: 0px;
- }
- }
- .form-handle {
- width: calc(100% - 30px);
- height: 40px;
- position: fixed;
- bottom: 20px;
- left: 15px;
- .handle-custom {
- background-color: #51A539;
- /deep/button {
- background-color: #56a83a;
- }
- /deep/.u-btn--success--disabled {
- background-color: #74bd60 !important;
- }
- }
- }
- }
- </style>
|