多模块重构 12:修改项目名字,按照新的规则

This commit is contained in:
YunaiV
2022-02-02 22:33:39 +08:00
parent 352a67c530
commit 0773a4c4d7
1040 changed files with 12 additions and 190 deletions

View File

@ -0,0 +1,182 @@
/* #ifndef APP-PLUS-NVUE */
view,
scroll-view,
swiper,
swiper-item,
cover-view,
cover-image,
icon,
text,
rich-text,
progress,
button,
checkbox,
form,
input,
label,
radio,
slider,
switch,
textarea,
navigator,
audio,
camera,
image,
video {
box-sizing: border-box;
}
image{
display: block;
}
text{
line-height: 1;
/* font-family: Helvetica Neue, Helvetica, sans-serif; */
}
button{
padding: 0;
margin: 0;
background-color: rgba(0,0,0,0) !important;
}
button:after{
border: 0;
}
.bottom-fill{
height: constant(safe-area-inset-bottom);
height: env(safe-area-inset-bottom);
}
.fix-bot{
box-sizing: content-box;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
/* 边框 */
.round{
position: relative;
border-radius: 100rpx;
}
.round:after{
content: '';
position: absolute;
left: 0;
top: 0;
width: 200%;
height: 200%;
transform: scale(.5) translate(-50%,-50%);
border: 1px solid #878787;
border-radius: 100rpx;
box-sizing: border-box;
}
.b-b:after{
position: absolute;
z-index: 3;
left: 0;
top: auto;
bottom: 0;
right: 0;
height: 0;
content: '';
transform: scaleY(.5);
border-bottom: 1px solid #e0e0e0;
}
.b-t:before{
position: absolute;
z-index: 3;
left: 0;
top: 0;
right: 0;
height: 0;
content: '';
transform: scaleY(.5);
border-bottom: 1px solid #e5e5e5;
}
.b-r:after{
position: absolute;
z-index: 3;
right: 0;
top: 0;
bottom: 0;
width: 0;
content: '';
transform: scaleX(.5);
border-right: 1px solid #e5e5e5;
}
.b-l:before{
position: absolute;
z-index: 3;
left: 0;
top: 0;
bottom: 0;
width: 0;
content: '';
transform: scaleX(.5);
border-left: 1px solid #e5e5e5;
}
.b-b, .b-t, .b-l, .b-r{
position: relative;
}
/* 点击态 */
.hover-gray {
background: #fafafa !important;
}
.hover-dark {
background: #f0f0f0 !important;
}
.hover-opacity {
opacity: 0.7;
}
/* #endif */
.clamp {
/* #ifdef APP-PLUS-NVUE */
lines: 1;
/* #endif */
/* #ifndef APP-PLUS-NVUE */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
/* #endif */
}
.clamp2 {
/* #ifdef APP-PLUS-NVUE */
lines: 2;
/* #endif */
/* #ifndef APP-PLUS-NVUE */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
/* #endif */
}
/* 布局 */
.row{
/* #ifndef APP-PLUS-NVUE */
display:flex;
/* #endif */
flex-direction:row;
align-items: center;
}
.column{
/* #ifndef APP-PLUS-NVUE */
display:flex;
/* #endif */
flex-direction: column;
}
.center{
/* #ifndef APP-PLUS-NVUE */
display:flex;
/* #endif */
align-items: center;
justify-content: center;
}
.fill{
flex: 1;
}
/* input */
.placeholder{
color: #999 !important;
}

View File

@ -0,0 +1,271 @@
@font-face {
font-family: "mix-icon";
font-weight: normal;
font-style: normal;
src: url('https://at.alicdn.com/t/font_1913318_2ui3nitf38x.ttf') format('truetype'); // TODO 芋艿: icon 怎么搞
}
.mix-icon {
font-family: "mix-icon" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-fanhui:before {
content: "\e7d5";
}
.icon-shoujihaoma:before {
content: "\e7ec";
}
.icon-close:before {
content: "\e60f";
}
.icon-xingbie-nv:before {
content: "\e60e";
}
.icon-wuliuyunshu:before {
content: "\e7ed";
}
.icon-jingpin:before {
content: "\e608";
}
.icon-zhangdanmingxi01:before {
content: "\e637";
}
.icon-tixian1:before {
content: "\e625";
}
.icon-chongzhi:before {
content: "\e605";
}
.icon-wodezhanghu_zijinjilu:before {
content: "\e615";
}
.icon-tixian:before {
content: "\e6ab";
}
.icon-qianbao:before {
content: "\e6c4";
}
.icon-guanbi1:before {
content: "\e61a";
}
.icon-daipingjia:before {
content: "\e604";
}
.icon-daifahuo:before {
content: "\e6bd";
}
.icon-yue:before {
content: "\e600";
}
.icon-wxpay:before {
content: "\e602";
}
.icon-alipay:before {
content: "\e603";
}
.icon-tishi:before {
content: "\e662";
}
.icon-shoucang-1:before {
content: "\e607";
}
.icon-gouwuche:before {
content: "\e657";
}
.icon-shoucang:before {
content: "\e645";
}
.icon-home:before {
content: "\e60c";
}
/* .icon-bangzhu1:before {
content: "\e63d"; // 帮助
} */
.icon-xingxing:before {
content: "\e70b";
}
.icon-shuxiangliebiao:before {
content: "\e635";
}
.icon-hengxiangliebiao:before {
content: "\e636";
}
.icon-guanbi2:before {
content: "\e7be";
}
.icon-down:before {
content: "\e65c";
}
.icon-arrow-top:before {
content: "\e63e";
}
.icon-xiaoxi:before {
content: "\e634";
}
.icon-saoma:before {
content: "\e655";
}
.icon-dizhi1:before {
content: "\e618";
}
.icon-ditu-copy:before {
content: "\e609";
}
.icon-lajitong:before {
content: "\e682";
}
.icon-bianji:before {
content: "\e60d"; //
}
.icon-yanzhengma1:before {
content: "\e613";
}
.icon-yanjing:before {
content: "\e65b";
}
.icon-mima:before {
content: "\e628";
}
.icon-biyan:before {
content: "\e633";
}
.icon-iconfontweixin:before {
content: "\e611";
}
.icon-shouye:before {
content: "\e626";
}
.icon-daifukuan:before {
content: "\e68f";
}
.icon-pinglun-copy:before {
content: "\e612";
}
.icon-lishijilu:before {
content: "\e6b9";
}
.icon-shoucang_xuanzhongzhuangtai:before {
content: "\e6a9";
}
.icon-share:before {
content: "\e656";
}
.icon-shezhi1:before {
content: "\e61d";
}
.icon-shouhoutuikuan:before {
content: "\e631";
}
.icon-dizhi:before {
content: "\e614";
}
.icon-yishouhuo:before {
content: "\e71a";
}
.icon-xuanzhong:before {
content: "\e632";
}
.icon-xiangzuo:before {
content: "\e653";
}
.icon-iconfontxingxing:before {
content: "\e6b0";
}
.icon-jia2:before {
content: "\e60a";
}
.icon-sousuo:before {
content: "\e7ce";
}
.icon-xiala:before {
content: "\e644";
}
.icon-xia:before {
content: "\e62d";
}
.icon--jianhao:before {
content: "\e60b";
}
.icon-you:before {
content: "\e606";
}
.icon-yk_yuanquan:before {
content: "\e601";
}
.icon-xing:before {
content: "\e627";
}
.icon-guanbi:before {
content: "\e71d";
}
.icon-loading:before {
content: "\e646";
}

View File

@ -0,0 +1,59 @@
import store from '@/store'
import { msg, getAuthToken } from './util'
const BASE_URL = 'http://127.0.0.1:28080/api/';
export const request = (options) => {
return new Promise((resolve, reject) => {
// 发起请求
const authToken = getAuthToken();
uni.request({
url: BASE_URL + options.url,
method: options.method || 'GET',
data: options.data || {},
header: {
...options.header,
'Authorization': authToken ? `Bearer ${authToken}` : ''
}
}).then(res => {
res = res[1];
const statusCode = res.statusCode;
if (statusCode !== 200) {
msg('请求失败,请重试');
return;
}
const code = res.data.code;
const message = res.data.msg;
// Token 过期,引导重新登陆
if (code === 401) {
msg('登录信息已过期,请重新登录');
store.commit('logout');
// reject('无效的登录信息');
return;
}
// 系统异常
if (code === 500) {
msg('系统异常,请稍后重试');
reject(new Error(message));
return;
}
// 其它失败情况
if (code > 0) {
msg(message);
// 提供 code + msg可以基于 code 做进一步的处理。当然,一般情况下是不需要的。
// 不需要的场景:手机登录时,密码不正确;
// 需要的场景:微信登录时,未绑定手机,后端会返回一个 code 码,前端需要基于它跳转到绑定手机界面;
reject({
'code': code,
'msg': message
});
return;
}
// 处理成功,则只返回成功的 data 数据,不返回 code 和 msg
resolve(res.data.data);
}).catch((err) => {
reject(err);
})
})
}

View File

@ -0,0 +1,136 @@
let _debounceTimeout = null,
_throttleRunning = false
/**
* 防抖
* 参考文章 https://juejin.cn/post/6844903669389885453
*
* @param {Function} 执行函数
* @param {Number} delay 延时ms
*/
export const debounce = (fn, delay=500) => {
clearTimeout(_debounceTimeout);
_debounceTimeout = setTimeout(() => {
fn();
}, delay);
}
/**
* 节流
* 参考文章 https://juejin.cn/post/6844903669389885453
*
* @param {Function} 执行函数
* @param {Number} delay 延时ms
*/
export const throttle = (fn, delay=500) => {
if(_throttleRunning){
return;
}
_throttleRunning = true;
fn();
setTimeout(() => {
_throttleRunning = false;
}, delay);
}
/**
* toast 提示
*
* @param {String} title 标题
* @param {Object} param 拓展参数
* @param {Integer} param.duration 持续时间
* @param {Boolean} param.mask 是否遮罩
* @param {Boolean} param.icon 图标
*/
export const msg = (title = '', param={}) => {
if (!title) {
return;
}
uni.showToast({
title,
duration: param.duration || 1500,
mask: param.mask || false,
icon: param.icon || 'none' // TODO 芋艿:是否要区分下 error 的提示,或者专门的封装
});
}
/**
* 检查登录
*
* @param {Boolean} options.nav 如果未登陆,是否跳转到登陆页。默认为 true
* @return {Boolean} 是否登陆
*/
export const isLogin = (options = {}) => {
const token = getAuthToken();
if (token) {
return true;
}
// 若 nav 不为 false则进行跳转登陆页
if (options.nav !== false) {
uni.navigateTo({
url: '/pages/auth/login'
})
}
return false;
}
/**
* 获得认证 Token
*
* @return 认证 Token
*/
export const getAuthToken = () => {
return uni.getStorageSync('token');
}
/**
* 校验参数
*
* @param {String} 字符串
* @param {String} 数据的类型。例如说 mobile 手机号、tel 座机 TODO 芋艿:是否组件里解决
*/
export const checkStr = (str, type) => {
switch (type) {
case 'mobile': //手机号码
return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(str);
case 'tel': //座机
return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(str);
case 'card': //身份证
return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(str);
case 'mobileCode': //6位数字验证码
return /^[0-9]{6}$/.test(str)
case 'pwd': //密码以字母开头长度在6~18之间只能包含字母、数字和下划线
return /^([a-zA-Z0-9_]){6,18}$/.test(str)
case 'payPwd': //支付密码 6位纯数字
return /^[0-9]{6}$/.test(str)
case 'postal': //邮政编码
return /[1-9]\d{5}(?!\d)/.test(str);
case 'QQ': //QQ号
return /^[1-9][0-9]{4,9}$/.test(str);
case 'email': //邮箱
return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(str);
case 'money': //金额(小数点2位)
return /^\d*(?:\.\d{0,2})?$/.test(str);
case 'URL': //网址
return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(str)
case 'IP': //IP
return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(str);
case 'date': //日期时间
return /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(str) || /^(\d{4})\-(\d{2})\-(\d{2})$/
.test(str)
case 'number': //数字
return /^[0-9]$/.test(str);
case 'english': //英文
return /^[a-zA-Z]+$/.test(str);
case 'chinese': //中文
return /^[\\u4E00-\\u9FA5]+$/.test(str);
case 'lower': //小写
return /^[a-z]+$/.test(str);
case 'upper': //大写
return /^[A-Z]+$/.test(str);
case 'HTML': //HTML标记
return /<("[^"]*"|'[^']*'|[^'">])*>/.test(str);
default:
return true;
}
}

View File

@ -0,0 +1,96 @@
// import {request} from '@/common/js/request'
export default{
data() {
return {
page: 0, // 页码
pageNum: 6, // 每页加载数据量
loadingType: 1, // 加载类型。0 加载前1 加载中2 没有更多
isLoading: false, // 刷新数据
loaded: false, // 加载完毕
}
},
methods: {
/**
* 打印日志,方便调试
*
* @param {Object} data 数据
*/
log(data) {
console.log(JSON.parse(JSON.stringify(data)))
},
/**
* navigatorTo 跳转页面
*
* @param {String} url
* @param {Object} options 可选参数
* @param {Boolean} options.login 是否检测登录
*/
navTo(url, options={}) {
this.$util.throttle(() => {
if (!url) {
return;
}
// 如果需要登陆,并且未登陆,则跳转到登陆界面
if ((~url.indexOf('login=1') || options.login) && !this.$store.getters.hasLogin){
url = '/pages/auth/login';
}
// 跳转到指定 url 地址
uni.navigateTo({
url
})
}, 300)
},
/**
* $request云函数请求 TODO 芋艿:需要改成自己的
* @param {String} module
* @param {String} operation
* @param {Boolean} data 请求参数
* @param {Boolean} ext 附加参数
* @param {Boolean} ext.showLoading 是否显示loading状态默认不显示
* @param {Boolean} ext.hideLoading 是否关闭loading状态默认关闭
* @param {Boolean} ext.login 未登录拦截
* @param {Boolean} ext.setLoaded 加载完成是设置页面加载完毕
*/
$request(module, operation, data={}, ext={}){
if(ext.login && !this.$util.isLogin()){
return;
}
if(ext.showLoading){
this.isLoading = true;
}
return new Promise((resolve, reject)=> {
request(module, operation, data, ext).then(result => {
if(ext.hideLoading !== false){
this.isLoading = false;
}
setTimeout(()=>{
if(this.setLoaded !== false){
this.loaded = true;
}
}, 100)
this.$refs.confirmBtn && this.$refs.confirmBtn.stop();
resolve(result);
}).catch((err) => {
reject(err);
})
})
},
imageOnLoad(data, key){ // TODO 芋艿:需要改成自己的
setTimeout(()=>{
this.$set(data, 'loaded', true);
}, 100)
},
showPopup(key){ // TODO 芋艿:需要改成自己的
this.$util.throttle(()=>{
this.$refs[key].open();
}, 200)
},
hidePopup(key){ // TODO 芋艿:需要改成自己的
this.$refs[key].close();
},
stopPrevent(){}, // TODO 芋艿:需要改成自己的
},
}