初始化项目

parents
# 环境标识
VITE_APP_ENV = 'development'
# URL路径
VITE_APP_BASE_URL = '/practice-jiaxiu-mobile/'
# API地址
VITE_APP_BASE_API = '/dev-api'
#组织标识
VITE_APP_VISITOR_CODE = 'practice-mediaCatalog'
#文件路径
VITE_APP_FILE_URL = '/download'
#kkfile地址
VITE_APP_PREVIEW_URL = 'http://jiaxiu.gyntv.com.cn:8012/onlinePreview?url='
#打包文件名称
VITE_APP_OUTDIR_FILENAME = 'practice-jiaxiu-mobile-html'
#systemCode
VITE_APP_SYSTEM_CODE = 'jiaxiu-centre'
\ No newline at end of file
# 环境标识
VITE_APP_ENV = 'production'
# URL路径
VITE_APP_BASE_URL = '/practice-jiaxiu-mobile/'
# API地址
VITE_APP_BASE_API = '/back/ty-visit/ty-visit'
#组织标识
VITE_APP_VISITOR_CODE = 'practice-mediaCatalog'
#文件路径
VITE_APP_FILE_URL = '/download'
#kkfile地址
VITE_APP_PREVIEW_URL = 'http://jiaxiu.gyntv.com.cn:8012/onlinePreview?url='
#打包文件名称
VITE_APP_OUTDIR_FILENAME = 'practice-jiaxiu-mobile-html'
#systemCode
VITE_APP_SYSTEM_CODE = 'ty-centre'
\ No newline at end of file
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
build
*.local
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.rexma
// .npmrc
public-hoist-pattern[]=@vue*
// or
// shamefully-hoist = true
# 小程序平台模板 vue3
## 安装依赖
```
yarn install
```
### 本地服务
```
yarn start
```
### 小程序平台打包
```
yarn build
```
## 默认安装的 UI 库
[wot-design-uni](https://wot-design-uni.netlify.app/component/button.html)
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
VanButton: typeof import('vant/es')['Button']
VanCascader: typeof import('vant/es')['Cascader']
VanEmpty: typeof import('vant/es')['Empty']
VanIcon: typeof import('vant/es')['Icon']
VanList: typeof import('vant/es')['List']
VanPopup: typeof import('vant/es')['Popup']
VanPullRefresh: typeof import('vant/es')['PullRefresh']
VanSearch: typeof import('vant/es')['Search']
VanSticky: typeof import('vant/es')['Sticky']
VanTab: typeof import('vant/es')['Tab']
VanTabbar: typeof import('vant/es')['Tabbar']
VanTabbarItem: typeof import('vant/es')['TabbarItem']
VanTabs: typeof import('vant/es')['Tabs']
VanTextEllipsis: typeof import('vant/es')['TextEllipsis']
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
{
"name": "rexma-temp-vue3",
"version": "0.0.0",
"scripts": {
"start": "rexma start-rexma",
"build": "rexma build-rexma",
"start:platform": "rexma start",
"build:platform": "rexma build"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-4000720240327002",
"@dcloudio/uni-app-plus": "3.0.0-4000720240327002",
"@dcloudio/uni-components": "3.0.0-4000720240327002",
"@dcloudio/uni-h5": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-alipay": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-baidu": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-jd": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-kuaishou": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-lark": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-qq": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-toutiao": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-weixin": "3.0.0-4000720240327002",
"@dcloudio/uni-mp-xhs": "3.0.0-4000720240327002",
"@dcloudio/uni-quickapp-webview": "3.0.0-4000720240327002",
"axios": "^1.7.2",
"dayjs": "^1.11.11",
"pinia": "2.0.36",
"vant": "^4.9.1",
"vue": "^3.3.11",
"vue-i18n": "^9.1.9",
"vue-router": "4",
"wot-design-uni": "^1.2.26",
"xinhua-sdk": "^1.6.0"
},
"devDependencies": {
"@dcloudio/types": "^3.3.2",
"@dcloudio/uni-automator": "3.0.0-4000720240327002",
"@dcloudio/uni-cli-shared": "3.0.0-4000720240327002",
"@dcloudio/uni-stacktracey": "3.0.0-4000720240327002",
"@dcloudio/vite-plugin-uni": "3.0.0-4000720240327002",
"@types/node": "^20.14.5",
"@vant/auto-import-resolver": "^1.2.1",
"@vitejs/plugin-legacy": "4.1.1",
"@vue/runtime-core": "^3.3.11",
"@vue/tsconfig": "^0.1.3",
"rexma-cli": "^1.8.0",
"sass": "^1.77.6",
"typescript": "^4.9.4",
"unplugin-auto-import": "^0.17.6",
"unplugin-vue-components": "^0.27.2",
"vite": "4.3.5",
"vue-tsc": "^1.0.24"
}
}
<script setup lang="ts">
onLaunch(() => {
console.log('App Launch');
});
onShow(() => {
console.log('App Show');
});
onHide(() => {
console.log('App Hide');
});
</script>
<style></style>
import request from '@/utils/request'
/**
* @description 上传图片
* @param {File} file File对象
* @param {Function} handleUploadProgress 上传进度回调
* @returns
*/
export const uploadFile = (file, handleUploadProgress) => {
const formData = new FormData()
formData.append("file", file)
formData.append("systemCode", import.meta.env.VITE_APP_SYSTEM_CODE)
return request({
url: '/html/htmlMediaInsert/htmlSingleUpload',
method: 'post',
data: formData,
onUploadProgress: handleUploadProgress,
headers: {
'Content-Type': 'multipart/form-data'
}
})
}
/**
* @description 查询类型数据
* @returns
*/
export const selectTypeList = () => {
const data = {
materialType: 3
}
return request({
url: '/html/htmlMediaSelect/selectHtmlClassifyList',
method: 'post',
data: data
})
}
/**
* @description 查询来源数据
* @param {Number} sourceType 1.来源类型 2.来源渠道
* @returns
*/
export const selectSourceList = (sourceType) => {
const data = { sourceType }
return request({
url: '/html/htmlMediaSelect/selectHtmlSourceList',
method: 'post',
data: data
})
}
/**
* @description 查询标签数据
* @returns
*/
export const selectTagsList = () => {
const data = {}
return request({
url: `/html/htmlMediaSelect/treeHtmlTagData/${import.meta.env.VITE_APP_SYSTEM_CODE}`,
method: 'post',
data: data
})
}
/**
* @description 精细查询图组列表
* @param {Any} page 分页对象
* @param {Any} data 图组对象
* @returns
*/
export const selectFinePictureList = (page, data) => {
return request({
url: `/app/appMediaSelect/selectAppFineCatalogList/${page.pageNum}/${page.pageSize}`,
method: 'post',
data: data
})
}
/**
* @description 广泛查询图组列表
* @param {Any} page 分页对象
* @param {Any} data 图组对象
* @returns
*/
export const selectCoarsePictureList = (page, data) => {
return request({
url: `/app/appMediaSelect/selectAppCatalogList/${page.pageNum}/${page.pageSize}`,
method: 'post',
data: data
})
}
/**
* @description 我的图组列表
* @param {Any} page 分页对象
* @param {Any} data 图组对象
* @returns
*/
export const selectMinePictureList = (page, data) => {
return request({
url: `/app/appMediaSelect/selectAppMaterialRetrievalList/${page.pageNum}/${page.pageSize}`,
method: 'post',
data: data
})
}
/**
* @description 我的收藏列表
* @param {Any} page 分页对象
* @param {Any} data 图组对象
* @returns
*/
export const selectCollectPictureList = (page, data) => {
return request({
url: `/app/appMediaSelect/selectAppPersonMaterialList/${page.pageNum}/${page.pageSize}`,
method: 'post',
data: data
})
}
/**
* @description 发布图组
* @param {Any} data 图组对象
* @returns
*/
export const publishPicture = ( data) => {
return request({
url: '/app/appMediaUpdate/updateAppCollect',
method: 'post',
data: data
})
}
/**
* @description 新增图组
* @param {Any} data 图组对象
* @returns
*/
export const insertPicture = (data) => {
return request({
url: '/html/htmlMediaInsert/htmlInsertImageCatalog',
method: 'post',
data: data
})
}
/**
* @description 新增图组地址
* @param {Any} data 图组地址列表
* @returns
*/
export const insertPictureUrl = (data) => {
return request({
url: '/html/htmlMediaInsert/htmlBatchInsertEnclosure',
method: 'post',
data: data
})
}
/**
* @description 查询图组详情
* @param {Number} id 图组id
* @returns
*/
export const selectPictureById = (id) => {
return request({
url: `/app/appMediaSelect/selectAppByMaterialId/${id}`,
method: 'post',
data: {}
})
}
/**
* @description 查询组织
* @param {Any} data 组织对象
* @returns
*/
export const selectOrganizeList = (data) => {
data.moduleCode = import.meta.env.VITE_APP_VISITOR_CODE
return request({
url: '/html/htmlMediaSelect/selectHtmlOrganizeList',
method: 'post',
data: data
})
}
\ No newline at end of file
This diff is collapsed.
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onAddToFavorites: typeof import('@dcloudio/uni-app')['onAddToFavorites']
const onBackPress: typeof import('@dcloudio/uni-app')['onBackPress']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onError: typeof import('@dcloudio/uni-app')['onError']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onHide: typeof import('@dcloudio/uni-app')['onHide']
const onLaunch: typeof import('@dcloudio/uni-app')['onLaunch']
const onLoad: typeof import('@dcloudio/uni-app')['onLoad']
const onMounted: typeof import('vue')['onMounted']
const onNavigationBarButtonTap: typeof import('@dcloudio/uni-app')['onNavigationBarButtonTap']
const onNavigationBarSearchInputChanged: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputChanged']
const onNavigationBarSearchInputClicked: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputClicked']
const onNavigationBarSearchInputConfirmed: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputConfirmed']
const onNavigationBarSearchInputFocusChanged: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputFocusChanged']
const onPageNotFound: typeof import('@dcloudio/uni-app')['onPageNotFound']
const onPageScroll: typeof import('@dcloudio/uni-app')['onPageScroll']
const onPullDownRefresh: typeof import('@dcloudio/uni-app')['onPullDownRefresh']
const onReachBottom: typeof import('@dcloudio/uni-app')['onReachBottom']
const onReady: typeof import('@dcloudio/uni-app')['onReady']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onResize: typeof import('@dcloudio/uni-app')['onResize']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage']
const onShareTimeline: typeof import('@dcloudio/uni-app')['onShareTimeline']
const onShow: typeof import('@dcloudio/uni-app')['onShow']
const onTabItemTap: typeof import('@dcloudio/uni-app')['onTabItemTap']
const onThemeChange: typeof import('@dcloudio/uni-app')['onThemeChange']
const onUnhandledRejection: typeof import('@dcloudio/uni-app')['onUnhandledRejection']
const onUnload: typeof import('@dcloudio/uni-app')['onUnload']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useLink: typeof import('vue-router')['useLink']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
const xma: typeof import('rexma-cli')['xma']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}
/// <reference types='@dcloudio/types' />
import 'vue'
declare module '@vue/runtime-core' {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentCustomOptions extends Hooks {
}
}
/// <reference types="vite/client" />
declare module '*.vue' {
import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
export function useInitScroll() {
// 记录离开时导航条的位置
let scrollY = ref();
// 离开路由时的钩子函数
onBeforeRouteLeave((to, from, next) => {
// 记录当前的滚动条位置
scrollY.value =
window.pageYOffset ||
document.documentElement.scrollTop ||
document.body.scrollTop;
next()
})
onActivated(() => {
nextTick(() => { }).then(() => {
window.scroll(0, scrollY.value);
})
})
}
\ No newline at end of file
import { createSSRApp } from 'vue';
import App from './App.vue';
import store from './store';
import router from './router'
export function createApp() {
const app = createSSRApp(App);
app.use(router)
app.use(store);
return {
app,
};
}
{
"name" : "",
"appid" : "",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* 模块配置 */
"modules" : {},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios" : {},
/* SDK配置 */
"sdkConfigs" : {}
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics": {
"enable": false
},
"vueVersion" : "3",
"h5" : {
"router" : {
"base" : "./",
"mode" : "hash"
},
"optimization" : {
"treeShaking" : {
"enable" : true
}
}
}
}
{
"easycom": {
"autoscan": true,
"custom": {
"^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue"
}
},
"pages": [ // pages 数组中第一项表示应用启动页
{
"path": "pages/index",
"style": {
"navigationBarTitleText": "小程序平台"
}
}
],
"globalStyle": {
"navigationStyle": "custom"
}
}
<template>
<van-popup v-model:show="show" position="bottom" :close-on-click-overlay="false" safe-area-inset-bottom @close="handleClose">
<div class="container">
<div class="header-placeholder">
<div class="header">
<span class="reset" @click="handleReset">重置</span>
<span class="confirm" @click="handleConfirm">确认</span>
</div>
</div>
<div class="content">
<div class="item" v-for="(item, index) in dataList" :key="index"
:class="{ active: selectItemIndex == index }" @click="selectItemIndex = index">
<span>{{ item.sourceName }}</span>
</div>
</div>
</div>
</van-popup>
</template>
<script setup>
import { selectSourceList } from '@/api/publish';
const emits = defineEmits(["confirm", "close"])
const dataList = ref([])
const getList = async () => {
const res = await selectSourceList(2)
dataList.value = res.data
}
getList()
const selectItemIndex = ref(null)
const handleConfirm = () => {
emits('confirm', dataList.value[selectItemIndex.value])
show.value = false
}
const handleReset = () => {
selectItemIndex.value = null
}
const handleClose = () => {
emits('close')
}
const show = ref(false)
const open = () => {
show.value = true
}
const close = () => {
show.value = false
}
defineExpose({
open,
close
})
</script>
<style lang="scss" scoped>
.container {
max-height: 50vh;
padding: 0 20px;
.header-placeholder {
height: 55px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 16px;
position: fixed;
width: calc(100vw - 40px);
height: 55px;
background-color: #ffffff;
color: #545454;
.confirm {
color: #0e7ce3;
}
}
}
.content {
display: flex;
flex-wrap: wrap;
gap: 15px;
padding-bottom: 15px;
.item {
background-color: #eef1f3;
flex: 0 0 calc((100vw - 70px) / 3);
padding: 15px 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
color: #676767;
font-size: 15px;
span {
max-width: 80%;
}
}
.active {
background-color: #0e7ce3;
color: #ffffff;
}
}
}
</style>
\ No newline at end of file
<template>
<van-popup v-model:show="show" position="bottom" :close-on-click-overlay="false" safe-area-inset-bottom @close="handleClose">
<div class="container">
<div class="header-placeholder">
<div class="header">
<span class="reset" @click="handleReset">重置</span>
<span class="confirm" @click="handleConfirm">确认</span>
</div>
</div>
<div class="content">
<div class="item" v-for="(item, index) in dataList" :key="index"
:class="{ active: selectItemIndex == index }" @click="selectItemIndex = index">
<span>{{ item.sourceName }}</span>
</div>
</div>
</div>
</van-popup>
</template>
<script setup>
import { selectSourceList } from '@/api/publish';
const emits = defineEmits(["confirm", "close"])
const dataList = ref([])
const getList = async () => {
const res = await selectSourceList(1)
dataList.value = res.data
}
getList()
const selectItemIndex = ref(null)
const handleConfirm = () => {
emits('confirm', dataList.value[selectItemIndex.value])
show.value = false
}
const handleReset = () => {
selectItemIndex.value = null
}
const handleClose = () => {
emits('close')
}
const show = ref(false)
const open = () => {
show.value = true
}
const close = () => {
show.value = false
}
defineExpose({
open,
close
})
</script>
<style lang="scss" scoped>
.container {
max-height: 50vh;
padding: 0 20px;
.header-placeholder {
height: 55px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 16px;
position: fixed;
width: calc(100vw - 40px);
height: 55px;
background-color: #ffffff;
color: #545454;
.confirm {
color: #0e7ce3;
}
}
}
.content {
display: flex;
flex-wrap: wrap;
gap: 15px;
padding-bottom: 15px;
.item {
background-color: #eef1f3;
flex: 0 0 calc((100vw - 70px) / 3);
padding: 15px 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
color: #676767;
font-size: 15px;
span {
max-width: 80%;
}
}
.active {
background-color: #0e7ce3;
color: #ffffff;
}
}
}
</style>
\ No newline at end of file
<template>
<van-popup v-model:show="show" position="bottom" :close-on-click-overlay="false" safe-area-inset-bottom @close="handleClose">
<div class="container">
<div class="header-placeholder">
<div class="header">
<span class="reset" @click="handleReset">重置</span>
<span class="confirm" @click="handleConfirm">确认</span>
</div>
</div>
<van-cascader v-model="activeId" :show-header="false" :options="treeList" :field-names="fieldNames" />
</div>
</van-popup>
</template>
<script setup>
import { selectTagsList } from '@/api/publish'
const emits = defineEmits(["confirm", "close"])
const activeId = ref(null)
const fieldNames = {
text: 'title',
value: 'id',
children: 'children'
}
const treeList = ref([])
const dataList=ref([])
const getList = async () => {
const res = await selectTagsList()
treeList.value = res.data
dataList.value=dealTreeData(res.data)
}
getList()
const dealTreeData = (data) => {
let arrTree = []
data.forEach((ele) => {
let obj = { ...ele }
delete obj.children
arrTree.push(obj)
if (ele?.children?.length) {
arrTree.push(...dealTreeData(ele.children))
}
});
return arrTree;
}
const handleConfirm = () => {
const item = dataList.value.filter(item => item.id == activeId.value)[0]
emits('confirm', item)
show.value = false
}
const handleReset = () => {
activeId.value = null
}
const handleClose = () => {
emits('close')
}
const show = ref(false)
const open = () => {
show.value = true
}
const close = () => {
show.value = false
}
defineExpose({
open,
close
})
</script>
<style lang="scss" scoped>
.container {
max-height: 50vh;
.header-placeholder {
height: 55px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 16px;
position: fixed;
width: calc(100vw - 40px);
height: 55px;
background-color: #ffffff;
color: #545454;
padding: 0 20px;
.confirm {
color: #0e7ce3;
}
}
}
::v-deep(.van-sidebar-item) {
text-align: center;
}
}
</style>
\ No newline at end of file
<template>
<van-popup v-model:show="show" position="bottom" :close-on-click-overlay="false" safe-area-inset-bottom @close="handleClose">
<div class="container">
<div class="header-placeholder">
<div class="header">
<span class="reset" @click="handleReset">重置</span>
<span class="confirm" @click="handleConfirm">确认</span>
</div>
</div>
<div class="content">
<div class="item" v-for="(item, index) in dataList" :key="index"
:class="{ active: selectItemIndex == index }" @click="selectItemIndex = index">
<span>{{ item.classifyType }}</span>
</div>
</div>
</div>
</van-popup>
</template>
<script setup>
import { selectTypeList } from '@/api/publish'
const emits = defineEmits(["confirm", "close"])
const dataList = ref([])
const getList = async () => {
const res = await selectTypeList()
dataList.value = res.data
}
getList()
const selectItemIndex = ref(null)
const handleConfirm = () => {
emits('confirm', dataList.value[selectItemIndex.value])
show.value = false
}
const handleReset = () => {
selectItemIndex.value = null
}
const handleClose = () => {
emits('close')
}
const show = ref(false)
const open = () => {
show.value = true
}
const close = () => {
show.value = false
}
defineExpose({
open,
close
})
</script>
<style lang="scss" scoped>
.container {
max-height: 50vh;
padding: 0 20px;
.header-placeholder {
height: 55px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 16px;
position: fixed;
width: calc(100vw - 40px);
height: 55px;
background-color: #ffffff;
color: #545454;
.confirm {
color: #0e7ce3;
}
}
}
.content {
display: flex;
flex-wrap: wrap;
gap: 15px;
padding-bottom: 15px;
.item {
background-color: #eef1f3;
flex: 0 0 calc((100vw - 70px) / 3);
padding: 15px 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
color: #676767;
font-size: 15px;
span {
max-width: 80%;
}
}
.active {
background-color: #0e7ce3;
color: #ffffff;
}
}
}
</style>
\ No newline at end of file
This diff is collapsed.
<template>
<router-view v-slot="{ Component, route }">
<keep-alive>
<component :is="Component" :key="route.meta.usePathKey ? route.path : undefined" />
</keep-alive>
</router-view>
<van-tabbar v-model="active" :placeholder="true" active-color="#0E7CE3" route>
<van-tabbar-item icon="home-o" to="/home">首页</van-tabbar-item>
<van-tabbar-item icon="apps-o" to="/prefecture">专区</van-tabbar-item>
<van-tabbar-item icon="send-gift-o" to="/subject">专题</van-tabbar-item>
<van-tabbar-item icon="user-o" to="/mine">我的</van-tabbar-item>
</van-tabbar>
</template>
<script setup>
import { ref } from 'vue'
const active = ref('/home')
</script>
<style scoped></style>
\ No newline at end of file
import { createRouter, createWebHistory } from 'vue-router'
// import useUserStore from '@/stores/user'
// import useCoreStore from '@/stores/core'
import Index from '../pages/index'
import HomeIndex from '../pages/home/index'
// import HomeContent from '../views/home/content'
// import PublishIndex from '../views/publish/index'
// import PublishResult from '../views/publish/result'
// import MineIndex from '../views/mine/index'
// import AccountLogin from '../views/account/login'
// import AccountUserinfo from '../views/account/userinfo'
// import SubjectIndex from '../views/subject/index'
// import SubjectList from '../views/subject/list'
// import PrefectureIndex from '../views/prefecture/index'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'index',
component: Index,
redirect: '/home',
meta: {
keepAlive: true
},
children: [{
path: '/home',
name: 'home',
component: HomeIndex
},
// {
// path: '/mine',
// name: 'mine',
// component: MineIndex,
// meta: {
// requireAuth: true
// }
// },
// {
// path: '/prefecture',
// name: 'prefecture',
// component: PrefectureIndex,
// meta: {
// requireAuth: true
// }
// },
// {
// path: '/subject',
// name: 'subject',
// component: SubjectIndex,
// meta: {
// requireAuth: true
// }
// }
]
},
// {
// path: '/home/content',
// name: 'home-content',
// component: HomeContent
// },
// {
// path: '/publish',
// name: 'publish',
// component: PublishIndex,
// meta: {
// requireAuth: true
// }
// },
// {
// path: '/publish/result',
// name: 'publish-result',
// component: PublishResult,
// meta: {
// requireAuth: true
// }
// },
// {
// path: '/account/login',
// name: 'account-login',
// component: AccountLogin
// },
// {
// path: '/account/userinfo',
// name: 'account-userinfo',
// component: AccountUserinfo,
// meta: {
// requireAuth: true
// }
// },
// {
// path: '/subject/list',
// name: 'subject-list',
// component: SubjectList,
// meta: {
// requireAuth: true,
// keepAlive: true
// }
// }
]
})
// router.beforeEach((to, from, next) => {
// const coreStore = useCoreStore()
// const userStore = useUserStore()
// if (to.meta.keepAlive) {
// coreStore.setCacheRouteNames(to.matched[0].name)
// }
// if (to.meta.requireAuth) {
// if (userStore.isLogin()) {
// next()
// } else {
// next({ name: 'account-login' })
// }
// } else {
// next()
// }
// })
export default router
import request from '@/services/request';
export function getList(params) {
return request.get('/api/queryList', params);
}
import * as foo from './foo';
const api = {
foo,
};
export default api;
type RequestConfig = UniApp.RequestOptions;
type IInterceptors = {
request?: {
onFulfilled?: (config: RequestConfig) => RequestConfig;
onRejected?: (error: any) => any;
};
response?: {
onFulfilled?: (result: UniApp.RequestSuccessCallbackResult) => any;
onRejected?: (error: any) => any;
};
};
class Request {
// 拦截器
private readonly interceptors?: IInterceptors;
constructor(config: { interceptors?: IInterceptors } = {}) {
this.interceptors = config.interceptors;
}
/**
* @description 统一结果处理
*/
private resultHandle(res: Promise<any>) {
return res.then((r) => [r, null]).catch((e) => [null, e]);
}
http(_config: RequestConfig): Promise<any> {
const requestOnFulfilled = this.interceptors?.request?.onFulfilled;
const requestOnRejected = this.interceptors?.request?.onRejected;
const responseOnFulfilled = this.interceptors?.response?.onFulfilled;
const responseOnRejected = this.interceptors?.response?.onRejected;
let config: RequestConfig = { ..._config, header: _config.header || {} };
if (requestOnFulfilled) {
try {
config = requestOnFulfilled(config);
} catch (e) {
requestOnRejected?.(e);
}
}
return new Promise((resolve, reject) => {
xma.request({
...config,
success: (result) => {
if (`${result.statusCode}`.startsWith('2')) {
resolve(responseOnFulfilled?.(result) || result);
} else {
reject(responseOnRejected?.(result) || result);
}
},
fail: (error) => {
reject(responseOnRejected?.(error) || error);
},
});
});
}
post(url: string, data: any = {}, config?: RequestConfig) {
return this.resultHandle(
this.http({
method: 'POST',
url,
data,
...config,
}),
);
}
get(url: string, data: any = {}, config?: RequestConfig) {
return this.resultHandle(
this.http({
method: 'GET',
url,
data,
...config,
}),
);
}
}
const request = new Request({
interceptors: {
request: {
onFulfilled(config) {
return config;
},
},
response: {
onFulfilled(result) {
return result.data;
},
onRejected(error) {
return error;
},
},
},
});
export default request;
export {}
declare module "vue" {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentCustomOptions extends Hooks {}
}
\ No newline at end of file
import { defineStore } from 'pinia';
import { ref } from 'vue';
type ICountStore = {
count: number;
};
const initState: ICountStore = {
count: 0,
};
export const useCountStore = defineStore('user', () => {
const countInfo = ref<ICountStore>({ ...initState });
const addCount = (count: number = 1) => {
countInfo.value.count += count;
};
return {
countInfo,
addCount,
};
});
import { createPinia } from 'pinia';
const store = createPinia();
export default store;
// 模块统一导出
export * from './count';
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
/* 文字基本颜色 */
$uni-text-color: #333; // 基本色
$uni-text-color-inverse: #fff; // 反色
$uni-text-color-grey: #999; // 辅助灰色,如加载更多的提示信息
$uni-text-color-placeholder: #808080;
$uni-text-color-disable: #c0c0c0;
/* 背景颜色 */
$uni-bg-color: #fff;
$uni-bg-color-grey: #f8f8f8;
$uni-bg-color-hover: #f1f1f1; // 点击状态颜色
$uni-bg-color-mask: rgba(0, 0, 0, 0.4); // 遮罩颜色
/* 边框颜色 */
$uni-border-color: #c8c7cc;
/* 尺寸变量 */
/* 文字尺寸 */
$uni-font-size-sm: 12px;
$uni-font-size-base: 14px;
$uni-font-size-lg: 16;
/* 图片尺寸 */
$uni-img-size-sm: 20px;
$uni-img-size-base: 26px;
$uni-img-size-lg: 40px;
/* Border Radius */
$uni-border-radius-sm: 2px;
$uni-border-radius-base: 3px;
$uni-border-radius-lg: 6px;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 5px;
$uni-spacing-row-base: 10px;
$uni-spacing-row-lg: 15px;
/* 垂直间距 */
$uni-spacing-col-sm: 4px;
$uni-spacing-col-base: 8px;
$uni-spacing-col-lg: 12px;
/* 透明度 */
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */
$uni-color-title: #2c405a; // 文章标题颜色
$uni-font-size-title: 20px;
$uni-color-subtitle: #555; // 二级标题颜色
$uni-font-size-subtitle: 18px;
$uni-color-paragraph: #3f536e; // 文章段落颜色
$uni-font-size-paragraph: 15px;
\ No newline at end of file
import axios from 'axios'
import { showToast } from 'vant'
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL: import.meta.env.VITE_APP_BASE_API,
// 超时
timeout: 100000
})
// request拦截器
service.interceptors.request.use(config => {
if (config.headers['Content-Type'] == 'application/json;charset=utf-8') {
config.data.systemCode = import.meta.env.VITE_APP_SYSTEM_CODE
if (config.requireAuth) {
const user = JSON.parse(localStorage.getItem('user'))
config.data.token = user.token
}
}
return config
}, error => {
Promise.reject(error)
})
// 响应拦截器
service.interceptors.response.use(res => {
// 未设置状态码则默认成功状态
const code = res.data.code;
// 获取错误信息
const message = res.data.message
if (code !== 1 && code !== 200) {
showToast(message)
return Promise.reject(message)
} else {
return res.data
}
},
error => {
let { message, response } = error;
if (message == "Network Error") {
message = "后端接口连接异常";
}
else if (message.includes("timeout")) {
message = "系统接口请求超时";
}
else if (message.includes("Request failed with status code")) {
if (response.data.code == 401) {
errorHandlerBy401()
} else {
message = "系统接口" + message.substr(message.length - 3) + "异常";
}
}
showToast(message)
return Promise.reject(error)
}
)
export default service
{
"extends": "@vue/tsconfig/tsconfig.json",
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"noImplicitThis": true,
"allowSyntheticDefaultImports": true,
"allowJs": true,
"sourceMap": true,
"noImplicitAny": false,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"outDir": "dist",
"lib": ["esnext", "dom"],
"types": ["@dcloudio/types", "wot-design-uni/global.d.ts"]
},
"vueCompilerOptions": {
"target": 3,
"nativeTags": ["block", "template", "component", "slot"]
},
"exclude": ["node_modules"],
"include": [
"src/**/*",
"src/**/*.ts",
"src/**/*.js",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.jsx",
"src/**/*.vue",
"src/**/*.json"
],
"files": ["src/**/*", "useScroll.js"]
}
import { defineConfig, loadEnv } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';
import legacy from '@vitejs/plugin-legacy';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd())
const { VITE_APP_ENV, VITE_APP_BASE_URL, VITE_APP_OUTDIR_FILENAME } = env
const fileName = VITE_APP_OUTDIR_FILENAME ?? 'dist'
return {
base: VITE_APP_BASE_URL,
plugins: [
uni(),
AutoImport({
imports: [
'vue',
'uni-app',
'vue-router',
{
'rexma-cli': ['xma'],
},
],
dts: 'src/declaration/auto-imports.d.ts',
resolvers: [VantResolver()],
}),
Components({
resolvers: [VantResolver()],
}),
process.env.UNI_PLATFORM === 'h5' &&
legacy({
targets: ['defaults', 'not IE 11'],
}),
].filter(Boolean),
server: {
host: '0.0.0.0',
proxy: {
'/dev-api': {
target: 'http://192.168.108.100:9758/jiaxiu-visit',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/dev-api/, ""),
bypass: (req, res, options) => res.setHeader("x-req-proxyUr1", options.target + req.url.replace('/dev-api', ''))
},
'/back/ty-visit/ty-visit': {
target: 'https://info.gyntv.com.cn',
changeOrigin: true,
bypass: (req, res, options) => res.setHeader("x-req-proxyUr1", options.target + req.url)
},
'/download': {
target: VITE_APP_ENV === 'production' ? 'https://info.gyntv.com.cn/' : 'http://192.168.98.43:88',
changeOrigin: true,
bypass: (req, res, options) => res.setHeader("x-req-proxyUr1", options.target + req.url)
}
}
},
build: {
outDir: fileName,
sourcemap: false,
minify: 'terser',
chunkSizeWarningLimit: 1500,
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true
}
},
}
}
});
This source diff could not be displayed because it is too large. You can view the blob instead.
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