Commit 61458afd by 姜雷

添加支付调试页面

parent 19920257
{
"name": "wx-school-app",
"version": "1.0.10",
"version": "1.0.11",
"private": true,
"description": "",
"scripts": {
......
......@@ -48,6 +48,8 @@ class App extends Component {
'pages/Password/ChangeHardwareAccount',
'pages/Password/ChangeTelAccount',
'pages/AppLaunch/AppLaunch',
'pages/WashingMachine/WashingMachine',
'pages/stringPay/stringPay',
],
window: {
backgroundTextStyle: 'light',
......
import { View } from '@tarojs/components';
const WashingMachine = () => {
return <View>WashingMachine</View>;
};
export default WashingMachine;
.stringPay {
padding: 20px;
.stringPay-input {
width: 100%;
height: 600px;
border: 1px solid #eee;
margin-bottom: 50px;
}
}
import './stringPay.scss';
import Taro, { Component, useState, useCallback } from '@tarojs/taro';
import { View, Button, Textarea } from '@tarojs/components';
class stringPay extends Component {
render() {
const [value, setValue] = useState('');
const inputHandle = useCallback(
e => {
setValue(e.detail.value);
},
[setValue],
);
const payHandle = () => {
console.log(value);
if (value) {
const payData = JSON.parse(value);
Taro.requestPayment({
timeStamp: payData.timeStamp.toString(),
nonceStr: payData.nonceStr,
package: payData.package,
signType: payData.signType,
paySign: payData.paySign,
}).then(res => {
console.log(res);
Taro.showToast({
title: '支付成功!',
icon: 'success',
mask: true,
});
setValue('');
});
}
};
return (
<View className='stringPay'>
<Textarea
className='stringPay-input'
value={value}
maxlength={-1}
onInput={inputHandle}></Textarea>
<Button onClick={payHandle}>支付</Button>
</View>
);
}
}
export default stringPay;
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