Commit d94d92a1 authored by miaojiale's avatar miaojiale

项目初始化

parent e814104e
Pipeline #342 failed with stages
NODE_ENV = 'development'
VUE_APP_URL = 'https://zcas.wzswsj.gov.cn:8079/screening-api/'
VUE_APP_IMG = 'https://inno.sh-sict.com/wjy-mobile/'
NODE_ENV = 'production'
VUE_APP_URL = 'https://zcas.wzswsj.gov.cn:8079/screening-api/'
VUE_APP_URL = '/screening-api/'
VUE_APP_IMG = 'https://inno.sh-sict.com/wjy-mobile/'
\ No newline at end of file
.DS_Store
node_modules
/cssc-mobile
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Videodiagnosis
# Video diagnosis H5
视频诊断H5
\ No newline at end of file
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
### 打包
\ No newline at end of file
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
This diff is collapsed.
{
"name": "vue-cs-es",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"@vux/loader": "^2.1.0",
"axios": "^0.17.1",
"clipboard": "^2.0.1",
"core-js": "^3.6.5",
"crypto-js": "^3.1.9-1",
"fastclick": "^1.0.6",
"js-base64": "^2.4.9",
"js-file-download": "^0.4.1",
"lodash": "^4.17.4",
"marked": "^0.3.19",
"mescroll.js": "^1.4.0",
"mint-ui": "^2.2.13",
"moment": "^2.29.4",
"pinch-zoom-js": "^2.2.0",
"postcss-plugin-px2rem": "^0.8.1",
"qs": "^6.5.2",
"v-distpicker": "^1.0.16",
"vant": "^2.12.45",
"vue": "^2.6.11",
"vue-carousel": "^0.6.5",
"vue-product-zoomer": "^2.0.10",
"vue-router": "^3.2.0",
"vue-slim-better-scroll": "^1.7.1",
"vuex": "^3.4.0",
"vux": "^2.11.1",
"weixin-js-sdk": "^1.3.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.4.6",
"@vue/cli-plugin-router": "~4.4.6",
"@vue/cli-plugin-vuex": "~4.4.6",
"@vue/cli-service": "~4.4.6",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"sass": "^1.26.9",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11",
"vux-loader": "^1.2.9"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Access-Control-Allow-Origin" content="*" />
<meta http-equiv="X-UA-Compatible" content="edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="format-detection" content="telephone=yes">
<meta http-equiv="x-rim-auto-match" content="none">
<!-- <meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="expires" content="0" /> -->
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
<!-- 标签图标 -->
<!-- <link type="favicon" rel="shortcut icon" href="./static/favicon.ico" /> -->
<title>国家重大疾病</title>
<link rel="stylesheet" href="./static/swiper/idangerous.swiper.css">
<script src="./static/swiper/idangerous.swiper.min.js"></script>
<!-- <script src="./static/iSlider.js"></script> -->
<script src="https://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js"></script>
<script type="text/javascript">
var _hmt = _hmt || [];
</script>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<script src="https://hm.baidu.com/hm.js?08c72ecbd029d05f93ebb4a14a36dccf6" async></script>
</html>
<template>
<div
id="app"
:class="{'is-ipx':isIPX == 1}"
>
<transition :name="routerAnimate">
<keep-alive :include="keepAlive">
<router-view class="app-content"></router-view>
</keep-alive>
</transition>
<!-- <transition :name="routerAnimate">
<router-view class="app-content" v-if="!$route.meta.keepAlive"></router-view>
</transition> -->
<!--底部导航 路由 -->
<footer
class="app-footer"
v-if="$route.meta.index == 1 && carTabFlag!=2"
>
<wx-tab :tab="tabIndex"></wx-tab>
</footer>
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex'
import wxTab from '@/components/common/tab'
export default {
name: 'app',
components: {
wxTab,
},
data () {
return {
"tabIndex": 1,
"pageName": "",
"routerAnimate": "",
keepAlive: ['cHome'],
aliveRoute: ['screeningMap', 'screeningFiles']
}
},
watch: {
// 监听 $route 为内页设置不同的过渡效果
"$route" (to, from) {
/*动态设置路由缓存 start*/
if (this.aliveRoute.includes(to.name)) {
to.meta.keepAlive = true
}
let aliveRoute = this.$router.options.routes.filter(e => e.meta && e.meta.keepAlive).map(e => e.name)
this.keepAlive = aliveRoute
/*动态设置路由缓存 end*/
// console.log(aliveRoute);
if (to.path == "/homePageIdx") {
this.tabIndex = 0
this.setCarTabFlagData(1);
this.$forceUpdate();
} else if (to.path == "/categoryIdx") {
this.tabIndex = 1
this.setCarTabFlagData(1);
} else if (to.path == "/carIndex") {
this.tabIndex = 2
this.$forceUpdate();
} else if (to.path == "/userIndex") {
this.setCarTabFlagData(1);
this.tabIndex = 3
}
this.routerAnimate = ""
if (to.meta.index === from.meta.index) {
return;
// this.routerAnimate = "slide-left"
}
//都有值时
if (to.meta.index && from.meta.index) {
if (to.meta.index > from.meta.index) {//前进
this.routerAnimate = "slide-left"
} else {//后退
this.routerAnimate = "slide-right"
}
}
// 如果 该路由 在 免登录之外 且 loginFlg 状态为 需要登录 则跳转登录页
// console.log(this.$store.state.userInfo, '-this.userInfo');
// if (!this.$normalPage().toString().includes(this.$route.path) && (!this.userInfo.loginFlg || this.userInfo.loginFlg != '1')) {
// console.log("检验未通过,走index")
// this.$router.push({
// path: "/index",
// });
// }
},
},
computed: {
isIPX () {
// console.log(this.$store.state.isLogin)
return this.$store.state.isIPX
},
userInfo () {
return this.$store.state.userInfo || {}
},
carTabFlag () {
return this.$store.state.carTabFlag
}
},
methods: {
...mapActions(['setIsFromShareAction', 'setCarTabFlagData']),
},
created () {
},
mounted () {
}
}
</script>
<style lang="scss">
/*将公用的样式统一在此导入*/
@import './assets/css/base.css';
@import './assets/css/vuex-ui.css';
@import './assets/css/vant-ui.css';
@import './assets/iconfont.css';
html,
body {
width: 100%;
height: 100%;
font-size: 16px;
//overflow: hidden;
}
html {
font-size: calc(100vw / 7.5); /*1rem = 100px*/
}
#app {
height: 100%;
width: 100%;
}
.slide-right-enter-active,
.slide-right-leave-active,
.slide-left-enter-active,
.slide-left-leave-active {
will-change: transform;
transition: all 500ms;
position: absolute;
}
.slide-right-enter {
opacity: 0;
transform: translate3d(-100%, 0, 0);
}
.slide-right-leave-active {
/*opacity: 0;*/
display: none;
transform: translate3d(100%, 0, 0);
}
.slide-left-enter {
opacity: 0;
transform: translate3d(100%, 0, 0);
}
.slide-left-leave-active {
/*opacity: 0;*/
display: none;
transform: translate3d(-100%, 0, 0);
}
</style>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/* 覆盖mint-ui的primary颜色,改为自己UI的主题色 */
$color-primary: #ff6a00;
.mint-header {
background-color: $color-primary;
}
.mint-button:not(.is-disabled):active::after {
opacity: .2
/* .6 */
}
.mint-button--primary {
background-color: $color-primary;
}
.mint-button--primary.is-plain {
border: 1px solid $color-primary;
color: $color-primary
}
.mint-badge.is-primary {
background-color: $color-primary
}
.mint-switch-input:checked+.mint-switch-core {
border-color: $color-primary;
background-color: $color-primary;
}
.mint-navbar .mint-tab-item.is-selected {
border-bottom: 3px solid $color-primary;
color: $color-primary;
}
.mint-tabbar>.mint-tab-item.is-selected {
color: $color-primary;
}
.mint-searchbar-cancel {
color: $color-primary;
}
.mint-checkbox-input:checked+.mint-checkbox-core {
background-color: $color-primary;
border-color: $color-primary;
}
.mint-radio-input:checked+.mint-radio-core {
background-color: $color-primary;
border-color: $color-primary;
}
.mt-range-progress {
background-color: $color-primary;
}
.mt-progress-progress {
background-color: $color-primary;
}
.mint-msgbox-confirm {
color: $color-primary;
}
.mint-msgbox-confirm:active {
color: $color-primary;
}
.mint-datetime-action {
color: $color-primary;
}
.mint-msgbox-message {
text-align: left;
}
.mint-toast {
background: rgba(0, 0, 0, 0.6);
z-index: 9999;
}
.mint-msgbox-input input {
height: 44px;
}
.mint-msgbox-errormsg {
display: none;
}
.mint-msgbox-input {
padding-top: 0;
}
\ No newline at end of file
.van-dialog__footer{
border-top:1px solid #eee;
}
.van-dialog__message--has-title{
padding-top: 8px;
}
.van-submit-bar__button{
border-radius: 3px;
}
.van-field--error .van-field__control, .van-field--error .van-field__control::placeholder{
color: rgba(153, 153, 153,0.6) !important;
}
.van-button{
/* height: 2.5rem !important; */
border-radius: 4px !important;
}
.disable.van-button{
background: #999 !important;
border: 1px solid #999 !important;
}
.van-button--primary{
background: #f16200 !important;
border: 1px solid #f16200 !important;
}
.van-button--normal{
/* width: 114px !important; */
}
/* .van-button--info:hover{
background: rgb(221, 233, 236);
color: #1989fa;
} */
/* .van-button--info{
background-color: #0086FF !important;
border: 1px solid #0086FF !important;
}
.van-button--plain.van-button--info{
background-color: white !important;
color: #0086FF !important;
border-color:#0086FF !important;
} */
.van-button--info:active{
background: rgb(236, 247, 250) !important;
color: #0086FF !important;
}
.van-goods-action .van-goods-action-button--first{
margin-left: 50px;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
background: linear-gradient(90deg, #FECA05 0%, #FFAC02 100%);
border: none;
}
.van-goods-action .van-goods-action-button--last{
background: linear-gradient(90deg, #FF8800 0%, #FF5000 100%);
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border: none;
}
.van-dialog .van-dialog__header{
padding-top: 20px;
}
.van-dialog .van-dialog__message{
font-size: 14px;
}
.van-dialog .van-dialog__footer{
height: 40px;
}
.van-card{
background: #fff !important;
}
.van-card__title{
font-size: 14px !important;
}
.van-switch--on{
background: #f16200 !important;
}
.van-card__thumb{
width: 80px !important;
height: 80px !important;
}
.van-cell__right-icon {
color: #d7d7d7;
}
.van-nav-bar .van-icon{
color: #000 !important;
}
.van-stepper .van-stepper__input{
width: 25px !important;
}
.van-dialog{
border-radius: 8px !important;
}
.van-dialog .van-dialog__footer{
height: 50px;
}
.van-dialog .van-dialog__footer .van-button{
height: 50px !important;
}
.van-hairline--top::after {
border-top-width: 0px !important;
}
.van-overlay{
background-color: rgba(0, 0, 0, 0.4);
}
/***iPhone5以下机型特殊处理***/
@media(max-width:320px) and (min-height:490px){
.van-button{
height: 2.5rem !important;
line-height: 3rem !important;
}
}
.vux-header {
position: fixed !important;
width: 100%;
padding: 0 !important;
background-color: #127BFF !important;
color: #ffffff ;
font-size: 16px !important;
z-index: 510;
}
.vux-header-title-area, .vux-header .vux-header-title {
color: #ffffff;
font-size: 16px !important;
height:44px !important;
line-height: 45px !important;
margin:0 0!important;
}
.weui-dialog__btn,
.dp-header .dp-item.dp-right {
color: #1690e0 !important;
font-size: 16px;
}
.weui-dialog__btn_default {
color: #444 !important;
}
.weui-dialog {
/*padding:15px;*/
overflow: auto !important;
}
.wx-popover-dialog .weui-dialog {
padding: 15px;
}
.vux-header .vux-header-left{
top:12px !important;
}
.vux-header .vux-header-left,
.vux-header .vux-header-right,
.vux-header .vux-header-left a,
.vux-header .vux-header-left button,
.vux-header .vux-header-right a,
.vux-header .vux-header-right button {
color: white !important;
}
.vux-header .vux-header-left .left-arrow{
top:-3px !important;
left: -16px !important;
width: 16px !important;
height:16px !important;
}
.vux-header .vux-header-left .left-arrow:before {
border: 2px solid white !important;
border-width: 2px 0 0 2px !important;
top: 45% !important;
left: 16px !important;
/* margin-top:-6px; */
height:10px !important;
width: 10px !important;
}
.vux-tab .vux-tab-item {
color: #888 !important;
background: none !important;
}
.vux-tab .vux-tab-item.vux-tab-selected {
color: #444 !important;
border-bottom: 3px solid #ffd54b !important;
}
.default .vux-tab-ink-bar {
background-color: #ffd54b !important;
}
.default .vux-tab-ink-bar {
background-color: #ffd54b !important;
}
.weui-switch {
position: relative;
top: 8px;
}
.mint-header.bottom {
bottom: 0;
right: 0;
left: 0;
position: fixed;
z-index: 1;
}
/*长 黄色实心方按钮 <x-button class="yellow">取消订单</x-button>*/
/*长 黄色空心方按钮 <x-button class="yellow empty">取消订单</x-button>*/
/*长 黄色实心圆按钮 <x-button class="yellow radius">取消订单</x-button>*/
/*长 黄色空心圆按钮 <x-button class="yellow empty radius">取消订单</x-button>*/
/*短 <x-button mini class="yellow empty radius">取消订单</x-button>*/
.full-btn button.weui-btn {
width: 100%;
height: 100%;
padding: 0;
border-radius: 0;
}
.full-btn button.weui-btn:after {
border-width: 0;
}
button.weui-btn {
font-size: 14px;
line-height: 1;
padding: 12px 0;
}
button.weui-btn.radius {
border-radius: 40px;
}
button.weui-btn.gray {
background: #e0e0e0;
background: -moz-linear-gradient(left, #d6d6d6 0%, #e0e0e0 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #d6d6d6), color-stop(100%, #e0e0e0));
background: -webkit-linear-gradient(left, #d6d6d6 0%, #e0e0e0 100%);
background: -o-linear-gradient(left, #d6d6d6 0%, #e0e0e0 100%);
background: -ms-linear-gradient(left, #d6d6d6 0%, #e0e0e0 100%);
background: linear-gradient(to right, #d6d6d6 0%, #e0e0e0 100%);
color: #fff;
}
button.weui-btn.yellow {
background: #ffae11;
background: -moz-linear-gradient(left, #ffae11 0%, #ffd64e 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffae11), color-stop(100%, #ffd64e));
background: -webkit-linear-gradient(left, #ffae11 0%, #ffd64e 100%);
background: -o-linear-gradient(left, #ffae11 0%, #ffd64e 100%);
background: -ms-linear-gradient(left, #ffae11 0%, #ffd64e 100%);
background: linear-gradient(to right, #ffae11 0%, #ffd64e 100%);
color: #4f525a;
}
button.weui-btn.yellow.empty {
border: 1px solid #ffae11;
background: #fff;
color: #ffae11;
}
button.weui-btn:after {
border: 0;
}
button.weui-btn_mini {
line-height: 1;
min-width: 70px;
font-size: 12px;
padding: 8px 9px;
}
.weui-cell {
padding: 0 !important;
}
.weui-cell:before,
.weui-cells:before {
border-top: 0 !important;
left: 0 !important;
}
.weui-cells:after {
border-bottom: 0 !important;
left: 0 !important;
}
.weui-cell__hd {
margin-right: 0px !important;
}
.vux-1px-b {
height: 44px;
line-height: 44px;
text-align: center;
position: fixed;
background: #fff;
z-index: 502;
top: 0;
left: 0;
width: 100%;
}
.require-input .weui-input {
background-color: #eee !important;
height: 38px !important;
line-height: 38px !important;
padding-right: 36px !important;
}
.weui-cells_radio {
padding: 0 15px;
/*width: 100%;
-webkit-transition-property: -webkit-transform;
transition-property: -webkit-transform;
transition-property: transform;
transition-property: transform, -webkit-transform;
-webkit-transition-duration: 300ms;
transition-duration: 300ms;
overflow-y: auto;
-webkit-overflow-scrolling: touch;*/
}
.vux-popup-dialog .weui-cell {
height: 44px;
line-height: 44px;
}
.weui-btn+.weui-btn,
.weui-btn+.weui-btn {
margin-top: 0 !important;
}
.weui-icon-success-circle,
.vux-check-icon>.weui-icon-success:before,
.vux-check-icon>.weui-icon-success-circle:before,
.weui-cells_radio .weui-check:checked+.weui-icon-checked:before {
color: #ffae11 !important;
}
.is-link {
position: relative;
}
.is-link:before {
content: " ";
display: inline-block;
height: 6px;
width: 6px;
border-width: 2px 2px 0 0;
border-color: #C8C8CD;
border-style: solid;
-webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
position: relative;
top: -2px;
position: absolute;
top: 50%;
margin-top: -4px;
right: 2px;
color: #999999;
}
/*.mint-msgbox-confirm{
color: #ffae11;
}*/
.mint-msgbox-btn {
font-size: 14px;
}
.mint-msgbox-message {
line-height: 28px
}
.vux-datetime {
color: #444 !important;
}
/*loading*/
.weui-mask_transparent {
/* background: rgba(0, 0, 0, .4); */
/* background: none; */
}
/*.vux-loading.weui-loading_toast .weui-toast {
width: 70px;
height: 70px;
min-height: 70px;
top: 50%;
margin-top: -35px;
background: rgba(255, 255, 255, 1)
}*/
/*.vux-loading.vux-loading-no-text .weui-toast {
height: 70px;
min-height: 70px;
}*/
/*.weui-loading_toast .weui-toast__content,*/
.vux-loading .weui-toast {
z-index: 6000 !important;
}
/*.vux-loading .weui-toast:before {
content: '';
position: absolute;
top: 50%;
left: 50%;
background: url(../images/loading_inner.png) no-repeat 0 0;
-webkit-background-size: contain;
background-size: contain;
width: 35px;
height: 30px;
margin-top: -15px;
margin-left: -17px;
color: rgba(0, 0, 0, 0);
z-index: 6000;
}*/
.vux-loading .weui-icon_toast.weui-loading {
/*position: absolute;
top: 50%;
left: 50%;
width: 58px;
height: 58px;
background: url(../images/loading_outer.png) no-repeat 0 0;
-webkit-background-size: contain;
background-size: contain;
margin-left: -29px;
margin-top: -29px;
animation: roller 1s linear infinite;
-webkit-animation: roller 1s linear infinite;*/
z-index: 99999;
}
@-webkit-keyframes roller {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@keyframes roller {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.red-box .weui-textarea-counter {
color: #e93340;
}
.orange-box .weui-textarea-counter {
color: #ffae11;
}
.xs-plugin-pullup-container,
.xs-plugin-pulldowncontainer {
line-height: 40px;
color: #888;
}
.vux-popup-dialog .vux-popup-header-right {
color: #ffae11;
}
.weui-dialog__bd:first-child {
padding: 1em 20px 1em;
}
.vux-slider > .vux-indicator > a > .vux-icon-dot.active, .vux-slider .vux-indicator-right > a > .vux-icon-dot{
background-color: #7d7d7d;
}
.vux-slider > .vux-indicator > a > .vux-icon-dot.active, .vux-slider .vux-indicator-right > a > .vux-icon-dot.active{
width:16px;
background-color: #fff !important;
}
.vux-slider > .vux-swiper > .vux-swiper-item img{
width:100%;
}
.vux-popup-dialog{
max-height: 60% !important;
}
/* vux-confirm */
.vux-confirm .weui-dialog{
border-radius: 15px;
}
.vux-confirm .weui-dialog__btn_primary{
color:#ff6a00 !important;
}
.vux-confirm .weui-dialog__bd:first-child{
padding: 2em 20px 1.7em;
}
/* 邮箱 */
.vux-confirm .vux-prompt{
padding-top: 1.6em;
}
.vux-confirm .vux-prompt .vux-prompt-msgbox{
border: none;
background: #f6f6f6;
border-radius:0px;
padding:8px;
font-size:14px;
user-select:all;
}
.weui-mask_transparent{
z-index: 9999;
}
.vux-loading .weui-toast{
z-index: 99999;
}
.vux-popup-dialog{
padding-bottom: 62px !important;
}
.is-ipx .vux-popup-dialog{
padding-bottom: 92px !important;
}
.weui-tabbar__icon > sup{
top: -5px !important;
}
\ No newline at end of file
#wx-nav a.is-selected{
/*color: yellow;*/
}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
import {
get,
post,
put,
Delete,
postForm,
expoertExcel,
getExcel,
downloadExcel
} from "../request/http.js";
import { prototype } from "events";
const v1 = `/gastric-cancer${process.env.VUE_APP_MOD || ""}-user`;
const ewellDefectData = `/gastric-cancer${process.env.VUE_APP_MOD || ""}-data`;
const im = `/gastric-cancer${process.env.VUE_APP_MOD || ""}-im`;
export const API = {
//居民端跳转
postCToken: (data) => {
return post(`${v1}/app/customer/forward`, data);
},
/*******************
* 患者端-首页 *
*******************/
//文章推荐
postArticle: (data) => {
return post(`${ewellDefectData}/app/index/article/list`, data);
},
//! 筛查档案
reportInfo: (data) => {
return get(
`${ewellDefectData}/app/customer/screen/report?patientId=${data.patientId}`,
data
);
},
};
import axios from "axios";
import router from "../../router";
import qs from "qs";
// import { Message as iviewMessage, Notice as iviewNotice } from 'view-design'
import { MessageBox, Toast } from "mint-ui";
//接口报错弹出
let CommonAlert = function (msg) {
if (msg.length > 0) {
return Toast({
message: msg,
duration: 1500,
});
}
};
// axios.defaults.timeout = 5000;
if (process.env.NODE_ENV == "development") {
// axios.defaults.baseURL = 'https://inno.sh-sict.com/screening-api/';
} else {
axios.defaults.baseURL = process.env.VUE_APP_URL;
}
window.baseURL = axios.defaults.baseURL;
//http request 拦截器
axios.create({
withCredentials: true,
});
axios.interceptors.request.use(
(config) => {
config.data = config.data;
config.headers["user-cookie"] = localStorage.getItem("token");
if (config.url === "/ewell-tumors-user/province/list") {
//坐下判断如果是获取省市接口则不做拦截
}
// else if(!localStorage.getItem("token")){
// toLogin()
// }
return config;
},
(error) => {
return Promise.reject(err);
}
);
/**
* 跳转登录页
* 携带当前页面路由,以期在登录页面完成登录后返回当前页面
*/
const toLogin = () => {
router.replace({
path: "/register",
query: {
redirect: router.currentRoute.fullPath,
},
});
};
//响应拦截器即异常处理
axios.interceptors.response.use(
(response) => {
if (response.data.code === 0 || response.data.code === -1) {
CommonAlert(response.data.message);
} else if (response.data.code === -100) {
localStorage.removeItem('token')
window.location.hash = "/register";
}
return response;
},
(err) => {
if (err && err.response) {
switch (err.response.status) {
case 400:
CommonAlert("错误请求");
console.log("错误请求");
break;
case 401:
CommonAlert("未授权,请重新登录");
toLogin();
console.log("未授权,请重新登录");
break;
case 403:
CommonAlert("拒绝访问");
console.log("拒绝访问");
break;
case 404:
CommonAlert("请求错误,未找到该资源");
console.log("请求错误,未找到该资源");
break;
case 405:
CommonAlert("请求方法未允许");
console.log("请求方法未允许");
break;
case 408:
CommonAlert("请求超时");
console.log("请求超时");
break;
case 500:
CommonAlert("服务器端出错");
console.log("服务器端出错");
break;
case 501:
CommonAlert("网络未实现");
console.log("网络未实现");
break;
case 502:
CommonAlert("网络错误");
console.log("网络错误");
break;
case 503:
CommonAlert("服务不可用");
console.log("服务不可用");
break;
case 504:
CommonAlert("网络超时");
console.log("网络超时");
break;
case 505:
CommonAlert("http版本不支持该请求");
console.log("http版本不支持该请求");
break;
default:
CommonAlert(`连接错误${err.response.status}`);
console.log(`连接错误${err.response.status}`);
}
} else {
CommonAlert("连接到服务器失败");
console.log("连接到服务器失败");
}
return Promise.resolve(err.response);
}
);
/**
* 封装get方法
* @param url
* @param data
* @returns {Promise}
*/
export function get(url, data = {}) {
return new Promise((resolve, reject) => {
axios.get(url, data).then(
(response) => {
resolve(response.data);
},
(err) => {
reject(err);
}
);
});
}
/**
* 封装post请求
* @param url
* @param data
* @returns {Promise}
*/
export function post(url, data = {}, params = {}) {
return new Promise((resolve, reject) => {
axios
.post(url, data, {
params,
})
.then(
(response) => {
resolve(response.data);
},
(err) => {
reject(err);
}
);
});
}
export function postForm(url, data = {}) {
return new Promise((resolve, reject) => {
axios
.post(url, qs.stringify(data), {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
})
.then(
(response) => {
resolve(response.data);
},
(err) => {
reject(err);
}
);
});
}
//用来导出excel
export function expoertExcel(url, data = {}) {
return new Promise((resolve, reject) => {
axios
.post(url, qs.stringify(data), {
responseType: "blob",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
})
.then(
(response) => {
resolve(response.data);
},
(err) => {
reject(err);
}
);
});
}
//下载excel
export function downloadExcel(url, data = {}, title = "筛查信息导出表") {
return axios({
method: "post",
url: url,
data: data,
responseType: "blob",
})
.then((res) => {
if ("msSaveOrOpenBlob" in navigator) {
//兼容ie
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel",
});
window.navigator.msSaveOrOpenBlob(blob, `${title}.xlsx`);
return;
} else {
const link = document.createElement("a");
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel",
});
link.style.display = "none";
link.href = URL.createObjectURL(blob);
link.setAttribute("download", `${title}.xlsx`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
})
.catch((error) => {
// this.$Notice.error({
// title: '错误',
// desc: '系统数据错误',
// })
CommonAlert("系统数据错误");
console.log(error);
});
}
/**
* 封装delete请求
* @param url
* @param data
* @returns {Promise}
*/
export function Delete(url, data = {}) {
return new Promise((resolve, reject) => {
axios.delete(url, data).then(
(response) => {
resolve(response.data);
},
(err) => {
reject(err);
}
);
});
}
/**
* 封装put请求
* @param url
* @param data
* @returns {Promise}
*/
export function put(url, data = {}) {
return new Promise((resolve, reject) => {
axios.put(url, data).then(
(response) => {
resolve(response.data);
},
(err) => {
reject(err);
}
);
});
}
export function getUrl() {
return axios.defaults.baseURL;
}
<template>
<div id="wx-share-to-home">
<div class="share-to-home" v-if="isFromShare == '1'" @click="handleGoHome">去首页</div>
</div>
</template>
<script>
import wx from 'weixin-js-sdk'
import {mapActions,mapState} from 'vuex'
export default {
props: {
},
data() {
return {
}
},
watch: {
},
computed:{
isFromShare(){
// console.log(this.$store.state.isLogin)
return this.$store.state.isFromShare
},
},
methods:{
...mapActions(['setIsFromShareAction']),
handleGoHome(){
this.setIsFromShareAction("0")
this.$router.push({
path: "/"
});
}
},
mounted() {
// this.$msgbox(this.isFromShare)
},
}
</script>
<style scoped>
.share-to-home{
position: fixed;
bottom: 80px;
right: 15px;
width: 50px;
height: 50px;
border-radius:50px;
background: #fff;
text-align: center;
line-height: 50px;
font-size: 14px;
color:#19181d;
-moz-box-shadow:1px 1px 10px #B5B5B5; -webkit-box-shadow:1px 1px 10px #B5B5B5; box-shadow:1px 1px 10px #B5B5B5;
z-index:888;
}
</style>
\ No newline at end of file
<!-- 如果有header和footer 则: <v-content :has-header = "true" :has-footer="true"></v-content>-->
<!-- 如果无header和footer 则: <v-content></v-content> -->
<template>
<div class="content" :class="{'has-header':hasHeader,'has-footer':hasFooter}">
<div class="content-inner">
<slot></slot>
</div>
</div>
</template>
<script>
export default {
components: {
},
props: {
hasHeader: {
type: Boolean,
default: true
},
hasFooter:{
type: Boolean,
default: true
}
},
data () {
return {
}
}
}
</script>
<style lang="scss" scoped>
.has-header{
padding-top:44px !important;
}
.has-footer{
padding-bottom:58px !important;
}
.content{
width: 100%;
height:100%;
overflow-y:scroll;
}
.content-inner{
width: 100%;
height:100%;
overflow-x: hidden;
overflow-y: auto;
position: relative;
//padding-bottom: 16px;
scroll-behavior: smooth;
}
.is-ipx{
.has-footer{
padding-bottom: 64px !important;
}
}
</style>
\ No newline at end of file
import content from './content.vue'
// 这里是重点
const VContent = {
install: function(Vue){
Vue.component('v-content',content)
}
}
// 导出组件
export default VContent
\ No newline at end of file
<!-- 如果有通栏按钮 则: <v-footer :full-btn = "true"></v-footer>-->
<!-- 如果无通栏按钮 则: <v-footer></v-footer> -->
<template>
<div id="mt-footer" :class="{'full-btn':fullBtn}">
<div class="mt-footer-ct">
<slot></slot>
</div>
</div>
</template>
<script>
export default {
props: {
fullBtn: {
type: Boolean,
default: false
}
},
data() {
return {
}
},
watch: {
},
mounted() {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.mt-footer-ct {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #444;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 14px;
height: 52px;
line-height: 1;
padding: 0 15px;
position: relative;
text-align: center;
white-space: nowrap;
// -moz-box-shadow: 0px -2px 19px #DBDBDB;
// -webkit-box-shadow: 0px -2px 19px #DBDBDB;
// box-shadow: 0px -2px 19px #DBDBDB;
-moz-box-shadow: 0px -3px 5px rgba(0,0,0,0.05);;
-webkit-box-shadow: 0px -3px 5px rgba(0,0,0,0.05);;
box-shadow: 0px -3px 5px rgba(0,0,0,0.05);
bottom: 0;
right: 0;
left: 0;
position: fixed;
z-index: 1;
justify-content: center;
z-index: 2000;
}
.is-ipx{
.mt-footer-ct {
height: 72px;
padding-bottom: 20px;
}
}
.full-btn {
.mt-footer-ct {
padding: 0;
}
}
</style>
\ No newline at end of file
import footer from './footer.vue'
// 这里是重点
const VFooter = {
install: function(Vue){
Vue.component('v-footer',footer)
}
}
// 导出组件
export default VFooter
\ No newline at end of file
const ROOT_URL = "https://smartgate.changsha.gov.cn/tybmfwmh/Mapi/";
// const ROOT_URL = "https://inno.sh-sict.com/screening-api";
let BASE_CONFIG = {
// 服务地址、页面地址
ROOT_URL : ROOT_URL,
// 接口超时断开时间
REQUEST_TIMEOUT : '32000',
// 弹窗消息延时时间
MESSAGE_DURATION : '1500',
// autofocus延时时间
AUTOFOCUS_DURATION : '500',
// modal关闭延时时间
CLOSE_MODAL_DURATION : '200',
};
export {BASE_CONFIG};
\ No newline at end of file
const ROOT_URL = "https://inno.sh-sict.com/wenzhou-api";
let BASE_CONFIG = {
// 服务地址、页面地址
ROOT_URL : ROOT_URL,
// 接口超时断开时间
REQUEST_TIMEOUT : '32000',
// 弹窗消息延时时间
MESSAGE_DURATION : '1500',
// autofocus延时时间
AUTOFOCUS_DURATION : '500',
// modal关闭延时时间
CLOSE_MODAL_DURATION : '200',
};
export {BASE_CONFIG};
\ No newline at end of file
const ROOT_URL = '';
const OSS_SERVICE_ADDRESS = ""
let BASE_CONFIG = {
// 服务地址、页面地址
ROOT_URL : ROOT_URL,
// 接口超时断开时间
REQUEST_TIMEOUT : '32000',
// 弹窗消息延时时间
MESSAGE_DURATION : '1500',
// autofocus延时时间
AUTOFOCUS_DURATION : '500',
// modal关闭延时时间
CLOSE_MODAL_DURATION : '200',
};
export {BASE_CONFIG};
let SERVICE_CODE = {
TEST_CODE:"pl040002",
TEST_INDSERT:"zly010001",
OSS_SIGNATURE: '0900001',
};
let STATE_CODE = {
CORRECT_CODE: '0000', // 正确码
CORRECT_CODE_REG: /^[M]/, // 其它状态正确码 以M字母开头的状态信息
ERROR_CODE: /^(9901|9902|9903|9999)$/, // 错误码 9901,9902,9903,9999 系统错误
SESSION_TIMEOUT_CODE: '9801', // session超时状态码
RIGHT_LIMITE_CODE: '9803', // 没有权限执行该操作
HAS_LOGIN_CODE: '9804' // 单点登录报错
}
export {
SERVICE_CODE,
STATE_CODE
};
\ No newline at end of file
// import inputNumber from './input-number';
// import inputPwd from './input-pwd';
// import errorImg from './error-image';
export default {
install(Vue, options) {
// Vue.directive('inputNumber', inputNumber);
// Vue.directive('inputPwd', inputPwd);
// Vue.directive('errorImg', errorImg);
}
}
\ No newline at end of file
// import formatMoney from './formatMoney';
export default {
install(Vue, options) {
//货币格式化 1000->1,000
// Vue.filter('formatMoney', formatMoney);
}
};
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from "vue";
// import Vue from "vue/dist/vue.common.js";
import { API } from "../src/axios/api/index.js";
Vue.prototype.$API = API;
import App from "./App";
import router from "./router";
import utils from "./utils/util";
import filters from "./filters/index";
import directives from "./directives/index";
import store from "./store/index.js";
import wx from "weixin-js-sdk";
import Scroll from "vue-slim-better-scroll";
import Vant from "vant";
import "vant/lib/index.css";
import "vant/lib/index.less";
import "../src/styles/vantTheme.less";
import clipboard from "clipboard";
Vue.prototype.clipboard = clipboard;
Vue.use(Scroll);
Vue.use(Vant);
import { MessageBox, Toast, Indicator } from "mint-ui";
//Vue.prototype.$message = Toast({duration:1000});
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
// 全局注册自定义组件
import VContent from "./components/common/content";
import VFooter from "./components/common/footer";
Vue.use(VContent);
Vue.use(VFooter);
Vue.use(wx);
import {
ToastPlugin,
XButton,
XHeader,
Cell,
CellBox,
Tab,
TabItem,
ViewBox,
PopupRadio,
Group,
XTextarea,
Panel,
Scroller,
XInput,
Tabbar,
TabbarItem,
Sticky,
XSwitch,
Selector,
Box,
LoadingPlugin,
FormPreview,
DatetimeRange,
ConfirmPlugin,
Confirm,
CheckIcon,
Popup,
Radio,
PopupHeader,
PopupPicker,
XAddress,
Datetime,
Flow,
FlowState,
FlowLine,
Popover,
TransferDom,
XDialog,
Flexbox,
FlexboxItem,
Qrcode,
Swiper,
SwiperItem,
Search,
Marquee,
MarqueeItem,
} from "vux";
import FastClick from "fastclick"; //使用 fastclick 解决移动端 300ms 点击延迟
FastClick.attach(document.body);
FastClick.prototype.focus = function (targetElement) {
var length;
var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0;
var deviceIsIOS =
/iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;
//兼容处理:在iOS7中,有一些元素(如date、datetime、month等)在setSelectionRange会出现TypeError
//这是因为这些元素并没有selectionStart和selectionEnd的整型数字属性,所以一旦引用就会报错,因此排除这些属性才使用setSelectionRange方法
try {
if (
deviceIsIOS &&
targetElement.setSelectionRange &&
targetElement.type.indexOf("date") !== 0 &&
targetElement.type !== "time" &&
targetElement.type !== "month" &&
targetElement.type !== "email"
) {
length = targetElement.value.length;
targetElement.setSelectionRange(length, length); //修复bug ios 11.3不弹出键盘,这里加上聚焦代码,让其强制聚焦弹出键盘
targetElement.focus();
} else {
targetElement.focus();
}
} catch (error) {
console.warn(error);
}
};
if (/Android [4-6]/.test(navigator.appVersion)) {
window.addEventListener("resize", function () {
if (
document.activeElement.tagName == "INPUT" ||
document.activeElement.tagName == "TEXTAREA"
) {
window.setTimeout(function () {
document.activeElement.scrollIntoViewIfNeeded();
}, 0);
}
});
}
Vue.component("x-button", XButton);
Vue.component("x-header", XHeader);
Vue.component("cell", Cell);
Vue.component("cell-box", CellBox);
Vue.component("tab", Tab);
Vue.component("tab-item", TabItem);
Vue.component("view-box", ViewBox);
Vue.component("popup-radio", PopupRadio);
Vue.component("group", Group);
Vue.component("x-textarea", XTextarea);
Vue.component("panel", Panel);
Vue.component("popup-picker", PopupPicker);
Vue.component("scroller", Scroller);
Vue.component("x-input", XInput);
Vue.component("tabbar", Tabbar);
Vue.component("tabbar-item", TabbarItem);
Vue.component("sticky", Sticky);
Vue.component("x-switch", XSwitch);
Vue.component("selector", Selector);
Vue.component("box", Box);
Vue.component("form-preview", FormPreview);
Vue.component("datetime-range", DatetimeRange);
Vue.component("confirm", Confirm);
Vue.component("check-icon", CheckIcon);
Vue.component("popup", Popup);
Vue.component("radio", Radio);
Vue.component("popup-header", PopupHeader);
Vue.component("x-address", XAddress);
Vue.component("datetime", Datetime);
Vue.component("flow", Flow);
Vue.component("flow-state", FlowState);
Vue.component("flow-line", FlowLine);
Vue.component("popover", Popover);
Vue.directive("transfer-dom", TransferDom);
Vue.component("x-dialog", XDialog);
Vue.component("flexbox", Flexbox);
Vue.component("flexbox-item", FlexboxItem);
Vue.component("qrcode", Qrcode);
Vue.component("swiper", Swiper);
Vue.component("SwiperItem", SwiperItem);
Vue.component("search", Search);
Vue.component("marquee", Marquee);
Vue.component("marquee-item", MarqueeItem);
Vue.config.productionTip = false;
Vue.use(utils);
Vue.use(filters);
Vue.use(directives);
Vue.use(LoadingPlugin);
Vue.use(ToastPlugin);
Vue.use(ConfirmPlugin);
import "mint-ui/lib/style.css";
import "./assets/css/my-mint.scss"; //全局修改mint-UI样式
import VueLazyload from "vue-lazyload";
Vue.use(VueLazyload);
new Vue({
el: "#app",
router,
store,
wx,
render: (h) => h(App),
});
<template>
<div></div>
</template>
<script>
export default {
data () {
return {}
},
methods: {},
mounted () { },
watch: {}
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<!-- 筛查地图 -->
<div class="index-wrap">
<x-header :left-options="{ backText: '', showBack: true }">
筛查地图
</x-header>
<v-content
has-header
:has-footer="false"
>
<van-search
v-model="searchInputValue"
shape="round"
background="#127BFF"
placeholder="请输入搜索关键词"
>
<template slot="right-icon">
<div
@click="inputSearch"
class="doText"
>搜索</div>
</template>
</van-search>
<div class="top_select">
<div
class="select_address"
v-for="(item, index) in selectObj"
:key="index"
>
<span
v-show="!item.chooseData"
@click="showChooseData(index)"
>{{ item.label }}
<van-icon
name="play"
class="column_play"
/>
</span>
<span v-show="item.chooseData">{{ item.chooseData }}
<van-icon
name="cross"
color="red"
@click="clearLocate(index)"
/>
</span>
</div>
</div>
<!-- 列表 -->
<div
class="list_content"
ref="scroller"
>
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="getList"
>
<van-cell-group
inset
v-for="(item, index) in hospitalList"
:key="index"
>
<van-cell
center
:title="item.hospitalName"
:label="item.address||'--'"
is-link
:to="`appointmentType?id=${item.hospitalNumber}`"
>
<template #right-icon> </template>
<template
#icon
v-if="item.hospitalRank"
>
123
</template>
<template
#icon
v-else
>
234
</template>
</van-cell>
</van-cell-group>
</van-list>
</div>
</v-content>
<!-- 弹出层公用 -->
<van-popup
v-model="chooseFlag"
position="bottom"
>
<van-picker
:title="showTitle"
show-toolbar
:columns="showOptions"
@confirm="onConfirm"
@cancel="onCancel"
/>
</van-popup>
</div>
</template>
<script>
let addressInfo = [
{
value: "330301000000",
label: "市辖区"
},
{
value: "330302000000",
label: "鹿城区"
},
{
value: "330303000000",
label: "龙湾区"
},
{
value: "330304000000",
label: "瓯海区"
},
{
value: "330305000000",
label: "洞头区"
},
{
value: "330324000000",
label: "永嘉县"
},
{
value: "330326000000",
label: "平阳县"
},
{
value: "330327000000",
label: "苍南县"
},
{
value: "330328000000",
label: "文成县"
},
{
value: "330329000000",
label: "泰顺县"
},
{
value: "330381000000",
label: "瑞安市"
},
{
value: "330382000000",
label: "乐清市"
}
]
export default {
name: 'screeningMap',
data () {
return {
searchInputValue: "",
chooseFlag: false,
showTitle: "",
pageNum: 1,
pageSize: 10,
totalCount: 0,
showIndex: 0, // 展示的下标
showOptions: [],
selectObj: [
{
label: "选择区县",
chooseData: '',
options: addressInfo.map(e => e.label)
},
{
label: "全部等级",
chooseData: '',
options: ["三级", "二级", "一级", "其他"]
}
],
hospitalList: [
// {
// name: "长江医院",
// address: "温州皮革厂"
// }
],
loading: false,
finished: false,
};
},
methods: {
// 搜索
inputSearch () {
this.pageNum = 0
this.getList()
},
getList () {
this.loading = true;
this.finished = false;
//? 处理一下区县编码
let locatecode = this.selectObj[0].chooseData
if (locatecode) {
locatecode = addressInfo.filter(e => e.label == locatecode)[0].value
}
if (this.hospitalList.length > 0 && this.hospitalList.length <= this.totalCount) {
this.pageNum++
}
let data = {
pageNum: this.pageNum,
pageSize: this.pageSize,
hospitalName: this.searchInputValue || undefined,
districtCode: locatecode || undefined,
hospitalRank: this.selectObj[1].chooseData || undefined,
}
},
// 调出底部面板
showChooseData (num) {
this.showIndex = num;
this.showOptions = this.selectObj[num].options
switch (num) {
case 0:
this.showTitle = "请选择所在区县";
break;
case 1:
this.showTitle = "请选择等级";
break;
default:
break;
}
this.chooseFlag = true;
},
clearLocate (index) {
this.selectObj[index].chooseData = "";
this.chooseFlag = false;
this.pageNum = 0
this.getList()
},
// 选择
onConfirm (value, index) {
this.chooseFlag = false;
this.selectObj[this.showIndex].chooseData = value;
this.pageNum = 0
this.getList()
},
onCancel () {
this.chooseFlag = false;
}
},
watch: {},
activated () {
const scrollTop = this.$route.meta.scrollTop;
const $content = document.querySelector('.list_content');
if (scrollTop && $content) {
this.$refs.scroller.scrollTo(0, scrollTop);
}
},
beforeRouteLeave (to, from, next) {
if (to.path != '/appointmentType') {
from.meta.keepAlive = false
} else
if (to.path == '/appointmentType') {
from.meta.keepAlive = true
const $content = document.querySelector('.list_content'); // 列表的外层容器
const scrollTop = $content ? $content.scrollTop : 0;
from.meta.scrollTop = scrollTop;
}
next()
}
};
</script>
<style lang="scss" scoped>
.doText {
font-size: 16px;
color: #127bff;
}
.top_select {
display: flex;
padding: 20px 10px;
font-size: 14px;
.select_address {
margin-right: 20px;
.column_play {
font-size: 12px;
transform: rotate(90deg);
}
}
}
.list_content {
height: calc(100vh - 159px);
overflow: auto;
}
::v-deep .hospital_level {
width: 100%;
height: 24px;
font-size: 12px;
position: absolute;
bottom: 0;
text-align: center;
color: #fff;
}
::v-deep .van-cell-group {
margin-bottom: 10px;
}
</style>
<template>
<div>
<x-header :left-options="{backText: '',showBack:true}">
预约类型
</x-header>
<!-- 列表 -->
<v-content
has-header
has-footer
>
<div class="list_content">
<van-cell-group
inset
v-for="(item,index) in typeList"
:key="index"
>
<van-cell
center
:title="item.name"
:label="item.address"
is-link
@click="jumpTo(index)"
>
<template #icon>
456
</template>
</van-cell>
</van-cell-group>
</div>
</v-content>
</div>
</template>
<script>
export default {
data () {
return {
typeList: [
{
name: '门诊预约',
address: '看病看医生',
},
{
name: '医技预约',
address: '检验检查、无需等待',
}
]
}
},
methods: {
jumpTo (i) {
if (i == 0) {
this.$API.getEncryptedInfo(
this.$route.query.id
).then(res => {
if (res.code == 1) {
let str = res.object
// console.log(str);
// let url
// if (process.env.NODE_ENV === 'development') {
// url = `https://ih.wzaijk.com/patient-wenzhou-h5/#/projects/wenzhou/pages/yygh/yyghHome?content=${str}&app=yygh`
// } else {
// url = `https://ih.wzaijk.com.cn/patient-wenzhou-h5/#/projects/wenzhou/pages/yygh/yyghHome?content=${str}&app=yygh`
// }
// console.log(url);
window.open(str, '_self');
}
})
}
}
},
beforeRouteEnter (to, from, next) {
from.meta.keepAlive = true
next()
},
mounted () { },
watch: {}
}
</script>
<style lang="scss" scoped>
.list_content {
padding: 10px;
}
::v-deep .van-cell-group {
margin: 10px 0;
}
</style>
\ No newline at end of file
import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);
//登录 注册 激活
const page = [
{
path: "/",
redirect: "/peopleList" //调试
},
{
path: "/peopleList",
meta: { index: 1, keepAlive: true },
name: "peopleList",
component: () => import("@/pages/peopleList")
},
{
path: "/videoList",
meta: { index: 2 },
name: "videoList",
component: () => import("@/pages/videoList")
}
];
const router = new Router({
// scrollBehavior: () => ({
// y: 0
// }),
routes: [...page]
});
router.beforeEach((to, from, next) => {
next();
});
// 解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;
// push
Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject)
return originalPush.call(this, location, onResolve, onReject);
return originalPush.call(this, location).catch((err) => err);
};
//replace
Router.prototype.replace = function push(location, onResolve, onReject) {
if (onResolve || onReject)
return originalReplace.call(this, location, onResolve, onReject);
return originalReplace.call(this, location).catch((err) => err);
};
export default router;
/*
*服务 接口
*和后端交互的接口
*
*
*/
import { Common } from '@/utils/http';
import { SERVICE_CODE, STATE_CODE } from '@/config/interface';
import {
BASE_CONFIG
} from '@/config/config'
import axios from 'axios'
import {MessageBox,Toast} from 'mint-ui';
let CommonAlert = function(msg){
return Toast({
message: msg,
duration: 15000
})
}
let InterfaceService = {
//--------------上传公共服务 start--------------
//一次性获取签名 用于:多文件file 一次性上传 遍历文件的时间很短 一般在签名有效期以内 所以不需要判断签名时效
getOssSignatureDisposable: (params, callback, errorCallback, loadingStartCb, loadingEndCb) => {
Common.request(SERVICE_CODE.OSS_SIGNATURE, params, (data) => {
let respData = data.respData
typeof callback === 'function' && callback(respData);
}, (data) => {
if(data.respData && data.respData.respMsg){
CommonAlert(data.respData.respMsg);
}
typeof errorCallback === 'function' && errorCallback(data);
}, loadingStartCb, loadingEndCb);
},
getOssSignature: (params, callback, errorCallback, loadingStartCb, loadingEndCb) => {
let signature = sessionStorage.getItem('signature') || '{}';
signature = JSON.parse(signature)
let now = new Date().getTime();
if(signature && signature['expire'] > now){ //签名未过期 直接上传
typeof callback === 'function' && callback(signature);
}else{ //签名过期 直接上传
sessionStorage.removeItem('signature');
Common.request(SERVICE_CODE.OSS_SIGNATURE, params, (data) => {
let respData = data.respData
sessionStorage.setItem('signature',JSON.stringify(respData));
typeof callback === 'function' && callback(respData);
}, (data) => {
typeof errorCallback === 'function' && errorCallback(data);
}, loadingStartCb, loadingEndCb);
}
},
/*
* signature 后端获取的签名
* file 上传文件对象
dirName 文件名 string
product/[productId]/main/ (商品图:商品/商品id/主图/)
product/[productId]/detail/ (商品图:商品/商品id/主图/)
company/ (公司/)
pos 多文件上传 pos对应文件的索引 单文件上传输入0即可
callBack oss上传成功回调
*
*/
uploadToOss: (signature, file, dirName, pos, callBack, reName, timestampFlag)=>{
let fileName = new Date().getTime()+file.name; //文件是否重命名
//let fileName = new Date().getTime()+file.name; //文件是否重命名
let key = signature.dir + dirName;
if (timestampFlag) { //是否加时间戳区别文件名
key = key + new Date().getTime() + '/';
}
key += fileName
let param = new FormData(); //创建form对象
let now = Date.parse(new Date()) / 1000;
param.append('key', key)
param.append('policy', signature.policy)
param.append('OSSAccessKeyId', signature.accessid)
param.append('success_action_status', '200')
param.append('signature', signature.signature)
//param.append('file',file,file.name)
param.append('file', new Blob([file], {type: "jpg"}), fileName)
let config = {
headers:{'Content-type': 'multipart/form-data'},
// withCredentials:true
};
(function(pos){
axios.post(signature.host,param,config)
.then(response=>{
//console.log(pos)
//console.log(file)
if(response.status===200){
typeof callBack === 'function' && callBack(pos,file,dirName,signature,fileName);
}else{
Message.error("oss签名获取错误");
}
})
})(pos)
},
//--------------oss静态文件获取 start--------------
//类目
getCategoryList:(callback)=>{
axios.get(BASE_CONFIG.OSS_CATEGORY)
.then(response=>{
if(response.status===200){
typeof callback === 'function' && callback(response.data);
}
})
},
//爆款商品列表
getGoodsList:(callback)=>{
axios.get(BASE_CONFIG.OSS_HOT_PRODUCT + '?v=' + Math.random())
.then(response=>{
if(response.status===200){
typeof callback === 'function' && callback(response.data);
}
})
},
getAreaList:(callback)=>{
axios.get(BASE_CONFIG.OSS_AREA_LIST + '?v=' + Math.random())
.then(response=>{
if(response.status===200){
typeof callback === 'function' && callback(response.data);
}
})
},
getCategroyList:(callback)=>{
axios.get(BASE_CONFIG.OSS_CATEGORY_LIST + '?v=' + Math.random())
.then(response=>{
if(response.status===200){
typeof callback === 'function' && callback(response.data);
}
})
},
getCategroyImgMap:(callback)=>{
axios.get(BASE_CONFIG.OSS_CATEGORY_IMG_MAP + '?v=' + Math.random())
.then(response=>{
if(response.status===200){
typeof callback === 'function' && callback(response.data);
}
})
},
//--------------oss静态文件获取 start--------------
}
const interMap = [
{ method: 'testInter', code: SERVICE_CODE.TEST_CODE },//--------------auth satrt--------------
{ method: 'testInsert', code: SERVICE_CODE.TEST_INDSERT },
//--------------auth satrt--------------
//--------------auth end--------------
{ method: 'miniProgramInnit', code: "500004" }, //微信小程序初始化
{ method: 'bindWxPhone', code: "500000" }, //用户注册(授权)
{ method: 'wxLogin', code: "500001" }, //用户登录(小程序)
{ method: 'sumbitGoods', code: "500002" }, // 抢购
{ method: 'getOrderList', code: "500003" }, // 订单详情
{ method: 'getRemainingGoodsList', code: "500006" },
{ method: 'getProductDetails', code: "500008" }, // 商品详情
{ method: 'addAddress', code: "500009" },//新增收货地址
{ method: 'oaLogin', code: "500010" },//绑定OA页面
{ method: 'getAddressList', code: "500011" },//收货地址一览
{ method: 'getCarGoodsList', code: "500012" },//购物车一览
{ method: 'operateCarThings', code: "500013" },//加入购物车
{ method: 'initOrder', code: "500014" },//订单初始化
{ method: 'orderList', code: "500017" },//订单列表
{ method: 'orderDetail', code: "500018" },//订单详情
{ method: 'logisticsDetail', code: "500019" },//物流信息
{ method: 'doCancellOrder', code: "500020" },//取消订单接口
{ method: 'rePayOrder', code: "500021" },//重新发起订单接口
{ method: 'getCouponList', code: "500022" },//优惠券列表
{ method: 'upDateOrderStatus', code: "500023" },//刷新订单状态
{ method: 'getHomeProductList', code: "500024" },//首页自由商品列表
{ method: 'getHomeCouponList', code: "500025" },//首页查询可领优惠券列表
{ method: 'doGetCoupons', code: "500026" },//首页领取优惠券
{ method: 'getCateProductList', code: "500027" },//类目对应商品list
{ method: 'doGetCateNameList', code: "500028" },//类目树
{ method: 'doSaveShareFlow', code: "500029" },//C端新增分享流水
// { method: 'oaLogin', code: "040076" },
// { method: 'getWXConfig', code: "500007" },
// { method: 'submitBill', code: "1060003" },//账单提交
// 500000 注册
// 500010Oa账号绑定
// 500001登录接口
]
let interAPI = {};
interMap.forEach( m => {
interAPI[m.method] = (params, callback, errorCallback, loadingStartCb, loadingEndCb) => {
Common.request(m.code, params, (data) => {
typeof callback === 'function' && callback(data);
}, (data) => {
if(m.showMsg && data.respData && data.respData.respMsg){
CommonAlert(data.respData.respMsg);
}else if(m.showError && data.respData && data.respData.respCode === '9999' && data.respData.respMsg){
CommonAlert(data.respData.respMsg);
}
typeof errorCallback === 'function' && errorCallback(data);
}, loadingStartCb, loadingEndCb);
}
});
Object.assign(InterfaceService,interAPI);
export { InterfaceService};
import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
const state = {};
const mutations = {};
const actions = {};
export default new Vuex.Store({
state,
actions,
mutations,
getters: {},
modules: {}
});
$red : #f5222d;
$orange : #ff6a00;
$grey: #aaa;
$blue:#0082ff;
$deepGreen:#607580;
@dialog-border-radius:0px;
\ No newline at end of file
// @subjectColor:#f16200;
// @dialog-border-radius:0px;
// @dialog-message-font-size:14px;
// @dialog-header-padding-top:20px;
// @button-primary-background-color:@subjectColor;
// @button-border-width:1px;
// @button-primary-border-color:@subjectColor;
// //三种按钮样式
// @button-large-height:40px;
// @button-default-height:34px;
// @switch-on-background-color:@subjectColor;
// @submit-bar-price-color:#FF3B30;
// @submit-bar-button-height:36px;
\ No newline at end of file
/*
*公共方法
*时间格式
*
*
*/
let calculationUtil = {
//加
add(a, b) {
let c, d, e;
try {
c = a.toString().split(".")[1].length;
} catch (f) {
c = 0;
}
try {
d = b.toString().split(".")[1].length;
} catch (f) {
d = 0;
}
e = Math.pow(10, Math.max(c, d));
return (this.mul(a, e) + this.mul(b, e)) / e;
},
//减
sub(a, b) {
let c, d, e;
try {
c = a.toString().split(".")[1].length;
} catch (f) {
c = 0;
}
try {
d = b.toString().split(".")[1].length;
} catch (f) {
d = 0;
}
e = Math.pow(10, Math.max(c, d));
return (this.mul(a, e) - this.mul(b, e)) / e;
},
//乘
mul(a, b) {
let c = 0,
d = a.toString(),
e = b.toString();
try {
c += d.split(".")[1].length;
} catch (f) {
}
try {
c += e.split(".")[1].length;
} catch (f) {
}
return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
},
//除
div(a, b) {
let c, d, e = 0,
f = 0;
try {
e = a.toString().split(".")[1].length;
} catch (g) {
}
try {
f = b.toString().split(".")[1].length;
} catch (g) {
}
c = Number(a.toString().replace(".", ""));
d = Number(b.toString().replace(".", ""));
return this.mul(c / d, Math.pow(10, f - e));
},
};
export {
calculationUtil
};
\ No newline at end of file
/*
*公共方法
*时间格式
*
*
*/
let DateUtil = {
getDistanceSpecifiedTime(dateTime) {
if (!dateTime) {
return;
}
// 指定日期和时间
var EndTime = new Date(dateTime.replace(/-/g, '/'));
// 当前系统时间
var NowTime = new Date();
var t = EndTime.getTime() - NowTime.getTime();
var d = Math.floor(t / 1000 / 60 / 60 / 24);
var h = Math.floor(t / 1000 / 60 / 60 % 24);
var m = Math.floor(t / 1000 / 60 % 60);
var s = Math.floor(t / 1000 % 60);
// var html = d + " 天" + h + " 时" + m + " 分" + s + " 秒";
return { day: d, h: h, m: m, s: s }
},
//业务 需要 比较时间大小 相距间隔
compareTimeDistance: (checkTime, baseTime) => {
let rstInfo = {
canBeginFlag: false,
minuteTimes: 0,
dayDistance: ''
}
let newCheckTime = '';
let newBaseTime = '';
if (baseTime) {
newBaseTime = Date.parse(baseTime.replace(/-/g, '/'));
} else {
newBaseTime = Date.parse(new Date());
}
// 判断日期是不是今天、昨天、明天
let d = new Date(checkTime.replace(/-/g, '/')).setHours(0, 0, 0, 0);
let today = new Date().setHours(0, 0, 0, 0);
let obj = {
'-86400000': 'yestoday',
0: 'today',
86400000: 'tomorrow',
};
let jian = d - today;
if (jian > 86400000) {
rstInfo.dayDistance = 'afterTomorrow';
} else if (jian < -86400000) {
rstInfo.dayDistance = 'beforeYestoday';
} else if (jian == '-86400000') {
rstInfo.dayDistance = 'yestoday';
} else if (jian == '0') {
rstInfo.dayDistance = 'today';
} else if (jian == '86400000') {
rstInfo.dayDistance = 'tomorrow';
}
if (checkTime) {
newCheckTime = Date.parse(checkTime.replace(/-/g, '/'));
// console.log(newCheckTime,newBaseTime,newCheckTime < newBaseTime)
if (newCheckTime < newBaseTime) {
//比标准值小
rstInfo.canBeginFlag = true;
//小多少
rstInfo.minuteTimes = newBaseTime - newCheckTime;
} else {
//小多少
rstInfo.canBeginFlag = false;
rstInfo.minuteTimes = newCheckTime - newBaseTime;
}
}
return rstInfo;
},
//获取时间字符串 date--> 201808081208
getTimestamp: () => {
let date = new Date();
let month = (date.getMonth() + 1).toString();
let strDate = (date.getDate()).toString();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
let currentdate = date.getFullYear() + month + strDate + date.getHours() + date.getMinutes() + date.getSeconds();
return currentdate
},
//获取当日时间字符串 date--> 2018-08-08
getTimesStr: () => {
let date = new Date();
let month = (date.getMonth() + 1).toString();
let strDate = (date.getDate()).toString();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
let currentdate = date.getFullYear() + '-' + month + '-' + strDate;
// this.$store.state.date = currentdate; //转换格式为yyyy-mm-dd
let dateDot = date.toLocaleDateString().replace(/\//g, ".");
let monthNum = (date.getMonth() + 1).toString();//没有0的当月时间字符串
let monthStr = date.getFullYear() + "-" + month
return {currentdate:currentdate,dateDot:dateDot,monthNum:monthNum,monthStr:monthStr}
},
//获取月份字符串 date--> 2018-08-08
getMonthStr:(month)=> {
let date = new Date();
let strDate = (date.getDate()).toString();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
let monthStr = date.getFullYear() + "-" + month
return monthStr
},
//获取近n个月的时间 返回值是数组 当前时间和上n个月的时间
getLastMonth: (n) => {
//获取系统当前时间
var nowdate = new Date();
var y = nowdate.getFullYear();
var m = nowdate.getMonth() + 1;
var d = nowdate.getDate();
var formatnowdate = y + '-' + m + '-' + d;
//获取系统前一个月的时间
nowdate.setMonth(nowdate.getMonth() - n);
var y = nowdate.getFullYear();
var m = nowdate.getMonth() + 1;
var d = nowdate.getDate();
var formatlastmonth = y + '-' + m + '-' + d;
return [formatlastmonth, formatnowdate]
},
//date格式转 时间字符串 date--> 2018-05-05 12:00:00
dateToString: () => {
var date = new Date();
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString();
var day = (date.getDate()).toString();
var hour = (date.getHours()).toString();
var minute = (date.getMinutes()).toString();
var second = (date.getSeconds()).toString();
if (month.length == 1) {
month = "0" + month;
}
if (day.length == 1) {
day = "0" + day;
}
if (hour.length == 1) {
hour = "0" + hour;
}
if (minute.length == 1) {
minute = "0" + minute;
}
if (second.length == 1) {
second = "0" + second;
}
var dateTime = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
return dateTime;
},
//num:0 YYYY-MM-DD num:1 YYYY-MM-DD hh:mm:ss // timestamp:时间戳
numToDate: (timestamp,num) => {
// let sStr = secondStr.substring(secondStr.length-4 , secondStr.length)
// return new Date(parseInt(sStr) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
timestamp = timestamp + '';
timestamp = timestamp.length==10 ? timestamp*1000 : timestamp;
var date = new Date(timestamp);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
if(num==0){
return y + '-' + m + '-' + d;
}else{
return y + '-' + m + '-' + d +' '+ h +':'+ minute +':' + second;
}
},
/**
* @param {Number} timeStamp 传入的时间戳
* @param {Number} startType 要返回的时间字符串的格式类型,传入'year'则返回年开头的完整时间
* 时间戳转时间格式
*/
getDate: (dateStr) => {
var date = new Date()
if (dateStr) {
date = new Date(dateStr)
}
var y = date.getFullYear()
var m = date.getMonth() + 1
var d = date.getDate()
var h = date.getHours()
var mm = date.getMinutes()
var s = date.getSeconds()
var ds =
y +
"-" +
(m < 10 ? "0" + m : m + "") +
"-" +
(d < 10 ? "0" + d : d + "") +
" " +
(h < 10 ? "0" + h : h + "") +
":" +
(mm < 10 ? "0" + mm : mm + "") +
":" +
(s < 10 ? "0" + s : s + "")
return ds
},
}
export {
DateUtil
};
\ No newline at end of file
/*
*公共方法
*字典
*
*
*/
let DictUtil = {
//病种字典
diseaseDict :(str) =>{
const codeDict = {
"colon": "结直肠癌",
"gastric": "胃癌",
"stroke": "脑卒中",
}
for (let key in codeDict) {
if (str == key) {
return String(codeDict[key])
}
if (str == String(codeDict[key])) {
return key
}
else {
if (!str) {
return "未知"
}
}
}
},
//风险字典
riskDict:(str,num)=>{
let codeDict={
"a": "高风险",
"b": "中风险",
"c": "低风险",
}
if(num==2){
codeDict = {
"a": "高危",
"b": "中危",
"c": "低危",
}
}
for (let key in codeDict) {
if (str == key) {
return String(codeDict[key])
}
if (str == String(codeDict[key])) {
return key
}
else {
if (!str) {
return "未知"
}
}
}
},
//职业字典
occupDict:(str)=>{
const codeDict = {
'1':'国家机关、党群组织、企业、事业单位负责人',
'2':'专业技术人员',
'3':'办事人员和有关人员',
'4':'商业、服务业人员农、牧、林、渔、水利业生产人员',
'5':'军人',
'99':'不便分类的其他从业人员'
}
for (let key in codeDict) {
if (str == key) {
return String(codeDict[key])
}
if (str == String(codeDict[key])) {
return key
}
else {
if (!str) {
return "未知"
}
}
}
},
//婚姻字典
maritalDict:(str)=>{
const codeDict = {
"未婚":'10',
"已婚":'20',
"再婚":'22',
"丧偶":'30',
"离婚":'40',
"未说明的婚姻状况":'90'
}
for (let key in codeDict) {
if (str == key) {
return String(codeDict[key])
}
if (str == String(codeDict[key])) {
return key
}
else {
if (!str) {
return "未知"
}
}
}
},
//教育字典
educaDict:(str)=>{
const codeDict = {
'10':'研究生班毕业',
'20':'大学本科毕业',
'30':'大学专科毕业',
'40':'中等专科毕业',
'47':'技工学校毕业',
'60':'普通高中毕业',
'70':'初中毕业',
'80':'小学毕业',
'90':'文盲或半文盲'
}
for (let key in codeDict) {
if (str == key) {
return String(codeDict[key])
}
if (str == String(codeDict[key])) {
return key
}
else {
if (!str) {
return "未知"
}
}
}
}
}
export {
DictUtil
};
\ No newline at end of file
This diff is collapsed.
//import CryptoJS from "./cryptoJs";
import CryptoJS from "crypto-js";
//秘钥
const CRYPTOJSKEY = "qwe!@#456&*(0-==";
export const encryption = {
// 加密
encrypt: function(plaintText) {
var plaintText = plaintText;
var iv = CryptoJS.enc.Utf8.parse('16-Bytes--String');
var options = {
iv: iv,
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
};
var key = CryptoJS.enc.Utf8.parse(CRYPTOJSKEY);
var encryptedData = CryptoJS.AES.encrypt(plaintText, key, options);
var encryptedBase64Str = encryptedData.toString();
encryptedBase64Str = encryptedBase64Str;
return encryptedBase64Str;
},
//解密
decrypt: function(encryptedBase64Str) {
var vals = encryptedBase64Str;
var options = {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
};
var key = CryptoJS.enc.Utf8.parse(CRYPTOJSKEY);
var decryptedData = CryptoJS.AES.decrypt(vals, key, options);
var decryptedStr = CryptoJS.enc.Utf8.stringify(decryptedData);
return decryptedStr
},
}
This diff is collapsed.
/*
*公共方法
*图片处理
*
*
*/
let ImageUtil = {
reg:/image\/[jpg|png|gif]/i,
//压缩
canvasDataURL:(path, obj,callback)=>{
let canvasSize = obj.canvasSize || 800 ;//画布大小
var img = new Image();
img.src = path;
img.onload = function() {
var that = this;
// 默认按比例压缩
var w = that.width,
h = that.height,
scale = w / h;
if (w > h && w > canvasSize) {
w = canvasSize;
h = canvasSize / scale;
} else if (w < h && h > canvasSize) {
h = canvasSize;
w = canvasSize * scale;
}
var quality = 0.9; // 默认图片质量为0.9
//生成canvas
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
// 创建属性节点
var anw = document.createAttribute("width");
anw.nodeValue = w;
var anh = document.createAttribute("height");
anh.nodeValue = h;
canvas.setAttributeNode(anw);
canvas.setAttributeNode(anh);
ctx.drawImage(that, 0, 0, w, h);
// 图像质量
if (obj.quality && obj.quality <= 1 && obj.quality > 0) {
quality = obj.quality;
}
// quality值越小,所绘制出的图像越模糊
var base64 = canvas.toDataURL("image/jpeg", quality);
// 回调函数返回base64的值
callback(base64);
};
},
//调用压缩
photoCompress:function(file, w){
let _this = this;
return new Promise(resolve => {
var ready = new FileReader();
/*开始读取指定的Blob对象或File对象中的内容. 当读取操作完成时,readyState属性的值会成为DONE,如果设置了onloadend事件处理程序,则调用之.同时,result属性中将包含一个data: URL格式的字符串以表示所读取文件的内容.*/
ready.onload = function() {
var re = this.result;
_this.canvasDataURL(re, w, base64 => {
resolve(base64);
});
};
ready.readAsDataURL(file);
});
},
//压缩后的base64 转回file格式 用于上传。。。
convertBase64UrlToFile:function(urlData,filename){
var arr = urlData.split(","),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr],filename, { type: mime });
},
//将超过限制的图片 循环调用压缩图片
compressPromis :function(sourcefiles,maxSize,canvasSize){
console.log(sourcefiles)
let userAgent = navigator.userAgent
let isIE11 = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; // ie11<11
let resFileArr = []
let len = sourcefiles.length;
return new Promise((resolve, reject) => {
let promiseList = [];
for(let i = 0 ; i<len;i++){
let file = sourcefiles[i].file;
console.log(file)
if(file && file.size > maxSize * 1024 && !isIE11){
let promise = new Promise((_resolve, _reject) => {
this.photoCompress(file, { quality: 0.5 , canvasSize:canvasSize}).then(base64 => {
let compressFile = this.convertBase64UrlToFile(base64,file.name);
_resolve(compressFile);
});
});
promiseList.push(promise);
}
}
//压缩所有图片后回调
Promise.all(promiseList).then(values => {
console.log(values)
resolve(values);
});
})
},
//页面触发 传入file 图片大小限制 压缩画布大小
handleChangeMasterImg:function(sourcefiles,maxSize,canvasSize,callback){
console.log("sourcefiles",sourcefiles)
let userAgent = navigator.userAgent
let isIE11 = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; // ie11<11
this.compressPromis(sourcefiles,maxSize,canvasSize).then(res => {
console.log(res)
let resArr = res || []
let len = sourcefiles.length;
for(let i = 0 ; i<len;i++){
let file = sourcefiles[i].file;
console.log(file.size,maxSize * 1024)
if(file.size <= maxSize * 1024){
resArr.push(file)
}
}
console.log(resArr)
callback(resArr)
});
}
}
export {
ImageUtil
};
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment