修复页面标题 fix 256, 修改 ql update 依赖安装逻辑

This commit is contained in:
hanhh 2021-06-07 00:57:57 +08:00
parent a8707e5422
commit 7f1c55c40a
8 changed files with 9851 additions and 10 deletions

1
.gitignore vendored
View File

@ -6,7 +6,6 @@
/yarn-error.log /yarn-error.log
/yarn.lock /yarn.lock
/package-lock.json /package-lock.json
/pnpm-lock.yaml
# production # production
/dist /dist

9826
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -204,7 +204,7 @@ npm_install_sub() {
npm install --production --no-save --registry=https://registry.npm.taobao.org || npm install --production --no-save npm install --production --no-save --registry=https://registry.npm.taobao.org || npm install --production --no-save
else else
echo -e "检测到本机安装了 pnpm使用 pnpm 替代 ...\n" echo -e "检测到本机安装了 pnpm使用 pnpm 替代 ...\n"
pnpm install --prod --registry=https://registry.npm.taobao.org || pnpm install --prod pnpm install --prod
fi fi
} }
@ -247,10 +247,8 @@ diff_and_copy() {
update_depend() { update_depend() {
local dir_current=$(pwd) local dir_current=$(pwd)
if [ ! -s $dir_scripts/package.json ] || [[ $(diff $dir_sample/package.json $dir_scripts/package.json) ]]; then cp -f $dir_sample/package.json $dir_scripts/package.json
cp -f $dir_sample/package.json $dir_scripts/package.json npm_install_2 $dir_scripts
npm_install_2 $dir_scripts
fi
if [ ! -s $dir_scripts/requirements.txt ] || [[ $(diff $dir_sample/requirements.txt $dir_scripts/requirements.txt) ]]; then if [ ! -s $dir_scripts/requirements.txt ] || [[ $(diff $dir_sample/requirements.txt $dir_scripts/requirements.txt) ]]; then
cp -f $dir_sample/requirements.txt $dir_scripts/requirements.txt cp -f $dir_sample/requirements.txt $dir_scripts/requirements.txt

View File

@ -247,7 +247,6 @@ usage() {
## 更新qinglong ## 更新qinglong
update_qinglong() { update_qinglong() {
echo -e "--------------------------------------------------------------\n" echo -e "--------------------------------------------------------------\n"
[ -f $dir_root/package.json ] && ql_depend_old=$(cat $dir_root/package.json)
reset_romote_url ${dir_root} "${github_proxy_url}https://github.com/whyour/qinglong.git" reset_romote_url ${dir_root} "${github_proxy_url}https://github.com/whyour/qinglong.git"
git_pull_scripts $dir_root git_pull_scripts $dir_root
@ -257,8 +256,7 @@ update_qinglong() {
detect_config_version detect_config_version
update_depend update_depend
[ -f $dir_root/package.json ] && ql_depend_new=$(cat $dir_root/package.json) npm_install_2 $dir_root
[[ "$ql_depend_old" != "$ql_depend_new" ]] && npm_install_2 $dir_root
else else
echo -e "\n更新$dir_root失败,请检查原因...\n" echo -e "\n更新$dir_root失败,请检查原因...\n"
fi fi

View File

@ -2,6 +2,18 @@ import { history } from 'umi';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
import config from '@/utils/config'; import config from '@/utils/config';
const titleMap: any = {
'/': '控制面板',
'/login': '登录',
'/crontab': '定时任务',
'/cookie': 'Session管理',
'/config': '配置文件',
'/diy': '自定义脚本',
'/diff': '对比工具',
'/log': '日志',
'/setting': '系统设置',
};
export function render(oldRender: any) { export function render(oldRender: any) {
request request
.get(`${config.apiPrefix}user`) .get(`${config.apiPrefix}user`)
@ -22,3 +34,10 @@ export function render(oldRender: any) {
} }
}); });
} }
export function onRouteChange({ matchedRoutes }: any) {
if (matchedRoutes.length) {
const path: string = matchedRoutes[matchedRoutes.length - 1].route.path;
document.title = `${titleMap[path]} - 控制面板`;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

View File

@ -13,7 +13,7 @@ export default {
route: { route: {
routes: [ routes: [
{ {
name: 'login', name: '登录',
path: '/login', path: '/login',
hideInMenu: true, hideInMenu: true,
component: '@/pages/login/index', component: '@/pages/login/index',

View File

@ -95,6 +95,7 @@ export default function (props: any) {
}, },
]; ];
}} }}
pageTitleRender={() => '控制面板'}
{...defaultProps} {...defaultProps}
> >
{props.children} {props.children}