Skip to content

Commit 32d9c9e

Browse files
committed
feat(client_mobile_miniapp): 新增用户反馈页面 ✨ (#16)
1 parent 41f8378 commit 32d9c9e

File tree

8 files changed

+104
-0
lines changed

8 files changed

+104
-0
lines changed

client_mobile_miniapp/app.json

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"pages": [
33
"pages/index/index",
4+
"pages/feedback/feedback",
45
"pages/read/read",
56
"pages/search/search",
67
"pages/classify/classify",
@@ -31,6 +32,12 @@
3132
"text": "书屋",
3233
"iconPath": "./images/book-shop.png",
3334
"selectedIconPath": "./images/book-shop-selected.png"
35+
},
36+
{
37+
"pagePath": "pages/feedback/feedback",
38+
"text": "反馈",
39+
"iconPath": "./images/book-feedback.png",
40+
"selectedIconPath": "./images/book-feedback-selected.png"
3441
}
3542
]
3643
},
Loading
6.8 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
var api = require('../../utils/api.js')
2+
var { request } = require('../../utils/request.js')
3+
4+
Page({
5+
6+
/**
7+
* 页面的初始数据
8+
*/
9+
data: {
10+
title: '',
11+
content: '',
12+
},
13+
14+
/**
15+
* 监听标题变化
16+
*/
17+
handleChangeTitle: function (e) {
18+
this.setData({ title: e.detail.value })
19+
},
20+
21+
/**
22+
* 监听内容变化
23+
*/
24+
handleChangeContent: function (e) {
25+
this.setData({ content: e.detail.value })
26+
},
27+
28+
/**
29+
* 提交
30+
*/
31+
handleSubmit: function () {
32+
var that = this
33+
var { title, content } = this.data
34+
var userId = wx.getStorageSync('user_id') || '-1'
35+
36+
if (!title || !content) {
37+
return wx.showToast({
38+
title: '标题和内容不能为空',
39+
})
40+
}
41+
42+
request({
43+
url: api.SEND_FEEDBACK_EMAIL,
44+
method: 'POST',
45+
data: { title, content, userId }
46+
}).then(function (res) {
47+
that.setData({ title: '', content: '' })
48+
wx.showToast({
49+
title: '提交成功',
50+
})
51+
wx.switchTab({
52+
url: '../index/index',
53+
})
54+
})
55+
},
56+
57+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<view class="wrapper padTop">
2+
<view class="header"></view>
3+
4+
<view class="greeting">亲爱的用户您好,感谢您的反馈:</view>
5+
6+
<input class="title" placeholder="哪个页面体验有瑕疵" bindinput="handleChangeTitle"></input>
7+
8+
<textarea class="content" placeholder="描述具体内容"
9+
maxlength="300" bindinput="handleChangeContent"></textarea>
10+
11+
<button class="btn" type="primary" bindtap="handleSubmit">提交</button>
12+
13+
</view>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.greeting {
2+
margin: 40rpx;
3+
font-size: 34rpx;
4+
}
5+
6+
.title {
7+
background: #fff;
8+
margin: 20rpx;
9+
padding: 20rpx;
10+
font-size: 34rpx;
11+
}
12+
13+
.content {
14+
background: #fff;
15+
width: 90%;
16+
margin: 20rpx;
17+
padding: 20rpx;
18+
font-size: 38rpx;
19+
}
20+
21+
.btn {
22+
margin-top: 40rpx;
23+
width: 90%;
24+
}

client_mobile_miniapp/utils/api.js

+2
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ module.exports = {
2020
GET_USER_INFO: `${apiPrefix}/gysw/user/info`, // 查询用户信息
2121
ADD_USER_INFO: `${apiPrefix}/gysw/user/info`, // 添加用户信息
2222
EDIT_USER_INFO: `${apiPrefix}/gysw/user/info/:user_id`, // 更新用户信息
23+
24+
SEND_FEEDBACK_EMAIL: `${apiPrefix}/gysw/email/feedback`, // 发送用户反馈邮件
2325
}

0 commit comments

Comments
 (0)