From d9687af294a85b72bab88657bcae70c99ca0b6ae Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期二, 21 三月 2023 11:27:31 +0800
Subject: [PATCH] 修改我要报案
---
miniprogram/pages/user/report/submitReport/index.ts | 113 +++++++++++++++++++++-
miniprogram/pages/user/pubulicty/index.ts | 5 +
miniprogram/pages/user/index.ts | 55 +++++++----
miniprogram/pages/user/loginInfo/index.ts | 39 ++++---
miniprogram/pages/index/index.ts | 3
miniprogram/pages/user/pubulicty/index.wxml | 3
miniprogram/pages/user/report/submitReport/index.wxml | 67 +++++++++----
miniprogram/pages/user/report/index.wxss | 3
8 files changed, 220 insertions(+), 68 deletions(-)
diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts
index 2d054e3..543c0a6 100644
--- a/miniprogram/pages/index/index.ts
+++ b/miniprogram/pages/index/index.ts
@@ -73,7 +73,7 @@
console.log("code", res.code)
wx.setStorageSync('uesrCode', res.code)
wx.setStorageSync('userPhoneNumberCode',e.detail.code)
-
+
wx.request({
url:app.globalData.url+"/wx/checkIdentity",
data: {
@@ -83,6 +83,7 @@
method: "GET",
success:(res)=>{
console.log(res);
+ wx.setStorageSync('phone', res.data.msg)
if (res.data.data==0) {
wx.redirectTo(
{
diff --git a/miniprogram/pages/user/index.ts b/miniprogram/pages/user/index.ts
index 4c62a6f..284c23d 100644
--- a/miniprogram/pages/user/index.ts
+++ b/miniprogram/pages/user/index.ts
@@ -19,31 +19,46 @@
onLoad() {
+ wx.request({
+ url: user.globalData.url+"/wx/login",
+ data: {
+ "phone": wx.getStorageSync('phone'),
+ },
+ method: "GET",
+ success: (res) => {
+ console.log(res);
+ wx.setStorageSync('token', res.data.data.token)
+ wx.setStorageSync('role', res.data.data.role)
+ wx.setStorageSync('id', res.data.data.id)
+ wx.setStorageSync('card',res.data.data.time)
+
+ wx.request(
+ {
+ url: user.globalData.url + "/wx/publicity?size=" + "4",
+ method: "GET",
+ header: { 'token': wx.getStorageSync('token') },
+ success: (res) => {
+
+ res.data.data.map(i => {
+ if (i.photoStr != null) {
+ i.photoStr = i.photoStr.split(",").map(i => user.globalData.imageUrl + "/img/" + i),
+ this.data.images = i.photoStr
+ }
+ })
+ this.setData({
+ causeList: res.data.data,
+ })
+
+
+ }
+ })
+ }})
if (wx.getStorageSync('info') == '') {
wx.redirectTo({
url: '../user/loginInfo/index'
})
}
- wx.request(
- {
- url: user.globalData.url + "/wx/publicity?size=" + "4",
- method: "GET",
- header: { 'token': wx.getStorageSync('token') },
- success: (res) => {
-
- res.data.data.map(i => {
- if (i.photoStr != null) {
- i.photoStr = i.photoStr.split(",").map(i => user.globalData.imageUrl + "/img/" + i),
- this.data.images = i.photoStr
- }
- })
- this.setData({
- causeList: res.data.data,
- })
-
-
- }
- })
+
},
getReport() {
console.log("xxx")
diff --git a/miniprogram/pages/user/loginInfo/index.ts b/miniprogram/pages/user/loginInfo/index.ts
index 4719350..c9dd48e 100644
--- a/miniprogram/pages/user/loginInfo/index.ts
+++ b/miniprogram/pages/user/loginInfo/index.ts
@@ -33,6 +33,10 @@
}
this.data.user.userIdcard=e.detail.value
},
+ getPhoneNumber:function(e){
+ console.log(e);
+
+ },
submit(){
if(!/^[\u4e00-\u9fa5]{2,4}$/.test(this.data.user.realName)){
// Toast.fail('璇疯緭鍏ユ纭殑濮撳悕');
@@ -56,10 +60,10 @@
return
}
wx.request({
+
url: loginInfo.globalData.url+"/wx/login",
data: {
- "code": wx.getStorageSync('uesrCode'),
- "phoneNumberCode": wx.getStorageSync('userPhoneNumberCode')
+ "phone": wx.getStorageSync('phone'),
},
method: "GET",
success: (res) => {
@@ -69,23 +73,26 @@
wx.setStorageSync('id', res.data.data.id)
wx.setStorageSync('card',res.data.data.time)
console.log(res.data.data.id)
+ this.data.user.id= res.data.data.id
+ wx.setStorageSync('id',res.data.data.id)
+ wx.request({
+ url:loginInfo.globalData.url+"/wx/user/add",
+ method:"POST",
+ data:this.data.user,
+ header:{
+ 'token':wx.getStorageSync('token')
+ },
+ success:(res)=>{
+ wx.setStorageSync('info',true)
+ wx.reLaunch({
+ url:'../../user/index'
+ })
+ }
+ })
}
})
- wx.request({
- url:loginInfo.globalData.url+"/wx/user/add",
- method:"POST",
- data:this.data.user,
- header:{
- 'token':wx.getStorageSync('token')
- },
- success:(res)=>{
- wx.setStorageSync('info',true)
- wx.reLaunch({
- url:'../../user/index'
- })
- }
- })
+
},
face(){
wx.chooseMedia({
diff --git a/miniprogram/pages/user/pubulicty/index.ts b/miniprogram/pages/user/pubulicty/index.ts
index b9ef926..a3db613 100644
--- a/miniprogram/pages/user/pubulicty/index.ts
+++ b/miniprogram/pages/user/pubulicty/index.ts
@@ -50,6 +50,11 @@
},
// 浜嬩欢澶勭悊鍑芥暟
onLoad() {
+ if (wx.getStorageSync('token')) {
+ this.setData({
+ cardFig:false
+ })
+ }
// this.getMobile()
// let info=wx.getStorageSync('card')
// console.log(info);
diff --git a/miniprogram/pages/user/pubulicty/index.wxml b/miniprogram/pages/user/pubulicty/index.wxml
index d3e10a6..0946492 100644
--- a/miniprogram/pages/user/pubulicty/index.wxml
+++ b/miniprogram/pages/user/pubulicty/index.wxml
@@ -23,8 +23,7 @@
<view class="lists-content">{{item.text}}</view>
</view>
</view>
-
- <view class="buttonView" wx:if="cardFig">
+ <view class="buttonView" wx:if="{{cardFig}}">
<navigator class="button" url="../loginInfo/index">鎴� 瑕� 娉� 鍐�</navigator>
</view>
<!-- <view class="buttonView"> <button class="button" bindtap="register">鎴� 瑕� 娉� 鍐�</button></view> -->
diff --git a/miniprogram/pages/user/report/index.wxss b/miniprogram/pages/user/report/index.wxss
index 8f864cc..97fdda6 100644
--- a/miniprogram/pages/user/report/index.wxss
+++ b/miniprogram/pages/user/report/index.wxss
@@ -1,6 +1,7 @@
/**index.wxss**/
.icon {
- height: 90%;
+ height: 40rem;
+ overflow: auto;
}
.font-wenzi {
diff --git a/miniprogram/pages/user/report/submitReport/index.ts b/miniprogram/pages/user/report/submitReport/index.ts
index 086251a..0f0207d 100644
--- a/miniprogram/pages/user/report/submitReport/index.ts
+++ b/miniprogram/pages/user/report/submitReport/index.ts
@@ -1,16 +1,28 @@
// index.ts
const submitReport =getApp()
+import Toast from '@vant/weapp/toast/toast';
Page({
data: {
+ beforList:'a',
+ amountInvolved:'',
+ workingLocation:'',
+ Location:'',
+ userIdCard:'',
+ sex:'鐢�',
+ realName:'',
+ phone:wx.getStorageSync('phone'),
fileImgList: [],
+ transactionReceiptList:[],
+ otherList:[],
causeIndex: null,
items: { name: '鏃ユ湡鏃堕棿閫夋嫨', value: 'dateTime' },
mode: 'dateTime',
reportDetail: {},
causeList: [],
imagesFile: [],
+ cardIdList:[],
images: [],
- materials:"",
+ materials:'',
cheatTime:"",
arraySex: [
{sex:'鐢�',id:1},
@@ -18,7 +30,44 @@
],
sexId:0
},
- afterReadImg(event: { detail: { file: any; }; }){
+ getrealName(e){
+ this.setData({
+ realName:e.detail
+ })
+ },
+ getsex(e){
+ this.setData({
+ sex:e.detail
+ })
+ },
+ getuserIdCard(e){
+ this.setData({
+ userIdCard:e.detail
+ })
+ },
+ getLocation(e){
+ this.setData({
+ Location:e.detail
+ })
+ },
+ getworkingLocation(e){
+ this.setData({
+ workingLocation:e.detail
+ })
+ },
+ getamountInvolved(e){
+ this.setData({
+ amountInvolved:e.detail
+ })
+ },
+ onChangeTabs(e){
+ this.setData({
+ beforList:e.detail.name
+ })
+ },
+ afterReadImg(event: { detail: { file: any; }; },name){
+ console.log(event,name);
+
const { file } = event.detail;
let that=this
console.log(file);
@@ -37,11 +86,24 @@
success(res) {
// 涓婁紶瀹屾垚闇�瑕佹洿鏂� fileList
const { fileImgList = [] } = that.data;
- fileImgList.push({ ...file, url: res.data });
- that.setData({ fileImgList });
-
-
- const result = JSON.parse(res.data)
+ const { transactionReceiptList = [] } = that.data;
+ const { otherList = [] } = that.data;
+ const { cardIdList = [] } = that.data;
+ let result = JSON.parse(res.data)
+ if (that.data.beforList=='a') {
+ cardIdList.push({ ...file, url: res.data });
+ that.setData({ cardIdList });
+ }else if(that.data.beforList=='b'){
+ fileImgList.push({ ...file, url: res.data });
+ that.setData({ fileImgList });
+ }else if(that.data.beforList=='c'){
+ transactionReceiptList.push({ ...file, url: res.data });
+ that.setData({ transactionReceiptList });
+ }else if(that.data.beforList=='d'){
+ otherList.push({ ...file, url: res.data });
+ that.setData({ otherList });
+ }
+
that.setData({
materials: that.data.materials+=result.data+","
@@ -110,6 +172,9 @@
this.setData({
sexId:e.detail.value
})
+this.setData({
+ sex:this.data.arraySex[e.detail.value].sex
+})
},
getMoney:function(e){
console.log(e.detail.value)
@@ -130,7 +195,41 @@
})
},
pass() {
+ console.log(this.data.realName);
+ if (this.data.realName=='') {
+ Toast('璇疯緭鍏ュ鍚嶏紒');
+ return
+ } else if(this.data.userIdCard=='') {
+ Toast('璇疯緭鍏ヨ韩浠借瘉锛�');
+ return
+ }else if(this.data.Location=='') {
+ Toast('璇疯緭鍏ョ幇浣忓潃锛�');
+ return
+ }else if(this.data.workingLocation=='') {
+ Toast('璇疯緭鍏ュ伐浣滃崟浣嶏紒');
+ return
+ }else if(this.data.amountInvolved=='') {
+ Toast('璇疯緭鍏ュ彈鎹熼噾棰濓紒');
+ return
+ }else if(this.data.cardIdList.length!=2) {
+ Toast('璇烽�夋嫨韬唤璇佺収鐗囷紒');
+ return
+ }
+ if (this.data.fileImgList.length!=0||this.data.transactionReceiptList.length!=0||this.data.otherList.length!=0) {
+
+ }else{
+
+ Toast('鐩稿叧鍚堝悓锛屼氦鏄撳嚟璇侊紝鍏朵粬;蹇呭~涓�椤癸紒');
+ return
+ }
this.data.materials=this.data.materials.substring(0,this.data.materials.length-1);
+ this.data.reportDetail.amountInvolved=this.data.amountInvolved,
+ this.data.reportDetail.workingLocation=this.data.workingLocation,
+ this.data.reportDetail.Location=this.data.Location,
+ this.data.reportDetail.userIdCard=this.data.userIdCard,
+ this.data.reportDetail.sex=this.data.sex,
+ this.data.reportDetail.realName=this.data.realName,
+ this.data.reportDetail.phone=this.data.phone,
this.data.reportDetail.reportMaterials=this.data.materials
this.data.reportDetail.userId=wx.getStorageSync('id')
this.data.reportDetail.cheatTime=this.data.cheatTime
diff --git a/miniprogram/pages/user/report/submitReport/index.wxml b/miniprogram/pages/user/report/submitReport/index.wxml
index f2a2db3..9a097a9 100644
--- a/miniprogram/pages/user/report/submitReport/index.wxml
+++ b/miniprogram/pages/user/report/submitReport/index.wxml
@@ -7,33 +7,37 @@
</view>
<van-cell-group>
<van-field
- required
- value="{{ getMoney }}"
+ bind:input="getrealName"
+ required
+ value="{{ realName }}"
label="濮撳悕"
placeholder="璇疯緭鍏ュ鍚�"
/>
- <van-field
+ <!-- <van-field
+ bind:input="getsex"
required
- value="{{ getMoney }}"
+ value="{{ sex }}"
label="鎬у埆"
placeholder="璇疯緭鍏ュ鍚�"
- />
- <!-- <view class="listSex">
+ /> -->
+ <view class="listSex">
<view > <span class="list-sure">*</span>鎬у埆</view>
<picker bindchange="bindPickerChangeSex" value="{{sexId}}" range="{{arraySex}}" range-key="sex" >
<view class="picker">
褰撳墠閫夋嫨锛歿{arraySex[sexId].sex}}
</view>
- </picker> -->
- <!-- </view> -->
+ </picker>
+ </view>
<van-field
+ bind:input="getuserIdCard"
required
- value="{{ phone }}"
+ value="{{ userIdCard }}"
label="韬唤璇�"
placeholder="璇疯緭鍏ヨ韩浠借瘉"
/>
<van-field
+ disabled
required
value="{{ phone }}"
label="鑱旂郴鐢佃瘽"
@@ -41,15 +45,17 @@
/>
<van-field
+ bind:input="getLocation"
required
- value="{{ phone }}"
+ value="{{ Location }}"
label="鐜颁綇鍧�"
placeholder="璇疯緭鍏ョ幇浣忓潃"
/>
<van-field
+ bind:input="getworkingLocation"
required
- value="{{ phone }}"
+ value="{{ workingLocation }}"
label="宸ヤ綔鍗曚綅"
placeholder="璇疯緭鍏ュ伐浣滃崟浣�"
@@ -64,44 +70,62 @@
</view>
<van-field
+ bind:input="getamountInvolved"
required
- value="{{ phone }}"
+ value="{{ amountInvolved }}"
label="鍙楁崯閲戦"
placeholder="璇疯緭鍏ュ彈鎹熼噾棰�"
/>
<van-field
required
readonly
- value="{{ phone }}"
+ value="{{ }}"
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">
+<!-- <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>
+ </view> -->
+<van-tabs active="a" ellipsis="{{false}}" bind:change="onChangeTabs">
+ <van-tab title="韬唤璇佹鍙嶉潰" name="a">
+ <van-uploader
+ file-list="{{ cardIdList }}"
+ max-count="2"
+ bind:after-read="afterReadImg"
+ capture="camera"
+ accept="image/*"
+/>
+
</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-tab title="浜ゆ槗鍑瘉" name="c">
+ <van-uploader
+ file-list="{{ transactionReceiptList }}"
+ bind:after-read="afterReadImg"
+/>
+ </van-tab>
+ <van-tab title="鍏朵粬" name="d">
+ <van-uploader
+ file-list="{{ otherList }}"
+ bind:after-read="afterReadImg"
+/>
+</van-tab>
</van-tabs>
</van-cell-group>
@@ -163,4 +187,5 @@
<button class="button2" size="mini" bindtap="pass">鎻愪氦</button>
<button class="button1" size="mini" bindtap="cancel">鍙栨秷</button>
</view>
+ <van-toast id="van-toast" />
</view>
\ No newline at end of file
--
Gitblit v1.8.0