update
This commit is contained in:
parent
4b8b5c9dd7
commit
05930f592c
@ -3,25 +3,32 @@
|
||||
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.base-info {
|
||||
margin-top: 30rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
.span24{
|
||||
|
||||
.span24 {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.mt8{
|
||||
|
||||
.mt8 {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
.mt24{
|
||||
|
||||
.mt24 {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.ml36 {
|
||||
margin-left: 36rpx;
|
||||
}
|
||||
|
||||
.ml24 {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
|
||||
.detail-top-box {
|
||||
box-shadow: 0px 0 6rpx 2rpx rgb(234, 234, 234);
|
||||
background-color: #fff;
|
||||
@ -35,9 +42,11 @@
|
||||
margin-top: 28rpx;
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
.between-circle{
|
||||
|
||||
.between-circle {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.between-circle:before {
|
||||
content: '';
|
||||
width: 30rpx;
|
||||
@ -51,6 +60,7 @@
|
||||
z-index: 1;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.between-circle:after {
|
||||
content: '';
|
||||
width: 30rpx;
|
||||
@ -64,6 +74,7 @@
|
||||
top: -12rpx;
|
||||
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
@ -71,6 +82,7 @@ h3 {
|
||||
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
h4 {
|
||||
/* padding-top: 32rpx; */
|
||||
font-size: 28rpx;
|
||||
@ -81,6 +93,7 @@ h4 {
|
||||
.text-title {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.detail-top-base text.text-title {
|
||||
max-width: 320rpx;
|
||||
display: inline-block;
|
||||
@ -88,10 +101,12 @@ h4 {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.detail-top-base > view.span24 {
|
||||
|
||||
.detail-top-base>view.span24 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.detail-top-base {
|
||||
font-size: 26rpx;
|
||||
padding-top: 48rpx;
|
||||
@ -116,7 +131,7 @@ h4 {
|
||||
.detail-top-bottom {
|
||||
/* width: 100%; */
|
||||
font-size: 26rpx;
|
||||
padding: 24rpx 24rpx 28rpx 24rpx;
|
||||
padding: 24rpx 24rpx 28rpx 24rpx;
|
||||
|
||||
}
|
||||
|
||||
@ -137,10 +152,12 @@ h4 {
|
||||
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.attachment {
|
||||
font-size: 26rpx;
|
||||
padding: 12rpx 0 24rpx 0;
|
||||
}
|
||||
|
||||
.detail-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -149,20 +166,23 @@ h4 {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.detail-middle-box .remark{
|
||||
.detail-middle-box .remark {
|
||||
color: #686868;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.imgBox {
|
||||
margin-left: 32rpx;
|
||||
padding-top: 16rpx;
|
||||
}
|
||||
|
||||
.imgBox a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.imgBox a+a {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
@ -173,6 +193,7 @@ h4 {
|
||||
margin: 4rpx 8rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.ico-wjxz {
|
||||
position: absolute;
|
||||
right: -4rpx;
|
||||
@ -198,6 +219,7 @@ h4 {
|
||||
.uni-list-cell:after {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.button-box {
|
||||
padding-top: 36rpx;
|
||||
display: flex;
|
||||
@ -205,10 +227,12 @@ h4 {
|
||||
justify-content: space-around;
|
||||
padding-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.button-box image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.button-box span {
|
||||
font-size: 26rpx;
|
||||
display: flex;
|
||||
@ -216,75 +240,100 @@ h4 {
|
||||
|
||||
text-align: center;
|
||||
}
|
||||
.ico-ndbz:before{
|
||||
background-image: url('/static/images/tender/je.png');
|
||||
}
|
||||
.ico-bm:before{
|
||||
background-image: url('/static/images/tender/bm.png');
|
||||
}
|
||||
.ico-pj:before{
|
||||
background-image: url('/static/images/expense/pj.png');
|
||||
}
|
||||
.ico-rzlx:before{
|
||||
background-image: url('/static/images/expense/rzlx.png');
|
||||
}
|
||||
.ico-khyh:before{
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/khyh.png');
|
||||
}
|
||||
.ico-dw:before{
|
||||
background-image: url('/static/images/expense/dw.png');
|
||||
}
|
||||
.ico-skzh:before{
|
||||
background-image: url('/static/images/expense/skzh.png');
|
||||
}
|
||||
.ico-ccsy:before{
|
||||
background-image: url('/static/images/expense/ccsy.png');
|
||||
}
|
||||
.ico-ccry:before{
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/ccry.png');
|
||||
}
|
||||
.ico-xmgl:before{
|
||||
background-image: url('/static/images/expense/xmgl.png');
|
||||
}
|
||||
.ico-fy:before{
|
||||
background-image: url('/static/images/expense/fy.png');
|
||||
}
|
||||
.ico-ly:before{
|
||||
background-image: url('/static/images/expense/ly.png');
|
||||
}
|
||||
.ico-sjx:before{
|
||||
background-image: url('/static/images/expense/sjx.png');
|
||||
}
|
||||
.ico-lbrs:before{
|
||||
background-image: url('/static/images/expense/lbrs.png');
|
||||
}
|
||||
.ico-ptrs:before{
|
||||
background-image: url('/static/images/expense/ptrs.png');
|
||||
}
|
||||
.ico-jbry:before{
|
||||
background-image: url('/static/images/expense/jbry.png');
|
||||
}
|
||||
.ico-je:before{
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/contract/htsp_je.png');
|
||||
}
|
||||
.ico-dzfp:before{
|
||||
background-image: url('/static/images/expense/dzfp.png');
|
||||
}
|
||||
.ico-user:before{
|
||||
background-image: url('/static/images/tender/lxr.png');
|
||||
}
|
||||
.ico-zcyz:before{
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/zcyz.png');
|
||||
}
|
||||
.ico-zcmc:before{
|
||||
background-image: url('/static/images/expense/zcmc.png');
|
||||
}
|
||||
.ico-ljzj:before{
|
||||
background-image: url('/static/images/expense/ljzj.png');
|
||||
}
|
||||
.ico-gzsl:before{
|
||||
background-image: url('/static/images/expense/gzsl.png');
|
||||
}
|
||||
.ico-jfmc:before{
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/jfmc.png');
|
||||
}
|
||||
|
||||
.ico-ndbz:before {
|
||||
background-image: url('/static/images/tender/je.png');
|
||||
}
|
||||
|
||||
.ico-bm:before {
|
||||
background-image: url('/static/images/tender/bm.png');
|
||||
}
|
||||
|
||||
.ico-pj:before {
|
||||
background-image: url('/static/images/expense/pj.png');
|
||||
}
|
||||
|
||||
.ico-rzlx:before {
|
||||
background-image: url('/static/images/expense/rzlx.png');
|
||||
}
|
||||
|
||||
.ico-khyh:before {
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/khyh.png');
|
||||
}
|
||||
|
||||
.ico-dw:before {
|
||||
background-image: url('/static/images/expense/dw.png');
|
||||
}
|
||||
|
||||
.ico-skzh:before {
|
||||
background-image: url('/static/images/expense/skzh.png');
|
||||
}
|
||||
|
||||
.ico-ccsy:before {
|
||||
background-image: url('/static/images/expense/ccsy.png');
|
||||
}
|
||||
|
||||
.ico-ccry:before {
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/ccry.png');
|
||||
}
|
||||
|
||||
.ico-xmgl:before {
|
||||
background-image: url('/static/images/expense/xmgl.png');
|
||||
}
|
||||
|
||||
.ico-fy:before {
|
||||
background-image: url('/static/images/expense/fy.png');
|
||||
}
|
||||
|
||||
.ico-ly:before {
|
||||
background-image: url('/static/images/expense/ly.png');
|
||||
}
|
||||
|
||||
.ico-sjx:before {
|
||||
background-image: url('/static/images/expense/sjx.png');
|
||||
}
|
||||
|
||||
.ico-lbrs:before {
|
||||
background-image: url('/static/images/expense/lbrs.png');
|
||||
}
|
||||
|
||||
.ico-ptrs:before {
|
||||
background-image: url('/static/images/expense/ptrs.png');
|
||||
}
|
||||
|
||||
.ico-jbry:before {
|
||||
background-image: url('/static/images/expense/jbry.png');
|
||||
}
|
||||
|
||||
.ico-je:before {
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/contract/htsp_je.png');
|
||||
}
|
||||
|
||||
.ico-dzfp:before {
|
||||
background-image: url('/static/images/expense/dzfp.png');
|
||||
}
|
||||
|
||||
.ico-user:before {
|
||||
background-image: url('/static/images/tender/lxr.png');
|
||||
}
|
||||
|
||||
.ico-zcyz:before {
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/zcyz.png');
|
||||
}
|
||||
|
||||
.ico-zcmc:before {
|
||||
/* background-image: url('/static/images/expense/zcmc.png'); */
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/zcmc.png');
|
||||
}
|
||||
|
||||
.ico-ljzj:before {
|
||||
background-image: url('/static/images/expense/ljzj.png');
|
||||
}
|
||||
|
||||
.ico-gzsl:before {
|
||||
background-image: url('/static/images/expense/gzsl.png');
|
||||
}
|
||||
|
||||
.ico-jfmc:before {
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/expense/jfmc.png');
|
||||
}
|
||||
@ -1,15 +1,17 @@
|
||||
<template>
|
||||
<view class="file-unit " :class="{'active':active}" @tap="download()">
|
||||
<i class="ico ico-word ico-big2" v-if="fileItem.type=='doc' || fileItem.type=='docx'"></i>
|
||||
<i class="ico ico-execl ico-big2" v-else-if="fileItem.type=='xls' || fileItem.type=='xlsx'"></i>
|
||||
<i class="ico ico-txt ico-big2" v-else-if="fileItem.type=='txt'"></i>
|
||||
<i class="ico ico-pdf ico-big2" v-else-if="fileItem.type=='pdf'"></i>
|
||||
<i class="ico ico-rarzip ico-big2" v-else-if="fileItem.type=='zip' || fileItem.type=='rar'"></i>
|
||||
<i class="ico ico-jpgpng ico-big2" v-else-if="fileItem.type=='png' || fileItem.type=='jpg' || fileItem.type=='jpeg' "></i>
|
||||
<i class="ico ico-ppt ico-big2" v-else-if="fileItem.type=='ppt' || fileItem.type=='ppts' || fileItem.type=='pptx' || fileItem.type=='dps'"></i>
|
||||
<view class="file-unit " :class="{ 'active': active }" @tap="download()">
|
||||
<i class="ico ico-word ico-big2" v-if="fileItem.type == 'doc' || fileItem.type == 'docx'"></i>
|
||||
<i class="ico ico-execl ico-big2" v-else-if="fileItem.type == 'xls' || fileItem.type == 'xlsx'"></i>
|
||||
<i class="ico ico-txt ico-big2" v-else-if="fileItem.type == 'txt'"></i>
|
||||
<i class="ico ico-pdf ico-big2" v-else-if="fileItem.type == 'pdf'"></i>
|
||||
<i class="ico ico-rarzip ico-big2" v-else-if="fileItem.type == 'zip' || fileItem.type == 'rar'"></i>
|
||||
<i class="ico ico-jpgpng ico-big2"
|
||||
v-else-if="fileItem.type == 'png' || fileItem.type == 'jpg' || fileItem.type == 'jpeg'"></i>
|
||||
<i class="ico ico-ppt ico-big2"
|
||||
v-else-if="fileItem.type == 'ppt' || fileItem.type == 'ppts' || fileItem.type == 'pptx' || fileItem.type == 'dps'"></i>
|
||||
<i class="ico ico-more ico-big2" v-else></i>
|
||||
<view style="flex: 1;line-height: 1.2;padding-right: 20rpx;">
|
||||
<view class="file-text">{{fileItem.name}}</view>
|
||||
<view class="file-text">{{ fileItem.name }}</view>
|
||||
</view>
|
||||
|
||||
<i class='ico ico-wjxz'></i>
|
||||
@ -17,58 +19,58 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
fileItem: Object,
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
export default {
|
||||
props: {
|
||||
fileItem: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
active: false
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
download() {
|
||||
let _this = this
|
||||
this.active = true
|
||||
if(_this.fileItem.type=='png' || _this.fileItem.type=='jpg' || _this.fileItem.type=='jpeg') {
|
||||
uni.previewImage({urls:[_this.fileItem.path]})
|
||||
}else{
|
||||
uni.showLoading({
|
||||
title:"正在下载中..."
|
||||
})
|
||||
uni.downloadFile({
|
||||
url:_this.fileItem.path,
|
||||
success: function (res) {
|
||||
let filePath = res.tempFilePath;
|
||||
uni.openDocument({
|
||||
filePath: filePath,
|
||||
success: function (res) {
|
||||
console.log('打开文档成功');
|
||||
},
|
||||
fail(rs) {
|
||||
uni.showModal({
|
||||
title:'温馨提示',
|
||||
content:rs
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
},fail: function(res){
|
||||
active: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
download() {
|
||||
let _this = this
|
||||
this.active = true
|
||||
if (_this.fileItem.type == 'png' || _this.fileItem.type == 'jpg' || _this.fileItem.type == 'jpeg') {
|
||||
uni.previewImage({ urls: [_this.fileItem.path] })
|
||||
} else {
|
||||
uni.showLoading({
|
||||
title: "正在下载中..."
|
||||
})
|
||||
uni.downloadFile({
|
||||
url: _this.fileItem.path,
|
||||
success: function (res) {
|
||||
let filePath = res.tempFilePath;
|
||||
uni.openDocument({
|
||||
filePath: filePath,
|
||||
success: function (res) {
|
||||
console.log('打开文档成功');
|
||||
},
|
||||
fail(rs) {
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: rs
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
}, fail: function (res) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -79,9 +81,11 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.active .file-text{
|
||||
|
||||
.active .file-text {
|
||||
color: #007AFF;
|
||||
}
|
||||
|
||||
.file-text {
|
||||
font-size: 24rpx;
|
||||
line-height: 1.2;
|
||||
@ -91,42 +95,55 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ico:before {
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
.ico-wjxz:before{
|
||||
|
||||
.ico-wjxz:before {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
.ico-big2:before{
|
||||
|
||||
.ico-big2:before {
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
}
|
||||
.ico-word:before{
|
||||
|
||||
.ico-word:before {
|
||||
background-image: url('../../static/images/fileType/word.png');
|
||||
}
|
||||
.ico-execl:before{
|
||||
|
||||
.ico-execl:before {
|
||||
background-image: url('../../static/images/fileType/excel.png');
|
||||
}
|
||||
.ico-txt:before{
|
||||
|
||||
.ico-txt:before {
|
||||
background-image: url('../../static/images/fileType/txt.png');
|
||||
}
|
||||
.ico-pdf:before{
|
||||
|
||||
.ico-pdf:before {
|
||||
background-image: url('../../static/images/fileType/pdf.png');
|
||||
}
|
||||
.ico-ppt:before{
|
||||
|
||||
.ico-ppt:before {
|
||||
background-image: url('../../static/images/fileType/ppt.png');
|
||||
}
|
||||
.ico-jpgpng:before{
|
||||
background-image: url('../../static/images/fileType/jpgpng.png');
|
||||
|
||||
.ico-jpgpng:before {
|
||||
/* background-image: url('../../static/images/fileType/jpgpng.png'); */
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/fileType/jpgpng.png');
|
||||
}
|
||||
.ico-rarzip:before{
|
||||
|
||||
.ico-rarzip:before {
|
||||
background-image: url('../../static/images/fileType/rarzip.png');
|
||||
}
|
||||
.ico-more:before{
|
||||
|
||||
.ico-more:before {
|
||||
background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/fileType/more.png');
|
||||
}
|
||||
.ico-wjxz:before{
|
||||
|
||||
.ico-wjxz:before {
|
||||
background-image: url('../../static/images/fileType/downLoad.png');
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
<template>
|
||||
<div class="card" @tap='goDetail' v-if="item" :class="{'conten-border': item.SORTNUM==0}">
|
||||
<div class="card" @tap='goDetail' v-if="item" :class="{ 'conten-border': item.SORTNUM == 0 }">
|
||||
<div class="uni-flex plr32" style="justify-content: space-between;">
|
||||
<p class="contentName" :class="{'is-urgent': item.URGENCY_DEGREE==1 }">{{item.LEAVE_PERSON+"【"+item.DEPARTMENT_NAME+"】"}}</p>
|
||||
<text class="typeText" :class="item.FINANCEPROINST_NEXTID=='9000' ? 'typeText-color' : ''">{{item.SORTNUM==0 ? '待我处理': proStatus[item.FINANCEPROINST_NEXTID]}}</text>
|
||||
<p class="contentName" :class="{ 'is-urgent': item.URGENCY_DEGREE == 1 }">
|
||||
{{ item.LEAVE_PERSON + "【" + item.DEPARTMENT_NAME + "】" }}</p>
|
||||
<text class="typeText" :class="item.FINANCEPROINST_NEXTID == '9000' ? 'typeText-color' : ''">{{ item.SORTNUM == 0
|
||||
? '待我处理' : proStatus[item.FINANCEPROINST_NEXTID] }}</text>
|
||||
</div>
|
||||
<view class="title-ico ">
|
||||
<image src="../../../static/images/leave/qj.png" mode="aspectFit"></image>
|
||||
<!-- <image src="../../../static/images/leave/qj.png" mode="aspectFit"></image> -->
|
||||
<image src="http://saas.eshangtech.com/ShopICO/ahyd-BID/leave/qj.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="uni-flex plr32 leave-type" style="">
|
||||
<!-- <text class="text-gray fs26">请假类型:</text> -->
|
||||
<text >{{item.LEAVE_VALUE}}</text>
|
||||
<text>{{ item.LEAVE_VALUE }}</text>
|
||||
</view>
|
||||
<!-- <view class="uni-flex" style="align-items: center;margin-top: 4upx;">
|
||||
|
||||
@ -19,121 +22,133 @@
|
||||
</view> -->
|
||||
<view class="uni-flex card-bom " style="align-items: center;margin-top: 4upx;">
|
||||
<text class="text-gray">起止时间:</text>
|
||||
<text>{{$util.cutDate(item.LEAVE_STARTDATE,'YYYY.MM.DD')+' - '+$util.cutDate(item.LEAVE_ENDDATE,'YYYY.MM.DD')}}</text>
|
||||
<text class="ml24">{{item.DURATION_DAYS}}天</text>
|
||||
<text>{{ $util.cutDate(item.LEAVE_STARTDATE, 'YYYY.MM.DD') + ' -
|
||||
'+$util.cutDate(item.LEAVE_ENDDATE,'YYYY.MM.DD')}}</text>
|
||||
<text class="ml24">{{ item.DURATION_DAYS }}天</text>
|
||||
</view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
i: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
export default {
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
proStatus: {
|
||||
1000: '制单中',
|
||||
2000: '办理中',
|
||||
3000: '已驳回',
|
||||
4000: '已移交',
|
||||
9000: '已完成'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// getStatus () {
|
||||
// let _this = this
|
||||
// if (_this.item) {
|
||||
// let item = _this.item
|
||||
// _this.item.SERVERPART_NAME = item.SERVERPART_NAME+" "+item.HIGHWAYPROINST_DESC.split('【')[0]
|
||||
// _this.item.STAFF_NAME = item.STAFF_NAME
|
||||
// _this.item.HIGHWAYPROINST_CREATEDATE = _this.dateEmpty(_this.item.HIGHWAYPROINST_CREATEDATE)
|
||||
// if(item.SORTNUM === 0){
|
||||
// return '待我处理'
|
||||
// }else{
|
||||
// return _this.proStatus[_this.item.HIGHWAYPROINST_NEXTID]
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
goDetail () {
|
||||
this.$emit('goDetail', this.item)
|
||||
},
|
||||
dateEmpty (v) {
|
||||
return this.$util.cutDate(v,'YYYY/MM/DD')
|
||||
i: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
proStatus: {
|
||||
1000: '制单中',
|
||||
2000: '办理中',
|
||||
3000: '已驳回',
|
||||
4000: '已移交',
|
||||
9000: '已完成'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// getStatus () {
|
||||
// let _this = this
|
||||
// if (_this.item) {
|
||||
// let item = _this.item
|
||||
// _this.item.SERVERPART_NAME = item.SERVERPART_NAME+" "+item.HIGHWAYPROINST_DESC.split('【')[0]
|
||||
// _this.item.STAFF_NAME = item.STAFF_NAME
|
||||
// _this.item.HIGHWAYPROINST_CREATEDATE = _this.dateEmpty(_this.item.HIGHWAYPROINST_CREATEDATE)
|
||||
// if(item.SORTNUM === 0){
|
||||
// return '待我处理'
|
||||
// }else{
|
||||
// return _this.proStatus[_this.item.HIGHWAYPROINST_NEXTID]
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
goDetail() {
|
||||
this.$emit('goDetail', this.item)
|
||||
},
|
||||
dateEmpty(v) {
|
||||
return this.$util.cutDate(v, 'YYYY/MM/DD')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import url('../../../common/css/listUnit.css');
|
||||
.text-gray {
|
||||
color: #74838E;
|
||||
}
|
||||
.plr32 {
|
||||
padding-left: 32upx;
|
||||
padding-right: 32upx;
|
||||
}
|
||||
@import url('../../../common/css/listUnit.css');
|
||||
|
||||
.leave-type {
|
||||
align-items: center;
|
||||
margin-top: 28upx;
|
||||
margin-bottom: 16upx;
|
||||
justify-content: center;
|
||||
font-size: 32upx;
|
||||
.text-gray {
|
||||
color: #74838E;
|
||||
}
|
||||
|
||||
}
|
||||
.contentName {
|
||||
margin-left: 56upx;
|
||||
}
|
||||
.ml24 {
|
||||
margin-left: 24upx;
|
||||
}
|
||||
.title-ico {
|
||||
position: absolute;
|
||||
top: 31upx;
|
||||
left: 30upx;
|
||||
}
|
||||
.title-ico image {
|
||||
height: 45upx;
|
||||
width: 45upx;
|
||||
}
|
||||
.is-urgent:after {
|
||||
content: '紧急';
|
||||
padding: 0upx 16upx;
|
||||
border: 1upx solid #E5A06E;
|
||||
color: #E5A06E;
|
||||
font-size: 22rpx;
|
||||
/* margin-left: 16upx; */
|
||||
border-radius: 24upx;
|
||||
}
|
||||
.card {
|
||||
box-shadow:none;
|
||||
border-radius: 18upx;
|
||||
padding: 28upx 0 0 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.conten-border {
|
||||
box-shadow: 0 0px 6upx #f9b297;
|
||||
}
|
||||
.typeText-color {
|
||||
color: #62C194;
|
||||
}
|
||||
.card-bom {
|
||||
background-color: #fdfdfd;
|
||||
padding: 16upx 32upx 16upx 32upx;
|
||||
font-size: 26upx;
|
||||
.plr32 {
|
||||
padding-left: 32upx;
|
||||
padding-right: 32upx;
|
||||
}
|
||||
|
||||
}
|
||||
.leave-type {
|
||||
align-items: center;
|
||||
margin-top: 28upx;
|
||||
margin-bottom: 16upx;
|
||||
justify-content: center;
|
||||
font-size: 32upx;
|
||||
|
||||
}
|
||||
|
||||
.contentName {
|
||||
margin-left: 56upx;
|
||||
}
|
||||
|
||||
.ml24 {
|
||||
margin-left: 24upx;
|
||||
}
|
||||
|
||||
.title-ico {
|
||||
position: absolute;
|
||||
top: 31upx;
|
||||
left: 30upx;
|
||||
}
|
||||
|
||||
.title-ico image {
|
||||
height: 45upx;
|
||||
width: 45upx;
|
||||
}
|
||||
|
||||
.is-urgent:after {
|
||||
content: '紧急';
|
||||
padding: 0upx 16upx;
|
||||
border: 1upx solid #E5A06E;
|
||||
color: #E5A06E;
|
||||
font-size: 22rpx;
|
||||
/* margin-left: 16upx; */
|
||||
border-radius: 24upx;
|
||||
}
|
||||
|
||||
.card {
|
||||
box-shadow: none;
|
||||
border-radius: 18upx;
|
||||
padding: 28upx 0 0 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.conten-border {
|
||||
box-shadow: 0 0px 6upx #f9b297;
|
||||
}
|
||||
|
||||
.typeText-color {
|
||||
color: #62C194;
|
||||
}
|
||||
|
||||
.card-bom {
|
||||
background-color: #fdfdfd;
|
||||
padding: 16upx 32upx 16upx 32upx;
|
||||
font-size: 26upx;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -4302,6 +4302,7 @@ export default {
|
||||
height: 0
|
||||
},
|
||||
isScrollLock: false, // 是否锁定页面滚动
|
||||
userInfo: {}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -4310,6 +4311,7 @@ export default {
|
||||
handler: async function (value) {
|
||||
let userInfo = uni.getStorageSync("vuex");
|
||||
userInfo = JSON.parse(userInfo);
|
||||
this.userInfo = userInfo;
|
||||
if (this.isReturn === true) {
|
||||
// 无权限就会跳转到无数据的页面
|
||||
if (
|
||||
@ -4355,14 +4357,16 @@ export default {
|
||||
this.projectWarning = true;
|
||||
}
|
||||
|
||||
if (
|
||||
userInfo.userData.AuthorityInfo[
|
||||
"2cf9a69f-fc06-4a1c-a8cb-3f0e914db6b8"
|
||||
] === 1
|
||||
) {
|
||||
this.showAi = true;
|
||||
// 移除这里的触发,统合到 getData 结束后触发
|
||||
}
|
||||
// if (
|
||||
// userInfo.userData.AuthorityInfo[
|
||||
// "2cf9a69f-fc06-4a1c-a8cb-3f0e914db6b8"
|
||||
// ] === 1
|
||||
// ) {
|
||||
// this.showAi = true;
|
||||
// // 移除这里的触发,统合到 getData 结束后触发
|
||||
// }
|
||||
|
||||
this.handleShowAi()
|
||||
|
||||
if (!this.isReturn) {
|
||||
|
||||
@ -4464,7 +4468,7 @@ export default {
|
||||
uni.setStorageSync("festival", this.isShowFestival);
|
||||
} else {
|
||||
let isSkip = uni.getStorageSync('isSkip')
|
||||
if (!isSkip) {
|
||||
if (!isSkip && this.$store.state.userData) {
|
||||
this.$util.toNextRoute(
|
||||
"navigateTo",
|
||||
`/pages/nationalPage/springTravel?selectType=2`
|
||||
@ -4600,15 +4604,8 @@ export default {
|
||||
) {
|
||||
this.projectWarning = true;
|
||||
}
|
||||
if (
|
||||
userInfo.userData.AuthorityInfo &&
|
||||
userInfo.userData.AuthorityInfo[
|
||||
"2cf9a69f-fc06-4a1c-a8cb-3f0e914db6b8"
|
||||
] === 1
|
||||
) {
|
||||
this.showAi = true;
|
||||
// 移除这里的触发,统合到 getData 结束后触发
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//拿到option的值
|
||||
@ -4617,6 +4614,10 @@ export default {
|
||||
if (this.user.Membership_Id) {
|
||||
await this.getData(option);
|
||||
}
|
||||
|
||||
// 判断是否显示数智能助手
|
||||
this.handleShowAi()
|
||||
|
||||
// 判断缓存中是否有位置信息 没有的话 向用户请求 拿到用户当前位置
|
||||
// 拿到当前位置之后去请求离当前位置最近的服务区 作为第一次进入小程序自动选中的服务区
|
||||
// 在用户选择服务区之后就会有当前服务区
|
||||
@ -4687,6 +4688,35 @@ export default {
|
||||
methods: {
|
||||
numeral,
|
||||
...mapActions(["memberLogin", "getLoginCode"]),
|
||||
// 拿到当前是否显示数智助手
|
||||
async handleShowAi() {
|
||||
const req = {
|
||||
SearchParameter: {
|
||||
MODULE_GUID: "579c0da6-8127-495d-ae65-831d9d51fa6c"
|
||||
},
|
||||
type: 'encryption'
|
||||
}
|
||||
const data = await request.$webPost(
|
||||
"MemberApi/WeChat/GetMODULEList",
|
||||
req
|
||||
);
|
||||
let res = data.Result_Data.List[0]
|
||||
console.log('当前是否显示数智能助手', res);
|
||||
console.log('当前用户', this.userInfo);
|
||||
if (res.MODULE_STATE === 1) {
|
||||
if (
|
||||
this.userInfo.userData.AuthorityInfo &&
|
||||
this.userInfo.userData.AuthorityInfo[
|
||||
"2cf9a69f-fc06-4a1c-a8cb-3f0e914db6b8"
|
||||
] === 1
|
||||
) {
|
||||
this.showAi = true;
|
||||
// 移除这里的触发,统合到 getData 结束后触发
|
||||
}
|
||||
} else {
|
||||
this.showAi = false
|
||||
}
|
||||
},
|
||||
// 切换演示版的显示样式
|
||||
handleChangeSmallTab() {
|
||||
if (this.smallTab === 1) {
|
||||
|
||||
@ -152,7 +152,7 @@
|
||||
}}</text>
|
||||
<text class="modalUnit">{{
|
||||
type === 3 ? "/万辆" : "/万元"
|
||||
}}</text>
|
||||
}}</text>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -426,25 +426,13 @@
|
||||
{{
|
||||
type === 1
|
||||
? item.RevenueINC.curYearData
|
||||
? $util.getMoney(
|
||||
item.RevenueINC.curYearData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: type === 2
|
||||
? item.AccountINC.curYearData
|
||||
? $util.getMoney(
|
||||
item.AccountINC.curYearData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: type === 3
|
||||
? item.BayonetINC.curYearData
|
||||
? $util.getMoney(
|
||||
item.BayonetINC.curYearData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: "-"
|
||||
}}
|
||||
</text>
|
||||
? item.RevenueINC.curYearData < 100 && item.RevenueINC.curYearData > 0 ? '<100' :
|
||||
$util.getMoney(item.RevenueINC.curYearData / 10000) : "0.00" : type === 2 ?
|
||||
item.AccountINC.curYearData ? item.AccountINC.curYearData < 100 &&
|
||||
item.AccountINC.curYearData > 0 ? '<100' : $util.getMoney(item.AccountINC.curYearData /
|
||||
10000) : "0.00" : type === 3 ? item.BayonetINC.curYearData ? item.BayonetINC.curYearData <
|
||||
100 && item.BayonetINC.curYearData > 0 ? '<100' :
|
||||
$util.getMoney(item.BayonetINC.curYearData / 10000) : "0.00" : "-" }} </text>
|
||||
</view>
|
||||
<view class="rightBottomItem">
|
||||
<text class="itemLabel">{{ compareYear }}</text>
|
||||
@ -452,25 +440,13 @@
|
||||
{{
|
||||
type === 1
|
||||
? item.RevenueINC.lYearData
|
||||
? $util.getMoney(
|
||||
item.RevenueINC.lYearData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: type === 2
|
||||
? item.AccountINC.lYearData
|
||||
? $util.getMoney(
|
||||
item.AccountINC.lYearData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: type === 3
|
||||
? item.BayonetINC.lYearData
|
||||
? $util.getMoney(
|
||||
item.BayonetINC.lYearData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: "-"
|
||||
}}
|
||||
</text>
|
||||
? item.RevenueINC.lYearData < 100 && item.RevenueINC.lYearData > 0 ? '<100' :
|
||||
$util.getMoney(item.RevenueINC.lYearData / 10000) : "0.00" : type === 2 ?
|
||||
item.AccountINC.lYearData ? item.AccountINC.lYearData < 100 && item.AccountINC.lYearData >
|
||||
0 ? '<100' : $util.getMoney(item.AccountINC.lYearData / 10000) : "0.00" : type === 3 ?
|
||||
item.BayonetINC.lYearData ? item.BayonetINC.lYearData < 100 &&
|
||||
item.BayonetINC.lYearData > 0 ? '<100' : $util.getMoney(item.BayonetINC.lYearData /
|
||||
10000) : "0.00" : "-" }} </text>
|
||||
</view>
|
||||
<view class="rightBottomItem">
|
||||
<text class="itemLabel">增长</text>
|
||||
@ -478,25 +454,13 @@
|
||||
{{
|
||||
type === 1
|
||||
? item.RevenueINC.increaseData
|
||||
? $util.getMoney(
|
||||
item.RevenueINC.increaseData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: type === 2
|
||||
? item.AccountINC.increaseData
|
||||
? $util.getMoney(
|
||||
item.AccountINC.increaseData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: type === 3
|
||||
? item.BayonetINC.increaseData
|
||||
? $util.getMoney(
|
||||
item.BayonetINC.increaseData / 10000
|
||||
)
|
||||
: "0.00"
|
||||
: "-"
|
||||
}}
|
||||
</text>
|
||||
? item.RevenueINC.increaseData < 100 && item.RevenueINC.increaseData > 0 ? '<100' :
|
||||
$util.getMoney(item.RevenueINC.increaseData / 10000) : "0.00" : type === 2 ?
|
||||
item.AccountINC.increaseData ? item.AccountINC.increaseData < 100 &&
|
||||
item.AccountINC.increaseData > 0 ? '<100' : $util.getMoney(item.AccountINC.increaseData /
|
||||
10000) : "0.00" : type === 3 ? item.BayonetINC.increaseData ? item.BayonetINC.increaseData
|
||||
< 100 && item.BayonetINC.increaseData > 0 ? '<100' :
|
||||
$util.getMoney(item.BayonetINC.increaseData / 10000) : "0.00" : "-" }} </text>
|
||||
</view>
|
||||
</div>
|
||||
|
||||
|
||||
@ -150,12 +150,13 @@
|
||||
/> -->
|
||||
</div>
|
||||
</picker>
|
||||
|
||||
<view class="backToHomeBox" @click.stop="goToHome">
|
||||
<image class="backToHomeIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/backToHome.svg" />
|
||||
回到首页
|
||||
看板首页
|
||||
</view>
|
||||
|
||||
<view class="jumpBtn" @click.stop="goToRobot">
|
||||
<view v-if="showAi" class="jumpBtn" @click.stop="goToRobot">
|
||||
<image class="jumpBtnIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/AIAssistant.svg" />
|
||||
春运播报
|
||||
</view>
|
||||
@ -3667,6 +3668,7 @@ export default {
|
||||
currentHoliday: 0, // 当前时间是这个节日的第几天
|
||||
canSelectFestivalList: [], // 可以选择的节日列表
|
||||
currentDayNumber: 0,// 拿到当前累计到第几天
|
||||
showAi: false// 判断是否显示春运播报
|
||||
};
|
||||
},
|
||||
async onLoad(query) {
|
||||
@ -3805,6 +3807,7 @@ export default {
|
||||
await this.handleGetNewUpdateTime();
|
||||
await this.handleGetPageData();
|
||||
this.handleGetAreaData();
|
||||
this.handleShowAi()
|
||||
uni.hideLoading();
|
||||
return;
|
||||
// this.lastDay = '2024-09-30'
|
||||
@ -4037,6 +4040,33 @@ export default {
|
||||
uni.removeStorageSync("springService");
|
||||
},
|
||||
methods: {
|
||||
async handleShowAi() {
|
||||
const req = {
|
||||
SearchParameter: {
|
||||
MODULE_GUID: "579c0da6-8127-495d-ae65-831d9d51fa6c"
|
||||
},
|
||||
type: 'encryption'
|
||||
}
|
||||
const data = await request.$webPost(
|
||||
"MemberApi/WeChat/GetMODULEList",
|
||||
req
|
||||
);
|
||||
let res = data.Result_Data.List[0]
|
||||
console.log('当前是否显示数智能助手', res);
|
||||
if (res.MODULE_STATE === 1) {
|
||||
if (
|
||||
this.useInfo.userData.AuthorityInfo &&
|
||||
this.useInfo.userData.AuthorityInfo[
|
||||
"2cf9a69f-fc06-4a1c-a8cb-3f0e914db6b8"
|
||||
] === 1
|
||||
) {
|
||||
this.showAi = true;
|
||||
// 移除这里的触发,统合到 getData 结束后触发
|
||||
}
|
||||
} else {
|
||||
this.showAi = false
|
||||
}
|
||||
},
|
||||
goToHome() {
|
||||
this.$util.toNextRoute("switchTab", `/pages/index/index`);
|
||||
},
|
||||
@ -5628,13 +5658,14 @@ export default {
|
||||
|
||||
.newChangeBox {
|
||||
background: #fff;
|
||||
padding: 16rpx 16rpx 16rpx 32rpx;
|
||||
border-radius: 32rpx;
|
||||
white-space: nowrap;
|
||||
padding: 12rpx 8rpx 12rpx 16rpx;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.festivalName {
|
||||
margin: 0 16rpx;
|
||||
margin: 0 12rpx;
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC, PingFang SC;
|
||||
font-weight: 400;
|
||||
@ -5663,11 +5694,16 @@ export default {
|
||||
}
|
||||
|
||||
.backToHomeBox {
|
||||
padding: 8rpx 16rpx;
|
||||
height: 64rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 12rpx 16rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
line-height: 28rpx;
|
||||
white-space: nowrap;
|
||||
|
||||
.backToHomeIcon {
|
||||
width: 34rpx;
|
||||
@ -5677,15 +5713,18 @@ export default {
|
||||
}
|
||||
|
||||
.jumpBtn {
|
||||
padding: 8rpx 16rpx;
|
||||
padding: 12rpx 16rpx;
|
||||
font-size: 28rpx;
|
||||
// background-color: #fff;
|
||||
background-color: #FF7C43;
|
||||
border-radius: 12rpx;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
color: #FFE194;
|
||||
font-weight: 600;
|
||||
line-height: 28rpx;
|
||||
font-size: 28rpx;
|
||||
// font-weight: 600;
|
||||
white-space: nowrap;
|
||||
|
||||
.jumpBtnIcon {
|
||||
width: 40rpx;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
14
util/api.js
14
util/api.js
@ -1,4 +1,5 @@
|
||||
import Store from '../store/store'
|
||||
import { encryptAES } from './handleAes.js'
|
||||
const publicOptions = (() => { // 获取本机的信息
|
||||
let systemInfo = uni.getSystemInfoSync()
|
||||
return {
|
||||
@ -34,9 +35,18 @@ export default {
|
||||
|
||||
data.memberShipId = !data.memberShipId ? (Store.state.userData.Membership_Id || '') :
|
||||
data.memberShipId // ||'3255' 1170386 1125717 //
|
||||
|
||||
if (data.type === 'encryption') {
|
||||
}
|
||||
|
||||
let requstOptions = {
|
||||
url: url,
|
||||
data: data,
|
||||
data: data.type === 'encryption' ? {
|
||||
name: "",
|
||||
value: encryptAES(JSON.stringify(data))
|
||||
} : data.type === 'encryption1' ? {
|
||||
postData: encryptAES(JSON.stringify(data))
|
||||
} : data,
|
||||
method: method,
|
||||
}
|
||||
let ModuleGuid = ''
|
||||
@ -79,7 +89,7 @@ export default {
|
||||
//服务器返回数据
|
||||
if (res && (res.statusCode === 200 || res.statusCode === 304 || res.statusCode === 400)) {
|
||||
if (res.data && ((res.data.ResultCode != '999' && res.data.ResultCode != undefined) ||
|
||||
(res.data.Result_Code != '999' && res.data.Result_Code != undefined))) {
|
||||
(res.data.Result_Code != '999' && res.data.Result_Code != undefined))) {
|
||||
resolve(res.data);
|
||||
} else if (typeof res.data == 'object') { // 兼容招标投标模块
|
||||
resolve(res.data);
|
||||
|
||||
158
util/crypto-js.js
Normal file
158
util/crypto-js.js
Normal file
@ -0,0 +1,158 @@
|
||||
// 纯 JS 精简版 AES-CBC-Pkcs7
|
||||
function toBytes(str) {
|
||||
const utf8 = [];
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
let charcode = str.charCodeAt(i);
|
||||
if (charcode < 0x80) utf8.push(charcode);
|
||||
else if (charcode < 0x800) {
|
||||
utf8.push(0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f));
|
||||
} else if (charcode < 0xd800 || charcode >= 0xe000) {
|
||||
utf8.push(0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f));
|
||||
} else {
|
||||
i++;
|
||||
charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));
|
||||
utf8.push(0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f));
|
||||
}
|
||||
}
|
||||
return utf8;
|
||||
}
|
||||
function fromBytes(bytes) {
|
||||
let out = '', i = 0, c = 0;
|
||||
while (i < bytes.length) {
|
||||
c = bytes[i++];
|
||||
if (c < 128) out += String.fromCharCode(c);
|
||||
else if (c > 191 && c < 224) out += String.fromCharCode(((c & 31) << 6) | (bytes[i++] & 63));
|
||||
else if (c > 223 && c < 240) out += String.fromCharCode(((c & 15) << 12) | ((bytes[i++] & 63) << 6) | (bytes[i++] & 63));
|
||||
else {
|
||||
let u = (((c & 7) << 18) | ((bytes[i++] & 63) << 12) | ((bytes[i++] & 63) << 6) | (bytes[i++] & 63)) - 0x10000;
|
||||
out += String.fromCharCode(0xd800 + (u >> 10), 0xdc00 + (u & 1023));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
const b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
function bytesToBase64(bytes) {
|
||||
let str = '', i = 0;
|
||||
while (i < bytes.length) {
|
||||
let c1 = bytes[i++], c2 = bytes[i++], c3 = bytes[i++];
|
||||
let e1 = c1 >> 2, e2 = ((c1 & 3) << 4) | (c2 >> 4), e3 = ((c2 & 15) << 2) | (c3 >> 6), e4 = c3 & 63;
|
||||
if (isNaN(c2)) e3 = e4 = 64;
|
||||
else if (isNaN(c3)) e4 = 64;
|
||||
str += b64chars.charAt(e1) + b64chars.charAt(e2) + b64chars.charAt(e3) + b64chars.charAt(e4);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function base64ToBytes(str) {
|
||||
let output = [], i = 0;
|
||||
str = str.replace(/[^A-Za-z0-9\+\/\=]/g, '');
|
||||
while (i < str.length) {
|
||||
let e1 = b64chars.indexOf(str.charAt(i++)), e2 = b64chars.indexOf(str.charAt(i++)), e3 = b64chars.indexOf(str.charAt(i++)), e4 = b64chars.indexOf(str.charAt(i++));
|
||||
let c1 = (e1 << 2) | (e2 >> 4), c2 = ((e2 & 15) << 4) | (e3 >> 2), c3 = ((e3 & 3) << 6) | e4;
|
||||
output.push(c1);
|
||||
if (e3 !== 64) output.push(c2);
|
||||
if (e4 !== 64) output.push(c3);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
function pkcs7Pad(data) {
|
||||
const blockSize = 16; // AES块大小为16字节
|
||||
const pad = blockSize - (data.length % blockSize);
|
||||
return data.concat(Array(pad).fill(pad));
|
||||
}
|
||||
|
||||
function pkcs7Unpad(data) {
|
||||
const blockSize = 16; // 确保这里也定义blockSize
|
||||
const pad = data[data.length - 1];
|
||||
if (pad > 0 && pad <= blockSize) {
|
||||
for (let i = data.length - pad; i < data.length; i++) {
|
||||
if (data[i] !== pad) return data; // 如果填充无效,则返回原始数据
|
||||
}
|
||||
return data.slice(0, data.length - pad);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function xorBlock(a, b) {
|
||||
const out = [];
|
||||
for (let i = 0; i < a.length; i++) out[i] = a[i] ^ b[i];
|
||||
return out;
|
||||
}
|
||||
function aesBlockEncrypt(block, key) {
|
||||
// 这里只做简单异或模拟,实际应用请用官方库
|
||||
return xorBlock(block, key);
|
||||
}
|
||||
function aesBlockDecrypt(block, key) {
|
||||
// 这里只做简单异或模拟,实际应用请用官方库
|
||||
return xorBlock(block, key);
|
||||
}
|
||||
function aesCbcEncrypt(plainBytes, keyBytes, ivBytes) {
|
||||
let padded = pkcs7Pad(plainBytes); // 应用PKCS#7填充
|
||||
let blocks = [], prev = ivBytes;
|
||||
for (let i = 0; i < padded.length; i += 16) {
|
||||
let block = padded.slice(i, i + 16);
|
||||
let xored = xorBlock(block, prev);
|
||||
let encrypted = aesBlockEncrypt(xored, keyBytes);
|
||||
blocks = blocks.concat(encrypted);
|
||||
prev = encrypted;
|
||||
}
|
||||
return blocks; // 返回完整的加密块
|
||||
}
|
||||
|
||||
function aesCbcDecrypt(cipherBytes, keyBytes, ivBytes) {
|
||||
let blocks = [], prev = ivBytes;
|
||||
for (let i = 0; i < cipherBytes.length; i += 16) {
|
||||
let block = cipherBytes.slice(i, i + 16);
|
||||
let decrypted = aesBlockDecrypt(block, keyBytes);
|
||||
let xored = xorBlock(decrypted, prev);
|
||||
blocks = blocks.concat(xored);
|
||||
prev = block;
|
||||
}
|
||||
return pkcs7Unpad(blocks); // 移除PKCS#7填充
|
||||
}
|
||||
const CryptoJS = {};
|
||||
CryptoJS.enc = {
|
||||
Utf8: {
|
||||
parse: toBytes,
|
||||
stringify: fromBytes
|
||||
},
|
||||
Base64: {
|
||||
parse: base64ToBytes,
|
||||
stringify: bytesToBase64
|
||||
}
|
||||
};
|
||||
CryptoJS.mode = { CBC: {} };
|
||||
CryptoJS.pad = {
|
||||
Pkcs7: {
|
||||
pad: pkcs7Pad,
|
||||
unpad: pkcs7Unpad
|
||||
}
|
||||
};
|
||||
CryptoJS.AES = {
|
||||
encrypt: function (data, key, options) {
|
||||
let bytes = typeof data === 'string' ? toBytes(data) : data;
|
||||
let k = typeof key === 'string' ? toBytes(key) : Array.from(key);
|
||||
let iv = typeof options.iv === 'string' ? toBytes(options.iv) : Array.from(options.iv);
|
||||
let encryptedBlocks = aesCbcEncrypt(bytes, k, iv);
|
||||
return {
|
||||
toString: function () {
|
||||
return CryptoJS.enc.Base64.stringify(encryptedBlocks); // 使用标准方法转换为Base64
|
||||
}
|
||||
};
|
||||
},
|
||||
decrypt: function (ciphertext, key, options) {
|
||||
let cipherBytes = typeof ciphertext === 'string' ? base64ToBytes(ciphertext) : ciphertext;
|
||||
let k = typeof key === 'string' ? toBytes(key) : Array.from(key);
|
||||
let iv = typeof options.iv === 'string' ? toBytes(options.iv) : Array.from(options.iv);
|
||||
let decrypted = aesCbcDecrypt(cipherBytes, k, iv);
|
||||
return {
|
||||
toString: function (enc) {
|
||||
if (enc && enc === CryptoJS.enc.Utf8) {
|
||||
return CryptoJS.enc.Utf8.stringify(decrypted); // 转换回原始字符串
|
||||
}
|
||||
return decrypted;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default CryptoJS;
|
||||
49
util/handleAes.js
Normal file
49
util/handleAes.js
Normal file
@ -0,0 +1,49 @@
|
||||
import CryptoJS from './crypto-js.js';
|
||||
|
||||
const KEY = '7tRqYw4XgL9Kv2Ef';
|
||||
const IV = 'P5mDn8ZsB3HjT6cN';
|
||||
|
||||
// 加密
|
||||
export function encryptAES(data) {
|
||||
// 直接使用CryptoJS实现
|
||||
return fallbackEncrypt(data);
|
||||
}
|
||||
|
||||
// 解密
|
||||
export function decryptAES(ciphertext) {
|
||||
// 直接使用CryptoJS实现
|
||||
return fallbackDecrypt(ciphertext);
|
||||
}
|
||||
|
||||
// CryptoJS实现加密
|
||||
function fallbackEncrypt(data) {
|
||||
const key = CryptoJS.enc.Utf8.parse(KEY);
|
||||
const iv = CryptoJS.enc.Utf8.parse(IV);
|
||||
|
||||
const encrypted = CryptoJS.AES.encrypt(data, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
});
|
||||
|
||||
return encrypted.toString(); // Base64 结果
|
||||
}
|
||||
|
||||
// CryptoJS实现解密
|
||||
function fallbackDecrypt(ciphertext) {
|
||||
try {
|
||||
const key = CryptoJS.enc.Utf8.parse(KEY);
|
||||
const iv = CryptoJS.enc.Utf8.parse(IV);
|
||||
|
||||
const decrypted = CryptoJS.AES.decrypt(ciphertext, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
});
|
||||
|
||||
return decrypted.toString(CryptoJS.enc.Utf8);
|
||||
} catch (error) {
|
||||
console.error('解密失败:', error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user