odc.xiaohui
2023-03-20 e87f184a75624e30d7ec895d5ef02ac3be5d884a
我要报案修改
4个文件已修改
153 ■■■■ 已修改文件
miniprogram/app.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
miniprogram/pages/user/report/submitReport/index.ts 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
miniprogram/pages/user/report/submitReport/index.wxml 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
miniprogram/pages/user/report/submitReport/index.wxss 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
miniprogram/app.json
@@ -43,7 +43,11 @@
        "van-checkbox": "@vant/weapp/checkbox/index",
        "van-checkbox-group": "@vant/weapp/checkbox-group/index",
        "van-field": "@vant/weapp/field/index",
        "van-picker": "@vant/weapp/picker/index"
        "van-picker": "@vant/weapp/picker/index",
        "van-tab": "@vant/weapp/tab/index",
        "van-tabs": "@vant/weapp/tabs/index",
        "van-uploader": "@vant/weapp/uploader/index",
        "van-notice-bar": "@vant/weapp/notice-bar/index"
    },
    "window": {
        "backgroundTextStyle": "light",
miniprogram/pages/user/report/submitReport/index.ts
@@ -2,6 +2,8 @@
const submitReport =getApp()
Page({
    data: {
        fileImgList: [],
        causeIndex: null,
        items:  { name: '日期时间选择', value: 'dateTime' },
        mode: 'dateTime',
        reportDetail: {},
@@ -16,14 +18,56 @@
            ],
            sexId:0
    },
    afterReadImg(event: { detail: { file: any; }; }){
        const { file } = event.detail;
        let that=this
        console.log(file);
        // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
        wx.uploadFile({
            // filePath:  this.data.imagesFile[index].tempFilePath,
                        header: {
                            'token': wx.getStorageSync('token'),
                            'content-type': 'application/json'
                        },
          url: submitReport.globalData.url+"/minio/upload",
          filePath: file.url,
          name: 'file',
          formData: { user: 'test' },
          success(res) {
            // 上传完成需要更新 fileList
            const { fileImgList = [] } = that.data;
            fileImgList.push({ ...file, url: res.data });
            that.setData({ fileImgList });
            const result = JSON.parse(res.data)
            that.setData({
                materials: that.data.materials+=result.data+","
            })
            console.log(that.data.materials);
          },
        });
    },
    //选择案件
    pickCause(e: { detail: { value: string | number; }; }) {
        console.log(e);
        this.setData({
            causeIndex: e.detail.value
        })
        this.data.reportDetail.causeId = this.data.causeList[e.detail.value].id
    },
    uploadImage() {
        wx.chooseMedia({
            sourceType:['camera'],
            mediaType: ['image'],
            success: res => {
                this.setData({
                    imagesFile: res.tempFiles
                })
                console.log(this.data.imagesFile);
                for (let index = 0; index <  this.data.imagesFile.length; index++) {
                    wx.uploadFile({
                        filePath:  this.data.imagesFile[index].tempFilePath,
@@ -90,13 +134,13 @@
        this.data.reportDetail.reportMaterials=this.data.materials
        this.data.reportDetail.userId=wx.getStorageSync('id')
        this.data.reportDetail.cheatTime=this.data.cheatTime
        if (  this.data.reportDetail.information==null||  this.data.reportDetail.reportDescription==null) {
            wx.showToast({
                icon: "none",
                title: '请完整填完表单!',
            })
            return
        }
        // if (  this.data.reportDetail.information==null||  this.data.reportDetail.reportDescription==null) {
        //     wx.showToast({
        //         icon: "none",
        //         title: '请完整填完表单!',
        //     })
        //     return
        // }
        wx.request(
            {
                url: submitReport.globalData.url+"/wx/user/addReport",
@@ -140,5 +184,16 @@
        }
        this.data.cheatTime = date.getFullYear() + "-" + month + "-" + day + " " + hours+":"+minutes+":"+secends
        console.log( this.data.cheatTime)
        wx.request(
            {
                url: submitReport.globalData.url+  "/cause/getCauseList",
                method: "GET",
                header: { 'token': wx.getStorageSync('token')},
                success: (res) => {
                    this.setData({
                        causeList: res.data.data.records
                    })
                }
            })
    }
})
miniprogram/pages/user/report/submitReport/index.wxml
@@ -54,23 +54,67 @@
    placeholder="请输入工作单位"
   
  />
  <view class="cause">
    <view class="font-wenzi-cause">描述</view>
        <picker bindchange="pickCause" class="content" value="{{causeIndex}}" range="{{causeList}}" range-key="{{'name'}}" mode="selector">
                    <view class="picker-cause">
            {{causeIndex==null?'请选择':causeList[causeIndex].name}}>
            </view>
        </picker>
    </view>
  <van-field
    required
    value="{{ phone }}"
    label="性别"
    placeholder="请输入性别"
    label="受损金额"
    placeholder="请输入受损金额"
  />
  <van-field
    required
    readonly
    value="{{ phone }}"
    label="作证材料"
    placeholder=" "
  >
</van-field>
<van-notice-bar
    mode="closeable"
  left-icon="volume-o"
  text="身份证正反必填,相关合同,交易凭证,其他;三个必须要填写一个"
/>
<van-tabs active="a" ellipsis="{{false}}">
  <van-tab title="身份证正反面"   name="a">
    <view class="upload" bindtap="uploadImage">
                <image class="imageUp" src="../../../icon/Photograph.png"></image>
                <view class="upload-wenzi">拍摄身份证照片</view>
            </view>
            <view class="imagess" wx:for="{{images}}" wx:key="index">
                <image class="image" style="width: 100%;" src="{{item.url}}" mode="aspectFill"></image>
            </view>
  </van-tab>
  <van-tab title="相关合同" name="b">
    <van-uploader
  file-list="{{ fileImgList }}"
  max-count="2"
  bind:after-read="afterReadImg"
/>
  </van-tab>
  <van-tab title="交易凭证" name="c">内容 3</van-tab>
  <van-tab title="其他"  name="d">内容 4</van-tab>
</van-tabs>
</van-cell-group>
    <view class="list1">
        <!-- <picker bindchange="cheatTime" class="content"  mode="time">请选择 </picker> -->
    <!-- <view class="list1">
        <picker bindchange="cheatTime" class="content"  mode="time">请选择 </picker>
        <time-picker mode="{{mode}}" class="content" bind:onPickerChange="onPickerChange"></time-picker>
        <view class="font-wenzi">被骗时间</view>
    </view>
    <view class="list1">
    </view> -->
    <!-- <view class="list1">
        <input bindinput="getMoney" type="digit" class="content" placeholder="请输入"  />
        <view class="font-wenzi">涉及金额</view>
    </view>
    </view> -->
    <!-- <view class="list1">
        <view class="content">{{reportDetail.idcard}}</view>
        <view class="font-wenzi">案件描述</view>
@@ -90,16 +134,16 @@
        <view class="content">{{reportDetail.cheatTime}}</view>
        <view class="font-wenzi">被骗时间</view>
    </view> -->
    <view class="list1">
    <!-- <view class="list1">
        <input bindinput="getDe" class="content" placeholder="请输入"  />
        <view class="font-wenzi">案件描述</view>
    </view>
    <view class="list1">
    </view> -->
    <!-- <view class="list1">
        <input bindinput="getInfor" maxlength="140"  class="content" placeholder="请输入"  />
        <view class="font-wenzi">补充信息</view>
    </view>
        <view>
    </view> -->
        <!-- <view>
            <view class="font-wenzi-1">报案材料</view>
            <view class="upload" bindtap="uploadImage">
                <image class="imageUp" src="../../../icon/Photograph.png"></image>
@@ -108,7 +152,7 @@
            <view class="imagess" wx:for="{{images}}" wx:key="index">
                <image class="image" style="width: 100%;" src="{{item.url}}" mode="aspectFill"></image>
            </view>
        </view>
        </view> -->
        <!-- <view class="list1">
        <picker bindchange="pickCause" class="content" value="{{causeIndex}}" range="{{causeList}}" range-key="{{'name'}}" mode="selector">请选择 >
miniprogram/pages/user/report/submitReport/index.wxss
@@ -81,3 +81,11 @@
    margin-left: 3%;
    font-size: 14px;
}
.cause{
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #646566;
    padding: 10px 16px;
    font-size: 14px;
}