diff --git a/src/main.js b/src/main.js index a549bf5..f1ad59a 100644 --- a/src/main.js +++ b/src/main.js @@ -21,7 +21,10 @@ import basicContainer from './components/basic-container/main' import api from './api' import AvueUeditor from 'avue-plugin-ueditor' import './util/indexedDb/index' +import functions from './util/function' +//全局防抖函数 +Vue.use(functions) Vue.use(AvueUeditor); import VueQuillEditor from 'vue-quill-editor' //vue-quill-editor其它文件可在应用页面直接引入 @@ -75,8 +78,6 @@ iconfontVersion.forEach(ele => { Vue.config.productionTip = false import APlayer from '@moefe/vue-aplayer'; - - Vue.use(APlayer, { productionTip: true, }); diff --git a/src/util/function.js b/src/util/function.js new file mode 100644 index 0000000..c940cb8 --- /dev/null +++ b/src/util/function.js @@ -0,0 +1,63 @@ +let timeout = null +let timer, flag +/** + * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数 + * + * @param {Function} func 要执行的回调函数 + * @param {Number} wait 延时的时间 + * @param {Boolean} immediate 是否立即执行 + * @return null + */ +function debounce(func, params, wait = 1000, immediate = false) { + // 清除定时器 + if (timeout !== null) clearTimeout(timeout) + // 立即执行,此类情况一般用不到 + if (immediate) { + var callNow = !timeout + timeout = setTimeout(function () { + timeout = null + }, wait) + if (callNow) typeof func === 'function' && func(params) + } else { + // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法 + timeout = setTimeout(function () { + typeof func === 'function' && func(params) + }, wait) + } +} +/** + * 节流原理:在一定时间内,只能触发一次 + * + * @param {Function} func 要执行的回调函数 + * @param {Number} wait 延时的时间 + * @param {Boolean} immediate 是否立即执行 + * @return null + */ +function throttle(func, params, wait = 500, immediate = true,) { + if (immediate) { + if (!flag) { + flag = true + // 如果是立即执行,则在wait毫秒内开始时执行 + typeof func === 'function' && func(params) + timer = setTimeout(() => { + flag = false + }, wait) + } + + } else { + if (!flag) { + flag = true + // 如果是非立即执行,则在wait毫秒内的结束处执行 + timer = setTimeout(() => { + flag = false + typeof func === 'function' && func(params) + }, wait) + } + } +} +export default { + install(Vue) { + Vue.prototype.$debounce = debounce + Vue.prototype.$throttle = throttle + } +} \ No newline at end of file diff --git a/src/views/Receive/index.vue b/src/views/Receive/index.vue index 709df1f..c1e7203 100644 --- a/src/views/Receive/index.vue +++ b/src/views/Receive/index.vue @@ -2771,10 +2771,8 @@ export default { } .mydesc { - position: absolute; + position: sticky; bottom: 0; - left: 0; - right: 0; padding: 0 10px; height: 40px; border-top: 1px solid #ccc; diff --git a/src/views/Template/Pinspeakwords.vue b/src/views/Template/Pinspeakwords.vue index e462cbe..69cb848 100644 --- a/src/views/Template/Pinspeakwords.vue +++ b/src/views/Template/Pinspeakwords.vue @@ -315,7 +315,7 @@ style="margin-left: 30px" type="primary" size="mini" - @click="submitForm" + @click="$debounce(submitForm)" >保存 @@ -436,6 +436,7 @@ export default { .findByRepetitionName({ name: this.inparams.templateName, houseId: this.houseId, + tempId: this.Templateid, }) .then((res) => { if (res.code != 0) { @@ -778,6 +779,7 @@ export default { window.history.back(); }, submitForm() { + console.log('q23e') let list = this.newlist; if (list.length == 0) { @@ -963,11 +965,12 @@ export default { }); return; } - - this.saveRate(params); + this.saveRate(params) }, // 评分保存 新增模板 saveRate(params) { + console.log('调用') + // if(!params.templateName) { // this.$message({ diff --git a/src/views/building/table.js b/src/views/building/table.js index 41e5c0b..37dd8bf 100644 --- a/src/views/building/table.js +++ b/src/views/building/table.js @@ -226,12 +226,12 @@ export default { minWidth: '100px', sortable: true, }, - { - label: "活跃顾问", - prop: "activeAccount", - minWidth: '100px', - sortable: true, - }, + // { + // label: "活跃顾问", + // prop: "activeAccount", + // minWidth: '100px', + // sortable: true, + // }, { label: "接待量", prop: "sumReception", diff --git a/src/views/houseData/analyse.vue b/src/views/houseData/analyse.vue index 09289d8..0631a45 100644 --- a/src/views/houseData/analyse.vue +++ b/src/views/houseData/analyse.vue @@ -107,7 +107,7 @@
+ :style="{ 'background': i + 1 == 1 ? 'linear-gradient(270deg, #F88881 0%, #E6625B 100%)' : i + 1 == 2 ? 'linear-gradient(270deg, #FFC940 0%, #FF981E 100%)' : i + 1 == 3 ? 'linear-gradient(270deg, #FFE800 0%, #FFCC00 100%)' : 'inear-gradient(270deg, #7BB1FF 0%, #618FFF 100%)', 'width': (item.zxl1||0) + '%' }">
{{ item.zxl }}