123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <template>
- <view class="content">
- <view class="equity_box">
- <view class="text-box uni-textarea"><textarea placeholder-style="color:#999" :placeholder="placeholder" @blur="bindTextAreaBlur"></textarea></view>
- <view class="">
- <view class="add-img-box flex_item">
- <view class="add-img-item" v-for="(item, index) in imgList" :key="index">
- <image class="add-img" @click.stop="imgInfo(index)" :src="item" mode="aspectFill"></image>
- <image class="add-img-del" @click.stop="delImg(index)" src="/static/img/delete.png"></image>
- </view>
- <view v-if="imgList.length < 9" class="add-img-item" @click.stop="scImg()"><image class="add-img" src="/static/img/add.png"></image></view>
- </view>
- </view>
- </view>
- <view @click.stop="submit" class="submit-btn">提交</view>
- </view>
- </template>
- <script>
- import { upload } from '@/api/order.js';
- import { submit } from '@/api/jdr.js';
- import uniRate from '@/components/uni-rate/uni-rate.vue';
- export default {
- components: {
- uniRate
- },
- data() {
- return {
- placeholder: '请上传照片完成确认',
- imgList: [],
- unique: '', //商品唯一标识码
- imgCount: 3 //最多支持9张上传,可以修改
- };
- },
- onLoad(option) {
- this.unique = option.unique;
- },
- onShow() {},
- methods: {
- //单张上传图片
- scImg() {
- let obj = this;
- console.log(obj.imgCount, 11);
- if (obj.imgCount == 0) {
- uni.showToast({
- title: '最多添加3张图片',
- icon: 'none'
- });
- return;
- }
- upload({
- file: ''
- })
- .then(e => {
- obj.imgList.push(e[0].url);
- obj.imgCount = 3 - obj.imgList.length;
- })
- .catch(e => {});
- },
- //提交评论
- submit(e) {
- let obj = this;
- if (obj.imgList.length < 1) {
- uni.showToast({
- title: '请添加图片',
- icon: 'none'
- });
- return;
- }
- submit(
- {
- images: obj.imgList
- },
- obj.unique
- )
- .then(e => {
- uni.showModal({
- title: '提示',
- content: '提交完成成功,是否前往个人中心页',
- success: function(res) {
- if (res.confirm) {
- uni.switchTab({
- url: '/pages/user/my'
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- })
- .catch(e => {});
- },
- //点击图片显示大图
- imgInfo(i) {
- let tempList = [];
- console.log(111);
- this.imgList.forEach(e => {
- tempList.push(e);
- });
- console.log(tempList);
- //显示图片
- uni.previewImage({
- current: i,
- loop: false,
- urls: tempList,
- indicator: 'default'
- });
- },
- //删除图片
- delImg(i) {
- uni.showModal({
- content: '确定删除这张吗',
- success: res => {
- if (res.confirm) {
- this.imgList.splice(i, 1);
- this.imgCount++;
- } else if (res.cancel) {
- }
- }
- });
- },
- // 页面跳转
- navto(e) {
- uni.navigateTo({
- url: e
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background: #f8f6f6;
- height: 100%;
- .content {
- background: #f8f6f6;
- height: 100%;
- }
- }
- .equity_box {
- border-radius: 10rpx;
- padding: 25rpx 25rpx;
- margin: 25rpx 0rpx;
- background: #ffffff;
- .text-box {
- height: 200rpx;
- textarea {
- font-size: 25rpx;
- width: 100%;
- height: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 5;
- }
- }
- }
- .submit-btn {
- margin: 102rpx auto 0;
- width: 560rpx;
- height: 85rpx;
- background: #24a17d;
- border-radius: 43px;
- text-align: center;
- font-size: 36rpx;
- font-family: PingFangSC;
- font-weight: 500;
- color: #ffffff;
- line-height: 85rpx;
- }
- .add-img-box {
- width: 100%;
- flex-direction: row;
- flex-wrap: wrap;
- margin-top: 50rpx;
- }
- .add-img-item {
- width: 180rpx;
- height: 180rpx;
- border-radius: 24rpx;
- position: relative;
- margin: 0rpx 20rpx;
- margin-bottom: 25rpx;
- .add-img {
- width: 100%;
- height: 100%;
- }
- }
- .add-img-camera {
- flex: 1;
- }
- .add-img-del {
- position: absolute;
- width: 40rpx;
- height: 40rpx;
- left: 155rpx;
- bottom: 155rpx;
- //background-color: rgba(238, 0, 0, 1);
- border-radius: 20rpx;
- }
- .address-time {
- width: 484rpx;
- height: 88rpx;
- background-color: rgba(245, 245, 245, 1);
- opacity: 1;
- border-radius: 24rpx;
- text-align: center;
- font-size: 35rpx;
- font-weight: 500;
- color: rgba(51, 51, 51, 1);
- }
- .line {
- width: 750rpx;
- height: 1px;
- transform: scaleY(0.3);
- background-color: rgba(0, 0, 0, 0.5);
- }
- </style>
|