Initial Commit

This commit is contained in:
quantulr
2024-05-06 15:34:15 +08:00
commit e3a0666d5a
307 changed files with 28969 additions and 0 deletions

View File

@ -0,0 +1,182 @@
const app = getApp();
const IP = app.globalData.ip;
Page({
/**
* 页面的初始数据
*/
data: {
ipUrl: app.globalData.ipUrl,
num: 0,
photo: [],
textarea: "",
phone: "",
customerId: "",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.getStorage({
key: 'user',
success: res => {
this.setData({
customerId: res.data.id
})
},
})
},
//提交
submitBut: function () {
var photos = this.data.photo.join(",")
if (this.data.phone.length == 11) {
if (this.data.textarea != "" && this.data.phone != "") {
wx.showModal({
title: '提示',
content: '确认提交反馈?',
success: ress => {
if (ress.confirm) {
wx.showLoading({
title: '提交中',
})
wx.request({
url: IP + '/wisdommining/api/user/addFeedBack',
method: 'POST',
data: {
userId: app.globalData.userId,
feedbackContent: this.data.textarea,
feedbackPhone: this.data.phone,
feedbackImage: photos,
},
success: res => {
console.log(res)
wx.hideLoading()
if (res.data.code == 1) {
wx.showToast({
title: '提交成功',
icon: 'success',
success() {
setTimeout(() => {
wx.navigateBack()
}, 1000);
}
})
} else {
wx.showModal({
title: '获取数据失败!',
content: res.data.message,
showCancel: false,
})
}
}
})
}
}
})
} else {
wx.showToast({
title: '请完善信息',
icon: 'none'
})
}
} else {
wx.showToast({
title: '手机号码有误',
icon: 'none'
})
}
},
//选择图片
revise_img: function (e) {
if (this.data.photo.length < 4) {
var a = 4 - this.data.photo.length
console.log(a)
wx.chooseImage({
count: a,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: res => {
console.log(res)
for (var i = 0; i < res.tempFilePaths.length; i++) {
wx.uploadFile({
url: IP + '/wisdommining/api/user/img',
filePath: res.tempFilePaths[i],
name: 'file',
success: ress => {
console.log(ress)
var photo = this.data.photo;
var data = JSON.parse(ress.data);
photo.push(data.src);
this.setData({
photo: photo
})
console.log(this.data.photo)
}
})
}
}
})
} else {
wx.showToast({
title: '超过上传上限',
icon: 'none'
})
}
},
//字数改变,获取输入内容-问题
num: function (e) {
this.setData({
num: e.detail.cursor,
textarea: e.detail.value,
})
},
//获取输入内容-电话
phone: function (e) {
this.setData({
phone: e.detail.value,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "问题反馈"
}

View File

@ -0,0 +1,21 @@
<view class="all">
<view class='title' style='margin-top:0;'>请输入你的问题</view>
<view class='textarea'>
<textarea placeholder='请输入文字(记得不要输入表情哦~' bindinput="num" maxlength="200" placeholder-style='color: #cccccc;'></textarea>
<view class='num'>{{num}}/200字</view>
</view>
<view class='title'>请上传照片<text>不超过4张</text></view>
<view class='photo'>
<view class='photo_cont' wx:for="{{photo}}" wx:key="index">
<image src='{{item}}'></image>
</view>
<view class='photo_upload' catchtap='revise_img'>
<image src='/icon/my_feedback_photo.png'></image>
</view>
</view>
<view class='title'>请输入手机号</view>
<view class='input'>
<input type="number" bindinput="phone" placeholder='请输入手机号,便于联系您' placeholder-style='color: #cccccc;'></input>
</view>
</view>
<view class='submit' catchtap='submitBut'>提交反馈</view>

View File

@ -0,0 +1,121 @@
page {
background-color: #fff;
}
.all {
width: 690rpx;
padding: 50rpx 30rpx 0 30rpx;
}
.title {
font-size: 32rpx;
color: #333;
margin: 60rpx 0 30rpx 0;
}
.title text {
font-size: 28rpx;
color: #bababa;
}
.textarea {
position: relative;
}
.num {
font-size: 24rpx;
color: #999999;
position: absolute;
bottom: 20rpx;
right: 40rpx;
}
.textarea textarea {
width: 650rpx;
height: 270rpx;
background-color: #f0f0f0;
border-radius: 10rpx;
font-size: 26rpx;
color: #333;
padding: 30rpx 20rpx;
}
.input {
width: 690rpx;
height: 80rpx;
background-color: #f0f0f0;
border-radius: 10rpx;
}
.input input {
width: 600rpx;
height: 80rpx;
font-size: 26rpx;
border: none;
color: #333;
line-height: 80rpx;
padding-left: 20rpx;
}
.photo {
margin-top: 50rpx;
}
.photo::after {
display: block;
content: "";
clear: both;
}
.photo_all {
float: left;
}
.photo_all>view:nth-child(4) {
margin-right: 0;
}
.photo_cont {
width: 140rpx;
height: 140rpx;
background-color: #f0f0f0;
border-radius: 10rpx;
margin-right: 30rpx;
margin-bottom: 30rpx;
float: left;
}
.photo_cont image {
width: 140rpx;
height: 140rpx;
}
.photo_upload {
width: 140rpx;
height: 140rpx;
background-color: #f0f0f0;
border-radius: 10rpx;
float: left;
}
.photo_upload image {
width: 72rpx;
height: 52rpx;
margin: 44rpx 34rpx;
}
.submit {
width: 690rpx;
height: 80rpx;
background-image: linear-gradient(-90deg,
#ee7b1e 0%,
#fdae03 100%);
border-radius: 40rpx;
font-size: 34rpx;
line-height: 80rpx;
text-align: center;
color: #f0f0f0;
margin: 80rpx auto;
}