Browse Source

优化

master
科技小王子 9 months ago
parent
commit
f6dd10534b
  1. 8
      assets/css/main.css
  2. 7
      components/AppFooter.vue
  3. 26
      components/AppHeader.vue
  4. 2
      composables/useRequest.ts
  5. 2
      ecosystem.config.cjs
  6. 22
      nuxt.config.ts
  7. 14
      pages/[custom]/index.vue
  8. 61
      pages/plug/index.vue
  9. 3
      utils/tool.ts

8
assets/css/main.css

@ -6,8 +6,8 @@
body { body {
margin: 0; margin: 0;
font-family: Inter, "Inter Fallback: Arial",ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji; font-family: Inter, "Inter Fallback: Arial",ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;
font-size: 14px;
line-height: 140%;
font-size: 15px;
line-height: 1.4rem;
} }
ul, li { ul, li {
@ -19,6 +19,10 @@ a {
color: #333333; color: #333333;
} }
a:hover{
color: #cf1313;
}
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
font-weight: normal; font-weight: normal;
} }

7
components/AppFooter.vue

@ -8,6 +8,7 @@
<footer class="text-center py-10"> <footer class="text-center py-10">
Copyright {{ new Date().getFullYear() }} {{ config?.siteName }} Inc. All Rights Reserved. Copyright {{ new Date().getFullYear() }} {{ config?.siteName }} Inc. All Rights Reserved.
<a href="https://beian.miit.gov.cn/" target="_blank" class="ml-10"> 备案号{{ config?.icpNo }}</a> <a href="https://beian.miit.gov.cn/" target="_blank" class="ml-10"> 备案号{{ config?.icpNo }}</a>
<a class="ml-3 cursor-pointer" @click="reload">刷新</a>
</footer> </footer>
</template> </template>
@ -21,10 +22,14 @@ const config = ref<Config>()
// //
const reload = async () => { const reload = async () => {
await nextTick()
const { data: fields } = await useRequest<ApiResult<Config>>('/cms/website-field/config', {}) const { data: fields } = await useRequest<ApiResult<Config>>('/cms/website-field/config', {})
config.value = fields.value?.data; config.value = fields.value?.data;
ElMessage.success('刷新成功')
} }
reload(); reload();
</script> </script>
<style lang="scss">
</style>

26
components/AppHeader.vue

@ -1,6 +1,6 @@
<template> <template>
<header class="header bg-black">
<div class="container between">
<header class="header bg-black fixed z-10 w-full">
<div class="container flex between">
<div class="header__left flex"> <div class="header__left flex">
<div class="logo w-[180px] flex items-center" @click="reload"> <div class="logo w-[180px] flex items-center" @click="reload">
<nuxt-link v-if="config?.siteLogo" to="/"> <nuxt-link v-if="config?.siteLogo" to="/">
@ -10,7 +10,7 @@
<text>{{ config?.siteName || '网宿软件' }}</text> <text>{{ config?.siteName || '网宿软件' }}</text>
</nuxt-link> </nuxt-link>
</div> </div>
<div v-if="route.path.indexOf('/user') === -1" class="hidden-sm-and-down">
<nav v-if="route.path.indexOf('/user') === -1" class="hidden-sm-and-down">
<el-menu <el-menu
:default-active="currentIndex" :default-active="currentIndex"
mode="horizontal" mode="horizontal"
@ -19,6 +19,7 @@
active-text-color="#ffd04b" active-text-color="#ffd04b"
:collapse="true" :collapse="true"
:ellipsis="false" :ellipsis="false"
style="border-bottom: none"
@select="handleSelect" @select="handleSelect"
> >
<template v-for="(item, index) in navigations"> <template v-for="(item, index) in navigations">
@ -48,23 +49,7 @@
</template> </template>
</el-sub-menu> </el-sub-menu>
</el-menu> </el-menu>
</div>
<!-- <nav v-if="route.path.indexOf('/user') === -1" class="hidden-sm-and-down">-->
<!-- <ul>-->
<!-- <li-->
<!-- v-for="item in navigations"-->
<!-- :key="item.navigationId"-->
<!-- class="relative"-->
<!-- :class="route.path === item.path ? 'active' : ''"-->
<!-- >-->
<!-- <nuxt-link v-if="item.target === '_blank'" :to="item.path" target="_blank">{{ item.title }}</nuxt-link>-->
<!-- <nuxt-link v-else :to="`${item.path}`">{{ item.title }}</nuxt-link>-->
<!-- <div class="absolute p-2 h-[100px]" v-if="item.children">-->
<!-- <nuxt-link v-for="(sub,index2) in item.children" :to="`${sub.path}`">{{ sub.title }}</nuxt-link>-->
<!-- </div>-->
<!-- </li>-->
<!-- </ul>-->
<!-- </nav>-->
</nav>
</div> </div>
<div class="header__right items-center"> <div class="header__right items-center">
<el-input <el-input
@ -164,4 +149,5 @@ reload();
</script> </script>
<style lang="scss"> <style lang="scss">
</style> </style>

2
composables/useRequest.ts

@ -19,7 +19,7 @@ export const useRequest = <T>(url: string, opts?: UseFetchOptions<T, unknown>) =
if (token.value) { if (token.value) {
options.headers.Authorization = token.value; options.headers.Authorization = token.value;
} }
options.headers.tenantid = `${TENANT_ID}`;
options.headers.tenantid = `5`;
}, },
onResponse({ response }) { onResponse({ response }) {
if (+response.status === 0 && +response._data.code !== 0) { if (+response.status === 0 && +response._data.code !== 0) {

2
ecosystem.config.cjs

@ -2,7 +2,7 @@ module.exports = {
apps: [ apps: [
{ {
name: '网宿软件', name: '网宿软件',
port: '10198',
port: '10123',
exec_mode: 'cluster', exec_mode: 'cluster',
instances: 'max', instances: 'max',
script: './.output/server/index.mjs' script: './.output/server/index.mjs'

22
nuxt.config.ts

@ -24,19 +24,19 @@ export default defineNuxtConfig({
} }
}, },
devServer: { devServer: {
port: 10189
port: 10123
}, },
nitro: {
devProxy: {
"/api": {
target: 'http://127.0.0.1:9001/api',
prependPath: true,
changeOrigin: true,
}
}
}
// nitro: {
// devProxy: {
// "/api": {
// target: 'http://127.0.0.1:9001/api',
// prependPath: true,
// changeOrigin: true,
// }
//
// }
// }
// runtimeConfig: { // runtimeConfig: {
// public: { // public: {

14
pages/[custom]/index.vue

@ -2,15 +2,17 @@
<div class="banner" v-if="form"> <div class="banner" v-if="form">
<el-image :src="form.photo"></el-image> <el-image :src="form.photo"></el-image>
</div> </div>
<div v-if="form" class="container flex flex-col w-[1280px] m-auto">
<el-breadcrumb class="my-5" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.name }}</el-breadcrumb-item>
</el-breadcrumb>
<div class="w-7xl m-auto bg-gray-50">
<div class="container">
<div v-if="form" class="flex flex-col w-[1280px] m-auto bg-white">
<el-breadcrumb class="my-5" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.name }}</el-breadcrumb-item>
</el-breadcrumb>
<div class="w-7xl m-auto bg-gray-50">
<div class="title text-3xl text-center py-10">{{ form.name }}</div> <div class="title text-3xl text-center py-10">{{ form.name }}</div>
<div class="p-4 leading-7" v-html="form.content"> <div class="p-4 leading-7" v-html="form.content">
</div> </div>
</div>
</div> </div>
</div> </div>
<div v-if="!form"> <div v-if="!form">

61
pages/plug/index.vue

@ -1,61 +0,0 @@
<template>
<div class="banner" v-if="form">
<el-image :src="form.photo"></el-image>
</div>
<div v-if="form" class="container flex flex-col w-[1280px] m-auto">
<el-breadcrumb class="my-5" separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>{{ form.name }}</el-breadcrumb-item>
</el-breadcrumb>
<div class="w-7xl m-auto bg-gray-50">
<div class="title text-3xl text-center py-10">{{ form.name }}</div>
<div class="p-4 leading-7" v-html="form.content">
</div>
</div>
</div>
<div v-if="!form">
<el-empty description="404 页面不存在"></el-empty>
</div>
</template>
<script setup lang="ts">
import type {Design} from "~/api/cms/design/model";
import type {ApiResult} from "~/api";
import {useRequest} from "~/composables/useRequest";
const route = useRoute();
const { query, params } = route;
const { custom: pageName} = params;
//
const form = ref<Design | any>();
//
const { data: design } = await useRequest<ApiResult<Design[]>>('/cms/design', {params: {
path: `/${pageName}`
}})
if (design.value) {
design.value?.data?.map((d,i) => {
if(i == 0){
form.value = d;
console.log(d.name)
useHead({
title: `${d.name} 网宿软件`,
meta: [{ name: "keywords", content: "Nuxt Vue SSR Typescript" }],
bodyAttrs: {
class: "page-container",
},
script: [
{
children: "console.log('Hello World')",
},
],
});
}
})
}
</script>
<style scoped lang="scss">
</style>

3
utils/tool.ts

@ -16,9 +16,10 @@ export function isArray(str: unknown) {
// 配置服务器接口 // 配置服务器接口
export function getBaseUrl() { export function getBaseUrl() {
console.log('process:',process.server)
if (process.server) { if (process.server) {
return "http://127.0.0.1:9001/api" return "http://127.0.0.1:9001/api"
} else { } else {
return "/api"
return "https://modules.gxwebsoft.com/api"
} }
} }

Loading…
Cancel
Save