提交 51d3d66b 编写于 作者: 张磊's avatar 张磊

done

......@@ -4,4 +4,7 @@ dist/authUseful.js
dist/stroke.js
dist/
/yqy/
node_modules/
\ No newline at end of file
node_modules/
.DS_Store
.vscode
.idea
{
"editor.fontSize": 15
}
\ No newline at end of file
<<<<<<< HEAD
单独的讨论后台
=======
基于dev-app-home-plugin-1115的改版的
Branch_tag-lecturer-rev-all-0115
>>>>>>> a4ddd9e3d07edc3043738b8bbc0d9ca5535396b3
单独的讨论后台
\ No newline at end of file
<<<<<<< HEAD
单独的讨论后台
=======
>>>>>>> a4ddd9e3d07edc3043738b8bbc0d9ca5535396b3
......@@ -57,7 +57,7 @@ module.exports = {
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url',
query: {
limit: 10000,
limit: 100000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}]
......
......@@ -8,6 +8,7 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var env = config.build.env
console.log('@@@@@@@@@@@@@@@@@@@', env)
var webpackConfig = merge(baseWebpackConfig, {
module: {
loaders: utils.styleLoaders({
......@@ -18,8 +19,8 @@ var webpackConfig = merge(baseWebpackConfig, {
//devtool: config.build.productionSourceMap ? '#source-map' : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].js'),
chunkFilename: utils.assetsPath('js/[name].[chunkhash].min.js')
filename: utils.assetsPath('js/[name].js?chunkhash=[chunkhash]'),
chunkFilename: utils.assetsPath('js/[name].[chunkhash].min.js?chunkhash=[chunkhash]')
},
vue: {
loaders: utils.cssLoaders({
......@@ -46,6 +47,7 @@ var webpackConfig = merge(baseWebpackConfig, {
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
favicon: 'favicon.ico',
inject: true,
// minify: {
// removeComments: true,
......
......@@ -4,13 +4,14 @@ var path = require('path')
module.exports = {
build: {
env: {
NODE_ENV: '"production"'
NODE_ENV: '"production"',
BUILD_ENV: '"' + process.env.BUILD_ENV + '"'
},
index: path.resolve(__dirname, '../yqy/index.html'),
assetsRoot: path.resolve(__dirname, '../yqy'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: './static',
assetsPublicPath: '/yqy/',
productionSourceMap: true,
assetsPublicPath: './',
productionSourceMap: false,
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
......@@ -19,9 +20,10 @@ module.exports = {
},
dev: {
env: {
NODE_ENV: '"development"'
NODE_ENV: '"development"',
BUILD_ENV: '"' + process.env.BUILD_ENV + '"'
},
port: 8000,
port: 8888,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
// proxyTable: {
......
......@@ -8,11 +8,12 @@
<meta name="format-detection" content="telephone=no">
<meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true">
<title>云鹊·</title>
<title>云鹊医</title>
</head>
<body>
<body id="appBody">
<div id="app">
<router-view></router-view>
</div>
<script src="https://unpkg.com/qiniu-js@2.2.0/dist/qiniu.min.js"></script>
</body>
</html>
此差异已折叠。
......@@ -6,17 +6,23 @@
"private": true,
"license": "GPL",
"scripts": {
"dev": "cross-env NODE_ENV=online node build/dev-server.js",
"local": "cross-env NODE_ENV=local node build/dev-server.js",
"build": "node build/build.js"
"dev": "cross-env BUILD_ENV=development node build/dev-server.js",
"local": "cross-env BUILD_ENV=development node build/dev-server.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": {
"@babel/polyfill": "^7.2.5",
"axios": "0.16.2",
"better-scroll": "^0.1.15",
"echarts": "^4.2.0-rc.2",
"element-ui": "^2.6.1",
"fastclick": "^1.0.6",
"iscroll": "^5.2.0",
"js-cookie": "^2.2.0",
"mint-ui": "^2.2.13",
"showdown": "^1.6.4",
"vue": "^2.1.0",
"vue-router": "^2.1.1",
......@@ -47,7 +53,7 @@
"less": "^2.7.1",
"less-loader": "^2.2.3",
"node-gyp": "^3.4.0",
"node-sass": "^4.9.2",
"node-sass": "^4.13.1",
"opn": "^4.0.2",
"ora": "^0.3.0",
"sass": "^0.5.0",
......@@ -58,6 +64,7 @@
"shelljs": "^0.7.4",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"vue-lazyload": "^1.2.6",
"vue-loader": "^10.0.0",
"vue-style-loader": "^1.0.0",
"vue-template-compiler": "^2.1.0",
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
无法预览此类型文件
<template>
<div>
<transition name="router-fade" mode="out-in">
<keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
</transition>
<transition name="router-fade" mode="out-in">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
<svg-icon></svg-icon>
<v-header :userName="userName" :authList="authList"></v-header>
<v-slidebar :tokenValue="token"></v-slidebar>
<el-container>
<div class="content" id="body-content">
<transition name="router-fade" mode="out-in">
<keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
</transition>
<transition name="router-fade" mode="out-in">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
<v-footer></v-footer>
</div>
</el-container>
</div>
</template>
<script>
import svgIcon from './components/common/svg';
export default {
components:{
svgIcon
},
}
import VHeader from './views/layout/header.vue'
import VSlidebar from './views/layout/slidebar.vue'
import VFooter from './views/layout/footer.vue'
import { base64decode, isNotEmptyUtils, getUrlParamsMap, ssoLogin } from "./utils/utils.js"
import { mapActions, mapGetters } from 'vuex'
import { getLoginUrl, getInnerLoginUrl } from './utils/index.js'
let vm = null
export default {
components:{
VHeader,
VSlidebar,
VFooter
},
data() {
return {
idType: 0,
token: '',
userName: '',
authList: []
}
},
computed:{
...mapGetters([
'_token'
])
},
created() {
vm = this
vm.getToken()
},
mounted() {
},
methods: {
// 解密token
getToken() {
let href = window.location.href
let offset = href.indexOf("?")
//localStorage.setItem('storageToken','CBC0F7B0C9D34806958B18E23C881A09')
if(offset !== -1) {
let paramStr = href.substring(offset + 1, href.length)
let pars = base64decode(paramStr)
let paramMap = getUrlParamsMap(pars, "&")
if (isNotEmptyUtils(paramMap["token"]) && isNotEmptyUtils(paramMap["ssoOrigin"])) {
vm.token = paramMap["token"]
localStorage.setItem('storageToken', vm.token)
ssoLogin(href, paramMap)
//vm.$router.push({ path: 'home' })
} else {
if(!localStorage.getItem('storageToken')) {
window.location.href = getInnerLoginUrl() // 没有token返回登录页面
return
}
}
}else {
if(!localStorage.getItem('storageToken')) {
window.location.href = getInnerLoginUrl() // 没有token返回登录页面
return
}
}
vm.changeToken(vm.token)
vm.getUserAuth()
},
// 修改token
...mapActions([
'changeToken',
'changeIdType'
]),
// 获取用户权限
getUserAuth(token) {
let req = null
req = {
system_type: '26'
}
vm.POST('/contents/login/header',req).then((res) => {
if(res.code == '000000') {
vm.userName = res.data.userName
vm.authList = res.data.systemInfoList
}
})
}
}
}
</script>
<style lang="scss">
@import './style/common';
// @import './style/common';
@import './style/global';
@import './style/mixin.scss';
.router-fade-enter-active, .router-fade-leave-active {
transition: opacity .3s;
transition: opacity .1s;
}
.router-fade-enter, .router-fade-leave-active {
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>
<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>
......@@ -114,16 +114,4 @@
<symbol viewBox="0 0 126 126" id="expired"><path fill="#9B9B9B" fill-rule="evenodd" d="M63 125.5c34.518 0 62.5-27.982 62.5-62.5S97.518.5 63 .5.5 28.482.5 63s27.982 62.5 62.5 62.5zM15.156 66.678l-3.073-1.258 2.868-1.674.248-3.31 2.478 2.21 3.225-.79-1.335 3.04 1.746 2.825-3.302-.33-2.147 2.533-.704-3.245zm4.07-24.55l-2.03-2.625 3.32-.015 1.87-2.744 1.04 3.153 3.187.93-2.677 1.964.1 3.32-2.695-1.94-3.124 1.122 1.01-3.163zm15.8-19.223l-.446-3.29 2.883 1.646 2.99-1.44-.674 3.25 2.294 2.4-3.3.363-1.573 2.924-1.363-3.027-3.267-.592 2.457-2.233zm23.296-8.75l1.258-3.072 1.674 2.868 3.31.248-2.21 2.478.79 3.225-3.04-1.335-2.825 1.746.33-3.302-2.533-2.147 3.245-.704zm24.55 4.072l2.625-2.032.015 3.32 2.744 1.87-3.153 1.04-.93 3.188-1.964-2.677-3.32.1 1.94-2.695-1.122-3.124 3.163 1.01zm27.972 39.095l3.073 1.258-2.868 1.674-.248 3.31-2.478-2.21-3.225.79 1.335-3.04-1.746-2.825 3.302.33 2.147-2.533.704 3.245zm-4.07 24.55l2.03 2.625-3.32.015-1.87 2.744-1.04-3.153-3.187-.93 2.677-1.964-.1-3.32 2.695 1.94 3.124-1.122-1.01 3.163zm-15.8 19.223l.446 3.29-2.883-1.646-2.99 1.44.674-3.25-2.294-2.4 3.3-.363 1.573-2.924 1.363 3.027 3.267.592-2.457 2.233zm-23.296 8.75l-1.258 3.072-1.674-2.868-3.31-.248 2.21-2.478-.79-3.225 3.04 1.335 2.825-1.746-.33 3.302 2.533 2.147-3.245.704zm-24.55-4.072l-2.625 2.032-.015-3.32-2.744-1.87 3.153-1.04.93-3.188 1.964 2.677 3.32-.1-1.94 2.695 1.122 3.124-3.163-1.01zM74.257 41.7a23.764 23.764 0 0 0-22.17.092 23.767 23.767 0 0 0-12.508 18.646l.995.1a22.767 22.767 0 0 1 11.983-17.863 22.764 22.764 0 0 1 21.238-.088l.462-.887zm11.387 22.436A22.764 22.764 0 0 1 74.313 82.1a22.767 22.767 0 0 1-21.5.696l-.44.897a23.767 23.767 0 0 0 22.44-.727A23.764 23.764 0 0 0 86.64 64.214l-.997-.078zM63 122.5C30.14 122.5 3.5 95.86 3.5 63S30.14 3.5 63 3.5s59.5 26.64 59.5 59.5-26.64 59.5-59.5 59.5zm14.127-71.148l1.14 1.975 3.388-1.956-1.14-1.974-3.388 1.956zm2.704-3.14l-1.055-1.83-3.388 1.956 1.056 1.83 3.388-1.957zm.237 8.232l3.388-1.956-1.14-1.974-3.388 1.956 1.14 1.974zm-6.89-8.715a24.73 24.73 0 0 0-.892-1.453 7.288 7.288 0 0 0-.79-.985c.31-.104.617-.227.924-.367a6.52 6.52 0 0 0 .842-.46c.13-.093.226-.12.285-.08.06.04.066.128.017.267a.653.653 0 0 0-.032.378c.03.113.09.253.187.42l.85 1.475 3.39-1.956a39.962 39.962 0 0 0-1.01-1.677c-.25-.383-.472-.665-.67-.847a13.33 13.33 0 0 0 1.857-.767c.19-.09.313-.107.374-.05.062.057.064.148.007.273-.09.2-.128.356-.117.47.01.114.06.247.147.4l.792 1.37c.24-.157.48-.318.718-.483a9.91 9.91 0 0 0 .673-.513l1.02 1.766c-.26.095-.52.204-.78.327-.262.123-.525.243-.79.36l4.655 8.063c.234-.17.46-.333.675-.486.217-.153.43-.318.643-.496l.912 1.58c-.21.085-.434.177-.672.278-.238.1-.534.243-.888.43-.354.185-.79.423-1.307.712a205.733 205.733 0 0 0-3.876 2.238c-.516.307-.943.567-1.28.78-.34.215-.615.402-.828.562-.212.16-.408.31-.586.45l-.912-1.58c.638-.24 1.29-.533 1.958-.882l-4.668-8.085a20.893 20.893 0 0 0-1.67 1.186l-1.02-1.767a21.623 21.623 0 0 0 1.862-.854zm14.762 2.285l3.387-1.956-2.124-3.68-3.388 1.956 2.124 3.68zm-1.45-10.332l-3.387 1.956 1.956 3.387 3.387-1.956-1.956-3.387zm2.11 11.67c.274.634.514 1.305.717 2.01.204.704.36 1.408.47 2.11.11.704.167 1.4.17 2.093a10.19 10.19 0 0 1-.17 1.94c-.51-.15-1.18-.14-2.008.024.213-.974.312-1.88.298-2.723a10.595 10.595 0 0 0-.37-2.558c-.23-.865-.573-1.77-1.028-2.72a48.398 48.398 0 0 0-1.714-3.208l-2.7-4.676a25.767 25.767 0 0 0-.875-1.42 21.753 21.753 0 0 0-.85-1.186c.525-.21 1.043-.45 1.554-.717.51-.267 1.112-.6 1.805-1a60.923 60.923 0 0 0 1.893-1.136 17.45 17.45 0 0 0 1.502-1.047c.137.364.325.787.565 1.267.24.48.517.99.83 1.53l7.535 13.054a6.1 6.1 0 0 1 .46.94.97.97 0 0 1-.036.756c-.115.25-.347.527-.698.832-.35.304-.864.688-1.54 1.15a3.186 3.186 0 0 0-.647-.858 4.97 4.97 0 0 0-1.038-.717 13.81 13.81 0 0 0 1.096-.55c.264-.152.45-.295.555-.43a.502.502 0 0 0 .108-.437 2.097 2.097 0 0 0-.243-.566l-2.172-3.762-3.47 2.004zm-1.954 7.223a6.16 6.16 0 0 0-1.466-.69 6.537 6.537 0 0 0-1.563-.332l.69-1.59a14.604 14.604 0 0 1 3.05.817l-.71 1.794zm-4.033-.027a2.137 2.137 0 0 0-.287.51 6.12 6.12 0 0 0-.26.872 23.78 23.78 0 0 0-.283 1.452c-.1.594-.225 1.34-.37 2.237a3.37 3.37 0 0 0-.92-.078 5.34 5.34 0 0 0-1.096.19 8.492 8.492 0 0 0 .812-2.41c.15-.843.175-1.782.077-2.816.39.034.75.034 1.08 0a8.61 8.61 0 0 0 1.06-.182c.14-.044.227-.04.26.017.03.056.007.126-.074.21zm-17.506-5.745c.68-.392 1.22-.72 1.624-.98.405-.26.798-.538 1.182-.834l1.044 1.81c-.426.19-.86.4-1.3.626a40.64 40.64 0 0 0-1.66.917l5.015 8.688c.21.36.354.684.435.97.082.285.043.584-.118.9-.16.313-.468.676-.924 1.086-.455.41-1.11.918-1.962 1.52a10.17 10.17 0 0 0-.84-.83 7.863 7.863 0 0 0-1.12-.836 20.7 20.7 0 0 0 1.457-.813c.36-.226.625-.43.797-.612.172-.183.262-.346.27-.49a.783.783 0 0 0-.117-.444l-4.68-8.105-4.448 2.568c-.846.488-1.512.886-2 1.195-.485.31-.936.6-1.35.877l-1.03-1.788c.236-.1.472-.204.706-.31.234-.108.484-.234.75-.38a93.69 93.69 0 0 0 2.035-1.132l4.45-2.568a106.39 106.39 0 0 0-1.3-2.202c-.33-.54-.576-.92-.74-1.138.35-.13.72-.29 1.105-.486.387-.194.696-.378.93-.55.192-.147.346-.176.462-.086.117.09.133.205.048.346a.79.79 0 0 0-.08.56c.044.186.098.335.162.446l1.2 2.08zm-1.79 11.537a25.633 25.633 0 0 0-1.934-1.475 35.97 35.97 0 0 0-2.03-1.31l1.267-1.644a38.25 38.25 0 0 1 2.034 1.195c.68.428 1.346.9 1.993 1.412l-1.33 1.822zm-12.53-7.01c.706.293 1.41.608 2.11.942.702.334 1.376.693 2.022 1.078l-1.13 2.12a56.81 56.81 0 0 0-2.01-1.152 41.097 41.097 0 0 0-2.06-1.044l1.067-1.945zM63 118.25c30.514 0 55.25-24.736 55.25-55.25S93.514 7.75 63 7.75 7.75 32.486 7.75 63 32.486 118.25 63 118.25zm-2.237-47.53c.262-.058.562-.097.9-.118.34-.02.753-.04 1.24-.063.52-.025 1.176-.163 1.964-.415.788-.25 1.72-.646 2.794-1.184 1.077-.536 2.303-1.235 3.682-2.096a87.9 87.9 0 0 0 4.634-3.133 10.2 10.2 0 0 0 .24 1.4c.098.378.23.74.394 1.09a321.96 321.96 0 0 1-4.068 2.362 69.403 69.403 0 0 1-3.052 1.65c-.88.445-1.643.802-2.29 1.074s-1.236.483-1.768.633c-.533.15-1.03.256-1.492.32-.462.063-.954.107-1.476.13-.62.046-1.087.126-1.4.24-.31.117-.536.344-.674.682-.123.33-.22.74-.286 1.232a18.89 18.89 0 0 0-.144 1.62 7.14 7.14 0 0 0-1.164-.31 9.118 9.118 0 0 0-1.23-.136c.132-.575.256-1.07.374-1.49.118-.42.23-.785.338-1.096.106-.31.212-.575.318-.793.105-.22.214-.407.326-.564l-3.66-6.34c-.582.337-1.08.634-1.495.892-.415.257-.75.498-1.01.722l-.972-1.684c.293-.132.648-.3 1.066-.505.42-.203.83-.42 1.23-.653a31.8 31.8 0 0 0 1.27-.775c.433-.277.775-.516 1.028-.718.14.4.292.778.46 1.134.17.355.413.81.733 1.364l3.193 5.53zm-15.907-.43l-2.712-4.7-5.425 3.133c-1.456.84-2.783 1.63-3.983 2.368-1.2.74-2.125 1.344-2.778 1.813l-1.237-2.14c.307-.14.708-.335 1.202-.583.494-.25 1.055-.54 1.684-.876a143.593 143.593 0 0 0 4.375-2.429 153.71 153.71 0 0 0 4.442-2.648c1.175-.734 2.054-1.315 2.638-1.745.15.357.367.813.652 1.37a42.88 42.88 0 0 0 1.05 1.915l1.848 3.2a32.46 32.46 0 0 0 1.93 2.96l-2.057 1.188-.72-1.247-9.395 5.424 3.072 5.32c.224.39.415.68.574.875.158.195.345.304.562.327.216.023.5-.045.853-.202.353-.157.838-.405 1.455-.743.876-.47 1.734-.942 2.577-1.42a68.054 68.054 0 0 0 2.465-1.465c.754-.453 1.335-.84 1.743-1.158.407-.318.686-.66.836-1.023.15-.364.185-.81.104-1.334a26.6 26.6 0 0 0-.45-2.124c.843.437 1.734.523 2.67.26.206 1.026.324 1.854.354 2.483.03.628-.083 1.184-.34 1.665-.258.48-.698.943-1.32 1.386-.623.443-1.495.988-2.617 1.636l-2.545 1.47c-.908.524-1.758.996-2.55 1.417-1.063.558-1.902.97-2.517 1.23-.615.264-1.123.368-1.524.313-.402-.055-.75-.274-1.045-.657-.297-.385-.652-.937-1.068-1.658l-3.444-5.965a27.726 27.726 0 0 0-1.155-1.855c-.337-.49-.602-.835-.793-1.04.37-.157.762-.342 1.176-.553.414-.212.79-.425 1.13-.64.185-.125.32-.144.41-.056.087.088.085.214-.005.377a.624.624 0 0 0-.105.394c.015.12.082.286.202.494l.384.665 9.396-5.424zM10.402 63c0-29.05 23.55-52.598 52.598-52.598 29.05 0 52.598 23.55 52.598 52.598 0 29.05-23.55 52.598-52.598 52.598-29.05 0-52.598-23.55-52.598-52.598z"></path></symbol>
</defs>
</svg>
</template>
<script>
export default {
}
</script>
<style lang="scss">
</style>
</template>
\ No newline at end of file
<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 VueRouter from 'vue-router'
import routes from './router/router'
import store from './store/'
const mixins = require('@/utils/mixins');
import '@/utils/rem' // 引入自适应
import '@/utils/yqyServerRegister' // 移动端服务
import FastClick from 'fastclick'
import Logger from './plugins/logger' // 日志插件
import vueFilters from '@/utils/filter'
// 引入Mint
import Mint from 'mint-ui'
import 'mint-ui/lib/style.css'
Vue.use(Mint)
Vue.use(Logger, { prefix: new Date(), isDev: process.env.NODE_ENV === 'development', cLevel: 'debug' })
// 引入ElementUI
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
// 可调试
// 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) {
document.addEventListener('DOMContentLoaded', function() {
......
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 discuss = r => require.ensure([], () => r(require('../views/discuss/index.vue')), 'index')
const creatDiscuss = r => require.ensure([], () => r(require('../views/discuss/add-edit.vue')), 'creatDiscuss')
const questionNaire = r => require.ensure([], () => r(require('../views/question-naire/question-list.vue')), 'questionNaire')
const topicList = r => require.ensure([], () => r(require('../views/topicManage/index.vue')), 'topicList')
const reportSet = r => require.ensure([], () => r(require('../views/report/reportSet.vue')), 'reportSet')
const discussInfoList = r => require.ensure([], () => r(require('../views/discussInfoList.vue')), 'discussInfoList')
export default [{
path: '/',
component: App, //顶层路由,对应index.html
children: [ //二级路由。对应App.vue
//地址为空时跳转home页面
component: App,
children: [
{
path: '',
redirect: '/home'
},
//首页城市列表页
{
},{
path: '/questionNaire',
component: questionNaire
},{
path: '/home',
component: home
},
{
path: '/discuss-list',
component: discuss
},
{
path: '/creat-discuss',
component: creatDiscuss
},
{
path: '/question-naire',
component: questionNaire
},
{
path: '/topic-list',
component: topicList
},
{
path: '/report-set',
component: reportSet
},
{
path: '/discuss-info-list',
component: discussInfoList
},
]
}]
}]
\ No newline at end of file
const common = {
state: {
_token: '',
idType: ''
},
mutations: {
CHANGE_TOKEN: (state, data) => {
state._token = data
},
CHANGE_IDTYPE: (state, data) => {
state.idType = data
}
},
actions: {
changeToken({ commit }, tokenData) {
commit('CHANGE_TOKEN', tokenData)
},
changeIdType({ commit }, idTypeData) {
commit('CHANGE_IDTYPE', idTypeData)
}
}
}
export default common
\ No newline at end of file
const getters = {
_token: state => state.common._token,
idType: state => state.common.idType
}
export default getters
const getters = {
// sidebar: state => state.app.sidebar,
// token: state => state.user.token,
// avatar: state => state.user.avatar,
}
export default getters
import education from './education/getters'
import { containObject } from '../utils/utils'
const getters = containObject(education)
export default getters
\ No newline at end of file
import Vue from 'vue'
import Vuex from 'vuex'
import common from './modules/common'
import diagnosis from './modules/diagnosis'
import gpRanking from './modules/gpRanking'
import getters from './getters'
import common from './education/common'
import getters from './getters'
Vue.use(Vuex)
const store = new Vuex.Store({
export default new Vuex.Store({
modules: {
common,
diagnosis,
gpRanking
common
},
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;
margin: 0;
list-style: none;
font-style: normal;
text-decoration: none;
border: none;
color: #333;
// color: #333;
font-weight: normal;
font-family: "Microsoft Yahei";
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB","Microsoft YaHei", SimSun, "sans-serif";
box-sizing: border-box;
-webkit-tap-highlight-color:transparent;
-webkit-font-smoothing: antialiased;
// -webkit-overflow-scrolling : touch;
// overflow-scrolling : touch;
// overflow: auto;
&:hover{
outline: none;
}
......@@ -21,7 +31,7 @@ body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, l
{
width: 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
{
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
border-radius: 10px;
background-color: #F5F5F5;
background-color: #fff;
}
/*定义滑块 内阴影+圆角*/
......@@ -49,10 +59,11 @@ textarea { -webkit-appearance: none;}
html,body{
height: 100%;
width: 100%;
background-color: #F5F5F5;
background-color: #fff;
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
}
.clear:after{
content: '';
display: block;
......@@ -108,4 +119,116 @@ html,body{
.animation_opactiy{
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 ,.el-checkbox__input.is-checked+.el-checkbox__label{
color: #449284 !important;
}
.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner{
border-color: #449284 !important;
background: #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;
}
@function px2rem($px){
$rem: 37.5px;
@return ($px / $rem) + rem;
}
\ No newline at end of file
// @function px2rem($px){
// $rem: 37.5px;
// @return ($px / $rem) + rem;
// }
\ No newline at end of file
此差异已折叠。
/**
* 常量定义文件
*
*/
// 分页大小
export const PAGE_SIZE = 10
// 问卷--模板下载
export const QUESTION_UPLOAD_TEMPLATE = 'https://files.yunqueyi.com/discuss/question/templet/questionTemplet20210929.xlsx'
/* 是否使用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',
innerLoginUrl: 'https://dev-sso.yunqueyi.com/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",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
qiniuResourceUrl: "https://test1-videos.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.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'
const service = axios.create({
// baseURL: process.env.BASE_API
timeout: 15000,
timeout: 600000,
withCredentials: false
})
// request拦截器
service.interceptors.request.use(config => {
// console.log('config: ', config, config.data.setEntry)
if (config.data && config.data.setEntry) {
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['sysCode'] = 26
config.headers['token'] = localStorage.getItem('storageToken')
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
}, error => {
logger.debug('service.interceptors.request: ', error)
// logger.debug('service.interceptors.request: ', error)
Promise.reject(error)
})
......@@ -31,14 +36,15 @@ service.interceptors.response.use(
baseUrl时,返回000000为成功
apiUrl时,返回200为成功
*/
if (res.code !== '000000' && response.respCode === 200) {
return Promise.reject('error')
} else {
// if (res.code !== '000000') {
// return Promise.reject(response.data)
// } else {
return response.data
}
//}
},
error => {
logger.error('err' + error)
// logger.error('err' + error)
return Promise.reject(error)
}
)
......
import { formatTime } from './index'
const vueFilter = {
// 通用状态过滤器
formatStatus: function(value) {
return !value ? '正常' : '停用'
liveDateFilter: (value) => {
if (!value) return '';
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) => {
if(value == 1) {
return '草稿'
}else if(value == 2) {
return '未上架'
}else if(value == 3) {
return '审批中'
}else if(value == 4) {
return '已上架'
}else if(value == 5) {
return '已下架'
}else {
return '已拒绝'
}
},
projeceRoleType: (value) => {
if(value == "L1") {
return '内部管理员'
}else if(value == "L2") {
return '项目负责人'
}else if(value == "L3") {
return '次级负责人'
} else if(value == "L4") {
return '普通用户'
}
},
// 问卷
questionStatus: (value) => {
if(value == 1) {
return '下线'
}else {
return '上线'
}
},
modifyType: (value,data) => {
let userName = ''
for(let i=0; i < data.length;i++) {
if(value == data[i].id) {
userName = data[i].userName
break
}else {
userName = ''
}
}
return userName
}
}
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) {
var o = {
'M+': this.getMonth() + 1, // 月份
'd+': this.getDate(), // 日
'h+': this.getHours(), // 小时
'm+': this.getMinutes(), // 分
'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 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 = getUrlParmByCode(paramList);
paramList[0] && (paramList[0].value += urlPara);
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
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
}
}else if( modeCode === 'M400') {
export function formatTime(time, option) {
time = +time * 1000
const d = new Date(time)
const now = Date.now()
const diff = (now - d) / 1000
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天前'
let path = paramList[0]['key'];
let v = paramList[0]['value'];
let query = setRouterParm(paramList);
}
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
// {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
return paramList;
}
/**
* JSON数组去重
* @param: [array] json Array
* @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
}
function getUrlParmByCode(paramList) {
if ( paramList.length <= 1) {
return ''
}
if (!repeat) {
result.push(item)
let dataStr = ''
let list = [];
for( let i = 1; i < paramList.length; i ++) {
list.push(paramList[i].key + '=' + paramList[i].value)
}
}
return result
dataStr = list.join('&')
if (dataStr !== '') {
return '?' + dataStr
}
return ''
}
// 计算高度
export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'sidebarWrapperId',
containerHeightId = 'appContainerId', innerHeightId = 'elTableId'){
if (!p_getElm(refHeightId) || !p_getElm(containerHeightId) || !p_getElm(innerHeightId)) {
......@@ -148,33 +69,111 @@ function p_getElm(elmId) {
return document.getElementById(elmId)
}
export function getHostnameAndPort() {
const NODE_ENV = process.env.NODE_ENV
if (NODE_ENV === 'production') {
return location.hostname + ':' + location.port
} else {
return '192.168.80.191:8080'
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 {
result[key] = obj[key];
}
}
}
return result;
}
/**
*
* @param {Array} originData 初始数据
* @param {Boolean} isUp true: 升序 false: 降序
* @param {String} sortField 排序字段,如果没有,则直接排序
* @param {Function} converFun 字段对应的数值转换函数
*/
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
}
// test1地址
const baseUrl = 'http://test1-sc.yunqueyi.com/'
const apiUrl = 'http://test1-api.yunqueyi.com/'
// // uat地址
// const baseUrl = 'http://uat-sc.yunqueyi.com/'
// const apiUrl = 'http://uat-api.yunqueyi.com/'
export function sortParmData(originData, orderCol, index) {
return originData.sort((a, b) => {
return (a[orderCol] - b[orderCol] ) * -1
})
}
// // pro地址
// const baseUrl = 'http://sc.yunqueyi.com/'
// const apiUrl = 'http://api.yunqueyi.com/'
// 获取SC服务器域名地址
export function getBaseUrl(url) {
return getConfigByEnvType('baseUrl') + url
}
// 获取七牛token
export function getQiniuToken1() {
return getConfigByEnvType('qiniuFileUrl')
}
// 为每个URL添加应用校验密钥
export function getBaseUrl(url) {
return baseUrl + url
// 登录URL
export function getLoginUrl() {
return getConfigByEnvType('loginUrl')
}
export function getInnerLoginUrl() {
return getConfigByEnvType('innerLoginUrl')
}
export function getApiUrl(url) {
return apiUrl + url
// 云鹊医首页
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 { getBaseUrl, getApiUrl } from '@/utils/index'
import { getBaseUrl } from '@/utils/index'
module.exports = {
data: function () {
return {
// isIpx: Utils.env.isIPhoneX(),//是不是iphoneX
// isAndroid: Utils.env.isAndroid(),
// isIOS: false,
// isWeb: false,
token: null
}
},
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.getUrlKey('token') || (query && query.token) || null
// this.token = this.getUrlKey('token') || (query && query.token) || null
},
mounted() {
mounted: function() {
},
methods: {
getUrlPara(obj) {
let dataStr = ''
let list = [];
for (let attr in obj) {
if (obj.hasOwnProperty(attr)) {
if (obj.hasOwnProperty(attr) && attr != 'data') {
list.push(attr + '=' + obj[attr])
}
}
......@@ -35,10 +31,122 @@ module.exports = {
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(api, para, callback) {
para.token = para.token || this.token || '625D128F3DBA486AABE7CBA9BDF90E69' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
GET(api, para, callback,str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
url = encodeURI(url);
return fetch({
url: getBaseUrl(url),
method: 'get',
......@@ -46,37 +154,37 @@ module.exports = {
})
},
// 通用POST请求
POST(api, para, callback) {
para.token = para.token || this.token || '625D128F3DBA486AABE7CBA9BDF90E69' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
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
// 通用DELETE请求
DELETE(api, para, callback,str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
return fetch({
url: getApiUrl(url),
method: 'get',
url: getBaseUrl(url),
method: 'delete',
data: para
})
},
// 通用POST请求
API_POST(api, para, callback) {
para.token = para.token || this.token || '625D128F3DBA486AABE7CBA9BDF90E69' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
POST(api, para, callback) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({
url: getApiUrl(api),
url: getBaseUrl(api),
method: 'post',
data: para
})
},
// 通用POST请求
PUT(api, para, callback) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({
url: getBaseUrl(api),
method: 'put',
data: para
})
},
// 从html参数
getUrlKey(name) {
if (decodeURIComponent && location.href) {
......@@ -100,7 +208,7 @@ module.exports = {
}
}
return null
},
}
}
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册