Commit c4f48302 authored by Menethil's avatar Menethil
Browse files

Merge remote-tracking branch 'origin/master'

parents 8f75afed c82046b7
......@@ -38,4 +38,4 @@ export function deleteFeedback(data) {
method: 'post',
data
})
}
\ No newline at end of file
}
......@@ -65,8 +65,8 @@ export const asyncRouterMap = [
{ path: 'address', component: _import('user/address'), name: 'address', meta: { title: '收货地址', noCache: true }},
{ path: 'collect', component: _import('user/collect'), name: 'collect', meta: { title: '会员收藏', noCache: true }},
{ path: 'footprint', component: _import('user/footprint'), name: 'footprint', meta: { title: '会员足迹', noCache: true }},
{ path: 'history', component: _import('user/history'), name: 'history', meta: { title: '搜索历史', noCache: true }}
{ path: 'feedback', component: _import('user/feedback'), name: 'feedback', meta: { title: '意见反馈', noCache: true }}
{ path: 'history', component: _import('user/history'), name: 'history', meta: { title: '搜索历史', noCache: true }},
{ path: 'feedback', component: _import('user/feedback'), name: 'feedback', meta: { title: '意见反馈', noCache: true }}
]
},
......
......@@ -49,12 +49,6 @@
<artifactId>weixin-java-miniapp</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.45</version>
</dependency>
</dependencies>
<build>
......
package org.linlinjava.litemall.wx.web;
import com.alibaba.fastjson.JSONObject;
import org.linlinjava.litemall.core.util.JacksonUtil;
import org.linlinjava.litemall.core.util.RegexUtil;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.LitemallFeedback;
......@@ -12,17 +12,11 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.time.LocalDateTime;
/**
* @author Yogeek
* @date 2018/8/25 14:10
......@@ -36,67 +30,33 @@ public class WxFeedbackController {
@Autowired
private LitemallFeedbackService feedbackService;
@Autowired
protected HttpServletRequest request;
@Autowired
private LitemallUserService userService;
/**
* 意见反馈
*/
@PostMapping("submit")
@ResponseBody
public Object save(@LoginUser Integer userId){
if(userId == null){
public Object submit(@LoginUser Integer userId, @RequestBody LitemallFeedback feedback) {
if (userId == null) {
return ResponseUtil.unlogin();
}
LitemallUser user = userService.findById(userId);
String username = user.getUsername();
//获取客户端对象
JSONObject feedbackJson = this.getJsonRequest();
if (null != feedbackJson) {
LitemallFeedback feedback = new LitemallFeedback();
String mobile = feedbackJson.getString("mobile");
// 测试手机号码是否正确
if (!RegexUtil.isMobileExact(mobile)) {
return ResponseUtil.badArgument();
}
String[] feedType = new String [] {"请选择反馈类型", "商品相关", "功能异常", "优化建议", "其他"};
int index = feedbackJson.getInteger("index");
String content = feedbackJson.getString("content");
feedback.setUserId(userId);
feedback.setUsername(username);
feedback.setMobile(mobile);
feedback.setAddTime(LocalDateTime.now());
feedback.setFeedType(feedType[index]);
//状态默认是0,1表示状态已发生变化
feedback.setStatus(1);
feedback.setContent(content);
feedbackService.add(feedback);
return ResponseUtil.ok("感谢您的反馈");
}
return ResponseUtil.badArgument();
}
private JSONObject getJsonRequest() {
JSONObject result = null;
StringBuilder sb = new StringBuilder();
try (BufferedReader reader = request.getReader();) {
char[] buff = new char[1024];
int len;
while ((len = reader.read(buff)) != -1) {
sb.append(buff, 0, len);
}
result = JSONObject.parseObject(sb.toString());
} catch (IOException e) {
e.printStackTrace();
// 测试手机号码是否正确
if (!RegexUtil.isMobileExact(feedback.getMobile())) {
return ResponseUtil.badArgument();
}
return result;
LitemallUser user = userService.findById(userId);
String username = user.getUsername();
feedback.setId(null);
feedback.setUserId(userId);
feedback.setUsername(username);
feedback.setAddTime(LocalDateTime.now());
//状态默认是0,1表示状态已发生变化
feedback.setStatus(1);
feedbackService.add(feedback);
return ResponseUtil.ok();
}
}
// 以下是业务服务器API地址
// 本机开发时使用
var WxApiRoot = 'http://localhost:8080/wx/';
var WxApiRoot = 'http://localhost:8082/wx/';
// 局域网测试使用
// var WxApiRoot = 'http://192.168.0.101:8080/wx/';
// 云平台部署时使用
// var WxApiRoot = 'http://122.152.206.172:8080/wx/';
// 云平台上线时使用
// var WxApiRoot = 'https://www.menethil.com.cn/wx/';
//var WxApiRoot = 'https://www.menethil.com.cn/wx/';
module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口
......@@ -75,6 +75,7 @@ module.exports = {
OrderConfirm: WxApiRoot + 'order/confirm', //确认收货
OrderComment: WxApiRoot + 'order/comment', // 代评价商品信息
FeedbackAdd: WxApiRoot + 'feedback/submit', //添加反馈
FootprintList: WxApiRoot + 'footprint/list', //足迹列表
FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹
......
......@@ -50,9 +50,12 @@
<view class="cart-bottom">
<view class="checkbox {{checkedAllStatus ? 'checked' : ''}}" bindtap="checkedAll">全选({{cartTotal.checkedGoodsCount}})</view>
<view class="total">{{!isEditCart ? '¥'+cartTotal.checkedGoodsAmount : ''}}</view>
<view class="delete" bindtap="editCart">{{!isEditCart ? '编辑' : '完成'}}</view>
<view class="checkout" bindtap="deleteCart" wx:if="{{isEditCart}}">删除所选</view>
<view class="checkout" bindtap="checkoutOrder" wx:if="{{!isEditCart}}">下单</view>
<view class='action_btn_area'>
<view class="{{!isEditCart ? 'edit' : 'sure'}}" bindtap="editCart">{{!isEditCart ? '编辑' : '完成'}}</view>
<view class="delete" bindtap="deleteCart" wx:if="{{isEditCart}}">删除({{cartTotal.checkedGoodsCount}})</view>
<view class="checkout" bindtap="checkoutOrder" wx:if="{{!isEditCart}}">下单</view>
<!-- </view> -->
</view>
</view>
</view>
</view>
......
This diff is collapsed.
{
"navigationBarTitleText": "",
"navigationBarTitleText": "首页",
"usingComponents": {
"zan-capsule": "../../lib/zanui-weapp/capsule/index"
}
......
......@@ -90,18 +90,31 @@ page{
}
.add-address{
background: #b4282d;
text-align: center;
width: 100%;
height: 99rpx;
line-height: 99rpx;
position: fixed;
border-radius: 0;
border: none;
color: #fff;
font-size: 29rpx;
bottom: 0;
left:0;
border: none;
right: 0;
display: flex;
justify-content: center;
align-items: center;
width: 90%;
height: 90rpx;
line-height: 98rpx;
position: absolute;
bottom: 0;
left: 0;
border-radius: 0;
padding: 0;
margin: 0;
margin-left: 5%;
text-align: center;
/* padding-left: -5rpx; */
font-size: 25rpx;
color: #f4f4f4;
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #9a9ba1 0%, #9a9ba1 100%);
}
.empty-view{
......
var util = require('../../../utils/util.js');
var check = require('../../../utils/check.js');
var api = require('../../../config/api.js');
var app = getApp();
Page({
data: {
array: ['请选择反馈类型', '商品相关', '功能异常', '优化建议', '其他'],
index: 0,
content:'',
contentLength:0,
mobile:''
content: '',
contentLength: 0,
mobile: '',
hasPicture: false,
picUrls: [],
files: []
},
chooseImage: function (e) {
if (this.data.files.length >= 5) {
util.showErrorToast('只能上传五张图片')
return false;
}
var that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function (res) {
that.setData({
files: that.data.files.concat(res.tempFilePaths)
});
that.upload(res);
}
})
},
upload: function (res) {
var that = this;
const uploadTask = wx.uploadFile({
url: api.StorageUpload,
filePath: res.tempFilePaths[0],
name: 'file',
success: function (res) {
var _res = JSON.parse(res.data);
if (_res.errno === 0) {
var url = _res.data.url
that.data.picUrls.push(url)
that.setData({
hasPicture: true,
picUrls: that.data.picUrls
})
}
},
fail: function (e) {
wx.showModal({
title: '错误',
content: '上传失败',
showCancel: false
})
},
})
uploadTask.onProgressUpdate((res) => {
console.log('上传进度', res.progress)
console.log('已经上传的数据长度', res.totalBytesSent)
console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend)
})
},
bindPickerChange: function (e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
previewImage: function (e) {
wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.files // 需要预览的图片http链接列表
})
},
bindPickerChange: function(e) {
this.setData({
index: e.detail.value
});
},
mobileInput: function (e) {
let that = this;
mobileInput: function(e) {
this.setData({
mobile: e.detail.value,
mobile: e.detail.value
});
console.log(that.data.mobile);
},
contentInput: function (e) {
let that = this;
contentInput: function(e) {
this.setData({
contentLength: e.detail.cursor,
content: e.detail.value,
});
console.log(that.data.content);
},
cleanMobile:function(){
let that = this;
clearMobile: function(e) {
this.setData({
mobile: ''
});
},
sbmitFeedback : function(e){
submitFeedback: function(e) {
if (!app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
let that = this;
if (that.data.index == 0){
if (that.data.index == 0) {
util.showErrorToast('请选择反馈类型');
return false;
}
......@@ -55,55 +116,69 @@ Page({
util.showErrorToast('请输入手机号码');
return false;
}
if (!check.isValidPhone(this.data.mobile)) {
this.setData({
mobile: ''
});
util.showErrorToast('请输入手机号码');
return false;
}
wx.showLoading({
title: '提交中...',
mask:true,
success: function () {
mask: true,
success: function() {
}
});
console.log(that.data);
util.request(api.FeedbackAdd, {
mobile: that.data.mobile,
feedType: that.data.array[that.data.index],
content: that.data.content,
hasPicture: that.data.hasPicture,
picUrls: that.data.picUrls
}, 'POST').then(function(res) {
wx.hideLoading();
util.request(api.FeedbackAdd, { mobile: that.data.mobile, index: that.data.index, content: that.data.content},'POST').then(function (res) {
if (res.errno === 0) {
console.log(res.data);
wx.hideLoading();
wx.showToast({
title: res.data,
title: '感谢您的反馈!',
icon: 'success',
duration: 2000,
complete: function () {
console.log('重新加载');
complete: function() {
that.setData({
index: 0,
content: '',
contentLength: 0,
mobile: ''
mobile: '',
hasPicture: false,
picUrls: [],
files: []
});
}
});
} else {
util.showErrorToast(res.data);
util.showErrorToast(res.errmsg);
}
});
},
onLoad: function (options) {
onLoad: function(options) {
},
onReady: function () {
onReady: function() {
},
onShow: function () {
onShow: function() {
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
}
})
\ No newline at end of file
{
"navigationBarTitleText": "意见反馈"
}
\ No newline at end of file
......@@ -10,18 +10,26 @@
</view>
</picker>
<view class="fb-body">
<textarea class="content" placeholder="对我们网站、商品、服务,你还有什么建议吗?你还希望在商城上买到什么?请告诉我们..." bindinput ="contentInput" maxlength="500" auto-focus="true" value="{{content}}"/>
<textarea class="content" placeholder="对我们网站、商品、服务,你还有什么建议吗?你还希望在商城上买到什么?请告诉我们..." bindinput="contentInput" maxlength="500" auto-focus="true" value="{{content}}" />
<view class="weui-uploader__files" id="uploaderFiles">
<block wx:for="{{files}}" wx:key="*this">
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
</view>
</block>
<view class="weui-uploader__input-box" wx:if="{{ files.length < 5 }}">
<view class="weui-uploader__input" bindtap="chooseImage"></view>
</view>
</view>
<view class="text-count">{{contentLength}}/500</view>
</view>
<view class="fb-mobile">
<view class="label">手机号码</view>
<view class="mobile-box">
<input class="mobile" maxlength="11" type="number" placeholder="方便我们与你联系" bindinput ="mobileInput" value="{{mobile}}"/>
<!--
<image class="clear-icon" src="https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/150647657fcdd0.png" bindtap="cleanMobile"></image>
-->
<input class="mobile" maxlength="11" type="number" placeholder="方便我们与你联系" bindinput="mobileInput" value="{{mobile}}" />
<image class="clear-icon" src="/static/images/clear_input.png" wx:if="{{ mobile.length > 0 }}" catchtap="clearMobile"></image>
</view>
</view>
<view class="fb-btn" bindtap="sbmitFeedback">提交</view>
<view class="fb-btn" bindtap="submitFeedback">提交</view>
</view>
\ No newline at end of file
page{
page{
background: #f4f4f4;
min-height: 100%;
}
......@@ -36,20 +36,83 @@ page{
.fb-body{
width: 100%;
background: #fff;
height: 374rpx;
height: 600rpx;
padding: 18rpx 30rpx 64rpx 30rpx;
}
.fb-body .content{
width: 100%;
height: 100%;
height: 400rpx;
color: #333;
line-height: 40rpx;
font-size: 28rpx;
}
.weui-uploader__files{
width: 100%;
}
.weui-uploader__file {
float: left;
margin-right: 9px;
margin-bottom: 9px;
}
.weui-uploader__img {
display: block;
width: 50px;
height: 50px;
}
.weui-uploader__input-box {
float: left;
position: relative;
margin-right: 9px;
margin-bottom: 9px;
width: 50px;
height: 50px;
border: 1px solid #d9d9d9;
}
.weui-uploader__input-box:after, .weui-uploader__input-box:before {
content: " ";
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background-color: #d9d9d9;
}
.weui-uploader__input-box:before {
width: 2px;
height: 39.5px;
}
.weui-uploader__input-box:after {
width: 39.5px;
height: 2px;
}
.weui-uploader__input-box:active {
border-color: #999;
}
.weui-uploader__input-box:active:after, .weui-uploader__input-box:active:before {
background-color: #999;
}
.weui-uploader__input {
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
.fb-body .text-count{
padding-top: 17rpx;
line-height: 30rpx;
float: right;
color: #666;
......@@ -95,12 +158,13 @@ page{
font-size: 24rpx;
}
.clear-icon{
.fb-mobile .clear-icon{
position: absolute;
top: 43rpx;
top: 27rpx;
right: 30rpx;
width: 48rpx;
height: 48rpx;
z-index: 2;
}
.fb-btn{
......
......@@ -13,7 +13,7 @@ page {
.profile-info {
background-color: #ab956d;
color: #fff;
color: #f4f4f4;
display: flex;
align-items: center;
padding: 30rpx;
......@@ -175,21 +175,16 @@ page {
}
.user_tool_item_phone {
background: none !important;
font-size: 32rpx;
color: #fff !important;
border-radius: 0%;
width: 187.5rpx;
height: 142rpx;
/* border: 1px solid #757575; */
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
float: left;
background: #fff;
border-bottom: 0px solid #fafafa;
width:187.5rpx;
height:142rpx;
text-align:center;
display:flex;
justify-content:center;
align-items:center;
flex-wrap:wrap;
float:left;
background:#fff;
border-bottom:1px solid #fafafa;
}
.user_tool_item_phone::after{
border: none;
......
......@@ -7,7 +7,17 @@ Page({
showType: 0
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
// 页面初始化 options为页面跳转所带来的参数
let that = this
try {
var tab = wx.getStorageSync('tab');
this.setData({
showType: tab
});
} catch (e) {
}
},
onPullDownRefresh() {
......
......@@ -9,7 +9,7 @@ page{
width: 100%;
background: #fff;
height: 84rpx;
border-bottom: 1px solid rgba(0,0,0,.15);
/* border-bottom: 1px solid rgba(0,0,0,.15); */
}
.orders-switch .item{
......@@ -25,14 +25,14 @@ page{
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
color: #9a9ba1;
font-size: 30rpx;
width: 170rpx;
}
.orders-switch .item.active .txt{
color: #ab2b2b;
border-bottom: 4rpx solid #ab2b2b;
color: #AB956D;
border-bottom: 4rpx solid #AB956D;
}
......
......@@ -28,7 +28,7 @@
"list": []
},
"miniprogram": {
"current": 32,
"current": 33,
"list": [
{
"id": -1,
......@@ -225,7 +225,14 @@
{
"id": -1,
"name": "测试更新",
"pathName": "pages/index/index"
"pathName": "pages/index/index",
"query": ""
},
{
"id": -1,
"name": "意见反馈",
"pathName": "pages/ucenter/feedback/feedback",
"query": ""
}
]
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment