From c3b1d6e40c2c89554f51b57072efb28cf480496f Mon Sep 17 00:00:00 2001 From: xjs Date: Fri, 7 Mar 2025 18:08:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9F=A5=E4=B8=93=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 6 +- src/components/fab/FabButton.vue | 75 ++ src/login-sub/hooks/useUserInfo.ts | 2 +- src/login-sub/index.vue | 11 +- .../home/college/components/Colleges.vue | 2 +- .../home/college/components/FirstClass.vue | 2 +- .../home/college/components/Profile.vue | 2 +- src/pages-sub/home/college/info.vue | 71 +- .../{college => }/components/MessageBox.vue | 0 src/pages-sub/home/components/ProgressBar.vue | 35 + .../major/components/EmploymentProspects.vue | 112 +++ .../home/major/components/MajorBaseInfo.vue | 126 +++ .../home/major/components/MajorTreeList.vue | 13 +- .../home/major/components/MajorUniversity.vue | 105 +++ src/pages-sub/home/major/index.vue | 49 +- src/pages-sub/home/major/info.vue | 196 +++++ src/pages-sub/home/schoolRank/index.vue | 98 ++- src/pages-sub/uni_modules/z-tabs/changelog.md | 9 + .../z-tabs/components/z-tabs/config/index.js | 4 + .../z-tabs/components/z-tabs/z-tabs.vue | 791 ++++++++++++++++++ src/pages-sub/uni_modules/z-tabs/package.json | 83 ++ src/pages-sub/uni_modules/z-tabs/readme.md | 177 ++++ src/pages.json | 9 + src/pages/home/index/index.vue | 4 +- src/service/index/api.ts | 17 + src/types/uni-pages.d.ts | 1 + 26 files changed, 1882 insertions(+), 118 deletions(-) create mode 100644 src/components/fab/FabButton.vue rename src/pages-sub/home/{college => }/components/MessageBox.vue (100%) create mode 100644 src/pages-sub/home/components/ProgressBar.vue create mode 100644 src/pages-sub/home/major/components/EmploymentProspects.vue create mode 100644 src/pages-sub/home/major/components/MajorBaseInfo.vue create mode 100644 src/pages-sub/home/major/components/MajorUniversity.vue create mode 100644 src/pages-sub/home/major/info.vue create mode 100644 src/pages-sub/uni_modules/z-tabs/changelog.md create mode 100644 src/pages-sub/uni_modules/z-tabs/components/z-tabs/config/index.js create mode 100644 src/pages-sub/uni_modules/z-tabs/components/z-tabs/z-tabs.vue create mode 100644 src/pages-sub/uni_modules/z-tabs/package.json create mode 100644 src/pages-sub/uni_modules/z-tabs/readme.md diff --git a/.vscode/settings.json b/.vscode/settings.json index 8b5873b..5db78b2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -58,5 +58,9 @@ "explorer.fileNesting.patterns": { "package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,.npmrc,.browserslistrc", ".eslintrc.cjs": ".eslintignore,.prettierignore,.stylelintignore,.commitlintrc.*,.prettierrc.*,.stylelintrc.*,.eslintrc-auto-import.json,.editorconfig,.commitlint.cjs" - } + }, + "vetur.validation.template": false, + "vetur.validation.script": false, + "vetur.validation.style": false, + "vetur.experimental.templateInterpolationService": true } diff --git a/src/components/fab/FabButton.vue b/src/components/fab/FabButton.vue new file mode 100644 index 0000000..03fa26a --- /dev/null +++ b/src/components/fab/FabButton.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/login-sub/hooks/useUserInfo.ts b/src/login-sub/hooks/useUserInfo.ts index 2d0b449..c6ee25e 100644 --- a/src/login-sub/hooks/useUserInfo.ts +++ b/src/login-sub/hooks/useUserInfo.ts @@ -1,4 +1,4 @@ -import { getUniversityInfo, setWxInfo } from '@/service/index/api' +import { setWxInfo } from '@/service/index/api' //uniapp 登陆获取用户信息 export const useLogin = () => { diff --git a/src/login-sub/index.vue b/src/login-sub/index.vue index 6ddadeb..93f03ac 100644 --- a/src/login-sub/index.vue +++ b/src/login-sub/index.vue @@ -20,7 +20,12 @@ src="https://api.static.ycymedu.com/images/logo.png" mode="aspectFit" > - 立即登陆 + + 立即登陆 + @@ -28,10 +33,6 @@ + + diff --git a/src/pages-sub/home/major/components/EmploymentProspects.vue b/src/pages-sub/home/major/components/EmploymentProspects.vue new file mode 100644 index 0000000..b9f67c0 --- /dev/null +++ b/src/pages-sub/home/major/components/EmploymentProspects.vue @@ -0,0 +1,112 @@ + + + diff --git a/src/pages-sub/home/major/components/MajorBaseInfo.vue b/src/pages-sub/home/major/components/MajorBaseInfo.vue new file mode 100644 index 0000000..ce19c50 --- /dev/null +++ b/src/pages-sub/home/major/components/MajorBaseInfo.vue @@ -0,0 +1,126 @@ + + + diff --git a/src/pages-sub/home/major/components/MajorTreeList.vue b/src/pages-sub/home/major/components/MajorTreeList.vue index 590a13b..76fa3e1 100644 --- a/src/pages-sub/home/major/components/MajorTreeList.vue +++ b/src/pages-sub/home/major/components/MajorTreeList.vue @@ -9,8 +9,9 @@ :name="item.key" custom-class="custom-collapse-item" v-for="item in subMajorList.items" + :key="item.key" > - import { getUniversityRank, getUnSortType } from '@/service/index/api' -// import { useUnSortType } from '@/hooks/useUnSortType' +import zTabs from '@/pages-sub/uni_modules/z-tabs/components/z-tabs/z-tabs.vue' type UnSortType = { type: number; name: string }[] @@ -104,10 +115,6 @@ const tabsRef = ref(null) const itemClick = (item, index) => { console.log('点击了', item) } -const tabsChange = (index, name) => { - tabIndex.value = name - paging.value.reload() -} onLoad((option) => { tabIndex.value = Number(option?.type) || 0 @@ -127,6 +134,11 @@ const queryList = (page: number, pageSize: number) => { const virtualListChange = (_vList) => { schoolList.value = _vList } + +const handleTabChange = (index: number) => { + tabIndex.value = index + paging.value.reload() +} diff --git a/src/pages-sub/uni_modules/z-tabs/changelog.md b/src/pages-sub/uni_modules/z-tabs/changelog.md new file mode 100644 index 0000000..1697db2 --- /dev/null +++ b/src/pages-sub/uni_modules/z-tabs/changelog.md @@ -0,0 +1,9 @@ +## 0.3.0(2024-10-21) +支持鸿蒙Next +## 0.2.7(2024-07-18) +1.`新增` 支持切换rpx&px +2.`修复` 宽度小于屏幕时底部tabs位置不正确的问题 +3.`修复` 偶现的Cannot read property 'left' of undefind的问题 + +## 0.2.5(2023-01-09) +修复可能出现的可能出现的与swiper联动时报错node不存在的bug diff --git a/src/pages-sub/uni_modules/z-tabs/components/z-tabs/config/index.js b/src/pages-sub/uni_modules/z-tabs/components/z-tabs/config/index.js new file mode 100644 index 0000000..56c953b --- /dev/null +++ b/src/pages-sub/uni_modules/z-tabs/components/z-tabs/config/index.js @@ -0,0 +1,4 @@ +// z-tabs全局配置文件,注意避免更新时此文件被覆盖,若被覆盖,可在此文件中右键->点击本地历史记录,找回覆盖前的配置 +export default { + +} \ No newline at end of file diff --git a/src/pages-sub/uni_modules/z-tabs/components/z-tabs/z-tabs.vue b/src/pages-sub/uni_modules/z-tabs/components/z-tabs/z-tabs.vue new file mode 100644 index 0000000..5c2a123 --- /dev/null +++ b/src/pages-sub/uni_modules/z-tabs/components/z-tabs/z-tabs.vue @@ -0,0 +1,791 @@ + + + + + + + + + + + diff --git a/src/pages-sub/uni_modules/z-tabs/package.json b/src/pages-sub/uni_modules/z-tabs/package.json new file mode 100644 index 0000000..0e9e24a --- /dev/null +++ b/src/pages-sub/uni_modules/z-tabs/package.json @@ -0,0 +1,83 @@ +{ + "id": "z-tabs", + "name": "z-tabs", + "displayName": "【z-tabs】一个简单轻量的tabs组件", + "version": "0.3.0", + "description": "全平台兼容,支持nvue、vue3", + "keywords": [ + "tabs" +], + "repository": "https://github.com/SmileZXLee/uni-z-tabs", + "engines": { + "HBuilderX": "^3.0.7" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "393727164" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@zxlee/z-tabs", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "钉钉": "y", + "快手": "y", + "飞书": "y", + "京东": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/src/pages-sub/uni_modules/z-tabs/readme.md b/src/pages-sub/uni_modules/z-tabs/readme.md new file mode 100644 index 0000000..b88a608 --- /dev/null +++ b/src/pages-sub/uni_modules/z-tabs/readme.md @@ -0,0 +1,177 @@ +# z-tabs + +[![version](https://img.shields.io/badge/version-0.3.0-blue)](https://github.com/SmileZXLee/uni-z-tabs) +[![license](https://img.shields.io/github/license/SmileZXLee/uni-z-tabs)](https://en.wikipedia.org/wiki/MIT_License) + +*** + +### 反馈qq群(点击加群):[371624008](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=avPmibADf2TNi4LxkIwjCE5vbfXpa-r1&authKey=dQ%2FVDAR87ONxI4b32Py%2BvmXbhnopjHN7%2FJPtdsqJdsCPFZB6zDQ17L06Uh0kITUZ&noverify=0&group_code=371624008) + +*** + +## z-tabs文档 + +### 安装 + +#### 方式1(推荐):通过uni_modules安装,在插件市场中点击右上角【使用HbuilderX导入插件】即可。 + +*** + +#### 方式2:通过npm安装 + +```bash +//若项目之前未使用npm管理依赖(项目根目录下无package.json文件),先在项目根目录执行命令初始化npm工程 +npm init -y + +//安装 +npm install @zxlee/z-tabs --save +//更新 +npm update @zxlee/z-tabs +``` + +然后在`pages.json`中配置`easycom`(注意:下方配置只有在使用npm安装时才需要配置!!!!!) + +```json +"easycom": { + "^z-tabs": "@zxlee/z-tabs/components/z-tabs/z-tabs.vue" +} +``` + +### 基本使用 + +```html + + + +``` + + + +### props + +| 参数 | 说明 | 类型 | 默认值 | 可选值 | +| :------------------ | :----------------------------------------------------------- | :------------- | :------ | :----- | +| list | 数据源数组,支持形如`['tab1','tab2']`的格式或`[{name:'tab1',value:1}]`的格式 | Array | [] | - | +| current | 当前选中的index | Number\|String | 0 | - | +| scroll-count | list数组长度超过scrollCount时滚动显示(不自动铺满全屏) | Number\|String | 5 | - | +| tab-width | 自定义每个tab的宽度,默认为0,即代表根据内容自动撑开,单位rpx,支持传100、"100px"或"100rpx" | Number\|String | 0 | 0 | +| bar-width | 滑块宽度,单位rpx,支持传100、"100px"或"100rpx" | Number\|String | 45rpx | - | +| bar-height | 滑块高度,单位rpx,支持传100、"100px"或"100rpx" | Number\|String | 8rpx | - | +| bar-style | 滑块样式,其中的`width`和`height`将被`bar-width`和`bar-height`覆盖 | Object | {} | - | +| bottom-space | tabs与底部的间距,单位rpx,支持传100、"100px"或"100rpx" | Number\|String | 8rpx | - | +| bar-animate-mode | 【v0.1.5起支持】切换tab时滑块动画模式,与`swiper`联动时有效,点击切换tab时无效,必须调用`setDx`。默认为`line`,即切换tab时滑块宽度保持不变,线性运动。可选值为`worm`,即为类似毛毛虫蠕动效果 | String | line | worm | +| name-key | list中item的name(标题)的key | String | name | - | +| value-key | list中item的value的key | String | value | - | +| active-color | 激活状态tab的颜色 | String | #007AFF | - | +| inactive-color | 未激活状态tab的颜色 | String | #666666 | - | +| disabled-color | 禁用状态tab的颜色 | String | #bbbbbb | - | +| active-style | 激活状态tab的样式 | Object | {} | - | +| inactive-style | 未激活状态tab的样式 | Object | {} | - | +| disabled-style | 禁用状态tab的样式 | Object | {} | - | +| badge-max-count | 徽标数最大数字限制,超过这个数字将变成`badge-max-count`+ | Number\|String | 99 | - | +| badge-style | 徽标样式,例如可自定义背景色,字体等等 | Object | {} | - | +| bg-color | z-tabs背景色 | String | white | - | +| tabs-style | z-tabs样式 | Object | {} | - | +| init-trigger-change | 初始化时是否自动触发change事件 | Boolean | true | false | +| unit | z-tabs中布局的单位,默认为rpx | String | rpx | px | + + + +### events + +| 事件名 | 说明 | 回调参数 | +| ------------ | -------------------- | ------------------------------------------------------------ | +| @change | tabs改变(点击)时触发 | `参数1`:index(当前切换到的index);
`参数2`:value(当前切换到的value) | +| @secondClick | tabs二次点击时触发 | `参数1`:index(当前切换到的index);
`参数2`:value(当前切换到的value) | + +### methods + +| 方法名 | 说明 | 参数 | +| ------------------- | ------------------------------------------------------------ | -------------------------------------- | +| setDx | 根据swiper的`@transition`实时更新底部dot位置 | swiper的`@transition`中的`e.detail.dx` | +| unlockDx | 在swiper的`@animationfinish`中通知`z-tabs`结束多`setDx`的锁定,若在父组件中调用了`setDx`,则必须调用`unlockDx` | - | +| updateSubviewLayout | 在nvue+安卓中,若在cell中使用`z-tabs`,且页面加载时cell在屏幕之外,因cell的复用机制,可能导致`z-tabs`内部的布局失效:例如底部bar无法显示,此时可在list滚动到一定区域内(例如快显示`z-tabs`)的时候调用此方法以更新其内部布局。其他情况无需调用! | - | + +### slots + +| 名称 | 说明 | +| :---- | ------------ | +| left | tabs左侧插槽 | +| right | tabs右侧插槽 | + +### 支持全局配置 + +* 在`/z-tabs/components/z-tabs/config/index.js`文件中进行配置 + +```js +export default { + 'active-color': 'red' +} +``` + +### 【v0.1.4起支持】底部dot与swiper联动演示 + +```html +