diff --git a/src/api/comm/index.js b/src/api/comm/index.js index 3b10fa3..d7daf75 100644 --- a/src/api/comm/index.js +++ b/src/api/comm/index.js @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2021-10-20 16:36:08 - * @LastEditTime: 2021-10-20 16:55:28 + * @LastEditTime: 2021-10-22 10:15:00 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /data-show/src/api/comm/index.js @@ -27,3 +27,31 @@ export function getTwoTime(params) { params: obj }) } + +// 获取渠道 +export function getQuDao(params) { + let obj = Object.assign({action: 'getQuDao'}, params) + return httpService({ + url: `/api/v6.ashx`, + method: 'get', + params: obj + }) +} +// 获取情感 +export function getQingGan(params) { + let obj = Object.assign({action: 'getQingGan'}, params) + return httpService({ + url: `/api/v6.ashx`, + method: 'get', + params: obj + }) +} +// 负面等级 +export function getCrisis(params) { + let obj = Object.assign({action: 'getCrisis'}, params) + return httpService({ + url: `/api/v6.ashx`, + method: 'get', + params: obj + }) +} diff --git a/src/components/v-loading/index.css b/src/components/v-loading/index.css deleted file mode 100644 index 6862204..0000000 --- a/src/components/v-loading/index.css +++ /dev/null @@ -1,347 +0,0 @@ -.zh-load-mark { - position: fixed; - left: 0; - top: 0; - width: 100%; - height: 100%; - z-index: 9999; -} -.zh-load-box { - position: fixed; - z-index: 3; - width: 7.6em; - min-height: 7.6em; - top: 180px; - left: 50%; - margin-left: -3.8em; - background: rgba(0, 0, 0, 0.7); - text-align: center; - border-radius: 5px; - color: #FFFFFF; -} -.zh-load-content { - margin-top: 64%; - font-size: 14px; -} -.zh-loading { - position: absolute; - width: 0px; - left: 50%; - top: 38%; -} -.loading_leaf { - position: absolute; - top: -1px; - opacity: 0.25; -} -.loading_leaf:before { - content: " "; - position: absolute; - width: 9.14px; - height: 3.08px; - background: #d1d1d5; - box-shadow: rgba(0, 0, 0, 0.0980392) 0px 0px 1px; - border-radius: 1px; - -webkit-transform-origin: left 50% 0px; - transform-origin: left 50% 0px; -} -.loading_leaf_0 { - -webkit-animation: opacity-0 1.25s linear infinite; - animation: opacity-0 1.25s linear infinite; -} -.loading_leaf_0:before { - -webkit-transform: rotate(0deg) translate(7.92px, 0px); - transform: rotate(0deg) translate(7.92px, 0px); -} -.loading_leaf_1 { - -webkit-animation: opacity-1 1.25s linear infinite; - animation: opacity-1 1.25s linear infinite; -} -.loading_leaf_1:before { - -webkit-transform: rotate(30deg) translate(7.92px, 0px); - transform: rotate(30deg) translate(7.92px, 0px); -} -.loading_leaf_2 { - -webkit-animation: opacity-2 1.25s linear infinite; - animation: opacity-2 1.25s linear infinite; -} -.loading_leaf_2:before { - -webkit-transform: rotate(60deg) translate(7.92px, 0px); - transform: rotate(60deg) translate(7.92px, 0px); -} -.loading_leaf_3 { - -webkit-animation: opacity-3 1.25s linear infinite; - animation: opacity-3 1.25s linear infinite; -} -.loading_leaf_3:before { - -webkit-transform: rotate(90deg) translate(7.92px, 0px); - transform: rotate(90deg) translate(7.92px, 0px); -} -.loading_leaf_4 { - -webkit-animation: opacity-4 1.25s linear infinite; - animation: opacity-4 1.25s linear infinite; -} -.loading_leaf_4:before { - -webkit-transform: rotate(120deg) translate(7.92px, 0px); - transform: rotate(120deg) translate(7.92px, 0px); -} -.loading_leaf_5 { - -webkit-animation: opacity-5 1.25s linear infinite; - animation: opacity-5 1.25s linear infinite; -} -.loading_leaf_5:before { - -webkit-transform: rotate(150deg) translate(7.92px, 0px); - transform: rotate(150deg) translate(7.92px, 0px); -} -.loading_leaf_6 { - -webkit-animation: opacity-6 1.25s linear infinite; - animation: opacity-6 1.25s linear infinite; -} -.loading_leaf_6:before { - -webkit-transform: rotate(180deg) translate(7.92px, 0px); - transform: rotate(180deg) translate(7.92px, 0px); -} -.loading_leaf_7 { - -webkit-animation: opacity-7 1.25s linear infinite; - animation: opacity-7 1.25s linear infinite; -} -.loading_leaf_7:before { - -webkit-transform: rotate(210deg) translate(7.92px, 0px); - transform: rotate(210deg) translate(7.92px, 0px); -} -.loading_leaf_8 { - -webkit-animation: opacity-8 1.25s linear infinite; - animation: opacity-8 1.25s linear infinite; -} -.loading_leaf_8:before { - -webkit-transform: rotate(240deg) translate(7.92px, 0px); - transform: rotate(240deg) translate(7.92px, 0px); -} -.loading_leaf_9 { - -webkit-animation: opacity-9 1.25s linear infinite; - animation: opacity-9 1.25s linear infinite; -} -.loading_leaf_9:before { - -webkit-transform: rotate(270deg) translate(7.92px, 0px); - transform: rotate(270deg) translate(7.92px, 0px); -} -.loading_leaf_10 { - -webkit-animation: opacity-10 1.25s linear infinite; - animation: opacity-10 1.25s linear infinite; -} -.loading_leaf_10:before { - -webkit-transform: rotate(300deg) translate(7.92px, 0px); - transform: rotate(300deg) translate(7.92px, 0px); -} -.loading_leaf_11 { - -webkit-animation: opacity-11 1.25s linear infinite; - animation: opacity-11 1.25s linear infinite; -} -.loading_leaf_11:before { - -webkit-transform: rotate(330deg) translate(7.92px, 0px); - transform: rotate(330deg) translate(7.92px, 0px); -} -@-webkit-keyframes opacity-0 { - 0% { - opacity: 0.25; - } - 0.01% { - opacity: 0.25; - } - 0.02% { - opacity: 1; - } - 60.01% { - opacity: 0.25; - } - 100% { - opacity: 0.25; - } -} -@-webkit-keyframes opacity-1 { - 0% { - opacity: 0.25; - } - 8.34333% { - opacity: 0.25; - } - 8.35333% { - opacity: 1; - } - 68.3433% { - opacity: 0.25; - } - 100% { - opacity: 0.25; - } -} -@-webkit-keyframes opacity-2 { - 0% { - opacity: 0.25; - } - 16.6767% { - opacity: 0.25; - } - 16.6867% { - opacity: 1; - } - 76.6767% { - opacity: 0.25; - } - 100% { - opacity: 0.25; - } -} -@-webkit-keyframes opacity-3 { - 0% { - opacity: 0.25; - } - 25.01% { - opacity: 0.25; - } - 25.02% { - opacity: 1; - } - 85.01% { - opacity: 0.25; - } - 100% { - opacity: 0.25; - } -} -@-webkit-keyframes opacity-4 { - 0% { - opacity: 0.25; - } - 33.3433% { - opacity: 0.25; - } - 33.3533% { - opacity: 1; - } - 93.3433% { - opacity: 0.25; - } - 100% { - opacity: 0.25; - } -} -@-webkit-keyframes opacity-5 { - 0% { - opacity: 0.270958333333333; - } - 41.6767% { - opacity: 0.25; - } - 41.6867% { - opacity: 1; - } - 1.67667% { - opacity: 0.25; - } - 100% { - opacity: 0.270958333333333; - } -} -@-webkit-keyframes opacity-6 { - 0% { - opacity: 0.375125; - } - 50.01% { - opacity: 0.25; - } - 50.02% { - opacity: 1; - } - 10.01% { - opacity: 0.25; - } - 100% { - opacity: 0.375125; - } -} -@-webkit-keyframes opacity-7 { - 0% { - opacity: 0.479291666666667; - } - 58.3433% { - opacity: 0.25; - } - 58.3533% { - opacity: 1; - } - 18.3433% { - opacity: 0.25; - } - 100% { - opacity: 0.479291666666667; - } -} -@-webkit-keyframes opacity-8 { - 0% { - opacity: 0.583458333333333; - } - 66.6767% { - opacity: 0.25; - } - 66.6867% { - opacity: 1; - } - 26.6767% { - opacity: 0.25; - } - 100% { - opacity: 0.583458333333333; - } -} -@-webkit-keyframes opacity-9 { - 0% { - opacity: 0.687625; - } - 75.01% { - opacity: 0.25; - } - 75.02% { - opacity: 1; - } - 35.01% { - opacity: 0.25; - } - 100% { - opacity: 0.687625; - } -} -@-webkit-keyframes opacity-10 { - 0% { - opacity: 0.791791666666667; - } - 83.3433% { - opacity: 0.25; - } - 83.3533% { - opacity: 1; - } - 43.3433% { - opacity: 0.25; - } - 100% { - opacity: 0.791791666666667; - } -} -@-webkit-keyframes opacity-11 { - 0% { - opacity: 0.895958333333333; - } - 91.6767% { - opacity: 0.25; - } - 91.6867% { - opacity: 1; - } - 51.6767% { - opacity: 0.25; - } - 100% { - opacity: 0.895958333333333; - } -} \ No newline at end of file diff --git a/src/components/v-loading/index.js b/src/components/v-loading/index.js deleted file mode 100644 index cee68d6..0000000 --- a/src/components/v-loading/index.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * @Author: your name - * @Date: 2021-10-21 13:16:41 - * @LastEditTime: 2021-10-21 13:16:43 - * @LastEditors: Please set LastEditors - * @Description: In User Settings Edit - * @FilePath: /data-show/src/components/v-loading/index.js - */ - /* - 自定义 loading 组件 - 调用 - this.$loading('正在加载中...'); - this.$loading.close(); -*/ -let _LOADING = { - show: false, // Boolean loading显示状态 - component: null // Object loading组件 - }; -export default { -install(Vue) { - /* - text: String - type: String - */ - Vue.prototype.$loading = function(text='正在加载中...', type) { - if (type == 'close') { - _LOADING.component.show = _LOADING.show = false; - } else { - if (_LOADING.show) { - return; - } - let LoadingCompoent = Vue.extend({ - data: function() { - return { - show: _LOADING.show - } - }, - template: `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
${text}
-
-
` - }); - _LOADING.component = new LoadingCompoent(); - let element = _LOADING.component.$mount().$el; - document.body.appendChild(element); - _LOADING.component.show = _LOADING.show = true; - } - }; - // 打开/关闭 - ['open', 'close'].forEach(function(type) { - Vue.prototype.$loading[type] = function(text) { - return Vue.prototype.$loading(text, type); - } - }); -} -} \ No newline at end of file diff --git a/src/components/v-loading/index.vue b/src/components/v-loading/index.vue new file mode 100644 index 0000000..4e33995 --- /dev/null +++ b/src/components/v-loading/index.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/src/mixins/index.js b/src/mixins/index.js index 8baf8b1..78a1bba 100644 --- a/src/mixins/index.js +++ b/src/mixins/index.js @@ -1,16 +1,19 @@ /* * @Author: your name * @Date: 2021-10-12 13:56:13 - * @LastEditTime: 2021-10-20 16:54:05 + * @LastEditTime: 2021-10-22 10:46:21 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /data-show/src/mixins/index.js */ import { mapGetters, mapActions } from "vuex"; - +import Loading from './loading' export default { install(Vue) { Vue.mixin({ + directives: { + 'loading': Loading + }, computed: { ...mapGetters(['getZoom','getToken', 'getUser', 'getAccount', 'getCommTime']) }, diff --git a/src/mixins/loading.js b/src/mixins/loading.js new file mode 100644 index 0000000..4078508 --- /dev/null +++ b/src/mixins/loading.js @@ -0,0 +1,64 @@ +/* + * @Author: your name + * @Date: 2021-10-22 10:41:53 + * @LastEditTime: 2021-10-22 11:42:48 + * @LastEditors: Please set LastEditors + * @Description: In User Settings Edit + * @FilePath: /data-show/src/mixins/loading.js + */ +// src/directive/loading/index.js + +import Vue from 'vue' +import Loading from '@/components/v-loading' +/** + * Vue.extend 接受参数并返回一个构造器,new 该构造器可以返回一个组件实例 + * 当我们 new Mask() 的时候,把该组件实例挂载到一个 div 上 + **/ +const Mask = Vue.extend(Loading) + +// 更新是否显示 +const toggleLoading = (el, binding) => { + if (binding.value) { + Vue.nextTick(() => { + let style = el.currentStyle || document.defaultView.getComputedStyle(el, ''); + if(style.position != 'relative' || style.position != 'absolute') { + el.style.position = 'relative'; + } + // 控制loading组件显示 + el.instance.visible = true + // 插入到目标元素 + insertDom(el, el, binding) + }) + } else { + el.instance.visible = false + } +} + + // 插入到目标元素 +const insertDom = (parent, el) => { + parent.appendChild(el.mask) +} +export default { + //第一次绑定到元素时调用 + bind: function (el, binding) { + const mask = new Mask({ + el: document.createElement('div'), + data () {} + }) + //用一个变量接住mask实例 + el.instance = mask + el.mask = mask.$el + el.maskStyle = {} + binding.value && toggleLoading(el, binding) + }, + //所在组件的 VNode 更新时调用--比较更新前后的值 + update: function (el, binding) { + if (binding.oldValue !== binding.value) { + toggleLoading(el, binding) + } + }, + //指令与元素解绑时调用 + unbind: function (el) { + el.instance && el.instance.$destroy() + } +} diff --git a/src/views/Index/barometer/index.vue b/src/views/Index/barometer/index.vue index 97a259a..76e47a1 100644 --- a/src/views/Index/barometer/index.vue +++ b/src/views/Index/barometer/index.vue @@ -1,13 +1,13 @@