Commit 2766a416 by 姜雷

完善反馈逻辑

parent 50fa246e
...@@ -63,3 +63,18 @@ export const perfectionUserInfo = (entity: perfectionCustomerParams) => ...@@ -63,3 +63,18 @@ export const perfectionUserInfo = (entity: perfectionCustomerParams) =>
method: 'POST', method: 'POST',
data: entity, data: entity,
}); });
type CustomerParam = {
areaId: number;
areaName: string;
customerId: number;
customerName: string;
customerPhone: string;
feedbackContent: string;
};
export const fetchFeedback = (entity: CustomerParam) =>
customerFetch({
url: '/app/customer/feed/back',
method: 'POST',
data: entity,
});
...@@ -37,6 +37,7 @@ class App extends Component { ...@@ -37,6 +37,7 @@ class App extends Component {
'pages/Feedback/Feedback', 'pages/Feedback/Feedback',
'pages/Order/OrderDetail/OrderDetail', 'pages/Order/OrderDetail/OrderDetail',
'pages/SelectCampus/SelectCampus', 'pages/SelectCampus/SelectCampus',
'pages/Content/Content',
], ],
window: { window: {
backgroundTextStyle: 'light', backgroundTextStyle: 'light',
......
...@@ -5,4 +5,4 @@ export const BASE_SERVER_URL = 'https://ex-dev-dcxy-base-app.168cad.top'; ...@@ -5,4 +5,4 @@ export const BASE_SERVER_URL = 'https://ex-dev-dcxy-base-app.168cad.top';
export const CUSTOMER_SERVER_URL = export const CUSTOMER_SERVER_URL =
'https://ex-dev-dcxy-customer-app.168cad.top'; 'https://ex-dev-dcxy-customer-app.168cad.top';
export const SCHOOL_MAIN_URL = 'https://internal-dev-school-main.168cad.top'; export const SCHOOL_MAIN_URL = 'https://internal-dev-school-main.168cad.top';
export const ANN_LINK_URL = 'https://internal-dev-school-homepage.168cad.top/'; export const ANN_LINK_URL = 'https://ex-dev-wx.168cad.top/announcement/';
import { Component } from '@tarojs/taro'; import Taro, { Component } from '@tarojs/taro';
import { ComponentClass } from 'react'; import { ComponentClass } from 'react';
import { View, ScrollView, Image, Text, WebView } from '@tarojs/components'; import { View, ScrollView, Image, Text, WebView } from '@tarojs/components';
...@@ -57,9 +57,8 @@ class Announcement extends Component { ...@@ -57,9 +57,8 @@ class Announcement extends Component {
}); });
} }
geAnnDetail(id: number, title: string) { geAnnDetail(id: number, title: string) {
console.log(id); Taro.navigateTo({
this.setState({ url: `/pages/Content/Content?id=${id}`,
linkUrl: `${ANN_LINK_URL}/Content/${id}?title=${title}`,
}); });
} }
render() { render() {
......
import { Component } from '@tarojs/taro';
import { ComponentClass } from 'react';
import { WebView } from '@tarojs/components';
import { connect } from '@tarojs/redux';
import { ANN_LINK_URL } from '../../constants';
type PageOwnProps = {
token: string;
};
type PageState = {
linkUrl: string;
};
interface Content {
props: PageOwnProps;
state: PageState;
}
@connect(({ userinfo }) => ({
token: userinfo.token,
}))
class Content extends Component {
constructor(props) {
super(props);
this.state = {
linkUrl: '',
};
this.getLinkUrl();
}
getLinkUrl() {
const { token } = this.props;
const { id } = this.$router.params;
this.setState({
linkUrl: `${ANN_LINK_URL}?id=${id}&token=${token}`,
});
}
render() {
const { linkUrl } = this.state;
return linkUrl && <WebView src={linkUrl} />;
}
}
export default Content as ComponentClass<PageOwnProps, PageState>;
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
padding: 20px; padding: 20px;
width: 100%; width: 100%;
height: 468px; height: 468px;
line-height: 50px;
font-size: 28px; font-size: 28px;
} }
.Feedback-btn { .Feedback-btn {
......
import { ComponentClass } from 'react'; import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro'; import Taro, { Component, Config } from '@tarojs/taro';
import { View, Textarea, Button } from '@tarojs/components'; import { View, Textarea, Button } from '@tarojs/components';
import { fetchFeedback } from '../../api/customer';
import { connect } from '@tarojs/redux';
import { UserState } from 'src/store/rootReducers/userinfo';
type PageProps = {}; import './Feedback.scss';
type PageProps = {
areaId: number;
areaName: string;
customerId: number;
customerName: string;
customerPhone: string;
};
type PageState = { type PageState = {
text: string; feedbackContent: string;
}; };
interface Feedback {
props: PageProps;
state: PageState;
}
@connect(({ userinfo }) => ({
areaId: userinfo.areaId,
areaName: userinfo.areaName,
customerId: userinfo.customerId,
customerName: userinfo.customerName,
customerPhone: userinfo.customerPhone,
}))
class Feedback extends Component<PageProps, PageState> { class Feedback extends Component<PageProps, PageState> {
config: Config = { config: Config = {
navigationBarTitleText: '意见反馈', navigationBarTitleText: '意见反馈',
...@@ -14,19 +36,74 @@ class Feedback extends Component<PageProps, PageState> { ...@@ -14,19 +36,74 @@ class Feedback extends Component<PageProps, PageState> {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
text: '', feedbackContent: '',
}; };
} }
feedbackHandle() {
Taro.showLoading();
const { feedbackContent } = this.state;
if (feedbackContent && feedbackContent.length > 5) {
const {
areaId,
areaName,
customerId,
customerName,
customerPhone,
} = this.props;
fetchFeedback({
areaId,
areaName,
customerId,
customerName,
customerPhone,
feedbackContent,
})
.then(res => {
Taro.hideLoading();
console.log(res);
Taro.showToast({
title: '反馈成功',
icon: 'success',
});
setTimeout(() => {
Taro.navigateBack();
}, 2000);
})
.catch(err => {
Taro.hideLoading();
console.log(err);
Taro.showToast({
title: '反馈失败',
icon: 'none',
});
});
} else {
Taro.showToast({
title: '请输入至少5个字',
icon: 'none',
});
}
}
render() { render() {
return ( return (
<View className='Feedback'> <View className='Feedback'>
<Textarea <Textarea
className='Feedback-input' className='Feedback-input'
value={this.state.text} value={this.state.feedbackContent}
placeholder='反馈问题不超过50字' placeholder='反馈问题不超过50字'
maxlength={50}
onInput={({ detail: { value } }) => {
this.setState({
feedbackContent: value.trim(),
});
return value.trim();
}}
/> />
<Button className='Feedback-btn'>提交</Button> <Button className='Feedback-btn' onClick={this.feedbackHandle}>
提交
</Button>
</View> </View>
); );
} }
......
...@@ -150,6 +150,7 @@ class Home extends Component { ...@@ -150,6 +150,7 @@ class Home extends Component {
}); });
} }
goFeedback() { goFeedback() {
this.toggleBarMenu();
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/Feedback/Feedback', url: '/pages/Feedback/Feedback',
}); });
...@@ -190,7 +191,12 @@ class Home extends Component { ...@@ -190,7 +191,12 @@ class Home extends Component {
let newPhone = phone.replace(/([0-9]{3})([0-9]{4})([0-9]{4})/, '$1****$3'); let newPhone = phone.replace(/([0-9]{3})([0-9]{4})([0-9]{4})/, '$1****$3');
return newPhone; return newPhone;
}; };
geAnnDetail(id: number, title: string) {
console.log(id);
Taro.navigateTo({
url: `/pages/Content/Content?id=${id}`,
});
}
render() { render() {
const { userinfo } = this.props; const { userinfo } = this.props;
const { commBean, hairDryerBean, annItem, barMenuVisiable } = this.state; const { commBean, hairDryerBean, annItem, barMenuVisiable } = this.state;
...@@ -275,7 +281,11 @@ class Home extends Component { ...@@ -275,7 +281,11 @@ class Home extends Component {
</View> </View>
</View> </View>
{annItem.items.length && ( {annItem.items.length && (
<View className='Home-Announcement-Content'> <View
className='Home-Announcement-Content'
onClick={() =>
this.geAnnDetail(annItem.items[0].id, annItem.items[0].title)
}>
<Text>{annItem.items[0].title}</Text> <Text>{annItem.items[0].title}</Text>
<Text className='ContentDate'> <Text className='ContentDate'>
{annItem.items[0].updateTime} {annItem.items[0].updateTime}
......
...@@ -38,8 +38,8 @@ class Login extends Component { ...@@ -38,8 +38,8 @@ class Login extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
account: '15928189723', account: '',
pwd: '123456', pwd: '',
}; };
} }
......
...@@ -61,11 +61,11 @@ class Register extends Component { ...@@ -61,11 +61,11 @@ class Register extends Component {
constructor(props: IProps) { constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {
name: '姜雷', name: '',
cellphone: '18108096033', cellphone: '',
vcode: '', vcode: '',
pwd: '123456', pwd: '',
checkPwd: '123456', checkPwd: '',
sex: '1', sex: '1',
agree: false, agree: false,
showPwd: false, showPwd: false,
...@@ -296,7 +296,7 @@ class Register extends Component { ...@@ -296,7 +296,7 @@ class Register extends Component {
<Vcode <Vcode
vcode-classname='registerBox-getVcode' vcode-classname='registerBox-getVcode'
ref='Vcode' ref='Vcode'
onClickHandle={this.getVcode} cellphone={cellphone}
/> />
</View> </View>
<View className='registerBox-title'> <View className='registerBox-title'>
......
Markdown is supported
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