Commit a1000433 authored by 李星剑's avatar 李星剑

hs-app init

parent 76deabac
Pipeline #55381 canceled with stages
.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*
# hs-app-project
## Project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn serve
```
### Compiles and minifies for production
```
yarn build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
### 相关包说明
```
uni-read-pages uni-simple-router [文档](https://hhyang.cn/v2/start/quickstart.html)
ui 框架用的 uView [文档](https://www.uviewui.com/guide/demo.html)]
关于sass this.getOptions 错误 降级版本 sass-loader
vconsole 手机端调试查看工具包 通过浏览器连接调试也行
```
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}`
}
}
])
})
module.exports = {
presets: [
[
'@vue/app',
{
modules: 'commonjs',
useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
}
]
],
plugins
}
/**
* 全局配置文件
*/
// #ifdef H5
export const BASE_URL = process.env.NODE_ENV === 'development' ? '/dev':'/prod-api/'
// #endif
// #ifdef APP-PLUS
export const BASE_URL = "http://octopus-dev.textile-saas.huansi.net/dev-api/"
// export const BASE_URL = "http://10.10.10.31/"
// #endif
export const API_URL = `${BASE_URL}` //后台接口域名
export const IMG_URL = `${BASE_URL}/gdep-system/virtualfile/downloadFile?fileCode=` //全局网络图片地址变量,css背景图片地址变量在uni.scss
{
"name": "hs-app-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-kuaishou": "cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou 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: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-kuaishou": "cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou 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: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.0-32920211029004",
"@dcloudio/uni-h5": "^2.0.0-32920211029004",
"@dcloudio/uni-helper-json": "*",
"@dcloudio/uni-i18n": "^2.0.0-32920211029004",
"@dcloudio/uni-mp-360": "^2.0.0-32920211029004",
"@dcloudio/uni-mp-alipay": "^2.0.0-32920211029004",
"@dcloudio/uni-mp-baidu": "^2.0.0-32920211029004",
"@dcloudio/uni-mp-kuaishou": "^2.0.0-32920211029004",
"@dcloudio/uni-mp-qq": "^2.0.0-32920211029004",
"@dcloudio/uni-mp-toutiao": "^2.0.0-32920211029004",
"@dcloudio/uni-mp-vue": "^2.0.0-32920211029004",
"@dcloudio/uni-mp-weixin": "^2.0.0-32920211029004",
"@dcloudio/uni-quickapp-native": "^2.0.0-32920211029004",
"@dcloudio/uni-quickapp-webview": "^2.0.0-32920211029004",
"@dcloudio/uni-stat": "^2.0.0-32920211029004",
"@vue/shared": "^3.0.0",
"core-js": "^3.6.5",
"flyio": "^0.6.2",
"jweixin-module": "^1.6.0",
"regenerator-runtime": "^0.12.1",
"sass": "^1.43.4",
"sass-loader": "^8.0.0",
"uni-read-pages": "^1.0.5",
"uview-ui": "^1.8.4",
"vconsole": "^3.9.5",
"vue": "^2.6.11",
"vuex": "^3.2.0"
},
"devDependencies": {
"@babel/runtime": "~7.12.0",
"@dcloudio/types": "*",
"@dcloudio/uni-automator": "^2.0.0-32920211029004",
"@dcloudio/uni-cli-i18n": "^2.0.0-32920211029004",
"@dcloudio/uni-cli-shared": "^2.0.0-32920211029004",
"@dcloudio/uni-migration": "^2.0.0-32920211029004",
"@dcloudio/uni-template-compiler": "^2.0.0-32920211029004",
"@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.0-32920211029004",
"@dcloudio/vue-cli-plugin-uni": "^2.0.0-32920211029004",
"@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.0-32920211029004",
"@dcloudio/webpack-uni-mp-loader": "^2.0.0-32920211029004",
"@dcloudio/webpack-uni-pages-loader": "^2.0.0-32920211029004",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"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",
"sass-resources-loader": "^2.2.4",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"Android >= 4.4",
"ios >= 9"
],
"uni-app": {
"scripts": {}
}
}
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')
]
}
<!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>
document.addEventListener('DOMContentLoaded', function() {
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
})
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>
\ No newline at end of file
<script>
export default {
data(){
return{
appVersion: ''
}
},
onLaunch: function() {
// // #ifdef APP-PLUS
// this.getAppVersion();
// // #endif
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
methods:{
//获取App版本号
getAppVersion() {
let that = this;
console.log(plus.runtime.appid)
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
that.appVersion = wgtinfo.version;
// that.update(this.appVersion)
});
},
//检查更新
checkUpdate: function(v) {
},
update(widgetInfo){
uni.request({
url: 'http://www.example.com/update/',
data: {
version: widgetInfo.version,
name: widgetInfo.name
},
success: (result) => {
let data = result.data;
if (data.update && data.wgtUrl) {
uni.downloadFile({
url: data.wgtUrl,
success: (downloadResult) => {
if (downloadResult.statusCode === 200) {
plus.runtime.install(downloadResult.tempFilePath, {
force: false
}, function() {
console.log('install success...');
plus.runtime.restart();
}, function(e) {
console.error('install fail...');
});
}
}
});
}
}
});
}
}
}
</script>
<style lang="scss">
@import "./static/style/index";
/*每个页面公共css */
</style>
{
"prompt" : "none"
}
<template>
<view>
<text>{{title}}</text>
<text>针织|180cm|100%</text>
</view>
</template>
<script>
export default {
name: "hs-select-item-text",
props:{
title:{
default: "",
type: String
},
item:{
default: () => {},
type: Object
}
}
}
</script>
<style scoped>
</style>
<template>
<view>
<view style="">
11
<hs-select-item-text :title="title" :item="item" class="float-left"></hs-select-item-text>
</view>
</view>
</template>
<script>
import HsSelectItemText from "../hs-select-item-text/hs-select-item-text";
export default {
name: "hs-select-item",
components: {HsSelectItemText},
props:{
title:{
type: String,
default: ""
},
backgroundImage:{
type: String,
default: ""
},
item:{
type: Object,
default: () => {}
}
}
}
</script>
<style scoped>
.float-left{
float: left;
}
</style>
<template>
<view>
<view class="title">
<view class="line"></view>
{{ title }}
<slot ></slot>
</view>
</view>
</template>
<script>
export default {
name: "hs-tip-title",
props:{
title:{
type: String,
default: ''
}
}
}
</script>
<style scoped lang="scss">
.title {
font-size: 28rpx;
font-weight: 600;
display: inline-block;
position: relative;
padding-left: 20rpx;
.line{
position: absolute;
width: 8rpx;
height: 28rpx;
background-color: #AF8D66;
border-radius: 4rpx;
left: 0;
top: 50%;
margin-top: -14rpx;
}
}
</style>
// 挂载变量
import {
API_URL,
IMG_URL
} from '../../env.js';
// import store from '@/config/store';
import http from '@/config/request';
import platform from '@/config/platform';
import tools from '@/config/utils/tools';
import mixins from '@/config/mixins';
// #ifdef H5
// uni方法重写, h5的粘贴板的设置,获取。图片视频的保存
import wxsdk from '@/config/wechat/sdk'
import VConsole from 'vconsole'
import '@/config/utils/sdk-h5.js'
// #endif
import wechat from '@/config/wechat/wechat';
const install = Vue => {
Vue.prototype.$API_URL = API_URL;
Vue.prototype.$IMG_URL = IMG_URL;
// 挂载请求
Vue.prototype.$http = http;
// 平台判断
Vue.prototype.$platform = platform;
// 挂载工具函数
Vue.prototype.$tools = tools;
// 挂载通用处理的生命周期
Vue.mixin(mixins);
// #ifdef H5
// 微信H5,sdk挂载
Vue.prototype.$wxsdk = wxsdk;
// 调试微信jssdk
process.env.NODE_ENV === 'development' && new VConsole()
// #endif
}
export async function init(options) {
// #ifdef H5
platform.entry();
// #endif
// #ifdef MP-WEIXIN
// 检测小程序更新(如果从朋友圈场景进入则无此API)
options.scene !== 1154 && wechat.checkMiniProgramUpdate();
// #endif
}
export default {
install
}
/**
* 处理一些公共逻辑
*
* onLoad
* @description 小程序下分享
* onShareAppMessage
* onShareTimeline
*/
import {
router
} from '@/config/router'
export default {
onLoad(options) {
let that = this;
// 后端拼接的具体page页面 直接进入 (如订阅消息场景下直接跳转)
// #ifdef MP
if (options?.scene) {
let scene = decodeURIComponent(options.scene);
let sceneObj = scene.split('=');
options[sceneObj[0]] = sceneObj[1];
}
// #endif
// 传个地址过来跳转的模式
if (options?.page) {
router.push({
path: decodeURIComponent(options.page)
})
}
// if (options?.custom_id) {
// router.push({
// path: '/pages/index/view',
// query: {
// id: options.custom_id
// }
// })
// }
},
// #ifdef MP-WEIXIN
onShareAppMessage(res) {
},
onShareTimeline(res) {
}
// #endif
}
/***
* 平台相关 函数
* get() 获取当前运行平台
* @return String platform
* set() 设置当前运行平台
* @param String platform
* @return String platform
* device() 检测当前运行机型
* @return String platform
* host() 获取前端真实主机
* @return String url
* entry() 处理wechat jssdk 签名网址(针对IOS微信浏览器做优化)
* @return String url
* */
// #ifdef H5
// 微信H5
import wxsdk from '@/config/wechat/sdk';
import {
router
} from '@/config/router';
// #endif
export default {
// 获取当前运行平台
get() {
let platform = '';
// #ifdef H5
wxsdk.isWechat() ? (platform = 'wxOfficialAccount') : (platform = 'H5');
// #endif
// #ifdef APP-PLUS
platform = 'App';
// #endif
// #ifdef MP-WEIXIN
platform = 'wxMiniProgram';
// #endif
// #ifdef MP-ALIPAY
platform = 'alipayMiniProgram';
// #endif
if (platform !== '') {
uni.setStorageSync('platform', platform);
} else {
uni.showToast({
title: '暂不支持该平台',
icon: 'none'
});
}
return platform;
},
set(platform) {
uni.setStorageSync('platform', platform);
return platform;
},
// 检测当前运行机型
device() {
return uni.getSystemInfoSync().platform;
},
// 获取前端真实主机
host() {
let host = location.origin;
let basePath = router.$route.options.base;
let mode = router.$route.options.mode;
host += basePath;
if (mode === 'hash') {
host += '#/';
}
return host;
},
// 处理wechat jssdk 签名网址(针对IOS微信浏览器做优化)
entry() {
let that = this;
var entryUrl = location.href;
if (this.device() === 'ios') {
if (typeof(location.entryUrl) !== 'undefined') {
entryUrl = location.entryUrl;
} else {
location.entryUrl = entryUrl;
}
}
return entryUrl;
},
}
export default {
auth:{
// 检查用户企业信息
checkSecretKey:{
url: "/gdep-auth/checkSecretKey",
method: "post"
},
// 检查用户企业信息
createTokenByApp:{
url: "/gdep-auth/createTokenByApp",
method: "post"
},
}
}
export default {
user:{
register:{
url: "gdep-enterprise/basics/basicsSaveAndroid",
method: "post"
},
checkMagStatus:{
url: "gdep-enterprise/basics/basicsWhetherOrNotPerfectAndroid",
method: "post"
},
getItemMsg:{
url: "gdep-enterprise/basics/basicsDetailAndroid",
method: "post"
}
}
}
/**
* 接口列表文件
*/
import user from './apiList/user.js'
import auth from './apiList/auth.js'
// import goods from './apiList/goods.js'
// import base from './apiList/base.js'
export default {
...user,
...auth
};
import Request from './request'
import apiList from './apis.js'
import {router} from '@/config/router/index.js'
import store from '@/config/store/index.js'
const shoproRequest = new Request();
export default function http(
url,
data = {},
toastBefore = '', // 请求前加载提示
toastAfter = true, // 请求后错误提示
) {
let api = getApiPath(url);
/* 请求之前拦截器 */
shoproRequest.interceptor.request((config, cancel) => {
let token = uni.getStorageSync('token');
if (api.auth && !token) {
uni.hideLoading()
throw (`暂未登录,已阻止此次API请求: '${api.url}'`);
}
token && shoproRequest.setConfig(config => {
config.header['blade-auth'] = "Bearer " + token
})
if (toastBefore !== '') {
uni.showLoading({
title: toastBefore,
mask: true
});
}
return config
});
/* 请求之后拦截器 */
shoproRequest.interceptor.response((response) => {
uni.hideLoading();
if (response.code === 0) {
if (toastAfter) {
uni.showToast({
title: response.msg || '请求出错,稍后重试',
icon: 'none',
duration: 1000,
mask: true
});
}
}
// token过期注销
if (response.code === 401) {
store.dispatch('logout');
router.push("/pages/user/login/login")
throw (`登录已过期或注销,已阻止此次API请求: '${api.url}'`);
}
return response
})
return shoproRequest.request({
url: api.url,
data,
method: api.method
})
}
// 组装接口路径
function getApiPath(url) {
let apiArray = url.split(".");
let api = apiList;
apiArray.forEach(v => {
api = api[v];
});
return api;
}
/**
* Request:请求封装
* @property {Object} config = 私有属性,默认值
* @property {Function} isUrl = 私有方法,url是否完整
* @property {Function} requestBefore = 私有方法,请求前
* @property {Function} requestAfter = 私有方法,请求后
*/
import {
API_URL
} from '../../../env'
import platform from '@/config/platform/index';
export default class Request {
constructor() {
// 默认配置
this.config = {
baseUrl: API_URL,
header: {
'content-type': 'application/json',
'app': "huansi",
'Authorization-Basic': 'Basic c3dvcmQ6c3dvcmRfc2VjcmV0',
'platform': platform.get()
},
url: '',
data: {},
params: {},
method: 'GET',
dataType: 'json',
// #ifndef MP-ALIPAY || APP-PLUS
responseType: 'text',
// #endif
custom: {},
// #ifdef APP-PLUS
sslVerify: false
// #endif
}
/* 拦截器 */
this.interceptor = {
request: cb => {
if (cb) {
this.requestBefore = cb
} else {
this.requestBefore = request => request
}
},
response: (cb) => {
if (cb) {
this.requestAfter = cb
} else {
this.requestAfter = response => response
}
}
}
}
/* 判断url是否完整 */
static isUrl(url) {
return /(http|https):\/\/([\w.]+\/?)\S*/.test(url)
}
static addQueryString(params) {
let paramsData = ''
Object.keys(params).forEach(key => {
paramsData += key + '=' + encodeURIComponent(params[key]) + '&'
})
return paramsData.substring(0, paramsData.length - 1)
}
/* 请求前 */
static requestBefore(config) {
return config
}
/* 请求后 */
static requestAfter(response) {
return response
}
/*设置全局配置*/
setConfig(func) {
return func(this.config)
}
/**
* @Function
* @param {Object} options - 请求配置项
* @prop {String} options.url - 请求路径
* @prop {Object} options.data - 请求参数
* @prop {Object} [options.responseType = config.responseType] [text|arraybuffer] - 响应的数据类型
* @prop {Object} [options.dataType = config.dataType] - 如果设为 json,会尝试对返回的数据做一次 JSON.parse
* @prop {Object} [options.header = config.header] - 请求header
* @prop {Object} [options.method = config.method] - 请求方法
* @returns {Promise<unknown>}
*/
async request(options = {}) {
options = {
...options,
...this.config,
...this.requestBefore(options)
}
return new Promise((resolve, reject) => {
let mergeUrl = Request.isUrl(options.url) ? options.url : (options.baseUrl + options.url)
if (JSON.stringify(options.params) !== '{}') {
let query = Request.addQueryString(options.params);
mergeUrl += mergeUrl.indexOf('?') === -1 ? `?${query}` : `&${query}`
}
options.url = mergeUrl
options.success = res => {
resolve(this.requestAfter(res.data))
}
options.fail = err => {
reject(this.requestAfter(err))
}
uni.request(options)
})
}
get(url, options = {}) {
return this.request({
url,
method: 'GET',
...options
})
}
post(url, data, options = {}) {
return this.request({
url,
data,
method: 'POST',
...options
})
}
}
// 路由
import {
RouterMount,
createRouter
} from './uni-simple-router.js'
import store from '@/config/store'
const router = createRouter({
platform: process.env.VUE_APP_PLATFORM,
applet: {
animationDuration: 0 //默认 300ms
},
routerErrorEach: ({
type,
msg
}) => {
switch (type) {
case 3: // APP退出应用
// #ifdef APP-PLUS
router.$lockStatus = false;
uni.showModal({
title: '提示',
content: '您确定要退出应用吗?',
success: function(res) {
if (res.confirm) {
plus.runtime.quit();
}
}
});
// #endif
break;
case 2:
case 0:
router.$lockStatus = false;
break;
default:
break;
}
},
// 通配符,非定义页面,跳转404
routes: [
...ROUTES,
{
path: '*',
redirect: (to) => {
return {
name: '404'
}
}
},
]
});
//全局路由前置守卫
router.beforeEach((to, from, next) => {
// 权限控制登录
if (to.meta && to.meta.auth && !store.getters.isLogin) {
next('/login');
} else {
next()
}
});
export {
router,
RouterMount
}
This diff is collapsed.
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
import user from './modules/user.js'
import base from './modules/base.js'
const store = new Vuex.Store({
modules: {
user,
base,
}
})
export default store
\ No newline at end of file
import http from '@/config/request';
/**
* 过滤字典值
* @param {Array} data -图片地址
* @param {String} type - 字典名
* @param {String} $type - 类型别名
* @param {String} key - 过滤用的名称
* @param {String} targetKey - 取数目标字段
*/
function filterDictionary(data,type,$type,key ="dictName" , targetKey = "dictList"){
let length = data.length ,res = [];
for (let i = 0; i < length; i++) {
let item = data[i];
if(item[key] === type){
res = item[targetKey];
break;
}
}
return res.map((item) => {
return {
...item,
...{
$type: $type
}
}
});
}
/**
* 过滤字典值
* @param {Array} trees -
*/
function tree2List(trees){
const newList = []
const queue = []
trees.forEach(tree => {
// 1. 对根节点的处理
const { children, ...meta } = tree // 去除子节点集合
newList.push(meta) // 把当前节点介入到 新的list里
if (children) { // 如果当前节点的 children 数组属性不为空,就把它加入到队列中
queue.push(children)
}
// 2. 对根节点以外的节点进行处理
// 遍历队列,可以看出 队列的操作 : 边遍历,边放入新的元素
while (queue.length) {
const item = queue.pop() // 从队列里推出一个元素
item && item.forEach(node => { // 如果子节点还有子节点,就继续往队列里存放
// 以下是重复性操作
const { children, ...meta } = node
newList.push(meta)
if (children) {
queue.push(children)
}
})
}
})
return newList
}
/**
* 统一字典 尺码 品类 数据格式
* @param {Array} data - 数据源
* @param {String} label - 显示文本的
* @param {String} value - 制
* @param {String} $type - 类型别名 品类初始化是没有过 filterDictionary 缺少 $type
*/
function filterDictionaryLabelAndKey(data,label = 'dictValue',value = 'dictKey',$type){
return data.map((item) =>{
return {
label: item[label],
value: item[value],
$type: item.$type || $type
}
})
}
function filterArray(data){
for (let i = 0; i < data.length; i++) {
let item = data[i];
if(item.children.length === 0){
delete item.children;
}else{
filterArray(item.children)
}
}
return data
}
const state = {
brandArray : [], // 品牌
saleSeasonArray : [], //销售季
positionArray : [], //用料部位
technologyTypeArray : [], //工艺类型
technologyPositionArray : [], //工艺节点
productionTypeArray : [], //生产类型
styleTypeArray : [], //开发类型
saleTypeArray : [], //销售类型
yearArray : [], //年份
seriesArray : [], //系列
waveArray : [], //波段
patternArray : [], //版型
basicCompany : [], //基本单位
materialNodeArray : [], //物料节点
sizeArray:[] , //尺码
categoryArray: [], // 品类
}
const getters = {
brandDictionary: ({brandArray}) => {
return filterDictionaryLabelAndKey(brandArray)
},
categoryDictionary: ({categoryArray}) => {
return filterDictionaryLabelAndKey(tree2List(categoryArray),'name','id','category')
},
saleSeasonDictionary: ({saleSeasonArray}) => {
return filterDictionaryLabelAndKey(saleSeasonArray)
},
positionDictionary: ({positionArray}) => {
return filterDictionaryLabelAndKey(positionArray)
},
technologyTypeDictionary: ({technologyTypeArray}) => {
return filterDictionaryLabelAndKey(technologyTypeArray)
},
technologyPositionDictionary: ({technologyPositionArray}) => {
return filterDictionaryLabelAndKey(technologyPositionArray)
},
productionTypeDictionary: ({productionTypeArray}) => {
return filterDictionaryLabelAndKey(productionTypeArray)
},
styleTypeDictionary: ({styleTypeArray}) => {
return filterDictionaryLabelAndKey(styleTypeArray)
},
saleTypeDictionary: ({saleTypeArray}) => {
return filterDictionaryLabelAndKey(saleTypeArray)
},
yearDictionary: ({yearArray}) => {
return filterDictionaryLabelAndKey(yearArray)
},
seriesDictionary:({seriesArray}) => {
return filterDictionaryLabelAndKey(seriesArray)
},
waveDictionary:({waveArray}) => {
return filterDictionaryLabelAndKey(waveArray)
},
patternDictionary:({patternArray}) => {
return filterDictionaryLabelAndKey(patternArray)
},
basicCompanyDictionary:({basicCompany}) => {
return filterDictionaryLabelAndKey(basicCompany)
},
sizeDictionary:({sizeArray}) => {
return filterDictionaryLabelAndKey(sizeArray,'describes','id','size')
},
materialNodeDictionary:({materialNodeArray}) => {
return filterDictionaryLabelAndKey(materialNodeArray)
},
}
const mutations = {
}
const actions = {
async getDictionary(){
return new Promise((resolve,reject) => {
// 品牌 销售季 用料部位 工艺类型 工艺节点
// 生产类型、开发类型、销售类型、年份、系列、波段、版型、单位
// 物料节点
let codeList = [
'brand','sale_season','material_position','technolog_type','technology_point',
'production_type','style_type','sale_type','year','series','wave','pattern','base_unit',
'material_node'
];
http('base.dictionary',{codeList}).then(res => {
let { code, data } = res;
if(code === 200){
state.brandArray = filterDictionary(data,"品牌","brand");
state.saleSeasonArray = filterDictionary(data,"销售季","sale_season");
state.positionArray = filterDictionary(data,"用料部位","material_position");
state.technologyTypeArray = filterDictionary(data,"工艺类型","technolog_type");
state.technologyPositionArray = filterDictionary(data,"工艺节点","technology_point");
state.productionTypeArray = filterDictionary(data,"生产类型","production_type");
state.styleTypeArray = filterDictionary(data,"开发类型","style_type");
state.saleTypeArray = filterDictionary(data,"销售类型","sale_type");
state.yearArray = filterDictionary(data,"年份","year");
state.seriesArray = filterDictionary(data,"系列","series");
state.waveArray = filterDictionary(data,"波段","wave");
state.patternArray = filterDictionary(data,"版型","pattern");
state.basicCompany = filterDictionary(data,"基本单位","base_unit");
state.materialNodeArray = filterDictionary(data,"物料节点","material_node");
resolve();
}
}).catch(e => {
reject(e)
})
})
},
async getCategoryList(){
return new Promise((resolve,reject) => {
// type(默认全部 CY-成衣 WL-物料 ML-面料 FL-辅料)
http('base.getCategoryList',{type: ''})
.then(res => {
let { code, data } = res;
if(code === 200){
state.categoryArray = filterArray(data);
resolve();
}
})
.catch(e => {
reject(e)
})
})
},
async getSizeList(){
return new Promise((resolve,reject) => {
http('base.sizeGroup',{queryName: ""})
.then(res => {
let { code, data } = res;
if(code === 200){
state.sizeArray = data.sizeGroupList;
resolve();
}
})
.catch(e => {
reject(e)
})
})
},
}
export default {
state,
mutations,
actions,
getters
}
import http from '@/config/request';
import {router} from '@/config/router';
import Store from '@/config/store/index';
const state = {
token: uni.getStorageSync("token") || "",
isLogin: uni.getStorageSync("isLogin") || false, // 是否登陆
userInfo: uni.getStorageSync("userInfo") || {}, // 用户信息
}
const getters = {
token: state => state.token,
isLogin: state => state.isLogin,
userInfo: state => state.userInfo,
}
const actions = {
async login({
commit
},data){
return new Promise((resolve, reject) => {
http('user.login',data,'加载中...').then(res => {
if(res){
commit("token", res.data.accessToken);
commit("isLogin", true);
commit("userInfo", res.data);
resolve(res);
}
}).catch(e => {
reject(e)
})
})
},
logout({commit}){
commit("token", "");
commit("isLogin", false);
commit("userInfo", {});
}
}
const mutations = {
token(state, payload) {
state.token = payload;
uni.setStorageSync("token", payload);
},
// 登录态
isLogin(state, data) {
state.isLogin = data;
uni.setStorageSync('isLogin', data);
},
// 用户信息
userInfo(state, data) {
state.userInfo = data;
uni.setStorageSync("userInfo", data);
}
}
export default {
state,
mutations,
actions,
getters
}
This diff is collapsed.
import {
API_URL
} from '../../../env'
import {
router
} from '@/config/router'
export default {
/**
* 跳转再封装,主要是为了兼容外链。
* @param {String} path - 跳转路径
* @param {isTabbar} isTabbar - 是否是底部导航
*/
routerTo(path, isTabbar) {
if (path) {
// 是否跳转外部链接
if (~path.indexOf('http') || ~path.indexOf('www')) {
// #ifdef H5
window.location = path;
// #endif
// #ifndef H5
router.push({
path: '/pages/public/webview',
query: {
'webviewPath': path
}
})
// #endif
return false
}
if (isTabbar) {
router.replaceAll(path)
} else {
path.includes('/pages/index') && !path.includes('/pages/index/view') ? router.replaceAll(path) : router
.push(path)
}
} else {
console.log(`%cerr:没有填写跳转路径`, 'color:green;background:yellow');
}
},
/**
* 图片处理-预览图片
* @param {Array} urls - 图片列表
* @param {Number} current - 首个预览下标
*/
previewImage(urls = [], current = 0) {
uni.previewImage({
urls: urls,
current: current,
indicator: 'default',
loop: true,
fail(err) {
console.log('previewImage出错', urls, err)
},
})
},
/**
* 数据分组
* @param {Array} oArr - 原数组列表
* @param {Number} length - 单个数组长度
* @return {Array} arr - 分组后的新数组
*/
splitData(oArr = [], length = 1) {
let arr = [];
let minArr = [];
oArr.forEach(c => {
if (minArr.length === length) {
minArr = [];
}
if (minArr.length === 0) {
arr.push(minArr);
}
minArr.push(c);
});
return arr;
},
/**
* 剩余时间格式化
* @param {Number} t - 剩余多少秒
* @return {Object} format - 格式后的天时分秒对象
*/
format(t) {
let format = {
d: '00',
h: '00',
m: '00',
s: '00'
};
if (t > 0) {
let d = Math.floor(t / 86400);
let h = Math.floor((t / 3600) % 24);
let m = Math.floor((t / 60) % 60);
let s = Math.floor(t % 60);
format.d = d < 10 ? '0' + d : d;
format.h = h < 10 ? '0' + h : h;
format.m = m < 10 ? '0' + m : m;
format.s = s < 10 ? '0' + s : s;
}
return format;
},
/**
* 打电话
* @param {String<Number>} phoneNumber - 数字字符串
*/
callPhone(phoneNumber = '') {
let num = phoneNumber.toString()
uni.makePhoneCall({
phoneNumber: num,
fail(err) {
console.log('makePhoneCall出错', err)
},
});
},
/**
* 微信头像
* @param {String} url -图片地址
*/
checkMPUrl(url) {
// #ifdef MP
if (
url.substring(0, 4) === 'http' &&
url.substring(0, 5) !== 'https' &&
url.substring(0, 12) !== 'http://store' &&
url.substring(0, 10) !== 'http://tmp' &&
url.substring(0, 10) !== 'http://usr'
) {
url = 'https' + url.substring(4, url.length);
}
// #endif
return url;
},
}
/**
* Validate v1.0.0 通用验证
*/
import test from 'uview-ui/libs/function/test.js'
export default {
// 手机号
mobile: [{
required: true,
message: '请输入手机号',
trigger: ['change', 'blur']
},
{
validator: (rule, value, callback) => {
return test.mobile(value);
},
message: '手机号码格式不正确',
trigger: ['change', 'blur']
}
],
// 账户
account: [{
required: true,
min: 5,
message: '请输入账号',
trigger: ['change', 'blur']
}],
// 短信验证码
code: [{
required: true,
min: 4,
message: '请输入验证码',
trigger: ['change', 'blur']
}],
// 密码
password: [{
required: true,
message: '请输入密码',
trigger: ['change', 'blur']
},
{
pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\S{5,12}$/,
message: '需同时含有字母和数字,长度在6-12之间',
trigger: ['change', 'blur']
}
],
// 真实姓名
realName: [{
required: true,
message: '请输入持卡人姓名',
trigger: ['change', 'blur']
},
{
validator: (rule, value, callback) => {
return test.chinese(value);
},
message: '请输入汉字',
trigger: ['change', 'blur']
}
],
// 开户行
bankName: [{
required: true,
message: '请输入开户行',
trigger: ['change', 'blur']
},
{
validator: (rule, value, callback) => {
return test.chinese(value);
},
message: '请输入汉字',
trigger: ['change', 'blur']
}
],
// 银行卡号
bankCode: [{
required: true,
message: '请输入银行卡号',
trigger: ['change', 'blur']
},
{
validator: (rule, value, callback) => {
return test.number(value);
},
message: '请输入正确账号',
trigger: ['change', 'blur']
}
],
// 支付宝账号
alipayAccount: [{
required: true,
message: '请输入支付账号',
trigger: ['change', 'blur']
},
{
validator: (rule, value, callback) => {
let isRange = test.rangeLength(value, [6, 30]);
let isAsterisk = test.contains(value, '*');
return isRange && !isAsterisk;
},
message: '请输入正确账号',
trigger: ['change', 'blur']
}
],
}
var jweixin = require("jweixin-module");
import http from "@/config/request/index";
import $platform from "@/config/platform";
export default {
//判断是否在微信中
isWechat() {
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/micromessenger/i) == "micromessenger") {
return true;
} else {
return false;
}
},
// 鉴权页面
initJssdk(callback) {
http("common.wxJssdk", {
uri: encodeURIComponent($platform.entry())
}).then(res => {
jweixin.config({
debug: res.data.debug,
appId: res.data.appId,
timestamp: res.data.timestamp,
nonceStr: res.data.nonceStr,
signature: res.data.signature,
jsApiList: res.data.jsApiList,
openTagList: res.data.openTagList
});
if (callback) {
callback(res.data);
}
});
},
//在需要定位页面调用
getLocation(callback) {
this.isWechat() && this.initJssdk(function(res) {
jweixin.ready(function() {
jweixin.getLocation({
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function(res) {
callback(res);
},
fail: function(res) {
console.log("%c微信H5sdk,getLocation失败:",
"color:green;background:yellow");
},
});
});
});
},
//获取微信收货地址
openAddress(callback) {
this.isWechat() && this.initJssdk(function(res) {
jweixin.ready(function() {
jweixin.openAddress({
success: function(res) {
callback(res);
},
fail: function(err) {
console.log("%c微信H5sdk,openAddress失败:",
"color:green;background:yellow");
},
complete: function(msg) {}
});
});
});
},
// 微信扫码
scanQRCode(callback) {
this.isWechat() && this.initJssdk(function(res) {
jweixin.ready(function() {
jweixin.scanQRCode({
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
success: function(res) {
callback(res);
},
fail: function(res) {
console.log("%c微信H5sdk,scanQRCode失败:",
"color:green;background:yellow");
},
});
});
});
},
// 微信分享
share(data, callback) {
this.isWechat() && this.initJssdk(function(res) {
jweixin.ready(function() {
var shareData = {
title: data.title,
desc: data.desc,
link: data.path,
imgUrl: data.image,
success: function(res) {
callback(res);
// 分享后的一些操作,比如分享统计等等
},
cancel: function(res) {}
};
jweixin.updateAppMessageShareData(shareData); //新版接口
//分享到朋友圈接口
// jweixin.updateTimelineShareData(shareData);
});
});
},
// 打开坐标位置
openLocation(data, callback) { //打开位置
this.isWechat() && this.initJssdk(function(res) {
jweixin.ready(function() {
jweixin.openLocation({ //根据传入的坐标打开地图
latitude: data.latitude,
longitude: data.longitude
});
});
});
},
// 选择图片
chooseImage(callback) { //选择图片
this.isWechat() && this.initJssdk(function(res) {
jweixin.ready(function() {
jweixin.chooseImage({
count: 1,
sizeType: ["compressed"],
sourceType: ["album"],
success: function(rs) {
callback(rs);
}
});
});
});
},
//微信支付
wxpay(data, callback) {
let that = this;
this.isWechat() && this.initJssdk(function(res) {
jweixin.ready(function() {
jweixin.chooseWXPay({
timestamp: data.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
nonceStr: data.nonceStr, // 支付签名随机串,不长于 32 位
package: data.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
signType: data.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
paySign: data.paySign, // 支付签名
success: function(res) {
callback(res);
},
fail: function(res) {
console.log("%c微信H5sdk,chooseWXPay失败:",
"color:green;background:yellow");
callback(res);
},
cancel: function(res) {
},
});
});
});
}
};
/**
* Wechat v1.1.0
* @Class Wechat
* @description shopro-wechat 1.1.0 wehcat第三方登录组件
* @Author lidongtony
* @Date 2020-05-20
* @Email lidongtony@qq.com
*/
import api from "@/config/request/index";
import $platform from "@/config/platform";
// import store from "@/app/store";
import {
API_URL
} from "../../../env";
export default {
eventMap(event) {
let map = "";
switch (event) {
case "login":
map = "登录中...";
break;
case "refresh":
map = "更新中...";
break;
case "bind":
map = "绑定中...";
break;
}
return map;
},
async login() {
let token = "";
// #ifdef MP-WEIXIN
token = await this.wxMiniProgramOauth("login");
return token;
// #endif
// #ifdef H5
this.wxOfficialAccountOauth("login");
// #endif
// #ifdef APP-PLUS
token = await this.wxOpenPlatformOauth("login");
return token;
// #endif
},
async refresh() {
let token = "";
// #ifdef MP-WEIXIN
token = await this.wxMiniProgramOauth("refresh");
return token;
// #endif
// #ifdef H5
this.wxOfficialAccountOauth("refresh");
// #endif
// #ifdef APP-PLUS
token = await this.wxOpenPlatformOauth("refresh");
return token;
// #endif
},
async bind() {
let token = "";
// #ifdef MP-WEIXIN
token = await this.wxMiniProgramOauth("bind");
return token;
// #endif
// #ifdef H5
this.wxOfficialAccountOauth("bind");
// #endif
// #ifdef APP-PLUS
token = await this.wxOpenPlatformOauth("bind");
return token;
// #endif
},
// #ifdef H5
// 微信公众号网页登录&刷新头像昵称&绑定
wxOfficialAccountOauth(event = "login") {
if ($platform.get() !== "wxOfficialAccount") {
uni.showToast({
title: "请在微信浏览器中打开",
icon: "none"
});
throw false;
}
let host = $platform.host();
let payloadObject = {
host: host,
event,
token: (event !== "login" && store.getters.isLogin) ? uni.getStorageSync("token") : ""
};
let payload = encodeURIComponent(JSON.stringify(payloadObject));
let redirect_uri = encodeURIComponent(`${API_URL}user/wxOfficialAccountOauth?payload=${payload}`);
let oauthUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + store.getters.initWechat.appid +
`&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=1`;
uni.setStorageSync("lastPage", window.location.href);
window.location = oauthUrl;
},
// 微信公众号网页静默登录:临时登录获取OpenId 不入库不绑定用户
wxOfficialAccountBaseLogin() {
let state = encodeURIComponent(window.location.href);
window.location = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + store.getters.initWechat.appid +
`&redirect_uri=${API_URL}user/wxOfficialAccountBaseLogin&response_type=code&scope=snsapi_base&state=${state}`;
throw "stop";
},
// #endif
// #ifdef APP-PLUS
// 微信开放平台登录
wxOpenPlatformOauth(event = "login") {
let that = this;
return new Promise((resolve, reject) => {
uni.login({
provider: "weixin",
success: function(loginRes) {
if (loginRes.errMsg === "login:ok") {
let authResult = loginRes.authResult;
api("user.wxOpenPlatformOauth", {
authResult,
event
}, that.eventMap(event)).then(res => {
if (res.code === 1) {
resolve(res.data.token);
} else {
resolve(false);
}
});
}
},
fail: function(res) {
uni.showToast({
title: "登录失败,请稍后再试"
});
resolve(false);
api("common.debug", {
info: res
});
},
complete: function(res) {}
});
});
},
// #endif
// #ifdef MP-WEIXIN
// 微信小程序静默登录
async getWxMiniProgramSessionKey(autoLogin = true) {
let sessionStatus = false;
let session_key = "";
return new Promise((resolve, reject) => {
uni.checkSession({
success(res) {
if (res.errMsg === "checkSession:ok") sessionStatus = true;
},
complete() {
if (uni.getStorageSync("session_key") && sessionStatus && !autoLogin) {
resolve(uni.getStorageSync("session_key"));
} else {
uni.login({
success: function(info) {
let code = info.code;
api("user.getWxMiniProgramSessionKey", {
code: code,
autoLogin: autoLogin
}).then(res => {
if (res.code === 1) {
uni.setStorageSync("session_key", res
.data.session_key);
if (autoLogin) {
if (res.data.token) {
resolve(res.data.token);
} else {
resolve(false);
}
}
resolve(res.data.session_key);
} else {
reject(res.msg);
}
});
}
});
}
}
});
});
},
// 微信小程序获取用户信息登录
wxMiniProgramOauth(event = "login") {
let that = this;
let session_key = uni.getStorageSync("session_key");
uni.showLoading({
title: that.eventMap(event)
});
return new Promise((resolve, reject) => {
uni.getUserProfile({ // 必须手动确认触发
desc: "完善会员资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: res => {
if (res.errMsg === "getUserProfile:ok") {
api("user.wxMiniProgramOauth", {
event,
session_key,
encryptedData: res.encryptedData,
iv: res.iv,
signature: res.signature,
}).then(res => {
console.log(res)
if (res.code === 1) {
resolve(res.data.token);
} else {
uni.removeStorageSync("session_key");
that.getWxMiniProgramSessionKey(false);
resolve(false);
}
});
}
},
complete: res => {
uni.hideLoading();
}
});
});
},
// 小程序更新
checkMiniProgramUpdate() {
if (uni.canIUse("getUpdateManager")) {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
if (res.hasUpdate) {
updateManager.onUpdateReady(function() {
uni.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function() {
// 新的版本下载失败
uni.showModal({
title: "已经有新版本了哟~",
content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~"
});
});
}
});
}
},
// #endif
};
import Vue from 'vue'
import App from './App'
Vue.config.productionTip = false
import {
router,
RouterMount
} from "@/config/router";
import store from "@/config/store";
import uView from "uview-ui";
import appConfig from "@/config/index";
async function bootstrap() {
App.mpType = "app";
//引入路由
Vue.use(router);
// 引入全局uView
Vue.use(uView);
// 加载app
Vue.use(appConfig);
const app = new Vue({
store,
...App
});
// #ifdef H5
RouterMount(app, router, "#app");
// #endif
// #ifndef H5
app.$mount();
// #endif
}
bootstrap();
{
"name" : "一料多款",
"appid" : "__UNI__41D6880",
"description" : "一料多款",
"versionName" : "1.1.0",
"versionCode" : "110",
"transformPx" : false,
"app-plus" : {
"compatible": {
"ignoreVersion": true
// true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
},
/* 5+App特有相关 */
"usingComponents" : true,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
"safearea" : {
//APP底部安全区域
"background" : "#fff",
"bottom" : {
"offset" : "auto"
}
},
"compilerVersion" : 3,
"nvueCompiler" : "uni-app",
"modules" : {
"Maps" : {},
"OAuth" : {},
"Payment" : {},
"Share" : {},
"VideoPlayer" : {},
"Geolocation" : {}
},
/* 模块配置 */
"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\"/>"
],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"autoSdkPermissions" : true
},
"ios" : {
"capabilities" : {
"entitlements" : {
"com.apple.developer.associated-domains" : [ "applinks:m.*****.top" ]
}
},
"privacyDescription" : {
"NSLocationAlwaysAndWhenInUseUsageDescription" : "需要同意获取您的位置信息才能展示附近信息",
"NSLocationAlwaysUsageDescription" : "需要同意获取您的位置信息才能展示附近信息",
"NSLocationWhenInUseUsageDescription" : "需要同意获取您的位置信息才能展示附近信息",
"NSPhotoLibraryAddUsageDescription" : "需要同意访问您的相册才能保存图片",
"NSPhotoLibraryUsageDescription" : "需要同意访问您的相册才能选取图片",
"NSCameraUsageDescription" : "需要同意访问您的摄像头才能拍摄照片",
"NSUserTrackingUsageDescription" : "请放心,开启权限不会获取您在其他站点的隐私信息,该权限仅用于标识设备并保障服务安全与提升浏览体验"
}
},
/* ios打包配置 */
"sdkConfigs" : {
"geolocation" : {}
}
},
"nvueLaunchMode" : ""
},
/* 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" : {
"template" : "../public/index.html",
"router" : {
"mode" : "hash",
"base" : ""
},
"optimization" : {
"treeShaking" : {
"enable" : true
}
},
"title" : "商城",
"devServer" : {
"https" : false,
"port" : "",
"proxy" : {
"/dev" : {
// "target" : "http://47.96.138.212:8321",
"target" : "http://10.10.10.31/",
"changeOrigin" : true,
"pathRewrite" : {
"^/dev" : ""
}
}
}
}
}
}
export default {
methods:{
// 切换用户 | 注册 | 选租户用户调用
// 核对用户信息状态
checkStatus() {
this.$http(
"user.checkMagStatus",
this.comData
).then(res =>{
let { code ,data} = res;
if(code === 200){
// 1-面料供应商, 2-品牌商, 3-设计机构, 4-检测机构
let { identityType} = data.userLastIdentity;
if(identityType){
this.assignType = identityType;
this.getItem();
this.filterStatus(data)
}
}
})
},
createToken(data){
// return
},
}
}
{
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
"^hs-(.*)": "@/components/hs-$1/hs-$1.vue"
},
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/user/tenanList/index",
"style": {
"navigationBarTitleText": "完善信息",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/user/register",
"style": {
"navigationBarTitleText": "完善信息",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/designCommissioned/listSelectToAdd",
"style": {
"navigationBarTitleText": "完善信息",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/designCommissioned/addItem",
"style": {
"navigationBarTitleText": "完善信息",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/designCommissioned/editItem",
"style": {
"navigationBarTitleText": "完善信息",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},{
"path": "pages/designCommissioned/splitItem",
"style": {
"navigationBarTitleText": "完善信息",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
}
This diff is collapsed.
<template>
</template>
<script>
export default {
name: "editItem"
}
</script>
<style scoped>
</style>
<!--新增委托-->
<template>
<view>
<!--新增委托navbar-->
<u-navbar title="新增委托"
:border-bottom="false"
:background="{backgroundColor: 'whitesmoke'}">
<template v-slot:right>
新增面料
</template>
</u-navbar>
<view class="title u-p-30">选择面料</view>
<view class="u-p-30 bg-fff">
<!--新增委托navbar-->
<u-search placeholder="请输入面料名称" v-model="keyword"
border-color="#e1e1e1" height="76"
bg-color="#fff" :show-action="false"></u-search>
</view>
<!-- 列表 确定-->
<view class="u-p-30">
<radio-group style="width: 100%">
<view v-for="(item, index) in list" :key="item.id" class="u-flex u-m-b-20">
<view>
<radio :value="item.value" :checked="index === selectedIndex" />
</view>
<view class="item"
style="background-image: url('https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png')"
:class="[index === selectedIndex ? 'active': '']">
<view class="item-text">
{{
item.title
}}
</view>
</view>
</view>
</radio-group>
</view>
<!-- 底部按钮 确定-->
<view class="footer" id="footer">
<view class="footer-btn">
<!-- /* 以下形式在微信小程序会无效,APP和H5有效 */-->
<u-button class="custom-style" shape="circle">
确定
</u-button>
</view>
</view>
</view>
</template>
<script>
import HsSelectItem from "../../components/hs-select-item/hs-select-item";
export default {
name: "listSelectToAdd",
components: {HsSelectItem},
data(){
return {
keyword: "",
selectedIndex: "",
selectedItem: {},
list: [
{
title: '加厚荷兰绒绒布布料',
id: 2
},
{
title: '加厚荷兰绒绒布布料加厚荷兰绒绒布布料',
id: 12
},
{
title: '加厚荷兰绒绒布布料',
id: 22
}
]
}
}
}
</script>
<style scoped lang="scss">
$h-color: #AF8D66;
$main-color: #fff;
.title{
color: $h-color;
background-color: whitesmoke;
}
.bg-fff{
background: $main-color;
}
.item{
border-radius: 8rpx;
border: 1px solid #bd4848;
height: 160rpx; width: 100%;
overflow: hidden;
background-size: contain;
.active{
border: 1px solid #000;
}
}
.custom-style{
color: #fff;
background: #000;
}
.footer {
position: fixed;
width: 100%;
bottom: 0;
z-index: 998;
background: #fff;
box-shadow: 0px -4rpx 6rpx 0px rgba(178,182,214,0.10);
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.footer-btn{
padding: 20rpx 30rpx;
}
}
</style>
<!--款式委托 拆弹-->
<template>
<view>
<!--navbar-->
<u-navbar title="拆单"
:border-bottom="false"
:background="{backgroundColor: 'whitesmoke'}">
</u-navbar>
<view class="u-p-30 bg-fff">
<hs-tip-title title="所选面料"></hs-tip-title>
<view ></view>
</view>
<view class="u-p-30 bg-fff">
<hs-tip-title title="风格款数要求"></hs-tip-title>
<view v-for="(item,index) in brandList" :key="index" class="u-p-t-16 u-p-b-30 u-border-bottom">
<view class="u-flex u-p-b-16">
<view class="u-line-1 u-flex-1">
{{item.name}}
</view>
<text class="del" @click="del">删除</text>
</view>
<u-number-box v-model="item.num"></u-number-box>
</view>
<u-button plain @click="addBrandList" type="primary">+添加风格</u-button>
</view>
<u-select
@confirm="brandSelectCallback"
safe-area-inset-bottom v-model="brandSelectShow" :list="brandSelectList" mode="mutil-column-auto"></u-select>
<view class="footer" id="footer">
<view class="footer-btn">
<view class="custom-style-round-circle custom-style-btn custom-style">
<view class="custom-style-left save">保存</view>
<view class="custom-style-right submit">
<view class="title">立即发布</view>
<view class="desc">将被拆分为<text class="color">2个委托</text></view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import HsTipTitle from "../../components/hs-tip-title/hs-tip-title";
export default {
name: "splitItem",
components: {HsTipTitle},
data(){
return{
brandList: [
{name: '男装|上装|25~35岁|时尚休闲', num: 12},
{name: '男装|上装|15~25岁|时尚休闲时尚休闲时', num: 12},
],
brandSelectShow: false,
timePickerShow: true,
brandSelectList: [
{
value: 1,
label: '男装',
children: [
{
value: 11,
label: '上装',
children:[
{
value: 21,
label: '18-25岁',
children:[
{
value: 31,
label: '时尚休闲',
},
{
value: 32,
label: '运动',
}
]
},
{
value: 22,
label: '25-35岁',
children:[
{
value: 33,
label: '时尚休闲',
},
{
value: 34,
label: '运动',
}
]
},
]
}
]
}
],
}
},
methods:{
addBrandList(){
this.brandSelectShow = true;
},
brandSelectCallback(e){
this.brandList.push({
num: 0,
name: e.map((item) => {
return item.label
}).join("|")
})
}
}
}
</script>
<style scoped lang="scss">
@mixin vue-flex($direction: row) {
/* #ifndef APP-NVUE */
display: flex;
flex-direction: $direction;
/* #endif */
}
.del{
color: #FA5353;
}
.bg-fff{
background: #fff;
}
.custom-style{
color: #fff; height: 88rpx; line-height: 88rpx;
@include vue-flex;
&-btn{
overflow: hidden;
}
&-round-circle{
border-radius: 100rpx;
}
/*background: #000;*/
.custom-style-left{ width: 240rpx; background: #d6d6d6; text-align: center }
.custom-style-right{ flex: 1; background: rgba(0,0,0,0.80);text-align: center}
.save{
font-size: 34rpx;
color: #000000;
}
.submit{
font-weight: 500;
font-size: 34rpx;
line-height: 100%;
.title{
margin: 8rpx 0;
}
.desc{
font-size: 20rpx;
.color{
color: #DDA973;
}
}
}
}
.footer {
position: fixed;
width: 100%;
bottom: 0;
z-index: 998;
background: #fff;
box-shadow: 0px -4rpx 6rpx 0px rgba(178,182,214,0.10);
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.footer-btn{
padding: 20rpx 60rpx;
}
}
</style>
<template>
<view>
首页
<button @click="changeUserType">切换用户</button>
</view>
</template>
<script>
export default {
name: "index",
methods:{
changeUserType(){
this.$Router.push({
path: '/pages/user/register?redirect=1'
})
},
}
}
</script>
<style scoped>
</style>
获取token => userId && enterpriseId =>
=>
<template>
<view class="step">
<view v-for="(item,index) in list" class="step-item" :key="index">
<!-- <view class="u-relative">-->
<!-- <view class="step-line" :class="[current === index ? 'active':'']"></view>-->
<!-- -->
<!-- </view>-->
<view class="step-line" v-if="index !== list.length - 1"
:class="[current >= index ? 'active':'']" :style="[lineStyle]"></view>
<view class="step-circle u-m-b-24" :class="[current >= index ? 'active':'']"></view>
<view class="step-item--title" :class="[current === index ? 'active-color':'']">{{item.title}}</view>
<view class="step-item--desc">{{item.desc}}</view>
</view>
</view>
</template>
<script>
// #ifdef APP-NVUE
const dom = uni.requireNativePlugin('dom')
// #endif
export default {
name: "steps",
props:{
current:{
type: Number,
default: 0
},
list:{
type: Array,
default: () => []
}
},
data(){
return {
size: {
height: 0,
width: 0
},
}
},
computed:{
lineStyle() {
const style = {}
style.width = this.size.width + 'px'
style.left = this.size.width / 2 + 'px'
return style
},
},
mounted() {
this.getStepsItemRect()
},
methods:{
uGetRect(selector, all) {
return new Promise((resolve) => {
uni.createSelectorQuery()
.in(this)[all ? 'selectAll' : 'select'](selector)
.boundingClientRect((rect) => {
if (all && Array.isArray(rect) && rect.length) {
resolve(rect)
}
if (!all && rect) {
resolve(rect)
}
})
.exec()
})
},
getStepsItemRect() {
this.uGetRect('.step-item').then(size => {
this.size = size
})
// #ifdef APP-NVUE
dom.getComponentRect(this.$refs['u-steps-item'], res => {
const {
size
} = res
this.size = size
})
// #endif
}
}
}
</script>
<style scoped lang="scss">
.active{
background: #1677FF !important;
}
.active-color{
color: #1677FF !important;
}
.step{
display: flex;
&-item{
flex: 1;
justify-content: center;
align-items: center;
text-align: center;
position: relative;
&--title{
font-size: 24rpx;
color: #333;
}
&--desc{
font-size: 24rpx;
color: #999;
}
}
&-line{
background: #e5e5e5; height: 2rpx;
position: absolute;
width: 100%;
top: 6rpx;
}
&-circle{
margin: 0 auto;
width: 16rpx; height: 16rpx;
background: #e5e5e5; border-radius: 50%;
}
}
</style>
<template>
<view>
<view v-for="(item,index) in list" @click="click(item,index)"
:key="index"
:class="activeIndex === index ? 'item--active' : ''"
class="item u-border u-p-60 u-m-b-40 border-radius-14">
<image
class="icon"
:src="activeIndex === index ? item.activeImgSrc : item.imgSrc" mode="fill"></image>
<view>
<view class="item-title">{{item.title}}</view>
<view class="item-desc">{{item.desc}}</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "UserSelect",
props:{
list:{
type: Array,
default: () => []
}
},
data(){
return {
activeIndex: null,
}
},
methods:{
click(row,index){
this.activeIndex = index;
this.$emit("change", index+1);
}
}
}
</script>
<style scoped lang="scss">
$active:#0663FF;
$mainColor: #333333;
$subColor: #666666;
.u-border:after{
border-radius: 28rpx;
}
.border-radius-14{
border-radius: 28rpx;
}
.item{
height: 200rpx;
display: flex;
justify-content: center;
align-items: center;
&-title{
font-size: 32rpx;
margin-bottom: 4rpx;
color: $mainColor;
}
&-desc{
font-size: 24rpx;
color: $subColor;
}
&--active{
border: 1px solid $active;
.item-title{
color: $active;
}
}
}
.icon{
width: 80rpx;
height: 80rpx;
margin-right: 96rpx;
}
.shadow{
box-shadow: 4rpx 28rpx 0px rgba(0, 0, 0, 0.10);
&.active{
box-shadow: none;
border: 1px solid $active;
}
}
.active{
color: $active;
}
</style>
This diff is collapsed.
<template>
<view>
<view v-for="item in mockData" @click="click(item)"
class="item"
:class="[item === active? 'u-border active' :'']">
用户名:{{item.userName}}
</view>
<!-- <button @click="getTenanList">getTenanList</button>-->
<button @click="next" :disabled="active === -1">下一步</button>
<!-- <view>encryptToken结果:{{token}}</view>-->
</view>
</template>
<script>
export default {
name: "index",
data(){
return {
back: '',
mockData: [
// {
// "id": 0,
// "userNo": "string",
// "userName": "string",
// "phone": "string",
// "tenantId": "string",
// "tenantCode": "string",
// "tenantName": "string",
// "tenantPlat": "string",
// "globalUserId": "string"
// }
],
active: -1,
token: "",
userData: {}
}
},
onLoad(){
// #ifdef APP-PLUS
uni.onNativeEventReceive((event,data)=>{
if(event === 'getTenantList'){
this.mockData = JSON.parse(data);
}else if(event === 'encryptToken'){
this.token = data;
uni.setStorageSync('encryptToken', data);
this.login()
}
})
this.getTenanList();
// #endif
},
methods:{
click(item){
this.active = item;
},
getTenanList(){
// 向宿主App发送事件
uni.sendNativeEvent('getTenantList', {
}, ret => {
// 返回的是 String 还是 JsonObject
// this.back = ret;
// this.mockData = JSON.parse(ret);
})
},
encryptToken(){
uni.sendNativeEvent('encryptToken',JSON.stringify(
{
globalId: this.active.globalUserId,
tenantId: this.active.tenantId,
subId: this.active.id,
}
), ret => {
// 返回的是 String 还是 JsonObject
// this.token = ret;
})
},
getToken(){
uni.setStorageSync('encryptToken',"")
},
login(){
// 核对
this.$http(
"auth.checkSecretKey",
uni.getStorageSync('encryptToken')
).then(res =>{
let {
code, data
} = res;
if(code === 200){
let {
userId, // 用户id
enterpriseId // 企业id
} = data;
this.userData = data;
uni.setStorageSync('tenantId', data.tenantId);
if(userId && enterpriseId){
this.createToken(data);
}else{
this.toRegister();
}
}
})
},
// 跳转到注册
toRegister(){
let {userId,enterpriseId,subId,tenantId} = this.userData;
this.$Router.push({
path: "/pages/user/register",
query:{
pcUserId: userId || "",
pcBasicsId: enterpriseId || "",
tenantUserId:subId,
tenantId,
}
})
},
// 跳转到首页
toIndexPage(){
this.$Router.push({
path: "/pages/index/index"
})
},
checkStatus(data){
this.$http(
"user.checkMagStatus",{
pcUserId: data.userId,
pcBasicsId: data.enterpriseId,
}).then(res =>{
let { code ,data} = res;
if(code === 200){
// 1-面料供应商, 2-品牌商, 3-设计机构, 4-检测机构
let { identityType} = data.userLastIdentity;
if(identityType){
this.assignType = identityType;
this.filterStatus(data)
}
}
})
},
filterStatus(data){
// 0-未完善 1-已完善
let{
isBrandOwner, // 我要选款
isDesignAgency, // 完善设计机构信息
isFabricSupplier, //完善面料供应商信息
isTestingFacility, // 完善检测机构信息
} = data;
let { assignType} = this;
switch (assignType){
case "1":
isFabricSupplier ? this.toIndexPage() : this.toRegister();
return ;
case "2":
isBrandOwner ? this.toIndexPage() : this.toRegister();
return ;
case "3":
isDesignAgency ? this.toIndexPage() : this.toRegister();
return ;
case "4":
isTestingFacility ? this.toIndexPage() : this.toRegister();
return ;
default:
this.toRegister();
return;
}
},
createToken(data){
this.$http("auth.createTokenByApp" ,{
...data,
...{
identityType: uni.getStorageSync("identityType")
}
}).then(res =>{
let {
code, data
} = res;
if(code === 200){
uni.setStorageSync('token', data.accessToken);
uni.setStorageSync('pcUserId', data.userId);
uni.setStorageSync('pcBasicsId', data.enterpriseId);
// uni.setStorageSync('tenantId', this.userData.tenantId);
this.checkStatus(data);
}
})
},
next(){
this.encryptToken();
// this.encryptToken();
// uni.setStorageSync('encryptToken',"MBN9Om00MUE9CEcnizCOwinwRe5NJNdZb4JyDT3/ze+vyyv5QNXVoo0Sb65Gptgdy9BZZFX36tEge08iDEzLHIYsLS95bnrcwUOh1tp9pMiJ0XYNBFnFcHFXP9AgeAmYe9EXW+akUkx4Zr7PGiG7eqhuabLlPisHhoQOBfFFTwQ=")
// this.$Router.push({
// path: "/pages/user/register"
// })
}
}
}
</script>
<style scoped>
.item{
padding: 30rpx;
}
.active{
color: #1E90FF;
}
</style>
This diff is collapsed.
@import 'uview-ui/index';
@import './colorui';
@import 'uview-ui/iconfont';
.font-OPPOSANS {
font-family: OPPOSANS;
}
page {
-webkit-overflow-scrolling: touch; // ios滑动不流畅
height: 100%;
background: #f6f6f6;
width: 100%;
font-size: 30rpx;
font-family: OPPOSANS;
word-break: break-all; //英文文本不换行
white-space: normal;
color: $u-main-color;
}
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
/**
* 这里是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:#ffffff;
$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:24rpx;
$uni-font-size-base:28rpx;
$uni-font-size-lg:32rpx;
/* 图片尺寸 */
$uni-img-size-sm:40rpx;
$uni-img-size-base:52rpx;
$uni-img-size-lg:80rpx;
/* Border Radius */
$uni-border-radius-sm: 4rpx;
$uni-border-radius-base: 6rpx;
$uni-border-radius-lg: 12rpx;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 10px;
$uni-spacing-row-base: 20rpx;
$uni-spacing-row-lg: 30rpx;
/* 垂直间距 */
$uni-spacing-col-sm: 8rpx;
$uni-spacing-col-base: 16rpx;
$uni-spacing-col-lg: 24rpx;
/* 透明度 */
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */
$uni-color-title: #2C405A; // 文章标题颜色
$uni-font-size-title:40rpx;
$uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:36rpx;
$uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:30rpx;
@import "uview-ui/theme";
{
"compilerOptions": {
"types": [
"@dcloudio/types",
"miniprogram-api-typings",
"mini-types"
]
}
}
const TransformPages = require('uni-read-pages')
const {
webpack
} = new TransformPages()
module.exports = {
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
const tfPages = new TransformPages({
includes: ['path', 'name', 'aliasPath', 'meta']
});
return JSON.stringify(tfPages.routes)
}, true)
})
]
},
// transpileDependencies: [ 'uni-request', 'uni-hold-tabbar']
}
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