From e87f184a75624e30d7ec895d5ef02ac3be5d884a Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期一, 20 三月 2023 09:59:09 +0800
Subject: [PATCH] 我要报案修改
---
miniprogram/pages/user/report/submitReport/index.ts | 69 ++++++++++++++++++++--
miniprogram/pages/user/report/submitReport/index.wxss | 8 ++
miniprogram/app.json | 6 +
miniprogram/pages/user/report/submitReport/index.wxml | 70 +++++++++++++++++++----
4 files changed, 132 insertions(+), 21 deletions(-)
diff --git a/miniprogram/app.json b/miniprogram/app.json
index e1e4042..c6ec919 100644
--- a/miniprogram/app.json
+++ b/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",
diff --git a/miniprogram/pages/user/report/submitReport/index.ts b/miniprogram/pages/user/report/submitReport/index.ts
index 9e2bb55..086251a 100644
--- a/miniprogram/pages/user/report/submitReport/index.ts
+++ b/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
+ })
+ }
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/pages/user/report/submitReport/index.wxml b/miniprogram/pages/user/report/submitReport/index.wxml
index 56a6c2d..f2a2db3 100644
--- a/miniprogram/pages/user/report/submitReport/index.wxml
+++ b/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">璇烽�夋嫨 >
diff --git a/miniprogram/pages/user/report/submitReport/index.wxss b/miniprogram/pages/user/report/submitReport/index.wxss
index 30a09cd..4f43c19 100644
--- a/miniprogram/pages/user/report/submitReport/index.wxss
+++ b/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;
+}
\ No newline at end of file
--
Gitblit v1.8.0