first commit
|
@ -0,0 +1,12 @@
|
|||
<script>
|
||||
export default {
|
||||
onLaunch() {},
|
||||
onShow() {},
|
||||
onHide() {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/static/style.css';
|
||||
@import "./uni_modules/uview-ui/index.scss";
|
||||
</style>
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020 www.uviewui.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,106 @@
|
|||
<p align="center">
|
||||
<img alt="logo" src="https://uviewui.com/common/logo.png" width="120" height="120" style="margin-bottom: 10px;">
|
||||
</p>
|
||||
<h3 align="center" style="margin: 30px 0 30px;font-weight: bold;font-size:40px;">uView</h3>
|
||||
<h3 align="center">多平台快速开发的UI框架</h3>
|
||||
|
||||
|
||||
## 说明
|
||||
|
||||
uView UI,是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水
|
||||
|
||||
## 特性
|
||||
|
||||
- 兼容安卓,iOS,微信小程序,H5,QQ小程序,百度小程序,支付宝小程序,头条小程序
|
||||
- 60+精选组件,功能丰富,多端兼容,让您快速集成,开箱即用
|
||||
- 众多贴心的JS利器,让您飞镖在手,召之即来,百步穿杨
|
||||
- 众多的常用页面和布局,让您专注逻辑,事半功倍
|
||||
- 详尽的文档支持,现代化的演示效果
|
||||
- 按需引入,精简打包体积
|
||||
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
# npm方式安装
|
||||
npm i uview-ui
|
||||
```
|
||||
|
||||
## 快速上手
|
||||
|
||||
1. `main.js`引入uView库
|
||||
```js
|
||||
// main.js
|
||||
import uView from 'uview-ui';
|
||||
Vue.use(uView);
|
||||
```
|
||||
|
||||
2. `App.vue`引入基础样式(注意style标签需声明scss属性支持)
|
||||
```css
|
||||
/* App.vue */
|
||||
<style lang="scss">
|
||||
@import "uview-ui/index.scss";
|
||||
</style>
|
||||
```
|
||||
|
||||
3. `uni.scss`引入全局scss变量文件
|
||||
```css
|
||||
/* uni.scss */
|
||||
@import "uview-ui/theme.scss";
|
||||
```
|
||||
|
||||
4. `pages.json`配置easycom规则(按需引入)
|
||||
|
||||
```js
|
||||
// pages.json
|
||||
{
|
||||
"easycom": {
|
||||
// npm安装的方式不需要前面的"@/",下载安装的方式需要"@/"
|
||||
// npm安装方式
|
||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||
// 下载安装方式
|
||||
// "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
|
||||
},
|
||||
// 此为本身已有的内容
|
||||
"pages": [
|
||||
// ......
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容
|
||||
|
||||
## 使用方法
|
||||
配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。
|
||||
|
||||
```html
|
||||
<template>
|
||||
<u-button>按钮</u-button>
|
||||
</template>
|
||||
```
|
||||
|
||||
请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容
|
||||
|
||||
## 链接
|
||||
|
||||
- [官方文档](https://uviewui.com/)
|
||||
- [更新日志](https://uviewui.com/components/changelog.html)
|
||||
- [升级指南](https://uviewui.com/components/changelog.html)
|
||||
- [关于我们](https://uviewui.com/cooperation/about.html)
|
||||
|
||||
## 预览
|
||||
|
||||
您可以通过**微信**扫码,查看最佳的演示效果。
|
||||
<br>
|
||||
<br>
|
||||
<img src="https://uviewui.com/common/weixin_mini_qrcode.png" width="220" height="220" >
|
||||
|
||||
<!-- ## 捐赠uView的研发
|
||||
|
||||
uView文档和源码全部开源免费,如果您认为uView帮到了您的开发工作,您可以捐赠uView的研发工作,捐赠无门槛,哪怕是一杯可乐也好(相信这比打赏主播更有意义)。
|
||||
|
||||
<img src="https://uviewui.com/common/wechat.png" width="220" >
|
||||
<img style="margin-left: 100px;" src="https://uviewui.com/common/alipay.png" width="220" >
|
||||
-->
|
||||
## 版权信息
|
||||
uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。
|
|
@ -0,0 +1,55 @@
|
|||
<template>
|
||||
<view class="make">
|
||||
<view class="list">
|
||||
<view class="item" v-for="i in 500">
|
||||
<text>{{info}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "watermark",
|
||||
props: {
|
||||
info: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.make {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 9999;
|
||||
background: rgba(0, 0, 0, 0);
|
||||
pointer-events: none;
|
||||
.list {
|
||||
width: 500%;
|
||||
height: 400%;
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: -50%;
|
||||
transform: rotate(-45deg);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
pointer-events: none;
|
||||
.item {
|
||||
font-size: 28px;
|
||||
color: rgba(220, 220, 220, 0.3);
|
||||
font-weight: bold;
|
||||
padding: 30rpx;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,42 @@
|
|||
<template>
|
||||
<view class="">
|
||||
<view class="bgwhite plr20 ptb10 flex_between flex_items mt20">
|
||||
<view v-if="back" @click="goback">
|
||||
<image :src="back" style="width:50rpx;height:50rpx;"></image>
|
||||
</view>
|
||||
<view v-else style="opacity: 0;">站位</view>
|
||||
<view class="bold f32">{{title}}</view>
|
||||
<view class="f28" @click="gohere">{{tright}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
back: require("@/static/back.png")
|
||||
}
|
||||
},
|
||||
props: ['title', 'tright', 'isback'],
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
goback() {
|
||||
this.$router.back()
|
||||
},
|
||||
gohere(){
|
||||
uni.navigateTo({
|
||||
url:"/pages/my/index"
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: #f5f5f5 !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,321 @@
|
|||
<template>
|
||||
<view>
|
||||
<u-overlay :show="show" @tap="cancle">
|
||||
<view class="flex_items flex_center" style="width: 100%;height: 100vh;">
|
||||
<view v-if="istype=='login'" class="login flex_column flex_items" @tap.stop="gonone">
|
||||
<u--form labelPosition="left" :model="form" labelWidth="60" style="margin-top: 80rpx;">
|
||||
<u-form-item prop="form.phone" border="none" style="border-radius: 8rpx;">
|
||||
<view class="flex_start flex_items"
|
||||
style="width: 428rpx;height:80rpx;background: #fff;border-radius: 43rpx;">
|
||||
<u--input class="ml30" v-model="form.phone" border="none" placeholder="请输入手机号"
|
||||
placeholderStyle="color:#FDAE73;font-size:26rpx" color="#FD5B23"
|
||||
fontSize="13"></u--input>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item prop="form.code" border="none" style="border-radius: 8rpx;">
|
||||
<view class="flex_start flex_items"
|
||||
style="width: 428rpx;height: 80rpx;background: #fff;border-radius: 43rpx;">
|
||||
<u--input class="ml30" v-model="form.code" border="none" placeholder="请输入验证码"
|
||||
placeholderStyle="color:#FDAE73;font-size:26rpx" color="#FD5B23"
|
||||
fontSize="13"></u--input>
|
||||
<view @click="getcode" class="f22 mr30 p10 f-center"
|
||||
style="background: #FA483D;color: #fff;border-radius:48rpx;width: 130rpx;">
|
||||
{{codemsg}}
|
||||
</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
<view class="f26 mt10 f-center" style="color: #FF7255;">接收验证码 最高可领500元立减金</view>
|
||||
<image @click="gologin" :src="okbtn" style="width: 389rpx;height: 69rpx;margin-top: 100rpx;"
|
||||
mode=""></image>
|
||||
</view>
|
||||
<view v-if="istype=='guize'" class="gz plr50 f26 pos" @tap.stop="gonone"
|
||||
style="width: 707rpx;height: 1100rpx;color: #8E4D41;line-height:45rpx;">
|
||||
<view style="width: 100%;height:946rpx;" class="gznei f26">
|
||||
<view class="bold f-center mt20 f32">2024年金市代客产品签约及柜台债二级交易活动细则
|
||||
</view>
|
||||
<view class="mt40 bold">活动时间:</view>
|
||||
<view class="mt20 ss" style="">
|
||||
达标统计时间:2024年4月1日至2024年12月31日
|
||||
</view>
|
||||
<view class="ss">
|
||||
达标领券时间:2024年5月1日至2025年1月31日(按月开展,每月15日将上新2141份微信立减金,本月未被领取的立减金将累计至下个月供达标客户领取。符合活动条件的客户,领取机会最晚保留至2025年1月31日23:59:59)
|
||||
</view>
|
||||
<view class="mt20 bold">活动对象:</view>
|
||||
<view class="mt20 ss">积存金客户/零售柜台债客户/零售结构性存款客户(不接受无实体卡的二类账户等办理)</view>
|
||||
<view class="mt20 bold">活动内容:</view>
|
||||
<view class="mt20 ss">
|
||||
活动期间,客户成功签约积存金、柜台债有机会获得1次领取机会,成功签约结构性存款有机会获得2次领取机会,成功买入1笔2000元面值(含)以上二级流通柜台债,有机会获得1次领取机会。整个活动期间单个项目单个客户不可重复奖励。每位客户领取随机立减金金额从15元至500元不等。活动名额有限,先领先得。
|
||||
</view>
|
||||
<view class="ss">其中,柜台债买入特指二级买入。满足活动条件的次月进行奖品发放。激励对象剔除活动期内产品先解约后签约的情况。
|
||||
</view>
|
||||
<view class="mt20 bold">活动细则:</view>
|
||||
<view class="mt20">
|
||||
<view class="ss">
|
||||
1、适用客户:须为本行认可的上海农商银行实体借记卡持卡人(不接受无实体卡的二类账户等办理),且为积存金、柜台债、结构性存款签约客户。积存金和柜台债的签约及买入可通过柜面、手机银行和网上银行等渠道办理,结构性存款的签约可通过柜面渠道办理。
|
||||
</view>
|
||||
<view class="mt20 ss">
|
||||
2、微信立减金每月上新合计2141份(品种包括:15元微信立减金、20元微信立减金、50元微信立减金、100元微信立减金和500元微信立减金),每月份额有限,先领先得,每次领取只能获得一档价值的微信立减金。每月立减金按照领取时序,先到先得,领完即止。本月未被领取的立减金将累计至下个月供达标客户领取。上海农商银行有权根据实际情况,调配奖券面值、数量与领用规则等。
|
||||
</view>
|
||||
<view class="mt20 ss">
|
||||
3、15元立减金,单笔消费实付金额满15.01元可用;20元立减金,单笔消费实付金额满20.01元可用;50元立减金,单笔消费实付金额满50.01元可用;100元立减金,单笔消费实付金额满100.01元可用;500元立减金,单笔消费实付金额满500.01元可用。
|
||||
</view>
|
||||
<view class="mt20 ss">
|
||||
4、满足活动要求的客户,根据达标产品类型、其积存金业务签约手机号/柜台债业务资金卡开户预留手机号/结构性存款业务签约卡开户预留手机号将在次月收到短信提示(短信提示通常于月初前5个工作日之后发出),客户须于短信提示中规定的截止日前、通过指定路径领取。客户领取时须填写根据达标产品类型对应的“积存金业务签约手机号”或“柜台债业务资金卡开户预留手机号”或“结构性存款业务签约卡开户预留手机号”进行信息验证,验证通过后领取,微信立减金将自动存入当前微信卡包。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
5、若出现客户因手机号问题导致未收到短信、或因客户本人未妥善保存造成短信泄露、或逾期未能在短信提示的截止日前领取导致领取失败等情况,责任由客户自行承担,本行不予补发。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
6、微信立减金有效期为领取后的20个自然日内,仅限微信支付时使用上海农商银行借记卡支付,请在有效期内使用,逾期作废。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
7、微信立减金一经领取不能退换,不能兑换现金或其他商品。
|
||||
</view>
|
||||
<view class="ss mt20"> 8、客户使用微信立减金完成的订单,如发生退货或撤销交易,视为客户微信立减金已使用,红包金额不予退还,红包不予补发。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
9、客户领取微信立减金红包前,请确保同一手机号注册的微信账号已在同一设备登录。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
10、微信立减金在少数特定商户(详见卡券详情)、零钱通、理财通等无法使用;社交支付(如转账、红包、个人收款码支付等)及合单支付(微信支付订单号位41开头的交易)无法使用。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
11、本活动中商品及相关服务由本行供应商负责提供,持卡人因商品或服务质量引发的任何索赔、质询及投诉由本行供应商协助处理和解决。供应商客服热线:400-118-1216(服务时间:工作日8:00-24:00;周六日及法定节假日9:00-23:00);本行24小时客户服务热线:021-962999或4006962999。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
12、如发现客户有利用活动规则或系统漏洞、作弊、冒用他人信息参与活动进行虚假交易或违法交易等手段恶意套取优惠奖励的,上海农商银行具有取消该客户参加本活动的权利,并有权取消或收回其因参加本活动所获得的奖品及使用资格。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
13、在法律许可范围内,上海农商银行保留本次活动合理解释权。上海农商银行有权修订本活动条款及细则,并经相关途径公告后(包括但不限于上海农商银行手机银行、上海农商银行微信公众号、上海农商银行工会卡微信公众号等)生效。
|
||||
</view>
|
||||
<view class="ss mt20">
|
||||
14、本活动与苹果公司无关。
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="width: 100%;height: 40rpx;"></view>
|
||||
<view @click="cancle" class="flex_items flex_center abs" style="width:100%;bottom: -70rpx;left: 0;">
|
||||
<image class="" :src="close" style="width: 45rpx;height: 45rpx;" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="istype=='iszj'" class="iszj flex_column flex_items" @tap.stop="gonone">
|
||||
<view class="flex_column flex_items" style="width: 100%;">
|
||||
<image :src="hdl" style="width: 208rpx;height: 246rpx;margin-top: 66rpx;" mode=""></image>
|
||||
<view class="bold f28 mt10" style="color:#FA483D;">
|
||||
{{title}}
|
||||
</view>
|
||||
<view class="mt10 f26" style="color:#FA483D;">请到【我的奖品】中查看并兑换</view>
|
||||
</view>
|
||||
<view class="flex_between flex_items" style="margin-top:100rpx;width: calc(100% - 80rpx);">
|
||||
<view @click="cancle" class="f-center f30 bold"
|
||||
style="width: 194rpx;height:65rpx;border-radius: 48rpx;line-height: 65rpx;border:1px solid #FFF2A3;color: #FFF2A3;letter-spacing:5rpx;">
|
||||
继续领取
|
||||
</view>
|
||||
<image :src="godui" style="width: 194rpx;height:69rpx;" @click="qudui" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="istype=='out'" class="flex_column flex_items bgwhite plr20 ptb40" @tap.stop="gonone"
|
||||
style="border-radius: 48rpx;width: 500rpx;">
|
||||
<view class="f34 bold">退出登录</view>
|
||||
<view class="mt20 f30" style="color:#666666">
|
||||
您是否确认退出登录
|
||||
</view>
|
||||
<view class="f30 mt10" style="color:#666">
|
||||
退出后我们会继续保留您的账号数据
|
||||
</view>
|
||||
<view class="mt60 flex_between flex_items" style="width: calc(100% - 50rpx);">
|
||||
<view @click="goout" class="f-center f32"
|
||||
style="width: 200rpx;height: 68rpx;border: 1px solid #666;border-radius: 48rpx;line-height:68rpx;">
|
||||
退出</view>
|
||||
<image @click="cancle" :src="qx" style="width: 200rpx;height:72rpx;" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Debounce} from "@/util/common.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: true,
|
||||
codemsg: "获取验证码",
|
||||
codesecond:60,
|
||||
qx: require('@/static/can.png'),
|
||||
form: {
|
||||
phone: "",
|
||||
code: "",
|
||||
activity_id: 1
|
||||
},
|
||||
close: require('@/static/close.png'),
|
||||
okbtn: require('@/static/okbtn.png'),
|
||||
hdl: require('@/static/hdl.png'),
|
||||
godui: require('@/static/godui.png'),
|
||||
iscut: 0
|
||||
}
|
||||
},
|
||||
props: ["istype", "isshow", "title", "link"],
|
||||
mounted() {
|
||||
this.show = this.isshow
|
||||
},
|
||||
methods: {
|
||||
gook() {
|
||||
console.log(1212)
|
||||
},
|
||||
cancle(types) {
|
||||
let tt = {
|
||||
types: "",
|
||||
show: false
|
||||
}
|
||||
if (this.istype == 'login') {
|
||||
return false
|
||||
}
|
||||
if (types) {
|
||||
tt.types = types
|
||||
}
|
||||
this.show = false
|
||||
this.$emit('backshow', tt)
|
||||
},
|
||||
getcode:Debounce( function(){
|
||||
if (this.form.phone == '') {
|
||||
uni.showToast({
|
||||
title: "手机号不能为空",
|
||||
icon: "none"
|
||||
})
|
||||
return false
|
||||
}
|
||||
if (this.iscut == 1) {
|
||||
return false
|
||||
}
|
||||
this.getphonecode()
|
||||
},1000),
|
||||
getphonecode() {
|
||||
let that = this
|
||||
uni.showLoading({
|
||||
title: "发送中..."
|
||||
})
|
||||
that.api.getcodes({
|
||||
phone: that.form.phone
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
if (res.data.code == '200') {
|
||||
this.iscut = 1
|
||||
uni.showToast({
|
||||
title: "发送成功",
|
||||
icon: "success",
|
||||
duration: 800,
|
||||
})
|
||||
setTimeout(function() {
|
||||
if (that.codemsg == "获取验证码") {
|
||||
// that.getphonecode()
|
||||
that.codesecond = 60
|
||||
that.codemsg = that.codesecond+'s';
|
||||
that.int = setInterval(() => {
|
||||
that.codesecond -= 1;
|
||||
that.codemsg = that.codesecond+'s';
|
||||
if (that.codesecond == 0) {
|
||||
clearInterval(that.int);
|
||||
that.codemsg = "重新发送";
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}, 800);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
})
|
||||
this.reset()
|
||||
this.show = false
|
||||
}
|
||||
})
|
||||
},
|
||||
qudui() {
|
||||
window.open(this.link, "_blank")
|
||||
},
|
||||
gologin() {
|
||||
let that = this
|
||||
uni.showLoading({
|
||||
title: '登录中...'
|
||||
})
|
||||
that.api.loglin(that.form).then((res) => {
|
||||
if (res.data.code == '200') {
|
||||
getApp().globalData.token = res.data.data.front_token
|
||||
// uni.setStorageSync('token',res.data.data.front_token)
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
icon: 'success',
|
||||
duration: 800
|
||||
})
|
||||
setTimeout(function() {
|
||||
that.$emit("backshow", {
|
||||
types: "loginok",
|
||||
show: false
|
||||
})
|
||||
}, 800);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goout() {
|
||||
uni.showLoading({
|
||||
title: '退出中...'
|
||||
})
|
||||
let that = this
|
||||
setTimeout(function() {
|
||||
uni.showToast({
|
||||
title: '退出成功',
|
||||
icon: 'success',
|
||||
duration: 800
|
||||
})
|
||||
setTimeout(function() {
|
||||
uni.removeStorageSync('token')
|
||||
uni.reLaunch({
|
||||
url: "/pages/index/index"
|
||||
})
|
||||
}, 800);
|
||||
}, 800);
|
||||
},
|
||||
gonone() {},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.login {
|
||||
background-image: url('~@/static/login.png') !important;
|
||||
background-size: 100% 100%;
|
||||
height: 587rpx;
|
||||
width: 501rpx;
|
||||
}
|
||||
|
||||
.gz {
|
||||
background-image: url('~@/static/hdgz.png') !important;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.gznei {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
margin-top: 80rpx;
|
||||
}
|
||||
|
||||
.iszj {
|
||||
background-image: url('~@/static/gxhd.png') !important;
|
||||
background-size: 100% 100%;
|
||||
height: 630rpx;
|
||||
width: 501rpx;
|
||||
}
|
||||
|
||||
.ss {
|
||||
text-indent: 2em;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>沪农商-抽奖活动</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.2da1efab.css><link href=/static/js/pages-index-index.a5b303a3.js rel=prefetch><link href=/static/js/pages-my-index.b1d1d11d.js rel=prefetch><link href=/static/js/chunk-vendors.c92b6bad.js rel=preload as=script><link href=/static/js/index.37feedd1.js rel=preload as=script></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.c92b6bad.js></script><script src=/static/js/index.37feedd1.js></script></body></html>
|
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 594 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 594 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 31 KiB |
|
@ -0,0 +1,551 @@
|
|||
/*每个页面公共css */
|
||||
body{
|
||||
height: auto!important;
|
||||
}
|
||||
.pos {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.abs {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.flex-center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex-row-jus-center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex-row-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex-col-center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.ellipsis-two {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
white-space: normal !important;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.ellipsis-one {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
white-space: normal !important;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.bolder {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/* ----------------------------- */
|
||||
.flex_start {
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.flex_end {
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.flex_center {
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.flex_around {
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.flex_between {
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex_warp {
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.flex_items {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex_column {
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.mlr10 {
|
||||
margin-left: 10rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.mlr20 {
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.mlr30 {
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.mtb10 {
|
||||
margin-top: 10rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.mtb20 {
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.mtb30 {
|
||||
margin-top: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.mt5 {
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
|
||||
.mt10 {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.mt15 {
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.mt20 {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.mt25 {
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
|
||||
.mt30 {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.mt35 {
|
||||
margin-top: 35rpx;
|
||||
}
|
||||
|
||||
.mt40 {
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.mt50 {
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
.mt60 {
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
|
||||
.mt80 {
|
||||
margin-top: 80rpx;
|
||||
}
|
||||
|
||||
.mt100 {
|
||||
margin-top: 100rpx;
|
||||
}
|
||||
|
||||
.mt120 {
|
||||
margin-top: 120rpx;
|
||||
}
|
||||
|
||||
.ml5 {
|
||||
margin-left: 5rpx;
|
||||
}
|
||||
|
||||
.ml10 {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.ml15 {
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
.ml20 {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.ml25 {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.ml30 {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.ml35 {
|
||||
margin-left: 35rpx;
|
||||
}
|
||||
|
||||
.mb5 {
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.mb10 {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.mb15 {
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.mb20 {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.mb25 {
|
||||
margin-bottom: 25rpx;
|
||||
}
|
||||
|
||||
.mb30 {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.mb40 {
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.mb100 {
|
||||
margin-bottom: 100rpx;
|
||||
}
|
||||
|
||||
.mr5 {
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
|
||||
.mr10 {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.mr15 {
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.mr20 {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.mr25 {
|
||||
margin-right: 25rpx;
|
||||
}
|
||||
|
||||
.mr30 {
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.mr40 {
|
||||
margin-right: 40rpx;
|
||||
}
|
||||
.mr45 {
|
||||
margin-right: 45rpx;
|
||||
}
|
||||
.mr50 {
|
||||
margin-right: 50rpx;
|
||||
}
|
||||
|
||||
/* 内边距 */
|
||||
|
||||
.p20 {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.p30 {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.ptb5 {
|
||||
padding-bottom: 5rpx;
|
||||
padding-top: 5rpx;
|
||||
}
|
||||
|
||||
.ptb15 {
|
||||
padding-bottom: 15rpx;
|
||||
padding-top: 15rpx;
|
||||
}
|
||||
|
||||
.ptb10 {
|
||||
padding-bottom: 10rpx;
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
|
||||
.ptb20 {
|
||||
padding-bottom: 20rpx;
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
|
||||
.ptb25 {
|
||||
padding-bottom: 25rpx;
|
||||
padding-top: 25rpx;
|
||||
}
|
||||
|
||||
.ptb30 {
|
||||
padding-bottom: 30rpx;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.ptb40 {
|
||||
padding-bottom: 40rpx;
|
||||
padding-top: 40rpx;
|
||||
}
|
||||
|
||||
.ptb50 {
|
||||
padding-bottom: 50rpx;
|
||||
padding-top: 50rpx;
|
||||
}
|
||||
|
||||
.plr15 {
|
||||
padding-left: 15rpx;
|
||||
padding-right: 15rpx;
|
||||
}
|
||||
|
||||
.plr10 {
|
||||
padding-left: 10rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
.plr20 {
|
||||
padding-left: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
|
||||
.plr30 {
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
}
|
||||
|
||||
.plr50 {
|
||||
padding-left: 50rpx;
|
||||
padding-right: 50rpx;
|
||||
}
|
||||
|
||||
.pt5 {
|
||||
padding-top: 5rpx;
|
||||
}
|
||||
|
||||
.pt10 {
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
|
||||
.pt15 {
|
||||
padding-top: 15rpx;
|
||||
}
|
||||
|
||||
.pt20 {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
|
||||
.pt30 {
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.pt35 {
|
||||
padding-top: 35rpx;
|
||||
}
|
||||
|
||||
.pt50 {
|
||||
padding-top: 50rpx;
|
||||
}
|
||||
|
||||
.pb10 {
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.pb20 {
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.pb30 {
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.pb35 {
|
||||
padding-bottom: 35rpx;
|
||||
}
|
||||
|
||||
.pb40 {
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.pb80 {
|
||||
padding-bottom: 80rpx;
|
||||
}
|
||||
|
||||
.pl10 {
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.pl15 {
|
||||
padding-left: 15rpx;
|
||||
}
|
||||
|
||||
.pl20 {
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.pl30 {
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
|
||||
.pl60 {
|
||||
padding-left: 60rpx;
|
||||
}
|
||||
|
||||
.pl50 {
|
||||
padding-left: 50rpx;
|
||||
}
|
||||
|
||||
.pr20 {
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
|
||||
.pr30 {
|
||||
padding-right: 30rpx;
|
||||
}
|
||||
|
||||
.p10 {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.p15 {
|
||||
padding: 15rpx;
|
||||
}
|
||||
|
||||
/* 底部边框 */
|
||||
|
||||
.bbe9s {
|
||||
border-bottom: 1rpx solid #e9e9e9;
|
||||
}
|
||||
|
||||
.bgwhite {
|
||||
background: white;
|
||||
}
|
||||
|
||||
/* 字体大小 */
|
||||
|
||||
.f80 {
|
||||
font-size: 80rpx;
|
||||
}
|
||||
|
||||
.f50 {
|
||||
font-size: 50rpx;
|
||||
}
|
||||
|
||||
.f58 {
|
||||
font-size: 58rpx;
|
||||
}
|
||||
|
||||
.f40 {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.f44 {
|
||||
font-size: 44rpx;
|
||||
}
|
||||
|
||||
.f48 {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
|
||||
.f38 {
|
||||
font-size: 38rpx;
|
||||
}
|
||||
|
||||
.f36 {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.f34 {
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.f32 {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.f30 {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.f28 {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.f26 {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.f24 {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.f22 {
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.f20 {
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.f18 {
|
||||
font-size: 18rpx;
|
||||
}
|
||||
|
||||
.f16 {
|
||||
font-size: 16rpx;
|
||||
}
|
||||
|
||||
.f-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.divbox {
|
||||
box-shadow: 0 0 9px #e2e2e2;
|
||||
}
|
||||
|
||||
.bte9s {
|
||||
border-top: 1px solid #e9e9e9;
|
||||
}
|
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 36 KiB |
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title></title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,141 @@
|
|||
// 引入全局mixin
|
||||
import mixin from './libs/mixin/mixin.js'
|
||||
// 引入关于是否mixin集成小程序分享的配置
|
||||
// import wxshare from './libs/mixin/mpShare.js'
|
||||
// 全局挂载引入http相关请求拦截插件
|
||||
import http from './libs/request'
|
||||
|
||||
function wranning(str) {
|
||||
// 开发环境进行信息输出,主要是一些报错信息
|
||||
// 这个环境的来由是在程序编写时候,点击hx编辑器运行调试代码的时候,详见:
|
||||
// https://uniapp.dcloud.io/frame?id=%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e5%92%8c%e7%94%9f%e4%ba%a7%e7%8e%af%e5%a2%83
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.warn(str)
|
||||
}
|
||||
}
|
||||
|
||||
// 尝试判断在根目录的/store中是否有$u.mixin.js,此文件uView默认为需要挂在到全局的vuex的state变量
|
||||
// HX2.6.11版本,放到try中,控制台依然会警告,暂时不用此方式,
|
||||
// let vuexStore = {};
|
||||
// try {
|
||||
// vuexStore = require("@/store/$u.mixin.js");
|
||||
// } catch (e) {
|
||||
// //TODO handle the exception
|
||||
// }
|
||||
|
||||
// post类型对象参数转为get类型url参数
|
||||
import queryParams from './libs/function/queryParams.js'
|
||||
// 路由封装
|
||||
import route from './libs/function/route.js'
|
||||
// 时间格式化
|
||||
import timeFormat from './libs/function/timeFormat.js'
|
||||
// 时间戳格式化,返回多久之前
|
||||
import timeFrom from './libs/function/timeFrom.js'
|
||||
// 颜色渐变相关,colorGradient-颜色渐变,hexToRgb-十六进制颜色转rgb颜色,rgbToHex-rgb转十六进制
|
||||
import colorGradient from './libs/function/colorGradient.js'
|
||||
// 生成全局唯一guid字符串
|
||||
import guid from './libs/function/guid.js'
|
||||
// 主题相关颜色,info|success|warning|primary|default|error,此颜色已在uview.scss中定义,但是为js中也能使用,故也定义一份
|
||||
import color from './libs/function/color.js'
|
||||
// 根据type获取图标名称
|
||||
import type2icon from './libs/function/type2icon.js'
|
||||
// 打乱数组的顺序
|
||||
import randomArray from './libs/function/randomArray.js'
|
||||
// 对象和数组的深度克隆
|
||||
import deepClone from './libs/function/deepClone.js'
|
||||
// 对象深度拷贝
|
||||
import deepMerge from './libs/function/deepMerge.js'
|
||||
// 添加单位
|
||||
import addUnit from './libs/function/addUnit.js'
|
||||
|
||||
// 规则检验
|
||||
import test from './libs/function/test.js'
|
||||
// 随机数
|
||||
import random from './libs/function/random.js'
|
||||
// 去除空格
|
||||
import trim from './libs/function/trim.js'
|
||||
// toast提示,对uni.showToast的封装
|
||||
import toast from './libs/function/toast.js'
|
||||
// 获取父组件参数
|
||||
import getParent from './libs/function/getParent.js'
|
||||
// 获取整个父组件
|
||||
import $parent from './libs/function/$parent.js'
|
||||
// 获取sys()和os()工具方法
|
||||
// 获取设备信息,挂载到$u的sys()(system的缩写)属性中,
|
||||
// 同时把安卓和ios平台的名称"ios"和"android"挂到$u.os()中,方便取用
|
||||
import {sys, os} from './libs/function/sys.js'
|
||||
// 防抖方法
|
||||
import debounce from './libs/function/debounce.js'
|
||||
// 节流方法
|
||||
import throttle from './libs/function/throttle.js'
|
||||
|
||||
|
||||
// 配置信息
|
||||
import config from './libs/config/config.js'
|
||||
// 各个需要fixed的地方的z-index配置文件
|
||||
import zIndex from './libs/config/zIndex.js'
|
||||
|
||||
const $u = {
|
||||
queryParams: queryParams,
|
||||
route: route,
|
||||
timeFormat: timeFormat,
|
||||
date: timeFormat, // 另名date
|
||||
timeFrom,
|
||||
colorGradient: colorGradient.colorGradient,
|
||||
colorToRgba: colorGradient.colorToRgba,
|
||||
guid,
|
||||
color,
|
||||
sys,
|
||||
os,
|
||||
type2icon,
|
||||
randomArray,
|
||||
wranning,
|
||||
get: http.get,
|
||||
post: http.post,
|
||||
put: http.put,
|
||||
'delete': http.delete,
|
||||
hexToRgb: colorGradient.hexToRgb,
|
||||
rgbToHex: colorGradient.rgbToHex,
|
||||
test,
|
||||
random,
|
||||
deepClone,
|
||||
deepMerge,
|
||||
getParent,
|
||||
$parent,
|
||||
addUnit,
|
||||
trim,
|
||||
type: ['primary', 'success', 'error', 'warning', 'info'],
|
||||
http,
|
||||
toast,
|
||||
config, // uView配置信息相关,比如版本号
|
||||
zIndex,
|
||||
debounce,
|
||||
throttle,
|
||||
}
|
||||
|
||||
// $u挂载到uni对象上
|
||||
uni.$u = $u
|
||||
|
||||
const install = Vue => {
|
||||
Vue.mixin(mixin)
|
||||
if (Vue.prototype.openShare) {
|
||||
Vue.mixin(mpShare);
|
||||
}
|
||||
// Vue.mixin(vuexStore);
|
||||
// 时间格式化,同时两个名称,date和timeFormat
|
||||
Vue.filter('timeFormat', (timestamp, format) => {
|
||||
return timeFormat(timestamp, format)
|
||||
})
|
||||
Vue.filter('date', (timestamp, format) => {
|
||||
return timeFormat(timestamp, format)
|
||||
})
|
||||
// 将多久以前的方法,注入到全局过滤器
|
||||
Vue.filter('timeFrom', (timestamp, format) => {
|
||||
return timeFrom(timestamp, format)
|
||||
})
|
||||
Vue.prototype.$u = $u
|
||||
}
|
||||
|
||||
export default {
|
||||
install
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// 引入公共基础类
|
||||
@import "./libs/css/common.scss";
|
||||
@import "./libs/css/color.scss";
|
||||
|
||||
// 非nvue的样式
|
||||
/* #ifndef APP-NVUE */
|
||||
@import "./libs/css/style.vue.scss";
|
||||
/* #endif */
|
||||
|
||||
// nvue的特有样式
|
||||
/* #ifdef APP-NVUE */
|
||||
@import "./libs/css/style.nvue.scss";
|
||||
/* #endif */
|
||||
|
||||
// 小程序特有的样式
|
||||
/* #ifdef MP */
|
||||
@import "./libs/css/style.mp.scss";
|
||||
/* #endif */
|
||||
|
||||
// H5特有的样式
|
||||
/* #ifdef H5 */
|
||||
@import "./libs/css/style.h5.scss";
|
||||
/* #endif */
|
|
@ -0,0 +1,15 @@
|
|||
// 此版本发布于2022-04-19
|
||||
let version = '1.8.6';
|
||||
|
||||
export default {
|
||||
v: version,
|
||||
version: version,
|
||||
// 主题名称
|
||||
type: [
|
||||
'primary',
|
||||
'success',
|
||||
'info',
|
||||
'error',
|
||||
'warning'
|
||||
]
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// uniapp在H5中各API的z-index值如下:
|
||||
/**
|
||||
* actionsheet: 999
|
||||
* modal: 999
|
||||
* navigate: 998
|
||||
* tabbar: 998
|
||||
* toast: 999
|
||||
*/
|
||||
|
||||
export default {
|
||||
toast: 10090,
|
||||
noNetwork: 10080,
|
||||
// popup包含popup,actionsheet,keyboard,picker的值
|
||||
popup: 10075,
|
||||
mask: 10070,
|
||||
navbar: 980,
|
||||
topTips: 975,
|
||||
sticky: 970,
|
||||
indexListSticky: 965,
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
.u-type-primary-light {
|
||||
color: $u-type-primary-light;
|
||||
}
|
||||
|
||||
.u-type-warning-light {
|
||||
color: $u-type-warning-light;
|
||||
}
|
||||
|
||||
.u-type-success-light {
|
||||
color: $u-type-success-light;
|
||||
}
|
||||
|
||||
.u-type-error-light {
|
||||
color: $u-type-error-light;
|
||||
}
|
||||
|
||||
.u-type-info-light {
|
||||
color: $u-type-info-light;
|
||||
}
|
||||
|
||||
.u-type-primary-light-bg {
|
||||
background-color: $u-type-primary-light;
|
||||
}
|
||||
|
||||
.u-type-warning-light-bg {
|
||||
background-color: $u-type-warning-light;
|
||||
}
|
||||
|
||||
.u-type-success-light-bg {
|
||||
background-color: $u-type-success-light;
|
||||
}
|
||||
|
||||
.u-type-error-light-bg {
|
||||
background-color: $u-type-error-light;
|
||||
}
|
||||
|
||||
.u-type-info-light-bg {
|
||||
background-color: $u-type-info-light;
|
||||
}
|
||||
|
||||
.u-type-primary-dark {
|
||||
color: $u-type-primary-dark;
|
||||
}
|
||||
|
||||
.u-type-warning-dark {
|
||||
color: $u-type-warning-dark;
|
||||
}
|
||||
|
||||
.u-type-success-dark {
|
||||
color: $u-type-success-dark;
|
||||
}
|
||||
|
||||
.u-type-error-dark {
|
||||
color: $u-type-error-dark;
|
||||
}
|
||||
|
||||
.u-type-info-dark {
|
||||
color: $u-type-info-dark;
|
||||
}
|
||||
|
||||
.u-type-primary-dark-bg {
|
||||
background-color: $u-type-primary-dark;
|
||||
}
|
||||
|
||||
.u-type-warning-dark-bg {
|
||||
background-color: $u-type-warning-dark;
|
||||
}
|
||||
|
||||
.u-type-success-dark-bg {
|
||||
background-color: $u-type-success-dark;
|
||||
}
|
||||
|
||||
.u-type-error-dark-bg {
|
||||
background-color: $u-type-error-dark;
|
||||
}
|
||||
|
||||
.u-type-info-dark-bg {
|
||||
background-color: $u-type-info-dark;
|
||||
}
|
||||
|
||||
.u-type-primary-disabled {
|
||||
color: $u-type-primary-disabled;
|
||||
}
|
||||
|
||||
.u-type-warning-disabled {
|
||||
color: $u-type-warning-disabled;
|
||||
}
|
||||
|
||||
.u-type-success-disabled {
|
||||
color: $u-type-success-disabled;
|
||||
}
|
||||
|
||||
.u-type-error-disabled {
|
||||
color: $u-type-error-disabled;
|
||||
}
|
||||
|
||||
.u-type-info-disabled {
|
||||
color: $u-type-info-disabled;
|
||||
}
|
||||
|
||||
.u-type-primary {
|
||||
color: $u-type-primary;
|
||||
}
|
||||
|
||||
.u-type-warning {
|
||||
color: $u-type-warning;
|
||||
}
|
||||
|
||||
.u-type-success {
|
||||
color: $u-type-success;
|
||||
}
|
||||
|
||||
.u-type-error {
|
||||
color: $u-type-error;
|
||||
}
|
||||
|
||||
.u-type-info {
|
||||
color: $u-type-info;
|
||||
}
|
||||
|
||||
.u-type-primary-bg {
|
||||
background-color: $u-type-primary;
|
||||
}
|
||||
|
||||
.u-type-warning-bg {
|
||||
background-color: $u-type-warning;
|
||||
}
|
||||
|
||||
.u-type-success-bg {
|
||||
background-color: $u-type-success;
|
||||
}
|
||||
|
||||
.u-type-error-bg {
|
||||
background-color: $u-type-error;
|
||||
}
|
||||
|
||||
.u-type-info-bg {
|
||||
background-color: $u-type-info;
|
||||
}
|
||||
|
||||
.u-main-color {
|
||||
color: $u-main-color;
|
||||
}
|
||||
|
||||
.u-content-color {
|
||||
color: $u-content-color;
|
||||
}
|
||||
|
||||
.u-tips-color {
|
||||
color: $u-tips-color;
|
||||
}
|
||||
|
||||
.u-light-color {
|
||||
color: $u-light-color;
|
||||
}
|
|
@ -0,0 +1,176 @@
|
|||
.u-relative,
|
||||
.u-rela {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.u-absolute,
|
||||
.u-abso {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
// nvue不能用标签命名样式,不能放在微信组件中,否则微信开发工具会报警告,无法使用标签名当做选择器
|
||||
/* #ifndef APP-NVUE */
|
||||
image {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
// 在weex,也即nvue中,所有元素默认为border-box
|
||||
view,
|
||||
text {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
.u-font-xs {
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.u-font-sm {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.u-font-md {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.u-font-lg {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.u-font-xl {
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.u-flex {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.u-flex-wrap {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.u-flex-nowrap {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.u-col-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.u-col-top {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.u-col-bottom {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.u-row-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.u-row-left {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.u-row-right {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.u-row-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.u-row-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.u-text-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.u-text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.u-text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.u-flex-col {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
// 定义flex等分
|
||||
@for $i from 0 through 12 {
|
||||
.u-flex-#{$i} {
|
||||
flex: $i;
|
||||
}
|
||||
}
|
||||
|
||||
// 定义字体(px)单位,小于20都为px单位字体
|
||||
@for $i from 9 to 20 {
|
||||
.u-font-#{$i} {
|
||||
font-size: $i + px;
|
||||
}
|
||||
}
|
||||
|
||||
// 定义字体(rpx)单位,大于或等于20的都为rpx单位字体
|
||||
@for $i from 20 through 40 {
|
||||
.u-font-#{$i} {
|
||||
font-size: $i + rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 定义内外边距,历遍1-80
|
||||
@for $i from 0 through 80 {
|
||||
// 只要双数和能被5除尽的数
|
||||
@if $i % 2 == 0 or $i % 5 == 0 {
|
||||
// 得出:u-margin-30或者u-m-30
|
||||
.u-margin-#{$i}, .u-m-#{$i} {
|
||||
margin: $i + rpx!important;
|
||||
}
|
||||
|
||||
// 得出:u-padding-30或者u-p-30
|
||||
.u-padding-#{$i}, .u-p-#{$i} {
|
||||
padding: $i + rpx!important;
|
||||
}
|
||||
|
||||
@each $short, $long in l left, t top, r right, b bottom {
|
||||
// 缩写版,结果如: u-m-l-30
|
||||
// 定义外边距
|
||||
.u-m-#{$short}-#{$i} {
|
||||
margin-#{$long}: $i + rpx!important;
|
||||
}
|
||||
|
||||
// 定义内边距
|
||||
.u-p-#{$short}-#{$i} {
|
||||
padding-#{$long}: $i + rpx!important;
|
||||
}
|
||||
|
||||
// 完整版,结果如:u-margin-left-30
|
||||
// 定义外边距
|
||||
.u-margin-#{$long}-#{$i} {
|
||||
margin-#{$long}: $i + rpx!important;
|
||||
}
|
||||
|
||||
// 定义内边距
|
||||
.u-padding-#{$long}-#{$i} {
|
||||
padding-#{$long}: $i + rpx!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重置nvue的默认关于flex的样式
|
||||
.u-reset-nvue {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// 定义混入指令,用于在非nvue环境下的flex定义,因为nvue没有display属性,会报错
|
||||
@mixin vue-flex($direction: row) {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-direction: $direction;
|
||||
/* #endif */
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
/* H5的时候,隐藏滚动条 */
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
-webkit-appearance: none;
|
||||
background: transparent;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/* start--微信小程序编译后页面有组件名的元素,特别处理--start */
|
||||
/* #ifdef MP-WEIXIN || MP-QQ */
|
||||
u-td, u-th {
|
||||
flex: 1;
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
.u-td {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
u-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
// 各家小程序宫格组件外层设置为100%,避免受到父元素display: flex;的影响
|
||||
u-grid {
|
||||
width: 100%;
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
|
||||
// 避免小程序线条组件因为父组件display: flex;而失效
|
||||
u-line {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
u-switch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
u-dropdown {
|
||||
flex: 1;
|
||||
}
|
||||
/* #endif */
|
||||
/* end-微信小程序编译后页面有组件名的元素,特别处理--end */
|
||||
|
||||
|
||||
/* #ifdef MP-QQ || MP-TOUTIAO */
|
||||
// 需要做这一切额外的兼容,都是因为TX的无能
|
||||
u-icon {
|
||||
line-height: 0;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
/* start--头条小程序编译后页面有组件名的元素,特别处理--start */
|
||||
// 由于头条小程序不支持直接组件名形式写样式,目前只能在写组件的时候给组件加上对应的类名
|
||||
/* #ifdef MP-TOUTIAO */
|
||||
.u-td, .u-th, .u-tr {
|
||||
flex: 1;
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
.u-row, .u-col {
|
||||
flex: 1;
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
// 避免小程序线条组件因为父组件display: flex;而失效
|
||||
.u-line {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.u-dropdown {
|
||||
flex: 1;
|
||||
}
|
||||
/* #endif */
|
||||
/* end-头条小程序编译后页面有组件名的元素,特别处理--end */
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
.nvue {
|
||||
font-size: 24rpx;
|
||||
}
|
|
@ -0,0 +1,175 @@
|
|||
page {
|
||||
color: $u-main-color;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* start--去除webkit的默认样式--start */
|
||||
.u-fix-ios-appearance {
|
||||
-webkit-appearance:none;
|
||||
}
|
||||
/* end--去除webkit的默认样式--end */
|
||||
|
||||
/* start--icon图标外层套一个view,让其达到更好的垂直居中的效果--start */
|
||||
.u-icon-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
/* end-icon图标外层套一个view,让其达到更好的垂直居中的效果--end */
|
||||
|
||||
/* start--iPhoneX底部安全区定义--start */
|
||||
.safe-area-inset-bottom {
|
||||
padding-bottom: 0;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
/* end-iPhoneX底部安全区定义--end */
|
||||
|
||||
/* start--各种hover点击反馈相关的类名-start */
|
||||
.u-hover-class {
|
||||
// background-color: #f7f8f9!important;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.u-cell-hover {
|
||||
background-color: #f7f8f9!important;
|
||||
}
|
||||
/* end--各种hover点击反馈相关的类名--end */
|
||||
|
||||
/* start--文本行数限制--start */
|
||||
.u-line-1 {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.u-line-2 {
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.u-line-3 {
|
||||
-webkit-line-clamp: 3;
|
||||
}
|
||||
|
||||
.u-line-4 {
|
||||
-webkit-line-clamp: 4;
|
||||
}
|
||||
|
||||
.u-line-5 {
|
||||
-webkit-line-clamp: 5;
|
||||
}
|
||||
|
||||
.u-line-2, .u-line-3, .u-line-4, .u-line-5 {
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box; // 弹性伸缩盒
|
||||
-webkit-box-orient: vertical; // 设置伸缩盒子元素排列方式
|
||||
}
|
||||
|
||||
/* end--文本行数限制--end */
|
||||
|
||||
|
||||
/* start--Retina 屏幕下的 1px 边框--start */
|
||||
.u-border,
|
||||
.u-border-bottom,
|
||||
.u-border-left,
|
||||
.u-border-right,
|
||||
.u-border-top,
|
||||
.u-border-top-bottom {
|
||||
position: relative
|
||||
}
|
||||
|
||||
.u-border-bottom:after,
|
||||
.u-border-left:after,
|
||||
.u-border-right:after,
|
||||
.u-border-top-bottom:after,
|
||||
.u-border-top:after,
|
||||
.u-border:after {
|
||||
/* #ifndef APP-NVUE */
|
||||
content: ' ';
|
||||
/* #endif */
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
pointer-events: none;
|
||||
box-sizing: border-box;
|
||||
-webkit-transform-origin: 0 0;
|
||||
transform-origin: 0 0;
|
||||
// 多加0.1%,能解决有时候边框缺失的问题
|
||||
width: 199.8%;
|
||||
height: 199.7%;
|
||||
transform: scale(0.5, 0.5);
|
||||
border: 0 solid $u-border-color;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.u-border-top:after {
|
||||
border-top-width: 1px
|
||||
}
|
||||
|
||||
.u-border-left:after {
|
||||
border-left-width: 1px
|
||||
}
|
||||
|
||||
.u-border-right:after {
|
||||
border-right-width: 1px
|
||||
}
|
||||
|
||||
.u-border-bottom:after {
|
||||
border-bottom-width: 1px
|
||||
}
|
||||
|
||||
.u-border-top-bottom:after {
|
||||
border-width: 1px 0
|
||||
}
|
||||
|
||||
.u-border:after {
|
||||
border-width: 1px
|
||||
}
|
||||
/* end--Retina 屏幕下的 1px 边框--end */
|
||||
|
||||
|
||||
/* start--clearfix--start */
|
||||
.u-clearfix:after,
|
||||
.clearfix:after {
|
||||
/* #ifndef APP-NVUE */
|
||||
content: '';
|
||||
/* #endif */
|
||||
display: table;
|
||||
clear: both
|
||||
}
|
||||
/* end--clearfix--end */
|
||||
|
||||
/* start--高斯模糊tabbar底部处理--start */
|
||||
.u-blur-effect-inset {
|
||||
width: 750rpx;
|
||||
height: var(--window-bottom);
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
/* end--高斯模糊tabbar底部处理--end */
|
||||
|
||||
/* start--提升H5端uni.toast()的层级,避免被uView的modal等遮盖--start */
|
||||
/* #ifdef H5 */
|
||||
uni-toast {
|
||||
z-index: 10090;
|
||||
}
|
||||
uni-toast .uni-toast {
|
||||
z-index: 10090;
|
||||
}
|
||||
/* #endif */
|
||||
/* end--提升H5端uni.toast()的层级,避免被uView的modal等遮盖--end */
|
||||
|
||||
/* start--去除button的所有默认样式--start */
|
||||
.u-reset-button {
|
||||
padding: 0;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.u-reset-button::after {
|
||||
border: none;
|
||||
}
|
||||
/* end--去除button的所有默认样式--end */
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
|
||||
// this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
|
||||
// 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
|
||||
// 值(默认为undefined),就是查找最顶层的$parent
|
||||
export default function $parent(name = undefined) {
|
||||
let parent = this.$parent;
|
||||
// 通过while历遍,这里主要是为了H5需要多层解析的问题
|
||||
while (parent) {
|
||||
// 父组件
|
||||
if (parent.$options && parent.$options.name !== name) {
|
||||
// 如果组件的name不相等,继续上一级寻找
|
||||
parent = parent.$parent;
|
||||
} else {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
import validation from './test.js';
|
||||
|
||||
// 添加单位,如果有rpx,%,px等单位结尾或者值为auto,直接返回,否则加上rpx单位结尾
|
||||
export default function addUnit(value = 'auto', unit = 'rpx') {
|
||||
value = String(value);
|
||||
// 用uView内置验证规则中的number判断是否为数值
|
||||
return validation.number(value) ? `${value}${unit}` : value;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
function bem(name, conf) {
|
||||
|
||||
}
|
||||
|
||||
module.exports.bem = bem;
|
|
@ -0,0 +1,37 @@
|
|||
// 为了让用户能够自定义主题,会逐步弃用此文件,各颜色通过css提供
|
||||
// 为了给某些特殊场景使用和向后兼容,无需删除此文件(2020-06-20)
|
||||
let color = {
|
||||
primary: "#2979ff",
|
||||
primaryDark: "#2b85e4",
|
||||
primaryDisabled: "#a0cfff",
|
||||
primaryLight: "#ecf5ff",
|
||||
bgColor: "#f3f4f6",
|
||||
|
||||
info: "#909399",
|
||||
infoDark: "#82848a",
|
||||
infoDisabled: "#c8c9cc",
|
||||
infoLight: "#f4f4f5",
|
||||
|
||||
warning: "#ff9900",
|
||||
warningDark: "#f29100",
|
||||
warningDisabled: "#fcbd71",
|
||||
warningLight: "#fdf6ec",
|
||||
|
||||
error: "#fa3534",
|
||||
errorDark: "#dd6161",
|
||||
errorDisabled: "#fab6b6",
|
||||
errorLight: "#fef0f0",
|
||||
|
||||
success: "#19be6b",
|
||||
successDark: "#18b566",
|
||||
successDisabled: "#71d5a1",
|
||||
successLight: "#dbf1e1",
|
||||
|
||||
mainColor: "#303133",
|
||||
contentColor: "#606266",
|
||||
tipsColor: "#909399",
|
||||
lightColor: "#c0c4cc",
|
||||
borderColor: "#e4e7ed"
|
||||
}
|
||||
|
||||
export default color;
|
|
@ -0,0 +1,134 @@
|
|||
/**
|
||||
* 求两个颜色之间的渐变值
|
||||
* @param {string} startColor 开始的颜色
|
||||
* @param {string} endColor 结束的颜色
|
||||
* @param {number} step 颜色等分的份额
|
||||
* */
|
||||
function colorGradient(startColor = 'rgb(0, 0, 0)', endColor = 'rgb(255, 255, 255)', step = 10) {
|
||||
let startRGB = hexToRgb(startColor, false); //转换为rgb数组模式
|
||||
let startR = startRGB[0];
|
||||
let startG = startRGB[1];
|
||||
let startB = startRGB[2];
|
||||
|
||||
let endRGB = hexToRgb(endColor, false);
|
||||
let endR = endRGB[0];
|
||||
let endG = endRGB[1];
|
||||
let endB = endRGB[2];
|
||||
|
||||
let sR = (endR - startR) / step; //总差值
|
||||
let sG = (endG - startG) / step;
|
||||
let sB = (endB - startB) / step;
|
||||
let colorArr = [];
|
||||
for (let i = 0; i < step; i++) {
|
||||
//计算每一步的hex值
|
||||
let hex = rgbToHex('rgb(' + Math.round((sR * i + startR)) + ',' + Math.round((sG * i + startG)) + ',' + Math.round((sB *
|
||||
i + startB)) + ')');
|
||||
colorArr.push(hex);
|
||||
}
|
||||
return colorArr;
|
||||
}
|
||||
|
||||
// 将hex表示方式转换为rgb表示方式(这里返回rgb数组模式)
|
||||
function hexToRgb(sColor, str = true) {
|
||||
let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
||||
sColor = sColor.toLowerCase();
|
||||
if (sColor && reg.test(sColor)) {
|
||||
if (sColor.length === 4) {
|
||||
let sColorNew = "#";
|
||||
for (let i = 1; i < 4; i += 1) {
|
||||
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
|
||||
}
|
||||
sColor = sColorNew;
|
||||
}
|
||||
//处理六位的颜色值
|
||||
let sColorChange = [];
|
||||
for (let i = 1; i < 7; i += 2) {
|
||||
sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2)));
|
||||
}
|
||||
if(!str) {
|
||||
return sColorChange;
|
||||
} else {
|
||||
return `rgb(${sColorChange[0]},${sColorChange[1]},${sColorChange[2]})`;
|
||||
}
|
||||
} else if (/^(rgb|RGB)/.test(sColor)) {
|
||||
let arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",")
|
||||
return arr.map(val => Number(val));
|
||||
} else {
|
||||
return sColor;
|
||||
}
|
||||
};
|
||||
|
||||
// 将rgb表示方式转换为hex表示方式
|
||||
function rgbToHex(rgb) {
|
||||
let _this = rgb;
|
||||
let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
||||
if (/^(rgb|RGB)/.test(_this)) {
|
||||
let aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
|
||||
let strHex = "#";
|
||||
for (let i = 0; i < aColor.length; i++) {
|
||||
let hex = Number(aColor[i]).toString(16);
|
||||
hex = String(hex).length == 1 ? 0 + '' + hex : hex; // 保证每个rgb的值为2位
|
||||
if (hex === "0") {
|
||||
hex += hex;
|
||||
}
|
||||
strHex += hex;
|
||||
}
|
||||
if (strHex.length !== 7) {
|
||||
strHex = _this;
|
||||
}
|
||||
return strHex;
|
||||
} else if (reg.test(_this)) {
|
||||
let aNum = _this.replace(/#/, "").split("");
|
||||
if (aNum.length === 6) {
|
||||
return _this;
|
||||
} else if (aNum.length === 3) {
|
||||
let numHex = "#";
|
||||
for (let i = 0; i < aNum.length; i += 1) {
|
||||
numHex += (aNum[i] + aNum[i]);
|
||||
}
|
||||
return numHex;
|
||||
}
|
||||
} else {
|
||||
return _this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
|
||||
* sHex为传入的十六进制的色值
|
||||
* alpha为rgba的透明度
|
||||
*/
|
||||
function colorToRgba(color, alpha = 0.3) {
|
||||
color = rgbToHex(color)
|
||||
// 十六进制颜色值的正则表达式
|
||||
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
|
||||
/* 16进制颜色转为RGB格式 */
|
||||
let sColor = color.toLowerCase()
|
||||
if (sColor && reg.test(sColor)) {
|
||||
if (sColor.length === 4) {
|
||||
var sColorNew = '#'
|
||||
for (let i = 1; i < 4; i += 1) {
|
||||
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
|
||||
}
|
||||
sColor = sColorNew
|
||||
}
|
||||
// 处理六位的颜色值
|
||||
var sColorChange = []
|
||||
for (let i = 1; i < 7; i += 2) {
|
||||
sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2)))
|
||||
}
|
||||
// return sColorChange.join(',')
|
||||
return 'rgba(' + sColorChange.join(',') + ',' + alpha + ')'
|
||||
}
|
||||
else {
|
||||
return sColor
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
colorGradient,
|
||||
hexToRgb,
|
||||
rgbToHex,
|
||||
colorToRgba
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
let timeout = null;
|
||||
|
||||
/**
|
||||
* 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
|
||||
*
|
||||
* @param {Function} func 要执行的回调函数
|
||||
* @param {Number} wait 延时的时间
|
||||
* @param {Boolean} immediate 是否立即执行
|
||||
* @return null
|
||||
*/
|
||||
function debounce(func, wait = 500, immediate = false) {
|
||||
// 清除定时器
|
||||
if (timeout !== null) clearTimeout(timeout);
|
||||
// 立即执行,此类情况一般用不到
|
||||
if (immediate) {
|
||||
var callNow = !timeout;
|
||||
timeout = setTimeout(function() {
|
||||
timeout = null;
|
||||
}, wait);
|
||||
if (callNow) typeof func === 'function' && func();
|
||||
} else {
|
||||
// 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
|
||||
timeout = setTimeout(function() {
|
||||
typeof func === 'function' && func();
|
||||
}, wait);
|
||||
}
|
||||
}
|
||||
|
||||
export default debounce
|
|
@ -0,0 +1,23 @@
|
|||
// 判断arr是否为一个数组,返回一个bool值
|
||||
function isArray (arr) {
|
||||
return Object.prototype.toString.call(arr) === '[object Array]';
|
||||
}
|
||||
|
||||
// 深度克隆
|
||||
function deepClone (obj) {
|
||||
// 对常见的“非”值,直接返回原来值
|
||||
if([null, undefined, NaN, false].includes(obj)) return obj;
|
||||
if(typeof obj !== "object" && typeof obj !== 'function') {
|
||||
//原始类型直接返回
|
||||
return obj;
|
||||
}
|
||||
var o = isArray(obj) ? [] : {};
|
||||
for(let i in obj) {
|
||||
if(obj.hasOwnProperty(i)){
|
||||
o[i] = typeof obj[i] === "object" ? deepClone(obj[i]) : obj[i];
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
export default deepClone;
|
|
@ -0,0 +1,30 @@
|
|||
import deepClone from "./deepClone";
|
||||
|
||||
// JS对象深度合并
|
||||
function deepMerge(target = {}, source = {}) {
|
||||
target = deepClone(target);
|
||||
if (typeof target !== 'object' || typeof source !== 'object') return false;
|
||||
for (var prop in source) {
|
||||
if (!source.hasOwnProperty(prop)) continue;
|
||||
if (prop in target) {
|
||||
if (typeof target[prop] !== 'object') {
|
||||
target[prop] = source[prop];
|
||||
} else {
|
||||
if (typeof source[prop] !== 'object') {
|
||||
target[prop] = source[prop];
|
||||
} else {
|
||||
if (target[prop].concat && source[prop].concat) {
|
||||
target[prop] = target[prop].concat(source[prop]);
|
||||
} else {
|
||||
target[prop] = deepMerge(target[prop], source[prop]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
target[prop] = source[prop];
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
export default deepMerge;
|
|
@ -0,0 +1,47 @@
|
|||
// 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
|
||||
// this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
|
||||
export default function getParent(name, keys) {
|
||||
let parent = this.$parent;
|
||||
// 通过while历遍,这里主要是为了H5需要多层解析的问题
|
||||
while (parent) {
|
||||
// 父组件
|
||||
if (parent.$options.name !== name) {
|
||||
// 如果组件的name不相等,继续上一级寻找
|
||||
parent = parent.$parent;
|
||||
} else {
|
||||
let data = {};
|
||||
// 判断keys是否数组,如果传过来的是一个数组,那么直接使用数组元素值当做键值去父组件寻找
|
||||
if(Array.isArray(keys)) {
|
||||
keys.map(val => {
|
||||
data[val] = parent[val] ? parent[val] : '';
|
||||
})
|
||||
} else {
|
||||
// 历遍传过来的对象参数
|
||||
for(let i in keys) {
|
||||
// 如果子组件有此值则用,无此值则用父组件的值
|
||||
// 判断是否空数组,如果是,则用父组件的值,否则用子组件的值
|
||||
if(Array.isArray(keys[i])) {
|
||||
if(keys[i].length) {
|
||||
data[i] = keys[i];
|
||||
} else {
|
||||
data[i] = parent[i];
|
||||
}
|
||||
} else if(keys[i].constructor === Object) {
|
||||
// 判断是否对象,如果是对象,且有属性,那么使用子组件的值,否则使用父组件的值
|
||||
if(Object.keys(keys[i]).length) {
|
||||
data[i] = keys[i];
|
||||
} else {
|
||||
data[i] = parent[i];
|
||||
}
|
||||
} else {
|
||||
// 只要子组件有传值,即使是false值,也是“传值”了,也需要覆盖父组件的同名参数
|
||||
data[i] = (keys[i] || keys[i] === false) ? keys[i] : parent[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* 本算法来源于简书开源代码,详见:https://www.jianshu.com/p/fdbf293d0a85
|
||||
* 全局唯一标识符(uuid,Globally Unique Identifier),也称作 uuid(Universally Unique IDentifier)
|
||||
* 一般用于多个组件之间,给它一个唯一的标识符,或者v-for循环的时候,如果使用数组的index可能会导致更新列表出现问题
|
||||
* 最可能的情况是左滑删除item或者对某条信息流"不喜欢"并去掉它的时候,会导致组件内的数据可能出现错乱
|
||||
* v-for的时候,推荐使用后端返回的id而不是循环的index
|
||||
* @param {Number} len uuid的长度
|
||||
* @param {Boolean} firstU 将返回的首字母置为"u"
|
||||
* @param {Number} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
|
||||
*/
|
||||
function guid(len = 32, firstU = true, radix = null) {
|
||||
let chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
||||
let uuid = [];
|
||||
radix = radix || chars.length;
|
||||
|
||||
if (len) {
|
||||
// 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
|
||||
for (let i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
|
||||
} else {
|
||||
let r;
|
||||
// rfc4122标准要求返回的uuid中,某些位为固定的字符
|
||||
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
|
||||
uuid[14] = '4';
|
||||
|
||||
for (let i = 0; i < 36; i++) {
|
||||
if (!uuid[i]) {
|
||||
r = 0 | Math.random() * 16;
|
||||
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
|
||||
}
|
||||
}
|
||||
}
|
||||
// 移除第一个字符,并用u替代,因为第一个字符为数值时,该guid不能用作id或者class
|
||||
if (firstU) {
|
||||
uuid.shift();
|
||||
return 'u' + uuid.join('');
|
||||
} else {
|
||||
return uuid.join('');
|
||||
}
|
||||
}
|
||||
|
||||
export default guid;
|
|
@ -0,0 +1,385 @@
|
|||
/*
|
||||
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
||||
* Digest Algorithm, as defined in RFC 1321.
|
||||
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
||||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||||
* Distributed under the BSD License
|
||||
* See http://pajhome.org.uk/crypt/md5 for more info.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Configurable variables. You may need to tweak these to be compatible with
|
||||
* the server-side, but the defaults work in most cases.
|
||||
*/
|
||||
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
|
||||
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
|
||||
|
||||
/*
|
||||
* These are the functions you'll usually want to call
|
||||
* They take string arguments and return either hex or base-64 encoded strings
|
||||
*/
|
||||
function hex_md5(s) { return rstr2hex(rstr_md5(str2rstr_utf8(s))); }
|
||||
function b64_md5(s) { return rstr2b64(rstr_md5(str2rstr_utf8(s))); }
|
||||
function any_md5(s, e) { return rstr2any(rstr_md5(str2rstr_utf8(s)), e); }
|
||||
function hex_hmac_md5(k, d)
|
||||
{ return rstr2hex(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); }
|
||||
function b64_hmac_md5(k, d)
|
||||
{ return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); }
|
||||
function any_hmac_md5(k, d, e)
|
||||
{ return rstr2any(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
|
||||
|
||||
/*
|
||||
* Perform a simple self-test to see if the VM is working
|
||||
*/
|
||||
function md5_vm_test()
|
||||
{
|
||||
return hex_md5("abc").toLowerCase() == "900150983cd24fb0d6963f7d28e17f72";
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of a raw string
|
||||
*/
|
||||
function rstr_md5(s)
|
||||
{
|
||||
return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the HMAC-MD5, of a key and some data (raw strings)
|
||||
*/
|
||||
function rstr_hmac_md5(key, data)
|
||||
{
|
||||
var bkey = rstr2binl(key);
|
||||
if(bkey.length > 16) bkey = binl_md5(bkey, key.length * 8);
|
||||
|
||||
var ipad = Array(16), opad = Array(16);
|
||||
for(var i = 0; i < 16; i++)
|
||||
{
|
||||
ipad[i] = bkey[i] ^ 0x36363636;
|
||||
opad[i] = bkey[i] ^ 0x5C5C5C5C;
|
||||
}
|
||||
|
||||
var hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
|
||||
return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to a hex string
|
||||
*/
|
||||
function rstr2hex(input)
|
||||
{
|
||||
try { hexcase } catch(e) { hexcase=0; }
|
||||
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
|
||||
var output = "";
|
||||
var x;
|
||||
for(var i = 0; i < input.length; i++)
|
||||
{
|
||||
x = input.charCodeAt(i);
|
||||
output += hex_tab.charAt((x >>> 4) & 0x0F)
|
||||
+ hex_tab.charAt( x & 0x0F);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to a base-64 string
|
||||
*/
|
||||
function rstr2b64(input)
|
||||
{
|
||||
try { b64pad } catch(e) { b64pad=''; }
|
||||
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
var output = "";
|
||||
var len = input.length;
|
||||
for(var i = 0; i < len; i += 3)
|
||||
{
|
||||
var triplet = (input.charCodeAt(i) << 16)
|
||||
| (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
|
||||
| (i + 2 < len ? input.charCodeAt(i+2) : 0);
|
||||
for(var j = 0; j < 4; j++)
|
||||
{
|
||||
if(i * 8 + j * 6 > input.length * 8) output += b64pad;
|
||||
else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to an arbitrary string encoding
|
||||
*/
|
||||
function rstr2any(input, encoding)
|
||||
{
|
||||
var divisor = encoding.length;
|
||||
var i, j, q, x, quotient;
|
||||
|
||||
/* Convert to an array of 16-bit big-endian values, forming the dividend */
|
||||
var dividend = Array(Math.ceil(input.length / 2));
|
||||
for(i = 0; i < dividend.length; i++)
|
||||
{
|
||||
dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Repeatedly perform a long division. The binary array forms the dividend,
|
||||
* the length of the encoding is the divisor. Once computed, the quotient
|
||||
* forms the dividend for the next step. All remainders are stored for later
|
||||
* use.
|
||||
*/
|
||||
var full_length = Math.ceil(input.length * 8 /
|
||||
(Math.log(encoding.length) / Math.log(2)));
|
||||
var remainders = Array(full_length);
|
||||
for(j = 0; j < full_length; j++)
|
||||
{
|
||||
quotient = Array();
|
||||
x = 0;
|
||||
for(i = 0; i < dividend.length; i++)
|
||||
{
|
||||
x = (x << 16) + dividend[i];
|
||||
q = Math.floor(x / divisor);
|
||||
x -= q * divisor;
|
||||
if(quotient.length > 0 || q > 0)
|
||||
quotient[quotient.length] = q;
|
||||
}
|
||||
remainders[j] = x;
|
||||
dividend = quotient;
|
||||
}
|
||||
|
||||
/* Convert the remainders to the output string */
|
||||
var output = "";
|
||||
for(i = remainders.length - 1; i >= 0; i--)
|
||||
output += encoding.charAt(remainders[i]);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode a string as utf-8.
|
||||
* For efficiency, this assumes the input is valid utf-16.
|
||||
*/
|
||||
function str2rstr_utf8(input)
|
||||
{
|
||||
var output = "";
|
||||
var i = -1;
|
||||
var x, y;
|
||||
|
||||
while(++i < input.length)
|
||||
{
|
||||
/* Decode utf-16 surrogate pairs */
|
||||
x = input.charCodeAt(i);
|
||||
y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
|
||||
if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
|
||||
{
|
||||
x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Encode output as utf-8 */
|
||||
if(x <= 0x7F)
|
||||
output += String.fromCharCode(x);
|
||||
else if(x <= 0x7FF)
|
||||
output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
|
||||
0x80 | ( x & 0x3F));
|
||||
else if(x <= 0xFFFF)
|
||||
output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
|
||||
0x80 | ((x >>> 6 ) & 0x3F),
|
||||
0x80 | ( x & 0x3F));
|
||||
else if(x <= 0x1FFFFF)
|
||||
output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
|
||||
0x80 | ((x >>> 12) & 0x3F),
|
||||
0x80 | ((x >>> 6 ) & 0x3F),
|
||||
0x80 | ( x & 0x3F));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode a string as utf-16
|
||||
*/
|
||||
function str2rstr_utf16le(input)
|
||||
{
|
||||
var output = "";
|
||||
for(var i = 0; i < input.length; i++)
|
||||
output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
|
||||
(input.charCodeAt(i) >>> 8) & 0xFF);
|
||||
return output;
|
||||
}
|
||||
|
||||
function str2rstr_utf16be(input)
|
||||
{
|
||||
var output = "";
|
||||
for(var i = 0; i < input.length; i++)
|
||||
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
|
||||
input.charCodeAt(i) & 0xFF);
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to an array of little-endian words
|
||||
* Characters >255 have their high-byte silently ignored.
|
||||
*/
|
||||
function rstr2binl(input)
|
||||
{
|
||||
var output = Array(input.length >> 2);
|
||||
for(var i = 0; i < output.length; i++)
|
||||
output[i] = 0;
|
||||
for(var i = 0; i < input.length * 8; i += 8)
|
||||
output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an array of little-endian words to a string
|
||||
*/
|
||||
function binl2rstr(input)
|
||||
{
|
||||
var output = "";
|
||||
for(var i = 0; i < input.length * 32; i += 8)
|
||||
output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
||||
*/
|
||||
function binl_md5(x, len)
|
||||
{
|
||||
/* append padding */
|
||||
x[len >> 5] |= 0x80 << ((len) % 32);
|
||||
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
||||
|
||||
var a = 1732584193;
|
||||
var b = -271733879;
|
||||
var c = -1732584194;
|
||||
var d = 271733878;
|
||||
|
||||
for(var i = 0; i < x.length; i += 16)
|
||||
{
|
||||
var olda = a;
|
||||
var oldb = b;
|
||||
var oldc = c;
|
||||
var oldd = d;
|
||||
|
||||
a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
|
||||
d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
|
||||
c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
|
||||
b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
|
||||
a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
|
||||
d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
|
||||
c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
|
||||
b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
|
||||
a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
|
||||
d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
|
||||
c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
|
||||
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
|
||||
a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
|
||||
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
|
||||
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
|
||||
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
|
||||
|
||||
a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
|
||||
d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
|
||||
c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
|
||||
b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
|
||||
a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
|
||||
d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
|
||||
c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
|
||||
b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
|
||||
a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
|
||||
d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
|
||||
c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
|
||||
b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
|
||||
a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
|
||||
d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
|
||||
c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
|
||||
b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
|
||||
|
||||
a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
|
||||
d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
|
||||
c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
|
||||
b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
|
||||
a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
|
||||
d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
|
||||
c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
|
||||
b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
|
||||
a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
|
||||
d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
|
||||
c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
|
||||
b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
|
||||
a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
|
||||
d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
|
||||
c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
|
||||
b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
|
||||
|
||||
a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
|
||||
d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
|
||||
c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
|
||||
b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
|
||||
a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
|
||||
d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
|
||||
c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
|
||||
b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
|
||||
a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
|
||||
d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
|
||||
c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
|
||||
b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
|
||||
a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
|
||||
d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
|
||||
c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
|
||||
b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
|
||||
|
||||
a = safe_add(a, olda);
|
||||
b = safe_add(b, oldb);
|
||||
c = safe_add(c, oldc);
|
||||
d = safe_add(d, oldd);
|
||||
}
|
||||
return Array(a, b, c, d);
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions implement the four basic operations the algorithm uses.
|
||||
*/
|
||||
function md5_cmn(q, a, b, x, s, t)
|
||||
{
|
||||
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
|
||||
}
|
||||
function md5_ff(a, b, c, d, x, s, t)
|
||||
{
|
||||
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
||||
}
|
||||
function md5_gg(a, b, c, d, x, s, t)
|
||||
{
|
||||
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
||||
}
|
||||
function md5_hh(a, b, c, d, x, s, t)
|
||||
{
|
||||
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
|
||||
}
|
||||
function md5_ii(a, b, c, d, x, s, t)
|
||||
{
|
||||
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
||||
* to work around bugs in some JS interpreters.
|
||||
*/
|
||||
function safe_add(x, y)
|
||||
{
|
||||
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
||||
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||
return (msw << 16) | (lsw & 0xFFFF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitwise rotate a 32-bit number to the left.
|
||||
*/
|
||||
function bit_rol(num, cnt)
|
||||
{
|
||||
return (num << cnt) | (num >>> (32 - cnt));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
md5 : function(str){
|
||||
return hex_md5(str);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* 对象转url参数
|
||||
* @param {*} data,对象
|
||||
* @param {*} isPrefix,是否自动加上"?"
|
||||
*/
|
||||
function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
|
||||
let prefix = isPrefix ? '?' : ''
|
||||
let _result = []
|
||||
if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';
|
||||
for (let key in data) {
|
||||
let value = data[key]
|
||||
// 去掉为空的参数
|
||||
if (['', undefined, null].indexOf(value) >= 0) {
|
||||
continue;
|
||||
}
|
||||
// 如果值为数组,另行处理
|
||||
if (value.constructor === Array) {
|
||||
// e.g. {ids: [1, 2, 3]}
|
||||
switch (arrayFormat) {
|
||||
case 'indices':
|
||||
// 结果: ids[0]=1&ids[1]=2&ids[2]=3
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
_result.push(key + '[' + i + ']=' + value[i])
|
||||
}
|
||||
break;
|
||||
case 'brackets':
|
||||
// 结果: ids[]=1&ids[]=2&ids[]=3
|
||||
value.forEach(_value => {
|
||||
_result.push(key + '[]=' + _value)
|
||||
})
|
||||
break;
|
||||
case 'repeat':
|
||||
// 结果: ids=1&ids=2&ids=3
|
||||
value.forEach(_value => {
|
||||
_result.push(key + '=' + _value)
|
||||
})
|
||||
break;
|
||||
case 'comma':
|
||||
// 结果: ids=1,2,3
|
||||
let commaStr = "";
|
||||
value.forEach(_value => {
|
||||
commaStr += (commaStr ? "," : "") + _value;
|
||||
})
|
||||
_result.push(key + '=' + commaStr)
|
||||
break;
|
||||
default:
|
||||
value.forEach(_value => {
|
||||
_result.push(key + '[]=' + _value)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
_result.push(key + '=' + value)
|
||||
}
|
||||
}
|
||||
return _result.length ? prefix + _result.join('&') : ''
|
||||
}
|
||||
|
||||
export default queryParams;
|
|
@ -0,0 +1,10 @@
|
|||
function random(min, max) {
|
||||
if (min >= 0 && max > 0 && max >= min) {
|
||||
let gab = max - min + 1;
|
||||
return Math.floor(Math.random() * gab + min);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
export default random;
|
|
@ -0,0 +1,7 @@
|
|||
// 打乱数组
|
||||
function randomArray(array = []) {
|
||||
// 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
|
||||
return array.sort(() => Math.random() - 0.5);
|
||||
}
|
||||
|
||||
export default randomArray
|
|
@ -0,0 +1,122 @@
|
|||
/**
|
||||
* 路由跳转方法,该方法相对于直接使用uni.xxx的好处是使用更加简单快捷
|
||||
* 并且带有路由拦截功能
|
||||
*/
|
||||
|
||||
class Router {
|
||||
constructor() {
|
||||
// 原始属性定义
|
||||
this.config = {
|
||||
type: 'navigateTo',
|
||||
url: '',
|
||||
delta: 1, // navigateBack页面后退时,回退的层数
|
||||
params: {}, // 传递的参数
|
||||
animationType: 'pop-in', // 窗口动画,只在APP有效
|
||||
animationDuration: 300, // 窗口动画持续时间,单位毫秒,只在APP有效
|
||||
intercept: false, // 是否需要拦截
|
||||
}
|
||||
// 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
|
||||
// 这里在构造函数中进行this绑定
|
||||
this.route = this.route.bind(this)
|
||||
}
|
||||
|
||||
// 判断url前面是否有"/",如果没有则加上,否则无法跳转
|
||||
addRootPath(url) {
|
||||
return url[0] === '/' ? url : `/${url}`
|
||||
}
|
||||
|
||||
// 整合路由参数
|
||||
mixinParam(url, params) {
|
||||
url = url && this.addRootPath(url)
|
||||
|
||||
// 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
|
||||
// 如果有url中有get参数,转换后无需带上"?"
|
||||
let query = ''
|
||||
if (/.*\/.*\?.*=.*/.test(url)) {
|
||||
// object对象转为get类型的参数
|
||||
query = uni.$u.queryParams(params, false);
|
||||
// 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
|
||||
return url += "&" + query
|
||||
} else {
|
||||
// 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
|
||||
query = uni.$u.queryParams(params);
|
||||
return url += query
|
||||
}
|
||||
}
|
||||
|
||||
// 对外的方法名称
|
||||
async route(options = {}, params = {}) {
|
||||
// 合并用户的配置和内部的默认配置
|
||||
let mergeConfig = {}
|
||||
|
||||
if (typeof options === 'string') {
|
||||
// 如果options为字符串,则为route(url, params)的形式
|
||||
mergeConfig.url = this.mixinParam(options, params)
|
||||
mergeConfig.type = 'navigateTo'
|
||||
} else {
|
||||
mergeConfig = uni.$u.deepClone(options, this.config)
|
||||
// 否则正常使用mergeConfig中的url和params进行拼接
|
||||
mergeConfig.url = this.mixinParam(options.url, options.params)
|
||||
}
|
||||
|
||||
if(params.intercept) {
|
||||
this.config.intercept = params.intercept
|
||||
}
|
||||
// params参数也带给拦截器
|
||||
mergeConfig.params = params
|
||||
// 合并内外部参数
|
||||
mergeConfig = uni.$u.deepMerge(this.config, mergeConfig)
|
||||
// 判断用户是否定义了拦截器
|
||||
if (typeof uni.$u.routeIntercept === 'function') {
|
||||
// 定一个promise,根据用户执行resolve(true)或者resolve(false)来决定是否进行路由跳转
|
||||
const isNext = await new Promise((resolve, reject) => {
|
||||
uni.$u.routeIntercept(mergeConfig, resolve)
|
||||
})
|
||||
// 如果isNext为true,则执行路由跳转
|
||||
isNext && this.openPage(mergeConfig)
|
||||
} else {
|
||||
this.openPage(mergeConfig)
|
||||
}
|
||||
}
|
||||
|
||||
// 执行路由跳转
|
||||
openPage(config) {
|
||||
// 解构参数
|
||||
const {
|
||||
url,
|
||||
type,
|
||||
delta,
|
||||
animationType,
|
||||
animationDuration
|
||||
} = config
|
||||
if (config.type == 'navigateTo' || config.type == 'to') {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
animationType,
|
||||
animationDuration
|
||||
});
|
||||
}
|
||||
if (config.type == 'redirectTo' || config.type == 'redirect') {
|
||||
uni.redirectTo({
|
||||
url
|
||||
});
|
||||
}
|
||||
if (config.type == 'switchTab' || config.type == 'tab') {
|
||||
uni.switchTab({
|
||||
url
|
||||
});
|
||||
}
|
||||
if (config.type == 'reLaunch' || config.type == 'launch') {
|
||||
uni.reLaunch({
|
||||
url
|
||||
});
|
||||
}
|
||||
if (config.type == 'navigateBack' || config.type == 'back') {
|
||||
uni.navigateBack({
|
||||
delta
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default (new Router()).route
|