Commit a23aeb3c authored by 何毅恒's avatar 何毅恒

更新

parent 34e26d59
Pipeline #78 failed with stages
# 路径变量必须得用VITE_开头, 修改后需要重启
# 指定构建模式
VITE_NODE_ENV=development
# 页面 title 前缀
VUE_APP_TITLE=开发环境
# 本地
VITE_API_BASE_URL='/dev'
# 路径变量必须得用VITE_开头, 修改后需要重启
# 指定构建模式
VITE_NODE_ENV=production
# 页面 title 前缀
VUE_APP_TITLE=生产环境
# 测试
VITE_API_BASE_URL='https://c.gelifood.com/index.php/api/'
# VITE_API_BASE_URL='https://cms.gelifood.com/index.php/api/'
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## Type Support For `.vue` Imports in TS
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
1. Disable the built-in TypeScript Extension
1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
}
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
export interface GlobalComponents {
ArticleItem: typeof import('./src/components/ArticleItem.vue')['default']
ElCarousel: typeof import('element-plus/es')['ElCarousel']
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
VanSearch: typeof import('vant/es')['Search']
VanTreeSelect: typeof import('vant/es')['TreeSelect']
}
}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>格利帮助中心</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
This diff is collapsed.
{
"name": "glhelp",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.4.0",
"element-plus": "^2.3.8",
"normalize.css": "^8.0.1",
"pinia": "^2.1.6",
"terser": "^5.19.2",
"vant": "^4.6.3",
"vue": "^3.3.4",
"vue-router": "^4.0.13",
"weixin-js-sdk": "^1.6.0"
},
"devDependencies": {
"@types/node": "^20.4.5",
"@vitejs/plugin-vue": "^4.2.3",
"eslint": "^8.46.0",
"node-sass": "^9.0.0",
"sass": "^1.64.1",
"typescript": "^5.0.2",
"unplugin-auto-import": "^0.16.6",
"unplugin-vue-components": "^0.25.1",
"vite": "^4.4.5",
"vite-plugin-cdn-import": "^0.3.5",
"vue-tsc": "^1.8.5"
}
}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
\ No newline at end of file
<script setup lang="ts">
import { onMounted, computed } from "vue";
import { useRouter } from "vue-router";
onMounted(() => {
detectDeviceType(machineType.value);
});
const router = useRouter();
const machineType = computed(() => {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
? "Mobile"
: "Desktop";
});
const detectDeviceType = (machineType): void => {
if (machineType == "Mobile") {
router.push("/mobile");
} else {
router.push("/pc");
}
};
</script>
<template>
<router-view></router-view>
</template>
<style scoped lang="scss"></style>
import axios, { AxiosRequestConfig, AxiosInstance, AxiosResponse,InternalAxiosRequestConfig } from 'axios';
const axiosInstance: AxiosInstance = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL,
timeout: 5000,
});
// 添加请求拦截器
axiosInstance.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
// 在发送请求之前做些什么
return config;
},
(error: any) => {
// 处理请求错误
return Promise.reject(error);
},
);
// 添加响应拦截器
axiosInstance.interceptors.response.use(
(response: AxiosResponse) => {
// 对响应数据做点什么
return response;
},
(error: any) => {
// 处理响应错误
return Promise.reject(error);
},
);
export default axiosInstance;
import axiosInstance from './axiosInstance';
export interface ApiResult<T> {
code: number;
message: string;
data: T;
}
export async function get<T>(url: string, params?: any): Promise<ApiResult<T>> {
const response = await axiosInstance.get<ApiResult<T>>(url, { params });
return response.data;
}
export async function post<T>(url: string, data?: any): Promise<ApiResult<T>> {
let _data = {
key : 'pPya2UfVOXJm',
timestamp:Date.parse(new Date()).toString().substr(0,10),
sign:'OsP0QNq63fgCmVEvt5CceeBEuPtXf2bn',
...data
}
const response = await axiosInstance.post<ApiResult<T>>(url, _data);
return response.data;
}
export async function put<T>(url: string, data?: any): Promise<ApiResult<T>> {
const response = await axiosInstance.put<ApiResult<T>>(url, data);
return response.data;
}
export async function del<T>(url: string, params?: any): Promise<ApiResult<T>> {
const response = await axiosInstance.delete<ApiResult<T>>(url, { params });
return response.data;
}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
\ No newline at end of file
<template>
<div id="ArticleItem" @click="toDetails(props.row.id)">
<div class="box">
<p class="title">{{ props.row.title }}</p>
<img src="../assets/icon/rightArrow.png" alt="" />
</div>
</div>
</template>
<script lang='ts' setup>
import { useRouter } from "vue-router";
const props = defineProps({
row: {
type: Object,
default: () => {},
},
});
const router: any = useRouter();
const toDetails = (id): void => {
router.push("/articleDetails?id=" + id);
};
</script>
<style scoped lang='scss'>
#ArticleItem {
height: 50px;
box-sizing: border-box;
.box {
margin-left: 15px;
display: flex;
align-items: center;
padding: 15px 0 15px 0;
border-bottom: 1px solid #e5e5e5;
.title {
width: calc(100vw - 50px);
margin-right: 6px;
overflow: hidden;
text-overflow: ellipsis;
}
img {
width: 17px;
height: 17px;
}
}
}
</style>
\ No newline at end of file
<script setup lang="ts">
import { ref } from 'vue'
defineProps<{ msg: string }>()
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Install
<a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
in your IDE for a better DX
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>
import { createApp } from "vue";
import router from "./router";
import "./style.css";
import App from "./App.vue";
//pinia
import { createPinia } from "pinia";
const pinia = createPinia();
import 'normalize.css';
import './style/reset.css'
// wx jssdk
const app = createApp(App)
import wx from './utils/wxJssdk'
app.config.globalProperties.$wx = wx
app.config.globalProperties.$img = 'https://c.gelifood.com/'
// app.config.globalProperties.$img = 'https://cms.gelifood.com/'
app.use(pinia)
app.use(router)
app.mount('#app')
<template>
<div id="index"></div>
</template>
<script lang="ts" setup>
// import { onMounted } from "vue";
// import { useRouter } from "vue-router";
// onMounted(() => {
// detectDeviceType();
// });
// const router = useRouter();
// const detectDeviceType = (): void => {
// const machineType =
// /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
// navigator.userAgent
// )
// ? "Mobile"
// : "Desktop";
// if (machineType == "Mobile") {
// router.push("/mobile");
// } else {
// router.push("/pc");
// }
// };
</script>
<style scoped lang="scss"></style>
<template>
<div id="articleDetails" v-if="informationDetail">
<h2>{{ informationDetail.title }}</h2>
<div class="downBox">
<span>{{ formatDate(informationDetail.add_time) }}</span>
<a
v-if="informationDetail.is_down"
:href="informationDetail.pdf_url"
:download="informationDetail.title"
>点击下载</a
>
</div>
<p v-html="informationDetail.content"></p>
</div>
</template>
<script lang='ts' setup>
import { useRouter } from "vue-router";
import {
onMounted,
ref,
getCurrentInstance,
ComponentInternalInstance,
} from "vue";
import { post } from "@/api/index";
import { formatDate } from "@/utils/index";
const {
appContext: {
config: { globalProperties },
},
} = getCurrentInstance() as ComponentInternalInstance;
const route = useRouter();
onMounted(() => {
getInformationDetail(id);
});
let id = route.currentRoute.value.query.id;
let informationDetail: any = ref();
const getInformationDetail = async (id) => {
let res = await post("Information/informationDetail", { id });
if (res.code == 0) {
informationDetail.value = res.data;
informationDetail.value.content = informationDetail.value.content.replace(
/\<img/gi,
'<img style="width:100%"'
);
wxJssdk();
}
};
// jssdk 微信分享
const wxJssdk = () => {
let obj = {
title: informationDetail.value.title,
link: "https://testhelp.gelifood.com/index.html#/articleDetails?id=" + id,
desc: "",
imgUrl: "../../assets/img/helpImg.png",
};
globalProperties.$wx.wxShare(obj);
};
</script>
<style scoped lang='scss'>
#articleDetails {
padding: 10px 15px;
h2 {
margin-bottom: 10px;
// height: 42px;
font-size: 15px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 21px;
}
.downBox {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 15px;
span {
height: 16.5px;
font-size: 12px;
font-weight: 400;
color: #7f7f7f;
line-height: 16.5px;
}
a {
height: 16.5px;
font-size: 12px;
font-weight: 500;
color: #e75d5d;
line-height: 16.5px;
}
}
p {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 25px;
}
}
</style>
\ No newline at end of file
<template>
<div id="mobile">
<div class="topImg">
<img src="../../assets/img/helpImg.png" alt="" />
</div>
<van-search
v-model="value"
shape="round"
background="#fff"
placeholder="请输入关键词"
@focus="searchFoucs"
/>
<div class="box" v-if="categoryList">
<div class="classify">
<h4>{{ categoryList[selectCategoryListIndex].cat_name }}</h4>
<img
src="../../assets/icon/downArrow.png"
@click.stop="selectClassifyBoxShow = !selectClassifyBoxShow"
alt=""
/>
</div>
<div class="selectClassifyBox" v-if="selectClassifyBoxShow">
<van-tree-select
v-model:active-id="activeId"
v-model:main-active-index="activeIndex"
:items="treeSelectList"
@click-nav="clickNav"
@click-item="clickItem"
/>
</div>
<div class="secondClassify">
<div
v-for="(item, index) in secondCategoryList"
:key="index"
class="secondClassifyItem"
:class="
selectedSecondCategoryIndex == item.id
? 'activeSecondClassifyItem'
: ''
"
@click="selectSecondClassifyItem(item)"
>
{{ item.cat_name }}
</div>
</div>
<div>
<ArticleItem
v-for="(item, index) in informationList"
:key="index"
:row="item"
></ArticleItem>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import {
ref,
getCurrentInstance,
ComponentInternalInstance,
onMounted,
defineAsyncComponent,
} from "vue";
import { post } from "@/api/index";
import { useRouter } from "vue-router";
onMounted(() => {
getInformationCategory();
});
const ArticleItem = defineAsyncComponent(
() => import("@/components/ArticleItem.vue")
);
const {
appContext: {
config: { globalProperties },
},
} = getCurrentInstance() as ComponentInternalInstance;
const router: any = useRouter();
// 一级分类
let categoryList: any = ref(null);
let selectCategoryListIndex = ref(0);
const getInformationCategory = async () => {
let res = await post("information/getInformationCategory", {});
if (res.code == 0) {
categoryList.value = res.data;
getSecondInformationCategory(res.data[0].id);
informationListParam.value.category_id_1 = res.data[0].id;
treeSelectList.value = categoryList.value.map((item) => {
return { text: item.cat_name, id: item.id };
});
wxJssdk();
}
};
// 二级分类
let secondCategoryList: any = ref([]);
let selectedSecondCategoryIndex = ref(0);
const getSecondInformationCategory = async (parent_id: any) => {
let res = await post("information/getInformationCategory", { parent_id });
if (res.code == 0) {
secondCategoryList.value = res.data;
selectedSecondCategoryIndex.value = res.data[0].id;
informationListParam.value.category_id_2 = res.data[0].id;
getInformationList();
let children = secondCategoryList.value.map((item) => {
return { text: item.cat_name, id: item.id };
});
treeSelectList.value.forEach((item) => {
if (item.id == parent_id) {
item.children = children;
}
});
}
};
// 文章列表
let informationListParam = ref({
// page: 1,
// limit: 10,
section: 3, // 应用板块1政策资讯2其他3帮助中心
category_id_1: "", // 1级分类id
category_id_2: "", // 2级分类id
title: "", //
});
let informationList = ref([]);
const getInformationList = async () => {
let data = informationListParam.value;
let res: any = await post("information/informationList", data);
if (res.code == 0) {
informationList.value = res.data.list;
}
};
// 点击二级分类
const selectSecondClassifyItem = (row) => {
selectedSecondCategoryIndex.value = row.id;
informationListParam.value.category_id_2 = row.id;
getInformationList();
};
// jssdk 微信分享
const wxJssdk = () => {
let obj = {
title: "帮助中心",
link: 'https://testhelp.gelifood.com/index.html',
desc: "",
imgUrl: "../../assets/img/helpImg.png",
};
globalProperties.$wx.wxShare(obj);
};
const value = ref("");
const selectClassifyBoxShow = ref(false);
const activeId = ref(1);
const activeIndex = ref(0);
let treeSelectList: any = ref([]);
const clickNav = (e: any = 0): void => {
let parent_id = categoryList.value[e].id;
informationListParam.value.category_id_1 = parent_id;
getSecondInformationCategory(parent_id);
selectCategoryListIndex.value = e;
};
const clickItem = (e: any): void => {
let currentChild =
treeSelectList.value[selectCategoryListIndex.value].children;
currentChild.forEach((item) => {
if (item.id == e.id) {
selectedSecondCategoryIndex.value = item.id;
informationListParam.value.category_id_2 = item.id;
getInformationList();
}
});
selectClassifyBoxShow.value = false;
};
const searchFoucs = (): void => {
router.push("/search");
};
</script>
<style scoped lang="scss">
#mobile {
// box-sizing: border-box;
width: 100vw;
.topImg {
width: 100vw;
height: 90px;
display: flex;
align-items: center;
justify-content: center;
background-color: #e75d5d;
img {
width: 187px;
height: 23px;
}
}
.box {
position: relative;
.classify {
width: 100vw;
height: 44px;
padding: 12px 15px;
box-sizing: border-box;
background-color: #fff;
display: flex;
align-items: center;
h4 {
height: 20px;
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
margin-right: 5px;
}
img {
width: 17px;
height: 17px;
}
}
.selectClassifyBox {
position: absolute;
top: 44px;
left: 0;
width: 100vw;
min-height: calc(100vh - 90px - 44px - 54px);
background-color: rgba(0, 0, 0, 0.5);
}
.secondClassify {
height: 43px;
width: 100vw;
background: #f8f8f8;
overflow-x: scroll;
white-space: nowrap;
display: flex;
align-items: center;
padding-right: 15px;
box-sizing: border-box;
.secondClassifyItem {
height: 23px;
background: #f2f2f2;
border-radius: 12px;
padding: 4px 12px;
box-sizing: border-box;
color: #333;
font-size: 11px;
margin-left: 15px;
line-height: 15px;
}
.activeSecondClassifyItem {
background: #e75d5d;
color: #fff;
}
}
}
}
::v-deep .van-sidebar-item--select:before {
background-color: #e75d5d;
}
::v-deep .van-tree-select__item--active {
color: #e75d5d;
}
.secondClassify::-webkit-scrollbar {
display: none;
}
</style>
<template>
<div id="search">
<van-search
v-model="informationListParam.title"
shape="round"
background="#fff"
placeholder="请输入问题关键词"
:show-action="true"
@cancel="searchCancel"
@search="getInformationList"
>
<template #action>
<div @click="cancel">取消</div>
</template></van-search
>
<div class="noData" v-if="informationList.length == 0">
<img src="../../../assets/img/nodata.png" alt="" />
<p>暂无数据</p>
</div>
<div class="hasData" v-else>
<ArticleItem
v-for="(item, index) in informationList"
:key="index"
:row="item"
></ArticleItem>
</div>
</div>
</template>
<script lang='ts' setup>
import { ref, defineAsyncComponent, onMounted } from "vue";
import { useRouter } from "vue-router";
import { post } from "@/api/index";
const ArticleItem = defineAsyncComponent(
() => import("@/components/ArticleItem.vue")
);
const router = useRouter();
onMounted(() => {
// getInformationList();
});
// 文章列表
let informationListParam = ref({
// page: 1,
// limit: 10,
section: 3, // 应用板块1政策资讯2其他3帮助中心
category_id_1: "", // 1级分类id
category_id_2: "", // 2级分类id
title: "", //
});
let informationList = ref([]);
const getInformationList = async () => {
let data = informationListParam.value;
let res: any = await post("information/informationList", data);
if (res.code == 0) {
informationList.value = res.data.list;
}
};
const searchCancel = (): void => {
getInformationList();
};
const cancel = (): void => {
router.push("/mobile");
};
</script>
<style scoped lang='scss'>
#search {
.noData {
text-align: center;
img {
height: 120px;
width: 120px;
margin: 20px auto 10px;
}
p {
height: 20px;
font-size: 14px;
font-weight: 400;
color: #7f7f7f;
line-height: 20px;
}
}
}
::v-deep .van-search {
padding: 15px;
border-bottom: 1px solid #e5e5e5;
}
::v-deep .van-search__action {
color: #e75d5d;
font-weight: 500;
}
::v-deep .van-icon-search {
display: none;
}
</style>
\ No newline at end of file
<template>
<div id="pc">
<div class="topBox">
<div class="topBoxCenter">
<img
@click.stop="toIndex"
src="../../assets/img/gelilogo.png"
alt=""
class="logo"
/>
<div class="selectTitle">
<h3 @click.stop="toIndex">首页</h3>
<h3 class="activeTitle">帮助中心</h3>
</div>
</div>
</div>
<div class="container">
<div class="containerCenter">
<div class="block text-center">
<el-carousel height="230px" interval="10000" autoplay="true">
<el-carousel-item
v-for="(item, index) in banner"
:key="index"
:autoplay="banner.length == 1 ? false : true"
interval="10000"
>
<img
style="width: 100%; height: 100%; cursor: pointer"
:src="imgUrl + item.ats_pic"
alt=""
@click.native="bannerJump(item)"
/>
</el-carousel-item>
</el-carousel>
</div>
<div class="contentBox">
<div class="leftBox">
<div class="leftTitle">帮助中心</div>
<el-menu
active-text-color="#E75D5D"
background-color="#fff"
class="el-menu-vertical-demo"
default-active="1"
text-color="#333333"
>
<el-sub-menu
:index="index + 1"
v-for="(item, index) in categoryList"
:key="index"
@click.stop="getSecondInformationCategory(item.id, index)"
>
<template #title>
<span>{{ item.cat_name }}</span>
</template>
<el-menu-item-group>
<el-menu-item
v-for="(secondItem, i) in item.secondCategoryList"
:key="i"
:index="index + 1 + '-' + i + 1"
@click="jump(item.id, secondItem.id, secondItem.cat_name)"
>{{
secondItem.cat_name.length > 7
? secondItem.cat_name.slice(0, 7) + "..."
: secondItem.cat_name
}}</el-menu-item
>
</el-menu-item-group>
</el-sub-menu>
</el-menu>
</div>
<div class="rightBox">
<router-view
:key="router.currentRoute.value.fullPath"
></router-view>
</div>
</div>
</div>
</div>
</div>
</template>
<script lang='ts' setup>
import {
ref,
onMounted,
getCurrentInstance,
ComponentInternalInstance,
} from "vue";
import { useRouter } from "vue-router";
import { post } from "@/api/index";
const {
appContext: {
config: { globalProperties },
},
} = getCurrentInstance() as ComponentInternalInstance;
onMounted(() => {
getBanner();
getInformationCategory();
});
const router = useRouter();
const imgUrl = globalProperties.$img;
// 获取轮播图
let banner: any = ref();
const getBanner = async () => {
let res = await post("information/getBanner");
if (res.code == 0) {
banner.value = res.data;
}
};
// 获取一级分类
let categoryList: any = ref([]);
const getInformationCategory = async () => {
let res = await post("information/getInformationCategory");
if (res.code == 0) {
categoryList.value = res.data;
}
};
// 获取二级分类
const getSecondInformationCategory = async (parent_id, key) => {
let res = await post("information/getInformationCategory", { parent_id });
if (res.code == 0) {
categoryList.value[key].secondCategoryList = res.data;
}
};
const toIndex = (): void => {
window.location.href = "https://gelifood.com/";
};
const jump = (category_id_1, category_id_2, cat_name): void => {
router.push(
"/pc/pcArticleList?category_id_1=" +
category_id_1 +
"&category_id_2=" +
category_id_2 +
"&cat_name=" +
cat_name
);
};
const bannerJump = (row: any) => {
if (row.skip_priority == "url") {
window.location.href = row.ats_link;
}
};
</script>
<style scoped lang='scss'>
#pc {
.topBox {
background: #fff;
height: 104px;
.topBoxCenter {
width: 1200px;
margin: 0 auto;
height: 104px;
display: flex;
align-items: center;
justify-content: space-between;
.logo {
width: 226px;
height: 50px;
cursor: pointer;
}
.selectTitle {
display: flex;
align-items: center;
h3 {
height: 34px;
font-size: 18px;
font-weight: 500;
color: #333333;
line-height: 25px;
margin-left: 24px;
cursor: pointer;
padding: 4px 8px;
box-sizing: border-box;
cursor: pointer;
}
.activeTitle {
color: #fff;
background: #e75d5d;
}
}
}
}
.container {
background: #f5f5f5;
padding: 16px 0;
box-sizing: border-box;
.containerCenter {
width: 1200px;
margin: 0 auto;
.demonstration {
color: var(--el-text-color-secondary);
}
.el-carousel__item h3 {
color: #475669;
opacity: 0.75;
line-height: 230px;
margin: 0;
text-align: center;
}
.el-carousel__item:nth-child(2n) {
background-color: #99a9bf;
}
.el-carousel__item:nth-child(2n + 1) {
background-color: #d3dce6;
}
.contentBox {
margin-top: 16px;
display: flex;
justify-content: space-between;
.leftBox {
background: #fff;
width: 150px;
.leftTitle {
text-align: center;
width: 150px;
height: 48px;
background: linear-gradient(135deg, #e5725d 0%, #e75d5d 100%);
font-size: 18px;
font-weight: 500;
color: #ffffff;
line-height: 48px;
}
::v-deep .el-menu-item-group {
background: #f2f2f2;
}
}
.rightBox {
background: #fff;
width: 1034px;
padding: 32px 32px 16px 32px;
box-sizing: border-box;
.rightTitle {
text-align: center;
height: 25px;
font-size: 18px;
font-weight: 500;
color: #333333;
line-height: 25px;
margin-bottom: 16px;
}
.rightList {
.rightItem {
display: flex;
align-items: center;
margin-bottom: 16px;
.blackIcon {
width: 8px;
height: 8px;
background: #333333;
border-radius: 50%;
margin-right: 16px;
}
span {
width: 100%;
height: 20px;
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.pageBox {
display: flex;
align-items: center;
justify-content: center;
.lastPage {
height: 30px;
width: 36px;
line-height: 30px;
text-align: center;
border: 1px solid #999999;
color: #999;
border-radius: 2px;
margin-left: 12px;
&:hover {
color: #e75d5d;
border: 1px solid #e75d5d;
cursor: pointer;
}
}
}
}
}
}
}
}
::v-deep .el-pager li.is-active {
color: #fff;
background: #e5725d;
border: 1px solid #e75d5d;
}
::v-deep .el-pager li {
color: #999999;
width: 32px;
height: 32px;
border-radius: 2px;
border: 1px solid #999999;
margin-right: 16px;
box-sizing: border-box;
padding: 0;
&:hover {
color: #e75d5d;
border: 1px solid #e75d5d;
}
}
::v-deep .btn-prev {
border: 1px solid #999999;
color: #999999;
margin-right: 16px;
&:hover {
color: #e75d5d;
border: 1px solid #e75d5d;
}
}
::v-deep .btn-next {
border: 1px solid #999999;
color: #999999;
// margin-left: 16px;
&:hover {
color: #e75d5d;
border: 1px solid #e75d5d;
}
}
::v-deep .el-menu-item-group__title {
padding: 0;
}
</style>
\ No newline at end of file
<template>
<div id="pcArticleDetail" v-if="informationDetail">
<div class="title">{{ informationDetail.title }}</div>
<a
v-if="informationDetail.is_down"
:href="informationDetail.pdf_url"
:download="informationDetail.title"
class="downText"
>点击下载</a
>
<p class="content" v-html="informationDetail.content"></p>
</div>
</template>
<script lang='ts' setup>
import { ref, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import { post } from "@/api/index";
onMounted(() => {
getInformationDetail(id);
});
const route = useRoute();
// 文章详情
let id = route.query.id;
let informationDetail: any = ref();
const getInformationDetail = async (id) => {
let res = await post("Information/informationDetail", { id });
if (res.code == 0) {
informationDetail.value = res.data;
informationDetail.value.content = informationDetail.value.content.replace(
/\<img/gi,
'<img style="width:100%"'
);
}
};
</script>
<style scoped lang='scss'>
#pcArticleDetail {
position: relative;
.title {
height: 25px;
font-size: 18px;
font-weight: 500;
color: #333333;
line-height: 25px;
text-align: center;
margin-bottom: 15px;
}
.downText {
position: absolute;
top: 3px;
right: 0;
color: #e75d5d;
cursor: pointer;
&:hover {
text-decoration: none;
}
}
.content {
width: 980px;
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
}
}
</style>
\ No newline at end of file
<template>
<div id="pcArticleList">
<h6 class="rightTitle">{{ cat_name_2 }}</h6>
<ul class="rightList">
<li
class="rightItem"
v-for="(item, index) in informationList.list"
:key="index"
@click="jumpDetail(item.id)"
>
<div class="blackIcon"></div>
<span>{{ item.title }}</span>
</li>
</ul>
<div class="pageBox">
<el-pagination
@size-change="onHandleSizeChange"
@current-change="onHandleCurrentChange"
v-model:current-page="informationListState.page"
v-model:page-size="informationListState.limit"
prev-text="上一页"
next-text="下一页"
layout="prev, pager, next"
:total="informationList.count"
/>
<p class="lastPage" @click="lastPageClick">末页</p>
</div>
</div>
</template>
<script lang='ts' setup>
import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { post } from "@/api/index";
onMounted(() => {
getInformationList();
});
const router = useRouter();
let category_id_1 = ref(router.currentRoute.value.query.category_id_1);
let category_id_2 = ref(router.currentRoute.value.query.category_id_2);
let cat_name_2 = ref(router.currentRoute.value.query.cat_name);
let informationListState = ref({
page: 1,
limit: 10,
section: 3, // 应用板块1政策资讯2其他3帮助中心
category_id_1: category_id_1.value,
category_id_2: category_id_2.value,
title: "",
});
let informationList: any = ref({});
// 获取列表
const getInformationList = async () => {
let res = await post(
"information/informationList",
informationListState.value
);
if (res.code == 0) {
informationList.value = res.data;
}
};
const jumpDetail = (id): void => {
router.push({ path: "/pc/pcArticleDetail", query: { id } });
};
// 分页改变
const onHandleSizeChange = (val: number) => {
informationListState.value.limit = val;
getInformationList();
};
// 分页改变
const onHandleCurrentChange = (val: number) => {
informationListState.value.page = val;
getInformationList();
};
// 末页
const lastPageClick = () => {
let count: number = +informationList.value.count;
let res: number = +count / 10;
// console.log(res, count);
if (count % 10 == 0) {
informationListState.value.page = res;
getInformationList();
} else {
if (res > 1) {
let page = parseInt(res + "") + 1;
informationListState.value.page = page;
getInformationList();
} else {
informationListState.value.page = 1;
getInformationList();
}
}
};
</script>
<style scoped lang='scss'>
#pcArticleList {
position: relative;
height: 100%;
.rightTitle {
text-align: center;
height: 25px;
font-size: 18px;
font-weight: 500;
color: #333333;
line-height: 25px;
margin-bottom: 16px;
}
.rightList {
.rightItem {
display: flex;
align-items: center;
margin-bottom: 16px;
cursor: pointer;
.blackIcon {
width: 8px;
height: 8px;
background: #333333;
border-radius: 50%;
margin-right: 16px;
}
span {
width: 100%;
height: 20px;
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.pageBox {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
display: flex;
justify-content: center;
align-items: center;
.lastPage {
height: 30px;
width: 36px;
line-height: 30px;
text-align: center;
border: 1px solid #999999;
color: #999;
border-radius: 2px;
margin-left: 12px;
&:hover {
color: #e75d5d;
border: 1px solid #e75d5d;
cursor: pointer;
}
}
}
}
::v-deep .el-pager li.is-active {
color: #fff;
background: #e5725d;
border: 1px solid #e75d5d;
}
::v-deep .el-pager li {
color: #999999;
width: 32px;
height: 32px;
border-radius: 2px;
border: 1px solid #999999;
margin-right: 16px;
box-sizing: border-box;
padding: 0;
&:hover {
color: #e75d5d;
border: 1px solid #e75d5d;
}
}
::v-deep .btn-prev {
border: 1px solid #999999;
color: #999999;
margin-right: 16px;
&:hover {
color: #e75d5d;
border: 1px solid #e75d5d;
}
}
::v-deep .btn-next {
border: 1px solid #999999;
color: #999999;
// margin-left: 16px;
&:hover {
color: #e75d5d;
border: 1px solid #e75d5d;
}
}
</style>
\ No newline at end of file
import { createRouter, RouteRecordRaw , createWebHashHistory} from "vue-router";
// @ts-ignore
const routes: Array<RouteRecordRaw> = [
{
path: "/",
name: "index",
component: () =>
import(/* webpackChunkName: "/" */ "@/pages/index.vue"),
},
{
path: "/pc",
name: "pc",
component: () =>
import(/* webpackChunkName: "pcIndex" */ "@/pages/pc/index.vue"),
children:[
{
path: '/pc/pcArticleList',
name: 'pcArticleList',
component: () => import(/* webpackChunkName: "pcArticleList" */'@/pages/pc/pcArticleList.vue'),
},
{
path: '/pc/pcArticleDetail',
name: 'pcArticleDetail',
component: () => import(/* webpackChunkName: "pcArticleList" */'@/pages/pc/pcArticleDetail.vue'),
},
]
},
{
path: "/mobile",
name: "mobile",
component: () =>
import(/* webpackChunkName: "About" */ "@/pages/mobile/index.vue"),
},
{
path: "/articleDetails",
name: "articleDetails",
component: () =>
import(/* webpackChunkName: "About" */ "@/pages/mobile/articleDetails/index.vue"),
},
{
path: "/search",
name: "search",
component: () =>
import(/* webpackChunkName: "About" */ "@/pages/mobile/search/index.vue"),
},
];
const router = createRouter({
history: createWebHashHistory(""),
routes,
scrollBehavior(to, from, savedPosition) {
return {
el: "#app",
top: 0,
behavior: "smooth",
};
},
});
export default router;
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
font,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
caption {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
table,
tbody,
tfoot,
thead,
tr,
th,
td {
margin: 0;
padding: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
button,
input,
textarea {
margin: 0;
padding: 0;
}
/* form elements 表单元素 */
body,
button,
input,
select,
textarea {
font: normal 12px/1.5 '\5FAE\8F6F\96C5\9ED1', tahoma, arial;
}
/*设置的字体,行高*/
h1,
h2,
h3,
h4,
h5,
h6,
th {
font-size: 100%;
font-weight: normal;
}
/*重置标题*/
address,
cite,
dfn,
var {
font-style: normal;
}
/* 将斜体扶正 */
code,
kbd,
pre,
samp {
font-family: 'courier new', courier, monospace;
}
/* 统一等宽字体 */
small {
font-size: 12px;
}
/* 小于 12px 的中文很难阅读,让 small 正常化 */
ul,
ol {
list-style: none;
}
/* 重置列表元素 */
button,
input[type="submit"],
input[type="button"] {
cursor: pointer;
}
input[type="radio"],
input[type="checkbox"],
input[type="submit"],
input[type="reset"] {
vertical-align: middle;
cursor: pointer;
border: none;
}
/** 重置文本格式元素 **/
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:focus {
outline: 0;
}
sup {
vertical-align: text-top;
}
/* 重置,减少对行高的影响 */
sub {
vertical-align: text-bottom;
}
/** 重置表单元素 **/
legend {
color: #000;
}
/* for ie6 */
fieldset,
img {
border: 0;
}
/* img 搭车:让链接里的 img 无边框 */
button,
input,
select,
textarea {
background: transparent;
font-size: 100%;
outline: 0;
}
/* 使得表单元素在 ie 下能继承字体大小 */
/* 注:optgroup 无法扶正 */
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
vertical-align: middle;
}
/** 重置表格元素 **/
/* 重置 HTML5 元素 */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
summary,
time,
mark,
audio,
video {
display: block;
margin: 0;
padding: 0;
}
/*回复标签重置*/
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
display: none;
}
export const formatDate=(timestamp:any):string=>{
let date = new Date( ('' + timestamp).length == 10 ? timestamp * 1000 : timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
let Y = date.getFullYear() + "-";//年
let M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";//月
let D =
(date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";//日
let h =
(date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
let m =
(date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
":";
let s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
let strDate = Y + M + D ;
return strDate;
}
\ No newline at end of file
import wx from 'weixin-js-sdk'
import {post} from '../api/index'
class wxJssdk{
// 当前是否是微信环境
isWeixin() {
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
}
// 初始化配置
async wxConfig(){
let url:string = window.location.href.split("#")[0];
let res:any = await post('Information/getTicket',{url})
if (res.code == 0) {
wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: res.data.appid, // 必填,公众号的唯一标识
timestamp: res.data.timestamp, // 必填,生成签名的时间戳
nonceStr: res.data.noncestr, // 必填,生成签名的随机串
signature: res.data.signature, // 必填,签名
jsApiList: [
'updateAppMessageShareData',
'updateTimelineShareData',
],
});
}
}
// 微信分享
wxShare(shareObj:any) {
this.wxConfig();
console.log('shareObj',shareObj);
wx.ready(() => {
wx.updateAppMessageShareData({
title: shareObj.title, // 分享标题
link: shareObj.link, // 分享链接
desc: shareObj.desc, // 分享描述
imgUrl: shareObj.imgUrl,
success: function (res:any) {
console.log("wxShare", "setSuccess",res);
},
cancel: function (fail:any) {
console.log("wx_fail", fail);
},
});
wx.updateTimelineShareData({
title: shareObj.title, // 分享标题
link: shareObj.link, // 分享链接
imgUrl: shareObj.imgUrl,
success: function (res:any) {
console.log("wxShare", "setSuccess",res);
},
cancel: function (fail:any) {
console.log("wx_fail", fail);
},
});
});
}
}
export default new wxJssdk();
\ No newline at end of file
/// <reference types="vite/client" />
This diff is collapsed.
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable", "ScriptHost"],
"skipLibCheck": true,
"outDir": "./dist", // 指定输出目录
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"@typings/*": ["src/typings/*"],
"@components/*": ["src/components/*"],
"@style/*": ["src/style/*"],
"@utils/*": ["src/utils/*"],
"@router/*": ["src/router/*"],
"@store/*": ["src/store/*"],
"@api/*": ["src/api/*"],
},
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"types": ["vite/client","node"],
// 编译过程中需要引入的库文件的列表。
/* Linting */
"strict": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
},
"include": [],
"exclude": ["node_modules", "dist"],
"references": [{ "path": "./tsconfig.node.json" }]
}
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"@typings/*": ["src/typings/*"],
"@components/*": ["src/components/*"],
"@style/*": ["src/style/*"],
"@utils/*": ["src/utils/*"],
"@router/*": ["src/router/*"],
"@store/*": ["src/store/*"],
"@api/*": ["src/api/*"],
},
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts","src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}
import { defineConfig,ConfigEnv,loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import path, { resolve } from "path"; //这个path用到了上面安装的@types/node
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import { VantResolver } from "unplugin-vue-components/resolvers";
export default((mode:ConfigEnv) =>{
const env = loadEnv(mode.mode, process.cwd());
return defineConfig({
base: './', //打包路径
publicDir: resolve('public'), //静态资源服务的文件夹
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver(), VantResolver()],
}),
],
//这里进行配置别名
resolve: {
alias: {
"@": path.resolve("./src"), // @代替src
},
},
server: {
host: '0.0.0.0',
port: env.VITE_PORT as unknown as number,
open: JSON.parse(env.VITE_OPEN),
hmr: true,
proxy: {
'/dev': {
target: 'https://c.gelifood.com/index.php/api/',
ws: true,
secure: true,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/dev/, ''),
},
},
},
// 打包配置
   build: {
       //浏览器兼容性 "esnext"|"modules"
       target: 'modules',
       //指定输出路径
       outDir: 'dist',
       //生成静态资源的存放路径
       assetsDir: 'assets',
       //启用/禁用 CSS 代码拆分
       cssCodeSplit: true,
       sourcemap: false,
       assetsInlineLimit: 10240,
       // 打包环境移除console.log, debugger
       minify: 'terser',
       terserOptions: {
           compress: {
               drop_console: true,
               drop_debugger: true,
          },
      },
       rollupOptions: {
           input: {
               main: resolve('index.html'),
          },
           output: {
               entryFileNames: `js/[name]-[hash].js`,
               chunkFileNames: `js/[name]-[hash].js`,
               assetFileNames: `[ext]/[name]-[hash].[ext]`,
          },
      },
  },
})
})
// https://vitejs.dev/config/
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment