提交 331e62f7 编写于 作者: yongbo.wang's avatar yongbo.wang

Merge remote-tracking branch 'origin/release'

# Conflicts:
#	.DS_Store
#	README-en.md
无法预览此类型文件
...@@ -5,3 +5,5 @@ dist/stroke.js ...@@ -5,3 +5,5 @@ dist/stroke.js
dist/ dist/
/yqy/ /yqy/
node_modules/ node_modules/
.DS_Store
.vscode
{
"editor.fontSize": 15
}
\ No newline at end of file
基于dev-app-home-plugin-1115的改版的
Branch_tag-lecturer-rev-all-0115
\ No newline at end of file
...@@ -8,6 +8,7 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin') ...@@ -8,6 +8,7 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin') var HtmlWebpackPlugin = require('html-webpack-plugin')
var env = config.build.env var env = config.build.env
console.log('@@@@@@@@@@@@@@@@@@@', env)
var webpackConfig = merge(baseWebpackConfig, { var webpackConfig = merge(baseWebpackConfig, {
module: { module: {
loaders: utils.styleLoaders({ loaders: utils.styleLoaders({
...@@ -18,8 +19,8 @@ var webpackConfig = merge(baseWebpackConfig, { ...@@ -18,8 +19,8 @@ var webpackConfig = merge(baseWebpackConfig, {
//devtool: config.build.productionSourceMap ? '#source-map' : false, //devtool: config.build.productionSourceMap ? '#source-map' : false,
output: { output: {
path: config.build.assetsRoot, path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].js'), filename: utils.assetsPath('js/[name].js?chunkhash=[chunkhash]'),
chunkFilename: utils.assetsPath('js/[name].[chunkhash].min.js') chunkFilename: utils.assetsPath('js/[name].[chunkhash].min.js?chunkhash=[chunkhash]')
}, },
vue: { vue: {
loaders: utils.cssLoaders({ loaders: utils.cssLoaders({
...@@ -46,6 +47,7 @@ var webpackConfig = merge(baseWebpackConfig, { ...@@ -46,6 +47,7 @@ var webpackConfig = merge(baseWebpackConfig, {
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
filename: config.build.index, filename: config.build.index,
template: 'index.html', template: 'index.html',
favicon: 'favicon.ico',
inject: true, inject: true,
// minify: { // minify: {
// removeComments: true, // removeComments: true,
......
...@@ -4,13 +4,14 @@ var path = require('path') ...@@ -4,13 +4,14 @@ var path = require('path')
module.exports = { module.exports = {
build: { build: {
env: { env: {
NODE_ENV: '"production"' NODE_ENV: '"production"',
BUILD_ENV: '"' + process.env.BUILD_ENV + '"'
}, },
index: path.resolve(__dirname, '../yqy/index.html'), index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../yqy'), assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: './static', assetsSubDirectory: './static',
assetsPublicPath: '/yqy/', assetsPublicPath: './',
productionSourceMap: true, productionSourceMap: false,
// Surge or Netlify already gzip all static assets for you. // Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to: // Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin // npm install --save-dev compression-webpack-plugin
...@@ -19,9 +20,10 @@ module.exports = { ...@@ -19,9 +20,10 @@ module.exports = {
}, },
dev: { dev: {
env: { env: {
NODE_ENV: '"development"' NODE_ENV: '"development"',
BUILD_ENV: '"' + process.env.BUILD_ENV + '"'
}, },
port: 8000, port: 8010,
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
assetsPublicPath: '/', assetsPublicPath: '/',
// proxyTable: { // proxyTable: {
......
...@@ -2,17 +2,20 @@ ...@@ -2,17 +2,20 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta content="云鹊医,云鹊健康,工作站,项目管理,教培项目,学情报告,随访管理,预约随访" name="keywords">
<meta content="云鹊医工作站用于管理人员的日常操作,支持提交内容审核、管理项目、管理随访计划等功能。" name="description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
<meta name="screen-orientation" content="portrait"/> <meta name="screen-orientation" content="portrait"/>
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no"> <meta name="format-detection" content="telephone=no">
<meta name="full-screen" content="yes"> <meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true"> <meta name="x5-fullscreen" content="true">
<title>云鹊·医</title> <title>云鹊医工作站</title>
</head> </head>
<body> <body id="appBody">
<div id="app"> <div id="app">
<router-view></router-view> <router-view></router-view>
</div> </div>
<script src="https://unpkg.com/qiniu-js@2.2.0/dist/qiniu.min.js"></script>
</body> </body>
</html> </html>
此差异已折叠。
...@@ -6,17 +6,23 @@ ...@@ -6,17 +6,23 @@
"private": true, "private": true,
"license": "GPL", "license": "GPL",
"scripts": { "scripts": {
"dev": "cross-env NODE_ENV=online node build/dev-server.js", "dev": "cross-env BUILD_ENV=development node build/dev-server.js",
"local": "cross-env NODE_ENV=local node build/dev-server.js", "local": "cross-env BUILD_ENV=development node build/dev-server.js",
"build": "node build/build.js" "build": "node build/build.js",
"build:dev": "cross-env BUILD_ENV=dev node build/build.js",
"build:test": "cross-env BUILD_ENV=test node build/build.js",
"build:uat": "cross-env BUILD_ENV=uat node build/build.js",
"build:pro": "cross-env BUILD_ENV=pro node build/build.js"
}, },
"dependencies": { "dependencies": {
"@babel/polyfill": "^7.2.5",
"axios": "0.16.2", "axios": "0.16.2",
"better-scroll": "^0.1.15", "better-scroll": "^0.1.15",
"echarts": "^4.2.0-rc.2",
"element-ui": "^2.6.1",
"fastclick": "^1.0.6", "fastclick": "^1.0.6",
"iscroll": "^5.2.0", "iscroll": "^5.2.0",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"mint-ui": "^2.2.13",
"showdown": "^1.6.4", "showdown": "^1.6.4",
"vue": "^2.1.0", "vue": "^2.1.0",
"vue-router": "^2.1.1", "vue-router": "^2.1.1",
...@@ -58,6 +64,7 @@ ...@@ -58,6 +64,7 @@
"shelljs": "^0.7.4", "shelljs": "^0.7.4",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"url-loader": "^0.5.7", "url-loader": "^0.5.7",
"vue-lazyload": "^1.2.6",
"vue-loader": "^10.0.0", "vue-loader": "^10.0.0",
"vue-style-loader": "^1.0.0", "vue-style-loader": "^1.0.0",
"vue-template-compiler": "^2.1.0", "vue-template-compiler": "^2.1.0",
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
无法预览此类型文件
<template> <template>
<div> <div>
<v-header :userName="userName" :portrait="portrait" :idType="idType"></v-header>
<v-slidebar :authList="authList" :tokenValue="token"></v-slidebar>
<el-container>
<div class="content" id="body-content">
<transition name="router-fade" mode="out-in"> <transition name="router-fade" mode="out-in">
<keep-alive> <keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view> <router-view v-if="$route.meta.keepAlive"></router-view>
...@@ -8,26 +12,129 @@ ...@@ -8,26 +12,129 @@
<transition name="router-fade" mode="out-in"> <transition name="router-fade" mode="out-in">
<router-view v-if="!$route.meta.keepAlive"></router-view> <router-view v-if="!$route.meta.keepAlive"></router-view>
</transition> </transition>
<svg-icon></svg-icon> <v-footer></v-footer>
</div>
</el-container>
</div> </div>
</template> </template>
<script> <script>
import svgIcon from './components/common/svg'; import VHeader from './views/layout/header.vue'
export default { import VSlidebar from './views/layout/slidebar.vue'
import VFooter from './views/layout/footer.vue'
import { base64decode, isNotEmptyUtils, getUrlParamsMap } from "./utils/utils.js"
import { mapActions, mapGetters } from 'vuex'
import { getLoginUrl } from './utils/index.js'
let vm = null
export default {
components:{ components:{
svgIcon VHeader,
VSlidebar,
VFooter
}, },
data() {
return {
idType: 0,
token: '',
userName: '',
portrait: '',
authList: {}
} }
},
computed:{
...mapGetters([
'_token'
])
},
created() {
vm = this
vm.getToken()
},
mounted() {
},
methods: {
// 解密token
getToken() {
let href = window.location.href
let offset = href.indexOf("?")
if(offset !== -1) {
let paramStr = href.substring(offset + 1, href.length)
let pars = base64decode(paramStr)
let paramMap = getUrlParamsMap(pars, "&")
if (isNotEmptyUtils(paramMap["token"])) {
vm.token = paramMap["token"]
localStorage.setItem('storageToken', vm.token)
vm.$router.push({ path: 'home' })
} else {
if(!localStorage.getItem('storageToken')) {
window.location.href = getLoginUrl('?from=work&type=logout') // 没有token返回登录页面
return
}
}
}else {
if(!localStorage.getItem('storageToken')) {
window.location.href = getLoginUrl('?from=work&type=logout') // 没有token返回登录页面
return
}
}
vm.changeToken(vm.token)
vm.getUserAuth(vm.token)
},
// 修改token
...mapActions([
'changeToken',
'changeIdType',
'changeMaster'
]),
// 获取用户权限
getUserAuth(token) {
let req = null
req = {
token: token
}
vm.GET('portal/common/v1/role',req).then((res) => {
if(res.code == '000000') {
vm.changeIdType(res.data.idType)
vm.changeMaster(res.data.masterAdministratorFlag)
localStorage.setItem('storageIdType', res.data.idType)
localStorage.setItem('storageMaster', res.data.masterAdministratorFlag)
vm.idType = res.data.idType
vm.userName = res.data.name
vm.portrait = res.data.imageUrl
vm.authList = res.data.auth
} else {
vm.$message.info(res.message)
}
})
}
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
@import './style/common'; // @import './style/common';
@import './style/global';
@import './style/mixin.scss';
.router-fade-enter-active, .router-fade-leave-active { .router-fade-enter-active, .router-fade-leave-active {
transition: opacity .3s; transition: opacity .1s;
} }
.router-fade-enter, .router-fade-leave-active { .router-fade-enter, .router-fade-leave-active {
opacity: 0; opacity: 0;
} }
.el-container {
margin-left: 255px;
overflow: hidden;
.content {
background: #F0F2F5;
position: absolute;
left: 255px;
right: 0;
top: 64px;
bottom: 0;
width: auto;
box-sizing: border-box;
overflow-y: scroll;
}
}
</style> </style>
<template>
<div class="bread-crumb">
<el-breadcrumb separator="/">
<el-breadcrumb-item>{{curmbFirst}}</el-breadcrumb-item>
<el-breadcrumb-item v-if="curmbSecond" :to="{ path: jumPathThird }">{{curmbSecond}}</el-breadcrumb-item>
<el-breadcrumb-item v-if="curmbThird">{{curmbThird}}</el-breadcrumb-item>
</el-breadcrumb>
</div>
</template>
<script>
export default {
props: {
curmbFirst: {
type: String
},
curmbSecond: {
type: String
},
curmbThird: {
type: String
},
jumPathThird: {
type: String
}
}
}
</script>
<style lang="scss">
.bread-crumb {
position: fixed;
left: 255px;
top: 64px;
width: 100%;
background: #fff;
height: 61px;
padding: 20px 20px 30px;
z-index: 99;
border-top: 3px solid #F0F2F5;
.el-breadcrumb__inner {
font-size: 14px;
}
}
</style>
<template>
<div class="alet_container">
<section class="tip_text_container">
<div class="tip_icon">
<span></span>
<span></span>
</div>
<p class="tip_text">{{alertText}}</p>
<div class="confrim" @click="closeTip">确认</div>
</section>
</div>
</template>
<script>
export default {
data(){
return{
positionY: 0,
timer: null,
}
},
mounted(){
},
props: ['alertText'],
methods: {
closeTip(){
this.$emit('closeTip')
}
}
}
</script>
<style lang="scss" scoped>
@import '../../style/mixin';
@keyframes tipMove{
0% { transform: scale(1) }
35% { transform: scale(.8) }
70% { transform: scale(1.1) }
100% { transform: scale(1) }
}
.alet_container{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 200;
}
.tip_text_container{
position: absolute;
top: 50%;
left: 50%;
margin-top: -6rem;
margin-left: -6rem;
width: 12rem;
animation: tipMove .4s ;
background-color: rgba(255,255,255,1);
border: 1px;
padding-top: .6rem;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
border: 1px;
border-radius: 0.25rem;
.tip_icon{
@include wh(3rem, 3rem);
border: 0.15rem solid #f8cb86;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
span:nth-of-type(1){
@include wh(.12rem, 1.5rem);
background-color: #f8cb86;
}
span:nth-of-type(2){
@include wh(.2rem, .2rem);
border: 1px;
border-radius: 50%;
margin-top: .2rem;
background-color: #f8cb86;
}
}
.tip_text{
@include sc(.7rem, #333);
line-height: .9rem;
text-align: center;
margin-top: .8rem;
padding: 0 .4rem;
}
.confrim{
@include sc(.8rem, #fff);
font-weight: bold;
margin-top: .8rem;
background-color: #4cd964;
width: 100%;
text-align: center;
line-height: 1.8rem;
border: 1px;
border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
}
}
</style>
<template>
<section class="cart_module">
<section v-if="!foods.specifications.length" class="cart_button">
<transition name="showReduce">
<span @click="removeOutCart(foods.category_id, foods.item_id, foods.specfoods[0].food_id, foods.specfoods[0].name, foods.specfoods[0].price, '', foods.specfoods[0].packing_fee, foods.specfoods[0].sku_id, foods.specfoods[0].stock)" v-if="foodNum">
<svg>
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#cart-minus"></use>
</svg>
</span>
</transition>
<transition name="fade">
<span class="cart_num" v-if="foodNum">{{foodNum}}</span>
</transition>
<svg class="add_icon" @touchstart="addToCart(foods.category_id, foods.item_id, foods.specfoods[0].food_id, foods.specfoods[0].name, foods.specfoods[0].price, '', foods.specfoods[0].packing_fee, foods.specfoods[0].sku_id, foods.specfoods[0].stock, $event)">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#cart-add"></use>
</svg>
</section>
<section v-else class="choose_specification">
<section class="choose_icon_container">
<transition name="showReduce">
<svg class="specs_reduce_icon" v-if="foodNum" @click="showReduceTip">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#cart-minus"></use>
</svg>
</transition>
<transition name="fade">
<span class="cart_num" v-if="foodNum">{{foodNum}}</span>
</transition>
<span class="show_chooselist" @click="showChooseList(foods)">选规格</span>
</section>
</section>
</section>
</template>
<script>
import {mapState, mapMutations} from 'vuex'
export default {
data(){
return{
showMoveDot: [], //控制下落的小圆点显示隐藏
}
},
mounted(){
},
computed: {
...mapState([
'cartList'
]),
/**
* 监听cartList变化,更新当前商铺的购物车信息shopCart,同时返回一个新的对象
*/
shopCart: function (){
return Object.assign({},this.cartList[this.shopId]);
},
//shopCart变化的时候重新计算当前商品的数量
foodNum: function (){
let category_id = this.foods.category_id;
let item_id = this.foods.item_id;
if (this.shopCart&&this.shopCart[category_id]&&this.shopCart[category_id][item_id]) {
let num = 0;
Object.values(this.shopCart[category_id][item_id]).forEach((item,index) => {
num += item.num;
})
return num;
}else {
return 0;
}
},
},
props:['foods', 'shopId'],
methods: {
...mapMutations([
'ADD_CART','REDUCE_CART',
]),
//移出购物车
removeOutCart(category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock){
if (this.foodNum > 0) {
this.REDUCE_CART({shopid: this.shopId, category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock});
}
},
//加入购物车,计算按钮位置。
addToCart(category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock, event){
this.ADD_CART({shopid: this.shopId, category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock});
let elLeft = event.target.getBoundingClientRect().left;
let elBottom = event.target.getBoundingClientRect().bottom;
this.showMoveDot.push(true);
this.$emit('showMoveDot', this.showMoveDot, elLeft, elBottom);
},
//显示规格列表
showChooseList(foodScroll){
this.$emit('showChooseList', foodScroll)
},
//点击多规格商品的减按钮,弹出提示
showReduceTip(){
this.$emit('showReduceTip')
},
},
}
</script>
<style lang="scss" scoped>
@import '../../style/mixin';
.cart_module{
.add_icon{
position: relative;
z-index: 999;
}
.cart_button{
display: flex;
align-items: center;
}
svg{
@include wh(.9rem, .9rem);
fill: #3190e8;
}
.specs_reduce_icon{
fill: #999;
}
.cart_num{
@include sc(.65rem, #666);
min-width: 1rem;
text-align: center;
font-family: Helvetica Neue,Tahoma;
}
.choose_specification{
.choose_icon_container{
display: flex;
align-items: center;
.show_chooselist{
display: block;
@include sc(.55rem, #fff);
padding: .1rem .2rem;
background-color: $blue;
border-radius: 0.2rem;
border: 1px solid $blue;
}
}
}
}
.showReduce-enter-active, .showReduce-leave-active {
transition: all .3s ease-out;
}
.showReduce-enter, .showReduce-leave-active {
opacity: 0;
transform: translateX(1rem);
}
.fade-enter-active, .fade-leave-active {
transition: all .3s;
}
.fade-enter, .fade-leave-active {
opacity: 0;
}
.fadeBounce-enter-active, .fadeBounce-leave-active {
transition: all .3s;
}
.fadeBounce-enter, .fadeBounce-leave-active {
opacity: 0;
transform: scale(.7);
}
</style>
<template>
<div class="page">
<span class="rem_time" style="color: orange;border-width: 1px;border-style: solid;border-color: orange;" @click="gotoPay">
{{remaining}}
</span>
<alert-tip v-if="showAlert" @closeTip="showAlert = false" :alertText="alertText"></alert-tip>
</div>
</template>
<script>
import alertTip from 'src/components/common/alertTip'
export default {
data(){
return{
countNum: 900,
showAlert: false,
alertText: null,
}
},
mounted(){
this.countNum -= this.numTime;
this.remainingTime();
},
props: ['time'],
components: {
alertTip,
},
methods: {
closeTip(){
this.$emit('closeTip')
},
//计算时间
remainingTime(){
clearInterval(this.timer);
this.timer = setInterval(() => {
this.countNum --;
if (this.countNum == 0) {
clearInterval(this.timer);
this.showAlert = true;
this.alertText = '支付超时';
}
}, 1000);
},
gotoPay(){
this.showAlert = true;
this.alertText = '暂不开放支付接口';
}
},
computed: {
//转换时间成分秒
remaining: function (){
let minute = parseInt(this.countNum/60);
let second = parseInt(this.countNum%60);
if (minute < 10) {
minute = '0' + minute;
}
if (second < 10) {
second = '0' + second;
}
return '去支付(还剩' + minute + '分' + second + '秒)';
},
//订单返回时间秒分分别处理
numTime: function (){
if (this.time.toString().indexOf('分钟') !== -1) {
return parseInt(this.time)*60;
}else{
return parseInt(this.time);
}
}
},
}
</script>
<style lang="scss" scoped>
@import 'src/style/mixin';
.page{
display: inline-block;
.rem_time{
@include sc(.55rem, orange);
padding: .1rem .2rem;
border-radius: .15rem;
}
}
</style>
<template>
<div class="loading_container">
<div class="load_img" :style="{backgroundPositionY: -(positionY%7)*2.5 + 'rem'}">
</div>
<svg class="load_ellipse" xmlns="http://www.w3.org/2000/svg" version="1.1">
<ellipse cx="26" cy="10" rx="26" ry="10" style="fill:#ddd;stroke:none;"></ellipse>
</svg>
</div>
</template>
<script>
export default {
data(){
return{
positionY: 0,
timer: null,
}
},
mounted(){
this.timer = setInterval(() => {
this.positionY ++;
}, 600)
},
beforeDestroy(){
clearInterval(this.timer);
}
}
</script>
<style lang="scss" scoped>
@import '../../style/mixin';
@keyframes load{
0% {transform: translateY(0px);}
50% {transform: translateY(-50px);}
100% {transform: translateY(0px);}
}
@keyframes ellipse{
0% {transform: scale(1);}
50% {transform: scale(0.3);}
100% {transform: scale(1);}
}
.loading_container{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
@include wh(2.5rem, 2.5rem);
}
.load_img{
@include wh(100%, 100%);
background: url(../../images/icon_loading.png) no-repeat 0 0;
background-size: 2.5rem auto;
transform: translateY(0px);
animation: load .6s infinite ease-in-out;
position: relative;
z-index: 11;
}
.load_ellipse{
position: absolute;
@include wh(2.6rem, 2rem);
top: 2.2rem;
left: 0.2rem;
z-index: 10;
animation: ellipse .6s infinite ease-in-out;
}
</style>
import { getStyle } from '../../config/mUtils'
import { imgBaseUrl, localapi, proapi } from '../../config/env'
export const loadMore = {
directives: {
'load-more': {
bind: (el, binding) => {
let windowHeight = window.screen.height;
let height;
let setTop;
let paddingBottom;
let marginBottom;
let requestFram;
let oldScrollTop;
let scrollEl;
let heightEl;
let scrollType = el.attributes.type && el.attributes.type.value;
let scrollReduce = 2;
if (scrollType == 2) {
scrollEl = el;
heightEl = el.children[0];
} else {
scrollEl = document.body;
heightEl = el;
}
el.addEventListener('touchstart', () => {
height = heightEl.clientHeight;
if (scrollType == 2) {
height = height
}
setTop = el.offsetTop;
paddingBottom = getStyle(el, 'paddingBottom');
marginBottom = getStyle(el, 'marginBottom');
}, false)
el.addEventListener('touchmove', () => {
loadMore();
}, false)
el.addEventListener('touchend', () => {
oldScrollTop = scrollEl.scrollTop;
moveEnd();
}, false)
const moveEnd = () => {
requestFram = requestAnimationFrame(() => {
if (scrollEl.scrollTop != oldScrollTop) {
oldScrollTop = scrollEl.scrollTop;
moveEnd()
} else {
cancelAnimationFrame(requestFram);
height = heightEl.clientHeight;
loadMore();
}
})
}
const loadMore = () => {
if (scrollEl.scrollTop + windowHeight >= height + setTop + paddingBottom + marginBottom - scrollReduce) {
binding.value();
}
}
}
}
}
};
export const getImgPath = {
methods: {
//传递过来的图片地址需要处理后才能正常使用
getImgPath(path) {
let suffix;
if (!path) {
return '//yqy.cangdu.org/img/default.jpg'
}
if (path.indexOf('jpeg') !== -1) {
suffix = '.jpeg'
} else {
suffix = '.png'
}
let url = '/' + path.substr(0, 1) + '/' + path.substr(1, 2) + '/' + path.substr(3) + suffix;
return 'https://fuss10.elemecdn.com' + url
},
}
}
\ No newline at end of file
<template>
<div class="rating_container">
<section class="star_container">
<svg class="grey_fill" v-for="num in 5" :key="num">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#star"></use>
</svg>
</section>
<div :style="'width:' + rating*2/5 + 'rem'" class="star_overflow">
<section class="star_container" >
<svg class="orange_fill" v-for="num in 5" :key="num">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#star"></use>
</svg>
</section>
</div>
</div>
</template>
<script>
export default {
data(){
return{
}
},
mounted(){
},
props:['rating'],
}
</script>
<style lang="scss" scoped>
@import '../../style/mixin';
.rating_container{
position: relative;
top: .2rem;
@include wh(2rem, .4rem);
.star_overflow{
overflow: hidden;
position: relative;
height: 100%;
}
.star_container{
position: absolute;
display: flex;
width: 2rem;
height: 0.4rem;
top: -0.02rem;
left: -0.02rem;
.grey_fill{
fill: #d1d1d1;
}
.orange_fill{
fill: #ff9a0d;
}
}
}
</style>
<template>
<div class="shoplist_container">
<ul v-load-more="loaderMore" v-if="shopListArr.length" type="1">
<router-link :to="{path: 'shop', query:{geohash, id: item.id}}" v-for="item in shopListArr" tag='li' :key="item.id" class="shop_li">
<section>
<img :src="imgBaseUrl + item.image_path" class="shop_img">
</section>
<hgroup class="shop_right">
<header class="shop_detail_header">
<h4 :class="item.is_premium? 'premium': ''" class="" class="shop_title ellipsis">{{item.name}}</h4>
<ul class="shop_detail_ul">
<li v-for="item in item.supports" :key="item.id" class="supports">{{item.icon_name}}</li>
</ul>
</header>
<h5 class="rating_order_num">
<section class="rating_order_num_left">
<section class="rating_section">
<rating-star :rating='item.rating'></rating-star>
<span class="rating_num">{{item.rating}}</span>
</section>
<section class="order_section">
月售{{item.recent_order_num}}
</section>
</section>
<section class="rating_order_num_right">
<span class="delivery_style delivery_left" v-if="item.delivery_mode">{{item.delivery_mode.text}}</span>
<span class="delivery_style delivery_right" v-if="zhunshi(item.supports)">准时达</span>
</section>
</h5>
<h5 class="fee_distance">
<p class="fee">
¥{{item.float_minimum_order_amount}}起送
<span class="segmentation">/</span>
{{item.piecewise_agent_fee.tips}}
</p>
<p class="distance_time">
<span v-if="Number(item.distance)">{{item.distance > 1000? (item.distance/1000).toFixed(2) + 'km': item.distance + 'm'}}
<span class="segmentation">/</span>
</span>
<span v-else>{{item.distance}}</span>
<span class="segmentation">/</span>
<span class="order_time">{{item.order_lead_time}}</span>
</p>
</h5>
</hgroup>
</router-link>
</ul>
<ul v-else class="animation_opactiy">
<li class="list_back_li" v-for="item in 10" :key="item">
<img src="../../images/shopback.svg" class="list_back_svg">
</li>
</ul>
<p v-if="touchend" class="empty_data">没有更多了</p>
<aside class="return_top" @click="backTop" v-if="showBackStatus">
<svg class="back_top_svg">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#backtop"></use>
</svg>
</aside>
<div ref="abc" style="background-color: red;"></div>
<transition name="loading">
<loading v-show="showLoading"></loading>
</transition>
</div>
</template>
<script>
import {mapState} from 'vuex'
import {shopList} from 'src/service/getData'
import {imgBaseUrl} from 'src/config/env'
import {showBack, animate} from 'src/config/mUtils'
import {loadMore, getImgPath} from './mixin'
import loading from './loading'
import ratingStar from './ratingStar'
export default {
data(){
return {
offset: 0, // 批次加载店铺列表,每次加载20个 limit = 20
shopListArr:[], // 店铺列表数据
preventRepeatReuqest: false, //到达底部加载数据,防止重复加载
showBackStatus: false, //显示返回顶部按钮
showLoading: true, //显示加载动画
touchend: false, //没有更多数据
imgBaseUrl,
}
},
mounted(){
this.initData();
},
components: {
loading,
ratingStar,
},
props: ['restaurantCategoryId', 'restaurantCategoryIds', 'sortByType', 'deliveryMode', 'supportIds', 'confirmSelect', 'geohash'],
mixins: [loadMore, getImgPath],
computed: {
...mapState([
'latitude','longitude'
]),
},
updated(){
// console.log(this.supportIds, this.sortByType)
},
methods: {
async initData(){
//获取数据
let res = await shopList(this.latitude, this.longitude, this.offset, this.restaurantCategoryId);
this.shopListArr = [...res];
if (res.length < 20) {
this.touchend = true;
}
this.hideLoading();
//开始监听scrollTop的值,达到一定程度后显示返回顶部按钮
showBack(status => {
this.showBackStatus = status;
});
},
//到达底部加载更多数据
async loaderMore(){
if (this.touchend) {
return
}
//防止重复请求
if (this.preventRepeatReuqest) {
return
}
this.showLoading = true;
this.preventRepeatReuqest = true;
//数据的定位加20位
this.offset += 20;
let res = await shopList(this.latitude, this.longitude, this.offset, this.restaurantCategoryId);
this.hideLoading();
this.shopListArr = [...this.shopListArr, ...res];
//当获取数据小于20,说明没有更多数据,不需要再次请求数据
if (res.length < 20) {
this.touchend = true;
return
}
this.preventRepeatReuqest = false;
},
//返回顶部
backTop(){
animate(document.body, {scrollTop: '0'}, 400,'ease-out');
},
//监听父级传来的数据发生变化时,触发此函数重新根据属性值获取数据
async listenPropChange(){
this.showLoading = true;
this.offset = 0;
let res = await shopList(this.latitude, this.longitude, this.offset, '', this.restaurantCategoryIds, this.sortByType, this.deliveryMode, this.supportIds);
this.hideLoading();
//考虑到本地模拟数据是引用类型,所以返回一个新的数组
this.shopListArr = [...res];
},
//开发环境与编译环境loading隐藏方式不同
hideLoading(){
this.showLoading = false;
},
zhunshi(supports){
let zhunStatus;
if ((supports instanceof Array) && supports.length) {
supports.forEach(item => {
if (item.icon_name === '准') {
zhunStatus = true;
}
})
}else{
zhunStatus = false;
}
return zhunStatus
},
},
watch: {
//监听父级传来的restaurantCategoryIds,当值发生变化的时候重新获取餐馆数据,作用于排序和筛选
restaurantCategoryIds: function (value){
this.listenPropChange();
},
//监听父级传来的排序方式
sortByType: function (value){
this.listenPropChange();
},
//监听父级的确认按钮是否被点击,并且返回一个自定义事件通知父级,已经接收到数据,此时父级才可以清除已选状态
confirmSelect: function (value){
this.listenPropChange();
}
}
}
</script>
<style lang="scss" scoped>
@import 'src/style/mixin';
.shoplist_container{
background-color: #fff;
margin-bottom: 2rem;
}
.shop_li{
display: flex;
border-bottom: 0.025rem solid #f1f1f1;
padding: 0.7rem 0.4rem;
}
.shop_img{
@include wh(2.7rem, 2.7rem);
display: block;
margin-right: 0.4rem;
}
.list_back_li{
height: 4.85rem;
.list_back_svg{
@include wh(100%, 100%)
}
}
.shop_right{
flex: auto;
.shop_detail_header{
@include fj;
align-items: center;
.shop_title{
width: 8.5rem;
color: #333;
padding-top: .01rem;
@include font(0.65rem, 0.65rem, 'PingFangSC-Regular');
font-weight: 700;
}
.premium::before{
content: '品牌';
display: inline-block;
font-size: 0.5rem;
line-height: .6rem;
color: #333;
background-color: #ffd930;
padding: 0 0.1rem;
border-radius: 0.1rem;
margin-right: 0.2rem;
}
.shop_detail_ul{
display: flex;
transform: scale(.8);
margin-right: -0.3rem;
.supports{
@include sc(0.5rem, #999);
border: 0.025rem solid #f1f1f1;
padding: 0 0.04rem;
border-radius: 0.08rem;
margin-left: 0.05rem;
}
}
}
.rating_order_num{
@include fj(space-between);
height: 0.6rem;
margin-top: 0.52rem;
.rating_order_num_left{
@include fj(flex-start);
.rating_section{
display: flex;
.rating_num{
@include sc(0.4rem, #ff6000);
margin: 0 0.2rem;
}
}
.order_section{
transform: scale(.8);
margin-left: -0.2rem;
@include sc(0.4rem, #666);
}
}
.rating_order_num_right{
display: flex;
align-items: center;
transform: scale(.7);
min-width: 5rem;
justify-content: flex-end;
margin-right: -0.8rem;
.delivery_style{
font-size: 0.4rem;
padding: 0.04rem 0.08rem 0;
border-radius: 0.08rem;
margin-left: 0.08rem;
border: 1px;
}
.delivery_left{
color: #fff;
background-color: $blue;
border: 0.025rem solid $blue;
}
.delivery_right{
color: $blue;
border: 0.025rem solid $blue;
}
}
}
.fee_distance{
margin-top: 0.52rem;
@include fj;
@include sc(0.5rem, #333);
.fee{
transform: scale(.9);
@include sc(0.5rem, #666);
}
.distance_time{
transform: scale(.9);
span{
color: #999;
}
.order_time{
color: $blue;
}
.segmentation{
color: #ccc;
}
}
}
}
.loader_more{
@include font(0.6rem, 3);
text-align: center;
color: #999;
}
.empty_data{
@include sc(0.5rem, #666);
text-align: center;
line-height: 2rem;
}
.return_top{
position: fixed;
bottom: 3rem;
right: 1rem;
.back_top_svg{
@include wh(2rem, 2rem);
}
}
.loading-enter-active, .loading-leave-active {
transition: opacity 1s
}
.loading-enter, .loading-leave-active {
opacity: 0
}
</style>
...@@ -115,15 +115,3 @@ ...@@ -115,15 +115,3 @@
</defs> </defs>
</svg> </svg>
</template> </template>
<script>
export default {
}
</script>
<style lang="scss">
</style>
<template>
<div class="alet_container">
<section class="tip_text_container">
我是文本
</section>
</div>
</template>
<script>
</script>
<style lang="scss" scoped>
</style>
import "@babel/polyfill";
import Vue from 'vue' import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import routes from './router/router' import routes from './router/router'
import store from './store/' import store from './store/'
const mixins = require('@/utils/mixins'); const mixins = require('@/utils/mixins');
import '@/utils/rem' // 引入自适应
import '@/utils/yqyServerRegister' // 移动端服务
import FastClick from 'fastclick' import FastClick from 'fastclick'
import Logger from './plugins/logger' // 日志插件 import vueFilters from '@/utils/filter'
// 引入Mint // 引入ElementUI
import Mint from 'mint-ui' import ElementUI from 'element-ui'
import 'mint-ui/lib/style.css' import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Mint)
Vue.use(Logger, { prefix: new Date(), isDev: process.env.NODE_ENV === 'development', cLevel: 'debug' }) // 可调试
// Vue.config.devtools = true;
// Vue.use(Logger, { prefix: new Date(), isDev: process.env.NODE_ENV === 'development', cLevel: 'debug' })
Vue.use(ElementUI)
// 注册所有公用过滤器
for(let key in vueFilters) {
Vue.filter(key, vueFilters[key])
}
if ('addEventListener' in document) { if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
......
import App from '../App' import App from '../App'
const home = r => require.ensure([], () => r(require('../views/home/home')), 'home') const home = r => require.ensure([], () => r(require('../views/home')), 'home')
const blank = r => require.ensure([], () => r(require('../views/blank')), 'blank')
const itemManager = r => require.ensure([], () => r(require('../views/education/item-manager.vue')), 'item-manager')
const itemComponent = r => require.ensure([], () => r(require('../views/education/item-component.vue')), 'item-component')
const createComponent = r => require.ensure([], () => r(require('../views/education/create-component.vue')),'create-component')
const roleManager = r => require.ensure([], () => r(require('../views/system/role.vue')),'role')
const addManager = r => require.ensure([], () => r(require('../views/education/add-manager.vue')), 'add-manager')
const itemRole = r => require.ensure([], () => r(require('../views/system/item-role.vue')), 'item-role')
export default [{ export default [{
path: '/', path: '/',
component: App, //顶层路由,对应index.html component: App,
children: [ //二级路由。对应App.vue children: [
//地址为空时跳转home页面
{ {
path: '', path: '',
redirect: '/home' redirect: '/home'
}, },{
//首页城市列表页 path: '/index',
{ component: home
},{
path: '/home', path: '/home',
component: home component: home
},{
path: '/blank',
component: blank
},{
path: '/item-manager',
component: itemManager
},{
path: '/add-manager',
component: addManager
},{
path: '/item-component',
component: itemComponent
},{
path: '/role',
component: roleManager
},{
path: '/create-component',
component: createComponent
},{
path: '/item-role',
component: itemRole
}, },
] ]
}] }]
\ No newline at end of file
const common = {
state: {
_token: '',
idType: '',
masterAdministratorFlag: false
},
mutations: {
CHANGE_TOKEN: (state, data) => {
state._token = data
},
CHANGE_IDTYPE: (state, data) => {
state.idType = data
},
CHANGE_MASTER: (state, data) => {
state.masterAdministratorFlag = data
}
},
actions: {
changeToken({ commit }, tokenData) {
commit('CHANGE_TOKEN', tokenData)
},
changeIdType({ commit }, idTypeData) {
commit('CHANGE_IDTYPE', idTypeData)
},
changeMaster({ commit }, masterData) {
commit('CHANGE_MASTER', masterData)
}
}
}
export default common
\ No newline at end of file
const getters = {
_token: state => state.common._token,
idType: state => state.common.idType,
masterAdministratorFlag: state => state.common.masterAdministratorFlag
}
export default getters
const getters = { import education from './education/getters'
// sidebar: state => state.app.sidebar,
// token: state => state.user.token, import { containObject } from '../utils/utils'
// avatar: state => state.user.avatar,
} const getters = containObject(education)
export default getters export default getters
\ No newline at end of file
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import common from './modules/common' import common from './education/common'
import diagnosis from './modules/diagnosis'
import gpRanking from './modules/gpRanking'
import getters from './getters' import getters from './getters'
Vue.use(Vuex) Vue.use(Vuex)
const store = new Vuex.Store({ export default new Vuex.Store({
modules: { modules: {
common, common
diagnosis,
gpRanking
}, },
getters getters
}) })
export default store
import router from '@/router/router'
import { uniqueArray } from '@/utils'
const common = {
state: {
homeTabs: [],
homeTabsActiveName: '',
comModObject: null
},
mutations: {
SET_HOME_TABS: (state, homeTabs) => {
state.homeTabs = homeTabs
},
SET_HOME_TABS_ACTIVE_NAME: (state, homeTabsActiveName) => {
state.homeTabsActiveName = homeTabsActiveName
},
SET_COMMON_OBJECT: (state, comModObject) => {
state.comModObject = comModObject
}
},
actions: {
setHomeTabs({ commit }, homeTabs) {
commit('SET_HOME_TABS', homeTabs)
},
setHomeTabsActiveName({ commit }, homeTabsActiveName) {
commit('SET_HOME_TABS_ACTIVE_NAME', homeTabsActiveName)
},
// 添加tab
addTabs({ commit, state }, tab) {
let homeTabs = state.homeTabs.slice()
if (homeTabs.length === 0) {
tab.closable = false
} else {
homeTabs[0].closable = false
}
homeTabs.push(tab)
homeTabs = uniqueArray(homeTabs, 'name')
commit('SET_HOME_TABS', homeTabs)
commit('SET_HOME_TABS_ACTIVE_NAME', tab.name)
},
// 删除tab(单个)
removeOneTab({ commit, state }, tabName) {
logger.warn(tabName)
const homeTabs = state.homeTabs.slice()
let name
for (let i = 0; i < homeTabs.length; i++) {
let item = homeTabs[i]
if (item.name === tabName) {
homeTabs.splice(i, 1)
item = homeTabs[i]
if (state.tabsActiveName === tabName) {
if (item) {
name = item.name
} else {
name = homeTabs[i - 1].name
}
commit('SET_HOME_TABS_ACTIVE_NAME', name)
router.push({ path: name })
}
break
}
}
commit('SET_HOME_TABS', homeTabs)
},
// 删除tabs(多个)
removeAllTabs({ commit, state }) {
const homeTabs = state.homeTabs.slice()
if (homeTabs.length === 0) {
return
}
const firstTab = [homeTabs.shift()]
commit('SET_HOME_TABS_ACTIVE_NAME', firstTab[0].name)
router.push({
path: firstTab[0].name
})
commit('SET_HOME_TABS', firstTab)
},
setCommonObjct({ commit, state }) {
commit('SET_COMMON_OBJECT', state.comModObject)
}
}
}
export default common
const diagnosis = {
state: {
},
mutations: {
},
actions: {
}
}
export default diagnosis
const gpRankings = {
state: {
},
mutations: {
},
actions: {
}
}
export default gpRankings
const yqyHome = {
state: {
},
mutations: {
},
actions: {
}
}
export default yqyHome
body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, li, a, p, h1, h2, h3, h4,h5, h6, i, b, textarea, button, input, select, figure, figcaption, { img {
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, li, a, p, h1, h2, h3, h4,h5, h6, i, b, textarea, button, input, select, figure, figcaption {
padding: 0; padding: 0;
margin: 0; margin: 0;
list-style: none; list-style: none;
font-style: normal; font-style: normal;
text-decoration: none; text-decoration: none;
border: none; border: none;
color: #333; // color: #333;
font-weight: normal; font-weight: normal;
font-family: "Microsoft Yahei"; font-family: "PingFangSC", "Microsoft Yahei";
box-sizing: border-box; box-sizing: border-box;
-webkit-tap-highlight-color:transparent; -webkit-tap-highlight-color:transparent;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
// -webkit-overflow-scrolling : touch;
// overflow-scrolling : touch;
// overflow: auto;
&:hover{ &:hover{
outline: none; outline: none;
} }
...@@ -21,7 +31,7 @@ body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, l ...@@ -21,7 +31,7 @@ body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, l
{ {
width: 0px; width: 0px;
height: 0px; height: 0px;
background-color: #F5F5F5; background-color: #fff;
} }
/*定义滚动条轨道 内阴影+圆角*/ /*定义滚动条轨道 内阴影+圆角*/
...@@ -29,7 +39,7 @@ body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, l ...@@ -29,7 +39,7 @@ body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, l
{ {
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0); -webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
border-radius: 10px; border-radius: 10px;
background-color: #F5F5F5; background-color: #fff;
} }
/*定义滑块 内阴影+圆角*/ /*定义滑块 内阴影+圆角*/
...@@ -49,10 +59,11 @@ textarea { -webkit-appearance: none;} ...@@ -49,10 +59,11 @@ textarea { -webkit-appearance: none;}
html,body{ html,body{
height: 100%; height: 100%;
width: 100%; width: 100%;
background-color: #F5F5F5; background-color: #fff;
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
} }
.clear:after{ .clear:after{
content: ''; content: '';
display: block; display: block;
...@@ -109,3 +120,110 @@ html,body{ ...@@ -109,3 +120,110 @@ html,body{
.animation_opactiy{ .animation_opactiy{
animation: backOpacity 2s ease-in-out infinite; animation: backOpacity 2s ease-in-out infinite;
} }
// 屏幕适配
@media screen and (min-width:1240px) and (max-width:1900px){
.screenSet{
// width: 163vh !important;
// height: 66vh !important;
// height: 430px !important;
margin: 88px 30px 0px;
overflow: auto;
}
}
@media screen and (min-width:1900px){
.screenSet{
// width: 166vh !important;
// height: 78vh !important;
// height: 800px !important;
overflow: auto;
margin: 88px 30px 0px;
}
}
.word-size {
font-size: 12px;
}
// 字体大小
.el-form-item{
.el-form-item__label {
font-size: 12px;
}
}
// 表格分页
.pagination {
margin: 20px 0;
text-align: right;
.el-pagination {
white-space: nowrap;
padding: 2px 5px;
color: #303133;
font-weight: 700;
}
}
// 表格
.el-table thead th{
background: #fafafa;
}
//下拉框
.el-dropdown-menu .el-popper {
top: 48px;
}
// 消息推送
.el-notification.right {
top: 130px !important;
}
// 弹框按钮样式
.el-message-box {
width: 360px;
height: 160px;
.el-message-box__header {
text-align: center;
}
.el-message-box__status {
display: none;
}
.el-message-box__message {
text-align: center
}
.el-message-box__btns {
text-align: center !important;
button {
height: 32px;
width: 78px;
}
}
}
.el-button--primary {
line-height: 40px;
background: #449284 !important;
border: 1px solid #449284 !important;
}
.el-button.is-disabled {
background: #449284 !important;
border: 1px solid #449284 !important;
opacity: 0.5;
}
.el-pagination.is-background .el-pager li:not(.disabled).active {
background: #449284 !important;
}
// 主题样式修改
.el-radio__input.is-checked .el-radio__inner {
border-color: #449284 !important;
background: #449284 !important;
}
.el-radio__input.is-checked+.el-radio__label, .el-tabs__item.is-active {
color: #449284 !important;
}
// 面包屑导航
.el-breadcrumb__inner a, .el-breadcrumb__inner.is-link {
font-weight: 300 !important;
}
.el-breadcrumb__inner.is-link:hover {
color: #449284 !important;
}
\ No newline at end of file
@import './common.scss';
//定位
.relative{
position: relative;
}
.flex{
display: flex;
}
.space-between{
display: flex;
justify-content: space-between;
}
.flex-start{
display: flex;
justify-content: flex-start;
}
.flex-end{
display: flex;
justify-content: flex-end;
}
.textLeft{
float: left;
}
.center{
text-align: center;
}
.mt10{
margin-top: 10px;
}
.mt20{
margin-top: 20px;
}
.mb10{
margin-bottom: 10px;
}
.mb20{
margin-bottom: 20px;
}
.pt10{
padding-top: 10px;
}
.pt20{
padding-top: 10px;
}
.pb10{
padding-bottom: 10px;
}
.pb20{
padding-bottom: 20px;
}
.mLR10{
margin: 0 10px;
}
.mLR20{
margin: 0 20px;
}
.mTB10{
margin: 10px 0;
}
.mTB20{
margin: 20px 0;
}
.pLR10{
padding: 0 10px;
}
.pLR20{
padding: 0 20px;
}
.pTB10{
padding: 10px 0;
}
.pTB20{
padding: 20px 0;
}
.fs10{
font-size: 10px;
}
.fs11{
font-size: 11px;
}
.fs12{
font-size: 12px;
}
.fs13{
font-size: 13px;
}
.fs14{
font-size: 14px;
}
.fs15{
font-size: 15px;
}
.fs16{
font-size: 16px;
}
.fs25{
font-size: 25px;
}
.fw{
font-weight: 600;
}
.bgWhite{
background-color: #fff;
}
.gray{
color: rgba(177, 181, 184, 1);
}
.white{
color: #fff;
}
.button-green {
color: #ffffff;
background: #449284;
border-color: #bfdad5;
border-radius: 2px;
}
.button-white {
color: #606266;
background: #ffffff;
border-color: #ecedf1;
border-radius: 2px;
}
...@@ -69,7 +69,7 @@ $fc:#fff; ...@@ -69,7 +69,7 @@ $fc:#fff;
} }
@function px2rem($px){ // @function px2rem($px){
$rem: 37.5px; // $rem: 37.5px;
@return ($px / $rem) + rem; // @return ($px / $rem) + rem;
} // }
\ No newline at end of file \ No newline at end of file
此差异已折叠。
/**
* 常量定义文件
*
*/
// 分页大小
export const PAGE_SIZE = 10
// 添加动作常量
export const ACTION_TYPE_ADD = 'ACTION_TYPE_ADD'
// 修改动作常量
export const ACTION_TYPE_UPDATE = 'ACTION_TYPE_UPDATE'
// 删除动作常量
export const ACTION_TYPE_DELETE = 'ACTION_TYPE_DELETE'
/* 是否使用Mock数据 */
export const IS_MOCK_DATAS = true
// 通用状态 全部/正常/停用
export const COMMON_STATUS_OPTIONS = [
{
value: '',
label: '启用状态'
}, {
value: 0,
label: '正常'
}, {
value: 1,
label: '停用'
}
]
// 识别状态 全部/未标记/正常/误识
export const RECORD_STATUS_OPTIONS = [
{
value: '',
label: '标记状态'
}, {
value: '0',
label: '未标记'
}, {
value: '1',
label: '正常'
}, {
value: '2',
label: '误识'
}
]
// 用户类型 全部/普通用户/VIP/黑名单
export const USER_TYPE_OPTIONS = [
{
value: '',
label: '用户类型'
}, {
value: 1,
label: '普通用户'
}, {
value: 2,
label: 'VIP'
}, {
value: 3,
label: '黑名单'
}
]
/**
* 环境变量配置文件
*/
export const envConfig = {
development: {
// baseUrl: 'https://dev-sc.yunqueyi.com/',
// // baseUrl: 'http://10.177.15.180:10202/',
// // baseUrl: 'http://192.168.140.14:10201/',
// baseUrl: 'https://test1-sc.yunqueyi.com/',
//baseUrl: 'https://uat-sc.yunqueyi.com/',
baseUrl: 'https://dev-sc.yunqueyi.com/',
qiniuFileUrl: "https://dev-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'http://localhost:8090/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html'
},
dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/',
qiniuFileUrl: "https://dev-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html'
},
test: {
baseUrl: 'https://test1-sc.yunqueyi.com/',
qiniuFileUrl: "https://test1-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://test1.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://test1-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://test1.yunqueyi.com/pica_index.html'
},
uat: {
baseUrl: 'https://uat-sc.yunqueyi.com/',
qiniuFileUrl: "https://uat-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://video.yunqueyi.com", // 视频
qiniuImgUrl: "https://files.yunqueyi.com",
loginUrl: 'https://uat.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://uat-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://uat.yunqueyi.com/pica_index.html'
},
pro: {
baseUrl: 'https://sc.yunqueyi.com/',
qiniuFileUrl: "https://sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://video.yunqueyi.com",
qiniuImgUrl: "https://files.yunqueyi.com",
loginUrl: 'https://yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://www.yunqueyi.com/pica_index.html'
}
}
//api路径
import {isNotEmptyUtils} from "./utils";
export default async(url = '', data = {}, type = 'POST', method = 'fetch',server='CONTENT') => {
type = type.toUpperCase();
// url = (server==='WECHAT'?wechatUrl:baseUrl) + url;
if (url.match("^http") == null){
url = localStorage.getItem("Url") + url;
}
console.log("完整url:",url)
if (type == 'GET' && data) {
let dataStr = ''; //数据拼接字符串
Object.keys(data).forEach(key => {
dataStr += key + '=' + data[key] + '&';
})
if (dataStr !== '') {
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
url = url + '?' + dataStr;
// url = encodeURI(url + '?' + dataStr, true);
}
}
if (window.fetch && method == 'fetch') {
let requestConfig = {
credentials: 'include',
method: type,
// mode: "cors",
headers: {
// 'Access-Control-Allow-Origin': '*',
'Accept': '*',
'Content-Type': 'application/json',
'sysCode':'2'
// 'token': localStorage.getItem('token') || null, //固定传header:
// 'system_code': 'todo' //固定传header:系统编号
},
}
if (type == 'POST' || type === 'PUT' || type === 'PATCH' || type === 'DELETE' && data) {
Object.defineProperty(requestConfig, 'body', {
value: JSON.stringify(data)
})
}
try {
const response = await fetch(url, requestConfig);
const responseJson = await response.json();
return responseJson
} catch (error) {
throw new Error(error)
}
} else {
return new Promise((resolve, reject) => {
let requestObj;
if (window.XMLHttpRequest) {
requestObj = new XMLHttpRequest();
} else {
requestObj = new ActiveXObject;
}
let sendData = '';
if (type == 'POST' || type == 'DELETE' || type == 'PUT') {
sendData = JSON.stringify(data);
}
requestObj.open(type, url, true);
requestObj.setRequestHeader("Content-Type", "application/json");
requestObj.setRequestHeader("sysCode", "3");
requestObj.send(sendData);
requestObj.onreadystatechange = () => {
if (requestObj.readyState == 4) {
if (requestObj.status == 200) {
let obj = requestObj.response
if (typeof obj !== 'object' && isNotEmptyUtils(obj)) {
obj = JSON.parse(obj);
}
resolve(obj)
} else {
reject(requestObj)
}
}
}
})
}
}
...@@ -5,21 +5,26 @@ import store from '../store' ...@@ -5,21 +5,26 @@ import store from '../store'
const service = axios.create({ const service = axios.create({
// baseURL: process.env.BASE_API // baseURL: process.env.BASE_API
timeout: 15000, timeout: 600000,
withCredentials: false withCredentials: false
}) })
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
// console.log('config: ', config, config.data.setEntry) config.headers['sysCode'] = 12
if (config.data && config.data.setEntry) { config.headers['token'] = localStorage.getItem('storageToken')
config.headers['sysCode'] = config.data.sysCode || 10
config.headers['token'] = config.data.token || '625D128F3DBA486AABE7CBA9BDF90E69'
config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' }) config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
} // if (config.data && config.data.setEntry) {
// config.headers['sysCode'] = config.data.sysCode || 10
// if(config.data.token){
// config.headers['token'] = config.data.token || '63C3FA92AF8A45A48B31EB7FD97B95EB'
// }
// config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
// }
return config return config
}, error => { }, error => {
logger.debug('service.interceptors.request: ', error) // logger.debug('service.interceptors.request: ', error)
Promise.reject(error) Promise.reject(error)
}) })
...@@ -31,14 +36,14 @@ service.interceptors.response.use( ...@@ -31,14 +36,14 @@ service.interceptors.response.use(
baseUrl时,返回000000为成功 baseUrl时,返回000000为成功
apiUrl时,返回200为成功 apiUrl时,返回200为成功
*/ */
if (res.code !== '000000' && response.respCode === 200) { // if (res.code !== '000000') {
return Promise.reject('error') // return Promise.reject('error')
} else { // } else {
return response.data return response.data
} // }
}, },
error => { error => {
logger.error('err' + error) // logger.error('err' + error)
return Promise.reject(error) return Promise.reject(error)
} }
) )
......
import { formatTime } from './index'
const vueFilter = { const vueFilter = {
// 通用状态过滤器 liveDateFilter: (value) => {
formatStatus: function(value) { if (!value) return '';
return !value ? '正常' : '停用' return new Date(value).format("yyyy-MM-dd hh:mm:ss");
},
liveFilter: (value) => {
if(value.liveStatus == 1){
return '未开始'
} else if(value.liveStatus == 5) {
return '直播中'
}else if(value.liveStatus == 10 && value.lookBackStatus == 2){
return '已结束(不可回看)'
}else if(value.liveStatus == 10 && value.lookBackStatus == 1) {
return '已结束(可回看)'
}
},
liveStatusFilter: (value) => {
if(value == 1) return "隐藏"
else return "发布"
},
liveTeacherType: (value) => {
let doctorName = []
if(value.length > 3) {
for(let i = 0; i < 3; i++) {
doctorName.push(value[i].doctorName)
}
return doctorName.join("、") + '...'
}else{
for(let i = 0; i < value.length; i++) {
doctorName.push(value[i].doctorName)
}
return doctorName.join("、")
}
},
controlType: (value) => {
if(value == 1) {
return '分页1'
}else if(value == 2) {
return '分页2'
}else if(value == 3) {
return '图片1'
}else if(value == 4) {
return '图片2'
}else if(value == 6) {
return '视频'
}
},
tabControlType: (value) => {
if(value == 3) {
return '图片1'
}else if(value == 4) {
return '图片2'
}else if(value == 6) {
return '视频'
}
},
refreshType: (value) => {
if(value == 1) return "支持"
else return "不支持"
},
moudleType: (value) => {
if(value == 1) return "未激活"
else return "激活"
},
dateFilter: (value) => {
if (!value) return '';
return new Date(value).format("yyyy-MM-dd hh:mm");
},
appColumnStatusFilter: (value) => {
if(value == 1) return "未提交"
else if(value == 4) return "已提交"
},
statusFilter: (value) => {
if(value == 1) return "已创建"
else if(value == 5) return "已发布"
else return "已下架"
},
linkTypeFilter: (value) => { // 跳转类型
if(value == 1) return '链接'
else if(value == 4) return '模块'
else return '无跳转'
},
teacherStatusFilter: (value) => {
if(value == 1) return "已下架"
else return "已发布"
},
moduleTypeFilter: (value,data) => { // 模块类型
for(let key in data) {
if(value == key) {
return data[key]
}
}
},
contentCreatedType: (value,data) => {
for(let i = 0; i< data.length;i++) {
if(value == data[i].id) {
return data[i].name
}
} }
}
},
contentModifiedType: (value,data) => {
for(var i=0; i < data.length;i++) {
if(value == data[i].id) {
return data[i].name
}
}
},
columnPositionType: (value,data) => { // 位置
for(let key in data) {
if(value == key) {
return data[key]
}
}
},
// 项目组件
statusFileter: (value) => {
if(value == 1) {
return '草稿'
}else if(value == 2) {
return '未启用'
}else if(value == 3) {
return '已启用'
}else {
return '已禁用'
}
},
//项目管理
statusProject: (value) => {
//console.log(value)
if(value[0] == 1) {
return '草稿'
}else if(value[0] == 2) {
return '未上架'
}else if(value[0] == 3) {
if(value[1] == 1) {
return '待审核'
} else {
return '审核中'
}
}else if(value[0] == 4) {
return '已上架'
}else if(value[0] == 5) {
return '已下架'
}else if(value[0] == 6) {
return '已拒绝'
}
},
projeceRoleType: (value) => {
if(value == "L1") {
return '内部管理员'
}else if(value == "L2") {
return '项目负责人'
}else if(value == "L3") {
return '次级负责人'
} else if(value == "L0") {
return '普通用户'
}
},
}
export default vueFilter export default vueFilter
\ No newline at end of file
/** /**
* Created by Anndy Yang on 18/03/18. * Created by Anndy Yang on 18/09/18.
*/ */
import { envConfig } from '@/utils/env-config'
Date.prototype.format = function(fmt) { export function setEventByModuleCode(itemData){
var o = { let modeCode = itemData.appModuleInfo.code || '';
'M+': this.getMonth() + 1, // 月份 let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
'd+': this.getDate(), // 日 if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
'h+': this.getHours(), // 小时 paramList = ''
'm+': this.getMinutes(), // 分 }else if( modeCode === 'M100' || modeCode === 'M300' ) {
's+': this.getSeconds(), // 秒
'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
'S': this.getMilliseconds() // 毫秒
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt
}
export function parseTime(time, cFormat) { let urlPara = getUrlParmByCode(paramList);
if (arguments.length === 0) { paramList[0] && (paramList[0].value += urlPara);
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if (('' + time).length === 10) time = parseInt(time) * 1000
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
export function formatTime(time, option) { }else if( modeCode === 'M400') {
time = +time * 1000
const d = new Date(time) let path = paramList[0]['key'];
const now = Date.now() let v = paramList[0]['value'];
const diff = (now - d) / 1000 let query = setRouterParm(paramList);
let des = ''
if (diff < 30) {
des = '刚刚'
} else if (diff < 3600) { // less 1 hour
des = Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) {
des = Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) {
des = '1天前'
}
if (option) {
return parseTime(time, option)
} else {
if (des) {
return des + ' (' + (d.getMonth() + 1) + '/' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds() + ')'
} else {
return d.getMonth() + 1 + '/' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds()
} }
if(typeof paramList === 'string' && !paramList){
paramList = []
} }
}
// 将树形结构任意两个key修改成对应的特定key return paramList;
// {id: '', name: ''} => {id: '', label: ''}
export function convertTreeData(originData, orgId = 'id', orgLabel = 'name', targetId = 'id', targetLabel = 'label') {
const targetData = []
let targetObj = {}
for (let i = 0; i < originData.length; i++) {
targetObj = {}
targetObj[targetId] = originData[i][orgId]
targetObj[targetLabel] = originData[i][orgLabel]
targetData.push(targetObj)
if (originData[i].children && originData[i].children.length > 0) {
targetObj.children = convertTreeData(originData[i].children, orgId, orgLabel, targetId, targetLabel)
}
}
return targetData
} }
/** function getUrlParmByCode(paramList) {
* JSON数组去重 if ( paramList.length <= 1) {
* @param: [array] json Array return ''
* @param: [string] 唯一的key名,根据此键名进行去重
*/
export function uniqueArray(array, key) {
const result = [array[0]]
for (let i = 1; i < array.length; i++) {
const item = array[i]
let repeat = false
for (let j = 0; j < result.length; j++) {
if (item[key] === result[j][key]) {
repeat = true
break
} }
let dataStr = ''
let list = [];
for( let i = 1; i < paramList.length; i ++) {
list.push(paramList[i].key + '=' + paramList[i].value)
} }
if (!repeat) { dataStr = list.join('&')
result.push(item) if (dataStr !== '') {
return '?' + dataStr
} }
} return ''
return result
} }
// 计算高度
export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'sidebarWrapperId', export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'sidebarWrapperId',
containerHeightId = 'appContainerId', innerHeightId = 'elTableId'){ containerHeightId = 'appContainerId', innerHeightId = 'elTableId'){
if (!p_getElm(refHeightId) || !p_getElm(containerHeightId) || !p_getElm(innerHeightId)) { if (!p_getElm(refHeightId) || !p_getElm(containerHeightId) || !p_getElm(innerHeightId)) {
...@@ -148,33 +69,111 @@ function p_getElm(elmId) { ...@@ -148,33 +69,111 @@ function p_getElm(elmId) {
return document.getElementById(elmId) return document.getElementById(elmId)
} }
export function getHostnameAndPort() {
const NODE_ENV = process.env.NODE_ENV
if (NODE_ENV === 'production') {
return location.hostname + ':' + location.port export function deepCopy(obj) {
var result = Array.isArray(obj) ? [] : {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === 'object') {
result[key] = deepCopy(obj[key]); //递归复制
} else { } else {
return '192.168.80.191:8080' result[key] = obj[key];
}
}
} }
return result;
} }
// test1地址 /**
const baseUrl = 'http://test1-sc.yunqueyi.com/' *
const apiUrl = 'http://test1-api.yunqueyi.com/' * @param {Array} originData 初始数据
* @param {Boolean} isUp true: 升序 false: 降序
// // uat地址 * @param {String} sortField 排序字段,如果没有,则直接排序
// const baseUrl = 'http://uat-sc.yunqueyi.com/' * @param {Function} converFun 字段对应的数值转换函数
// const apiUrl = 'http://uat-api.yunqueyi.com/' */
export function arraySort(originData, isUp = true, sortedField, converFun) {
// debugger
let sortedData = originData.slice(), swap, sourceA, sourceB;
for(let i = 0; i < sortedData.length - 1; i ++) {
for(let j = 0; j < sortedData.length - i -1; j++) {
sourceA = sortedData[j]
sourceB = sortedData[j + 1]
if(sortedField && !converFun) {
sourceA = sourceA[sortedField]
sourceB = sourceB[sortedField]
} else if(sortedField && converFun && typeof converFun === 'function'){
if(!sourceA[sortedField] || !sourceB[sortedField]) {
sourceA = 0
sourceB = 0
} else {
sourceA = converFun(sourceA[sortedField])
sourceB = converFun(sourceB[sortedField])
}
}
// if(!sourceA || !sourceB) {
// sourceA = 0
// sourceB = 0
// }
if(isUp) {
if((sourceA - 0) > (sourceB - 0)) {
swap = sortedData[j]
sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap
}
} else {
if((sourceA - 0) < (sourceB - 0)) {
swap = sortedData[j]
sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap
}
}
}
}
return sortedData
}
// // pro地址
// const baseUrl = 'http://sc.yunqueyi.com/'
// const apiUrl = 'http://api.yunqueyi.com/'
export function sortParmData(originData, orderCol, index) {
return originData.sort((a, b) => {
return (a[orderCol] - b[orderCol] ) * -1
})
}
// 为每个URL添加应用校验密钥 // 获取SC服务器域名地址
export function getBaseUrl(url) { export function getBaseUrl(url) {
return baseUrl + url return getConfigByEnvType('baseUrl') + url
} }
export function getApiUrl(url) { // 获取七牛token
return apiUrl + url export function getQiniuToken1() {
return getConfigByEnvType('qiniuFileUrl')
} }
// 登录URL
export function getLoginUrl(param) {
return getConfigByEnvType('loginUrl') + param
}
export function getInnerLoginUrl() {
return getConfigByEnvType('innerLoginUrl')
}
// 云鹊医首页
export function getYunQueYiUrl() {
return getConfigByEnvType('yuequeyiIndexUrl')
}
// 七牛上传视频和图片
export function uploadVideo() {
return getConfigByEnvType('qiniuResourceUrl')
}
export function uploadImg() {
return getConfigByEnvType('qiniuImgUrl')
}
// 根据不同环境,生成URL
function getConfigByEnvType(urlType) {
return envConfig[process.env.BUILD_ENV][urlType]
}
import fetch from '@/utils/fetch' import fetch from '@/utils/fetch'
import { getBaseUrl, getApiUrl } from '@/utils/index' import { getBaseUrl } from '@/utils/index'
module.exports = { module.exports = {
data: function () { data: function () {
return { return {
// isIpx: Utils.env.isIPhoneX(),//是不是iphoneX
// isAndroid: Utils.env.isAndroid(),
// isIOS: false,
// isWeb: false,
token: null token: null
} }
}, },
created: function () { created: function () {
let query = this.$router.query // let query = this.$router.query
// this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null // this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null
this.token = this.getUrlKey('token') || (query && query.token) || null // this.token = this.getUrlKey('token') || (query && query.token) || null
}, },
mounted() { mounted: function() {
}, },
methods: { methods: {
...@@ -24,7 +20,7 @@ module.exports = { ...@@ -24,7 +20,7 @@ module.exports = {
let dataStr = '' let dataStr = ''
let list = []; let list = [];
for (let attr in obj) { for (let attr in obj) {
if (obj.hasOwnProperty(attr)) { if (obj.hasOwnProperty(attr) && attr != 'data') {
list.push(attr + '=' + obj[attr]) list.push(attr + '=' + obj[attr])
} }
} }
...@@ -35,10 +31,122 @@ module.exports = { ...@@ -35,10 +31,122 @@ module.exports = {
return '' return ''
}, },
setRouterParm(paramList){
let parm = {};
if(paramList.length<=1){
return '';
}
for(let i=1;i<paramList.length;i++){
parm[paramList[i].key] = paramList[i].value;
}
return parm;
},
// 拼接多个参数
getUrlParmByCode(paramList) {
if ( paramList.length <= 1) {
return ''
}
let dataStr = ''
let list = [];
for( let i = 1; i < paramList.length; i ++) {
list.push(paramList[i].key + '=' + paramList[i].value)
}
dataStr = list.join('&')
if (dataStr !== '') {
return '?' + dataStr
}
return ''
},
//处理五分钟数据 初始化播放状态
handelFive(d) {
for (let i = 0; i < d.length; i++) {
d[i].play = '0';
}
return d;
},
// 根据条件排序
async searchForOrder(searchCategory = '1', searchValue = '', sortItem = 1, pageSize = 10, sourceData = []) {
if(pageSize <=0 ) return;
let str2 = (searchValue || '').replace(/[\-\_\,\!\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\?]/g, '');// 去掉特殊字符
let _this = this,
para = {
searchCategory: searchCategory,
searchValue: str2,
keywordColor: 'rgba(244,122,72,1)',
sortItem: sortItem,
pageNo: 1,
pageSize: pageSize,
token: _this.token,
setEntry: 'headers',
}
let url = 'contents/searchKeyword/searchContent'
let csourceData = await this.GET(url, para).then(res => {
// _this.searchText = ''
if (res.code == '000000') {
// 课程
if(searchCategory.indexOf('1') >= 0) {
sourceData = (res.data && res.data.contentAppModels) || []
}
if(searchCategory.indexOf('2') >= 0) {
// sourceData = []
sourceData = this.handelFive(res.data.fiveMinutesMedicalContentList || [])
}
if(searchCategory.indexOf('3') >= 0) {
sourceData = (res.data && res.data.pCourseDoctorModels) || []
}
if(searchCategory.indexOf('4') >= 0) {
sourceData = res.data.educationContents
}
}
return sourceData || []
})
return csourceData
},
setEventByModuleCode(itemData){
let modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = ''
}else if( modeCode === 'M100' || modeCode === 'M300' ) {
// 支持多个参数
let urlPara = this.getUrlParmByCode(paramList);
if(paramList[0]){
if( paramList[0].value.indexOf("?") == -1){
paramList[0].value += urlPara
}
}
} else if (modeCode === 'M400') {
debugger
let path = paramList[0]['key'];
let v = paramList[0]['value'];
let query = this.setRouterParm(paramList);
paramList = [{
url:v,
query:query
}]
this.$router.push({
path: v,
query: query
})
//alert(this.token);
return 'NO'
}
if(typeof paramList === 'string' && !paramList){
paramList = []
}
return paramList;
},
// 通用GET请求 // 通用GET请求
GET(api, para, callback) { GET(api, para, callback,str) {
para.token = para.token || this.token || '625D128F3DBA486AABE7CBA9BDF90E69' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
url = encodeURI(url);
return fetch({ return fetch({
url: getBaseUrl(url), url: getBaseUrl(url),
method: 'get', method: 'get',
...@@ -46,32 +154,22 @@ module.exports = { ...@@ -46,32 +154,22 @@ module.exports = {
}) })
}, },
// 通用POST请求 // 通用DELETE请求
POST(api, para, callback) { DELETE(api, para, callback,str) {
para.token = para.token || this.token || '625D128F3DBA486AABE7CBA9BDF90E69' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({
url: getBaseUrl(api),
method: 'post',
data: para
})
},
// 通用GET请求
API_GET(api, para, callback) {
para.token = para.token || this.token || '625D128F3DBA486AABE7CBA9BDF90E69' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
return fetch({ return fetch({
url: getApiUrl(url), url: getBaseUrl(url),
method: 'get', method: 'delete',
data: para data: para
}) })
}, },
// 通用POST请求 // 通用POST请求
API_POST(api, para, callback) { POST(api, para, callback) {
para.token = para.token || this.token || '625D128F3DBA486AABE7CBA9BDF90E69' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token // para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({ return fetch({
url: getApiUrl(api), url: getBaseUrl(api),
method: 'post', method: 'post',
data: para data: para
}) })
...@@ -100,7 +198,7 @@ module.exports = { ...@@ -100,7 +198,7 @@ module.exports = {
} }
} }
return null return null
}, }
} }
} }
let tableOrganization = [{
name: "上海市第一人民医院",
grade: "一甲医院",
province: "上海市",
city: "上海市",
district: "浦东新区",
street: "张江街道"
}, {
name: "上海市第二人民医院",
grade: "二甲医院",
province: "上海市",
city: "上海市",
district: "浦东新区",
street: "张江街道"
}, {
name: "上海市第三人民医院",
grade: "三甲医院",
province: "上海市",
city: "上海市",
district: "浦东新区",
street: "张江街道"
}];
let tablePerson = [{
name: "云小鹊",
hospital: "上海市第一人民医院",
department: "全科",
province: "上海市",
city: "上海市",
district: "浦东新区"
}, {
name: "云小鹊",
hospital: "上海市第二人民医院",
department: "全科",
province: "上海市",
city: "上海市",
district: "长宁区"
}, {
name: "云小鹊",
hospital: "上海市第三人民医院",
department: "全科",
province: "上海市",
city: "上海市",
district: "南汇区"
}];
let treeData = [
{
id: 11,
name: "一级 1",
label: "一级 1",
isLeaf: "true",
children: [
{
id: 1,
label: "一级 1",
isLeaf: "true",
children: [
{
id: 4,
label: "二级 1-1",
children: [
{
id: 9,
label: "三级 1-1-1"
},
{
id: 10,
label: "三级 1-1-2"
}
]
}
]
},
{
id: 2,
label: "一级 2",
children: [
{
id: 5,
label: "二级 2-1",
children: [],
},
{
id: 6,
label: "二级 2-2",
isLeaf: false,
}
]
},
{
id: 4,
label: "一级 4",
isLeaf: false,
},
{
id: 3,
label: "一级 3",
children: [
{
id: 7,
label: "二级 3-1"
},
{
id: 8,
label: "二级 3-2"
}
]
}
]
}
];
// 按钮type类型: 0-编辑
// 1-暂存 2-完成 3-上架 4-通过 5-下架 6-拒绝
// 7- 提醒审核 8(2)-取消审核 9-删除
let buttonStatusIn = [
//L1 内部管理员 L2项目负责人 L3次级负责人
//草稿
{ L1: "09", L2: "", L3: "" },
//未上架
{ L1: "039", L2: "039", L3: "0" },
//待审核、审批中
{ L1: "46", L2: "78", L3: "" },
//已上架
{ L1: "05", L2: "05", L3: "0" },
//已下架
{ L1: "039", L2: "039", L3: "0" },
//已拒绝/未上架
{ L1: "039", L2: "039", L3: "0" },
];
let buttonStatusOut = [
//L1 内部管理员 L2项目负责人 L3次级负责人
//草稿
{ L1: "", L2: "09", L3: "" },
//未上架
{ L1: "09", L2: "039", L3: "0" },
//待审核、审批中
{ L1: "46", L2: "78", L3: "" },
//已上架
{ L1: "05", L2: "05", L3: "0" },
//已下架
{ L1: "039", L2: "039", L3: "0" },
//已拒绝/未上架
{ L1: "09", L2: "039", L3: "0" },
];
export function returnData() {
let data = {};
data.tableOrganization = tableOrganization;
data.tablePerson = tablePerson;
data.treeData = treeData;
data.buttonStatusIn = buttonStatusIn;
data.buttonStatusOut = buttonStatusOut;
return data;
}
\ No newline at end of file
//求并集
export function getUnion(a, b) {
if (a.constructor === Array && b.constructor === Array) {
let set1 = new Set(a);
let set2 = new Set(b);
return Array.from(new Set([...set1, ...set2]));
}
return null;
}
//求差集
export function getDifference(a, b) {
if (a.constructor === Array && b.constructor === Array) {
let set1 = new Set(a);
let set2 = new Set(b);
return Array.from(new Set([...set1].filter(x => !set2.has(x))));
}
return null;
}
//求交集
export function getIntersect(a, b) {
if (a.constructor === Array && b.constructor === Array) {
let set1 = new Set(a);
let set2 = new Set(b);
return Array.from(new Set([...set1].filter(x => set2.has(x))));
}
return null;
}
//获取id的list
export function getIdList(data) {
let list = [];
if(typeof data === 'undefined') {
return list;
}
if (data.constructor === Array) {
for (let i = 0; i < data.length; i++) {
list.push(data[i].id);
}
}
return list;
}
//区域
export function getDivision(data) {
if (data === null || data == 'NaN') {
let empty = [];
return empty;
}
let list = data.split('|');
let num = [];
for (let i = 0; i < list.length; i++) {
num[i] = parseInt(list[i]);
}
//console.log(list);
return num;
}
export function getLevelList(data) {
let level = [];
level[0] = {
id: '-1',
label: '全部医院等级',
}
for (let i = 0; i < data.length; i++) {
let obj = {
id: data[i].no,
label: data[i].value,
}
level.push(obj);
}
//console.log(level);
return level;
}
function inTags(id, tags) {
let flag = false;
for (let i = 0; i < tags.length; i++) {
if (tags[i].key == id) {
flag = true;
}
}
return flag;
}
export function inOrganization(list, id) {
let flag = false;
if (list.length == 0) {
flag = true;
}
for (let i = 0; i < list.length; i++) {
if (list[i].id != id) {
flag = true;
}
}
return flag;
}
export function initTags(value) {
let tags = [];
for (let j = 0; j < value.length; j++) {
let tagsComponent = {};
tagsComponent.value = value.value;
tagsComponent[j].name = this.optionsComponent[j].label;
}
return tags;
}
//机构列表
export function getOrganizationList(data) {
let list = [];
list[0] = {
value: '0',
label: '全部机构',
};
for (let i = 0; i < data.length; i++) {
let obj = {
value: data[i].key,
label: data[i].name,
}
list.push(obj);
}
return list;
}
//机构列表
export function getHospitalList(data) {
let list = [];
list[0] = {
value: 0,
label: '全部医院',
};
for (let i = 0; i < data.length; i++) {
let obj = {
value: data[i].id,
label: data[i].name,
}
list.push(obj);
}
//console.log(list);
return list;
}
//拼树
export function changeTags(option) {
let list = [];
// for(let i=0;i<option.length;i++) {
// console.log(option[i].label);
// let obj = {
// name: option[i].name,
// key: option[i].key,
// }
// list.push(obj);
// }
console.log(option);
return option;
}
// 递归删除多余的节点
function handlerAction(treeData, selData) {
treeData.forEach((elem, index) => {
if (!isValuable(elem.value, selData)) {
treeData.splice(index, 1)
handlerAction(treeData, selData)
} else {
if (elem.children) {
handlerAction(elem.children, selData)
}
}
})
return treeData;
}
function isValuable(val, selData) {
for (let i = 0; i < selData.length; i++) {
if (selData[i]['value'].indexOf(val) >= 0) {
return true
}
}
return false
}
function changeTreeKey(oData, orgKey, targetKey) {
oData = [...oData]
oData.forEach(elem => {
elem[targetKey] = elem[orgKey]
delete elem[orgKey]
if (elem.children) {
changeTreeKey(elem.children, orgKey, targetKey)
}
})
return oData
}
function deleteTreeKey(oData, delKeys) {
oData = [...oData]
oData.forEach(elem => {
delKeys.forEach(key => {
delete elem[key]
})
if (elem.children) {
deleteTreeKey(elem.children, delKeys)
}
})
return oData
}
function deleteEmptyChild(oData) {
oData = [...oData]
oData.forEach(elem => {
if (elem.children && elem.children.length == 0) {
delete elem.children
} else if (elem.children) {
deleteEmptyChild(elem.children)
}
})
return oData
}
function addEmpty(data) {
let after = [];
after[0] = {
label: "全部地区",
value: "0",
}
for(let i=0;i<data.length;i++) {
after.push(data[i]);
}
return after;
}
export function treeHandler(treeData, selData) {
//console.log('treeData',treeData,'selData',selData);
treeData = deleteTreeKey(treeData, ['status', 'disabled'])
treeData = changeTreeKey(treeData, 'id', 'value')
selData = changeTreeKey(selData, 'name', 'label')
selData = changeTreeKey(selData, 'key', 'value')
let endData = deleteEmptyChild(handlerAction(treeData, selData));
// console.log(treeData, selData)
//return handlerAction(treeData, selData);
let returnData = addEmpty(endData);
return returnData;
}
//小生态
export function getEcologyList() {
let dataList = [{
id: '123',
name: '上海第一人民医院',
hospitalLevelName: '二甲医院',
provinceName: '上海市',
cityName: '上海市',
countyName: '浦东新区',
townName: '--',
},{
id: '124',
name: '上海第二人民医院',
hospitalLevelName: '二甲医院',
provinceName: '上海市',
cityName: '上海市',
countyName: '浦东新区',
townName: '--',
},{
id: '125',
name: '上海第三人民医院',
hospitalLevelName: '二甲医院',
provinceName: '上海市',
cityName: '上海市',
countyName: '浦东新区',
townName: '--',
}]
return dataList;
}
export function getEcologySelect (data) {
// let ecologyist = [{
// label: '上海小生态',
// value: '1',
// },{
// label: '北京小生态',
// value: '2',
// }];
let ecologyist = [];
for(let i=0;i<data.length;i++) {
let obj = {
label: data[i].name,
value: data[i].id,
}
ecologyist.push(obj);
}
return ecologyist;
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册