Commit 2766a416 by 姜雷

完善反馈逻辑

parent 50fa246e
......@@ -63,3 +63,18 @@ export const perfectionUserInfo = (entity: perfectionCustomerParams) =>
method: 'POST',
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 {
'pages/Feedback/Feedback',
'pages/Order/OrderDetail/OrderDetail',
'pages/SelectCampus/SelectCampus',
'pages/Content/Content',
],
window: {
backgroundTextStyle: 'light',
......
......@@ -5,4 +5,4 @@ export const BASE_SERVER_URL = 'https://ex-dev-dcxy-base-app.168cad.top';
export const CUSTOMER_SERVER_URL =
'https://ex-dev-dcxy-customer-app.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 { View, ScrollView, Image, Text, WebView } from '@tarojs/components';
......@@ -57,9 +57,8 @@ class Announcement extends Component {
});
}
geAnnDetail(id: number, title: string) {
console.log(id);
this.setState({
linkUrl: `${ANN_LINK_URL}/Content/${id}?title=${title}`,
Taro.navigateTo({
url: `/pages/Content/Content?id=${id}`,
});
}
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 @@
padding: 20px;
width: 100%;
height: 468px;
line-height: 50px;
font-size: 28px;
}
.Feedback-btn {
......
import { ComponentClass } from 'react';
import Taro, { Component, Config } from '@tarojs/taro';
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 = {
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> {
config: Config = {
navigationBarTitleText: '意见反馈',
......@@ -14,19 +36,74 @@ class Feedback extends Component<PageProps, PageState> {
constructor(props) {
super(props);
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() {
return (
<View className='Feedback'>
<Textarea
className='Feedback-input'
value={this.state.text}
value={this.state.feedbackContent}
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>
);
}
......
......@@ -150,6 +150,7 @@ class Home extends Component {
});
}
goFeedback() {
this.toggleBarMenu();
Taro.navigateTo({
url: '/pages/Feedback/Feedback',
});
......@@ -190,7 +191,12 @@ class Home extends Component {
let newPhone = phone.replace(/([0-9]{3})([0-9]{4})([0-9]{4})/, '$1****$3');
return newPhone;
};
geAnnDetail(id: number, title: string) {
console.log(id);
Taro.navigateTo({
url: `/pages/Content/Content?id=${id}`,
});
}
render() {
const { userinfo } = this.props;
const { commBean, hairDryerBean, annItem, barMenuVisiable } = this.state;
......@@ -275,7 +281,11 @@ class Home extends Component {
</View>
</View>
{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 className='ContentDate'>
{annItem.items[0].updateTime}
......
......@@ -38,8 +38,8 @@ class Login extends Component {
constructor(props) {
super(props);
this.state = {
account: '15928189723',
pwd: '123456',
account: '',
pwd: '',
};
}
......
......@@ -61,11 +61,11 @@ class Register extends Component {
constructor(props: IProps) {
super(props);
this.state = {
name: '姜雷',
cellphone: '18108096033',
name: '',
cellphone: '',
vcode: '',
pwd: '123456',
checkPwd: '123456',
pwd: '',
checkPwd: '',
sex: '1',
agree: false,
showPwd: false,
......@@ -296,7 +296,7 @@ class Register extends Component {
<Vcode
vcode-classname='registerBox-getVcode'
ref='Vcode'
onClickHandle={this.getVcode}
cellphone={cellphone}
/>
</View>
<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