New file |
| | |
| | | > 1% |
| | | last 2 versions |
| | | not dead |
New file |
| | |
| | | [*.{js,jsx,ts,tsx,vue}] |
| | | indent_style = space |
| | | indent_size = 2 |
| | | trim_trailing_whitespace = true |
| | | insert_final_newline = true |
New file |
| | |
| | | module.exports = { |
| | | root: true, |
| | | env: { |
| | | node: true |
| | | }, |
| | | extends: [ |
| | | 'plugin:vue/essential', |
| | | '@vue/standard' |
| | | ], |
| | | parserOptions: { |
| | | parser: '@babel/eslint-parser' |
| | | }, |
| | | rules: { |
| | | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| | | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' |
| | | } |
| | | } |
New file |
| | |
| | | .DS_Store |
| | | node_modules |
| | | /dist |
| | | |
| | | |
| | | # local env files |
| | | .env.local |
| | | .env.*.local |
| | | |
| | | # Log files |
| | | npm-debug.log* |
| | | yarn-debug.log* |
| | | yarn-error.log* |
| | | pnpm-debug.log* |
| | | |
| | | # Editor directories and files |
| | | .idea |
| | | .vscode |
| | | *.suo |
| | | *.ntvs* |
| | | *.njsproj |
| | | *.sln |
| | | *.sw? |
New file |
| | |
| | | 木兰宽松许可证, 第2版 |
| | | |
| | | 木兰宽松许可证, 第2版 |
| | | 2020年1月 http://license.coscl.org.cn/MulanPSL2 |
| | | |
| | | |
| | | 您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: |
| | | |
| | | 0. 定义 |
| | | |
| | | “软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 |
| | | |
| | | “贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 |
| | | |
| | | “贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 |
| | | |
| | | “法人实体”是指提交贡献的机构及其“关联实体”。 |
| | | |
| | | “关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 |
| | | |
| | | 1. 授予版权许可 |
| | | |
| | | 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。 |
| | | |
| | | 2. 授予专利许可 |
| | | |
| | | 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。 |
| | | |
| | | 3. 无商标许可 |
| | | |
| | | “本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。 |
| | | |
| | | 4. 分发限制 |
| | | |
| | | 您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 |
| | | |
| | | 5. 免责声明与责任限制 |
| | | |
| | | “软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。 |
| | | |
| | | 6. 语言 |
| | | “本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。 |
| | | |
| | | 条款结束 |
| | | |
| | | 如何将木兰宽松许可证,第2版,应用到您的软件 |
| | | |
| | | 如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: |
| | | |
| | | 1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; |
| | | |
| | | 2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; |
| | | |
| | | 3, 请将如下声明文本放入每个源文件的头部注释中。 |
| | | |
| | | Copyright (c) [Year] [name of copyright holder] |
| | | [Software Name] is licensed under Mulan PSL v2. |
| | | You can use this software according to the terms and conditions of the Mulan PSL v2. |
| | | You may obtain a copy of Mulan PSL v2 at: |
| | | http://license.coscl.org.cn/MulanPSL2 |
| | | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. |
| | | See the Mulan PSL v2 for more details. |
| | | |
| | | |
| | | Mulan Permissive Software License,Version 2 |
| | | |
| | | Mulan Permissive Software License,Version 2 (Mulan PSL v2) |
| | | January 2020 http://license.coscl.org.cn/MulanPSL2 |
| | | |
| | | Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: |
| | | |
| | | 0. Definition |
| | | |
| | | Software means the program and related documents which are licensed under this License and comprise all Contribution(s). |
| | | |
| | | Contribution means the copyrightable work licensed by a particular Contributor under this License. |
| | | |
| | | Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. |
| | | |
| | | Legal Entity means the entity making a Contribution and all its Affiliates. |
| | | |
| | | Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. |
| | | |
| | | 1. Grant of Copyright License |
| | | |
| | | Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. |
| | | |
| | | 2. Grant of Patent License |
| | | |
| | | Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. |
| | | |
| | | 3. No Trademark License |
| | | |
| | | No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4. |
| | | |
| | | 4. Distribution Restriction |
| | | |
| | | You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. |
| | | |
| | | 5. Disclaimer of Warranty and Limitation of Liability |
| | | |
| | | THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
| | | |
| | | 6. Language |
| | | |
| | | THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. |
| | | |
| | | END OF THE TERMS AND CONDITIONS |
| | | |
| | | How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software |
| | | |
| | | To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps: |
| | | |
| | | i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner; |
| | | |
| | | ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package; |
| | | |
| | | iii Attach the statement to the appropriate annotated syntax at the beginning of each source file. |
| | | |
| | | |
| | | Copyright (c) [Year] [name of copyright holder] |
| | | [Software Name] is licensed under Mulan PSL v2. |
| | | You can use this software according to the terms and conditions of the Mulan PSL v2. |
| | | You may obtain a copy of Mulan PSL v2 at: |
| | | http://license.coscl.org.cn/MulanPSL2 |
| | | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. |
| | | See the Mulan PSL v2 for more details. |
| | |
| | | ## qyspzw-app |
| | | # hm-vant-h5 |
| | | |
| | | app嵌套 |
| | | ## Project setup |
| | | ``` |
| | | npm install |
| | | ``` |
| | | |
| | | ### Compiles and hot-reloads for development |
| | | ``` |
| | | npm run serve |
| | | ``` |
| | | |
| | | ### Compiles and minifies for production |
| | | ``` |
| | | npm run build |
| | | ``` |
New file |
| | |
| | | module.exports = { |
| | | presets: [ |
| | | '@vue/cli-plugin-babel/preset' |
| | | ], |
| | | plugins: [ |
| | | ['import', { |
| | | libraryName: 'vant', |
| | | libraryDirectory: 'es', |
| | | style: true |
| | | }, 'vant'] |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "compilerOptions": { |
| | | "target": "es5", |
| | | "module": "esnext", |
| | | "baseUrl": "./", |
| | | "moduleResolution": "node", |
| | | "paths": { |
| | | "@/*": [ |
| | | "src/*" |
| | | ] |
| | | }, |
| | | "lib": [ |
| | | "esnext", |
| | | "dom", |
| | | "dom.iterable", |
| | | "scripthost" |
| | | ] |
| | | } |
| | | } |
New file |
| | |
| | | { |
| | | "name": "hm-vant-h5", |
| | | "version": "0.1.0", |
| | | "private": true, |
| | | "scripts": { |
| | | "serve": "vue-cli-service serve", |
| | | "build": "vue-cli-service build", |
| | | "lint": "vue-cli-service lint" |
| | | }, |
| | | "dependencies": { |
| | | "axios": "^1.4.0", |
| | | "core-js": "^3.8.3", |
| | | "vant": "^2.12.54", |
| | | "vue": "^2.6.14", |
| | | "vue-router": "^3.5.1" |
| | | }, |
| | | "devDependencies": { |
| | | "@babel/core": "^7.12.16", |
| | | "@babel/eslint-parser": "^7.12.16", |
| | | "@vue/cli-plugin-babel": "~5.0.0", |
| | | "@vue/cli-plugin-eslint": "~5.0.0", |
| | | "@vue/cli-plugin-router": "~5.0.0", |
| | | "@vue/cli-service": "~5.0.0", |
| | | "@vue/eslint-config-standard": "^6.1.0", |
| | | "babel-plugin-import": "^1.13.6", |
| | | "eslint": "^7.32.0", |
| | | "eslint-plugin-import": "^2.25.3", |
| | | "eslint-plugin-node": "^11.1.0", |
| | | "eslint-plugin-promise": "^5.1.0", |
| | | "eslint-plugin-vue": "^8.0.3", |
| | | "less": "^4.0.0", |
| | | "less-loader": "^8.0.0", |
| | | "postcss-px-to-viewport": "^1.1.1", |
| | | "vue-template-compiler": "^2.6.14" |
| | | } |
| | | } |
New file |
| | |
| | | // postcss.config.js |
| | | module.exports = { |
| | | plugins: { |
| | | 'postcss-px-to-viewport': { |
| | | viewportWidth: 375 |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang=""> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| | | <meta |
| | | name="viewport" |
| | | content="width=device-width,initial-scale=1.0, user-scalable=0" |
| | | /> |
| | | <link rel="icon" href="<%= BASE_URL %>favicon.ico"> |
| | | <title><%= htmlWebpackPlugin.options.title %></title> |
| | | </head> |
| | | <body> |
| | | <noscript> |
| | | <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> |
| | | </noscript> |
| | | <div id="app"></div> |
| | | <!-- built files will be auto injected --> |
| | | </body> |
| | | </html> |
New file |
| | |
| | | <template> |
| | | <div id="app"> |
| | | |
| | | <router-view></router-view> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | </script> |
| | | |
| | | <style lang="less"> |
| | | |
| | | </style> |
New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // 获取文章列表 |
| | | export const getArticles = (obj) => { |
| | | return request.get('/interview/query', { |
| | | params: { |
| | | current: obj.current, // 当前页 |
| | | pageSize: 10, // 每页条数 |
| | | sorter: obj.sorter // 排序字段 推荐传 weight_desc 最新:可以不用传 |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 获取我的收藏 |
| | | export const getArticlesCollect = (obj) => { |
| | | return request.get('/interview/opt/list', { |
| | | params: { |
| | | page: obj.page, // 当前页 |
| | | pageSize: 10, // 可选 |
| | | optType: 2 // 表示收藏 |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 获取我的喜欢 |
| | | export const getArticlesLike = (obj) => { |
| | | return request.get('/interview/opt/list', { |
| | | params: { |
| | | page: obj.page, // 当前页 |
| | | pageSize: 10, // 可选 |
| | | optType: 1 // 表示喜欢 |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 获取文章详情 |
| | | export const getArticleDetail = (id) => { |
| | | return request.get('interview/show', { |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 对某个文章喜欢操作 |
| | | export const updateLike = (id) => { |
| | | return request.post('interview/opt', { |
| | | id, |
| | | optType: 1 // 喜欢 |
| | | }) |
| | | } |
| | | |
| | | // 对某个文章收藏操作 |
| | | export const updateCollect = (id) => { |
| | | return request.post('interview/opt', { |
| | | id, |
| | | optType: 2 // 收藏 |
| | | }) |
| | | } |
New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export const register = (obj) => { |
| | | return request.post('/user/register', obj) |
| | | } |
| | | |
| | | export const login = obj => { |
| | | return request.post('/user/login', obj) |
| | | } |
| | | |
| | | // 获取用户信息 |
| | | export const getUserInfo = () => { |
| | | return request('/user/currentUser') |
| | | } |
New file |
| | |
| | | <template> |
| | | <van-cell |
| | | class="article-item" |
| | | @click="$router.push(`/detail/${item.id}`)" |
| | | > |
| | | <template #title> |
| | | <div class="head"> |
| | | <img |
| | | :src="item.avatar" |
| | | alt="" |
| | | /> |
| | | <div class="con"> |
| | | <p class="title van-ellipsis">{{item.stem}}</p> |
| | | <p class="other">{{item.creator}} | {{item.createdAt}}</p> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <template #label> |
| | | <div class="body van-multi-ellipsis--l2"> |
| | | {{clearHtmlTag(item.content)}} |
| | | </div> |
| | | <div class="foot">点赞 {{item.likeCount}} | 浏览 {{item.views}}</div> |
| | | </template> |
| | | </van-cell> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | export default { |
| | | props: { |
| | | item: { |
| | | type: Object, |
| | | required: true, |
| | | default: () => { |
| | | return {} |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // 处理数据 |
| | | clearHtmlTag (str) { |
| | | return str.replace(/<[^>]+>/g, '') |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang='less' scoped> |
| | | .article-item { |
| | | .head { |
| | | display: flex; |
| | | img { |
| | | width: 40px; |
| | | height: 40px; |
| | | border-radius: 50%; |
| | | overflow: hidden; |
| | | } |
| | | .con { |
| | | flex: 1; |
| | | overflow: hidden; |
| | | padding-left: 10px; |
| | | p { |
| | | margin: 0; |
| | | line-height: 1.5; |
| | | &.title { |
| | | width: 280px; |
| | | } |
| | | &.other { |
| | | font-size: 10px; |
| | | color: #999; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .body { |
| | | font-size: 14px; |
| | | color: #666; |
| | | line-height: 1.6; |
| | | margin-top: 10px; |
| | | } |
| | | .foot { |
| | | font-size: 12px; |
| | | color: #999; |
| | | margin-top: 10px; |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | import Vue from 'vue' |
| | | import App from './App.vue' |
| | | import router from './router' |
| | | import '@/utils/vant-ui' |
| | | import ArticleItem from '@/components/article-item.vue' |
| | | |
| | | Vue.config.productionTip = false |
| | | Vue.component('ArticleItem', ArticleItem) |
| | | |
| | | new Vue({ |
| | | router, |
| | | render: h => h(App) |
| | | }).$mount('#app') |
New file |
| | |
| | | import Vue from 'vue' |
| | | import VueRouter from 'vue-router' |
| | | import Login from '@/views/login' |
| | | import Register from '@/views/register' |
| | | import Detail from '@/views/detail' |
| | | import Layout from '@/views/layout' |
| | | |
| | | import Like from '@/views/like' |
| | | import Article from '@/views/article' |
| | | import Collect from '@/views/collect' |
| | | import User from '@/views/user' |
| | | |
| | | import { getToken } from '@/utils/storage' |
| | | |
| | | Vue.use(VueRouter) |
| | | |
| | | const router = new VueRouter({ |
| | | routes: [ |
| | | // { path: '/', redirect: '/layout' }, |
| | | { |
| | | path: '/', |
| | | component: Layout, |
| | | redirect: '/article', |
| | | children: [ |
| | | { path: '/article', component: Article }, |
| | | { path: '/like', component: Like }, |
| | | { path: '/collect', component: Collect }, |
| | | { path: '/user', component: User } |
| | | ] |
| | | }, |
| | | { path: '/detail/:id', component: Detail }, |
| | | { path: '/login', component: Login }, |
| | | { path: '/register', component: Register } |
| | | |
| | | ] |
| | | }) |
| | | |
| | | // 白名单 |
| | | const whiteList = ['/login'] |
| | | |
| | | // 在每一个路由在真正被访问之前,都会经过路由前置导航守卫 |
| | | // 只有前置守卫放行,才能访问对应的路由 |
| | | // 每个路由被访问前,都会调用这个函数 |
| | | |
| | | // to 往哪去 要去的路由 |
| | | // from 从哪来 从哪个路由来 |
| | | // next是否放行 |
| | | // next() 直接放行 |
| | | // next(path) 拦截某路由路径 |
| | | // next(路径) 拦截到某个路径页面 |
| | | router.beforeEach((to, from, next) => { |
| | | // 1.判断是否有 token,有就直接放行 |
| | | // 2.无token,判断是否访问的是白名单页面 |
| | | const token = getToken() |
| | | if (token) { |
| | | next('/login') |
| | | } else { |
| | | if (whiteList.includes(to.path)) { |
| | | next() |
| | | } else { |
| | | next('/login') |
| | | } |
| | | } |
| | | }) |
| | | |
| | | export default router |
New file |
| | |
| | | /* 封装axios用于发送请求 */ |
| | | import axios from 'axios' |
| | | import { Toast } from 'vant' |
| | | import { getToken, delToken } from './storage' |
| | | import router from '@/router' |
| | | |
| | | // 创建一个新的axios实例 |
| | | const request = axios.create({ |
| | | baseURL: 'http://interview-api-t.itheima.net/h5/', |
| | | timeout: 5000 // 超时时间 |
| | | }) |
| | | |
| | | // 添加请求拦截器 |
| | | request.interceptors.request.use(function (config) { |
| | | // 在发送请求之前做些什么 |
| | | // config 就是请求对象 |
| | | const token = getToken() |
| | | if (token) { |
| | | config.headers.Authorization = `Bearer ${token}` |
| | | } |
| | | return config |
| | | }, function (error) { |
| | | // 对请求错误做些什么 |
| | | return Promise.reject(error) |
| | | }) |
| | | |
| | | // 添加响应拦截器 |
| | | request.interceptors.response.use(function (response) { |
| | | // 对响应数据做点什么 |
| | | return response.data |
| | | }, function (error) { |
| | | // 对响应错误做点什么 |
| | | // 对错误信息进行提示 |
| | | console.log(error) |
| | | if (error.response) { |
| | | // 有错误响应, 提示错误提示 |
| | | if (error.response.status === 401) { |
| | | delToken() |
| | | router.push('/login') |
| | | Toast('登录已过期 请重新登录!') |
| | | } else { |
| | | Toast(error.response.data.message) |
| | | } |
| | | } |
| | | return Promise.reject(error) |
| | | }) |
| | | |
| | | export default request |
New file |
| | |
| | | const KEY = 'my-token-vant-mobile' |
| | | |
| | | export const getToken = () => { |
| | | return localStorage.getItem(KEY) |
| | | } |
| | | |
| | | export const setToken = (newToken) => { |
| | | localStorage.setItem(KEY, newToken) |
| | | } |
| | | |
| | | export const delToken = () => { |
| | | localStorage.removeItem(KEY) |
| | | } |
New file |
| | |
| | | import Vue from 'vue' |
| | | import { |
| | | Button, Tabbar, TabbarItem, NavBar, Form, Field, Toast, Cell, List, Icon, Grid, |
| | | GridItem, |
| | | CellGroup, |
| | | Circle, |
| | | Dialog |
| | | } from 'vant' |
| | | |
| | | Vue.use(Button) |
| | | Vue.use(Tabbar) |
| | | Vue.use(TabbarItem) |
| | | Vue.use(NavBar) |
| | | Vue.use(Form) |
| | | Vue.use(Field) |
| | | Vue.use(Toast) |
| | | Vue.use(Cell) |
| | | Vue.use(List) |
| | | Vue.use(Icon) |
| | | Vue.use(Grid) |
| | | Vue.use(GridItem) |
| | | Vue.use(CellGroup) |
| | | Vue.use(Circle) |
| | | Vue.use(Dialog) |
New file |
| | |
| | | <template> |
| | | <div class="article-page"> |
| | | <nav class="my-nav van-hairline--bottom"> |
| | | <a |
| | | :class="{active:sorter}" |
| | | href="javascript:;" |
| | | @click="changeSorter('weight_desc')" |
| | | >推荐</a> |
| | | <a |
| | | :class="{active:!sorter}" |
| | | href="javascript:;" |
| | | @click="changeSorter(null)" |
| | | >最新</a> |
| | | <div class="logo"><img |
| | | src="@/assets/logo.png" |
| | | alt="" |
| | | ></div> |
| | | </nav> |
| | | |
| | | <van-list |
| | | v-model="loading" |
| | | :finished="finished" |
| | | finished-text="我是有底线的!" |
| | | @load="onLoad" |
| | | > |
| | | <ArticleItem |
| | | |
| | | v-for="item in list" |
| | | :key="item.id" |
| | | :item=item |
| | | ></ArticleItem> |
| | | </van-list> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getArticles } from '@/api/article' |
| | | |
| | | export default { |
| | | name: 'article-page', |
| | | |
| | | data () { |
| | | return { |
| | | list: [], |
| | | current: 1, |
| | | sorter: 'weight_desc', |
| | | loading: false, |
| | | finished: false |
| | | } |
| | | }, |
| | | created () { |
| | | |
| | | }, |
| | | methods: { |
| | | // 刚进入页面 因为 list:[] 所以会触发一次onLoad |
| | | // 每次触底是 也会调用一次onLoad |
| | | async onLoad () { |
| | | const { data } = await getArticles({ |
| | | current: this.current, |
| | | sorter: this.sorter |
| | | }) |
| | | // console.log(data) |
| | | // 要将获取的数据追加到数组中,不然一直都是10条数据。也就是一直在触底 一直在发请求!!! |
| | | this.list.push(...data.rows) |
| | | |
| | | console.log(this.list) |
| | | this.loading = false |
| | | |
| | | // 每次获取的页数加1 |
| | | this.current++ |
| | | |
| | | // 页数大于后端的数据 也就是没有了 |
| | | if (this.current > data.pageTotal) { |
| | | this.finished = true |
| | | } |
| | | }, |
| | | |
| | | changeSorter (value) { |
| | | this.sorter = value |
| | | |
| | | // 重置所有条件 |
| | | this.current = 1 |
| | | this.list = [] |
| | | this.finished = false |
| | | |
| | | // 手动加载更过 |
| | | this.loading = true |
| | | this.onLoad() |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .article-page { |
| | | margin-bottom: 50px; |
| | | margin-top: 44px; |
| | | .my-nav { |
| | | height: 44px; |
| | | position: fixed; |
| | | left: 0; |
| | | top: 0; |
| | | width: 100%; |
| | | z-index: 999; |
| | | background: #fff; |
| | | display: flex; |
| | | align-items: center; |
| | | > a { |
| | | color: #999; |
| | | font-size: 14px; |
| | | line-height: 44px; |
| | | margin-left: 20px; |
| | | position: relative; |
| | | transition: all 0.3s; |
| | | &::after { |
| | | content: ""; |
| | | position: absolute; |
| | | left: 50%; |
| | | transform: translateX(-50%); |
| | | bottom: 0; |
| | | width: 0; |
| | | height: 2px; |
| | | background: #222; |
| | | transition: all 0.3s; |
| | | } |
| | | &.active { |
| | | color: orange; |
| | | &::after { |
| | | width: 14px; |
| | | } |
| | | } |
| | | } |
| | | .logo { |
| | | flex: 1; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | > img { |
| | | width: 64px; |
| | | height: 28px; |
| | | display: block; |
| | | margin-right: 10px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="collect-page"> |
| | | <van-nav-bar fixed title="我的收藏" /> |
| | | <van-list |
| | | v-model="loading" |
| | | :finished="finished" |
| | | finished-text="没有更多了" |
| | | @load="onLoad" |
| | | > |
| | | <article-item v-for="(item, i) in list" :key="i" :item="item" /> |
| | | </van-list> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getArticlesCollect } from '@/api/article' |
| | | export default { |
| | | name: 'collect-page', |
| | | data () { |
| | | return { |
| | | list: [], |
| | | loading: false, |
| | | finished: false, |
| | | page: 1 |
| | | } |
| | | }, |
| | | methods: { |
| | | async onLoad () { |
| | | // 异步更新数据 |
| | | const { data } = await getArticlesCollect({ page: this.page }) |
| | | this.list.push(...data.rows) |
| | | this.loading = false |
| | | if (this.page === data.pageTotal || !data.rows.length) { |
| | | this.finished = true |
| | | } else { |
| | | this.page++ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .collect-page { |
| | | margin-bottom: 50px; |
| | | margin-top: 44px; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="detail-page"> |
| | | <van-nav-bar |
| | | left-text="返回" |
| | | @click-left="$router.back()" |
| | | fixed |
| | | title="面经详细" |
| | | /> |
| | | <header class="header"> |
| | | <h1>{{ article.stem }}</h1> |
| | | <p> |
| | | {{ article.createdAt }} | {{ article.views }} 浏览量 | |
| | | {{ article.likeCount }} 点赞数 |
| | | </p> |
| | | <p> |
| | | <img |
| | | :src="article.avatar" |
| | | alt="" |
| | | /> |
| | | <span>{{ article.creator }}</span> |
| | | </p> |
| | | </header> |
| | | <main |
| | | class="body" |
| | | v-html="article.content" |
| | | ></main> |
| | | <div class="opt"> |
| | | <van-icon |
| | | @click="toggleLike" |
| | | :class="{active:article.likeFlag}" |
| | | name="like-o" |
| | | /> |
| | | <van-icon |
| | | @click="toggleCollect" |
| | | :class="{active:article.collectFlag}" |
| | | name="star-o" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getArticleDetail, updateLike, updateCollect } from '@/api/article' |
| | | |
| | | export default { |
| | | name: 'detail-page', |
| | | data () { |
| | | return { |
| | | article: {} |
| | | } |
| | | }, |
| | | async created () { |
| | | this.article = {} |
| | | const { data } = await getArticleDetail(this.$route.params.id) |
| | | // console.log(data) |
| | | this.article = data |
| | | }, |
| | | methods: { |
| | | async toggleLike () { |
| | | await updateLike(this.article.id) |
| | | this.article.likeFlag = !this.article.likeFlag |
| | | if (this.article.likeFlag) { |
| | | this.article.likeCount++ |
| | | this.$toast.success('点赞成功') |
| | | } else { |
| | | this.article.likeCount-- |
| | | this.$toast.success('取消点赞') |
| | | } |
| | | }, |
| | | async toggleCollect () { |
| | | await updateCollect(this.article.id) |
| | | this.article.collectFlag = !this.article.collectFlag |
| | | if (this.article.collectFlag) { |
| | | this.$toast.success('收藏成功') |
| | | } else { |
| | | this.$toast.success('取消收藏') |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .detail-page { |
| | | margin-top: 44px; |
| | | overflow: hidden; |
| | | padding: 0 15px; |
| | | .header { |
| | | h1 { |
| | | font-size: 24px; |
| | | } |
| | | p { |
| | | color: #999; |
| | | font-size: 12px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | img { |
| | | width: 40px; |
| | | height: 40px; |
| | | border-radius: 50%; |
| | | overflow: hidden; |
| | | } |
| | | } |
| | | .opt { |
| | | position: fixed; |
| | | bottom: 100px; |
| | | right: 0; |
| | | > .van-icon { |
| | | margin-right: 20px; |
| | | background: #fff; |
| | | width: 40px; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | text-align: center; |
| | | border-radius: 50%; |
| | | box-shadow: 2px 2px 10px #ccc; |
| | | font-size: 18px; |
| | | &.active { |
| | | background: #fec635; |
| | | color: #fff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="layout-page"> |
| | | <router-view></router-view> |
| | | |
| | | <!-- 配置route,开启路由模式,就可以当routerlink一样用 --> |
| | | <van-tabbar route> |
| | | <van-tabbar-item icon="smile-o" to="/article">面经</van-tabbar-item> |
| | | <van-tabbar-item icon="star-o" to="/collect">收藏</van-tabbar-item> |
| | | <van-tabbar-item icon="like-o" to="/like">喜欢</van-tabbar-item> |
| | | <van-tabbar-item icon="user-circle-o" to="/user">我的</van-tabbar-item> |
| | | </van-tabbar> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'layout-page' |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped></style> |
New file |
| | |
| | | <template> |
| | | <div class="like-page"> |
| | | <van-nav-bar fixed title="我的点赞" /> |
| | | <van-list |
| | | v-model="loading" |
| | | :finished="finished" |
| | | finished-text="没有更多了" |
| | | @load="onLoad" |
| | | > |
| | | <article-item v-for="(item,i) in list" :key="i" :item="item" /> |
| | | </van-list> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getArticlesLike } from '@/api/article' |
| | | export default { |
| | | name: 'like-page', |
| | | data () { |
| | | return { |
| | | list: [], |
| | | loading: false, |
| | | finished: false, |
| | | page: 1 |
| | | } |
| | | }, |
| | | methods: { |
| | | async onLoad () { |
| | | // 异步更新数据 |
| | | // setTimeout 仅做示例,真实场景中一般为 ajax 请求 |
| | | const { data } = await getArticlesLike({ page: this.page }) |
| | | this.list.push(...data.rows) |
| | | this.loading = false |
| | | if (this.page === data.pageTotal || !data.rows.length) { |
| | | this.finished = true |
| | | } else { |
| | | this.page++ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .like-page { |
| | | margin-bottom: 50px; |
| | | margin-top: 44px; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="login-page"> |
| | | <!-- 导航栏部分 --> |
| | | <!-- <van-nav-bar title="面经登录" />--> |
| | | <van-dialog |
| | | v-model="showDing" |
| | | title="下载中" |
| | | :show-cancel-button="false" |
| | | :show-confirm-button="false" |
| | | > |
| | | <van-circle |
| | | v-model="currentRate" |
| | | :rate="0" |
| | | :speed="100" |
| | | :text="text" |
| | | /> |
| | | </van-dialog> |
| | | |
| | | <div class="login-van-fie"> |
| | | <van-field |
| | | v-model="password" |
| | | placeholder="请输入提取码" |
| | | :rules="[ |
| | | { required: true, message: '请填写提取码' }, |
| | | { pattern: /^\w{6,}$/, message: '提取码至少是6位字符' } |
| | | ]" |
| | | /> |
| | | </div> |
| | | <div style="margin: 16px;" class="login-van-btn"> |
| | | <!-- <van-button--> |
| | | <!-- block--> |
| | | <!-- type="primary"--> |
| | | <!-- native-type="submit"--> |
| | | <!-- @click="onstest"--> |
| | | <!-- >确认0</van-button>--> |
| | | <!-- <van-button--> |
| | | <!-- block--> |
| | | <!-- type="primary"--> |
| | | <!-- native-type="submit"--> |
| | | <!-- @click="onSubPwd"--> |
| | | <!-- >确认1</van-button>--> |
| | | <van-button |
| | | block |
| | | type="primary" |
| | | native-type="submit" |
| | | @click="donwn" |
| | | >确认</van-button> |
| | | </div> |
| | | <div v-if="downXs"> |
| | | <p> |
| | | |
| | | </p> |
| | | </div> |
| | | <!-- <router-link class="link" to="/register">注册账号</router-link>--> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { login } from '@/api/user' |
| | | import { setToken } from '@/utils/storage' |
| | | |
| | | export default { |
| | | name: 'login-page', |
| | | data () { |
| | | return { |
| | | downXs: false, |
| | | mytime: null, |
| | | currentRate: 0, |
| | | text: '0%', |
| | | showDing: false, |
| | | dowRrl: '', |
| | | username: '', |
| | | password: '', |
| | | apptoken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZENhcmQiOiI1MTAxMTMxOTg2MDUwNzA0MVgiLCJhcHBLZXkiOiI5MWEzZjM3NDQ0NWM0MmQyYjA3MGJiMTI1NzgwYzA3ZCIsIklNRUkiOiJlNzkwZDM0ZTVlNGNkMTg2IiwiZXhwIjoxNzA0OTAyMzk5LCJpYXQiOjE3MDQ4NDU0MDJ9.8g08LXtg8QZzksnWT5xqXmhWzR8FfVaWDjBRPOdWgVY' |
| | | } |
| | | }, |
| | | |
| | | mounted () { |
| | | // console.log('mounted') |
| | | const me = this |
| | | // eslint-disable-next-line |
| | | window["downloadCompleted"] = (val,res) => { |
| | | me.downloadCompletedBackToday(val, res) // 这个也就是定义的方法 |
| | | } |
| | | me.getApptoken() |
| | | }, |
| | | methods: { |
| | | downloadCompletedBackToday (val, res) { |
| | | // eslint-disable-next-line eqeqeq |
| | | if (val == 0) { |
| | | this.downXs = true |
| | | this.showDing = false |
| | | this.$toast.fail('下载成功!') |
| | | this.currentRate = 0 |
| | | clearInterval(this.mytime) |
| | | // eslint-disable-next-line eqeqeq |
| | | } else if (val == 2) { |
| | | this.showDing = false |
| | | this.$toast.fail('提取码错误!') |
| | | this.currentRate = 0 |
| | | clearInterval(this.mytime) |
| | | } else { |
| | | this.$toast.fail('下载失败!') |
| | | this.showDing = false |
| | | this.currentRate = 0 |
| | | clearInterval(this.mytime) |
| | | } |
| | | }, |
| | | donwn () { |
| | | // eslint-disable-next-line eqeqeq |
| | | if (this.password == '') { |
| | | this.$toast.fail('请填写提取码') |
| | | return |
| | | } |
| | | clearInterval(this.mytime) |
| | | this.currentRate = 0 |
| | | this.showDing = true |
| | | this.mytime = setInterval(() => { |
| | | this.currentRate++ |
| | | if (this.currentRate >= 100) { |
| | | clearInterval(this.mytime) |
| | | // this.showDing = false |
| | | } |
| | | this.text = this.currentRate.toFixed(0) + '%' |
| | | }, 1000) |
| | | const url = 'http://esb.ydjw.sc/service/api/56e038d545bb4fa3834d03c368d74118/' + `${this.apptoken}/12345678/${this.password}` |
| | | // const url = 'http://162.14.79.111:8080/resource/oss/download' + `/12345678/${this.password}` |
| | | window.JavaScriptMe.downFileUrl(url) |
| | | }, |
| | | onstests () { |
| | | const elemIF = document.createElement('iframe') |
| | | // elemIF.src = 'http://esb.ydjw.sc/service/api/56e038d545bb4fa3834d03c368d74118/' + `${this.apptoken}/12345678/${this.password}` |
| | | elemIF.src = 'http://162.14.79.111:8080/resource/oss/download' + `/12345678/${this.password}` |
| | | console.log(elemIF.src) |
| | | elemIF.style.display = 'none' |
| | | document.body.appendChild(elemIF) |
| | | }, |
| | | onstest () { |
| | | const url = 'http://esb.ydjw.sc/service/api/56e038d545bb4fa3834d03c368d74118/' + `${this.apptoken}/12345678/${this.password}` |
| | | // const url = 'http://162.14.79.111:8080/resource/oss/download' + `/12345678/${this.password}` |
| | | |
| | | const a = document.createElement('a') |
| | | a.href = url |
| | | a.download = 'test222' |
| | | a.click() |
| | | }, |
| | | onSubPwd () { |
| | | const x = new window.XMLHttpRequest() |
| | | // x.open('GET', 'http://162.14.79.111:8080/resource/oss/download' + `/12345678/${this.password}`, true) |
| | | x.open('GET', 'http://esb.ydjw.sc/service/api/56e038d545bb4fa3834d03c368d74118/' + `${this.apptoken}/12345678/${this.password}`, true) |
| | | x.responseType = 'blob' |
| | | x.onload = () => { |
| | | const url = window.URL.createObjectURL(x.response) |
| | | const a = document.createElement('a') |
| | | a.href = url |
| | | a.download = 'test' |
| | | a.click() |
| | | } |
| | | x.send() |
| | | |
| | | // http://esb.ydjw.sc/service/api/56e038d545bb4fa3834d03c368d74118/{token} |
| | | // fetch('http://esb.ydjw.sc/service/api/56e038d545bb4fa3834d03c368d74118/' + `${this.apptoken}/12345678/${this.password}`, { |
| | | // method: 'Get', |
| | | // mode: 'cors', |
| | | // headers: { |
| | | // 'Content-Type': 'application/json;charset=utf-8;' |
| | | // }, |
| | | // responseType: 'blob', |
| | | // }).then(res => { |
| | | // console.log(res) |
| | | // }) |
| | | }, |
| | | getApptoken () { |
| | | // window.JavaScriptMe.getAppCenterToken() |
| | | this.apptoken = JSON.parse(window.JavaScriptMe.getAppCenterToken()) |
| | | // localStorage.setItem('appkey', appkey) |
| | | }, |
| | | async onSubmit (values) { |
| | | // console.log('submit', values) |
| | | const res = await login(values) |
| | | // console.log(res) |
| | | // 存token |
| | | setToken(res.data.token) |
| | | this.$toast.success('登录成功!') |
| | | this.$router.push('/') |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | /deep/.van-dialog__content{ |
| | | text-align: center; |
| | | margin: 1rem 0; |
| | | } |
| | | .link { |
| | | color: #069; |
| | | font-size: 12px; |
| | | padding-right: 20px; |
| | | float: right; |
| | | } |
| | | .login-page{ |
| | | min-height: 100vh; |
| | | } |
| | | .login-van-fie{ |
| | | padding-top: 50%; |
| | | } |
| | | .van-cell{ |
| | | border: 1px solid #ededed; |
| | | margin: 0 1rem; |
| | | border-radius: 40px; |
| | | width: 90%; |
| | | } |
| | | .van-button{ |
| | | margin-top: 3rem; |
| | | border-radius: 40px; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="login-page"> |
| | | <van-nav-bar title="面经注册" /> |
| | | |
| | | <van-form @submit="onSubmit"> |
| | | <van-field |
| | | v-model="username" |
| | | name="username" |
| | | label="用户名" |
| | | placeholder="用户名" |
| | | :rules="[{ required: true, message: '请填写用户名' }, |
| | | { pattern: /^\w{5,}$/, message: '用户名至少是5位字符' }]" |
| | | /> |
| | | <van-field |
| | | v-model="password" |
| | | type="password" |
| | | name="password" |
| | | label="密码" |
| | | placeholder="密码" |
| | | :rules="[{ required: true, message: '请填写密码' }, |
| | | { pattern: /^\w{6,}$/, message: '密码至少是6位字符' }]" |
| | | /> |
| | | <div style="margin: 16px"> |
| | | <van-button block type="primary" native-type="submit" |
| | | >注册</van-button |
| | | > |
| | | </div> |
| | | </van-form> |
| | | <router-link class="link" to="/login">有账号,去登录</router-link> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { Toast } from 'vant' |
| | | import { register } from '@/api/user' |
| | | |
| | | export default { |
| | | name: 'register-page', |
| | | data () { |
| | | return { |
| | | username: '', |
| | | password: '' |
| | | } |
| | | }, |
| | | methods: { |
| | | async onSubmit (values) { |
| | | // console.log('submit', values) |
| | | await register(values) |
| | | Toast.success('注册成功!') |
| | | this.$router.push('/login') |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .link { |
| | | color: #069; |
| | | font-size: 12px; |
| | | padding-right: 20px; |
| | | float: right; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="user-page"> |
| | | <div class="user"> |
| | | <img :src="avatar" alt="" /> |
| | | <h3>{{ username }}</h3> |
| | | </div> |
| | | <van-grid clickable :column-num="3" :border="false"> |
| | | <van-grid-item icon="clock-o" text="历史记录" to="/" /> |
| | | <van-grid-item icon="bookmark-o" text="我的收藏" to="/collect" /> |
| | | <van-grid-item icon="thumb-circle-o" text="我的点赞" to="/like" /> |
| | | </van-grid> |
| | | |
| | | <van-cell-group class="mt20"> |
| | | <van-cell title="推荐分享" is-link /> |
| | | <van-cell title="意见反馈" is-link /> |
| | | <van-cell title="关于我们" is-link /> |
| | | <van-cell @click="logout" title="退出登录" is-link /> |
| | | </van-cell-group> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getUserInfo } from '@/api/user' |
| | | import { delToken } from '@/utils/storage' |
| | | export default { |
| | | name: 'user-page', |
| | | data () { |
| | | return { |
| | | username: '', |
| | | avatar: '' |
| | | } |
| | | }, |
| | | async created () { |
| | | const { data } = await getUserInfo() |
| | | this.username = data.username |
| | | this.avatar = data.avatar |
| | | }, |
| | | methods: { |
| | | logout () { |
| | | delToken() |
| | | this.$toast.success('退出成功') |
| | | this.$router.push('/login') |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .user-page { |
| | | padding: 0 10px; |
| | | background: #f5f5f5; |
| | | height: 100vh; |
| | | .mt20 { |
| | | margin-top: 20px; |
| | | } |
| | | .user { |
| | | display: flex; |
| | | padding: 20px 0; |
| | | align-items: center; |
| | | img { |
| | | width: 80px; |
| | | height: 80px; |
| | | border-radius: 50%; |
| | | overflow: hidden; |
| | | } |
| | | h3 { |
| | | margin: 0; |
| | | padding-left: 20px; |
| | | font-size: 18px; |
| | | } |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | const { defineConfig } = require('@vue/cli-service') |
| | | module.exports = defineConfig({ |
| | | transpileDependencies: true, |
| | | // 默认直接打包的项目代码,必须在 服务器根目录 才能运行!!! |
| | | // 所有资源(js css img 等) 的访问都是基于根路径,以绝对路径访问 |
| | | // publicPath:'/' |
| | | |
| | | // 如果想要在任意目录都能运行 需要将 publicPath 配置成相对路径 |
| | | // 然后重新打包 |
| | | publicPath: './', |
| | | |
| | | // 配置端口号 |
| | | devServer: { |
| | | port: 3000 |
| | | } |
| | | }) |