Skip to content

Commit

Permalink
fix: 🚀 修复在 app 端环境下路由插件系统使用异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Oct 18, 2023
1 parent c3b01f5 commit 894ca30
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 58 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

🚀 基于 vitejs 驱动的 uniapp 最佳实践集成模板

🚀 The best practical integrated template based on VITEJS -driven Uniapp

[查看演示](https://vite-uniapp-template.netlify.app/)

## 特点

- 💪 Assets: 提供了全局静态资源加载工具,无感切换加载本地静态资源/远程静态资源,解决小程序环境下包大小限制问题。
- 📦 SubPackages: 符合心智模型的分包风格,合理的 pages 目录结构,与分包配置轻松实现功能分包。
- 🛣 Router: 使用 uniapp-router-next,并通过优化封装,API 同 VueRouter 类似,扩展了拦截器、中间件、路由别名功能。
- 📊 Store: 使用 Pinia 强力驱动,轻松实现应用状态管理。
- ⚡️ Request: 请求库使用 uni-network 完全基于 uniapp API 编写的高性能请求库, API 同 axios。
- 🛣 Router: 使用 [uniapp-router-next](https://gitee.com/wen-jason/uni-router/tree/main/packages/uniapp-router-next),并通过优化封装,API 同 VueRouter 类似,扩展了拦截器、中间件、路由别名功能。
- 📊 Store: 使用 [Pinia](https://pinia.vuejs.org/zh/) 强力驱动,轻松实现应用状态管理。
- ⚡️ Request: 请求库使用 [uni-network](https://github.com/uni-helper/uni-network) 完全基于 uniapp API 编写的高性能请求库, API 同 axios。
- 👇 Z-paging: 内置了高性能且易于使用的业务常用下拉分页组件模块,轻松实现下拉刷新、上拉加载等功能。
- 💅 Unocss: 使用原子化 CSS 引擎,小程序环境下依然完美支持原子化的 class 命名书写规则。
- 🎨 UI-libs: 预设了 uivew-plus 和 uni-ui 两者相辅相成,轻松满足绝大多数业务场景,并支持主题色定制功能。
- 🎨 UI-libs: 预设了 [uivew-plus](https://uiadmin.net/uview-plus/)[uni-ui](https://uniapp.dcloud.net.cn/component/uniui/uni-ui.html) 两者相辅相成,轻松满足绝大多数业务场景,并支持主题色定制功能。
- 📝 NoTs: 只使用 JavaScript,在常规业务场景或人员水平差距过大情况下,TypeScript 并不会提升开发体验。

## 使用方法
Expand Down Expand Up @@ -44,6 +42,8 @@ pnpm install
pnpm dev:h5
# 微信小程序端
pnpm dev:mp-weixin
# 安卓端
pnpm dev:app-android
#... 更多端请参阅 package.json/script
```

Expand Down Expand Up @@ -302,7 +302,7 @@ export default (router) => {

### 支持项目

> 如果该项目帮到你的话,可以请我喝杯咖啡,让我更有精神完善该项目😛
> 如果该项目帮到你的话,可以请我喝杯咖啡,让我更有精神完善该项目 😛
<div style="display:flex;">
<img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/79dcbc40246743e2b6870419e88e0392~tplv-k3u1fbpfcp-watermark.image?" alt="payment-weixin" style="width: 45%;">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"lodash-es": "^4.17.21",
"pinia": "2.0.33",
"qs": "6.9.7",
"uniapp-router-next": "^1.1.9",
"uniapp-router-next": "^1.2.3",
"uview-plus": "^3.1.35",
"vue": "3.2.47",
"vue-i18n": "^9.1.9",
Expand Down
22 changes: 9 additions & 13 deletions pages.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,13 @@ export default defineUniPages({
navigationBarBackgroundColor: '#ffffff',
backgroundColor: '#f8f8f8',
},
condition: {
current: 0,
list: [
{
name: 'pages/contact/index',
path: 'pages/contact/index',
},
{
name: 'pages/realname/index',
path: 'pages/realname/index',
},
],
},
// condition: {
// current: 0,
// list: [
// {
// name: 'pages/contact/index',
// path: 'pages/contact/index',
// },
// ],
// },
})
13 changes: 0 additions & 13 deletions src/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,5 @@
"navigationBarTitleText": "vite-uniapp-template",
"navigationBarBackgroundColor": "#ffffff",
"backgroundColor": "#f8f8f8"
},
"condition": {
"current": 0,
"list": [
{
"name": "pages/contact/index",
"path": "pages/contact/index"
},
{
"name": "pages/realname/index",
"path": "pages/realname/index"
}
]
}
}
27 changes: 3 additions & 24 deletions src/pages/login/phone/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
</view>
<view class="px-4 mt-18">
<u-button type="primary" shape="circle" ripple @click="handleLogin">
<!-- open-type="getPhoneNumber" -->
<!-- @getphonenumber="handleLogin" -->
手机号快捷登录
</u-button>
<view class="text-center mt-4 flex items-center justify-center">
Expand Down Expand Up @@ -54,12 +52,9 @@ export default {
enterpriseInfo,
version,
agreed: false,
loginCode: '',
}
},
onShow() {
// this.getLoginCode()
},
onShow() {},
methods: {
handleInfo() {
this.$Router.push({
Expand All @@ -70,21 +65,10 @@ export default {
},
})
},
getLoginCode() {
uni.login({
provider: 'weixin', // 使用微信登录
success: (res) => {
console.log('handleBeforeLogin.res', res)
this.loginCode = res.code
},
})
},
handleAgree() {
this.$Router.push({ path: '/pages/statement/index' })
},
async handleLogin({ detail = {} } = {}) {
console.log('login.detail', detail)
async handleLogin() {
if (!this.agreed) {
try {
await this.$dialog('是否已阅读并同意《产品服务协议》?', {
Expand All @@ -101,12 +85,7 @@ export default {
}
}
const params = {
...detail,
code: this.loginCode,
encryptedData: detail.encryptedData,
iv: detail.iv,
}
const params = {}
await this.$store.user.login(params)
await this.$toast('登录成功', { type: 'success' })
Expand Down

0 comments on commit 894ca30

Please sign in to comment.