import Taro, { useLoad } from '@tarojs/taro'; import { Button } from '@taroify/core'; import { useCallback } from 'react'; import HomePage from '@/components/home-page'; import { PageUrl } from '@/constants/app'; import { copy, logWithPrefix } from '@/utils/common'; import { navigateTo } from '@/utils/route'; import './index.less'; const PREFIX = 'dev-debug'; const log = logWithPrefix(PREFIX); const marginTopStyle = { marginTop: 20 }; export default function DevDebug() { // const [lastOrderNo, setLastOrderNo] = useState(''); const handleLogin = useCallback(() => { Taro.login({ success: res => { log('login code:', res.code); copy(res.code); }, fail: e => log('login fail', e), }); }, []); // const handleGetPhoneNumber = useCallback((e: BaseEventOrig) => { // log( // 'handleGetPhoneNumber', // `code: ${e.detail.code}`, // `\niv: ${e.detail.iv}`, // `\nencryptedData:${e.detail.encryptedData}` // ); // const encryptedData = e.detail.encryptedData; // const iv = e.detail.iv; // if (!encryptedData || !iv) { // Toast.error('取消授权'); // return; // } // Taro.setClipboardData({ // data: `code: ${e.detail.code}, iv: ${e.detail.iv}, encryptedData:${e.detail.encryptedData}`, // }); // }, []); // const handleCopyAndContact = async () => { // openCustomerServiceChat(); // await copy('测试复制'); // }; // const handleGetLocationInfo = () => { // requestLocation(); // }; // const handleCreateOrder = async (type: OrderType) => { // try { // const { payOrderNo, createPayInfo: payInfo } = await requestCreatePayInfo({ // type, // amt: 1, // productCode: type === OrderType.Group ? ProductType.AddGroup : ProductType.BossVip, // productSpecId: type === OrderType.Group ? ProductSpecId.AddGroup1 : ProductSpecId.BossVip, // }); // log('handlePay data', payOrderNo, payInfo); // const res = await Taro.requestPayment({ // timeStamp: payInfo.timeStamp, // nonceStr: payInfo.nonceStr, // package: payInfo.packageVal, // signType: payInfo.signType, // paySign: payInfo.paySign, // }); // setLastOrderNo(payOrderNo); // log('handleBuy requestPayment res', res); // } catch (e) { // Toast.error('出错了,请重试'); // log('handleBuy error', e); // } // }; // const handleGetOrder = async () => { // if (!lastOrderNo) { // return; // } // try { // const result = await requestOrderInfo({ // payOrderNo: lastOrderNo, // }); // Taro.showToast({ title: JSON.stringify(result), icon: 'none' }); // log('handleGetOrder data', result); // } catch (e) { // Toast.error('出错了,请重试'); // log('handleGetOrder error', e); // } // }; const handleJumpPage = () => navigateTo(PageUrl.CertificationStart); // const handleSubscribeJob = async () => { // const result = await subscribeMessage([SubscribeTempId.SUBSCRIBE_JOB]); // log('handleSubscribeMessage result', result); // Toast.info(`订阅结果: ${result[SubscribeTempId.SUBSCRIBE_JOB]}`); // }; // const handleSubscribeVip = async () => { // const result = await subscribeMessage([SubscribeTempId.SUBSCRIBE_VIP]); // log('handleSubscribeMessage result', result); // Toast.info(`订阅结果: ${result[SubscribeTempId.SUBSCRIBE_VIP]}`); // }; // const handleQiniu = async () => { // try { // const media = await chooseMedia(); // if (!media) { // return; // } // const { tempFiles } = media; // const tempFile = tempFiles[0]; // if (!tempFile) { // throw new Error('tempFile is not exist'); // } // const onProgress: UploadTask.OnProgressUpdateCallback = res => { // log('上传视频进度', res.progress, '总长度', res.totalBytesExpectedToSend, '已上传的长度', res.totalBytesSent); // Taro.showLoading({ title: `上传${res.progress}%` }); // }; // await qiniuUpload.upload(tempFile.tempFilePath, onProgress); // } catch (e) { // console.error('upload fail', e); // Toast.error('上传失败'); // } finally { // Taro.hideLoading(); // } // }; useLoad(() => { console.log('Page loaded.'); }); return (
{/*
{`最近一次的订单 ID: ${lastOrderNo}`}
*/} {/* */} {/* */} {/* */}
); }