diff --git a/.gitignore b/.gitignore index a503fa2..5ff51cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,17 @@ +###################################################################### +# Build Tools + +/unpackage/* +/node_modules/* + +###################################################################### +# Development Tools + +/.idea/* +/.vscode/* +/.hbuilderx/* + +package-lock.json +yarn.lock + /unpackage/ diff --git a/.idea/modules.xml b/.idea/modules.xml index 9c643aa..993a2b6 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/ruoyi-miniapp.iml b/.idea/ruoyi-miniapp.iml deleted file mode 100644 index 24643cc..0000000 --- a/.idea/ruoyi-miniapp.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.image/Java监控.jpg b/.image/Java监控.jpg new file mode 100644 index 0000000..6ad522a Binary files /dev/null and b/.image/Java监控.jpg differ diff --git a/.image/MySQL.jpg b/.image/MySQL.jpg new file mode 100644 index 0000000..64a1940 Binary files /dev/null and b/.image/MySQL.jpg differ diff --git a/.image/OA请假-列表.jpg b/.image/OA请假-列表.jpg new file mode 100644 index 0000000..787bb73 Binary files /dev/null and b/.image/OA请假-列表.jpg differ diff --git a/.image/OA请假-发起.jpg b/.image/OA请假-发起.jpg new file mode 100644 index 0000000..1a7342d Binary files /dev/null and b/.image/OA请假-发起.jpg differ diff --git a/.image/OA请假-详情.jpg b/.image/OA请假-详情.jpg new file mode 100644 index 0000000..a83e7c1 Binary files /dev/null and b/.image/OA请假-详情.jpg differ diff --git a/.image/Redis.jpg b/.image/Redis.jpg new file mode 100644 index 0000000..9569352 Binary files /dev/null and b/.image/Redis.jpg differ diff --git a/.image/admin-uniapp/01.png b/.image/admin-uniapp/01.png new file mode 100644 index 0000000..0f65d99 Binary files /dev/null and b/.image/admin-uniapp/01.png differ diff --git a/.image/admin-uniapp/02.png b/.image/admin-uniapp/02.png new file mode 100644 index 0000000..05ec781 Binary files /dev/null and b/.image/admin-uniapp/02.png differ diff --git a/.image/admin-uniapp/03.png b/.image/admin-uniapp/03.png new file mode 100644 index 0000000..f400c68 Binary files /dev/null and b/.image/admin-uniapp/03.png differ diff --git a/.image/admin-uniapp/04.png b/.image/admin-uniapp/04.png new file mode 100644 index 0000000..d5d5ea0 Binary files /dev/null and b/.image/admin-uniapp/04.png differ diff --git a/.image/admin-uniapp/05.png b/.image/admin-uniapp/05.png new file mode 100644 index 0000000..1de6d8a Binary files /dev/null and b/.image/admin-uniapp/05.png differ diff --git a/.image/admin-uniapp/06.png b/.image/admin-uniapp/06.png new file mode 100644 index 0000000..400ae90 Binary files /dev/null and b/.image/admin-uniapp/06.png differ diff --git a/.image/admin-uniapp/07.png b/.image/admin-uniapp/07.png new file mode 100644 index 0000000..2ed8c0f Binary files /dev/null and b/.image/admin-uniapp/07.png differ diff --git a/.image/admin-uniapp/08.png b/.image/admin-uniapp/08.png new file mode 100644 index 0000000..090e64a Binary files /dev/null and b/.image/admin-uniapp/08.png differ diff --git a/.image/admin-uniapp/09.png b/.image/admin-uniapp/09.png new file mode 100644 index 0000000..f2032c8 Binary files /dev/null and b/.image/admin-uniapp/09.png differ diff --git a/.image/common/mall-feature.png b/.image/common/mall-feature.png new file mode 100644 index 0000000..cca05c0 Binary files /dev/null and b/.image/common/mall-feature.png differ diff --git a/.image/common/mall-preview.png b/.image/common/mall-preview.png new file mode 100644 index 0000000..f939214 Binary files /dev/null and b/.image/common/mall-preview.png differ diff --git a/.image/common/project-vs.png b/.image/common/project-vs.png new file mode 100644 index 0000000..561e092 Binary files /dev/null and b/.image/common/project-vs.png differ diff --git a/.image/common/ruoyi-vue-pro-architecture.png b/.image/common/ruoyi-vue-pro-architecture.png new file mode 100644 index 0000000..7bd7d59 Binary files /dev/null and b/.image/common/ruoyi-vue-pro-architecture.png differ diff --git a/.image/common/ruoyi-vue-pro-biz.png b/.image/common/ruoyi-vue-pro-biz.png new file mode 100644 index 0000000..24a385a Binary files /dev/null and b/.image/common/ruoyi-vue-pro-biz.png differ diff --git a/.image/common/yudao-cloud-architecture.png b/.image/common/yudao-cloud-architecture.png new file mode 100644 index 0000000..59416d8 Binary files /dev/null and b/.image/common/yudao-cloud-architecture.png differ diff --git a/.image/common/yudao-roadmap.png b/.image/common/yudao-roadmap.png new file mode 100644 index 0000000..f4becc9 Binary files /dev/null and b/.image/common/yudao-roadmap.png differ diff --git a/.image/个人中心.jpg b/.image/个人中心.jpg new file mode 100644 index 0000000..ce57f6e Binary files /dev/null and b/.image/个人中心.jpg differ diff --git a/.image/代码生成.jpg b/.image/代码生成.jpg new file mode 100644 index 0000000..751603e Binary files /dev/null and b/.image/代码生成.jpg differ diff --git a/.image/令牌管理.jpg b/.image/令牌管理.jpg new file mode 100644 index 0000000..04abf4d Binary files /dev/null and b/.image/令牌管理.jpg differ diff --git a/.image/任务列表-审批.jpg b/.image/任务列表-审批.jpg new file mode 100644 index 0000000..cba312a Binary files /dev/null and b/.image/任务列表-审批.jpg differ diff --git a/.image/任务列表-已办.jpg b/.image/任务列表-已办.jpg new file mode 100644 index 0000000..7a8d0fb Binary files /dev/null and b/.image/任务列表-已办.jpg differ diff --git a/.image/任务列表-待办.jpg b/.image/任务列表-待办.jpg new file mode 100644 index 0000000..a90323f Binary files /dev/null and b/.image/任务列表-待办.jpg differ diff --git a/.image/任务日志.jpg b/.image/任务日志.jpg new file mode 100644 index 0000000..599e50a Binary files /dev/null and b/.image/任务日志.jpg differ diff --git a/.image/商户信息.jpg b/.image/商户信息.jpg new file mode 100644 index 0000000..483eace Binary files /dev/null and b/.image/商户信息.jpg differ diff --git a/.image/在线用户.jpg b/.image/在线用户.jpg new file mode 100644 index 0000000..b183009 Binary files /dev/null and b/.image/在线用户.jpg differ diff --git a/.image/大屏设计器-列表.jpg b/.image/大屏设计器-列表.jpg new file mode 100644 index 0000000..9a45c3b Binary files /dev/null and b/.image/大屏设计器-列表.jpg differ diff --git a/.image/大屏设计器-编辑.jpg b/.image/大屏设计器-编辑.jpg new file mode 100644 index 0000000..63298a0 Binary files /dev/null and b/.image/大屏设计器-编辑.jpg differ diff --git a/.image/大屏设计器-预览.jpg b/.image/大屏设计器-预览.jpg new file mode 100644 index 0000000..501d9ea Binary files /dev/null and b/.image/大屏设计器-预览.jpg differ diff --git a/.image/字典数据.jpg b/.image/字典数据.jpg new file mode 100644 index 0000000..8298c89 Binary files /dev/null and b/.image/字典数据.jpg differ diff --git a/.image/字典类型.jpg b/.image/字典类型.jpg new file mode 100644 index 0000000..6613392 Binary files /dev/null and b/.image/字典类型.jpg differ diff --git a/.image/定时任务.jpg b/.image/定时任务.jpg new file mode 100644 index 0000000..d5bbd85 Binary files /dev/null and b/.image/定时任务.jpg differ diff --git a/.image/岗位管理.jpg b/.image/岗位管理.jpg new file mode 100644 index 0000000..42b64d2 Binary files /dev/null and b/.image/岗位管理.jpg differ diff --git a/.image/应用信息-列表.jpg b/.image/应用信息-列表.jpg new file mode 100644 index 0000000..da419a2 Binary files /dev/null and b/.image/应用信息-列表.jpg differ diff --git a/.image/应用信息-编辑.jpg b/.image/应用信息-编辑.jpg new file mode 100644 index 0000000..913cfbc Binary files /dev/null and b/.image/应用信息-编辑.jpg differ diff --git a/.image/应用管理.jpg b/.image/应用管理.jpg new file mode 100644 index 0000000..6e7789f Binary files /dev/null and b/.image/应用管理.jpg differ diff --git a/.image/我的流程-列表.jpg b/.image/我的流程-列表.jpg new file mode 100644 index 0000000..223d17a Binary files /dev/null and b/.image/我的流程-列表.jpg differ diff --git a/.image/我的流程-发起.jpg b/.image/我的流程-发起.jpg new file mode 100644 index 0000000..7a83306 Binary files /dev/null and b/.image/我的流程-发起.jpg differ diff --git a/.image/我的流程-详情.jpg b/.image/我的流程-详情.jpg new file mode 100644 index 0000000..6a01541 Binary files /dev/null and b/.image/我的流程-详情.jpg differ diff --git a/.image/报表设计器-图形报表.jpg b/.image/报表设计器-图形报表.jpg new file mode 100644 index 0000000..681b318 Binary files /dev/null and b/.image/报表设计器-图形报表.jpg differ diff --git a/.image/报表设计器-打印设计.jpg b/.image/报表设计器-打印设计.jpg new file mode 100644 index 0000000..bb86da6 Binary files /dev/null and b/.image/报表设计器-打印设计.jpg differ diff --git a/.image/报表设计器-数据报表.jpg b/.image/报表设计器-数据报表.jpg new file mode 100644 index 0000000..9ca5b9b Binary files /dev/null and b/.image/报表设计器-数据报表.jpg differ diff --git a/.image/操作日志.jpg b/.image/操作日志.jpg new file mode 100644 index 0000000..4a0611a Binary files /dev/null and b/.image/操作日志.jpg differ diff --git a/.image/支付订单.jpg b/.image/支付订单.jpg new file mode 100644 index 0000000..0a56dd7 Binary files /dev/null and b/.image/支付订单.jpg differ diff --git a/.image/敏感词.jpg b/.image/敏感词.jpg new file mode 100644 index 0000000..92a5397 Binary files /dev/null and b/.image/敏感词.jpg differ diff --git a/.image/数据库文档.jpg b/.image/数据库文档.jpg new file mode 100644 index 0000000..a4339d9 Binary files /dev/null and b/.image/数据库文档.jpg differ diff --git a/.image/文件管理.jpg b/.image/文件管理.jpg new file mode 100644 index 0000000..054b19f Binary files /dev/null and b/.image/文件管理.jpg differ diff --git a/.image/文件管理2.jpg b/.image/文件管理2.jpg new file mode 100644 index 0000000..b12e5c3 Binary files /dev/null and b/.image/文件管理2.jpg differ diff --git a/.image/文件配置.jpg b/.image/文件配置.jpg new file mode 100644 index 0000000..e618049 Binary files /dev/null and b/.image/文件配置.jpg differ diff --git a/.image/日志中心.jpg b/.image/日志中心.jpg new file mode 100644 index 0000000..27c1c6c Binary files /dev/null and b/.image/日志中心.jpg differ diff --git a/.image/流程模型-列表.jpg b/.image/流程模型-列表.jpg new file mode 100644 index 0000000..ffdc584 Binary files /dev/null and b/.image/流程模型-列表.jpg differ diff --git a/.image/流程模型-定义.jpg b/.image/流程模型-定义.jpg new file mode 100644 index 0000000..18b316c Binary files /dev/null and b/.image/流程模型-定义.jpg differ diff --git a/.image/流程模型-设计.jpg b/.image/流程模型-设计.jpg new file mode 100644 index 0000000..9614969 Binary files /dev/null and b/.image/流程模型-设计.jpg differ diff --git a/.image/流程表单.jpg b/.image/流程表单.jpg new file mode 100644 index 0000000..60669c1 Binary files /dev/null and b/.image/流程表单.jpg differ diff --git a/.image/生成效果.jpg b/.image/生成效果.jpg new file mode 100644 index 0000000..98ff2cc Binary files /dev/null and b/.image/生成效果.jpg differ diff --git a/.image/用户分组.jpg b/.image/用户分组.jpg new file mode 100644 index 0000000..39af1cd Binary files /dev/null and b/.image/用户分组.jpg differ diff --git a/.image/用户管理.jpg b/.image/用户管理.jpg new file mode 100644 index 0000000..844604a Binary files /dev/null and b/.image/用户管理.jpg differ diff --git a/.image/登录.jpg b/.image/登录.jpg new file mode 100644 index 0000000..b782b98 Binary files /dev/null and b/.image/登录.jpg differ diff --git a/.image/登录日志.jpg b/.image/登录日志.jpg new file mode 100644 index 0000000..25662d9 Binary files /dev/null and b/.image/登录日志.jpg differ diff --git a/.image/短信日志.jpg b/.image/短信日志.jpg new file mode 100644 index 0000000..ada8e56 Binary files /dev/null and b/.image/短信日志.jpg differ diff --git a/.image/短信模板.jpg b/.image/短信模板.jpg new file mode 100644 index 0000000..09381cc Binary files /dev/null and b/.image/短信模板.jpg differ diff --git a/.image/短信渠道.jpg b/.image/短信渠道.jpg new file mode 100644 index 0000000..df3a5c3 Binary files /dev/null and b/.image/短信渠道.jpg differ diff --git a/.image/租户套餐.png b/.image/租户套餐.png new file mode 100644 index 0000000..9663167 Binary files /dev/null and b/.image/租户套餐.png differ diff --git a/.image/租户管理.jpg b/.image/租户管理.jpg new file mode 100644 index 0000000..647416a Binary files /dev/null and b/.image/租户管理.jpg differ diff --git a/.image/系统接口.jpg b/.image/系统接口.jpg new file mode 100644 index 0000000..6d39d42 Binary files /dev/null and b/.image/系统接口.jpg differ diff --git a/.image/菜单管理.jpg b/.image/菜单管理.jpg new file mode 100644 index 0000000..ad3b797 Binary files /dev/null and b/.image/菜单管理.jpg differ diff --git a/.image/表单构建.jpg b/.image/表单构建.jpg new file mode 100644 index 0000000..81f0374 Binary files /dev/null and b/.image/表单构建.jpg differ diff --git a/.image/角色管理.jpg b/.image/角色管理.jpg new file mode 100644 index 0000000..eed776e Binary files /dev/null and b/.image/角色管理.jpg differ diff --git a/.image/访问日志.jpg b/.image/访问日志.jpg new file mode 100644 index 0000000..ef301aa Binary files /dev/null and b/.image/访问日志.jpg differ diff --git a/.image/退款订单.jpg b/.image/退款订单.jpg new file mode 100644 index 0000000..2c6c6c9 Binary files /dev/null and b/.image/退款订单.jpg differ diff --git a/.image/通知公告.jpg b/.image/通知公告.jpg new file mode 100644 index 0000000..97bb42f Binary files /dev/null and b/.image/通知公告.jpg differ diff --git a/.image/部门管理.jpg b/.image/部门管理.jpg new file mode 100644 index 0000000..6eab233 Binary files /dev/null and b/.image/部门管理.jpg differ diff --git a/.image/配置管理.jpg b/.image/配置管理.jpg new file mode 100644 index 0000000..0abaec9 Binary files /dev/null and b/.image/配置管理.jpg differ diff --git a/.image/链路追踪.jpg b/.image/链路追踪.jpg new file mode 100644 index 0000000..12f7aa8 Binary files /dev/null and b/.image/链路追踪.jpg differ diff --git a/.image/错误日志.jpg b/.image/错误日志.jpg new file mode 100644 index 0000000..eb615ea Binary files /dev/null and b/.image/错误日志.jpg differ diff --git a/.image/错误码管理.jpg b/.image/错误码管理.jpg new file mode 100644 index 0000000..ea91dde Binary files /dev/null and b/.image/错误码管理.jpg differ diff --git a/.image/首页.jpg b/.image/首页.jpg new file mode 100644 index 0000000..10a7fde Binary files /dev/null and b/.image/首页.jpg differ diff --git a/App.vue b/App.vue index 38c7544..6a5b013 100644 --- a/App.vue +++ b/App.vue @@ -1,75 +1,37 @@ \ No newline at end of file +@import '@/uni_modules/windi-css-uniapp/index.scss'; +@import '@/static/scss/index.scss'; + diff --git a/README.md b/README.md new file mode 100644 index 0000000..554d52b --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +### 初始化 +npm install \ No newline at end of file diff --git a/api/login.js b/api/login.js new file mode 100644 index 0000000..f4e424a --- /dev/null +++ b/api/login.js @@ -0,0 +1,29 @@ +import request from '@/utils/request' + +// 登录方法 +export function login(data) { + return request({ + url: '/system/auth/app_login', + headers: { + isToken: false + }, + 'method': 'POST', + 'data': data + }) +} + +// 获取用户详细信息 +export function getInfo() { + return request({ + url: '/system/auth/get-permission-info', + 'method': 'GET' + }) +} + +// 退出方法 +export function logout() { + return request({ + url: '/system/auth/logout', + 'method': 'POST' + }) +} \ No newline at end of file diff --git a/api/system/user.js b/api/system/user.js new file mode 100644 index 0000000..59e9304 --- /dev/null +++ b/api/system/user.js @@ -0,0 +1,42 @@ +import upload from '@/utils/upload' +import request from '@/utils/request' + +// 用户密码重置 +export function updateUserPwd(oldPassword, newPassword) { + const data = { + oldPassword, + newPassword + } + return request({ + url: '/system/user/profile/update-password', + method: 'PUT', + params: data + }) +} + +// 查询用户个人信息 +export function getUserProfile() { + return request({ + url: '/system/user/profile/get', + method: 'GET' + }) +} + +// 修改用户个人信息 +export function updateUserProfile(data) { + return request({ + url: '/system/user/profile/update', + method: 'PUT', + data: data + }) +} + +// 用户头像上传 +export function uploadAvatar(data) { + return upload({ + url: '/system/user/profile/update-avatar', + method: 'PUT', + name: data.name, + filePath: data.filePath + }) +} diff --git a/components/cs-page/index.vue b/components/cs-page/index.vue new file mode 100644 index 0000000..046f18c --- /dev/null +++ b/components/cs-page/index.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/config.js b/config.js new file mode 100644 index 0000000..4d4f40b --- /dev/null +++ b/config.js @@ -0,0 +1,20 @@ +// 应用全局配置 +module.exports = { + // baseUrl: 'http://api-dashboard.yudao.iocoder.cn', + baseUrl: 'http://188.188.5.98:48080', + baseApi: '/admin-api', + // 应用信息 + appInfo: { + // 应用名称 + name: "nature-secure-miniapp", + // 应用版本 + version: "1.0.0", + // 应用logo + logo: "/static/logo.png", + // 官方网站 + site_url: "", + // 政策协议 + agreements: [ + ] + } +} \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index c3ff205..0000000 --- a/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - -
- - - diff --git a/main.js b/main.js index 54dd424..69cb804 100644 --- a/main.js +++ b/main.js @@ -1,49 +1,24 @@ -import App from './App' - -// #ifndef VUE3 import Vue from 'vue' +import App from './App' +import store from './store' // store +import plugins from './plugins' // plugins +import './permission' // permission // 引入uView import uView from '@/uni_modules/uview-ui' -Vue.use(uView) -// 全局配置根域名 -uni.$u.http.setConfig((config) => { - /* config 为默认全局配置*/ - config.baseURL = `http://192.168.2.101:8080/api/app`; - return config -}) - -// Vuex -import store from '@/store'; -import vuexStore from '@/store/$u.mixin.js'; -Vue.mixin(vuexStore); +// 挂载全局对象 +Vue.use(plugins).use(uView) -import './uni.promisify.adaptor' Vue.config.productionTip = false + +// 挂载vuex +Vue.prototype.$store = store + App.mpType = 'app' const app = new Vue({ - store, ...App }) -app.$mount() -// #endif - - -// #ifdef VUE3 -import { - createSSRApp -} from 'vue' - -// 引入uView主JS库 -import uView from '@/uni_modules/uview-ui' -Vue.use(uView) -export function createApp() { - const app = createSSRApp(App) - return { - app - } -} -// #endif \ No newline at end of file +app.$mount() \ No newline at end of file diff --git a/manifest.json b/manifest.json index 0e44a65..b875a5e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,72 +1,69 @@ { - "name" : "智慧环保", - "appid" : "__UNI__20C9AD1", - "description" : "智慧环保", - "versionName" : "1.0.0", - "versionCode" : "100", - "transformPx" : false, - /* 5+App特有相关 */ - "app-plus" : { - "usingComponents" : true, - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 - }, - /* 模块配置 */ - "modules" : {}, - /* 应用发布信息 */ - "distribute" : { - /* android打包配置 */ - "android" : { - "permissions" : [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - /* ios打包配置 */ - "ios" : {}, - /* SDK配置 */ - "sdkConfigs" : {} - } - }, - /* 快应用特有相关 */ - "quickapp" : {}, - /* 小程序特有相关 */ - "mp-weixin" : { - "appid" : "wx6a07542e99f7fc98", - "setting" : { - "urlCheck" : false - }, - "usingComponents" : true - }, - "mp-alipay" : { - "usingComponents" : true - }, - "mp-baidu" : { - "usingComponents" : true - }, - "mp-toutiao" : { - "usingComponents" : true - }, - "uniStatistics" : { - "enable" : false - }, - "vueVersion" : "2" -} + "name": "智慧生态", + "appid": "__UNI__25A9D80", + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueCompiler": "uni-app", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "modules": {}, + "distribute": { + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "ios": {}, + "sdkConfigs": {} + } + }, + "quickapp": {}, + "mp-weixin": { + "appid": "wx6a07542e99f7fc98", + "setting": { + "urlCheck": false, + "es6": true, + "minified": true, + "postcss": true + }, + "optimization": { + "subPackages": true + }, + "usingComponents": true + }, + "vueVersion": "2", + "h5": { + "template": "static/index.html", + "devServer": { + "port": 9090, + "https": false + }, + "title": "Yudao-App", + "router": { + "mode": "hash", + "base": "./" + } + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..9bb28a9 --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "dependencies": { + "crypto-js": "^4.0.0" + }, + "devDependencies": { + "sass": "^1.83.4", + "sass-loader": "^16.0.4" + } +} diff --git a/pages.json b/pages.json index aa17bce..9156225 100644 --- a/pages.json +++ b/pages.json @@ -1,134 +1,73 @@ { - "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - { - "path": "pages/index/index", - "style": { - "navigationBarTitleText": "智慧环保" - } - }, - { - "path": "pages/index/off_reg", - "style": { - "navigationBarTitleText": "部门申请" - } - }, - { - "path": "pages/index/ent_reg", - "style": { - "navigationBarTitleText": "企业注册" - } - }, - { - "path": "pages/task/index", - "style": { - "navigationBarTitleText": "执法任务" - } - }, - { - "path": "pages/task/list", + + "pages": [{ + "path": "pages/index", "style": { - "navigationBarTitleText": "任务列表" + "navigationBarTitleText": "首页" } - }, - { - "path": "pages/task/item", + }, { + "path": "pages/login", "style": { - "navigationBarTitleText": "任务详情" + "navigationBarTitleText": "登录" } }, { - "path": "pages/ent/index", + "path": "pages/enterprise", "style": { - "navigationBarTitleText": "环保企业" + "navigationBarTitleText": "企业" } }, { - "path": "pages/ent/info", + "path": "pages/chat", "style": { - "navigationBarTitleText": "企业详情" + "navigationBarTitleText": "聊天" } }, { - "path": "pages/public/sug", + "path": "pages/task", "style": { - "navigationBarTitleText": "投诉建议" + "navigationBarTitleText": "任务" } }, { - "path": "pages/user/index", + "path": "pages/owner", "style": { "navigationBarTitleText": "个人中心" } - }, - { - "path": "pages/user/edit", - "style": { - "navigationBarTitleText": "编辑资料" - } - }, - { - "path": "pages/user/notif", - "style": { - "navigationBarTitleText": "消息通知" - } - }, - { - "path": "pages/user/law", - "style": { - "navigationBarTitleText": "政策法规" - } - }, - { - "path": "pages/user/task", - "style": { - "navigationBarTitleText": "任务记录" - } - }, - { - "path": "pages/AI/index", - "style": { - "navigationBarTitleText": "AI" - } } ], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "智慧环保", - "navigationBarBackgroundColor": "#FFF", - "backgroundColor": "#FFF" + "easycom": { + "autoscan": true, + "custom": { + "^cs-(.*)": "@/components/cs-$1/index.vue", // 匹配components目录内的vue文件 + "^s-(.*)": "@/uni_modules/s-components/s-$1/index.vue" // 匹配components目录内的vue文件 + } }, - - "uniIdRouter": {}, - + "subPackages": [{ + "root": "sub", + "pages": [{ + "path": "owner/edit" + }] + }], "tabBar": { - "color": "#7A7E83", - "selectedColor": "#3cc51f", - "borderStyle": "black", - "backgroundColor": "#ffffff", "list": [{ - "pagePath": "pages/index/index", - "iconPath": "/static/logo.png", - "selectedIconPath": "/static/logo.png", - "text": "首页" - }, { - "pagePath": "pages/task/index", - "iconPath": "/static/logo.png", - "selectedIconPath": "/static/logo.png", - "text": "任务" - }, { - "pagePath": "pages/AI/index", - "iconPath": "/static/logo.png", - "selectedIconPath": "/static/logo.png" - }, { - "pagePath": "pages/ent/index", - "iconPath": "/static/logo.png", - "selectedIconPath": "/static/logo.png", - "text": "企业" - }, { - "pagePath": "pages/user/index", - "iconPath": "/static/logo.png", - "selectedIconPath": "/static/logo.png", - "text": "我的" - }] + "pagePath": "pages/index" + }, + { + "pagePath": "pages/task" + }, + { + "pagePath": "pages/chat" + }, + { + "pagePath": "pages/enterprise" + }, + { + "pagePath": "pages/owner" + } + ] + }, + "globalStyle": { + "navigationStyle": "custom" } } \ No newline at end of file diff --git a/pages/AI/index.vue b/pages/AI/index.vue deleted file mode 100644 index 99909f1..0000000 --- a/pages/AI/index.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/pages/chat.vue b/pages/chat.vue new file mode 100644 index 0000000..dd6a5fd --- /dev/null +++ b/pages/chat.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/pages/ent/index.vue b/pages/ent/index.vue deleted file mode 100644 index 6e91778..0000000 --- a/pages/ent/index.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/ent/info.vue b/pages/ent/info.vue deleted file mode 100644 index 33bc679..0000000 --- a/pages/ent/info.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/enterprise.vue b/pages/enterprise.vue new file mode 100644 index 0000000..a04cfd3 --- /dev/null +++ b/pages/enterprise.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/pages/index.vue b/pages/index.vue new file mode 100644 index 0000000..5d47022 --- /dev/null +++ b/pages/index.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/pages/index/ent_reg.vue b/pages/index/ent_reg.vue deleted file mode 100644 index 4efd2bd..0000000 --- a/pages/index/ent_reg.vue +++ /dev/null @@ -1,243 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue deleted file mode 100644 index 42a84ff..0000000 --- a/pages/index/index.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/index/index222.vue b/pages/index/index222.vue deleted file mode 100644 index 2912674..0000000 --- a/pages/index/index222.vue +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/pages/index/off_reg.vue b/pages/index/off_reg.vue deleted file mode 100644 index 7add02e..0000000 --- a/pages/index/off_reg.vue +++ /dev/null @@ -1,310 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/login.vue b/pages/login.vue new file mode 100644 index 0000000..d99ea29 --- /dev/null +++ b/pages/login.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/pages/owner.vue b/pages/owner.vue new file mode 100644 index 0000000..088afb4 --- /dev/null +++ b/pages/owner.vue @@ -0,0 +1,106 @@ + + + + + diff --git a/pages/public/sug.vue b/pages/public/sug.vue deleted file mode 100644 index 6f3337c..0000000 --- a/pages/public/sug.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/pages/task.vue b/pages/task.vue new file mode 100644 index 0000000..1e0d30e --- /dev/null +++ b/pages/task.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/pages/task/index.vue b/pages/task/index.vue deleted file mode 100644 index 7dbf004..0000000 --- a/pages/task/index.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/pages/task/item.vue b/pages/task/item.vue deleted file mode 100644 index 11e64fd..0000000 --- a/pages/task/item.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/pages/task/list.vue b/pages/task/list.vue deleted file mode 100644 index c7cde44..0000000 --- a/pages/task/list.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/pages/user/edit.vue b/pages/user/edit.vue deleted file mode 100644 index 40d50a2..0000000 --- a/pages/user/edit.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/pages/user/index.vue b/pages/user/index.vue deleted file mode 100644 index ab2e13f..0000000 --- a/pages/user/index.vue +++ /dev/null @@ -1,187 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/user/law.vue b/pages/user/law.vue deleted file mode 100644 index fffc390..0000000 --- a/pages/user/law.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/pages/user/notif.vue b/pages/user/notif.vue deleted file mode 100644 index 29e4209..0000000 --- a/pages/user/notif.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/pages/user/task.vue b/pages/user/task.vue deleted file mode 100644 index 8c5e956..0000000 --- a/pages/user/task.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/permission.js b/permission.js new file mode 100644 index 0000000..e3ef650 --- /dev/null +++ b/permission.js @@ -0,0 +1,48 @@ +import { + getAccessToken +} from '@/utils/auth' + +// 登录页面 +const loginPage = "/pages/login" + +const indexPage = "/pages/index" + +// 页面白名单 +const whiteList = [ + '/pages/login', + +] + +// 检查地址白名单 +function checkWhite(url) { + const path = url.split('?')[0] + return whiteList.indexOf(path) !== -1 +} + +// 页面跳转验证拦截器 +let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"] +list.forEach(item => { + // uni.addInterceptor(item, { + // invoke(to) { + // if (getAccessToken()) { + // if (to.path === loginPage) { + // uni.reLaunch({ + // url: "/" + // }) + // } + // return true + // } else { + // if (checkWhite(to.url)) { + // return true + // } + // uni.reLaunch({ + // url: loginPage + // }) + // return false + // } + // }, + // fail(err) { + // console.log(err) + // } + // }) +}) \ No newline at end of file diff --git a/plugins/auth.js b/plugins/auth.js new file mode 100644 index 0000000..3b91c14 --- /dev/null +++ b/plugins/auth.js @@ -0,0 +1,60 @@ +import store from '@/store' + +function authPermission(permission) { + const all_permission = "*:*:*" + const permissions = store.getters && store.getters.permissions + if (permission && permission.length > 0) { + return permissions.some(v => { + return all_permission === v || v === permission + }) + } else { + return false + } +} + +function authRole(role) { + const super_admin = "admin" + const roles = store.getters && store.getters.roles + if (role && role.length > 0) { + return roles.some(v => { + return super_admin === v || v === role + }) + } else { + return false + } +} + +export default { + // 验证用户是否具备某权限 + hasPermi(permission) { + return authPermission(permission) + }, + // 验证用户是否含有指定权限,只需包含其中一个 + hasPermiOr(permissions) { + return permissions.some(item => { + return authPermission(item) + }) + }, + // 验证用户是否含有指定权限,必须全部拥有 + hasPermiAnd(permissions) { + return permissions.every(item => { + return authPermission(item) + }) + }, + // 验证用户是否具备某角色 + hasRole(role) { + return authRole(role) + }, + // 验证用户是否含有指定角色,只需包含其中一个 + hasRoleOr(roles) { + return roles.some(item => { + return authRole(item) + }) + }, + // 验证用户是否含有指定角色,必须全部拥有 + hasRoleAnd(roles) { + return roles.every(item => { + return authRole(item) + }) + } +} diff --git a/plugins/index.js b/plugins/index.js new file mode 100644 index 0000000..efbae15 --- /dev/null +++ b/plugins/index.js @@ -0,0 +1,14 @@ +import tab from './tab' +import auth from './auth' +import modal from './modal' + +export default { + install(Vue) { + // 页签操作 + Vue.prototype.$tab = tab + // 认证对象 + Vue.prototype.$auth = auth + // 模态框对象 + Vue.prototype.$modal = modal + } +} diff --git a/plugins/modal.js b/plugins/modal.js new file mode 100644 index 0000000..87960fd --- /dev/null +++ b/plugins/modal.js @@ -0,0 +1,74 @@ +export default { + // 消息提示 + msg(content) { + uni.showToast({ + title: content, + icon: 'none' + }) + }, + // 错误消息 + msgError(content) { + uni.showToast({ + title: content, + icon: 'error' + }) + }, + // 成功消息 + msgSuccess(content) { + uni.showToast({ + title: content, + icon: 'success' + }) + }, + // 隐藏消息 + hideMsg(content) { + uni.hideToast() + }, + // 弹出提示 + alert(content) { + uni.showModal({ + title: '提示', + content: content, + showCancel: false + }) + }, + // 确认窗体 + confirm(content) { + return new Promise((resolve, reject) => { + uni.showModal({ + title: '系统提示', + content: content, + cancelText: '取消', + confirmText: '确定', + success: function(res) { + if (res.confirm) { + resolve(res.confirm) + } + } + }) + }) + }, + // 提示信息 + showToast(option) { + if (typeof option === "object") { + uni.showToast(option) + } else { + uni.showToast({ + title: option, + icon: "none", + duration: 2500 + }) + } + }, + // 打开遮罩层 + loading(content) { + uni.showLoading({ + title: content, + icon: 'none' + }) + }, + // 关闭遮罩层 + closeLoading() { + uni.hideLoading() + } +} diff --git a/plugins/tab.js b/plugins/tab.js new file mode 100644 index 0000000..5d1b305 --- /dev/null +++ b/plugins/tab.js @@ -0,0 +1,30 @@ +export default { + // 关闭所有页面,打开到应用内的某个页面 + reLaunch(url) { + return uni.reLaunch({ + url: url + }) + }, + // 跳转到tabBar页面,并关闭其他所有非tabBar页面 + switchTab(url) { + return uni.switchTab({ + url: url + }) + }, + // 关闭当前页面,跳转到应用内的某个页面 + redirectTo(url) { + return uni.redirectTo({ + url: url + }) + }, + // 保留当前页面,跳转到应用内的某个页面 + navigateTo(url) { + return uni.navigateTo({ + url: url + }) + }, + // 关闭当前页面,返回上一页面或多级页面 + navigateBack() { + return uni.navigateBack() + } +} diff --git a/static/favicon.png b/static/favicon.png new file mode 100644 index 0000000..49dbe6b Binary files /dev/null and b/static/favicon.png differ diff --git a/static/font/iconfont.css b/static/font/iconfont.css new file mode 100644 index 0000000..39aed3d --- /dev/null +++ b/static/font/iconfont.css @@ -0,0 +1,90 @@ +@font-face { + font-family: "iconfont"; + src: url('/static/font/iconfont.ttf') format('truetype'); +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + display: inline-block; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-user:before { + content: "\e7ae"; +} + +.icon-password:before { + content: "\e8b2"; +} + +.icon-code:before { + content: "\e699"; +} + +.icon-setting:before { + content: "\e6cc"; +} + +.icon-share:before { + content: "\e739"; +} + +.icon-edit:before { + content: "\e60c"; +} + +.icon-version:before { + content: "\e63f"; +} + +.icon-service:before { + content: "\e6ff"; +} + +.icon-friendfill:before { + content: "\e726"; +} + +.icon-community:before { + content: "\e741"; +} + +.icon-people:before { + content: "\e736"; +} + +.icon-dianzan:before { + content: "\ec7f"; +} + +.icon-right:before { + content: "\e7eb"; +} + +.icon-logout:before { + content: "\e61d"; +} + +.icon-help:before { + content: "\e616"; +} + +.icon-github:before { + content: "\e628"; +} + +.icon-aixin:before { + content: "\e601"; +} + +.icon-clean:before { + content: "\e607"; +} + +.icon-refresh:before { + content: "\e604"; +} + diff --git a/static/font/iconfont.ttf b/static/font/iconfont.ttf new file mode 100644 index 0000000..53915ca Binary files /dev/null and b/static/font/iconfont.ttf differ diff --git a/static/images/avatar.jpg b/static/images/avatar.jpg new file mode 100644 index 0000000..c57839e Binary files /dev/null and b/static/images/avatar.jpg differ diff --git a/static/images/owner/edit.png b/static/images/owner/edit.png new file mode 100644 index 0000000..130f64c Binary files /dev/null and b/static/images/owner/edit.png differ diff --git a/static/images/owner/list.png b/static/images/owner/list.png new file mode 100644 index 0000000..23c5af3 Binary files /dev/null and b/static/images/owner/list.png differ diff --git a/static/images/owner/message.png b/static/images/owner/message.png new file mode 100644 index 0000000..8b33ab9 Binary files /dev/null and b/static/images/owner/message.png differ diff --git a/static/images/owner/phone.png b/static/images/owner/phone.png new file mode 100644 index 0000000..05404ae Binary files /dev/null and b/static/images/owner/phone.png differ diff --git a/static/images/tabbers/chat.png b/static/images/tabbers/chat.png new file mode 100644 index 0000000..0a827d5 Binary files /dev/null and b/static/images/tabbers/chat.png differ diff --git a/static/images/tabbers/home-select.png b/static/images/tabbers/home-select.png new file mode 100644 index 0000000..17f1424 Binary files /dev/null and b/static/images/tabbers/home-select.png differ diff --git a/static/images/tabbers/home.png b/static/images/tabbers/home.png new file mode 100644 index 0000000..f52eda8 Binary files /dev/null and b/static/images/tabbers/home.png differ diff --git a/static/images/tabbers/position-select.png b/static/images/tabbers/position-select.png new file mode 100644 index 0000000..f7305df Binary files /dev/null and b/static/images/tabbers/position-select.png differ diff --git a/static/images/tabbers/position.png b/static/images/tabbers/position.png new file mode 100644 index 0000000..455be4f Binary files /dev/null and b/static/images/tabbers/position.png differ diff --git a/static/images/tabbers/task-select.png b/static/images/tabbers/task-select.png new file mode 100644 index 0000000..1c6979e Binary files /dev/null and b/static/images/tabbers/task-select.png differ diff --git a/static/images/tabbers/task.png b/static/images/tabbers/task.png new file mode 100644 index 0000000..4122cfc Binary files /dev/null and b/static/images/tabbers/task.png differ diff --git a/static/images/tabbers/user-select.png b/static/images/tabbers/user-select.png new file mode 100644 index 0000000..f313a9b Binary files /dev/null and b/static/images/tabbers/user-select.png differ diff --git a/static/images/tabbers/user.png b/static/images/tabbers/user.png new file mode 100644 index 0000000..a0ad8c6 Binary files /dev/null and b/static/images/tabbers/user.png differ diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..e4a3851 --- /dev/null +++ b/static/index.html @@ -0,0 +1,23 @@ + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + + + + +
+ \ No newline at end of file diff --git a/static/logo.png b/static/logo.png deleted file mode 100644 index b5771e2..0000000 Binary files a/static/logo.png and /dev/null differ diff --git a/static/scss/colorui.css b/static/scss/colorui.css new file mode 100644 index 0000000..ae35c8f --- /dev/null +++ b/static/scss/colorui.css @@ -0,0 +1,3916 @@ +/* + ColorUi for uniApp v2.1.6 | by 文晓港 2019-05-31 10:44:24 + 仅供学习交流,如作它用所承受的法律责任一概与作者无关 + + *使用ColorUi开发扩展与插件时,请注明基于ColorUi开发 + + (QQ交流群:240787041) +*/ + +/* ================== + 初始化 + ==================== */ +body { + background-color: #f1f1f1; + font-size: 28upx; + color: #333333; + font-family: Helvetica Neue, Helvetica, sans-serif; +} + +view, +scroll-view, +swiper, +button, +input, +textarea, +label, +navigator, +image { + box-sizing: border-box; +} + +.round { + border-radius: 5000upx; +} + +.radius { + border-radius: 6upx; +} + +/* ================== + 图片 + ==================== */ + +image { + max-width: 100%; + display: inline-block; + position: relative; + z-index: 0; +} + +image.loading::before { + content: ""; + background-color: #f5f5f5; + display: block; + position: absolute; + width: 100%; + height: 100%; + z-index: -2; +} + +image.loading::after { + content: "\e7f1"; + font-family: "cuIcon"; + position: absolute; + top: 0; + left: 0; + width: 32upx; + height: 32upx; + line-height: 32upx; + right: 0; + bottom: 0; + z-index: -1; + font-size: 32upx; + margin: auto; + color: #ccc; + -webkit-animation: cuIcon-spin 2s infinite linear; + animation: cuIcon-spin 2s infinite linear; + display: block; +} + +.response { + width: 100%; +} + +/* ================== + 开关 + ==================== */ + +switch, +checkbox, +radio { + position: relative; +} + +switch::after, +switch::before { + font-family: "cuIcon"; + content: "\e645"; + position: absolute; + color: #ffffff !important; + top: 0%; + left: 0upx; + font-size: 26upx; + line-height: 26px; + width: 50%; + text-align: center; + pointer-events: none; + transform: scale(0, 0); + transition: all 0.3s ease-in-out 0s; + z-index: 9; + bottom: 0; + height: 26px; + margin: auto; +} + +switch::before { + content: "\e646"; + right: 0; + transform: scale(1, 1); + left: auto; +} + +switch[checked]::after, +switch.checked::after { + transform: scale(1, 1); +} + +switch[checked]::before, +switch.checked::before { + transform: scale(0, 0); +} + +/* #ifndef MP-ALIPAY */ +radio::before, +checkbox::before { + font-family: "cuIcon"; + content: "\e645"; + position: absolute; + color: #ffffff !important; + top: 50%; + margin-top: -8px; + right: 5px; + font-size: 32upx; + line-height: 16px; + pointer-events: none; + transform: scale(1, 1); + transition: all 0.3s ease-in-out 0s; + z-index: 9; +} + +radio .wx-radio-input, +checkbox .wx-checkbox-input, +radio .uni-radio-input, +checkbox .uni-checkbox-input { + margin: 0; + width: 24px; + height: 24px; +} + +checkbox.round .wx-checkbox-input, +checkbox.round .uni-checkbox-input { + border-radius: 100upx; +} + +/* #endif */ + +switch[checked]::before { + transform: scale(0, 0); +} + +switch .wx-switch-input, +switch .uni-switch-input { + border: none; + padding: 0 24px; + width: 48px; + height: 26px; + margin: 0; + border-radius: 100upx; +} + +switch .wx-switch-input:not([class*="bg-"]), +switch .uni-switch-input:not([class*="bg-"]) { + background: #8799a3 !important; +} + +switch .wx-switch-input::after, +switch .uni-switch-input::after { + margin: auto; + width: 26px; + height: 26px; + border-radius: 100upx; + left: 0upx; + top: 0upx; + bottom: 0upx; + position: absolute; + transform: scale(0.9, 0.9); + transition: all 0.1s ease-in-out 0s; +} + +switch .wx-switch-input.wx-switch-input-checked::after, +switch .uni-switch-input.uni-switch-input-checked::after { + margin: auto; + left: 22px; + box-shadow: none; + transform: scale(0.9, 0.9); +} + +radio-group { + display: inline-block; +} + + + +switch.radius .wx-switch-input::after, +switch.radius .wx-switch-input, +switch.radius .wx-switch-input::before, +switch.radius .uni-switch-input::after, +switch.radius .uni-switch-input, +switch.radius .uni-switch-input::before { + border-radius: 10upx; +} + +switch .wx-switch-input::before, +radio.radio::before, +checkbox .wx-checkbox-input::before, +radio .wx-radio-input::before, +switch .uni-switch-input::before, +radio.radio::before, +checkbox .uni-checkbox-input::before, +radio .uni-radio-input::before { + display: none; +} + +radio.radio[checked]::after, +radio.radio .uni-radio-input-checked::after { + content: ""; + background-color: transparent; + display: block; + position: absolute; + width: 8px; + height: 8px; + z-index: 999; + top: 0upx; + left: 0upx; + right: 0; + bottom: 0; + margin: auto; + border-radius: 200upx; + /* #ifndef MP */ + border: 7px solid #ffffff !important; + /* #endif */ + + /* #ifdef MP */ + border: 8px solid #ffffff !important; + /* #endif */ +} + +.switch-sex::after { + content: "\e71c"; +} + +.switch-sex::before { + content: "\e71a"; +} + +.switch-sex .wx-switch-input, +.switch-sex .uni-switch-input { + background: #e54d42 !important; + border-color: #e54d42 !important; +} + +.switch-sex[checked] .wx-switch-input, +.switch-sex.checked .uni-switch-input { + background: #0081ff !important; + border-color: #0081ff !important; +} + +switch.red[checked] .wx-switch-input.wx-switch-input-checked, +checkbox.red[checked] .wx-checkbox-input, +radio.red[checked] .wx-radio-input, +switch.red.checked .uni-switch-input.uni-switch-input-checked, +checkbox.red.checked .uni-checkbox-input, +radio.red.checked .uni-radio-input { + background-color: #e54d42 !important; + border-color: #e54d42 !important; + color: #ffffff !important; +} + +switch.orange[checked] .wx-switch-input, +checkbox.orange[checked] .wx-checkbox-input, +radio.orange[checked] .wx-radio-input, +switch.orange.checked .uni-switch-input, +checkbox.orange.checked .uni-checkbox-input, +radio.orange.checked .uni-radio-input { + background-color: #f37b1d !important; + border-color: #f37b1d !important; + color: #ffffff !important; +} + +switch.yellow[checked] .wx-switch-input, +checkbox.yellow[checked] .wx-checkbox-input, +radio.yellow[checked] .wx-radio-input, +switch.yellow.checked .uni-switch-input, +checkbox.yellow.checked .uni-checkbox-input, +radio.yellow.checked .uni-radio-input { + background-color: #fbbd08 !important; + border-color: #fbbd08 !important; + color: #333333 !important; +} + +switch.olive[checked] .wx-switch-input, +checkbox.olive[checked] .wx-checkbox-input, +radio.olive[checked] .wx-radio-input, +switch.olive.checked .uni-switch-input, +checkbox.olive.checked .uni-checkbox-input, +radio.olive.checked .uni-radio-input { + background-color: #8dc63f !important; + border-color: #8dc63f !important; + color: #ffffff !important; +} + +switch.green[checked] .wx-switch-input, +switch[checked] .wx-switch-input, +checkbox.green[checked] .wx-checkbox-input, +checkbox[checked] .wx-checkbox-input, +radio.green[checked] .wx-radio-input, +radio[checked] .wx-radio-input, +switch.green.checked .uni-switch-input, +switch.checked .uni-switch-input, +checkbox.green.checked .uni-checkbox-input, +checkbox.checked .uni-checkbox-input, +radio.green.checked .uni-radio-input, +radio.checked .uni-radio-input { + background-color: #39b54a !important; + border-color: #39b54a !important; + color: #ffffff !important; + border-color: #39B54A !important; +} + +switch.cyan[checked] .wx-switch-input, +checkbox.cyan[checked] .wx-checkbox-input, +radio.cyan[checked] .wx-radio-input, +switch.cyan.checked .uni-switch-input, +checkbox.cyan.checked .uni-checkbox-input, +radio.cyan.checked .uni-radio-input { + background-color: #1cbbb4 !important; + border-color: #1cbbb4 !important; + color: #ffffff !important; +} + +switch.blue[checked] .wx-switch-input, +checkbox.blue[checked] .wx-checkbox-input, +radio.blue[checked] .wx-radio-input, +switch.blue.checked .uni-switch-input, +checkbox.blue.checked .uni-checkbox-input, +radio.blue.checked .uni-radio-input { + background-color: #0081ff !important; + border-color: #0081ff !important; + color: #ffffff !important; +} + +switch.purple[checked] .wx-switch-input, +checkbox.purple[checked] .wx-checkbox-input, +radio.purple[checked] .wx-radio-input, +switch.purple.checked .uni-switch-input, +checkbox.purple.checked .uni-checkbox-input, +radio.purple.checked .uni-radio-input { + background-color: #6739b6 !important; + border-color: #6739b6 !important; + color: #ffffff !important; +} + +switch.mauve[checked] .wx-switch-input, +checkbox.mauve[checked] .wx-checkbox-input, +radio.mauve[checked] .wx-radio-input, +switch.mauve.checked .uni-switch-input, +checkbox.mauve.checked .uni-checkbox-input, +radio.mauve.checked .uni-radio-input { + background-color: #9c26b0 !important; + border-color: #9c26b0 !important; + color: #ffffff !important; +} + +switch.pink[checked] .wx-switch-input, +checkbox.pink[checked] .wx-checkbox-input, +radio.pink[checked] .wx-radio-input, +switch.pink.checked .uni-switch-input, +checkbox.pink.checked .uni-checkbox-input, +radio.pink.checked .uni-radio-input { + background-color: #e03997 !important; + border-color: #e03997 !important; + color: #ffffff !important; +} + +switch.brown[checked] .wx-switch-input, +checkbox.brown[checked] .wx-checkbox-input, +radio.brown[checked] .wx-radio-input, +switch.brown.checked .uni-switch-input, +checkbox.brown.checked .uni-checkbox-input, +radio.brown.checked .uni-radio-input { + background-color: #a5673f !important; + border-color: #a5673f !important; + color: #ffffff !important; +} + +switch.grey[checked] .wx-switch-input, +checkbox.grey[checked] .wx-checkbox-input, +radio.grey[checked] .wx-radio-input, +switch.grey.checked .uni-switch-input, +checkbox.grey.checked .uni-checkbox-input, +radio.grey.checked .uni-radio-input { + background-color: #8799a3 !important; + border-color: #8799a3 !important; + color: #ffffff !important; +} + +switch.gray[checked] .wx-switch-input, +checkbox.gray[checked] .wx-checkbox-input, +radio.gray[checked] .wx-radio-input, +switch.gray.checked .uni-switch-input, +checkbox.gray.checked .uni-checkbox-input, +radio.gray.checked .uni-radio-input { + background-color: #f0f0f0 !important; + border-color: #f0f0f0 !important; + color: #333333 !important; +} + +switch.black[checked] .wx-switch-input, +checkbox.black[checked] .wx-checkbox-input, +radio.black[checked] .wx-radio-input, +switch.black.checked .uni-switch-input, +checkbox.black.checked .uni-checkbox-input, +radio.black.checked .uni-radio-input { + background-color: #333333 !important; + border-color: #333333 !important; + color: #ffffff !important; +} + +switch.white[checked] .wx-switch-input, +checkbox.white[checked] .wx-checkbox-input, +radio.white[checked] .wx-radio-input, +switch.white.checked .uni-switch-input, +checkbox.white.checked .uni-checkbox-input, +radio.white.checked .uni-radio-input { + background-color: #ffffff !important; + border-color: #ffffff !important; + color: #333333 !important; +} + +/* ================== + 边框 + ==================== */ + +/* -- 实线 -- */ + +.solid, +.solid-top, +.solid-right, +.solid-bottom, +.solid-left, +.solids, +.solids-top, +.solids-right, +.solids-bottom, +.solids-left, +.dashed, +.dashed-top, +.dashed-right, +.dashed-bottom, +.dashed-left { + position: relative; +} + +.solid::after, +.solid-top::after, +.solid-right::after, +.solid-bottom::after, +.solid-left::after, +.solids::after, +.solids-top::after, +.solids-right::after, +.solids-bottom::after, +.solids-left::after, +.dashed::after, +.dashed-top::after, +.dashed-right::after, +.dashed-bottom::after, +.dashed-left::after { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border-radius: inherit; + transform: scale(0.5); + transform-origin: 0 0; + pointer-events: none; + box-sizing: border-box; +} + +.solid::after { + border: 1upx solid rgba(0, 0, 0, 0.1); +} + +.solid-top::after { + border-top: 1upx solid rgba(0, 0, 0, 0.1); +} + +.solid-right::after { + border-right: 1upx solid rgba(0, 0, 0, 0.1); +} + +.solid-bottom::after { + border-bottom: 1upx solid rgba(0, 0, 0, 0.1); +} + +.solid-left::after { + border-left: 1upx solid rgba(0, 0, 0, 0.1); +} + +.solids::after { + border: 8upx solid #eee; +} + +.solids-top::after { + border-top: 8upx solid #eee; +} + +.solids-right::after { + border-right: 8upx solid #eee; +} + +.solids-bottom::after { + border-bottom: 8upx solid #eee; +} + +.solids-left::after { + border-left: 8upx solid #eee; +} + +/* -- 虚线 -- */ + +.dashed::after { + border: 1upx dashed #ddd; +} + +.dashed-top::after { + border-top: 1upx dashed #ddd; +} + +.dashed-right::after { + border-right: 1upx dashed #ddd; +} + +.dashed-bottom::after { + border-bottom: 1upx dashed #ddd; +} + +.dashed-left::after { + border-left: 1upx dashed #ddd; +} + +/* -- 阴影 -- */ + +.shadow[class*='white'] { + --ShadowSize: 0 1upx 6upx; +} + +.shadow-lg { + --ShadowSize: 0upx 40upx 100upx 0upx; +} + +.shadow-warp { + position: relative; + box-shadow: 0 0 10upx rgba(0, 0, 0, 0.1); +} + +.shadow-warp:before, +.shadow-warp:after { + position: absolute; + content: ""; + top: 20upx; + bottom: 30upx; + left: 20upx; + width: 50%; + box-shadow: 0 30upx 20upx rgba(0, 0, 0, 0.2); + transform: rotate(-3deg); + z-index: -1; +} + +.shadow-warp:after { + right: 20upx; + left: auto; + transform: rotate(3deg); +} + +.shadow-blur { + position: relative; +} + +.shadow-blur::before { + content: ""; + display: block; + background: inherit; + filter: blur(10upx); + position: absolute; + width: 100%; + height: 100%; + top: 10upx; + left: 10upx; + z-index: -1; + opacity: 0.4; + transform-origin: 0 0; + border-radius: inherit; + transform: scale(1, 1); +} + +/* ================== + 按钮 + ==================== */ + +.cu-btn { + position: relative; + border: 0upx; + display: inline-flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + padding: 0 30upx; + font-size: 28upx; + height: 64upx; + line-height: 1; + text-align: center; + text-decoration: none; + overflow: visible; + margin-left: initial; + transform: translate(0upx, 0upx); + margin-right: initial; +} + +.cu-btn::after { + display: none; +} + +.cu-btn:not([class*="bg-"]) { + background-color: #f0f0f0; +} + +.cu-btn[class*="line"] { + background-color: transparent; +} + +.cu-btn[class*="line"]::after { + content: " "; + display: block; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border: 1upx solid currentColor; + transform: scale(0.5); + transform-origin: 0 0; + box-sizing: border-box; + border-radius: 12upx; + z-index: 1; + pointer-events: none; +} + +.cu-btn.round[class*="line"]::after { + border-radius: 1000upx; +} + +.cu-btn[class*="lines"]::after { + border: 6upx solid currentColor; +} + +.cu-btn[class*="bg-"]::after { + display: none; +} + +.cu-btn.sm { + padding: 0 20upx; + font-size: 20upx; + height: 48upx; +} + +.cu-btn.lg { + padding: 0 40upx; + font-size: 32upx; + height: 80upx; +} + +.cu-btn.cuIcon.sm { + width: 48upx; + height: 48upx; +} + +.cu-btn.cuIcon { + width: 64upx; + height: 64upx; + border-radius: 500upx; + padding: 0; +} + +button.cuIcon.lg { + width: 80upx; + height: 80upx; +} + +.cu-btn.shadow-blur::before { + top: 4upx; + left: 4upx; + filter: blur(6upx); + opacity: 0.6; +} + +.cu-btn.button-hover { + transform: translate(1upx, 1upx); +} + +.block { + display: block; +} + +.cu-btn.block { + display: flex; +} + +.cu-btn[disabled] { + opacity: 0.6; + color: #ffffff; +} + +/* ================== + 徽章 + ==================== */ + +.cu-tag { + font-size: 24upx; + vertical-align: middle; + position: relative; + display: inline-flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + padding: 0upx 16upx; + height: 48upx; + font-family: Helvetica Neue, Helvetica, sans-serif; + white-space: nowrap; +} + +.cu-tag:not([class*="bg"]):not([class*="line"]) { + background-color: #f1f1f1; +} + +.cu-tag[class*="line-"]::after { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border: 1upx solid currentColor; + transform: scale(0.5); + transform-origin: 0 0; + box-sizing: border-box; + border-radius: inherit; + z-index: 1; + pointer-events: none; +} + +.cu-tag.radius[class*="line"]::after { + border-radius: 12upx; +} + +.cu-tag.round[class*="line"]::after { + border-radius: 1000upx; +} + +.cu-tag[class*="line-"]::after { + border-radius: 0; +} + +.cu-tag+.cu-tag { + margin-left: 10upx; +} + +.cu-tag.sm { + font-size: 20upx; + padding: 0upx 12upx; + height: 32upx; +} + +.cu-capsule { + display: inline-flex; + vertical-align: middle; +} + +.cu-capsule+.cu-capsule { + margin-left: 10upx; +} + +.cu-capsule .cu-tag { + margin: 0; +} + +.cu-capsule .cu-tag[class*="line-"]:last-child::after { + border-left: 0upx solid transparent; +} + +.cu-capsule .cu-tag[class*="line-"]:first-child::after { + border-right: 0upx solid transparent; +} + +.cu-capsule.radius .cu-tag:first-child { + border-top-left-radius: 6upx; + border-bottom-left-radius: 6upx; +} + +.cu-capsule.radius .cu-tag:last-child::after, +.cu-capsule.radius .cu-tag[class*="line-"] { + border-top-right-radius: 12upx; + border-bottom-right-radius: 12upx; +} + +.cu-capsule.round .cu-tag:first-child { + border-top-left-radius: 200upx; + border-bottom-left-radius: 200upx; + text-indent: 4upx; +} + +.cu-capsule.round .cu-tag:last-child::after, +.cu-capsule.round .cu-tag:last-child { + border-top-right-radius: 200upx; + border-bottom-right-radius: 200upx; + text-indent: -4upx; +} + +.cu-tag.badge { + border-radius: 200upx; + position: absolute; + top: -10upx; + right: -10upx; + font-size: 20upx; + padding: 0upx 10upx; + height: 28upx; + color: #ffffff; +} + +.cu-tag.badge:not([class*="bg-"]) { + background-color: #dd514c; +} + +.cu-tag:empty:not([class*="cuIcon-"]) { + padding: 0upx; + width: 16upx; + height: 16upx; + top: -4upx; + right: -4upx; +} + +.cu-tag[class*="cuIcon-"] { + width: 32upx; + height: 32upx; + top: -4upx; + right: -4upx; +} + +/* ================== + 头像 + ==================== */ + +.cu-avatar { + font-variant: small-caps; + margin: 0; + padding: 0; + display: inline-flex; + text-align: center; + justify-content: center; + align-items: center; + background-color: #ccc; + color: #ffffff; + white-space: nowrap; + position: relative; + width: 64upx; + height: 64upx; + background-size: cover; + background-position: center; + vertical-align: middle; + font-size: 1.5em; +} + +.cu-avatar.sm { + width: 48upx; + height: 48upx; + font-size: 1em; +} + +.cu-avatar.lg { + width: 96upx; + height: 96upx; + font-size: 2em; +} + +.cu-avatar.xl { + width: 128upx; + height: 128upx; + font-size: 2.5em; +} + +.cu-avatar .avatar-text { + font-size: 0.4em; +} + +.cu-avatar-group { + direction: rtl; + unicode-bidi: bidi-override; + padding: 0 10upx 0 40upx; + display: inline-block; +} + +.cu-avatar-group .cu-avatar { + margin-left: -30upx; + border: 4upx solid #f1f1f1; + vertical-align: middle; +} + +.cu-avatar-group .cu-avatar.sm { + margin-left: -20upx; + border: 1upx solid #f1f1f1; +} + +/* ================== + 进度条 + ==================== */ + +.cu-progress { + overflow: hidden; + height: 28upx; + background-color: #ebeef5; + display: inline-flex; + align-items: center; + width: 100%; +} + +.cu-progress+view, +.cu-progress+text { + line-height: 1; +} + +.cu-progress.xs { + height: 10upx; +} + +.cu-progress.sm { + height: 20upx; +} + +.cu-progress view { + width: 0; + height: 100%; + align-items: center; + display: flex; + justify-items: flex-end; + justify-content: space-around; + font-size: 20upx; + color: #ffffff; + transition: width 0.6s ease; +} + +.cu-progress text { + align-items: center; + display: flex; + font-size: 20upx; + color: #333333; + text-indent: 10upx; +} + +.cu-progress.text-progress { + padding-right: 60upx; +} + +.cu-progress.striped view { + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-size: 72upx 72upx; +} + +.cu-progress.active view { + animation: progress-stripes 2s linear infinite; +} + +@keyframes progress-stripes { + from { + background-position: 72upx 0; + } + + to { + background-position: 0 0; + } +} + +/* ================== + 加载 + ==================== */ + +.cu-load { + display: block; + line-height: 3em; + text-align: center; +} + +.cu-load::before { + font-family: "cuIcon"; + display: inline-block; + margin-right: 6upx; +} + +.cu-load.loading::before { + content: "\e67a"; + animation: cuIcon-spin 2s infinite linear; +} + +.cu-load.loading::after { + content: "加载中..."; +} + +.cu-load.over::before { + content: "\e64a"; +} + +.cu-load.over::after { + content: "没有更多了"; +} + +.cu-load.erro::before { + content: "\e658"; +} + +.cu-load.erro::after { + content: "加载失败"; +} + +.cu-load.load-cuIcon::before { + font-size: 32upx; +} + +.cu-load.load-cuIcon::after { + display: none; +} + +.cu-load.load-cuIcon.over { + display: none; +} + +.cu-load.load-modal { + position: fixed; + top: 0; + right: 0; + bottom: 140upx; + left: 0; + margin: auto; + width: 260upx; + height: 260upx; + background-color: #ffffff; + border-radius: 10upx; + box-shadow: 0 0 0upx 2000upx rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + font-size: 28upx; + z-index: 9999; + line-height: 2.4em; +} + +.cu-load.load-modal [class*="cuIcon-"] { + font-size: 60upx; +} + +.cu-load.load-modal image { + width: 70upx; + height: 70upx; +} + +.cu-load.load-modal::after { + content: ""; + position: absolute; + background-color: #ffffff; + border-radius: 50%; + width: 200upx; + height: 200upx; + font-size: 10px; + border-top: 6upx solid rgba(0, 0, 0, 0.05); + border-right: 6upx solid rgba(0, 0, 0, 0.05); + border-bottom: 6upx solid rgba(0, 0, 0, 0.05); + border-left: 6upx solid #f37b1d; + animation: cuIcon-spin 1s infinite linear; + z-index: -1; +} + +.load-progress { + pointer-events: none; + top: 0; + position: fixed; + width: 100%; + left: 0; + z-index: 2000; +} + +.load-progress.hide { + display: none; +} + +.load-progress .load-progress-bar { + position: relative; + width: 100%; + height: 4upx; + overflow: hidden; + transition: all 200ms ease 0s; +} + +.load-progress .load-progress-spinner { + position: absolute; + top: 10upx; + right: 10upx; + z-index: 2000; + display: block; +} + +.load-progress .load-progress-spinner::after { + content: ""; + display: block; + width: 24upx; + height: 24upx; + -webkit-box-sizing: border-box; + box-sizing: border-box; + border: solid 4upx transparent; + border-top-color: inherit; + border-left-color: inherit; + border-radius: 50%; + -webkit-animation: load-progress-spinner 0.4s linear infinite; + animation: load-progress-spinner 0.4s linear infinite; +} + +@-webkit-keyframes load-progress-spinner { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes load-progress-spinner { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +/* ================== + 列表 + ==================== */ +.grayscale { + filter: grayscale(1); +} + +.cu-list+.cu-list { + margin-top: 30upx +} + +.cu-list>.cu-item { + transition: all .6s ease-in-out 0s; + transform: translateX(0upx) +} + +.cu-list>.cu-item.move-cur { + transform: translateX(-260upx) +} + +.cu-list>.cu-item .move { + position: absolute; + right: 0; + display: flex; + width: 260upx; + height: 100%; + transform: translateX(100%) +} + +.cu-list>.cu-item .move view { + display: flex; + flex: 1; + justify-content: center; + align-items: center +} + +.cu-list.menu-avatar { + overflow: hidden; +} + +.cu-list.menu-avatar>.cu-item { + position: relative; + display: flex; + padding-right: 10upx; + height: 140upx; + background-color: #ffffff; + justify-content: flex-end; + align-items: center +} + +.cu-list.menu-avatar>.cu-item>.cu-avatar { + position: absolute; + left: 30upx +} + +.cu-list.menu-avatar>.cu-item .flex .text-cut { + max-width: 510upx +} + +.cu-list.menu-avatar>.cu-item .content { + position: absolute; + left: 146upx; + width: calc(100% - 96upx - 60upx - 120upx - 20upx); + line-height: 1.6em; +} + +.cu-list.menu-avatar>.cu-item .content.flex-sub { + width: calc(100% - 96upx - 60upx - 20upx); +} + +.cu-list.menu-avatar>.cu-item .content>view:first-child { + font-size: 30upx; + display: flex; + align-items: center +} + +.cu-list.menu-avatar>.cu-item .content .cu-tag.sm { + display: inline-block; + margin-left: 10upx; + height: 28upx; + font-size: 16upx; + line-height: 32upx +} + +.cu-list.menu-avatar>.cu-item .action { + width: 100upx; + text-align: center +} + +.cu-list.menu-avatar>.cu-item .action view+view { + margin-top: 10upx +} + +.cu-list.menu-avatar.comment>.cu-item .content { + position: relative; + left: 0; + width: auto; + flex: 1; +} + +.cu-list.menu-avatar.comment>.cu-item { + padding: 30upx 30upx 30upx 120upx; + height: auto +} + +.cu-list.menu-avatar.comment .cu-avatar { + align-self: flex-start +} + +.cu-list.menu>.cu-item { + position: relative; + display: flex; + padding: 0 30upx; + min-height: 100upx; + background-color: #ffffff; + justify-content: space-between; + align-items: center +} + +.cu-list.menu>.cu-item:last-child:after { + border: none +} + +.cu-list.menu-avatar>.cu-item:after, +.cu-list.menu>.cu-item:after { + position: absolute; + top: 0; + left: 0; + box-sizing: border-box; + width: 200%; + height: 200%; + border-bottom: 1upx solid #ddd; + border-radius: inherit; + content: " "; + transform: scale(.5); + transform-origin: 0 0; + pointer-events: none +} + +.cu-list.menu>.cu-item.grayscale { + background-color: #f5f5f5 +} + +.cu-list.menu>.cu-item.cur { + background-color: #fcf7e9 +} + +.cu-list.menu>.cu-item.arrow { + padding-right: 90upx +} + +.cu-list.menu>.cu-item.arrow:before { + position: absolute; + top: 0; + right: 30upx; + bottom: 0; + display: block; + margin: auto; + width: 30upx; + height: 30upx; + color: #8799a3; + content: "\e6a3"; + text-align: center; + font-size: 34upx; + font-family: cuIcon; + line-height: 30upx +} + +.cu-list.menu>.cu-item button.content { + padding: 0; + background-color: transparent; + justify-content: flex-start +} + +.cu-list.menu>.cu-item button.content:after { + display: none +} + +.cu-list.menu>.cu-item .cu-avatar-group .cu-avatar { + border-color: #ffffff +} + +.cu-list.menu>.cu-item .content>view:first-child { + display: flex; + align-items: center +} + +.cu-list.menu>.cu-item .content>text[class*=cuIcon] { + display: inline-block; + margin-right: 10upx; + width: 1.6em; + text-align: center +} + +.cu-list.menu>.cu-item .content>image { + display: inline-block; + margin-right: 10upx; + width: 1.6em; + height: 1.6em; + vertical-align: middle +} + +.cu-list.menu>.cu-item .content { + font-size: 30upx; + line-height: 1.6em; + flex: 1 +} + +.cu-list.menu>.cu-item .content .cu-tag.sm { + display: inline-block; + margin-left: 10upx; + height: 28upx; + font-size: 16upx; + line-height: 32upx +} + +.cu-list.menu>.cu-item .action .cu-tag:empty { + right: 10upx +} + +.cu-list.menu { + display: block; + overflow: hidden +} + +.cu-list.menu.sm-border>.cu-item:after { + left: 30upx; + width: calc(200% - 120upx) +} + +.cu-list.grid>.cu-item { + position: relative; + display: flex; + padding: 20upx 0 30upx; + transition-duration: 0s; + flex-direction: column +} + +.cu-list.grid>.cu-item:after { + position: absolute; + top: 0; + left: 0; + box-sizing: border-box; + width: 200%; + height: 200%; + border-right: 1px solid rgba(0, 0, 0, .1); + border-bottom: 1px solid rgba(0, 0, 0, .1); + border-radius: inherit; + content: " "; + transform: scale(.5); + transform-origin: 0 0; + pointer-events: none +} + +.cu-list.grid>.cu-item text { + display: block; + margin-top: 10upx; + color: #888; + font-size: 26upx; + line-height: 40upx +} + +.cu-list.grid>.cu-item [class*=cuIcon] { + position: relative; + display: block; + margin-top: 20upx; + width: 100%; + font-size: 48upx +} + +.cu-list.grid>.cu-item .cu-tag { + right: auto; + left: 50%; + margin-left: 20upx +} + +.cu-list.grid { + background-color: #ffffff; + text-align: center +} + +.cu-list.grid.no-border>.cu-item { + padding-top: 10upx; + padding-bottom: 20upx +} + +.cu-list.grid.no-border>.cu-item:after { + border: none +} + +.cu-list.grid.no-border { + padding: 20upx 10upx +} + +.cu-list.grid.col-3>.cu-item:nth-child(3n):after, +.cu-list.grid.col-4>.cu-item:nth-child(4n):after, +.cu-list.grid.col-5>.cu-item:nth-child(5n):after { + border-right-width: 0 +} + +.cu-list.card-menu { + overflow: hidden; + margin-right: 30upx; + margin-left: 30upx; + border-radius: 20upx +} + + +/* ================== + 操作条 + ==================== */ + +.cu-bar { + display: flex; + position: relative; + align-items: center; + min-height: 100upx; + justify-content: space-between; +} + +.cu-bar .action { + display: flex; + align-items: center; + height: 100%; + justify-content: center; + max-width: 100%; +} + +.cu-bar .action.border-title { + position: relative; + top: -10upx; +} + +.cu-bar .action.border-title text[class*="bg-"]:last-child { + position: absolute; + bottom: -0.5rem; + min-width: 2rem; + height: 6upx; + left: 0; +} + +.cu-bar .action.sub-title { + position: relative; + top: -0.2rem; +} + +.cu-bar .action.sub-title text { + position: relative; + z-index: 1; +} + +.cu-bar .action.sub-title text[class*="bg-"]:last-child { + position: absolute; + display: inline-block; + bottom: -0.2rem; + border-radius: 6upx; + width: 100%; + height: 0.6rem; + left: 0.6rem; + opacity: 0.3; + z-index: 0; +} + +.cu-bar .action.sub-title text[class*="text-"]:last-child { + position: absolute; + display: inline-block; + bottom: -0.7rem; + left: 0.5rem; + opacity: 0.2; + z-index: 0; + text-align: right; + font-weight: 900; + font-size: 36upx; +} + +.cu-bar.justify-center .action.border-title text:last-child, +.cu-bar.justify-center .action.sub-title text:last-child { + left: 0; + right: 0; + margin: auto; + text-align: center; +} + +.cu-bar .action:first-child { + margin-left: 30upx; + font-size: 30upx; +} + +.cu-bar .action text.text-cut { + text-align: left; + width: 100%; +} + +.cu-bar .cu-avatar:first-child { + margin-left: 20upx; +} + +.cu-bar .action:first-child>text[class*="cuIcon-"] { + margin-left: -0.3em; + margin-right: 0.3em; +} + +.cu-bar .action:last-child { + margin-right: 30upx; +} + +.cu-bar .action>text[class*="cuIcon-"], +.cu-bar .action>view[class*="cuIcon-"] { + font-size: 36upx; +} + +.cu-bar .action>text[class*="cuIcon-"]+text[class*="cuIcon-"] { + margin-left: 0.5em; +} + +.cu-bar .content { + position: absolute; + text-align: center; + width: calc(100% - 340upx); + left: 0; + right: 0; + bottom: 0; + top: 0; + margin: auto; + height: 60upx; + font-size: 32upx; + line-height: 60upx; + cursor: none; + pointer-events: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.cu-bar.ios .content { + bottom: 7px; + height: 30px; + font-size: 32upx; + line-height: 30px; +} + +.cu-bar.btn-group { + justify-content: space-around; +} + +.cu-bar.btn-group button { + padding: 20upx 32upx; +} + +.cu-bar.btn-group button { + flex: 1; + margin: 0 20upx; + max-width: 50%; +} + +.cu-bar .search-form { + background-color: #f5f5f5; + line-height: 64upx; + height: 64upx; + font-size: 24upx; + color: #333333; + flex: 1; + display: flex; + align-items: center; + margin: 0 30upx; +} + +.cu-bar .search-form+.action { + margin-right: 30upx; +} + +.cu-bar .search-form input { + flex: 1; + padding-right: 30upx; + height: 64upx; + line-height: 64upx; + font-size: 26upx; + background-color: transparent; +} + +.cu-bar .search-form [class*="cuIcon-"] { + margin: 0 0.5em 0 0.8em; +} + +.cu-bar .search-form [class*="cuIcon-"]::before { + top: 0upx; +} + +.cu-bar.fixed, +.nav.fixed { + position: fixed; + width: 100%; + top: 0; + z-index: 1024; + box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1); +} + +.cu-bar.foot { + position: fixed; + width: 100%; + bottom: 0; + z-index: 1024; + box-shadow: 0 -1upx 6upx rgba(0, 0, 0, 0.1); +} + +.cu-bar.tabbar { + padding: 0; + height: calc(100upx + env(safe-area-inset-bottom) / 2); + padding-bottom: calc(env(safe-area-inset-bottom) / 2); +} + +.cu-tabbar-height { + min-height: 100upx; + height: calc(100upx + env(safe-area-inset-bottom) / 2); +} + +.cu-bar.tabbar.shadow { + box-shadow: 0 -1upx 6upx rgba(0, 0, 0, 0.1); +} + +.cu-bar.tabbar .action { + font-size: 22upx; + position: relative; + flex: 1; + text-align: center; + padding: 0; + display: block; + height: auto; + line-height: 1; + margin: 0; + background-color: inherit; + overflow: initial; +} + +.cu-bar.tabbar.shop .action { + width: 140upx; + flex: initial; +} + +.cu-bar.tabbar .action.add-action { + position: relative; + z-index: 2; + padding-top: 50upx; +} + +.cu-bar.tabbar .action.add-action [class*="cuIcon-"] { + position: absolute; + width: 70upx; + z-index: 2; + height: 70upx; + border-radius: 50%; + line-height: 70upx; + font-size: 50upx; + top: -35upx; + left: 0; + right: 0; + margin: auto; + padding: 0; +} + +.cu-bar.tabbar .action.add-action::after { + content: ""; + position: absolute; + width: 100upx; + height: 100upx; + top: -50upx; + left: 0; + right: 0; + margin: auto; + box-shadow: 0 -3upx 8upx rgba(0, 0, 0, 0.08); + border-radius: 50upx; + background-color: inherit; + z-index: 0; +} + +.cu-bar.tabbar .action.add-action::before { + content: ""; + position: absolute; + width: 100upx; + height: 30upx; + bottom: 30upx; + left: 0; + right: 0; + margin: auto; + background-color: inherit; + z-index: 1; +} + +.cu-bar.tabbar .btn-group { + flex: 1; + display: flex; + justify-content: space-around; + align-items: center; + padding: 0 10upx; +} + +.cu-bar.tabbar button.action::after { + border: 0; +} + +.cu-bar.tabbar .action [class*="cuIcon-"] { + width: 100upx; + position: relative; + display: block; + height: auto; + margin: 0 auto 10upx; + text-align: center; + font-size: 40upx; +} + +.cu-bar.tabbar .action .cuIcon-cu-image { + margin: 0 auto; +} + +.cu-bar.tabbar .action .cuIcon-cu-image image { + width: 50upx; + height: 50upx; + display: inline-block; +} + +.cu-bar.tabbar .submit { + align-items: center; + display: flex; + justify-content: center; + text-align: center; + position: relative; + flex: 2; + align-self: stretch; +} + +.cu-bar.tabbar .submit:last-child { + flex: 2.6; +} + +.cu-bar.tabbar .submit+.submit { + flex: 2; +} + +.cu-bar.tabbar.border .action::before { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + transform: scale(0.5); + transform-origin: 0 0; + border-right: 1upx solid rgba(0, 0, 0, 0.1); + z-index: 3; +} + +.cu-bar.tabbar.border .action:last-child:before { + display: none; +} + +.cu-bar.input { + padding-right: 20upx; + background-color: #ffffff; +} + +.cu-bar.input input { + overflow: initial; + line-height: 64upx; + height: 64upx; + min-height: 64upx; + flex: 1; + font-size: 30upx; + margin: 0 20upx; +} + +.cu-bar.input .action { + margin-left: 20upx; +} + +.cu-bar.input .action [class*="cuIcon-"] { + font-size: 48upx; +} + +.cu-bar.input input+.action { + margin-right: 20upx; + margin-left: 0upx; +} + +.cu-bar.input .action:first-child [class*="cuIcon-"] { + margin-left: 0upx; +} + +.cu-custom { + display: block; + position: relative; +} + +.cu-custom .cu-bar .content { + width: calc(100% - 440upx); +} + +/* #ifdef MP-ALIPAY */ +.cu-custom .cu-bar .action .cuIcon-back { + opacity: 0; +} + +/* #endif */ + +.cu-custom .cu-bar .content image { + height: 60upx; + width: 240upx; +} + +.cu-custom .cu-bar { + min-height: 0px; + /* #ifdef MP-WEIXIN */ + padding-right: 220upx; + /* #endif */ + /* #ifdef MP-ALIPAY */ + padding-right: 150upx; + /* #endif */ + box-shadow: 0upx 0upx 0upx; + z-index: 9999; +} + +.cu-custom .cu-bar .border-custom { + position: relative; + background: rgba(0, 0, 0, 0.15); + border-radius: 1000upx; + height: 30px; +} + +.cu-custom .cu-bar .border-custom::after { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border-radius: inherit; + transform: scale(0.5); + transform-origin: 0 0; + pointer-events: none; + box-sizing: border-box; + border: 1upx solid #ffffff; + opacity: 0.5; +} + +.cu-custom .cu-bar .border-custom::before { + content: " "; + width: 1upx; + height: 110%; + position: absolute; + top: 22.5%; + left: 0; + right: 0; + margin: auto; + transform: scale(0.5); + transform-origin: 0 0; + pointer-events: none; + box-sizing: border-box; + opacity: 0.6; + background-color: #ffffff; +} + +.cu-custom .cu-bar .border-custom text { + display: block; + flex: 1; + margin: auto !important; + text-align: center; + font-size: 34upx; +} + +/* ================== + 导航栏 + ==================== */ + +.nav { + white-space: nowrap; +} + +::-webkit-scrollbar { + display: none; +} + +.nav .cu-item { + height: 90upx; + display: inline-block; + line-height: 90upx; + margin: 0 10upx; + padding: 0 20upx; +} + +.nav .cu-item.cur { + border-bottom: 4upx solid; +} + +/* ================== + 时间轴 + ==================== */ + +.cu-timeline { + display: block; + background-color: #ffffff; +} + +.cu-timeline .cu-time { + width: 120upx; + text-align: center; + padding: 20upx 0; + font-size: 26upx; + color: #888; + display: block; +} + +.cu-timeline>.cu-item { + padding: 30upx 30upx 30upx 120upx; + position: relative; + display: block; + z-index: 0; +} + +.cu-timeline>.cu-item:not([class*="text-"]) { + color: #ccc; +} + +.cu-timeline>.cu-item::after { + content: ""; + display: block; + position: absolute; + width: 1upx; + background-color: #ddd; + left: 60upx; + height: 100%; + top: 0; + z-index: 8; +} + +.cu-timeline>.cu-item::before { + font-family: "cuIcon"; + display: block; + position: absolute; + top: 36upx; + z-index: 9; + background-color: #ffffff; + width: 50upx; + height: 50upx; + text-align: center; + border: none; + line-height: 50upx; + left: 36upx; +} + +.cu-timeline>.cu-item:not([class*="cuIcon-"])::before { + content: "\e763"; +} + +.cu-timeline>.cu-item[class*="cuIcon-"]::before { + background-color: #ffffff; + width: 50upx; + height: 50upx; + text-align: center; + border: none; + line-height: 50upx; + left: 36upx; +} + +.cu-timeline>.cu-item>.content { + padding: 30upx; + border-radius: 6upx; + display: block; + line-height: 1.6; +} + +.cu-timeline>.cu-item>.content:not([class*="bg-"]) { + background-color: #f1f1f1; + color: #333333; +} + +.cu-timeline>.cu-item>.content+.content { + margin-top: 20upx; +} + +/* ================== + 聊天 + ==================== */ + +.cu-chat { + display: flex; + flex-direction: column; +} + +.cu-chat .cu-item { + display: flex; + padding: 30upx 30upx 70upx; + position: relative; +} + +.cu-chat .cu-item>.cu-avatar { + width: 80upx; + height: 80upx; +} + +.cu-chat .cu-item>.main { + max-width: calc(100% - 260upx); + margin: 0 40upx; + display: flex; + align-items: center; +} + +.cu-chat .cu-item>image { + height: 320upx; +} + +.cu-chat .cu-item>.main .content { + padding: 20upx; + border-radius: 6upx; + display: inline-flex; + max-width: 100%; + align-items: center; + font-size: 30upx; + position: relative; + min-height: 80upx; + line-height: 40upx; + text-align: left; +} + +.cu-chat .cu-item>.main .content:not([class*="bg-"]) { + background-color: #ffffff; + color: #333333; +} + +.cu-chat .cu-item .date { + position: absolute; + font-size: 24upx; + color: #8799a3; + width: calc(100% - 320upx); + bottom: 20upx; + left: 160upx; +} + +.cu-chat .cu-item .action { + padding: 0 30upx; + display: flex; + align-items: center; +} + +.cu-chat .cu-item>.main .content::after { + content: ""; + top: 27upx; + transform: rotate(45deg); + position: absolute; + z-index: 100; + display: inline-block; + overflow: hidden; + width: 24upx; + height: 24upx; + left: -12upx; + right: initial; + background-color: inherit; +} + +.cu-chat .cu-item.self>.main .content::after { + left: auto; + right: -12upx; +} + +.cu-chat .cu-item>.main .content::before { + content: ""; + top: 30upx; + transform: rotate(45deg); + position: absolute; + z-index: -1; + display: inline-block; + overflow: hidden; + width: 24upx; + height: 24upx; + left: -12upx; + right: initial; + background-color: inherit; + filter: blur(5upx); + opacity: 0.3; +} + +.cu-chat .cu-item>.main .content:not([class*="bg-"])::before { + background-color: #333333; + opacity: 0.1; +} + +.cu-chat .cu-item.self>.main .content::before { + left: auto; + right: -12upx; +} + +.cu-chat .cu-item.self { + justify-content: flex-end; + text-align: right; +} + +.cu-chat .cu-info { + display: inline-block; + margin: 20upx auto; + font-size: 24upx; + padding: 8upx 12upx; + background-color: rgba(0, 0, 0, 0.2); + border-radius: 6upx; + color: #ffffff; + max-width: 400upx; + line-height: 1.4; +} + +/* ================== + 卡片 + ==================== */ + +.cu-card { + display: block; + overflow: hidden; +} + +.cu-card>.cu-item { + display: block; + background-color: #ffffff; + overflow: hidden; + border-radius: 10upx; + margin: 30upx; +} + +.cu-card>.cu-item.shadow-blur { + overflow: initial; +} + +.cu-card.no-card>.cu-item { + margin: 0upx; + border-radius: 0upx; +} + +.cu-card .grid.grid-square { + margin-bottom: -20upx; +} + +.cu-card.case .image { + position: relative; +} + +.cu-card.case .image image { + width: 100%; +} + +.cu-card.case .image .cu-tag { + position: absolute; + right: 0; + top: 0; +} + +.cu-card.case .image .cu-bar { + position: absolute; + bottom: 0; + width: 100%; + background-color: transparent; + padding: 0upx 30upx; +} + +.cu-card.case.no-card .image { + margin: 30upx 30upx 0; + overflow: hidden; + border-radius: 10upx; +} + +.cu-card.dynamic { + display: block; +} + +.cu-card.dynamic>.cu-item { + display: block; + background-color: #ffffff; + overflow: hidden; +} + +.cu-card.dynamic>.cu-item>.text-content { + padding: 0 30upx 0; + max-height: 6.4em; + overflow: hidden; + font-size: 30upx; + margin-bottom: 20upx; +} + +.cu-card.dynamic>.cu-item .square-img { + width: 100%; + height: 200upx; + border-radius: 6upx; +} + +.cu-card.dynamic>.cu-item .only-img { + width: 100%; + height: 320upx; + border-radius: 6upx; +} + +/* card.dynamic>.cu-item .comment { + padding: 20upx; + background-color: #f1f1f1; + margin: 0 30upx 30upx; + border-radius: 6upx; +} */ + +.cu-card.article { + display: block; +} + +.cu-card.article>.cu-item { + padding-bottom: 30upx; +} + +.cu-card.article>.cu-item .title { + font-size: 30upx; + font-weight: 900; + color: #333333; + line-height: 100upx; + padding: 0 30upx; +} + +.cu-card.article>.cu-item .content { + display: flex; + padding: 0 30upx; +} + +.cu-card.article>.cu-item .content>image { + width: 240upx; + height: 6.4em; + margin-right: 20upx; + border-radius: 6upx; +} + +.cu-card.article>.cu-item .content .desc { + flex: 1; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.cu-card.article>.cu-item .content .text-content { + font-size: 28upx; + color: #888; + height: 4.8em; + overflow: hidden; +} + +/* ================== + 表单 + ==================== */ + +.cu-form-group { + background-color: #ffffff; + padding: 1upx 30upx; + display: flex; + align-items: center; + min-height: 100upx; + justify-content: space-between; +} + +.cu-form-group+.cu-form-group { + border-top: 1upx solid #eee; +} + +.cu-form-group .title { + text-align: justify; + padding-right: 30upx; + font-size: 30upx; + position: relative; + height: 60upx; + line-height: 60upx; +} + +.cu-form-group input { + flex: 1; + font-size: 30upx; + color: #555; + padding-right: 20upx; +} + +.cu-form-group>text[class*="cuIcon-"] { + font-size: 36upx; + padding: 0; + box-sizing: border-box; +} + +.cu-form-group textarea { + margin: 32upx 0 30upx; + height: 4.6em; + width: 100%; + line-height: 1.2em; + flex: 1; + font-size: 28upx; + padding: 0; +} + +.cu-form-group.align-start .title { + height: 1em; + margin-top: 32upx; + line-height: 1em; +} + +.cu-form-group picker { + flex: 1; + padding-right: 40upx; + overflow: hidden; + position: relative; +} + +.cu-form-group picker .picker { + line-height: 100upx; + font-size: 28upx; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + width: 100%; + text-align: right; +} + +.cu-form-group picker::after { + font-family: cuIcon; + display: block; + content: "\e6a3"; + position: absolute; + font-size: 34upx; + color: #8799a3; + line-height: 100upx; + width: 60upx; + text-align: center; + top: 0; + bottom: 0; + right: -20upx; + margin: auto; +} + +.cu-form-group textarea[disabled], +.cu-form-group textarea[disabled] .placeholder { + color: transparent; +} + +/* ================== + 模态窗口 + ==================== */ + +.cu-modal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1110; + opacity: 0; + outline: 0; + text-align: center; + -ms-transform: scale(1.185); + transform: scale(1.185); + backface-visibility: hidden; + perspective: 2000upx; + background: rgba(0, 0, 0, 0.6); + transition: all 0.3s ease-in-out 0s; + pointer-events: none; +} + +.cu-modal::before { + content: "\200B"; + display: inline-block; + height: 100%; + vertical-align: middle; +} + +.cu-modal.show { + opacity: 1; + transition-duration: 0.3s; + -ms-transform: scale(1); + transform: scale(1); + overflow-x: hidden; + overflow-y: auto; + pointer-events: auto; +} + +.cu-dialog { + position: relative; + display: inline-block; + vertical-align: middle; + margin-left: auto; + margin-right: auto; + width: 680upx; + max-width: 100%; + background-color: #f8f8f8; + border-radius: 10upx; + overflow: hidden; +} + +.cu-modal.bottom-modal::before { + vertical-align: bottom; +} + +.cu-modal.bottom-modal .cu-dialog { + width: 100%; + border-radius: 0; +} + +.cu-modal.bottom-modal { + margin-bottom: -1000upx; +} + +.cu-modal.bottom-modal.show { + margin-bottom: 0; +} + +.cu-modal.drawer-modal { + transform: scale(1); + display: flex; +} + +.cu-modal.drawer-modal .cu-dialog { + height: 100%; + min-width: 200upx; + border-radius: 0; + margin: initial; + transition-duration: 0.3s; +} + +.cu-modal.drawer-modal.justify-start .cu-dialog { + transform: translateX(-100%); +} + +.cu-modal.drawer-modal.justify-end .cu-dialog { + transform: translateX(100%); +} + +.cu-modal.drawer-modal.show .cu-dialog { + transform: translateX(0%); +} + +.cu-modal .cu-dialog>.cu-bar:first-child .action { + min-width: 100rpx; + margin-right: 0; + min-height: 100rpx; +} + +/* ================== + 轮播 + ==================== */ +swiper .a-swiper-dot { + display: inline-block; + width: 16upx; + height: 16upx; + background: rgba(0, 0, 0, .3); + border-radius: 50%; + vertical-align: middle; +} + +swiper[class*="-dot"] .wx-swiper-dots, +swiper[class*="-dot"] .a-swiper-dots, +swiper[class*="-dot"] .uni-swiper-dots { + display: flex; + align-items: center; + width: 100%; + justify-content: center; +} + +swiper.square-dot .wx-swiper-dot, +swiper.square-dot .a-swiper-dot, +swiper.square-dot .uni-swiper-dot { + background-color: #ffffff; + opacity: 0.4; + width: 10upx; + height: 10upx; + border-radius: 20upx; + margin: 0 8upx !important; +} + +swiper.square-dot .wx-swiper-dot.wx-swiper-dot-active, +swiper.square-dot .a-swiper-dot.a-swiper-dot-active, +swiper.square-dot .uni-swiper-dot.uni-swiper-dot-active { + opacity: 1; + width: 30upx; +} + +swiper.round-dot .wx-swiper-dot, +swiper.round-dot .a-swiper-dot, +swiper.round-dot .uni-swiper-dot { + width: 10upx; + height: 10upx; + position: relative; + margin: 4upx 8upx !important; +} + +swiper.round-dot .wx-swiper-dot.wx-swiper-dot-active::after, +swiper.round-dot .a-swiper-dot.a-swiper-dot-active::after, +swiper.round-dot .uni-swiper-dot.uni-swiper-dot-active::after { + content: ""; + position: absolute; + width: 10upx; + height: 10upx; + top: 0upx; + left: 0upx; + right: 0; + bottom: 0; + margin: auto; + background-color: #ffffff; + border-radius: 20upx; +} + +swiper.round-dot .wx-swiper-dot.wx-swiper-dot-active, +swiper.round-dot .a-swiper-dot.a-swiper-dot-active, +swiper.round-dot .uni-swiper-dot.uni-swiper-dot-active { + width: 18upx; + height: 18upx; +} + +.screen-swiper { + min-height: 375upx; +} + +.screen-swiper image, +.screen-swiper video, +.swiper-item image, +.swiper-item video { + width: 100%; + display: block; + height: 100%; + margin: 0; + pointer-events: none; +} + +.card-swiper { + height: 420upx !important; +} + +.card-swiper swiper-item { + width: 610upx !important; + left: 70upx; + box-sizing: border-box; + padding: 40upx 0upx 70upx; + overflow: initial; +} + +.card-swiper swiper-item .swiper-item { + width: 100%; + display: block; + height: 100%; + border-radius: 10upx; + transform: scale(0.9); + transition: all 0.2s ease-in 0s; + overflow: hidden; +} + +.card-swiper swiper-item.cur .swiper-item { + transform: none; + transition: all 0.2s ease-in 0s; +} + + +.tower-swiper { + height: 420upx; + position: relative; + max-width: 750upx; + overflow: hidden; +} + +.tower-swiper .tower-item { + position: absolute; + width: 300upx; + height: 380upx; + top: 0; + bottom: 0; + left: 50%; + margin: auto; + transition: all 0.2s ease-in 0s; + opacity: 1; +} + +.tower-swiper .tower-item.none { + opacity: 0; +} + +.tower-swiper .tower-item .swiper-item { + width: 100%; + height: 100%; + border-radius: 6upx; + overflow: hidden; +} + +/* ================== + 步骤条 + ==================== */ + +.cu-steps { + display: flex; +} + +scroll-view.cu-steps { + display: block; + white-space: nowrap; +} + +scroll-view.cu-steps .cu-item { + display: inline-block; +} + +.cu-steps .cu-item { + flex: 1; + text-align: center; + position: relative; + min-width: 100upx; +} + +.cu-steps .cu-item:not([class*="text-"]) { + color: #8799a3; +} + +.cu-steps .cu-item [class*="cuIcon-"], +.cu-steps .cu-item .num { + display: block; + font-size: 40upx; + line-height: 80upx; +} + +.cu-steps .cu-item::before, +.cu-steps .cu-item::after, +.cu-steps.steps-arrow .cu-item::before, +.cu-steps.steps-arrow .cu-item::after { + content: ""; + display: block; + position: absolute; + height: 0px; + width: calc(100% - 80upx); + border-bottom: 1px solid #ccc; + left: calc(0px - (100% - 80upx) / 2); + top: 40upx; + z-index: 0; +} + +.cu-steps.steps-arrow .cu-item::before, +.cu-steps.steps-arrow .cu-item::after { + content: "\e6a3"; + font-family: 'cuIcon'; + height: 30upx; + border-bottom-width: 0px; + line-height: 30upx; + top: 0; + bottom: 0; + margin: auto; + color: #ccc; +} + +.cu-steps.steps-bottom .cu-item::before, +.cu-steps.steps-bottom .cu-item::after { + bottom: 40upx; + top: initial; +} + +.cu-steps .cu-item::after { + border-bottom: 1px solid currentColor; + width: 0px; + transition: all 0.3s ease-in-out 0s; +} + +.cu-steps .cu-item[class*="text-"]::after { + width: calc(100% - 80upx); + color: currentColor; +} + +.cu-steps .cu-item:first-child::before, +.cu-steps .cu-item:first-child::after { + display: none; +} + +.cu-steps .cu-item .num { + width: 40upx; + height: 40upx; + border-radius: 50%; + line-height: 40upx; + margin: 20upx auto; + font-size: 24upx; + border: 1px solid currentColor; + position: relative; + overflow: hidden; +} + +.cu-steps .cu-item[class*="text-"] .num { + background-color: currentColor; +} + +.cu-steps .cu-item .num::before, +.cu-steps .cu-item .num::after { + content: attr(data-index); + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + transition: all 0.3s ease-in-out 0s; + transform: translateY(0upx); +} + +.cu-steps .cu-item[class*="text-"] .num::before { + transform: translateY(-40upx); + color: #ffffff; +} + +.cu-steps .cu-item .num::after { + transform: translateY(40upx); + color: #ffffff; + transition: all 0.3s ease-in-out 0s; +} + +.cu-steps .cu-item[class*="text-"] .num::after { + content: "\e645"; + font-family: 'cuIcon'; + color: #ffffff; + transform: translateY(0upx); +} + +.cu-steps .cu-item[class*="text-"] .num.err::after { + content: "\e646"; +} + +/* ================== + 布局 + ==================== */ + +/* -- flex弹性布局 -- */ + +.flex { + display: flex; +} + +.basis-xs { + flex-basis: 20%; +} + +.basis-sm { + flex-basis: 40%; +} + +.basis-df { + flex-basis: 50%; +} + +.basis-lg { + flex-basis: 60%; +} + +.basis-xl { + flex-basis: 80%; +} + +.flex-sub { + flex: 1; +} + +.flex-twice { + flex: 2; +} + +.flex-treble { + flex: 3; +} + +.flex-direction { + flex-direction: column; +} + +.flex-wrap { + flex-wrap: wrap; +} + +.align-start { + align-items: flex-start; +} + +.align-end { + align-items: flex-end; +} + +.align-center { + align-items: center; +} + +.align-stretch { + align-items: stretch; +} + +.self-start { + align-self: flex-start; +} + +.self-center { + align-self: flex-center; +} + +.self-end { + align-self: flex-end; +} + +.self-stretch { + align-self: stretch; +} + +.align-stretch { + align-items: stretch; +} + +.justify-start { + justify-content: flex-start; +} + +.justify-end { + justify-content: flex-end; +} + +.justify-center { + justify-content: center; +} + +.justify-between { + justify-content: space-between; +} + +.justify-around { + justify-content: space-around; +} + +/* grid布局 */ + +.grid { + display: flex; + flex-wrap: wrap; +} + +.grid.grid-square { + overflow: hidden; +} + +.grid.grid-square .cu-tag { + position: absolute; + right: 0; + top: 0; + border-bottom-left-radius: 6upx; + padding: 6upx 12upx; + height: auto; + background-color: rgba(0, 0, 0, 0.5); +} + +.grid.grid-square>view>text[class*="cuIcon-"] { + font-size: 52upx; + position: absolute; + color: #8799a3; + margin: auto; + top: 0; + bottom: 0; + left: 0; + right: 0; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.grid.grid-square>view { + margin-right: 20upx; + margin-bottom: 20upx; + border-radius: 6upx; + position: relative; + overflow: hidden; +} + +.grid.grid-square>view.bg-img image { + width: 100%; + height: 100%; + position: absolute; +} + +.grid.col-1.grid-square>view { + padding-bottom: 100%; + height: 0; + margin-right: 0; +} + +.grid.col-2.grid-square>view { + padding-bottom: calc((100% - 20upx)/2); + height: 0; + width: calc((100% - 20upx)/2); +} + +.grid.col-3.grid-square>view { + padding-bottom: calc((100% - 40upx)/3); + height: 0; + width: calc((100% - 40upx)/3); +} + +.grid.col-4.grid-square>view { + padding-bottom: calc((100% - 60upx)/4); + height: 0; + width: calc((100% - 60upx)/4); +} + +.grid.col-5.grid-square>view { + padding-bottom: calc((100% - 80upx)/5); + height: 0; + width: calc((100% - 80upx)/5); +} + +.grid.col-2.grid-square>view:nth-child(2n), +.grid.col-3.grid-square>view:nth-child(3n), +.grid.col-4.grid-square>view:nth-child(4n), +.grid.col-5.grid-square>view:nth-child(5n) { + margin-right: 0; +} + +.grid.col-1>view { + width: 100%; +} + +.grid.col-2>view { + width: 50%; +} + +.grid.col-3>view { + width: 33.33%; +} + +.grid.col-4>view { + width: 25%; +} + +.grid.col-5>view { + width: 20%; +} + +/* -- 内外边距 -- */ + +.margin-0 { + margin: 0; +} + +.margin-xs { + margin: 10upx; +} + +.margin-sm { + margin: 20upx; +} + +.margin { + margin: 30upx; +} + +.margin-lg { + margin: 40upx; +} + +.margin-xl { + margin: 50upx; +} + +.margin-top-xs { + margin-top: 10upx; +} + +.margin-top-sm { + margin-top: 20upx; +} + +.margin-top { + margin-top: 30upx; +} + +.margin-top-lg { + margin-top: 40upx; +} + +.margin-top-xl { + margin-top: 50upx; +} + +.margin-right-xs { + margin-right: 10upx; +} + +.margin-right-sm { + margin-right: 20upx; +} + +.margin-right { + margin-right: 30upx; +} + +.margin-right-lg { + margin-right: 40upx; +} + +.margin-right-xl { + margin-right: 50upx; +} + +.margin-bottom-xs { + margin-bottom: 10upx; +} + +.margin-bottom-sm { + margin-bottom: 20upx; +} + +.margin-bottom { + margin-bottom: 30upx; +} + +.margin-bottom-lg { + margin-bottom: 40upx; +} + +.margin-bottom-xl { + margin-bottom: 50upx; +} + +.margin-left-xs { + margin-left: 10upx; +} + +.margin-left-sm { + margin-left: 20upx; +} + +.margin-left { + margin-left: 30upx; +} + +.margin-left-lg { + margin-left: 40upx; +} + +.margin-left-xl { + margin-left: 50upx; +} + +.margin-lr-xs { + margin-left: 10upx; + margin-right: 10upx; +} + +.margin-lr-sm { + margin-left: 20upx; + margin-right: 20upx; +} + +.margin-lr { + margin-left: 30upx; + margin-right: 30upx; +} + +.margin-lr-lg { + margin-left: 40upx; + margin-right: 40upx; +} + +.margin-lr-xl { + margin-left: 50upx; + margin-right: 50upx; +} + +.margin-tb-xs { + margin-top: 10upx; + margin-bottom: 10upx; +} + +.margin-tb-sm { + margin-top: 20upx; + margin-bottom: 20upx; +} + +.margin-tb { + margin-top: 30upx; + margin-bottom: 30upx; +} + +.margin-tb-lg { + margin-top: 40upx; + margin-bottom: 40upx; +} + +.margin-tb-xl { + margin-top: 50upx; + margin-bottom: 50upx; +} + +.padding-0 { + padding: 0; +} + +.padding-xs { + padding: 10upx; +} + +.padding-sm { + padding: 20upx; +} + +.padding { + padding: 30upx; +} + +.padding-lg { + padding: 40upx; +} + +.padding-xl { + padding: 50upx; +} + +.padding-top-xs { + padding-top: 10upx; +} + +.padding-top-sm { + padding-top: 20upx; +} + +.padding-top { + padding-top: 30upx; +} + +.padding-top-lg { + padding-top: 40upx; +} + +.padding-top-xl { + padding-top: 50upx; +} + +.padding-right-xs { + padding-right: 10upx; +} + +.padding-right-sm { + padding-right: 20upx; +} + +.padding-right { + padding-right: 30upx; +} + +.padding-right-lg { + padding-right: 40upx; +} + +.padding-right-xl { + padding-right: 50upx; +} + +.padding-bottom-xs { + padding-bottom: 10upx; +} + +.padding-bottom-sm { + padding-bottom: 20upx; +} + +.padding-bottom { + padding-bottom: 30upx; +} + +.padding-bottom-lg { + padding-bottom: 40upx; +} + +.padding-bottom-xl { + padding-bottom: 50upx; +} + +.padding-left-xs { + padding-left: 10upx; +} + +.padding-left-sm { + padding-left: 20upx; +} + +.padding-left { + padding-left: 30upx; +} + +.padding-left-lg { + padding-left: 40upx; +} + +.padding-left-xl { + padding-left: 50upx; +} + +.padding-lr-xs { + padding-left: 10upx; + padding-right: 10upx; +} + +.padding-lr-sm { + padding-left: 20upx; + padding-right: 20upx; +} + +.padding-lr { + padding-left: 30upx; + padding-right: 30upx; +} + +.padding-lr-lg { + padding-left: 40upx; + padding-right: 40upx; +} + +.padding-lr-xl { + padding-left: 50upx; + padding-right: 50upx; +} + +.padding-tb-xs { + padding-top: 10upx; + padding-bottom: 10upx; +} + +.padding-tb-sm { + padding-top: 20upx; + padding-bottom: 20upx; +} + +.padding-tb { + padding-top: 30upx; + padding-bottom: 30upx; +} + +.padding-tb-lg { + padding-top: 40upx; + padding-bottom: 40upx; +} + +.padding-tb-xl { + padding-top: 50upx; + padding-bottom: 50upx; +} + +/* -- 浮动 -- */ + +.cf::after, +.cf::before { + content: " "; + display: table; +} + +.cf::after { + clear: both; +} + +.fl { + float: left; +} + +.fr { + float: right; +} + +/* ================== + 背景 + ==================== */ + +.line-red::after, +.lines-red::after { + border-color: #e54d42; +} + +.line-orange::after, +.lines-orange::after { + border-color: #f37b1d; +} + +.line-yellow::after, +.lines-yellow::after { + border-color: #fbbd08; +} + +.line-olive::after, +.lines-olive::after { + border-color: #8dc63f; +} + +.line-green::after, +.lines-green::after { + border-color: #39b54a; +} + +.line-cyan::after, +.lines-cyan::after { + border-color: #1cbbb4; +} + +.line-blue::after, +.lines-blue::after { + border-color: #0081ff; +} + +.line-purple::after, +.lines-purple::after { + border-color: #6739b6; +} + +.line-mauve::after, +.lines-mauve::after { + border-color: #9c26b0; +} + +.line-pink::after, +.lines-pink::after { + border-color: #e03997; +} + +.line-brown::after, +.lines-brown::after { + border-color: #a5673f; +} + +.line-grey::after, +.lines-grey::after { + border-color: #8799a3; +} + +.line-gray::after, +.lines-gray::after { + border-color: #aaaaaa; +} + +.line-black::after, +.lines-black::after { + border-color: #333333; +} + +.line-white::after, +.lines-white::after { + border-color: #ffffff; +} + +.bg-red { + background-color: #e54d42; + color: #ffffff; +} + +.bg-orange { + background-color: #f37b1d; + color: #ffffff; +} + +.bg-yellow { + background-color: #fbbd08; + color: #333333; +} + +.bg-olive { + background-color: #8dc63f; + color: #ffffff; +} + +.bg-green { + background-color: #39b54a; + color: #ffffff; +} + +.bg-cyan { + background-color: #1cbbb4; + color: #ffffff; +} + +.bg-blue { + background-color: #0081ff; + color: #ffffff; +} + +.bg-purple { + background-color: #6739b6; + color: #ffffff; +} + +.bg-mauve { + background-color: #9c26b0; + color: #ffffff; +} + +.bg-pink { + background-color: #e03997; + color: #ffffff; +} + +.bg-brown { + background-color: #a5673f; + color: #ffffff; +} + +.bg-grey { + background-color: #8799a3; + color: #ffffff; +} + +.bg-gray { + background-color: #f0f0f0; + color: #333333; +} + +.bg-black { + background-color: #333333; + color: #ffffff; +} + +.bg-white { + background-color: #ffffff; + color: #666666; +} + +.bg-shadeTop { + background-image: linear-gradient(rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.01)); + color: #ffffff; +} + +.bg-shadeBottom { + background-image: linear-gradient(rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 1)); + color: #ffffff; +} + +.bg-red.light { + color: #e54d42; + background-color: #fadbd9; +} + +.bg-orange.light { + color: #f37b1d; + background-color: #fde6d2; +} + +.bg-yellow.light { + color: #fbbd08; + background-color: #fef2ced2; +} + +.bg-olive.light { + color: #8dc63f; + background-color: #e8f4d9; +} + +.bg-green.light { + color: #39b54a; + background-color: #d7f0dbff; +} + +.bg-cyan.light { + color: #1cbbb4; + background-color: #d2f1f0; +} + +.bg-blue.light { + color: #0081ff; + background-color: #cce6ff; +} + +.bg-purple.light { + color: #6739b6; + background-color: #e1d7f0; +} + +.bg-mauve.light { + color: #9c26b0; + background-color: #ebd4ef; +} + +.bg-pink.light { + color: #e03997; + background-color: #f9d7ea; +} + +.bg-brown.light { + color: #a5673f; + background-color: #ede1d9; +} + +.bg-grey.light { + color: #8799a3; + background-color: #e7ebed; +} + +.bg-gradual-red { + background-image: linear-gradient(45deg, #f43f3b, #ec008c); + color: #ffffff; +} + +.bg-gradual-orange { + background-image: linear-gradient(45deg, #ff9700, #ed1c24); + color: #ffffff; +} + +.bg-gradual-green { + background-image: linear-gradient(45deg, #39b54a, #8dc63f); + color: #ffffff; +} + +.bg-gradual-purple { + background-image: linear-gradient(45deg, #9000ff, #5e00ff); + color: #ffffff; +} + +.bg-gradual-pink { + background-image: linear-gradient(45deg, #ec008c, #6739b6); + color: #ffffff; +} + +.bg-gradual-blue { + background-image: linear-gradient(45deg, #0081ff, #1cbbb4); + color: #ffffff; +} + +.shadow[class*="-red"] { + box-shadow: 6upx 6upx 8upx rgba(204, 69, 59, 0.2); +} + +.shadow[class*="-orange"] { + box-shadow: 6upx 6upx 8upx rgba(217, 109, 26, 0.2); +} + +.shadow[class*="-yellow"] { + box-shadow: 6upx 6upx 8upx rgba(224, 170, 7, 0.2); +} + +.shadow[class*="-olive"] { + box-shadow: 6upx 6upx 8upx rgba(124, 173, 55, 0.2); +} + +.shadow[class*="-green"] { + box-shadow: 6upx 6upx 8upx rgba(48, 156, 63, 0.2); +} + +.shadow[class*="-cyan"] { + box-shadow: 6upx 6upx 8upx rgba(28, 187, 180, 0.2); +} + +.shadow[class*="-blue"] { + box-shadow: 6upx 6upx 8upx rgba(0, 102, 204, 0.2); +} + +.shadow[class*="-purple"] { + box-shadow: 6upx 6upx 8upx rgba(88, 48, 156, 0.2); +} + +.shadow[class*="-mauve"] { + box-shadow: 6upx 6upx 8upx rgba(133, 33, 150, 0.2); +} + +.shadow[class*="-pink"] { + box-shadow: 6upx 6upx 8upx rgba(199, 50, 134, 0.2); +} + +.shadow[class*="-brown"] { + box-shadow: 6upx 6upx 8upx rgba(140, 88, 53, 0.2); +} + +.shadow[class*="-grey"] { + box-shadow: 6upx 6upx 8upx rgba(114, 130, 138, 0.2); +} + +.shadow[class*="-gray"] { + box-shadow: 6upx 6upx 8upx rgba(114, 130, 138, 0.2); +} + +.shadow[class*="-black"] { + box-shadow: 6upx 6upx 8upx rgba(26, 26, 26, 0.2); +} + +.shadow[class*="-white"] { + box-shadow: 6upx 6upx 8upx rgba(26, 26, 26, 0.2); +} + +.text-shadow[class*="-red"] { + text-shadow: 6upx 6upx 8upx rgba(204, 69, 59, 0.2); +} + +.text-shadow[class*="-orange"] { + text-shadow: 6upx 6upx 8upx rgba(217, 109, 26, 0.2); +} + +.text-shadow[class*="-yellow"] { + text-shadow: 6upx 6upx 8upx rgba(224, 170, 7, 0.2); +} + +.text-shadow[class*="-olive"] { + text-shadow: 6upx 6upx 8upx rgba(124, 173, 55, 0.2); +} + +.text-shadow[class*="-green"] { + text-shadow: 6upx 6upx 8upx rgba(48, 156, 63, 0.2); +} + +.text-shadow[class*="-cyan"] { + text-shadow: 6upx 6upx 8upx rgba(28, 187, 180, 0.2); +} + +.text-shadow[class*="-blue"] { + text-shadow: 6upx 6upx 8upx rgba(0, 102, 204, 0.2); +} + +.text-shadow[class*="-purple"] { + text-shadow: 6upx 6upx 8upx rgba(88, 48, 156, 0.2); +} + +.text-shadow[class*="-mauve"] { + text-shadow: 6upx 6upx 8upx rgba(133, 33, 150, 0.2); +} + +.text-shadow[class*="-pink"] { + text-shadow: 6upx 6upx 8upx rgba(199, 50, 134, 0.2); +} + +.text-shadow[class*="-brown"] { + text-shadow: 6upx 6upx 8upx rgba(140, 88, 53, 0.2); +} + +.text-shadow[class*="-grey"] { + text-shadow: 6upx 6upx 8upx rgba(114, 130, 138, 0.2); +} + +.text-shadow[class*="-gray"] { + text-shadow: 6upx 6upx 8upx rgba(114, 130, 138, 0.2); +} + +.text-shadow[class*="-black"] { + text-shadow: 6upx 6upx 8upx rgba(26, 26, 26, 0.2); +} + +.bg-img { + background-size: cover; + background-position: center; + background-repeat: no-repeat; +} + +.bg-mask { + background-color: #333333; + position: relative; +} + +.bg-mask::after { + content: ""; + border-radius: inherit; + width: 100%; + height: 100%; + display: block; + background-color: rgba(0, 0, 0, 0.4); + position: absolute; + left: 0; + right: 0; + bottom: 0; + top: 0; +} + +.bg-mask view, +.bg-mask cover-view { + z-index: 5; + position: relative; +} + +.bg-video { + position: relative; +} + +.bg-video video { + display: block; + height: 100%; + width: 100%; + -o-object-fit: cover; + object-fit: cover; + position: absolute; + top: 0; + z-index: 0; + pointer-events: none; +} + +/* ================== + 文本 + ==================== */ + +.text-xs { + font-size: 20upx; +} + +.text-sm { + font-size: 24upx; +} + +.text-df { + font-size: 28upx; +} + +.text-lg { + font-size: 32upx; +} + +.text-xl { + font-size: 36upx; +} + +.text-xxl { + font-size: 44upx; +} + +.text-sl { + font-size: 80upx; +} + +.text-xsl { + font-size: 120upx; +} + +.text-Abc { + text-transform: Capitalize; +} + +.text-ABC { + text-transform: Uppercase; +} + +.text-abc { + text-transform: Lowercase; +} + +.text-price::before { + content: "¥"; + font-size: 80%; + margin-right: 4upx; +} + +.text-cut { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.text-bold { + font-weight: bold; +} + +.text-center { + text-align: center; +} + +.text-content { + line-height: 1.6; +} + +.text-left { + text-align: left; +} + +.text-right { + text-align: right; +} + +.text-red, +.line-red, +.lines-red { + color: #e54d42; +} + +.text-orange, +.line-orange, +.lines-orange { + color: #f37b1d; +} + +.text-yellow, +.line-yellow, +.lines-yellow { + color: #fbbd08; +} + +.text-olive, +.line-olive, +.lines-olive { + color: #8dc63f; +} + +.text-green, +.line-green, +.lines-green { + color: #39b54a; +} + +.text-cyan, +.line-cyan, +.lines-cyan { + color: #1cbbb4; +} + +.text-blue, +.line-blue, +.lines-blue { + color: #0081ff; +} + +.text-purple, +.line-purple, +.lines-purple { + color: #6739b6; +} + +.text-mauve, +.line-mauve, +.lines-mauve { + color: #9c26b0; +} + +.text-pink, +.line-pink, +.lines-pink { + color: #e03997; +} + +.text-brown, +.line-brown, +.lines-brown { + color: #a5673f; +} + +.text-grey, +.line-grey, +.lines-grey { + color: #8799a3; +} + +.text-gray, +.line-gray, +.lines-gray { + color: #aaaaaa; +} + +.text-black, +.line-black, +.lines-black { + color: #333333; +} + +.text-white, +.line-white, +.lines-white { + color: #ffffff; +} \ No newline at end of file diff --git a/static/scss/global.scss b/static/scss/global.scss new file mode 100644 index 0000000..e69de29 diff --git a/static/scss/index.scss b/static/scss/index.scss new file mode 100644 index 0000000..745cffa --- /dev/null +++ b/static/scss/index.scss @@ -0,0 +1,6 @@ +// global +@import "./global.scss"; +// color-ui +@import "@/static/scss/colorui.css"; +// iconfont +@import "@/static/font/iconfont.css"; \ No newline at end of file diff --git a/store/$u.mixin.js b/store/$u.mixin.js deleted file mode 100644 index 283d88f..0000000 --- a/store/$u.mixin.js +++ /dev/null @@ -1,27 +0,0 @@ -import { mapState } from 'vuex' -import store from "@/store" - -// 尝试将用户在根目录中的store/index.js的vuex的state变量,全部加载到全局变量中 -let $uStoreKey = []; -try{ - $uStoreKey = store.state ? Object.keys(store.state) : []; -}catch(e){ - -} - -module.exports = { - created() { - // 将vuex方法挂在到$u中 - // 使用方法为:如果要修改vuex的state中的user.name变量为"史诗" => this.$u.vuex('user.name', '史诗') - // 如果要修改vuex的state的version变量为1.0.1 => this.$u.vuex('version', '1.0.1') - this.$u.vuex = (name, value) => { - this.$store.commit('$uStore', { - name,value - }) - } - }, - computed: { - // 将vuex的state中的所有变量,解构到全局混入的mixin中 - ...mapState($uStoreKey) - } -} diff --git a/store/getters.js b/store/getters.js new file mode 100644 index 0000000..8854794 --- /dev/null +++ b/store/getters.js @@ -0,0 +1,8 @@ +const getters = { + token: state => state.user.token, + avatar: state => state.user.avatar, + name: state => state.user.name, + roles: state => state.user.roles, + permissions: state => state.user.permissions +} +export default getters diff --git a/store/index.js b/store/index.js index 847c2c4..83a9db5 100644 --- a/store/index.js +++ b/store/index.js @@ -1,73 +1,15 @@ import Vue from 'vue' import Vuex from 'vuex' -Vue.use(Vuex) - -let lifeData = {}; - -try { - // 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的 - lifeData = uni.getStorageSync('lifeData'); -} catch (e) { +import user from '@/store/modules/user' +import getters from './getters' -} - -// 需要永久存储,且下次APP启动需要取出的,在state中的变量名 -let saveStateKeys = ['vuex_user', 'vuex_token']; +Vue.use(Vuex) -// 保存变量到本地存储中 -const saveLifeData = function(key, value) { - // 判断变量名是否在需要存储的数组中 - if (saveStateKeys.indexOf(key) != -1) { - // 获取本地存储的lifeData对象,将变量添加到对象中 - let tmp = uni.getStorageSync('lifeData'); - // 第一次打开APP,不存在lifeData变量,故放一个{}空对象 - tmp = tmp ? tmp : {}; - tmp[key] = value; - // 执行这一步后,所有需要存储的变量,都挂载在本地的lifeData对象中 - uni.setStorageSync('lifeData', tmp); - } -} const store = new Vuex.Store({ - // 下面这些值仅为示例,使用过程中请删除 - state: { - // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量 - // 加上vuex_前缀,是防止变量名冲突,也让人一目了然 - // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 - // vuex_version: '1.0.1', - vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '', - vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {}, - vuex_dept: '', - vuex_sex: [{ - label: '男', - value: 0 - }, { - label: '女', - value: 1 - }] - - }, - mutations: { - $uStore(state, payload) { - // 判断是否多层级调用,state中为对象存在的情况,诸如user.info.score = 1 - let nameArr = payload.name.split('.'); - let saveKey = ''; - let len = nameArr.length; - if (nameArr.length >= 2) { - let obj = state[nameArr[0]]; - for (let i = 1; i < len - 1; i++) { - obj = obj[nameArr[i]]; - } - obj[nameArr[len - 1]] = payload.value; - saveKey = nameArr[0]; - } else { - // 单层级变量,在state就是一个普通变量的情况 - state[payload.name] = payload.value; - saveKey = payload.name; - } - // 保存变量到本地,见顶部函数定义 - saveLifeData(saveKey, state[saveKey]) - } - } + modules: { + user + }, + getters }) -export default store \ No newline at end of file +export default store diff --git a/store/modules/user.js b/store/modules/user.js new file mode 100644 index 0000000..8fe0708 --- /dev/null +++ b/store/modules/user.js @@ -0,0 +1,113 @@ +import config from '@/config' +import storage from '@/utils/storage' +import constant from '@/utils/constant' +import { + login, + logout, + getInfo +} from '@/api/login' +import { + setToken, + removeToken, +} from '@/utils/auth' + +const baseUrl = config.baseUrl + +const user = { + state: { + id: 0, // 用户编号 + name: storage.get(constant.name), + avatar: storage.get(constant.avatar), + roles: storage.get(constant.roles), + permissions: storage.get(constant.permissions) + }, + + mutations: { + SET_ID: (state, id) => { + state.id = id + }, + SET_NAME: (state, name) => { + state.name = name + storage.set(constant.name, name) + }, + SET_AVATAR: (state, avatar) => { + state.avatar = avatar + storage.set(constant.avatar, avatar) + }, + SET_ROLES: (state, roles) => { + state.roles = roles + storage.set(constant.roles, roles) + }, + SET_PERMISSIONS: (state, permissions) => { + state.permissions = permissions + storage.set(constant.permissions, permissions) + } + }, + + actions: { + // 登录 + Login({ + commit + }, userInfo) { + return new Promise((resolve, reject) => { + login(userInfo).then(res => { + console.log('Login', res); + res = res.data; + // 设置 token + setToken(res) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + + // 获取用户信息 + GetInfo({ + commit, + state + }) { + return new Promise((resolve, reject) => { + getInfo().then(res => { + res = res.data; // 读取 data 数据 + const user = res.user + const avatar = (user == null || user.avatar === "" || user.avatar == null) ? require( + "@/static/images/avatar.jpg") : user.avatar + const nickname = (user == null || user.nickname === "" || user.nickname == null) ? "" : user + .nickname + if (res.roles && res.roles.length > 0) { + commit('SET_ROLES', res.roles) + commit('SET_PERMISSIONS', res.permissions) + } else { + commit('SET_ROLES', ['ROLE_DEFAULT']) + } + commit('SET_NAME', nickname) + commit('SET_AVATAR', avatar) + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, + + // 退出系统 + LogOut({ + commit, + state + }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_ROLES', []) + commit('SET_PERMISSIONS', []) + removeToken() + storage.clean() + resolve() + }).catch(error => { + reject(error) + }) + }) + } + } +} + +export default user \ No newline at end of file diff --git a/sub/owner/edit.vue b/sub/owner/edit.vue new file mode 100644 index 0000000..bf414df --- /dev/null +++ b/sub/owner/edit.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/uni.promisify.adaptor.js b/uni.promisify.adaptor.js deleted file mode 100644 index 5fec4f3..0000000 --- a/uni.promisify.adaptor.js +++ /dev/null @@ -1,13 +0,0 @@ -uni.addInterceptor({ - returnValue (res) { - if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) { - return res; - } - return new Promise((resolve, reject) => { - res.then((res) => { - if (!res) return resolve(res) - return res[0] ? reject(res[0]) : resolve(res[1]) - }); - }); - }, -}); \ No newline at end of file diff --git a/uni.scss b/uni.scss index ce8bc8d..5b70ec4 100644 --- a/uni.scss +++ b/uni.scss @@ -1,22 +1,7 @@ /** - * 这里是uni-app内置的常用样式变量 - * - * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 - * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App - * + * uni-app内置的常用样式变量 */ - -/** - * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 - * - * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 - */ - -/* uni.scss */ @import '@/uni_modules/uview-ui/theme.scss'; - -/* 颜色变量 */ - /* 行为相关颜色 */ $uni-color-primary: #007aff; $uni-color-success: #4cd964; @@ -24,32 +9,32 @@ $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: #333; //基本色 +$uni-text-color-inverse: #fff; //反色 +$uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息 $uni-text-color-placeholder: #808080; -$uni-text-color-disable:#c0c0c0; +$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-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-border-color: #e5e5e5; /* 尺寸变量 */ /* 文字尺寸 */ -$uni-font-size-sm:12px; -$uni-font-size-base:14px; -$uni-font-size-lg:16px; +$uni-font-size-sm: 12px; +$uni-font-size-base: 14px; +$uni-font-size-lg: 16px; /* 图片尺寸 */ -$uni-img-size-sm:20px; -$uni-img-size-base:26px; -$uni-img-size-lg:40px; +$uni-img-size-sm: 20px; +$uni-img-size-base: 26px; +$uni-img-size-lg: 40px; /* Border Radius */ $uni-border-radius-sm: 2px; @@ -71,9 +56,13 @@ $uni-spacing-col-lg: 12px; $uni-opacity-disabled: 0.3; // 组件禁用态的透明度 /* 文章场景相关 */ -$uni-color-title: #2C405A; // 文章标题颜色 -$uni-font-size-title:20px; +$uni-color-title: #2c405a; // 文章标题颜色 +$uni-font-size-title: 20px; $uni-color-subtitle: #555555; // 二级标题颜色 -$uni-font-size-subtitle:26px; -$uni-color-paragraph: #3F536E; // 文章段落颜色 -$uni-font-size-paragraph:15px; +$uni-font-size-subtitle: 26px; +$uni-color-paragraph: #3f536e; // 文章段落颜色 +$uni-font-size-paragraph: 15px; + +$cs-shadow-color: #eaeaea; +$cs-border-radius: 8px; +$cs-gap: 10px; diff --git a/uni_modules/s-components/s-header/index.vue b/uni_modules/s-components/s-header/index.vue new file mode 100644 index 0000000..73a230f --- /dev/null +++ b/uni_modules/s-components/s-header/index.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/uni_modules/s-components/s-tabber/index.vue b/uni_modules/s-components/s-tabber/index.vue new file mode 100644 index 0000000..b7ecdc1 --- /dev/null +++ b/uni_modules/s-components/s-tabber/index.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-slider/nvue - 鍓湰.js b/uni_modules/uview-ui/components/u-slider/nvue - 副本.js similarity index 100% rename from uni_modules/uview-ui/components/u-slider/nvue - 鍓湰.js rename to uni_modules/uview-ui/components/u-slider/nvue - 副本.js diff --git a/uni_modules/windi-css-uniapp/changelog.md b/uni_modules/windi-css-uniapp/changelog.md new file mode 100644 index 0000000..a92a0db --- /dev/null +++ b/uni_modules/windi-css-uniapp/changelog.md @@ -0,0 +1,6 @@ +## 0.1.0(2022-05-06) +文档修正 +## 0.0.8(2022-05-06) +文档增加插件市场下载方式安装使用,支持 `uni_modules` +## 0.0.7(2022-05-06) +第一次发布到插件市场 diff --git a/uni_modules/windi-css-uniapp/components/windi-css-uniapp/windi-css-uniapp.vue b/uni_modules/windi-css-uniapp/components/windi-css-uniapp/windi-css-uniapp.vue new file mode 100644 index 0000000..bcd3662 --- /dev/null +++ b/uni_modules/windi-css-uniapp/components/windi-css-uniapp/windi-css-uniapp.vue @@ -0,0 +1,15 @@ + + + + + + + diff --git a/uni_modules/windi-css-uniapp/index.scss b/uni_modules/windi-css-uniapp/index.scss new file mode 100644 index 0000000..4de8b4c --- /dev/null +++ b/uni_modules/windi-css-uniapp/index.scss @@ -0,0 +1,29 @@ +// 变量 +@import "./modules/vars.scss"; + +// 通用 +// 颜色 +@import "./modules/general/colors.scss"; +// 排版 +@import "./modules/general/typography.scss"; + +// 背景 +@import "./modules/backgrounds.scss"; + +// 边框 +@import "./modules/borders.scss"; + +// 特效 +@import "./modules/effects.scss"; + +// 布局 +// Display +@import "./modules/layout/display.scss"; +// Flexbox +@import "./modules/layout/flexbox.scss"; +// Positioning +@import "./modules/layout/positioning.scss"; +// 尺寸 +@import "./modules/layout/sizing.scss"; +// 间隔 +@import "./modules/layout/spacing.scss"; diff --git a/uni_modules/windi-css-uniapp/modules/backgrounds.scss b/uni_modules/windi-css-uniapp/modules/backgrounds.scss new file mode 100644 index 0000000..80e2158 --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/backgrounds.scss @@ -0,0 +1,118 @@ +/* #ifndef APP-NVUE */ +// 背景固定 +.#{$prefix}bg-fixed { + background-attachment: fixed; +} +.#{$prefix}bg-local { + background-attachment: local; +} +.#{$prefix}bg-scroll { + background-attachment: scroll; +} + +// 背景裁剪 +.#{$prefix}bg-clip-border { + background-clip: border-box; +} +.#{$prefix}bg-clip-padding { + background-clip: padding-box; +} +.#{$prefix}bg-clip-content { + background-clip: content-box; +} +/* #endif */ + +// 背景颜色 +.#{$prefix}bg-transparent { + background-color: transparent; +} +/* #ifndef APP-NVUE */ +.#{$prefix}bg-current { + background-color: currentColor; +} +/* #endif */ +.#{$prefix}bg-000, +.#{$prefix}bg-black { + background-color: #000; +} +.#{$prefix}bg-fff, +.#{$prefix}bg-white { + background-color: #fff; +} +@for $i from 1 through 9 { + .#{$prefix}bg-#{$i * 111} { + background-color: unquote("##{$i * 111}"); + } +} + +/* #ifndef APP-NVUE */ +// 背景颜色不透明度 + +// 背景图像位置 +.#{$prefix}bg-bottom { + background-position: bottom; +} +.#{$prefix}bg-center { + background-position: center; +} +.#{$prefix}bg-left { + background-position: left; +} +.#{$prefix}bg-left-bottom { + background-position: left bottom; +} +.#{$prefix}bg-left-top { + background-position: left top; +} +.#{$prefix}bg-right { + background-position: right; +} +.#{$prefix}bg-right-bottom { + background-position: right bottom; +} +.#{$prefix}bg-right-top { + background-position: right top; +} +.#{$prefix}bg-top { + background-position: top; +} + +// 背景图像重复 +.#{$prefix}bg-repeat { + background-repeat: repeat; +} +.#{$prefix}bg-repeat-x { + background-repeat: repeat-x; +} +.#{$prefix}bg-repeat-y { + background-repeat: repeat-y; +} +.#{$prefix}bg-repeat-round { + background-repeat: round; +} +.#{$prefix}bg-repeat-space { + background-repeat: space; +} + +// 背景图像大小 +.#{$prefix}bg-auto { + background-size: auto; +} +.#{$prefix}bg-cover { + background-size: cover; +} +.#{$prefix}bg-contain { + background-size: contain; +} + +// 背景图像原点 +.#{$prefix}bg-origin-border { + background-origin: border-box; +} +.#{$prefix}bg-origin-padding { + background-origin: padding-box; +} +.#{$prefix}bg-origin-content { + background-origin: content-box; +} +/* #endif */ \ No newline at end of file diff --git a/uni_modules/windi-css-uniapp/modules/borders.scss b/uni_modules/windi-css-uniapp/modules/borders.scss new file mode 100644 index 0000000..e8da244 --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/borders.scss @@ -0,0 +1,113 @@ +// 边框圆角 +.#{$prefix}rounded-none { + border-radius: 0px; +} +.#{$prefix}rounded-full { + border-radius: 9999px; +} +@for $i from 0 through 32 { + // border-radius: {0~32}px; + .#{$prefix}rounded-#{$i} { + border-radius: $i + px; + } +} +@for $i from 0 through 64 { + // border-radius: {0~64}rpx; + .#{$prefix}rounded-#{$i}r { + border-radius: $i + rpx; + } +} +@for $i from 0 through 100 { + // border-radius: {0~100}%; + .#{$prefix}rounded-#{$i}p { + border-radius: $i * 1%; + } +} + +// 边框宽度 {0~10} px || rpx +@for $i from 0 through 10 { + // border-width: {0~10}px; + .#{$prefix}border-#{$i} { + border-width: $i + px; + } + // border-top-width: {0~10}px; + .#{$prefix}border-top-#{$i} { + border-top-width: $i + px; + } + // border-right-width: {0~10}px; + .#{$prefix}border-right-#{$i} { + border-right-width: $i + px; + } + // border-bottom-width: {0~10}px; + .#{$prefix}border-bottom-#{$i} { + border-bottom-width: $i + px; + } + // border-left-width: {0~10}px; + .#{$prefix}border-left-#{$i} { + border-left-width: $i + px; + } +} +@for $i from 0 through 20 { + // border-width: {0~20}rpx; + .#{$prefix}border-#{$i}r { + border-width: $i + rpx; + } + // border-top-width: {0~20}rpx; + .#{$prefix}border-top-#{$i}r { + border-top-width: $i + rpx; + } + // border-right-width: {0~20}rpx; + .#{$prefix}border-right-#{$i}r { + border-right-width: $i + rpx; + } + // border-bottom-width: {0~20}rpx; + .#{$prefix}border-bottom-#{$i}r { + border-bottom-width: $i + rpx; + } + // border-left-width: {0~20}rpx; + .#{$prefix}border-left-#{$i}r { + border-left-width: $i + rpx; + } +} + +// 边框颜色 +.#{$prefix}border-transparent { + border-color: transparent; +} +/* #ifndef APP-NVUE */ +.#{$prefix}border-current { + border-color: currentColor; +} +/* #endif */ +.#{$prefix}border-fff, +.#{$prefix}border-white { + border-color: #fff; +} +.#{$prefix}border-000, +.#{$prefix}border-black { + border-color: #000; +} +@for $i from 1 through 9 { + .#{$prefix}border-#{$i * 111} { + border-color: unquote("##{$i * 111}"); + } +} + +// 边框样式 +.#{$prefix}border-solid { + border-style: solid; +} +.#{$prefix}border-dashed { + border-style: dashed; +} +.#{$prefix}border-dotted { + border-style: dotted; +} +/* #ifndef APP-NVUE */ +.#{$prefix}border-double { + border-style: double; +} +.#{$prefix}border-none { + border-style: none; +} +/* #endif */ diff --git a/uni_modules/windi-css-uniapp/modules/effects.scss b/uni_modules/windi-css-uniapp/modules/effects.scss new file mode 100644 index 0000000..4c9c268 --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/effects.scss @@ -0,0 +1,6 @@ +// Opacity +@for $i from 0 through 20 { + .#{$prefix}opacity-#{$i * 5} { + opacity: 0.05 * $i; + } +} diff --git a/uni_modules/windi-css-uniapp/modules/general/colors.scss b/uni_modules/windi-css-uniapp/modules/general/colors.scss new file mode 100644 index 0000000..e69de29 diff --git a/uni_modules/windi-css-uniapp/modules/general/typography.scss b/uni_modules/windi-css-uniapp/modules/general/typography.scss new file mode 100644 index 0000000..0085d9e --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/general/typography.scss @@ -0,0 +1,241 @@ +// Font Family +/* #ifndef APP-NVUE */ +.#{$prefix}font-sans { + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, + 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; +} +.#{$prefix}font-serif { + font-family: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif; +} +.#{$prefix}font-mono { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} +/* #endif */ + +// 字号 {8~100} px || rpx +@for $i from 8 through 48 { + // font-size: {8~48}px; + .#{$prefix}text-#{$i} { + font-size: $i + px; + } +} +@for $i from 8 through 96 { + // font-size: {8~96}rpx; + .#{$prefix}text-#{$i}r { + font-size: $i + rpx; + } +} + +// 字体平滑度 +/* #ifndef APP-NVUE */ +.#{$prefix}antialiased { + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.#{$prefix}subpixel-antialiased { + -webkit-font-smoothing: auto; + -moz-osx-font-smoothing: auto; +} +/* #endif */ + +// 字体样式 +.#{$prefix}italic { + font-style: italic; +} +.#{$prefix}not-italic { + font-style: normal; +} + +// 字体粗细 +.#{$prefix}font-thin { + font-weight: 100; +} +.#{$prefix}font-extralight { + font-weight: 200; +} +.#{$prefix}font-light { + font-weight: 300; +} +.#{$prefix}font-normal { + font-weight: 400; +} +.#{$prefix}font-medium { + font-weight: 500; +} +.#{$prefix}font-semibold { + font-weight: 600; +} +.#{$prefix}font-bold { + font-weight: 700; +} +.#{$prefix}font-extrabold { + font-weight: 800; +} +.#{$prefix}font-black { + font-weight: 900; +} +@for $i from 1 through 9 { + // font-weight: {100-900}; + .#{$prefix}font-#{$i * 100} { + font-weight: $i * 100; + } +} + +// 连字符 +/* #ifndef APP-NVUE */ +.#{$prefix}hyphens-none { + hyphens: none; +} +.#{$prefix}hyphens-manual { + hyphens: manual; +} +.#{$prefix}hyphens-auto { + hyphens: auto; +} +/* #endif */ + +// 行高 {8~100} px || rpx +@for $i from 8 through 48 { + .#{$prefix}leading-#{$i} { + line-height: $i + px; + } +} +@for $i from 8 through 96 { + .#{$prefix}leading-#{$i}r { + line-height: $i + rpx; + } +} + +// 文本对齐 +.#{$prefix}text-left { + text-align: left; +} +.#{$prefix}text-center { + text-align: center; +} +.#{$prefix}text-right { + text-align: right; +} +/* #ifndef APP-NVUE */ +.#{$prefix}text-justify { + text-align: justify; +} +/* #endif */ + +// 文本颜色 {000~999} +/* #ifndef APP-NVUE */ +.#{$prefix}text-transparent { + color: transparent; +} +.#{$prefix}text-current { + color: currentColor; +} +/* #endif */ +.#{$prefix}text-000, +.#{$prefix}text-black { + color: #000; +} +.#{$prefix}text-fff, +.#{$prefix}text-white { + color: #fff; +} +@for $i from 1 through 9 { + .#{$prefix}text-#{$i * 111} { + color: unquote('##{$i * 111}'); + } +} + +// 垂直对齐 +/* #ifndef APP-NVUE */ +.#{$prefix}align-baseline { + vertical-align: baseline; +} +.#{$prefix}align-top { + vertical-align: top; +} +.#{$prefix}align-middle { + vertical-align: middle; +} +.#{$prefix}align-bottom { + vertical-align: bottom; +} +.#{$prefix}align-text-top { + vertical-align: text-top; +} +.#{$prefix}align-text-bottom { + vertical-align: text-bottom; +} +/* #endif */ + +// 文本溢出 +.#{$prefix}truncate { + text-overflow: ellipsis; + /* #ifndef APP-NVUE */ + overflow: hidden; + -o-text-overflow: ellipsis; + /* #endif */ +} +.#{$prefix}overflow-ellipsis { + /* #ifndef APP-NVUE */ + -o-text-overflow: ellipsis; + /* #endif */ + text-overflow: ellipsis; +} +.#{$prefix}overflow-clip { + /* #ifndef APP-NVUE */ + overflow: clip; + /* #endif */ + /* #ifdef APP-NVUE */ + text-overflow: clip; + /* #endif */ +} + +// 行数 +@for $i from 1 through 8 { + .#{$prefix}lines-#{$i} { + /* #ifdef APP-NVUE */ + lines: $i; + /* #endif */ + /* #ifndef APP-NVUE */ + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: $i; + /* #endif */ + } +} + +// 空格 +/* #ifndef APP-NVUE */ +.#{$prefix}whitespace-normal { + white-space: normal; +} +.#{$prefix}whitespace-nowrap { + white-space: nowrap; +} +.#{$prefix}whitespace-pre { + white-space: pre; +} +.#{$prefix}whitespace-pre-line { + white-space: pre-line; +} +.#{$prefix}whitespace-pre-wrap { + white-space: pre-wrap; +} +/* #endif */ + +// 断字 +/* #ifndef APP-NVUE */ +.#{$prefix}break-normal { + // word-wrap: normal; + word-break: normal; + overflow-wrap: normal; +} +.#{$prefix}break-words { + overflow-wrap: break-word; + // word-wrap: break-word; +} +.#{$prefix}break-all { + // word-wrap: anywhere; + word-break: break-all; +} +/* #endif */ diff --git a/uni_modules/windi-css-uniapp/modules/layout/display.scss b/uni_modules/windi-css-uniapp/modules/layout/display.scss new file mode 100644 index 0000000..4803b76 --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/layout/display.scss @@ -0,0 +1,29 @@ +/* #ifndef APP-NVUE */ +// 块级元素 +.#{$prefix}block { + display: block; +} +// 行内块级元素 +.#{$prefix}inline-block { + display: inline-block; +} +// 行内元素 +.#{$prefix}inline { + display: inline; +} +// 内容 +.#{$prefix}contents { + display: contents; +} +// 隐藏 +.#{$prefix}hidden { + display: none; +} +// Visibility +.#{$prefix}visible { + visibility: visible; +} +.#{$prefix}invisible { + visibility: hidden; +} +/* #endif */ diff --git a/uni_modules/windi-css-uniapp/modules/layout/flexbox.scss b/uni_modules/windi-css-uniapp/modules/layout/flexbox.scss new file mode 100644 index 0000000..b6d9e32 --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/layout/flexbox.scss @@ -0,0 +1,82 @@ +// Flex +.#{$prefix}flex { + /* #ifndef APP-NVUE */ + display: flex !important; + /* #endif */ +} +.#{$prefix}flex-center { + /* #ifndef APP-NVUE */ + display: flex !important; + /* #endif */ + justify-content: center !important; + align-items: center !important; +} +// Flex Basis + +// 行内 Flex + +// Flex 方向 +.#{$prefix}flex-row { + flex-direction: row !important; +} +.#{$prefix}flex-row-reverse { + flex-direction: row-reverse !important; +} +.#{$prefix}flex-col { + flex-direction: column !important; +} +.#{$prefix}flex-col-reverse { + flex-direction: column-reverse !important; +} + +// Flex Wrap +.#{$prefix}flex-wrap { + flex-wrap: wrap !important; +} +.#{$prefix}flex-wrap-reverse { + flex-wrap: wrap-reverse !important; +} +.#{$prefix}flex-nowrap { + flex-wrap: nowrap !important; +} + +/* #ifndef APP-NVUE */ +// Flex Stretch +// .#{$prefix}flex-1 { +// flex: 1 1 0%; +// } +.#{$prefix}flex-auto { + flex: 1 1 auto; +} +.#{$prefix}flex-initial { + flex: 0 1 auto; +} +.#{$prefix}flex-none { + flex: none; +} +/* #endif */ + +// flex: {1~16} !important; +@for $i from 1 through 16 { + .#{$prefix}flex-#{$i} { + flex: $i !important; + } +} + +/* #ifndef APP-NVUE */ +// Flex Grow +.#{$prefix}flex-grow-0 { + flex-grow: 0; +} +.#{$prefix}flex-grow { + flex-grow: 1; +} + +// Flex Shrink +.#{$prefix}flex-shrink-0 { + flex-shrink: 0; +} +.#{$prefix}flex-shrink { + flex-shrink: 1; +} +/* #endif */ diff --git a/uni_modules/windi-css-uniapp/modules/layout/grid.scss b/uni_modules/windi-css-uniapp/modules/layout/grid.scss new file mode 100644 index 0000000..e69de29 diff --git a/uni_modules/windi-css-uniapp/modules/layout/positioning.scss b/uni_modules/windi-css-uniapp/modules/layout/positioning.scss new file mode 100644 index 0000000..1d92bde --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/layout/positioning.scss @@ -0,0 +1,360 @@ +/* #ifndef APP-NVUE */ +// Order +.#{$prefix}order-first { + order: -9999; +} +.#{$prefix}order-last { + order: 9999; +} +.#{$prefix}order-none { + order: 0; +} + +@for $i from 1 through 14 { + .#{$prefix}order-#{$i} { + order: $i; + } + .#{$prefix}-order-#{$i} { + order: $i * -1; + } +} +/* #endif */ + +// Justify Content +.#{$prefix}justify-start { + justify-content: flex-start !important; +} +.#{$prefix}justify-end { + justify-content: flex-end !important; +} +.#{$prefix}justify-center { + justify-content: center !important; +} +.#{$prefix}justify-between { + justify-content: space-between !important; +} +/* #ifndef APP-NVUE */ +.#{$prefix}justify-around { + justify-content: space-around; +} +.#{$prefix}justify-evenly { + justify-content: space-evenly; +} + +// Justify Items +.#{$prefix}justify-items-auto { + justify-items: auto; +} +.#{$prefix}justify-items-start { + justify-items: start; +} +.#{$prefix}justify-items-end { + justify-items: end; +} +.#{$prefix}justify-items-center { + justify-items: center; +} +.#{$prefix}justify-items-stretch { + justify-items: stretch; +} + +// Justify Self +.#{$prefix}justify-self-auto { + justify-self: auto; +} +.#{$prefix}justify-self-start { + justify-self: start; +} +.#{$prefix}justify-self-end { + justify-self: end; +} +.#{$prefix}justify-self-center { + justify-self: center; +} +.#{$prefix}justify-self-stretch { + justify-self: stretch; +} + +// Align Content +.#{$prefix}content-center { + align-content: center; +} +.#{$prefix}content-start { + align-content: flex-start; +} +.#{$prefix}content-end { + align-content: flex-end; +} +.#{$prefix}content-between { + align-content: space-between; +} +.#{$prefix}content-around { + align-content: space-around; +} +.#{$prefix}content-evenly { + align-content: space-evenly; +} +/* #endif */ + +// Align Items +.#{$prefix}items-start { + align-items: flex-start !important; +} +.#{$prefix}items-end { + align-items: flex-end !important; +} +.#{$prefix}items-center { + align-items: center !important; +} +/* #ifndef APP-NVUE */ +.#{$prefix}items-baseline { + align-items: baseline; +} +/* #endif */ +.#{$prefix}items-stretch { + align-items: stretch !important; +} + +/* #ifndef APP-NVUE */ +// Align Self +.#{$prefix}self-auto { + align-self: auto; +} +.#{$prefix}self-start { + align-self: flex-start; +} +.#{$prefix}self-end { + align-self: flex-end; +} +.#{$prefix}self-center { + align-self: center; +} +.#{$prefix}self-stretch { + align-self: stretch; +} + +// Place Content +.#{$prefix}place-content-center { + place-content: center; +} +.#{$prefix}place-content-start { + place-content: start; +} +.#{$prefix}place-content-end { + place-content: end; +} +.#{$prefix}place-content-between { + place-content: space-between; +} +.#{$prefix}place-content-around { + place-content: space-around; +} +.#{$prefix}place-content-evenly { + place-content: space-evenly; +} +.#{$prefix}place-content-stretch { + place-content: stretch; +} + +// Place Items +.#{$prefix}place-items-auto { + place-items: auto; +} +.#{$prefix}place-items-start { + place-items: start; +} +.#{$prefix}place-items-end { + place-items: end; +} +.#{$prefix}place-items-center { + place-items: center; +} +.#{$prefix}place-items-stretch { + place-items: stretch; +} + +// Place Self +.#{$prefix}place-self-auto { + place-self: auto; +} +.#{$prefix}place-self-start { + place-self: start; +} +.#{$prefix}place-self-end { + place-self: end; +} +.#{$prefix}place-self-center { + place-self: center; +} +.#{$prefix}place-self-stretch { + place-self: stretch; +} +/* #endif */ + +// Position +/* #ifndef APP-NVUE */ +.#{$prefix}static { + position: static; +} +/* #endif */ +.#{$prefix}fixed { + position: fixed !important; +} +.#{$prefix}absolute { + position: absolute !important; +} +.#{$prefix}relative { + position: relative !important; +} +.#{$prefix}sticky { + position: sticky !important; +} + +// Top / Right / Bottom / Left +// Inset +.#{$prefix}inset-0 { + top: 0px; + right: 0px; + bottom: 0px; + left: 0px; +} +.#{$prefix}inset-px { + top: 1px; + right: 1px; + bottom: 1px; + left: 1px; +} +/* #ifndef APP-NVUE */ +.#{$prefix}inset-auto { + top: auto; + right: auto; + bottom: auto; + left: auto; +} +/* #endif */ +.#{$prefix}inset-full { + top: 100%; + right: 100%; + bottom: 100%; + left: 100%; +} +@for $i from 0 through 50 { + // top: {0-50}px; + .#{$prefix}top-#{$i} { + top: $i + px; + } + // right: {0-50}px; + .#{$prefix}right-#{$i} { + right: $i + px; + } + // bottom: {0-50}px; + .#{$prefix}bottom-#{$i} { + bottom: $i + px; + } + // left: {0-50}px; + .#{$prefix}left-#{$i} { + left: $i + px; + } +} +@for $i from 1 through 100 { + // top: {0-100}rpx; + .#{$prefix}top-#{$i}r { + top: $i + rpx; + } + // right: {0-100}rpx; + .#{$prefix}right-#{$i}r { + right: $i + rpx; + } + // bottom: {0-100}rpx; + .#{$prefix}bottom-#{$i}r { + bottom: $i + rpx; + } + // left: {0-100}rpx; + .#{$prefix}left-#{$i}r { + left: $i + rpx; + } +} + +/* #ifndef APP-NVUE */ +// Floats +.#{$prefix}float-right { + float: right; +} +.#{$prefix}float-left { + float: left; +} +.#{$prefix}float-none { + float: none; +} + +// Clear +.#{$prefix}clear-right { + clear: right; +} +.#{$prefix}clear-left { + clear: left; +} +.#{$prefix}clear-both { + clear: both; +} +.#{$prefix}clear-none { + clear: none; +} + +// Object Fit +.#{$prefix}object-contain { + object-fit: contain; +} +.#{$prefix}object-cover { + object-fit: cover; +} +.#{$prefix}object-fill { + object-fit: fill; +} +.#{$prefix}object-none { + object-fit: none; +} +.#{$prefix}object-scale-down { + object-fit: scale-down; +} + +// Object Position +.#{$prefix}object-bottom { + object-position: bottom; +} +.#{$prefix}object-center { + object-position: center; +} +.#{$prefix}object-left { + object-position: left; +} +.#{$prefix}object-left-bottom { + object-position: left bottom; +} +.#{$prefix}object-left-top { + object-position: left top; +} +.#{$prefix}object-right { + object-position: right; +} +.#{$prefix}object-right-bottom { + object-position: right bottom; +} +.#{$prefix}object-right-top { + object-position: right top; +} +.#{$prefix}object-top { + object-position: top; +} + +// Z-Index +.#{$prefix}z-auto { + z-index: auto; +} +/* #endif */ + +@for $i from 0 through 16 { + .#{$prefix}z-#{$i} { + z-index: $i !important; + } +} diff --git a/uni_modules/windi-css-uniapp/modules/layout/sizing.scss b/uni_modules/windi-css-uniapp/modules/layout/sizing.scss new file mode 100644 index 0000000..6622235 --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/layout/sizing.scss @@ -0,0 +1,77 @@ +@for $i from 0 through 750 { + // width: {0~750}rpx; + .#{$prefix}w-#{$i}r { + width: $i + rpx; + } + // min-width: {0~750}rpx; + // .#{$prefix}min-w-#{$i}r { + // min-width: $i + rpx; + // } + // max-width: {0~750}rpx; + // .#{$prefix}max-w-#{$i}r { + // max-width: $i + rpx; + // } + + // height: {0~750}rpx; + .#{$prefix}h-#{$i}r { + height: $i + rpx; + } + // min-height: {0~750}rpx; + // .#{$prefix}min-h-#{$i}r { + // min-height: $i + rpx; + // } + // max-height: {0~750}rpx; + // .#{$prefix}max-h-#{$i}r { + // max-height: $i + rpx; + // } +} + +@for $i from 0 through 500 { + // width: {0~500}px; + .#{$prefix}w-#{$i} { + width: $i + px; + } + // min-width: {0~500}px; + // .#{$prefix}min-w-#{$i} { + // min-width: $i + px; + // } + // max-width: {0~500}px; + // .#{$prefix}max-w-#{$i} { + // max-width: $i + px; + // } + + // height: {0~500}px; + .#{$prefix}h-#{$i} { + height: $i + px; + } + // min-height: {0~500}px; + // .#{$prefix}min-h-#{$i} { + // min-height: $i + px; + // } + // max-height: {0~500}px; + // .#{$prefix}max-h-#{$i} { + // max-height: $i + px; + // } +} + +/* #ifndef APP-NVUE */ +@for $i from 0 through 100 { + // width: {0~100}%; + .#{$prefix}w-#{$i}p { + width: $i * 1%; + } + + // height: {0~100}%; + .#{$prefix}h-#{$i}p { + height: $i * 1%; + } +} + +// Box Sizing +.#{$prefix}box-border { + box-sizing: border-box; +} +.#{$prefix}box-content { + box-sizing: content-box; +} +/* #endif */ diff --git a/uni_modules/windi-css-uniapp/modules/layout/spacing.scss b/uni_modules/windi-css-uniapp/modules/layout/spacing.scss new file mode 100644 index 0000000..a58b951 --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/layout/spacing.scss @@ -0,0 +1,129 @@ +// Padding +@for $i from 0 through 100 { + // padding-top (0~100)px + .#{$prefix}pt-#{$i} { + padding-top: $i + px; + } + // padding-right (0~100)px + .#{$prefix}pr-#{$i} { + padding-right: $i + px; + } + // padding-bottom (0~100)px + .#{$prefix}pb-#{$i} { + padding-bottom: $i + px; + } + // padding-left (0~100)px + .#{$prefix}pl-#{$i} { + padding-left: $i + px; + } + // padding (0~100)px + .#{$prefix}p-#{$i} { + padding: $i + px; + } + .#{$prefix}px-#{$i} { + padding-right: $i + px; + padding-left: $i + px; + } + .#{$prefix}py-#{$i} { + padding-top: $i + px; + padding-bottom: $i + px; + } +} +@for $i from 1 through 200 { + // padding-top (1~200)rpx + .#{$prefix}pt-#{$i}r { + padding-top: $i + rpx; + } + // padding-right (1~200)rpx + .#{$prefix}pr-#{$i}r { + padding-right: $i + rpx; + } + // padding-bottom (1~200)rpx + .#{$prefix}pb-#{$i}r { + padding-bottom: $i + rpx; + } + // padding-left (1~200)rpx + .#{$prefix}pl-#{$i}r { + padding-left: $i + rpx; + } + // padding (1~200)rpx + .#{$prefix}p-#{$i}r { + padding: $i + rpx; + } + .#{$prefix}px-#{$i}r { + padding-right: $i + rpx; + padding-left: $i + rpx; + } + .#{$prefix}py-#{$i}r { + padding-top: $i + rpx; + padding-bottom: $i + rpx; + } +} + +// Margin +@for $i from 0 through 100 { + // margin-top (0~100)px + .#{$prefix}mt-#{$i} { + margin-top: $i + px; + } + // margin-right (0~100)px + .#{$prefix}mr-#{$i} { + margin-right: $i + px; + } + // margin-bottom (0~100)px + .#{$prefix}mb-#{$i} { + margin-bottom: $i + px; + } + // margin-left (0~100)px + .#{$prefix}ml-#{$i} { + margin-left: $i + px; + } + // margin (0~100)px + .#{$prefix}m-#{$i} { + margin: $i + px; + } + .#{$prefix}mx-#{$i} { + margin-right: $i + px; + margin-left: $i + px; + } + .#{$prefix}my-#{$i} { + margin-top: $i + px; + margin-bottom: $i + px; + } +} +@for $i from 1 through 200 { + // margin-top (1~200)rpx + .#{$prefix}mt-#{$i}r { + margin-top: $i + rpx; + } + // margin-right (1~200)rpx + .#{$prefix}mr-#{$i}r { + margin-right: $i + rpx; + } + // margin-bottom (1~200)rpx + .#{$prefix}mb-#{$i}r { + margin-bottom: $i + rpx; + } + // margin-left (1~200)rpx + .#{$prefix}ml-#{$i}r { + margin-left: $i + rpx; + } + // margin (1~200)rpx + .#{$prefix}m-#{$i}r { + margin: $i + rpx; + } + .#{$prefix}mx-#{$i}r { + margin-right: $i + rpx; + margin-left: $i + rpx; + } + .#{$prefix}my-#{$i}r { + margin-top: $i + rpx; + margin-bottom: $i + rpx; + } +} +/* #ifndef APP-NVUE */ +.#{$prefix}mx-auto { + margin-right: auto; + margin-left: auto; +} +/* #endif */ diff --git a/uni_modules/windi-css-uniapp/modules/vars.scss b/uni_modules/windi-css-uniapp/modules/vars.scss new file mode 100644 index 0000000..2e2865d --- /dev/null +++ b/uni_modules/windi-css-uniapp/modules/vars.scss @@ -0,0 +1 @@ +$prefix: 'wd-'; diff --git a/uni_modules/windi-css-uniapp/package.json b/uni_modules/windi-css-uniapp/package.json new file mode 100644 index 0000000..79f866c --- /dev/null +++ b/uni_modules/windi-css-uniapp/package.json @@ -0,0 +1,97 @@ +{ + "name": "@limm/windi-css-uni", + "displayName": "windi-css-uni", + "version": "0.1.0", + "description": "wind-css 风格的 css 库。专为 uni-app 打造。", + "keywords": [ + "css", + "windicss", + "uni-app" +], + "homepage": "https://github.com/SunSeekerX/uni-app-starter/tree/main/packages/windi-css-uni", + "bugs": { + "url": "https://github.com/SunSeekerX/uni-app-starter/issues" + }, + "repository": "https://github.com/SunSeekerX/uni-app-starter/tree/main/packages/windi-css-uni", + "license": "UNLICENSED", + "author": "SunSeekerX", + "main": "src/index.scss", + "scripts": { + "build": "sass --no-source-map --no-charset --style=compressed src/index.scss:dist/output.css", + "dev": "sass --no-source-map --no-charset --watch src/index.scss:dist/output.css", + "gc": "git add -A && git-cz && git pull && git push", + "pkg:sort": "npx sort-package-json", + "pub": "npm publish --access public" + }, + "engines": { + "HBuilderX": "^3.1.12" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "1647800606" + }, + "declaration": { + "ads": "无", + "data": "插件不采集任何数据", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@limm/windi-css-uni" + }, + "id": "windi-css-uniapp", + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + } + } + } + } +} diff --git a/uni_modules/windi-css-uniapp/readme.md b/uni_modules/windi-css-uniapp/readme.md new file mode 100644 index 0000000..e68a40d --- /dev/null +++ b/uni_modules/windi-css-uniapp/readme.md @@ -0,0 +1,514 @@ +# windi-css-uni + +## 1️⃣ 简介 + +Github:[https://github.com/SunSeekerX/uni-app-starter/tree/main/packages/windi-css-uni](https://github.com/SunSeekerX/uni-app-starter/tree/main/packages/windi-css-uni) + +这是一些 css 的简写类名的库,用于快速开发 uni-app。适用于 vue+nvue 文件。类名的设计参考了 [windicss](https://github.com/windicss/windicss) 的类名。 + +大部分效果可以参考 [https://cn.windicss.org/guide/](https://cn.windicss.org/guide/) 预览。 + +在写代码的过程中,写 css 是非常头疼的事情,例如: + +1. **命名**;这应该是所有程序员的痛。 +2. **写 dom 不能直接写 css**;html 和 css 通常不在一块,需要滑动很长才能找到 css 定义的地方。 +3. **很多重复定义**;像 `diaplay: flex;` 这样的代码在 css 中写了太多太多 + +缺点也很明显 + +1. **增加了一些项目根本没有用到的 css 类** +2. **可读性不好** +3. **有一定的学习成本和记忆成本** + +有舍有得,自行取舍。 + +## 2️⃣ 快速上手 + +### 安装 + +**npm** + +```bash +npm i @limm/windi-css-uni +# or +yarn add @limm/windi-css-uni +``` + +**插件市场** + +插件市场地址:[https://ext.dcloud.net.cn/plugin?name=windi-css-uniapp](https://ext.dcloud.net.cn/plugin?name=windi-css-uniapp) + +### 导入 + +~~推荐全部引入,开启 `treeshaking` 会自动裁剪没有用到的类~~,截至目前,css 裁剪没有方案。 + +`${app}/App.vue` style 标签最上方导入 + +```scss +// npm 下载 +@import '@limm/windi-css-uni'; + +// npm 下载 - 如果使用了 stylelint +@import '@limm/windi-css-uni/src/index.scss'; + +// 如果是插件市场导入的 +@import '@/uni_modules/windi-css-uniapp/index.scss'; +``` + +**关于大小** + +全部压缩之后大概 258KB 左右大小。nvue 下应该不到 200KB。 + +### 使用 + +在下面列出的类名前增加 `wd-` 这是全局的前缀,为了防止和其他库或者你自己定义的样式冲突。 + +```html + + {{ item.name }} + +``` + +## 4️⃣ class + +### 通用 + +#### 排版 + +| | 样式参考 | 说明 | +| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | ---------- | +| **Font Family** | | | +| font-sans | | !nvue | +| font-serif | | !nvue | +| font-mono | | !nvue | +| | | | +| **font-size** | | | +| text-{8~48} | font-size: {8-48}px; | | +| text-{8~96}r | font-size: {8-96}rpx; | | +| | | | +| **字体平滑度** | | | +| antialiased | -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; | !nvue | +| subpixel-antialiased | -webkit-font-smoothing: auto;
-moz-osx-font-smoothing: auto; | !nvue | +| | | | +| **font-style** | | | +| italic | font-style: italic; | | +| not-italic | font-style: normal; | | +| | | | +| **font-weight** | | | +| font-{100-900} | font-weight: {100-900}; | 步长为 100 | +| | | | +| **连字符** | | | +| hyphens-none | hyphens: none; | !nvue | +| hyphens-manual | hyphens: manual; | !nvue | +| hyphens-auto | hyphens: auto; | !nvue | +| | | | +| **行高** | | | +| leading-{8-48} | line-height: {8-48}px; | | +| leading-{8-96}r | line-height: {8-96}rpx; | | +| | | | +| **文本对齐** | | | +| text-left | text-align: left; | | +| text-center | text-align: center; | | +| text-right | text-align: right; | | +| text-justify | text-align: justify; | !nvue | +| | | | +| **文本颜色** | | | +| text-transparent | color: transparent; | !nvue | +| text-current | color: currentColor; | !nvue | +| text-000
text-black | color: #000; | | +| text-fff
text-white | color: #fff; | | +| text-{100~900} | color: #{111-999}; | 步长为 111 | +| | | | +| **垂直对齐** | | | +| align-baseline | vertical-align: baseline; | !nvue | +| align-top | vertical-align: top; | !nvue | +| align-middle | vertical-align: middle; | !nvue | +| align-bottom | vertical-align: bottom; | !nvue | +| align-text-top | vertical-align: text-top; | !nvue | +| align-text-bottom | vertical-align: text-bottom; | !nvue | +| | | | +| **文本溢出** | | | +| truncate | text-overflow: ellipsis;
!nvue
overflow: hidden;
-o-text-overflow: ellipsis; | | +| overflow-ellipsis | text-overflow: ellipsis;
!nvue
-o-text-overflow: ellipsis; | | +| overflow-clip | !nvue
overflow: clip;
nvue
text-overflow: clip; | | +| | | | +| **行数** | | | +| lines-{1~8} | nvue
lines: {1~8};
!nvue
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: {1~8}; | | +| | | | +| **空格** | | | +| whitespace-normal | white-space: normal; | !nvue | +| whitespace-nowrap | white-space: nowrap; | !nvue | +| whitespace-pre | white-space: pre; | !nvue | +| whitespace-pre-line | white-space: pre-line; | !nvue | +| whitespace-pre-wrap | white-space: pre-wrap; | !nvue | +| | | | +| **断字** | | | +| break-normal | overflow-wrap: normal;
word-break: normal; | !nvue | +| break-words | overflow-wrap: break-word; | !nvue | +| break-all | !nvue: word-break: break-all; | !nvue | + +### 背景 + +| | 样式参考 | 说明 | +| -------------------- | ---------------------------------- | ---------- | +| **背景固定** | | | +| bg-fixed | background-attachment: fixed; | !nvue | +| bg-local | background-attachment: local; | !nvue | +| bg-scroll | background-attachment: scroll; | !nvue | +| | | | +| **背景裁剪** | | | +| bg-clip-border | background-clip: border-box; | !nvue | +| bg-clip-padding | background-clip: padding-box; | !nvue | +| bg-clip-content | background-clip: content-box; | !nvue | +| | | | +| **背景颜色** | | | +| bg-transparent | background-color: transparent; | | +| bg-current | background-color: currentColor; | !nvue | +| bg-fff
bg-white | background-color: #fff; | | +| bg-000
bg-black | background-color: #000; | | +| bg-{111-999} | background-color: #{111-999}; | 步长为 111 | +| | | | +| **背景图像位置** | | | +| bg-bottom | background-position: bottom; | !nvue | +| bg-center | background-position: center; | !nvue | +| bg-left | background-position: left; | !nvue | +| bg-left-bottom | background-position: left bottom; | !nvue | +| bg-left-top | background-position: left top; | !nvue | +| bg-right | background-position: right; | !nvue | +| bg-right-bottom | background-position: right bottom; | !nvue | +| bg-right-top | background-position: right top; | !nvue | +| bg-top | background-position: top; | !nvue | +| | | | +| **背景图像重复** | | | +| bg-repeat | background-repeat: repeat; | !nvue | +| bg-repeat-x | background-repeat: repeat-x; | !nvue | +| bg-repeat-y | background-repeat: repeat-y; | !nvue | +| bg-repeat-round | background-repeat: round; | !nvue | +| bg-repeat-space | background-repeat: space; | !nvue | +| | | | +| **背景图像大小** | | | +| bg-auto | background-size: auto; | !nvue | +| bg-cover | background-size: cover; | !nvue | +| bg-contain | background-size: contain; | !nvue | +| | | | +| **背景图像原点** | | | +| bg-origin-border | background-origin: border-box; | !nvue | +| bg-origin-padding | background-origin: padding-box; | !nvue | +| bg-origin-content | background-origin: content-box; | !nvue | + +### 边框 + +| | 样式参考 | 说明 | +| ---------------------------- | ------------------------------- | ----- | +| **边框圆角** | | | +| rounded-none | border-radius: 0px; | | +| rounded-full | border-radius: 9999px; | | +| rounded-{0~32} | border-radius: {0~32}px; | | +| rounded-{0~64}r | border-radius: {0~64}rpx; | | +| rounded-{0~100}p | border-radius: {0~100}%; | | +| | | | +| **边框宽度** | | | +| border-{0-10} | border-width: {0-10}px; | | +| border-{0-20}r | border-width: {0-20}rpx; | | +| border-top-{0-10} | border-top-width: {0-10}px; | | +| border-top-{0-20}r | border-top-width: {0-20}rpx; | | +| border-right-{0-10} | border-right-width: {0-10}px; | | +| border-right-{0-20}r | border-right-width: {0-20}rpx; | | +| border-bottom-{0-10} | border-bottom-width: {0-10}px; | | +| border-bottom-{0-20}r | border-bottom-width: {0-20}rpx; | | +| border-left-{0-10} | border-left-width: {0-10}px; | | +| border-left-{0-20}r | border-left-width: {0-20}rpx; | | +| | | | +| **边框颜色** | | | +| border-transparent | border-color: transparent; | | +| border-current | border-color: currentColor; | !nvue | +| border-fff
border-white | border-color: #fff; | | +| border-000
border-black | border-color: #000; | | +| border-{111-999} | border-color: #{111-999}; | | +| | | | +| **边框样式** | | | +| border-solid | border-style: solid; | | +| border-dashed | border-style: dashed; | | +| border-dotted | border-style: dotted; | | +| border-double | border-style: double; | !nvue | +| border-none | border-style: none; | !nvue | + +### 特效 + +| | **样式参考** | 说明 | +| --------------- | ----------------- | -------- | +| **Opacity** | | | +| opacity-{0~100} | opacity: {0~100}; | 步长为 5 | + +### 布局 + +#### Display + +| | **样式参考** | 说明 | +| ------------ | ---------------------- | ----- | +| **块级元素** | | | +| block | display: block; | !nvue | +| inline-block | display: inline-block; | !nvue | +| inline | display: inline; | !nvue | +| contents | display: contents; | !nvue | +| hidden | display: none; | !nvue | +| visible | visibility: visible; | !nvue | +| invisible | visibility: hidden; | !nvue | + +#### Flexbox + +| | **样式参考** | 说明 | +| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | +| **Flex** | | | +| flex | display: flex !important; | !nvue | +| flex-center | nvue:
justify-content: center !important;
align-items: center !important;
!nvue:
display: flex !important;
justify-content: center !important;
align-items: center !important; | | +| | | | +| **Flex 方向** | | | +| flex-row | flex-direction: row !important; | | +| flex-row-reverse | flex-direction: row-reverse !important; | | +| flex-col | flex-direction: column !important; | | +| flex-col-reverse | flex-direction: column-reverse !important; | | +| | | | +| **Flex Wrap** | | | +| flex-wrap | flex-wrap: wrap !important; | | +| flex-wrap-reverse | flex-wrap: wrap-reverse !important; | | +| flex-nowrap | flex-wrap: nowrap !important; | | +| | | | +| **Flex Stretch** | | | +| flex-auto | flex: 1 1 auto; | !nvue | +| flex-initial | flex: 0 1 auto; | !nvue | +| flex-none | flex: none; | !nvue | +| flex-{1~16} | flex: {1-16} !important; | | +| | | | +| **Flex Grow** | | | +| flex-grow-0 | flex-grow: 0; | !nvue | +| flex-grow | flex-grow: 1; | !nvue | +| | | | +| **Flex Shrink** | | | +| flex-shrink-0 | flex-shrink: 0; | !nvue | +| flex-shrink | flex-shrink: 1; | !nvue | + +#### Posiioning + +| | **样式参考** | 说明 | +| ------------------------------- | ---------------------------------------------------------------- | ----- | +| | | | +| **Order** | | | +| order-first | order: -9999; | !nvue | +| order-last | order: 9999; | !nvue | +| order-none | order: 0; | !nvue | +| order-{0~16} | order: {0~16}; | !nvue | +| | | | +| **Justify Content** | | | +| justify-start | justify-content: flex-start !important; | | +| justify-end | justify-content: flex-end;!important | | +| justify-center | justify-content: center !important; | | +| justify-between | justify-content: space-between !important; | | +| justify-around | justify-content: space-around; | !nvue | +| justify-evenly | justify-content: space-evenly; | !nvue | +| | | | +| **Justify Items** | | | +| justify-items-auto | justify-items: auto; | | +| justify-items-start | justify-items: start; | | +| justify-items-end | justify-items: end; | | +| justify-self-center | justify-self: center; | | +| justify-self-stretch | justify-self: stretch; | | +| | | | +| **Align Items** | | | +| items-start | align-items: flex-start !important; | | +| items-end | align-items: flex-end;!important | | +| items-center | align-items: center;!important | | +| items-baseline | align-items: baseline; | !nvue | +| items-stretch | align-items: stretch !important; | | +| | | | +| **Align Self** | | | +| self-auto | align-self: auto; | !nvue | +| self-start | align-self: flex-start; | !nvue | +| self-end | align-self: flex-end; | !nvue | +| self-center | align-self: center; | !nvue | +| self-stretch | align-self: stretch; | !nvue | +| | | | +| **Place Content** | | | +| place-content-center | place-content: center; | !nvue | +| place-content-start | place-content: start; | !nvue | +| place-content-end | place-content: end; | !nvue | +| place-content-between | place-content: space-between; | !nvue | +| place-content-around | place-content: space-around; | !nvue | +| place-content-evenly | place-content: space-evenly; | !nvue | +| place-content-stretch | place-content: stretch; | !nvue | +| | | | +| **Place Items** | | | +| place-items-auto | place-items: auto; | !nvue | +| place-items-start | place-items: start; | !nvue | +| place-items-end | place-items: end; | !nvue | +| place-items-center | place-items: center; | !nvue | +| place-items-stretch | place-items: stretch; | !nvue | +| | | | +| **Place Self** | | | +| place-self-auto | place-self: auto; | !nvue | +| place-self-start | place-self: start; | !nvue | +| place-self-end | place-self: end; | !nvue | +| place-self-center | place-self: center; | !nvue | +| place-self-stretch | place-self: stretch; | !nvue | +| | | | +| **Position** | | | +| static | position: static; | !nvue | +| fixed | position: fixed !important; | | +| absolute | position: absolute !important; | | +| relative | position: relative !important; | | +| sticky | position: sticky !important; | | +| | | | +| **Top / Right / Bottom / Left** | | | +| inset-0 | top: 0px;
right: 0px;
bottom: 0px;
left: 0px; | | +| inset-px | top: 1px;
right: 1px;
bottom: 1px;
left: 1px; | | +| inset-auto | top: auto;
right: auto;
bottom: auto;
left: auto; | | +| inset-full | top: 100%;
right: 100%;
bottom: 100%;
left: 100%; | | +| top-{0-50} | top: {0-50}px; | | +| top-{1-100}r | top: {1-100}rpx; | | +| right-{0-50} | right: {0-50}px; | | +| right-{1-100}r | right: {1-100}rpx; | | +| bottom-{0-50} | bottom: {0-50}px; | | +| bottom-{1-100}r | bottom: {1-100}rpx; | | +| left-{0-50} | left: {0-50}px; | | +| left-{1-100}r | left: {1-100}rpx; | | +| | | | +| **Floats** | | | +| float-right | float: right; | !nvue | +| float-left | float: left; | !nvue | +| float-none | float: none; | !nvue | +| | | | +| **Clear** | | | +| clear-right | clear: right; | !nvue | +| clear-left | clear: left; | !nvue | +| clear-both | clear: both; | !nvue | +| clear-none | clear: none; | !nvue | +| | | | +| **Object Fit** | | | +| object-contain | object-fit: contain; | !nvue | +| object-cover | object-fit: cover; | !nvue | +| object-fill | object-fit: fill; | !nvue | +| object-none | object-fit: none; | !nvue | +| object-scale-down | object-fit: scale-down; | !nvue | +| | | | +| **Object Position** | | | +| object-bottom | object-position: bottom; | !nvue | +| object-center | object-position: center; | !nvue | +| object-left | object-position: left; | !nvue | +| object-left-bottom | object-position: left bottom; | !nvue | +| object-left-top | object-position: left top; | !nvue | +| object-right | object-position: right; | !nvue | +| object-right-bottom | object-position: right bottom; | !nvue | +| object-right-top | object-position: right top; | !nvue | +| object-top | object-position: top; | !nvue | +| | | | +| **Z-Index** | | | +| z-auto | z-index: auto; | !nvue | +| z-{0~16} | z-index: {0~16} !important; | | + +#### 尺寸 + +| | **样式参考** | 说明 | +| -------------- | ------------------------ | ---- | +| **width** | | | +| w-{0~750}r | width: {0~750}rpx; | | +| w-{0~500} | width: {0~500}px; | | +| w-{0~100}p | width: {0~100}%; | | +| | | | +| **height** | | | +| h-{0~750}r | height: {0~750}rpx; | | +| h-{0~500} | height: {0~500}px; | | +| h-{0~100}p | height: {0~100}%; | | +| | | | +| **Box Sizing** | | | +| box-border | box-sizing: border-box; | | +| box-content | box-sizing: content-box; | | + +### 间隔 + +| | **样式参考** | 说明 | +| ----------- | ----------------------------------------------------------- | ---- | +| **Padding** | | | +| pt-{0~100} | padding-top: {0~100}px; | | +| pt-{1~200}r | padding-top: {1~200}rpx; | | +| pr-{0~100} | padding-right: {0~100}px; | | +| pr-{1~200}r | padding-right: {1~200}rpx; | | +| pb-{0~100} | padding-bottom: {0~100}px; | | +| pb-{1~200}r | padding-bottom: {1~200}rpx; | | +| pl-{0~100} | padding-left: {0~100}px; | | +| pl-{1~200}r | padding-left: {1~200}rpx; | | +| p-{0-100} | padding: {0~100}px; | | +| p-{1-200}r | padding: {1~200}rpx; | | +| px-{0-100} | padding-right: {0\~100}px;
padding-left: {0\~100}px; | | +| px-{1-200}r | padding-right: {1\~200}rpx;
padding-left: {1\~200}rpx; | | +| py-{0-100} | padding-top: {0\~100}px;
padding-bottom: {0\~100}px; | | +| py-{1-200}r | padding-top: {1\~200}rpx;
padding-bottom: {1\~200}rpx; | | +| | | | +| **Margin** | | | +| mt-{0~100} | margin-top: {0~100}px; | | +| mt-{1~200}r | margin-top: {1~200}rpx; | | +| mr-{0~100} | margin-right: {0~100}px; | | +| mr-{1~200}r | margin-right: {1~200}rpx; | | +| mb-{0~100} | margin-bottom: {0~100}px; | | +| mb-{1~200}r | margin-bottom: {1~200}rpx; | | +| ml-{0~100} | margin-left: {0~100}px; | | +| ml-{1~200}r | margin-left: {1~200}rpx; | | +| m-{0-100} | margin: {0~100}px; | | +| m-{1-200}r | margin: {1~200}rpx; | | +| mx-{0-100} | margin-right: {0\~100}px;
margin-left: {0\~100}px; | | +| mx-{1-200}r | margin-right: {1\~200}rpx;
margin-left: {1\~200}rpx; | | +| my-{0-100} | margin-top: {0\~100}px;
margin-bottom: {0\~100}px; | | +| my-{1-200}r | margin-top: {1\~200}rpx;
margin-bottom: {1\~200}rpx; | | +| mx-auto | margin-right: auto;
margin-left: auto; | | + +## 5️⃣ 问题? + +1. 为什么没有 `max-width` 、`min-width`、`max-height`、`min-height` 等类? + + 付出 > 收益,性价比不高,项目中用到的地方不多。增加之后文件增大了 100 多 kb。没有必要。 + +## 6️⃣ 更新日志(CHANGELOG) + +### 0.1.0 + +- 文档修正 + +### 0.0.8 + +- 文档增加插件市场下载方式安装使用,支持 `uni_modules` + +### 0.0.7 + +- 移除 nvue 下的断字相关的类,避免警告 + - break-normal + - break-words + - break-all + +### 0.0.6 + +- 文档颜色描述修正 + +### 0.0.5 + +- 修正文本溢出行数无效 + +### 0.0.4 + +- 增加文本溢出功能类 +- 增加 nvue 下 lines-{1~8} 功能类 + +### 0.0.3 + +- 文档颜色描述修正 +- 增加边框颜色 border-black +- 增加边框颜色 border-{000~999} + +### 0.0.2 + +- 增加背景色 bg-{000~999} +- 增加背景色 bg-black +- 增加文字颜色 text-fff、text-white +- 增加文字颜色 text-black + +### 0.0.1 + +- 第一个可用版本 diff --git a/utils/auth.js b/utils/auth.js new file mode 100644 index 0000000..a823da0 --- /dev/null +++ b/utils/auth.js @@ -0,0 +1,34 @@ +const AccessTokenKey = 'ACCESS_TOKEN' +const RefreshTokenKey = 'REFRESH_TOKEN' +const OpenIdKey = "OPEN_ID" +// ========== Token 相关 ========== + +export function getAccessToken() { + return uni.getStorageSync(AccessTokenKey) +} + +export function getRefreshToken() { + return uni.getStorageSync(RefreshTokenKey) +} + +export function setToken(token) { + uni.setStorageSync(AccessTokenKey, token.accessToken) + uni.setStorageSync(RefreshTokenKey, token.refreshToken) +} + +export function removeToken() { + uni.removeStorageSync(AccessTokenKey) + uni.removeStorageSync(RefreshTokenKey) +} + +export function setOpenId(openId) { + uni.setStorageSync(OpenIdKey, openId) +} + +export function getOpenId() { + return uni.getStorageSync(OpenIdKey) +} + +export function removeOpenId() { + uni.removeStorageSync(OpenId) +} \ No newline at end of file diff --git a/utils/common.js b/utils/common.js new file mode 100644 index 0000000..00d4137 --- /dev/null +++ b/utils/common.js @@ -0,0 +1,54 @@ +/** +* 显示消息提示框 +* @param content 提示的标题 +*/ +export function toast(content) { + uni.showToast({ + icon: 'none', + title: content + }) +} + +/** +* 显示模态弹窗 +* @param content 提示的标题 +*/ +export function showConfirm(content) { + return new Promise((resolve, reject) => { + uni.showModal({ + title: '提示', + content: content, + cancelText: '取消', + confirmText: '确定', + success: function(res) { + resolve(res) + } + }) + }) +} + +/** +* 参数处理 +* @param params 参数 +*/ +export function tansParams(params) { + let result = '' + for (const propName of Object.keys(params)) { + const value = params[propName] + var part = encodeURIComponent(propName) + "=" + if (value !== null && value !== "" && typeof (value) !== "undefined") { + if (typeof value === 'object') { + for (const key of Object.keys(value)) { + if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { + let params = propName + '[' + key + ']' + var subPart = encodeURIComponent(params) + "=" + result += subPart + encodeURIComponent(value[key]) + "&" + } + } + } else { + result += part + encodeURIComponent(value) + "&" + } + } + } + return result +} \ No newline at end of file diff --git a/utils/constant.js b/utils/constant.js new file mode 100644 index 0000000..8becd84 --- /dev/null +++ b/utils/constant.js @@ -0,0 +1,8 @@ +const constant = { + avatar: 'vuex_avatar', + name: 'vuex_name', + roles: 'vuex_roles', + permissions: 'vuex_permissions' + } + + export default constant diff --git a/utils/errorCode.js b/utils/errorCode.js new file mode 100644 index 0000000..d2111ee --- /dev/null +++ b/utils/errorCode.js @@ -0,0 +1,6 @@ +export default { + '401': '认证失败,无法访问系统资源', + '403': '当前操作没有权限', + '404': '访问资源不存在', + 'default': '系统未知错误,请反馈给管理员' +} diff --git a/utils/permission.js b/utils/permission.js new file mode 100644 index 0000000..17969f2 --- /dev/null +++ b/utils/permission.js @@ -0,0 +1,51 @@ +import store from '@/store' + +/** + * 字符权限校验 + * @param {Array} value 校验值 + * @returns {Boolean} + */ +export function checkPermi(value) { + if (value && value instanceof Array && value.length > 0) { + const permissions = store.getters && store.getters.permissions + const permissionDatas = value + const all_permission = "*:*:*" + + const hasPermission = permissions.some(permission => { + return all_permission === permission || permissionDatas.includes(permission) + }) + + if (!hasPermission) { + return false + } + return true + } else { + console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`) + return false + } +} + +/** + * 角色权限校验 + * @param {Array} value 校验值 + * @returns {Boolean} + */ +export function checkRole(value) { + if (value && value instanceof Array && value.length > 0) { + const roles = store.getters && store.getters.roles + const permissionRoles = value + const super_admin = "admin" + + const hasRole = roles.some(role => { + return super_admin === role || permissionRoles.includes(role) + }) + + if (!hasRole) { + return false + } + return true + } else { + console.error(`need roles! Like checkRole="['admin','editor']"`) + return false + } +} \ No newline at end of file diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..39434b8 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,88 @@ +import store from '@/store' +import config from '@/config' +import { + getAccessToken +} from '@/utils/auth' +import errorCode from '@/utils/errorCode' +import { + toast, + showConfirm, + tansParams +} from '@/utils/common' + +let timeout = 10000 +const baseUrl = config.baseUrl + config.baseApi; + +const request = config => { + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + config.header = config.header || {} + if (getAccessToken() && !isToken) { + config.header['Authorization'] = 'Bearer ' + getAccessToken() + } + // 设置租户 TODO 芋艿:强制 1 先 + config.header['tenant-id'] = '1'; + // get请求映射params参数 + if (config.params) { + let url = config.url + '?' + tansParams(config.params) + url = url.slice(0, -1) + config.url = url + } + return new Promise((resolve, reject) => { + uni.request({ + method: config.method || 'get', + timeout: config.timeout || timeout, + url: config.baseUrl || baseUrl + config.url, + data: config.data, + // header: config.header, + header: config.header, + dataType: 'json' + }).then(response => { + let [error, res] = response + if (error) { + toast('后端接口连接异常') + reject('后端接口连接异常') + return + } + const code = res.data.code || 200 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + if (code === 401) { + showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { + if (res.confirm) { + store.dispatch('LogOut').then(res => { + uni.reLaunch({ + url: '/pages/login' + }) + }) + } + }) + reject('无效的会话,或者会话已过期,请重新登录。') + } else if (code === 500) { + toast(msg) + reject('500') + } else if (code !== 200) { + toast(msg) + reject(code) + } else { + toast(msg) + } + resolve(res.data) + }) + .catch(error => { + let { + message + } = error + if (message === 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } else if (message.includes('Request failed with status code')) { + message = '系统接口' + message.substr(message.length - 3) + '异常' + } + toast(message) + reject(error) + }) + }) +} + +export default request \ No newline at end of file diff --git a/utils/ruoyi.js b/utils/ruoyi.js new file mode 100644 index 0000000..fb60217 --- /dev/null +++ b/utils/ruoyi.js @@ -0,0 +1,47 @@ +/** + * 通用js方法封装处理 + * Copyright (c) 2019 ruoyi + */ + +// 日期格式化 +export function parseTime(time, pattern) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm),''); + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { + return ['日', '一', '二', '三', '四', '五', '六'][value] + } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} diff --git a/utils/storage.js b/utils/storage.js new file mode 100644 index 0000000..dd5c38b --- /dev/null +++ b/utils/storage.js @@ -0,0 +1,33 @@ +import constant from './constant' + +// 存储变量名 +let storageKey = 'storage_data' + +// 存储节点变量名 +let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions] + +// 存储的数据 +let storageData = uni.getStorageSync(storageKey) || {} + +const storage = { + set: function(key, value) { + if (storageNodeKeys.indexOf(key) != -1) { + let tmp = uni.getStorageSync(storageKey) + tmp = tmp ? tmp : {} + tmp[key] = value + uni.setStorageSync(storageKey, tmp) + } + }, + get: function(key) { + return storageData[key] || "" + }, + remove: function(key) { + delete storageData[key] + uni.setStorageSync(storageKey, storageData) + }, + clean: function() { + uni.removeStorageSync(storageKey) + } +} + +export default storage diff --git a/utils/upload.js b/utils/upload.js new file mode 100644 index 0000000..fb6b379 --- /dev/null +++ b/utils/upload.js @@ -0,0 +1,73 @@ +import store from '@/store' +import config from '@/config' +import { getAccessToken } from '@/utils/auth' +import errorCode from '@/utils/errorCode' +import { toast, showConfirm, tansParams } from '@/utils/common' + +let timeout = 10000 +const baseUrl = config.baseUrl + +const upload = config => { + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + config.header = config.header || {} + if (getAccessToken() && !isToken) { + config.header['Authorization'] = 'Bearer ' + getAccessToken() + } + // get请求映射params参数 + if (config.params) { + let url = config.url + '?' + tansParams(config.params) + url = url.slice(0, -1) + config.url = url + } + // 设置租户 TODO 芋艿:强制 1 先 + config.header['tenant-id'] = '1'; + return new Promise((resolve, reject) => { + uni.uploadFile({ + timeout: config.timeout || timeout, + url: baseUrl + config.url, + filePath: config.filePath, + name: config.name || 'file', + header: config.header, + formData: config.formData, + method: config.method || 'post', + success: (res) => { + let result = JSON.parse(res.data) + const code = result.code || 200 + const msg = errorCode[code] || result.msg || errorCode['default'] + if (code === 200) { + resolve(result) + } else if (code == 401) { + showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => { + if (res.confirm) { + store.dispatch('LogOut').then(res => { + uni.reLaunch({ url: '/pages/login/login' }) + }) + } + }) + reject('无效的会话,或者会话已过期,请重新登录。') + } else if (code === 500) { + toast(msg) + reject('500') + } else if (code !== 200) { + toast(msg) + reject(code) + } + }, + fail: (error) => { + let { message } = error + if (message == 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } else if (message.includes('Request failed with status code')) { + message = '系统接口' + message.substr(message.length - 3) + '异常' + } + toast(message) + reject(error) + } + }) + }) +} + +export default upload