手机端打包和选择语言

This commit is contained in:
lyp 2025-01-17 17:35:26 +08:00
parent 44f8e72977
commit 3713bf5f3e
21 changed files with 4031 additions and 336 deletions

4212
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"homepage": "/h5/",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
@ -10,6 +11,7 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@vitejs/plugin-legacy": "^4.1.1",
"antd-mobile": "^5.38.1", "antd-mobile": "^5.38.1",
"axios": "^1.7.8", "axios": "^1.7.8",
"china-area-data": "^5.0.1", "china-area-data": "^5.0.1",
@ -17,12 +19,12 @@
"china-region": "^1.4.1", "china-region": "^1.4.1",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"less": "^4.2.1", "less": "^4.2.1",
"less-loader": "^12.2.0",
"rc-picker": "^4.8.3", "rc-picker": "^4.8.3",
"react": "^18.2.0", "react": "^18.2.0",
"react-device-detect": "^2.2.3", "react-device-detect": "^2.2.3",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.28.0" "react-router-dom": "^6.28.0",
"vite-plugin-commonjs": "^0.10.4"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.2.15", "@types/react": "^18.2.15",
@ -32,6 +34,7 @@
"eslint-plugin-react": "^7.32.2", "eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3", "eslint-plugin-react-refresh": "^0.4.3",
"less-loader": "^7.3.0",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport": "^1.1.1",
"vite": "^4.4.5" "vite": "^4.4.5"
} }

View File

@ -8,6 +8,8 @@ ReactDOM.createRoot(document.getElementById('root')).render(
// //
if (isMobile) { if (isMobile) {
// //
// window.location.href = 'https://www.aimzhu.com/h5/'
// window.location.href = 'http://192.168.0.112:3000'
} else { } else {
// PC // PC
window.location.href = 'https://www.aimzhu.com/'; window.location.href = 'https://www.aimzhu.com/';

View File

@ -6,9 +6,10 @@ import List from '@/views/List/List'
import Use from '@/views/Use/Use' import Use from '@/views/Use/Use'
import Detail from '@/views/Detail/Detail' import Detail from '@/views/Detail/Detail'
const router = ( const router = (
<Router> // <Router basename="/car-shop3">
<Router basename="/h5">
<Routes> <Routes>
<Route path="/" element={<App></App>}> <Route path="/" element={<App></App>}>
<Route path="/" element={<Home />} /> <Route path="/" element={<Home />} />
<Route path="/login" element={<Login />} /> <Route path="/login" element={<Login />} />
<Route path="/list" element={<List />} /> <Route path="/list" element={<List />} />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 KiB

After

Width:  |  Height:  |  Size: 369 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 KiB

After

Width:  |  Height:  |  Size: 210 KiB

View File

@ -150,7 +150,7 @@ export default function List() {
// }, // },
// ] // ]
const getList = async (status) => { const getList = async (status) => {
setProjList([])
const res = await GetList({ const res = await GetList({
page, page,
rows: 10, rows: 10,
@ -162,14 +162,16 @@ export default function List() {
// setProjList([...projList, ...res.rows]) // setProjList([...projList, ...res.rows])
} }
const getPageList = async (status) => { const getPageList = async (status) => {
// console.log(status);
const res = await GetList({ const res = await GetList({
page: page + 1, page: page + 1,
rows: 10, rows: 10,
generateStatus: status //ALL PROCESSING COMPLETE status: status //ALL PROCESSING COMPLETE
}) })
setPage(page + 1) setPage(page + 1)
setProjList([...projList, ...res.rows]) // setProjList([...projList, ...res.rows])
setProjList(prevProjList => [...prevProjList, ...res.rows]);
} }
const nav = useNavigate() const nav = useNavigate()
@ -185,7 +187,7 @@ export default function List() {
useEffect(() => { useEffect(() => {
getList(select) getList(select)
// getPageList(select) // getPageList(select)
}, [page]) }, [])
useEffect(() => { useEffect(() => {
// token // token
let token = sessionStorage.getItem('token') let token = sessionStorage.getItem('token')

View File

@ -52,6 +52,9 @@ export default function Login() {
return return
} else { } else {
setShowBtn(false)
//
startCountdown();
var res = await GetCode(phoneNum) var res = await GetCode(phoneNum)
console.log(res); console.log(res);
@ -61,9 +64,7 @@ export default function Login() {
icon: 'success', icon: 'success',
content: '验证码已发送', content: '验证码已发送',
}) })
setShowBtn(false)
//
startCountdown();
} }
// //
const startCountdown = () => { const startCountdown = () => {

View File

@ -14,8 +14,7 @@ import {
Toast, Toast,
CheckList, CheckList,
Empty, Empty,
// Picker, Cascader,
Cascader
} from 'antd-mobile' } from 'antd-mobile'
import { CreateProj, CreateContact, CreateOwner, GetCsa, GetOwnerList, GetContactList } from '../../request/api' import { CreateProj, CreateContact, CreateOwner, GetCsa, GetOwnerList, GetContactList } from '../../request/api'
@ -36,11 +35,11 @@ export default function Use() {
const [cascaberShow, setCascaberShow] = useState(false) const [cascaberShow, setCascaberShow] = useState(false)
const onFinish = (values) => { const onFinish = (values) => {
// console.log(values); // console.log(values);
createNewOwner(values.name, values.idCardNo, values.provinceCity); createNewOwner(values.name, values.idCardNo, values.provinceCity);
}; };
const nav = useNavigate() const nav = useNavigate()
const [name, setName] = useState('') // const [name, setName] = useState('') //
@ -86,10 +85,10 @@ export default function Use() {
const [applyContactCsaNo, setApplyContactCsaNo] = useState('') // const [applyContactCsaNo, setApplyContactCsaNo] = useState('') //
const [visible, setVisible] = useState(false); // const [visible, setVisible] = useState(false); //
const [languageModal, setLanguageModal] = useState(false)//
const [time, setTime] = useState('') // const [time, setTime] = useState('') //
const [timeToast, setTimeToast] = useState(false) // const [timeToast, setTimeToast] = useState(false) //
const [programmingLanguage, setProgrammingLanguage] = useState('JAVA') //
// const [loading, setLoading] = useState(false);// // const [loading, setLoading] = useState(false);//
@ -147,7 +146,8 @@ export default function Use() {
projDevCompleteDate: time, projDevCompleteDate: time,
projName: name, projName: name,
projVersion: 'v1.0', projVersion: 'v1.0',
projChargeType: 'FREE' projChargeType: 'FREE',
backendCodeLang:programmingLanguage
}) })
// setLoading(false) // setLoading(false)
nav('/list') nav('/list')
@ -393,7 +393,8 @@ export default function Use() {
请选择知识产权联系人 请选择知识产权联系人
</div> </div>
</div> </div>
<div className='formItem'>
<div className='formItem' >
<div className='itemName'>开发完成时间</div> <div className='itemName'>开发完成时间</div>
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<Input className='formInput' value={time} <Input className='formInput' value={time}
@ -409,16 +410,30 @@ export default function Use() {
请选择开发完成时间 请选择开发完成时间
</div> </div>
</div> </div>
<DatePicker <DatePicker
visible={visible} visible={visible}
onClose={() => setVisible(false)} onClose={() => setVisible(false)}
onConfirm={handleDateChange} onConfirm={handleDateChange}
title="选择日期" title="选择日期"
/> />
<div className='formItem'>
<div className='itemName'>系统语言</div>
<div style={{ position: 'relative' }}>
<Input className='formInput disableIn' value={programmingLanguage} >
</Input>
<div className='datePick' onClick={() => {
setLanguageModal(true)
}}>
</div>
</div>
</div>
</div> </div>
<Button className='useBtn' <Button className='useBtn'
// disabled={loading} // disabled={loading}
onClick={ onClick={
@ -617,14 +632,14 @@ export default function Use() {
}} }}
onConfirm={(value) => { onConfirm={(value) => {
// console.log(value); // console.log(value);
if(value.length == 0){ if (value.length == 0) {
Toast.show({ Toast.show({
icon: 'fail', icon: 'fail',
content: '请选择省市', content: '请选择省市',
}) })
return return
} }
if(value.length < 2){ if (value.length < 2) {
Toast.show({ Toast.show({
icon: 'fail', icon: 'fail',
content: '请选择市', content: '请选择市',
@ -834,7 +849,53 @@ export default function Use() {
}} }}
/> />
{/* 选择开发语言弹窗 */}
<Modal
destroyOnClose
closeOnMaskClick
visible={languageModal}
content={
(
<div className='modalBox'>
<div className='createModalTitle'>
选择开发语言
</div>
<CheckList
onChange={(value) => {
setProgrammingLanguage(value[0])
}
}
>
<CheckList.Item
value={'JAVA'}
>
JAVA
</CheckList.Item>
<CheckList.Item
value={'NODE'}
>
NODE(JAVASCRIPT)
</CheckList.Item> <CheckList.Item
value={'PYTHON'}
>
PYTHON
</CheckList.Item> <CheckList.Item
value={'GO'}
>
GO
</CheckList.Item>
</CheckList>
</div>
)
}
closeOnAction
onClose={() => {
setLanguageModal(false)
}}
/>
</div> </div>
) )
} }

View File

@ -14,7 +14,7 @@
.formBox { .formBox {
margin-top: 60px; margin-top: 60px;
width: 291px; width: 291px;
height: 410px; height: 450px;
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
position: relative; position: relative;
padding: 0 24px; padding: 0 24px;

View File

@ -11,7 +11,7 @@
.useBox .formBox { .useBox .formBox {
margin-top: 60px; margin-top: 60px;
width: 291px; width: 291px;
height: 410px; height: 450px;
background-color: #ffffff; background-color: #ffffff;
position: relative; position: relative;
padding: 0 24px; padding: 0 24px;

View File

@ -1,9 +1,36 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import postcssPxToViewport from 'postcss-px-to-viewport'; import postcssPxToViewport from 'postcss-px-to-viewport';
// https://vitejs.dev/config/ import legacy from "@vitejs/plugin-legacy";
// import commonjs from 'vite-plugin-commonjs';
export default defineConfig({ export default defineConfig({
plugins: [react()], // base:'/car-shop3/', // 设置为相对路径
base:'/h5/', // 设置为相对路径
plugins: [
react(),
legacy({
targets: ["ie>=11"],
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
}),
],
// server: {
// proxy: {
// '/api': {
// target: 'http://localhost:3000', // 目标服务器的地址
// changeOrigin: true, // 是否改变源地址
// rewrite: (path) => path.replace(/^\/api/, '') // 路径重写,将/api替换为空
// }
// }
// },
// build: {
// commonjsOptions: {
// transformMixedEsModules: true
// }
// },
build: {
// outDir: 'dist/h5',// 输出目录设置为 dist/h5
assetsDir: 'assets',
},
server: { server: {
host: '0.0.0.0', // 允许外部网络访问 host: '0.0.0.0', // 允许外部网络访问
port: 3000, // 更改此处的端口号 port: 3000, // 更改此处的端口号
@ -32,6 +59,6 @@ export default defineConfig({
], ],
}, },
}, },
}) })