Commit 62e8493f authored by szq233's avatar szq233

init: repo

parent 2440fe7b
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
......@@ -2,6 +2,8 @@
node_modules/
unpackage/
dist/
src/manifest.json
src/pages.json
# local env files
.env.local
......@@ -21,3 +23,4 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
.history
......@@ -3,11 +3,12 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "npm run dev:h5",
"serve": "npm run cfgbuild && npm run dev:h5",
"cfgbuild": "node src/utils/pagesJson.js && node src/utils/manifestJson.js",
"build": "npm run build:h5",
"build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
"build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
"build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
"build:h5": "cross-env VUE_APP_ENV=online NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
"build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build",
"build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build",
"build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build",
......@@ -24,7 +25,7 @@
"build:quickapp-webview-union": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build",
"dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
"dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",
"dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
"dev:h5": "cross-env VUE_APP_ENV=dev NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
"dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch",
"dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch",
"dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch",
......@@ -68,8 +69,12 @@
"@dcloudio/uni-stat": "^2.0.1-34920220609002",
"@vue/shared": "^3.0.0",
"core-js": "^3.6.5",
"eruda": "^2.4.1",
"flyio": "^0.6.2",
"regenerator-runtime": "^0.12.1",
"uni-read-pages": "^1.0.5",
"uni-simple-router": "2.0.7",
"uview-ui": "1.8.4",
"vue": "^2.6.11",
"vue-class-component": "^6.3.2",
"vue-property-decorator": "^8.0.0",
......@@ -89,6 +94,7 @@
"@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.1-34920220609002",
"@dcloudio/webpack-uni-mp-loader": "^2.0.1-34920220609002",
"@dcloudio/webpack-uni-pages-loader": "^2.0.1-34920220609002",
"@types/node": "^18.0.0",
"@vue/cli-plugin-babel": "~4.5.13",
"@vue/cli-plugin-typescript": "~4.5.11",
"@vue/cli-service": "~4.5.13",
......@@ -98,6 +104,8 @@
"mini-types": "*",
"miniprogram-api-typings": "*",
"postcss-comment": "^2.0.0",
"sass": "^1.38.1",
"sass-loader": "^10.1.1",
"typescript": "^3.0.0",
"vue-template-compiler": "^2.6.11"
},
......
import Vue from 'vue'
import Vue from 'vue';
import { $u } from './src/models/uview'; // 引入this.$u的相关类型定义
import { GlobalMixins } from './src/store/model'; // 引入混入到全局的vuex中state中属性类型扩展
declare module "vue/types/options" {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentOptions<V extends Vue> extends Hooks {
/**
* 组件类型
*/
mpType?: string;
mpType?: string;
}
}
declare module 'vue/types/vue' {
interface Vue extends GlobalMixins {
$u: $u,
$scss: any
}
}
\ No newline at end of file
}
declare var ROUTES=[];
declare module '*.vue' {
import Vue from 'vue';
export default Vue;
}
declare module 'uview-ui'
declare module '*.scss'
declare module 'eruda'
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
mpType: 'app',
onLaunch() {
console.log('App Launch')
},
onShow() {
console.log('App Show')
},
onHide() {
console.log('App Hide')
import Vue from 'vue';
export default Vue.extend({
mpType: 'app',
onLaunch() {
// 隐藏原生的tabBar,只使用自定义的tabbar组件
uni.hideTabBar({
success: (res) => {
console.log(res)
}
});
})
console.log('App Launch')
},
onShow() {
console.log('App Show')
},
onHide() {
console.log('App Hide')
}
});
</script>
<style>
/*每个页面公共css */
</style>
<style lang="scss">
/*每个页面公共css */
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import "uview-ui/index.scss";
/* 该样式修复ios搜索框bug问题 */
[type="search"]::-webkit-search-decoration {
display: none;
}
page{
background-color: $uni-color-bg;
min-height:100vh;
}
</style>
// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
const install = (Vue: any, vm: any) => {
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
vm.$u.api = {
fetchSomeData: (params = {}) => vm.$u.get('/test/test/get', params),
postSomeData: (data = {}) => vm.$u.post('/test/test/post', data)
}
}
export default {
install
}
// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的
const install = (Vue: any, vm: any) => {
Vue.prototype.$u.http.setConfig({
baseUrl: `https://test.test/api`,
// 如果将此值设置为true,拦截回调中将会返回服务端返回的所有数据response,而不是response.data
// 设置为true后,就需要在this.$u.http.interceptor.response进行多一次的判断,请打印查看具体值
// 设置自定义头部content-type
originalData: true, // 是否在拦截器中返回服务端的原始数据
showLoading: false, // 是否显示请求中的loading
loadingText: '正在加载中...', // 加载中文字
loadingTime: 30000, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
header: {
'content-type': 'application/json;charset=UTF-8'
}
})
// 请求拦截,配置Token等参数
Vue.prototype.$u.http.interceptor.request = (config: any) => {
config.header.token = vm.vuex_user.token
config.header.corpid = vm.vuex_user.corpid
// const Token = vm.$u.getStorageSync('Token');
// 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html
// common.header.token = vm.token;
// 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
// common.header.token = vm.$store.state.token;
// 方式三,如果token放在了globalData,通过getApp().globalData获取
// common.header.token = getApp().globalData.username;
// 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的,所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
// const token = uni.getStorageSync('token');
// common.header.token = token;
return config
}
// 响应拦截,判断状态码是否通过
Vue.prototype.$u.http.interceptor.response = (res: any) => {
// originalData = true
// 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据
// 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果
// 表格数据导出
try {
if (res.header && res.header['content-type'].includes('excel')) {
return res.data
}
} catch (e) {
console.log(e)
}
if (res.errMsg.includes('timeout')) {
vm.$toast.error('请求超时!')
return false
} else if (res.data.code === 0) {
// 如果把originalData设置为了true,这里return回什么,this.$u.post的then回调中就会得到什么
return res.data
} else if (res.data.code === -1) {
vm.$toast.error('请重新登录!')
return false
} else if (res.data.code === 503) {
uni.reLaunch({
url: '/pages/noAccess/index'
})
} else {
const message = /.*[\u4e00-\u9fa5]+.*$/.test(res.data.message) ? res.data.message : '服务异常请重试'
vm.$toast.error(message)
return false
}
}
}
export default {
install
}
<template>
<view class="container anime1">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'anime1',
data () {
return {
}
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.anime1 {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.anime1 .shape1 {
-webkit-animation: animation1shape1 0.5s ease 0s infinite alternate;
animation: animation1shape1 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation1shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(16px, 16px);
transform: translate(16px, 16px);
}
}
@keyframes animation1shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(16px, 16px);
transform: translate(16px, 16px);
}
}
.anime1 .shape2 {
-webkit-animation: animation1shape2 0.5s ease 0s infinite alternate;
animation: animation1shape2 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation1shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-16px, 16px);
transform: translate(-16px, 16px);
}
}
@keyframes animation1shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-16px, 16px);
transform: translate(-16px, 16px);
}
}
.anime1 .shape3 {
-webkit-animation: animation1shape3 0.5s ease 0s infinite alternate;
animation: animation1shape3 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation1shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(16px, -16px);
transform: translate(16px, -16px);
}
}
@keyframes animation1shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(16px, -16px);
transform: translate(16px, -16px);
}
}
.anime1 .shape4 {
-webkit-animation: animation1shape4 0.5s ease 0s infinite alternate;
animation: animation1shape4 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation1shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-16px, -16px);
transform: translate(-16px, -16px);
}
}
@keyframes animation1shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-16px, -16px);
transform: translate(-16px, -16px);
}
}
</style>
<template>
<view class="container anime2">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'anime2',
data () {
return {
}
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.anime2 {
-webkit-transform: rotate(10deg);
transform: rotate(10deg);
}
.container.anime2 .shape {
border-radius: 5px;
}
.container.anime2{
-webkit-animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.anime2 .shape1 {
-webkit-animation: animation2shape1 0.5s ease 0s infinite alternate;
animation: animation2shape1 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation2shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(20px, 20px);
transform: translate(20px, 20px);
}
}
@keyframes animation2shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(20px, 20px);
transform: translate(20px, 20px);
}
}
.anime2 .shape2 {
-webkit-animation: animation2shape2 0.5s ease 0s infinite alternate;
animation: animation2shape2 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation2shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-20px, 20px);
transform: translate(-20px, 20px);
}
}
@keyframes animation2shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-20px, 20px);
transform: translate(-20px, 20px);
}
}
.anime2 .shape3 {
-webkit-animation: animation2shape3 0.5s ease 0s infinite alternate;
animation: animation2shape3 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation2shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(20px, -20px);
transform: translate(20px, -20px);
}
}
@keyframes animation2shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(20px, -20px);
transform: translate(20px, -20px);
}
}
.anime2 .shape4 {
-webkit-animation: animation2shape4 0.5s ease 0s infinite alternate;
animation: animation2shape4 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation2shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-20px, -20px);
transform: translate(-20px, -20px);
}
}
@keyframes animation2shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-20px, -20px);
transform: translate(-20px, -20px);
}
}
</style>
<template>
<view class="container anime3">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'anime3',
data () {
return {
}
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.anime3 {
-webkit-animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container.anime3 .shape1 {
border-top-left-radius: 10px;
}
.container.anime3 .shape2 {
border-top-right-radius: 10px;
}
.container.anime3 .shape3 {
border-bottom-left-radius: 10px;
}
.container.anime3 .shape4 {
border-bottom-right-radius: 10px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.anime3 .shape1 {
-webkit-animation: animation3shape1 0.5s ease 0s infinite alternate;
animation: animation3shape1 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation3shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(5px, 5px);
transform: translate(5px, 5px);
}
}
@keyframes animation3shape1 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(5px, 5px);
transform: translate(5px, 5px);
}
}
.anime3 .shape2 {
-webkit-animation: animation3shape2 0.5s ease 0s infinite alternate;
animation: animation3shape2 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation3shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-5px, 5px);
transform: translate(-5px, 5px);
}
}
@keyframes animation3shape2 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-5px, 5px);
transform: translate(-5px, 5px);
}
}
.anime3 .shape3 {
-webkit-animation: animation3shape3 0.5s ease 0s infinite alternate;
animation: animation3shape3 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation3shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(5px, -5px);
transform: translate(5px, -5px);
}
}
@keyframes animation3shape3 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(5px, -5px);
transform: translate(5px, -5px);
}
}
.anime3 .shape4 {
-webkit-animation: animation3shape4 0.5s ease 0s infinite alternate;
animation: animation3shape4 0.5s ease 0s infinite alternate;
}
@-webkit-keyframes animation3shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-5px, -5px);
transform: translate(-5px, -5px);
}
}
@keyframes animation3shape4 {
from {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
to {
-webkit-transform: translate(-5px, -5px);
transform: translate(-5px, -5px);
}
}
</style>
<template>
<view class="container anime4">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'anime4',
data () {
return {
}
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.anime4 .shape {
width: 15px;
height: 15px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.anime4 .shape1 {
animation: animation5shape1 2s ease 0s infinite reverse;
}
@-webkit-keyframes animation5shape1 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, 15px);
transform: translate(0, 15px);
}
50% {
-webkit-transform: translate(15px, 15px);
transform: translate(15px, 15px);
}
75% {
-webkit-transform: translate(15px, 0);
transform: translate(15px, 0);
}
}
@keyframes animation5shape1 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, 15px);
transform: translate(0, 15px);
}
50% {
-webkit-transform: translate(15px, 15px);
transform: translate(15px, 15px);
}
75% {
-webkit-transform: translate(15px, 0);
transform: translate(15px, 0);
}
}
.anime4 .shape2 {
animation: animation5shape2 2s ease 0s infinite reverse;
}
@-webkit-keyframes animation5shape2 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
50% {
-webkit-transform: translate(-15px, 15px);
transform: translate(-15px, 15px);
}
75% {
-webkit-transform: translate(0, 15px);
transform: translate(0, 15px);
}
}
@keyframes animation5shape2 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
50% {
-webkit-transform: translate(-15px, 15px);
transform: translate(-15px, 15px);
}
75% {
-webkit-transform: translate(0, 15px);
transform: translate(0, 15px);
}
}
.anime4 .shape3 {
animation: animation5shape3 2s ease 0s infinite reverse;
}
@-webkit-keyframes animation5shape3 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(15px, 0);
transform: translate(15px, 0);
}
50% {
-webkit-transform: translate(15px, -15px);
transform: translate(15px, -15px);
}
75% {
-webkit-transform: translate(0, -15px);
transform: translate(0, -15px);
}
}
@keyframes animation5shape3 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(15px, 0);
transform: translate(15px, 0);
}
50% {
-webkit-transform: translate(15px, -15px);
transform: translate(15px, -15px);
}
75% {
-webkit-transform: translate(0, -15px);
transform: translate(0, -15px);
}
}
.anime4 .shape4 {
animation: animation5shape4 2s ease 0s infinite reverse;
}
@-webkit-keyframes animation5shape4 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, -15px);
transform: translate(0, -15px);
}
50% {
-webkit-transform: translate(-15px, -15px);
transform: translate(-15px, -15px);
}
75% {
-webkit-transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
}
@keyframes animation5shape4 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, -15px);
transform: translate(0, -15px);
}
50% {
-webkit-transform: translate(-15px, -15px);
transform: translate(-15px, -15px);
}
75% {
-webkit-transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
}
</style>
<template>
<view class="container anime5">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'anime5',
data () {
return {
}
}
}
</script>
<style scoped="true">
.container {
width: 30px;
height: 30px;
position: relative;
}
.container.anime5 {
-webkit-animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container.anime5 .shape {
width: 12px;
height: 12px;
border-radius: 2px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890FF;
}
.container .shape.shape2 {
right: 0;
background-color: #91CB74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #FAC858;
}
.container .shape.shape4 {
bottom: 0;
right: 0;
background-color: #EE6666;
}
.anime5 .shape1 {
-webkit-animation: animation6shape1 2s linear 0s infinite normal;
animation: animation6shape1 2s linear 0s infinite normal;
}
@-webkit-keyframes animation6shape1 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, 18px);
transform: translate(0, 18px);
}
50% {
-webkit-transform: translate(18px, 18px);
transform: translate(18px, 18px);
}
75% {
-webkit-transform: translate(18px, 0);
transform: translate(18px, 0);
}
}
@keyframes animation6shape1 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, 18px);
transform: translate(0, 18px);
}
50% {
-webkit-transform: translate(18px, 18px);
transform: translate(18px, 18px);
}
75% {
-webkit-transform: translate(18px, 0);
transform: translate(18px, 0);
}
}
.anime5 .shape2 {
-webkit-animation: animation6shape2 2s linear 0s infinite normal;
animation: animation6shape2 2s linear 0s infinite normal;
}
@-webkit-keyframes animation6shape2 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
50% {
-webkit-transform: translate(-18px, 18px);
transform: translate(-18px, 18px);
}
75% {
-webkit-transform: translate(0, 18px);
transform: translate(0, 18px);
}
}
@keyframes animation6shape2 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
50% {
-webkit-transform: translate(-18px, 18px);
transform: translate(-18px, 18px);
}
75% {
-webkit-transform: translate(0, 18px);
transform: translate(0, 18px);
}
}
.anime5 .shape3 {
-webkit-animation: animation6shape3 2s linear 0s infinite normal;
animation: animation6shape3 2s linear 0s infinite normal;
}
@-webkit-keyframes animation6shape3 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(18px, 0);
transform: translate(18px, 0);
}
50% {
-webkit-transform: translate(18px, -18px);
transform: translate(18px, -18px);
}
75% {
-webkit-transform: translate(0, -18px);
transform: translate(0, -18px);
}
}
@keyframes animation6shape3 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(18px, 0);
transform: translate(18px, 0);
}
50% {
-webkit-transform: translate(18px, -18px);
transform: translate(18px, -18px);
}
75% {
-webkit-transform: translate(0, -18px);
transform: translate(0, -18px);
}
}
.anime5 .shape4 {
-webkit-animation: animation6shape4 2s linear 0s infinite normal;
animation: animation6shape4 2s linear 0s infinite normal;
}
@-webkit-keyframes animation6shape4 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, -18px);
transform: translate(0, -18px);
}
50% {
-webkit-transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
}
75% {
-webkit-transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
}
@keyframes animation6shape4 {
0% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
-webkit-transform: translate(0, -18px);
transform: translate(0, -18px);
}
50% {
-webkit-transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
}
75% {
-webkit-transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
}
</style>
<template>
<view class="loading">
<component :is="`Anime${loadingType}`"></component>
</view>
</template>
<script>
import Anime1 from './anime1.vue'
import Anime2 from './anime2.vue'
import Anime3 from './anime3.vue'
import Anime4 from './anime4.vue'
import Anime5 from './anime5.vue'
export default {
name: 'loading',
components: { Anime1, Anime2, Anime3, Anime4, Anime5 },
props: {
loadingType: {
type: [Number, String],
default: 2
}
}
}
</script>
<style>
.loading{
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top:0;
left:0;
right:0;
bottom:0;
background:rgba(255,255,255,.3);
}
</style>
import Vue from 'vue'
import { Component } from 'vue-property-decorator'
import uView from "uview-ui";
import Loading from './loading/loading.vue'
import TabBar from './tabbar/index.vue'
import scss from '@/uni.scss'
Vue.component('Loading', Loading)
Vue.component('TabBar', TabBar)
Vue.use(uView)
Vue.mixin({
computed: {
$scss: () => scss
}
})
<template>
<!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
<u-tabbar ref="uTabbar"
:list="lists"
:active-color="$scss.mainColor"
inactive-color="#808b9a"
height="100"
:border-top="true"/>
</template>
<script>
import tabBar from '@/utils/tabbarList'
export default {
name: 'index',
computed: {
lists () {
const l = this.$u.deepClone(tabBar)
// const m = this.vuex_isStudent ? [l[0], l[2]] : l
return l.map(item => {
item.pagePath = `/${item.pagePath}`
return item
})
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .u-tabbar__content{
max-width: $uni-max-width;
position: fixed;
left: 50%;
transform: translate(-50%, 0);
}
</style>
import Vue from 'vue'
import App from './App.vue'
import store from '@/store'
import eruda from 'eruda'
import { router, RouterMount } from './router'
import '@/components/register';
import { VuexMixin } from '@/store/$u.mixin'
Vue.config.productionTip = false
new App().$mount()
Vue.use(router)
Vue.mixin(VuexMixin)
// if (process.env.VUE_APP_ENV === 'test') {
// 默认开启eruda调试台,这里可以用环境变量判断开启关闭
eruda.init();
// }
const app = new App({
store
})
// http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
import httpInterceptor from '@/common/http.interceptor'
Vue.use(httpInterceptor, app)
// http接口API集中管理引入部分
import httpApi from '@/common/http.api'
Vue.use(httpApi, app)
// #ifdef H5
RouterMount(app, router, '#app')
// #endif
// #ifndef H5
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif
interface UView {
/**
* uview为uniapp的uni.showToast的二次封装
* @param title toast的消息内容
* @param duration toast出现到消失的时间,单位ms,默认1500ms
*/
toast(title: string, duration?: number): void
/**
* 此属性用于返回平台的名称,为小写的ios或android
*/
os(): string
/**
* 此属性用于获取设备的信息,相当于uni.getSystemInfoSync()的效果
*/
sys(): UniNamespace.GetSystemInfoResult
queryParams(data: any, isPrefix?: boolean, arrayFormat?: string): string
route(options: any, params: any): void
timeFormat(dateTime: null, fmt?: ('yyyy-mm-dd'|string)): string
guid: any
color: any
type2icon: any
randomArray: any
wranning: any
get: any
post: any
put: any
hexToRgb: any
rgbToHex: any
random: any
deepClone: Function
deepMerge: Function
getParent: Function
$parent: any
trim: Function
http: any
config: any // uView配置信息相关,比如版本号
zIndex: any
debounce: Function
throttle: Function
}
export interface $u extends UView {
/**
* 使用方法为:如果要修改vuex的state中的user.name变量为"史诗" => this.$u.vuex('user.name', '史诗')
* 如果要修改vuex的state的version变量为1.0.1 => this.$u.vuex('version', '1.0.1')
* @param name 对应vux中state的key,可以使用.分隔以修改深层属性
* @param value 值
*/
vuex(name: string, value: any): void
// rpx转换为px
rpx2px(rpx: number): number
// px转换为rpx
px2rpx(rpx: number): number
}
<template>
<view class="about">
{{title}}
<TabBar />
</view>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch, Emit, Ref } from 'vue-property-decorator';
@Component
export default class About extends Vue {
private title = '这里是关于'
}
</script>
<style lang="scss" scoped>
</style>
<template>
<view class="home">
{{title}}
<view class="message">
这里是测试样式
</view>
<u-button>测试</u-button>
<TabBar />
</view>
</template>
<script lang="ts">
import { Vue, Component, Watch, Emit, Ref } from 'vue-property-decorator';
@Component
export default class Home extends Vue {
private title = '这里是首页'
onShow() {
this.$u.toast('首页')
this.$u.vuex('vuex_user', {
name: '测试',
id: '123456'
})
}
}
</script>
<style lang="scss" scoped>
.message {
color: lightblue;
}
</style>
<template>
<view class="content">
<image class="logo" src="../../static/logo.png"></image>
<view>
<text class="title">{{title}}</text>
</view>
</view>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
}
});
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin: 200rpx auto 50rpx auto;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
<template>
<view class="no-access">
{{ title }}
</view>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch, Emit, Ref } from 'vue-property-decorator';
@Component
export default class NoAccess extends Vue {
private title = '你没有权限'
}
</script>
<template>
<view class="about">
{{title}}
<TabBar />
</view>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch, Emit, Ref } from 'vue-property-decorator';
@Component
export default class About extends Vue {
private title = '这里是我的'
}
</script>
<style lang="scss" scoped>
</style>
import { RouterMount, createRouter, RoutesRule } from 'uni-simple-router';
const pages = require('./pages.ts')
const RouterPages: RoutesRule[] = [
...pages
].map((item: RoutesRule) => ({
path: `/${item.path}`,
meta: item.meta || {},
name: item.name,
style: item.style
}))
const router = createRouter({
platform: process.env.VUE_APP_PLATFORM as any,
routes: [...RouterPages, {
path: '*',
redirect: (to: RoutesRule) => {
return { name: '404' }
}
}]
});
// 路由前置守卫
router.beforeEach((to, from, next) => {
next();
});
// 路由后置守卫
router.afterEach((to, from) => {
// console.log('跳转结束')
})
export {
router,
RouterMount
}
const home = require('./path/home.ts')
const about = require('./path/about.ts')
const profile = require('./path/profile.ts')
const noAccess = require('./path/noAccess.ts')
module.exports = [
...home,
...about,
...profile,
...noAccess
]
module.exports = [
{
path: 'pages/about/index',
style: {
navigationBarTitleText: '关于'
}
}
]
module.exports = [
{
path: 'pages/home/index',
aliasPath: '/',
style: {
navigationBarTitleText: '首页',
enablePullDownRefresh: true
}
}
]
module.exports = [
{
path: 'pages/noAccess/index',
style: {
navigationBarTitleText: '无权限'
}
}
]
module.exports = [
{
path: 'pages/profile/index',
style: {
navigationBarTitleText: '我的'
}
}
]
import { Component, Vue } from 'vue-property-decorator'
import { mapState } from 'vuex'
import store from "./index"
// 尝试将用户在根目录中的store/index.js的vuex的state变量,全部加载到全局变量中
let $uStoreKey: string[] = [];
try{
$uStoreKey = store.state ? Object.keys(store.state) : [];
}catch(e){ }
@Component({
computed: {
...mapState($uStoreKey)
}
})
export class VuexMixin extends Vue {
private created() {
// 此处的types声明在src/models/uview/index.ts定义
// 将vuex方法挂在到$u中
// 使用方法为:如果要修改vuex的state中的user.name变量为"史诗" => this.$u.vuex('user.name', '史诗')
// 如果要修改vuex的state的version变量为1.0.1 => this.$u.vuex('version', '1.0.1')
this.$u.vuex = (name: string, value: any) => {
this.$store.commit('$uStore', {
name, value
})
}
// 以下是一些挂载到$u的自定义工具方法
// rpx转换为px
this.$u.rpx2px = (rpx: number) => {
return uni.upx2px(rpx)
}
// px转换为rpx
this.$u.px2rpx = (px: number) => {
return px / (uni.upx2px(100) / 100)
}
}
}
import Vue from 'vue'
import Vuex from 'vuex'
import { Store } from 'vuex';
Vue.use(Vuex)
let lifeData: any = {};
// 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的
try{
lifeData = uni.getStorageSync('lifeData');
}catch(e){ }
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
const saveStateKeys = ['vuex_user', 'vuex_token'];
// 保存变量到本地存储中
const saveLifeData = function(key: string, value: any) {
// 判断变量名是否在需要存储的数组中
if (saveStateKeys.indexOf(key) != -1) {
// 获取本地存储的lifeData对象,将变量添加到对象中
let tmp = uni.getStorageSync('lifeData');
// 第一次打开APP,不存在lifeData变量,故放一个{}空对象
tmp = tmp ? tmp : {};
tmp[key] = value;
// 执行这一步后,所有需要存储的变量,都挂载在本地的lifeData对象中
uni.setStorageSync('lifeData', tmp);
}
}
const store = new Vuex.Store({
state: {
// 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
// 加上vuex_前缀,是防止变量名冲突,也让人一目了然
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : { name: '测试名', corpid: '2333' },
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version: '1.0.1',
},
mutations: {
$uStore(state: any, payload: any) {
// 判断是否多层级调用,state中为对象存在的情况,诸如user.info.score = 1
let nameArr = payload.name.split('.') as string[]
let saveKey = '';
let len = nameArr.length;
if(len >= 2) {
let obj = state[nameArr[0]];
for(let i = 1; i < len - 1; i ++) {
obj = obj[nameArr[i]]
}
// obj[nameArr[len - 1]] = payload.value;
Vue.set(state[nameArr[0]], nameArr[len - 1], payload.value)
saveKey = payload.name
} else {
// 单层级变量,在state就是一个普通变量的情况
// state[payload.name] = payload.value;
Vue.set(state, payload.name, payload.value)
saveKey = payload.name;
}
// 保存变量到本地,见顶部函数定义
saveLifeData(saveKey, state[saveKey])
}
}
}) as Store<any>
export default store
export interface GlobalMixins {
vuex_user: any
vuex_token: string
vuex_version: string
}
......@@ -14,11 +14,14 @@
/* 颜色变量 */
/* 主体颜色 */
$uni-color: rgba(0, 165, 255, 1);
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
$uni-color-primary: #00a5ff;
$uni-color-success: #30c690;
$uni-color-warning: #ff7011;
$uni-color-error: #E9614F;
/* 文字基本颜色 */
$uni-text-color:#333;//基本色
......@@ -28,20 +31,28 @@ $uni-text-color-placeholder: #808080;
$uni-text-color-disable:#c0c0c0;
/* 背景颜色 */
$uni-bg-color:#ffffff;
$uni-bg-color-grey:#f8f8f8;
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
$uni-color-bg:#ffffff;
$uni-color-bg-grey:#f8f8f8;
$uni-color-bg-hover:#f1f1f1;//点击状态颜色
$uni-color-bg-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
/* 边框颜色 */
$uni-border-color:#c8c7cc;
/* 尺寸变量 */
$uni-max-width: 1000rpx;
/* 文字尺寸 */
$uni-font-size-sm:24rpx;
$uni-font-size-base:28rpx;
$uni-font-size-lg:32rpx;
$uni-f22: 22rpx;
$uni-f24: 24rpx;
$uni-f26: 26rpx;
$uni-f28: 28rpx;
$uni-f30: 30rpx;
$uni-f32: 32rpx;
$uni-f34: 34rpx;
$uni-f36: 36rpx;
$uni-f38: 38rpx;
$uni-f40: 40rpx;
/* 图片尺寸 */
$uni-img-size-sm:40rpx;
......@@ -73,4 +84,19 @@ $uni-font-size-title:40rpx;
$uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:36rpx;
$uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:30rpx;
\ No newline at end of file
$uni-font-size-paragraph:30rpx;
/* utils.scss */
@import './utils.scss';
/* uni.scss */
@import 'uview-ui/theme.scss';
/* 这里暴露出一些样式变量, 使用计算属性混入全局,可以在全局的$scss拿到这些变量使用 */
:export {
mainColor: $uni-color;
bg: $uni-color-bg;
success: $uni-color-success;
warning: $uni-color-warning;
error: $uni-color-error;
}
\ No newline at end of file
/*
* @FilePath: /uni-app-template/src/utils.scss
* @Description: 工具mixin样式,样式中用 @include name(*) 来使用
*/
// 设置背景图片
@mixin bis($url) {
background: {
image: url($url);
repeat: no-repeat;
size: 100% 100%;
}
}
// fixed定位位置
@mixin fixed($position, $rem ) {
position: fixed;
@if $position == top {
top:$rem;
left: 0;
right: 0;
}
@else if $position == bottom {
bottom: $rem;
left: 0;
right: 0;
}
@else if $position == left {
top: 0;
bottom: 0;
left: $rem;
}
@else if $position == right {
top: 0;
bottom: 0;
right: $rem;
}
@else if $position == center {
top: 50%;
left: 50%;
transform: translate(-50% -50%);
}
}
// 绝对定位居中
@mixin center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
// 宽and高
@mixin wh ($width, $height) {
width: $width;
height: $height;
}
// 字体大小、行高、字体
@mixin font($size, $line-height, $family: 'Microsoft YaHei') {
font: #{$size}/#{$line-height} $family;
}
// flex垂直水平居中
@mixin flexCenter {
display: flex;
justify-content: center;
align-items: center;
}
// flex列水平居中
@mixin flexCenterCol {
display: flex;
flex-direction: column;
align-items: center;
}
\ No newline at end of file
const fs = require('fs')
let versionCode = '0.0.1'
// try {
// const execSync = require('child_process').execSync // 同步子进程
// const commit = execSync('git show -s --format=%d').toString().trim()
// versionCode = String(commit.match(/\d+(?:\.\d+)*\b/))
// } catch (e) {
// versionCode = '0.0.1'
// }
// console.log('读取git版本号:' + versionCode)
/**
* 环境publicPath配置
* prod----线上
* qa----测试
* @type {{qa: string, prod: string}}
*/
const paths = {
qa: 'https://测试环境域名地址/' + versionCode + '/build/h5',
prod: 'https://正式环境域名地址/' + versionCode + '/build/h5'
}
console.log('当前:' + process.env.VUE_APP_ENV)
const publicPath = process.env.VUE_APP_ENV === 'online' ? paths.prod : paths.qa
const data = {
name: 'uni-module',
appid: '',
description: '',
versionName: '0.0.1',
versionCode: '100',
transformPx: false,
networkTimeout: {
request: 30000
},
'app-plus': { /* 5+App特有相关 */
nvueCompiler: 'uni-app',
usingComponents: true,
splashscreen: {
alwaysShowBeforeRender: true,
waiting: true,
autoclose: true,
delay: 0
},
// "safearea": {
// "background": "#CCCCCC",
// "bottom": {
// "offset": "none | auto"
// }
// },
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.READ_CONTACTS"/>',
'<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.WRITE_CONTACTS"/>',
'<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>',
'<uses-permission android:name="android.permission.CAMERA"/>',
'<uses-permission android:name="android.permission.RECORD_AUDIO"/>',
'<uses-permission android:name="android.permission.GET_ACCOUNTS"/>',
'<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>',
'<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.CALL_PHONE"/>',
'<uses-permission android:name="android.permission.FLASHLIGHT"/>',
'<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>',
'<uses-feature android:name="android.hardware.camera"/>',
'<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>',
'<uses-permission android:name="android.permission.WRITE_SETTINGS"/>'
]
},
ios: { /* ios打包配置 */
},
sdkConfigs: { /* SDK配置 */
}
}
},
quickapp: { /* 快应用特有相关 */
},
'mp-weixin': { /* 微信小程序特有相关 */
appid: '',
setting: {
urlCheck: false
},
usingComponents: true
},
'mp-alipay': {
usingComponents: true
},
'mp-baidu': {
usingComponents: true
},
'mp-toutiao': {
usingComponents: true
},
'mp-qq': {
usingComponents: true
},
h5: {
/* "publicPath": "https://www.name.com/alioss/0.0.1" */
devServer: {
port: 8080,
disableHostCheck: true,
proxy: {
'/api': {
target: 'http://目标域名/', // 请求的目标域名
changeOrigin: true,
secure: false,
pathRewrite: { // 使用代理; 告诉他你这个连接要用代理
'^/api': '/'
}
}
}
},
publicPath: publicPath,
title: 'h5模板',
router: {
mode: 'history',
base: '/template/'
},
async: {
loading: 'Loading',
delay: 200,
timeout: 10000
},
optimization: {
treeShaking: {
enable: false
}
}
}
}
const env = process.env.VUE_APP_ENV === 'online' ? '正式环境' : '测试环境'
console.log(`uni-app: publicPath-${env}:${publicPath}`)
fs.writeFile(
`${__dirname}/../manifest.json`,
JSON.stringify(data),
(e) => (e ? console.error(e) : console.log('manifest.json 配置文件更新成功'))
)
const fs = require('fs')
const pages = require('../router/pages.ts')
const tabBar = require('./tabbarList')
const data = {
easycom: {
'^u-(.*)': 'uview-ui/components/u-$1/u-$1.vue'
// '^s-(.*)': '@netm/schbrain-view/components/s-$1/s-$1.vue'
},
pages,
globalStyle: {
maxWidth: 500,
rpxCalcMaxDeviceWidth: 375,
// #ifndef APP-PLUS
navigationStyle: 'custom',
// #endif
navigationBarTextStyle: 'black',
navigationBarBackgroundColor: '#FFFFFF',
backgroundColor: '#FFFFFF'
},
tabBar: {
color: '#808b9a',
selectedColor: '#4782e0',
borderStyle: 'white',
fontSize: '12px',
backgroundColor: '#f9fafc',
list: tabBar
}
}
fs.writeFile(
`${__dirname}/../pages.json`,
JSON.stringify(data),
(e) => (e ? console.error(e) : console.log('pages.json 配置文件更新成功'))
)
module.exports = [
{
pagePath: 'pages/home/index',
iconPath: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAAA3hJREFUWEftmN9OGkEUxs/MsPxZEJQgilBrtTfapjYxBm174Uv4lH0Jk9ZQNSZNY+2FtaUVEBTFgsCuuzPTrELaILhnZUlL4l4R9ptvfufbyZmdJTBkFxkyXngAHvQTe0h4+BKeWfOHTV2tGnUdSp/qbhfg6pIIpFaThMuJNiRnpKrnMocAIN0Cdw14bHYpojeVuVtghnLcKL87/u+AvYmVeQ9AoBOMcMHrJ4/3AN5yN6BdSXh0Zm30StdmewIZrNgobxb+G+Be6bYBCRW8nlc/A2yY/UL3nXBk+s2YYZhP7EAkI6VmLpO309nd7xvYLl23U+4LWI0tJUBREnaptO8LwS+00s73ftqcQ+AFL8TGfCEP9RseM8K4DGNh2zoToKlwee41TK0SGdEhu6E7KaA3cDQdDgQgLAzmUyj3CUp9IKXDAhHlECIpJ4YhuE4VoSnUU6/mMpVeRXQFCEwtPyKSjSOmG4iEU8+lnn9/0A36NnBqNaByOT8QEgemjIoftfz22a2NqPOPcGo1anI548B7IFJJ5Ukzv5WzBYZhS9iqyD/1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ZdHUlcwPuU8fbwBcotxhALuSV68vd8otBW6e75nDai/RFlN1WCxEO/zHO1lP3yIT1zHSdOeEHD2rL6HWs0FFW5oSbEHoVNs6i8JfAB8DXEzGD8Z8MNTKnZwT2zugmHDYBN6LcgNCJkp8FYNqRSeAn4HuEQYVoeJwPZ/oXagJ7ob4BPJFWKbN94Ux1mPtqJf8/4FJF12jM55nBGI1FePSoK++m9nAp1G0K7xt9M5Op8Hrgyo504HmSMMp2v1veSQVOBF6kb6I8nll8KcYiRK0drC+vkqoJmORCWM9+4LHLDa1wOhmZgSsjtWrXncOlUPcpPHu5oEU40erwQHmtXJypZurFUQq1T+GlzKGFQ/kOHqrVBv+tnQo81dM7UV6FzD4LHMi7PFIWSS6RussEfAk61JeBXWmGs9jv9z+hhz6JLWfNwPeH2pETfkVxLMZWjQr3Bq4MWPVm4KmUR4ElVnOLbsLh1uNd8pVFm2jMwN5pvRaHH6zGVp3jUDrSJb5VbweOtAfluNXYqlN4ISjIHqveDhxq8sAlD15Tl8LBoCBbraZm4FKkB1R52GrcgO4bvyA3W/V24FDPKtxmNW5AN1Edoc361mECXjegufYcF4wTIhn+54GrwPaGIg63H+2S5FNB6jIBX5rBkPbl5qI47I+V1wJXfi5GuqxF2B4ru1CuTiHZ6Bfk41TaRsZaKdTvFFbWMB0T4W1nKXsP3ynnpu+vG9C25a08pcpO4Mrp+wqjS5QV1td/U8JJkc0V7Z6MOQYsmyo6Drw3CXuOFSR1Pm84qe1tS9mh8DTQPuUxifCk78pblnQbujgScfFTvYYqRXFwyPORf5f8aC30j640oMs1R1GVK3A4GbjybSMe5oQbMc1SuwicZboN93DWMBb/BdcSfwESCyU8TPffywAAAABJRU5ErkJggg==',
text: '首页',
customIcon: false
}, {
pagePath: 'pages/about/index',
iconPath: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAABFlJREFUWEftmM9PG0cUx+fHrr3s2samJrbXDgISkcpSU1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5PYhyf61BEOLGlWI5JJlXDyVbh9ZHxpXttgwX6986WxAVDuPT68S4WX32A60lnwYCKwxlPFlvy/DXKLfagP1pVg1slGIHVszk6yjPNBoY4Rvjym22DP8AXGcDNp78u2CTed2N0ttwYPjReHK9DXg8TKMTGVj5jSYe9qc44zi8DDxqSwowYTxpsQFfAJbbxCIDw6vGk+eKul1D2tY8VWrqbWPMeLLCBvw9sNqmFBlY2GNc2fePbjKnaosBjBhPbrABnw7T9CwS8LDx5HYb8HGgw/b0iwQ8aDzptAG/B+z8jwD3GU8estXhF9HSKg4cYxdoPbpZ/rpYh3tRdhf/V92ahX3GldKWv+mIXr58BedtMRBeMq68Egw8qJspUOoFgoYIbyxr4fnx89zixErN0sxCrd78jPgFUi2tnJkap0eVp2wxiLHFdMiRQOBEXleK8kuYWmwNWJ/BhAqrMq6cCwQuTiaymhYhWV+8+rxVMZm4pCpVqh2RulT5uL6Q9XmLcF/alTmtadVTczKvgyhlnVJ9CBG8hRPGlXlLa3XgrK5B+CLMNh0BJYzpGMpdJi7D8xkHXqR0H9ek73MQaAoTqQE2047D9v7O8mORddHNNkjOlLk+4IoGAAVJ/EmMnZVlLNSiqzRK5HW1wGtoaQds9E1QAaFP4dmMKyO2pFgvA2cLbPtcb3QcHkdIoZQ1JbZAc+aF0yhp3+ftgXvku7D+kYBniyaG9FqZKr/QVqVdhDaF9plNj7OqjErFhbYu42RmnfwUFjLSN1yL6EL61JzhhYQK0r4EvNCZX3IZ/hsRxbk8ePIe5AAAAABJRU5ErkJggg==',
text: '关于',
customIcon: false
}, {
pagePath: 'pages/profile/index',
iconPath: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAABABJREFUWEftmP9P20YUwO/dXWziJMBKk5DARKdFFQ3bpAq1HUiT+NMrTQLRqZrUbmm1Uq2okMTJaIHEATu+e9OZBbLUTs5J0JQJ/2TZ79597t37dgdkxh6YMV5yB3zbO3Zn4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2XYTuUTYpfOMXgJeBh4FehqhF+ED1+VtEQaB24NsiHA2n5UHzVwiPKwhynC+W3ZtOa23lac5L1DnZ3EbUJgUlw5njfzUX9JBVYLr4CRhLSJxeDzf/NzGvZ92ynRfUV8UGI6DrPtf2e10y561JzV9bdqvBFcFKpwkccSkZu/J8VzelgNDqtbnJd4AHjOCFt65P8PWIRF3c1F3unAgZF6y1OwZyUUXP1OSojvfJWc86M9KDIryAhIaCqfUYt8DXQx7sFvGdHXF9SvBMHdKVvz4wPHl5ZWUxbqjGfEuKJuK2p4SnkR5BOEOXznlB4T3U8JrRzPyo/dTX0k7BU6g3BB6Ko2Ul1XouAJ+EmXgzwoHT/WI13MI/TyfvS7F066wL/KiCo0V8N7Kpk8kgfMuHNIlHCs8JBdqqXs/1hXWNP0oOwKLnPotzu+JVFU52SNU+APlV59DuDny6OuDrIrF41E9itg33VV7LfXMr4NulUZKDXTTW1UIO6J6EUapOeq2t1QzsHYj1TjdWLtV2O9k/6V262z1axvaKHeDnzRmGtrgJ4+v/vOGtlHt0ORBxmGtyes2bG4RuGHpDCf+DROgmTx08YlPAAAAAElFTkSuQmCC',
text: '我的',
customIcon: false
}
]
......@@ -16,7 +16,8 @@
"webpack-env",
"@dcloudio/types",
"miniprogram-api-typings",
"mini-types"
"mini-types",
"node"
],
"paths": {
"@/*": [
......
//vue.config.js
const TransformPages = require('uni-read-pages')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const {webpack} = new TransformPages()
module.exports = {
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
const tfPages = new TransformPages({
includes: ['path', 'name', 'aliasPath']
});
return JSON.stringify(tfPages.routes)
}, true )
})
]
},
configureWebpack: (config) => {
// 限制工作线程使用1024MB内存
// get a reference to the existing ForkTsCheckerWebpackPlugin
const existingForkTsChecker = config.plugins.filter(
p => p instanceof ForkTsCheckerWebpackPlugin,
)[0]
// remove the existing ForkTsCheckerWebpackPlugin
// so that we can replace it with our modified version
config.plugins = config.plugins.filter(
p => !(p instanceof ForkTsCheckerWebpackPlugin),
);
// copy the options from the original ForkTsCheckerWebpackPlugin
// instance and add the memoryLimit property
const forkTsCheckerOptions = existingForkTsChecker.options;
forkTsCheckerOptions.memoryLimit = 1024;
config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerOptions));
},
transpileDependencies: ['uview-ui']
}
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