'初始化'

This commit is contained in:
TOP糯米 2023-02-27 13:50:13 +08:00
commit 05ae78fa3a
50 changed files with 19015 additions and 0 deletions

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules/
unpackage/
dist/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.project
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

19
README.md Normal file
View File

@ -0,0 +1,19 @@
# project
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

76
babel.config.js Normal file
View File

@ -0,0 +1,76 @@
const plugins = []
if (process.env.UNI_OPT_TREESHAKINGNG) {
plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js'))
}
if (
(
process.env.UNI_PLATFORM === 'app-plus' &&
process.env.UNI_USING_V8
) ||
(
process.env.UNI_PLATFORM === 'h5' &&
process.env.UNI_H5_BROWSER === 'builtin'
)
) {
const path = require('path')
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
const input = normalizePath(process.env.UNI_INPUT_DIR)
try {
plugins.push([
require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
{
file (file) {
file = normalizePath(file)
if (file.indexOf(input) === 0) {
return path.relative(input, file)
}
return false
}
}
])
} catch (e) {}
}
process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
process.UNI_LIBRARIES.forEach(libraryName => {
plugins.push([
'import',
{
'libraryName': libraryName,
'customName': (name) => {
return `${libraryName}/lib/${name}/${name}`
}
}
])
})
const config = {
presets: [
[
'@vue/app',
{
modules: 'commonjs',
useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
}
]
],
plugins
}
const UNI_H5_TEST = '**/@dcloudio/uni-h5/dist/index.umd.min.js'
if (process.env.NODE_ENV === 'production') {
config.overrides = [{
test: UNI_H5_TEST,
compact: true,
}]
} else {
config.ignore = [UNI_H5_TEST]
}
module.exports = config

9
jsconfig.json Normal file
View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"types": [
"@dcloudio/types",
"miniprogram-api-typings",
"mini-types"
]
}
}

17035
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

112
package.json Normal file
View File

@ -0,0 +1,112 @@
{
"name": "project",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "npm run dev:h5",
"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: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",
"build:mp-jd": "cross-env NODE_ENV=production UNI_PLATFORM=mp-jd vue-cli-service uni-build",
"build:mp-kuaishou": "cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build",
"build:mp-lark": "cross-env NODE_ENV=production UNI_PLATFORM=mp-lark vue-cli-service uni-build",
"build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build",
"build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build",
"build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
"build:mp-xhs": "cross-env NODE_ENV=production UNI_PLATFORM=mp-xhs vue-cli-service uni-build",
"build:quickapp-native": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build",
"build:quickapp-webview": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build",
"build:quickapp-webview-huawei": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build",
"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: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",
"dev:mp-jd": "cross-env NODE_ENV=development UNI_PLATFORM=mp-jd vue-cli-service uni-build --watch",
"dev:mp-kuaishou": "cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build --watch",
"dev:mp-lark": "cross-env NODE_ENV=development UNI_PLATFORM=mp-lark vue-cli-service uni-build --watch",
"dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch",
"dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch",
"dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
"dev:mp-xhs": "cross-env NODE_ENV=development UNI_PLATFORM=mp-xhs vue-cli-service uni-build --watch",
"dev:quickapp-native": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch",
"dev:quickapp-webview": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch",
"dev:quickapp-webview-huawei": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build --watch",
"dev:quickapp-webview-union": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build --watch",
"info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js",
"serve:quickapp-native": "node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js",
"test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i",
"test:h5": "cross-env UNI_PLATFORM=h5 jest -i",
"test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i",
"test:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu jest -i",
"test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i"
},
"dependencies": {
"@dcloudio/uni-app-plus": "^2.0.1-36420220922003",
"@dcloudio/uni-h5": "^2.0.1-36420220922003",
"@dcloudio/uni-helper-json": "*",
"@dcloudio/uni-i18n": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-360": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-alipay": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-baidu": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-jd": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-kuaishou": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-lark": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-qq": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-toutiao": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-vue": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-weixin": "^2.0.1-36420220922003",
"@dcloudio/uni-mp-xhs": "^2.0.1-36420220922003",
"@dcloudio/uni-quickapp-native": "^2.0.1-36420220922003",
"@dcloudio/uni-quickapp-webview": "^2.0.1-36420220922003",
"@dcloudio/uni-stacktracey": "^2.0.1-36420220922003",
"@dcloudio/uni-stat": "^2.0.1-36420220922003",
"@vue/shared": "^3.0.0",
"core-js": "^3.6.5",
"flyio": "^0.6.2",
"less": "^4.1.3",
"less-loader": "^4.1.0",
"regenerator-runtime": "^0.12.1",
"vue": "^2.6.11",
"vuex": "^3.2.0"
},
"devDependencies": {
"@babel/runtime": "~7.17.9",
"@dcloudio/types": "^3.0.4",
"@dcloudio/uni-automator": "^2.0.1-36420220922003",
"@dcloudio/uni-cli-i18n": "^2.0.1-36420220922003",
"@dcloudio/uni-cli-shared": "^2.0.1-36420220922003",
"@dcloudio/uni-migration": "^2.0.1-36420220922003",
"@dcloudio/uni-template-compiler": "^2.0.1-36420220922003",
"@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.1-36420220922003",
"@dcloudio/vue-cli-plugin-uni": "^2.0.1-36420220922003",
"@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.1-36420220922003",
"@dcloudio/webpack-uni-mp-loader": "^2.0.1-36420220922003",
"@dcloudio/webpack-uni-pages-loader": "^2.0.1-36420220922003",
"@vue/cli-plugin-babel": "~4.5.19",
"@vue/cli-service": "~4.5.19",
"babel-plugin-import": "^1.11.0",
"cross-env": "^7.0.2",
"jest": "^25.4.0",
"mini-types": "*",
"miniprogram-api-typings": "*",
"postcss-comment": "^2.0.0",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"Android >= 4.4",
"ios >= 9"
],
"resolutions": {
"@babel/runtime": "~7.17.9"
},
"uni-app": {
"scripts": {}
}
}

22
postcss.config.js Normal file
View File

@ -0,0 +1,22 @@
const path = require('path')
module.exports = {
parser: require('postcss-comment'),
plugins: [
require('postcss-import')({
resolve (id, basedir, importOptions) {
if (id.startsWith('~@/')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
} else if (id.startsWith('@/')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
} else if (id.startsWith('/') && !id.startsWith('//')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
}
return id
}
}),
require('autoprefixer')({
remove: process.env.UNI_PLATFORM !== 'h5'
}),
require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
]
}

25
public/index.html Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<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>
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
</head>
<body>
<noscript>
<strong>Please enable JavaScript to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

10
sfc.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
import Vue from 'vue'
declare module "vue/types/options" {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentOptions<V extends Vue> extends Hooks {
/**
*
*/
mpType?: string;
}
}

4
shime-vue.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
declare module "*.vue" {
import Vue from 'vue'
export default Vue
}

60
src/App.vue Normal file
View File

@ -0,0 +1,60 @@
<script>
export default {
onLaunch: function () {
this.$store.dispatch("system/initConfig");
},
onShow: function () {},
onHide: function () {},
};
</script>
<style lang="less">
.limit-line {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
}
.clamp-1 {
-webkit-line-clamp: 1;
}
.clamp-2 {
-webkit-line-clamp: 2;
}
.clamp-3 {
-webkit-line-clamp: 3;
}
.clamp-4 {
-webkit-line-clamp: 4;
}
.clamp-5 {
-webkit-line-clamp: 5;
}
/* #ifdef H5 */
// tabBar
.uni-tabbar {
.uni-tabbar__bd {
height: @tabBarHeight !important;
.uni-tabbar__icon {
width: @tabBarIconWidth !important;
height: @tabBarIconHeight !important;
}
.uni-tabbar__label {
font-size: @tabBarFontSize !important;
}
}
}
/* #endif */
//
.placeholder-style-1 {
color: #bebebe;
}
.placeholder-style-2 {
color: #909090;
}
.placeholder-style-3 {
color: #c9c9c9;
}
.placeholder-style-4 {
color: #999999;
}
</style>

View File

@ -0,0 +1,187 @@
<template>
<view class="page-layout" :style="{ backgroundColor: backgroundColor, minHeight: minHeight }">
<view
class="page-header"
:class="[textColor]"
:style="{
height: header.height + 'px',
paddingTop: header.pt + 'px',
backgroundColor: headerBackgroundColor,
}"
>
<!-- 首页选择地址 -->
<block v-if="btnType === 'city'">
<view class="page-index-btn change-city" :style="{ height: header.height + 'px' }" @click="changeCity">
<text class="iconfont icon-31dingwei"></text>
<text class="city">成都市</text>
</view>
</block>
<!-- 正常返回按钮 -->
<block v-if="btnType === 'back'">
<view class="page-index-btn back" :style="{ height: header.height + 'px' }" @click="onClick">
<text class="iconfont icon-fanhui"></text>
</view>
</block>
<view class="page-title">
<text class="title-text" :style="{ lineHeight: header.height + 'px' }">{{ title }}</text>
</view>
</view>
<view class="page-body" :style="{ paddingTop: bodyPt + 'px' }">
<slot></slot>
</view>
<view class="page-footer"></view>
</view>
</template>
<script>
import { mapState } from "vuex";
export default {
name: "component-layout",
data() {
return {
header: {
height: 0,
pt: 0,
},
bodyPt: 0,
};
},
components: {},
props: {
minHeight: {
type: String,
default: "100vh",
},
backgroundColor: {
type: String,
default: "#F6F6F6",
},
headerBackgroundColor: {
type: String,
default: "#F6F6F6",
},
customBtn: {
type: Boolean,
default: false,
},
btnType: {
type: String,
default: "back",
},
title: {
type: String,
default: "",
},
textColor: {
type: String,
default: "dark",
},
},
computed: {
...mapState({
config: (state) => state.system.config,
}),
},
mounted() {
const { statusBarHeight, headerHeight } = this.config;
// #ifndef H5
this.header.pt = statusBarHeight;
this.header.height = headerHeight;
// #endif
// #ifdef H5
this.header.pt = 0;
this.header.height = this.$utils.rpx2px(headerHeight * 2);
// #endif
this.bodyPt = this.header.pt + this.header.height;
},
methods: {
onClick() {
if (this.customBtn) {
this.$emit("onClickBtn");
} else {
uni.navigateBack({ delta: 1 });
}
},
changeCity() {
console.log("修改城市");
},
},
};
</script>
<style scoped lang="less">
.page-layout {
position: relative;
max-width: 750px;
width: 100%;
margin: 0 auto;
/* #ifdef H5 */
// tabBar
// padding-bottom: calc(@tabBarHeight - 50px);
/* #endif */
}
.page-header.dark {
.page-title,
.page-index-btn {
color: #2d2d2d;
}
}
.page-header.light {
.page-title,
.page-index-btn {
color: #ffffff;
}
}
.page-header {
z-index: 20;
position: fixed;
top: 0;
left: 0;
right: 0;
max-width: 750px;
width: 750rpx;
text-align: center;
margin: 0 auto;
.page-title {
width: 100%;
height: auto;
line-height: 0;
.title-text {
font-size: 30rpx;
font-weight: bold;
}
}
.page-index-btn {
position: absolute;
bottom: 0;
left: 0;
width: 180rpx;
padding-left: 30rpx;
line-height: 0;
display: flex;
align-items: center;
justify-content: flex-start;
}
.page-index-btn.change-city {
font-size: 24rpx;
.icon-31dingwei {
font-size: 40rpx;
}
.city {
margin-left: 5rpx;
}
}
.page-index-btn.back {
.icon-fanhui {
font-size: 40rpx;
font-weight: bold;
}
}
}
.page-body {
width: 100%;
}
.page-footer {
width: 100%;
}
</style>

7
src/core/apis.js Normal file
View File

@ -0,0 +1,7 @@
const apis = {
member: {
info: "/member/info"
}
}
export default apis

6
src/core/config.js Normal file
View File

@ -0,0 +1,6 @@
const config = {
name: "熊熊安装",
root: "http://127.0.0.1/api.php"
}
export default config

70
src/core/libs/event.js Normal file
View File

@ -0,0 +1,70 @@
function MyPromise(resolve) {
this.resolveFunc = function () {
};
this.rejectFunc = function () {
};
resolve(this.resolve.bind(this), this.reject.bind(this));
}
MyPromise.prototype.resolve = function (val) {
setTimeout(() => {
this.resolveFunc(val);
}, 0);
};
MyPromise.prototype.reject = function (val) {
setTimeout(() => {
this.rejectFunc(val);
}, 0);
};
MyPromise.prototype.then = function (resolve, reject) {
this.resolveFunc = resolve;
this.rejectFunc = reject;
return this;
};
module.exports = {
_resolveStorage: {},
_addResolve(eventName, resolve, removeEventAfterTrigger) {
if (!this._resolveStorage[eventName]) {
this._resolveStorage[eventName] = [];
}
this._resolveStorage[eventName].push({
resolve: resolve,
removeEventAfterTrigger: removeEventAfterTrigger,
});
},
/**
* 定义触发器
* @param eventName
* @param removeEventAfterTrigger
* @returns {Promise<any>}
*/
on(eventName, removeEventAfterTrigger) {
return new MyPromise(fn => {
if (typeof removeEventAfterTrigger === 'undefined') {
removeEventAfterTrigger = true;
}
this._addResolve(eventName, fn, removeEventAfterTrigger);
});
},
/**
* 触发事件
* @param eventName
* @param e 传入数据可选
*/
trigger(eventName, e) {
if (!this._resolveStorage[eventName] || !this._resolveStorage[eventName].length) {
return;
}
let saveEvens = [];
for (let i in this._resolveStorage[eventName]) {
this._resolveStorage[eventName][i].resolve(e);
if (!this._resolveStorage[eventName][i].removeEventAfterTrigger) {
saveEvens.push(this._resolveStorage[eventName][i]);
}
}
this._resolveStorage[eventName] = saveEvens;
},
};

17
src/core/libs/request.js Normal file
View File

@ -0,0 +1,17 @@
const request = async (args) => {
const header = {
'X-Requested-With': 'XMLHttpRequest',
'content-type': 'application/x-www-form-urlencoded',
};
const [error, response] = await uni.request({
url: args.url,
method: args.method || 'get',
data: args.data,
header: header
});
return Promise.resolve(response);
};
export default request

166
src/core/libs/test.js Normal file
View File

@ -0,0 +1,166 @@
function email(value) {
return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value);
}
function mobile(value) {
return /^1[23456789]\d{9}$/.test(value)
}
function url(value) {
return /^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/
.test(value)
}
function date(value) {
return !/Invalid|NaN/.test(new Date(value.replace(/-/g, '/')).toString())
}
function dateISO(value) {
return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value)
}
function number(value) {
return /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value)
}
function digits(value) {
return /^\d+$/.test(value)
}
function idCard(value) {
return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
value)
}
function carNo(value) {
// 新能源车牌
const xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
// 旧车牌
const creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
if (value.length === 7) {
return creg.test(value);
} else if (value.length === 8) {
return xreg.test(value);
} else {
return false;
}
}
function amount(value) {
//金额,只允许保留两位小数
return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
}
function chinese(value) {
let reg = /^[\u4e00-\u9fa5]+$/gi;
return reg.test(value);
}
function letter(value) {
return /^[a-zA-Z]*$/.test(value);
}
function enOrNum(value) {
//英文或者数字
let reg = /^[0-9a-zA-Z]*$/g;
return reg.test(value);
}
function contains(value, param) {
return value.indexOf(param) >= 0
}
function range(value, param) {
return value >= param[0] && value <= param[1]
}
function rangeLength(value, param) {
return value.length >= param[0] && value.length <= param[1]
}
function landline(value) {
let reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
return reg.test(value);
}
function umobile(value){
let reg = /(^\d+$)|(^$)|(^([0-9]{3,4}-)?\d{7,8}$)|(^400[0-9]{7}$)|(^800[0-9]{7}$)|(^(400)-(\d{3})-(\d{4})(.)(\d{1,4})$)|(^(400)-(\d{3})-(\d{4}$))/;
return reg.test(value);
}
function empty(value) {
switch (typeof value) {
case 'undefined':
return true;
case 'string':
if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
break;
case 'boolean':
if (!value) return true;
break;
case 'number':
if (0 === value || isNaN(value)) return true;
break;
case 'object':
if (null === value || value.length === 0) return true;
for (var i in value) {
return false;
}
return true;
}
return false;
}
function jsonString(value) {
if (typeof value == 'string') {
try {
var obj = JSON.parse(value);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
}
return false;
}
function array(value) {
if (typeof Array.isArray === "function") {
return Array.isArray(value);
} else {
return Object.prototype.toString.call(value) === "[object Array]";
}
}
function object(value) {
return Object.prototype.toString.call(value) === '[object Object]';
}
export default {
email,
mobile,
url,
date,
dateISO,
number,
digits,
idCard,
carNo,
amount,
chinese,
letter,
enOrNum,
contains,
range,
rangeLength,
empty,
isEmpty: empty,
jsonString,
landline,
object,
array,
umobile,
}

9
src/core/models.js Normal file
View File

@ -0,0 +1,9 @@
import order from "@/core/models/order";
import user from "@/core/models/user";
import worker from "@/core/models/worker";
export default {
order,
user,
worker,
}

77
src/core/models/order.js Normal file
View File

@ -0,0 +1,77 @@
export default {
type: {
NORMAL: 1,
WORKER_PRICE: 2,
CUSTOM_PRICE: 3,
},
state: {
// 订单关闭
ORDER_CLOSE: -2,
// 未支付
NO_PAY: -1,
// 等待师傅报价
NO_PRICE: 0,
// 等待您选择师傅
NO_SELECT_WORKER: 1,
// 等待师傅上门
NO_SERVICE: 2,
// 完成订单
NO_APPRAISE: 3,
// 服务完结
ALL_FINISH: 4,
// 已申请退款
APPLY_REFUND: 6,
// 已退款
REFUNDED: 7,
// 无法退款
CAN_NOT_REFUND: 8,
},
getOrderStateTextColor(state) {
switch (state) {
case this.state.NO_PAY:
return '#000000';
case this.state.NO_PRICE:
return '#000000';
case this.state.NO_SELECT_WORKER:
return '#000000';
case this.state.NO_SERVICE:
return '#000000';
case this.state.NO_APPRAISE:
return '#000000';
case this.state.ALL_FINISH:
return '#000000';
case this.state.APPLY_REFUND:
return '#000000';
case this.state.REFUNDED:
return '#000000';
case this.state.CAN_NOT_REFUND:
return '#000000';
default:
return '#ff0000';
}
},
getOrderStateText(state) {
switch (state) {
case this.state.NO_PAY:
return '待支付';
case this.state.NO_PRICE:
return '等待师傅报价';
case this.state.NO_SELECT_WORKER:
return '等待您选择师傅';
case this.state.NO_SERVICE:
return '等待师傅上门';
case this.state.NO_APPRAISE:
return '完成订单';
case this.state.ALL_FINISH:
return '服务完结';
case this.state.APPLY_REFUND:
return '已提交申请';
case this.state.REFUNDED:
return '已退款';
case this.state.CAN_NOT_REFUND:
return '未通过';
default:
return '未知状态';
}
}
}

60
src/core/models/user.js Normal file
View File

@ -0,0 +1,60 @@
export default {
/**
* 获取平台用户信息
*/
platformInfo() {
return new Promise((resolve, reject) => {
// 获取用户信息
uni.getUserProfile({
provider: 'weixin',
desc: "获取用户信息",
success: function (info) {
console.log(info);
uni.login({
provider: "weixin",
success: (result) => {
resolve({
code: result.code,
userInfo: {
avatarUrl: info.userInfo.avatarUrl,
city: info.userInfo.city,
country: info.userInfo.country,
gender: info.userInfo.gender,
language: info.userInfo.language,
nickName: info.userInfo.nickName,
province: info.userInfo.province
}
// encryptedData: info.encryptedData,
// iv: info.iv,
});
},
fail: e => {
reject(e);
},
});
},
fail: e => {
reject(e);
},
});
});
},
register() {
this.platformInfo().then(platfromUser => {
console.log(platfromUser);
}).catch(e => { });
},
login() {
uni.navigateTo({
url: '/pages/auth/login'
});
},
getInfo() {
return new Promise((resolve, reject) => {
resolve({
id: 123,
name: '李四'
});
});
}
}

26
src/core/models/worker.js Normal file
View File

@ -0,0 +1,26 @@
export default {
type: {
NORMAL: 1,
SETTLE: 2,
},
getWorkerTypeTextColor(type) {
switch (type) {
case this.type.NORMAL:
return '#179C43';
case this.type.SETTLE:
return '#D9A019';
default:
return '#999999';
}
},
getWorkerTypeText(type) {
switch (type) {
case this.type.NORMAL:
return '普通师傅';
case this.type.SETTLE:
return '入驻师傅';
default:
return '未知';
}
}
}

203
src/core/utils.js Normal file
View File

@ -0,0 +1,203 @@
function time() {
return parseInt(Math.round(new Date() / 1000));
};
function datetime(format, timestamp) {
if (typeof format === 'undefined' || format === null) {
format = 'Y-m-d h:i:s';
}
if (typeof timestamp === 'undefined' || timestamp === null) {
timestamp = this.time();
}
const d = new Date();
d.setTime(timestamp * 1000);
const date = {
"Y": d.getFullYear(),
"m+": (d.getMonth() + 1) < 10 ? `0${d.getMonth() + 1}` : (d.getMonth() + 1),
"d+": d.getDate() < 10 ? `0${d.getDate()}` : d.getDate(),
"h+": d.getHours() < 10 ? `0${d.getHours()}` : d.getHours(),
"i+": d.getMinutes() < 10 ? `0${d.getMinutes()}` : d.getMinutes(),
"s+": d.getSeconds() < 10 ? `0${d.getSeconds()}` : d.getSeconds(),
"q+": Math.floor((d.getMonth() + 3) / 3),
"S+": d.getMilliseconds(),
};
for (let k in date) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length === 1 ?
date[k] : ("00" + date[k]).substr(("" + date[k]).length));
}
}
return format;
};
function timeDifference(start_at, end_at) {
let times = parseInt((end_at - start_at) / 1000);
let day = 0,
hour = 0,
minute = 0,
second = 0;
if (times > 0) {
day = Math.floor(times / (60 * 60 * 24));
hour = Math.floor(times / (60 * 60)) - (day * 24);
minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
} else {
return null;
}
return {
d: day,
h: hour < 10 ? ('0' + hour) : hour,
m: minute < 10 ? ('0' + minute) : minute,
s: second < 10 ? ('0' + second) : second,
};
};
function earthDistance(location1, location2) {
const lat1 = parseFloat(location1.lat);
const lng1 = parseFloat(location1.lng);
const lat2 = parseFloat(location2.lat);
const lng2 = parseFloat(location2.lng);
const EARTH_RADIUS = 6378137.0; //单位M
const PI = Math.PI;
function getRad(d) {
return d * PI / 180.0;
}
let f = getRad((lat1 + lat2) / 2);
let g = getRad((lat1 - lat2) / 2);
let l = getRad((lng1 - lng2) / 2);
let sg = Math.sin(g);
let sl = Math.sin(l);
let sf = Math.sin(f);
let s, c, w, r, d, h1, h2;
let a = EARTH_RADIUS;
let fl = 1 / 298.257;
sg = sg * sg;
sl = sl * sl;
sf = sf * sf;
s = sg * (1 - sl) + (1 - sf) * sl;
c = (1 - sg) * (1 - sl) + sf * sl;
w = Math.atan(Math.sqrt(s / c));
r = Math.sqrt(s * c) / w;
d = 2 * w * a;
h1 = (3 * r - 1) / 2 / c;
h2 = (3 * r + 1) / 2 / s;
return d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg));
};
function randomString(length) {
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
let result = '';
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
return result;
};
let timer, flag;
function throttle(func, wait = 500, immediate = true) {
if (immediate) {
if (!flag) {
flag = true;
typeof func === 'function' && func();
timer = setTimeout(() => {
flag = false;
}, wait);
}
} else {
if (!flag) {
flag = true
timer = setTimeout(() => {
flag = false
typeof func === 'function' && func();
}, wait);
}
}
}
let timeout = null;
function debounce(func, wait = 500, immediate = false) {
if (timeout !== null) clearTimeout(timeout);
if (immediate) {
let callNow = !timeout;
timeout = setTimeout(function () {
timeout = null;
}, wait);
if (callNow) typeof func === 'function' && func();
} else {
timeout = setTimeout(function () {
typeof func === 'function' && func();
}, wait);
}
}
function px2rpx(px) {
let { windowWidth } = uni.getStorageSync('system_config');
windowWidth = (windowWidth > 750) ? 750 : windowWidth;
return 750 * (px / windowWidth);
}
function rpx2px(rpx) {
let { windowWidth } = uni.getStorageSync('system_config');
windowWidth = (windowWidth > 750) ? 750 : windowWidth;
return (rpx / 750) * windowWidth;
}
function toPage(url, options) {
uni.navigateTo({
...{ url: url, },
...options
});
}
function toast(title, options) {
uni.showToast({
...{ title: title, icon: "none" },
...options
});
}
function formatNumber(num, limit) {
num = parseFloat(num);
limit = limit ? limit : 2;
return num > 0 ? num.toFixed(limit) : 0;
}
function serviceActions() {
uni.showActionSheet({
itemList: ['电话客服', '微信客服', '微信客服二'],
success(res) {
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
},
fail(res) {
console.log(res.errMsg);
}
});
}
export default {
time,
datetime,
timeDifference,
earthDistance,
randomString,
throttle,
debounce,
px2rpx,
rpx2px,
toPage,
toast,
formatNumber,
serviceActions,
}

31
src/main.js Normal file
View File

@ -0,0 +1,31 @@
import Vue from 'vue'
import App from './App'
import store from "./store/index"
import request from './core/libs/request'
import event from './core/libs/event'
import utils from './core/utils'
import config from './core/config'
import apis from './core/apis'
import models from './core/models'
import './static/iconfont/iconfont.css'
Vue.use({
install(Vue, options) {
Vue.prototype.$request = request
Vue.prototype.$event = event
Vue.prototype.$utils = utils
Vue.prototype.$config = config
Vue.prototype.$apis = apis
Vue.prototype.$models = models
}
})
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()

97
src/manifest.json Normal file
View File

@ -0,0 +1,97 @@
{
"name": "",
"appid": "",
"description": "",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
"app-plus": { /* 5+App */
"usingComponents": true,
"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.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": "wx239055764f21ba10",
"setting": {
"urlCheck": false,
"es6" : true,
"minified" : true,
"postcss" : true
},
"usingComponents": true,
"permission" : {
"scope.userLocation" : {
"desc" : "请求获取您的位置信息"
}
},
"requiredPrivateInfos": [
"chooseAddress",
"chooseLocation"
]
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"mp-qq" : {
"usingComponents" : true
},
"h5": {
"sdkConfigs": {
"maps" : {
"qqmap" : {
// https://lbs.qq.com/dev/console/key/manage
"key" : "PB3BZ-PB76J-HRSF2-KJ2QJ-CI2Z2-5TFTJ"
}
}
}
}
}

84
src/pages.json Normal file
View File

@ -0,0 +1,84 @@
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "熊熊安装队",
"enablePullDownRefresh": true
}
},
{
"path": "pages/auth/auth",
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/order/order",
"style": {
"navigationBarTitleText": "订单",
"enablePullDownRefresh": true
}
},
{
"path": "pages/message/message",
"style": {
"navigationBarTitleText": "消息",
"enablePullDownRefresh": true
}
},
{
"path": "pages/member/member",
"style": {
"navigationBarTitleText": "我的",
"enablePullDownRefresh": true
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "熊熊安装",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"navigationStyle": "custom"
// #ifdef H5
,
"rpxCalcMaxDeviceWidth": 750,
"rpxCalcBaseDeviceWidth": 750,
"rpxCalcIncludeWidth": 750,
"maxWidth": 750
// #endif
},
"tabBar": {
"color": "#B5B5B5",
"selectedColor": "#7286F1",
"borderStyle": "white",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/temp/tabbar/1.png",
"selectedIconPath": "static/temp/tabbar/1a.png",
"text": "首页"
},
{
"pagePath": "pages/order/order",
"iconPath": "static/temp/tabbar/2.png",
"selectedIconPath": "static/temp/tabbar/2a.png",
"text": "订单"
},
{
"pagePath": "pages/message/message",
"iconPath": "static/temp/tabbar/3.png",
"selectedIconPath": "static/temp/tabbar/3a.png",
"text": "消息"
},
{
"pagePath": "pages/member/member",
"iconPath": "static/temp/tabbar/5.png",
"selectedIconPath": "static/temp/tabbar/5a.png",
"text": "我的"
}
]
}
}

24
src/pages/auth/auth.vue Normal file
View File

@ -0,0 +1,24 @@
<template>
<app-layout title="登录"> </app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
export default {
name: "auth",
data() {
return {};
},
components: {
AppLayout,
},
onLoad() {},
onShow() {},
onReady() {},
onReachBottom() {},
onPullDownRefresh() {},
methods: {},
};
</script>
<style lang="less" scoped></style>

24
src/pages/index/index.vue Normal file
View File

@ -0,0 +1,24 @@
<template>
<app-layout title="首页" btnType="unset"></app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
export default {
name: "index",
data() {
return {};
},
components: {
AppLayout,
},
onLoad() {},
onShow() {},
onReady() {},
onReachBottom() {},
onPullDownRefresh() {},
methods: {},
};
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,24 @@
<template>
<app-layout title="我的" btnType="unset"></app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
export default {
name: "member",
data() {
return {};
},
components: {
AppLayout,
},
onLoad() {},
onShow() {},
onReady() {},
onReachBottom() {},
onPullDownRefresh() {},
methods: {},
};
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,24 @@
<template>
<app-layout title="消息" btnType="unset"></app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
export default {
name: "message",
data() {
return {};
},
components: {
AppLayout,
},
onLoad() {},
onShow() {},
onReady() {},
onReachBottom() {},
onPullDownRefresh() {},
methods: {},
};
</script>
<style lang="less" scoped></style>

24
src/pages/order/order.vue Normal file
View File

@ -0,0 +1,24 @@
<template>
<app-layout title="订单" btnType="unset"></app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
export default {
name: "order",
data() {
return {};
},
components: {
AppLayout,
},
onLoad() {},
onShow() {},
onReady() {},
onReachBottom() {},
onPullDownRefresh() {},
methods: {},
};
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,282 @@
@font-face {
font-family: "iconfont"; /* Project id 3642656 */
src: url('@/static/iconfont/iconfont.woff2?t=1675847767279') format('woff2'),
url('@/static/iconfont/iconfont.woff?t=1675847767279') format('woff'),
url('@/static/iconfont/iconfont.ttf?t=1675847767279') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-touxiang:before {
content: "\e60c";
}
.icon-guanbi:before {
content: "\e64d";
}
.icon-qingchu:before {
content: "\e633";
}
.icon-shezhi:before {
content: "\e6a9";
}
.icon-shuaxin:before {
content: "\e80b";
}
.icon-xiaoxizhongxin:before {
content: "\e8be";
}
.icon-dingdan:before {
content: "\e737";
}
.icon-guizeshezhi:before {
content: "\e6dc";
}
.icon-kefu1:before {
content: "\e644";
}
.icon-gonggao:before {
content: "\e647";
}
.icon-shenfenzhengzhengmian:before {
content: "\e68d";
}
.icon-icon-truck:before {
content: "\e60b";
}
.icon-cailiaogongcheng:before {
content: "\e61c";
}
.icon-kefufill:before {
content: "\e740";
}
.icon-shezhixitongshezhigongnengshezhishuxing:before {
content: "\e795";
}
.icon-tousu:before {
content: "\e632";
}
.icon-morentouxiang:before {
content: "\e630";
}
.icon-fl-ju:before {
content: "\e61f";
}
.icon-star:before {
content: "\e9a1";
}
.icon-jingdiananli_wujiaoxing_shoucanghou:before {
content: "\e64a";
}
.icon-fenxiang:before {
content: "\e8b0";
}
.icon-guanbishixin:before {
content: "\e8dc";
}
.icon-shuoming:before {
content: "\e63c";
}
.icon-huore:before {
content: "\1001d";
}
.icon-zy_peisong:before {
content: "\e60a";
}
.icon-shangchuantupian:before {
content: "\e628";
}
.icon-kefu:before {
content: "\e665";
}
.icon-bianji:before {
content: "\e609";
}
.icon-xiala:before {
content: "\e6b9";
}
.icon-24gf-telephone:before {
content: "\e96c";
}
.icon-shanchu:before {
content: "\e718";
}
.icon-kaiguan-kai:before {
content: "\e608";
}
.icon-kaiguan-guan:before {
content: "\e60f";
}
.icon-fenfabaoxian:before {
content: "\e607";
}
.icon-shijian:before {
content: "\e8c5";
}
.icon-dingwei:before {
content: "\e8c4";
}
.icon-xuanzeweixuanze:before {
content: "\e67b";
}
.icon-xuanzeyixuanze:before {
content: "\e67c";
}
.icon-tixing:before {
content: "\e64e";
}
.icon-fanhui:before {
content: "\e605";
}
.icon-jiahao-:before {
content: "\e606";
}
.icon-jianhao:before {
content: "\e617";
}
.icon-jiahao2fill:before {
content: "\e728";
}
.icon-31dingwei:before {
content: "\e604";
}
.icon-gouwuche:before {
content: "\e70b";
}
.icon-quanbudingdan:before {
content: "\e601";
}
.icon-31wode:before {
content: "\e602";
}
.icon-shouye:before {
content: "\e62e";
}
.icon-fenlei:before {
content: "\e62f";
}
.icon-qiye:before {
content: "\e637";
}
.icon-gongren:before {
content: "\e6db";
}
.icon-jinru:before {
content: "\e646";
}
.icon-weixiu:before {
content: "\e68c";
}
.icon-guandao1:before {
content: "\ec51";
}
.icon-jiazhengfuwu:before {
content: "\e661";
}
.icon-jiazheng:before {
content: "\e662";
}
.icon-jiayongdianqi:before {
content: "\e619";
}
.icon-dibandiaodinganzhuang:before {
content: "\e61a";
}
.icon-iconmoshiyugangreshuiqi:before {
content: "\e653";
}
.icon-jingshuiqianzhuang:before {
content: "\e61d";
}
.icon-menchuangmenchuangwujinanzhuang:before {
content: "\e61e";
}
.icon-shuidianmei:before {
content: "\e631";
}
.icon-anzhuangshigong:before {
content: "\e8d7";
}
.icon-guandao:before {
content: "\e603";
}
.icon-jiadiandianqi:before {
content: "\e60e";
}
.icon-classchuangjuanzhuang:before {
content: "\e7f8";
}
.icon-sousuo:before {
content: "\e600";
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

13
src/store/index.js Normal file
View File

@ -0,0 +1,13 @@
import Vue from 'vue'
import Vuex from 'vuex'
import user from "@/store/modules/user"
import system from "@/store/modules/system"
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
user,
system,
}
})

View File

@ -0,0 +1,6 @@
export default {
state: {},
getters: {},
mutations: {},
actions: {}
}

View File

@ -0,0 +1,34 @@
export default {
namespaced: true,
state: {
config: {},
},
getters: {
config(state) {
return state.config;
},
},
mutations: {
setConfig(state, data) {
state.config = { ...state.config, ...data };
},
},
actions: {
initConfig(context) {
let config = uni.getStorageSync('system_config');
if (!config) {
const { windowWidth, windowHeight, statusBarHeight, safeAreaInsets } = uni.getSystemInfoSync();
// #ifndef H5
const { height, top } = uni.getMenuButtonBoundingClientRect();
const headerHeight = height + ((top - statusBarHeight) * 2);
// #endif
// #ifdef H5
const headerHeight = 40; // 乘2再使用rpx2px转px使用
// #endif
config = { windowWidth, windowHeight, statusBarHeight, headerHeight, safeAreaInsets };
uni.setStorageSync('system_config', config);
}
context.commit('setConfig', config);
}
}
}

35
src/store/modules/user.js Normal file
View File

@ -0,0 +1,35 @@
import user from '@/core/models/user'
export default {
namespaced: true,
state: {
showLoginModal: false,
userInfo: null,
},
getters: {
showLoginModal(state) {
return state.showLoginModal;
},
userInfo(state) {
return state.userInfo;
},
},
mutations: {
showLoginModal(state, data) {
state.showLoginModal = data;
},
userInfo(state, data) {
state.userInfo = data;
}
},
actions: {
logout(context) {
context.commit('userInfo', null);
},
userInfo(context) {
user.getInfo().then(info => {
context.commit('userInfo', info);
});
}
}
}

76
src/uni.scss Normal file
View File

@ -0,0 +1,76 @@
/**
* 这里是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;

14
vue.config.js Normal file
View File

@ -0,0 +1,14 @@
module.exports = {
css: {
loaderOptions: {
less: {
globalVars: {
tabBarHeight: '100rpx',
tabBarIconWidth: '40rpx',
tabBarIconHeight: '40rpx',
tabBarFontSize: '22rpx'
}
}
}
}
}