Skip to content

Commit

Permalink
feat(client_mobile_miniapp): 新增用户反馈页面 ✨ (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvirus committed Dec 19, 2018
1 parent 41f8378 commit 32d9c9e
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client_mobile_miniapp/app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"pages": [
"pages/index/index",
"pages/feedback/feedback",
"pages/read/read",
"pages/search/search",
"pages/classify/classify",
Expand Down Expand Up @@ -31,6 +32,12 @@
"text": "书屋",
"iconPath": "./images/book-shop.png",
"selectedIconPath": "./images/book-shop-selected.png"
},
{
"pagePath": "pages/feedback/feedback",
"text": "反馈",
"iconPath": "./images/book-feedback.png",
"selectedIconPath": "./images/book-feedback-selected.png"
}
]
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client_mobile_miniapp/images/book-feedback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions client_mobile_miniapp/pages/feedback/feedback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
var api = require('../../utils/api.js')
var { request } = require('../../utils/request.js')

Page({

/**
* 页面的初始数据
*/
data: {
title: '',
content: '',
},

/**
* 监听标题变化
*/
handleChangeTitle: function (e) {
this.setData({ title: e.detail.value })
},

/**
* 监听内容变化
*/
handleChangeContent: function (e) {
this.setData({ content: e.detail.value })
},

/**
* 提交
*/
handleSubmit: function () {
var that = this
var { title, content } = this.data
var userId = wx.getStorageSync('user_id') || '-1'

if (!title || !content) {
return wx.showToast({
title: '标题和内容不能为空',
})
}

request({
url: api.SEND_FEEDBACK_EMAIL,
method: 'POST',
data: { title, content, userId }
}).then(function (res) {
that.setData({ title: '', content: '' })
wx.showToast({
title: '提交成功',
})
wx.switchTab({
url: '../index/index',
})
})
},

})
1 change: 1 addition & 0 deletions client_mobile_miniapp/pages/feedback/feedback.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
13 changes: 13 additions & 0 deletions client_mobile_miniapp/pages/feedback/feedback.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<view class="wrapper padTop">
<view class="header"></view>

<view class="greeting">亲爱的用户您好,感谢您的反馈:</view>

<input class="title" placeholder="哪个页面体验有瑕疵" bindinput="handleChangeTitle"></input>

<textarea class="content" placeholder="描述具体内容"
maxlength="300" bindinput="handleChangeContent"></textarea>

<button class="btn" type="primary" bindtap="handleSubmit">提交</button>

</view>
24 changes: 24 additions & 0 deletions client_mobile_miniapp/pages/feedback/feedback.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.greeting {
margin: 40rpx;
font-size: 34rpx;
}

.title {
background: #fff;
margin: 20rpx;
padding: 20rpx;
font-size: 34rpx;
}

.content {
background: #fff;
width: 90%;
margin: 20rpx;
padding: 20rpx;
font-size: 38rpx;
}

.btn {
margin-top: 40rpx;
width: 90%;
}
2 changes: 2 additions & 0 deletions client_mobile_miniapp/utils/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ module.exports = {
GET_USER_INFO: `${apiPrefix}/gysw/user/info`, // 查询用户信息
ADD_USER_INFO: `${apiPrefix}/gysw/user/info`, // 添加用户信息
EDIT_USER_INFO: `${apiPrefix}/gysw/user/info/:user_id`, // 更新用户信息

SEND_FEEDBACK_EMAIL: `${apiPrefix}/gysw/email/feedback`, // 发送用户反馈邮件
}

0 comments on commit 32d9c9e

Please sign in to comment.