From c9f0424f0ea31f4539bd33c27fa5913d7c6665c4 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Fri, 7 May 2021 15:18:17 +0800 Subject: [PATCH] no message --- components/calendar/index.js | 6 +-- components/calendar/index.json | 3 +- components/calendar/index.wxml | 22 +++------- components/index-bar/index.wxml | 20 +++------ components/submit-bar/index.wxml | 26 +++--------- components/toast/index.js | 29 ------------- components/toast/index.json | 9 ---- components/toast/index.wxml | 19 --------- components/toast/index.wxss | 1 - components/toast/toast.js | 70 -------------------------------- pages/home/user-info/index.js | 2 - utils/util.js | 5 +-- 12 files changed, 18 insertions(+), 194 deletions(-) delete mode 100644 components/toast/index.js delete mode 100644 components/toast/index.json delete mode 100644 components/toast/index.wxml delete mode 100644 components/toast/index.wxss delete mode 100644 components/toast/toast.js diff --git a/components/calendar/index.js b/components/calendar/index.js index 06112e6..21da725 100644 --- a/components/calendar/index.js +++ b/components/calendar/index.js @@ -10,7 +10,6 @@ import { getMonths, getDayByOffset, } from './utils'; -import Toast from '../toast/toast'; import { requestAnimationFrame } from '../common/utils'; VantComponent({ props: { @@ -270,10 +269,7 @@ VantComponent({ checkRange(date) { const { maxRange, rangePrompt } = this.data; if (maxRange && calcDateNum(date) > maxRange) { - Toast({ - context: this, - message: rangePrompt || `选择天数不能超过 ${maxRange} 天`, - }); + wx.showToast({ title: rangePrompt || `选择天数不能超过 ${maxRange} 天`, icon: 'none' }) return false; } return true; diff --git a/components/calendar/index.json b/components/calendar/index.json index 397d5ae..61dec08 100644 --- a/components/calendar/index.json +++ b/components/calendar/index.json @@ -4,7 +4,6 @@ "header": "./components/header/index", "month": "./components/month/index", "van-button": "../button/index", - "van-popup": "../popup/index", - "van-toast": "../toast/index" + "van-popup": "../popup/index" } } diff --git a/components/calendar/index.wxml b/components/calendar/index.wxml index 7df0b98..374f4f0 100644 --- a/components/calendar/index.wxml +++ b/components/calendar/index.wxml @@ -3,23 +3,11 @@ - + - - - + \ No newline at end of file diff --git a/components/index-bar/index.wxml b/components/index-bar/index.wxml index 19a59cf..1c183a2 100644 --- a/components/index-bar/index.wxml +++ b/components/index-bar/index.wxml @@ -1,22 +1,12 @@ - - + + data-index="{{ index }}"> {{ item }} - + \ No newline at end of file diff --git a/components/submit-bar/index.wxml b/components/submit-bar/index.wxml index 805c38a..288a611 100644 --- a/components/submit-bar/index.wxml +++ b/components/submit-bar/index.wxml @@ -2,17 +2,9 @@ - - - - {{ tip }} - + + {{ tip }} @@ -26,17 +18,9 @@ {{ suffixLabel }} - + {{ loading ? '' : buttonText }} - + \ No newline at end of file diff --git a/components/toast/index.js b/components/toast/index.js deleted file mode 100644 index c4c2ed9..0000000 --- a/components/toast/index.js +++ /dev/null @@ -1,29 +0,0 @@ -import { VantComponent } from '../common/component'; -VantComponent({ - props: { - show: Boolean, - mask: Boolean, - message: String, - forbidClick: Boolean, - zIndex: { - type: Number, - value: 1000, - }, - type: { - type: String, - value: 'text', - }, - loadingType: { - type: String, - value: 'circular', - }, - position: { - type: String, - value: 'middle', - }, - }, - methods: { - // for prevent touchmove - noop() {}, - }, -}); diff --git a/components/toast/index.json b/components/toast/index.json deleted file mode 100644 index 9b1b78c..0000000 --- a/components/toast/index.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "component": true, - "usingComponents": { - "van-icon": "../icon/index", - "van-loading": "../loading/index", - "van-overlay": "../overlay/index", - "van-transition": "../transition/index" - } -} diff --git a/components/toast/index.wxml b/components/toast/index.wxml deleted file mode 100644 index a14e428..0000000 --- a/components/toast/index.wxml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - {{ message }} - - - - - - {{ message }} - - - - - \ No newline at end of file diff --git a/components/toast/index.wxss b/components/toast/index.wxss deleted file mode 100644 index 85dc7a8..0000000 --- a/components/toast/index.wxss +++ /dev/null @@ -1 +0,0 @@ -@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(0,0,0,.7);background-color:var(--toast-background-color,rgba(0,0,0,.7));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:88px;width:var(--toast-default-width,88px);min-height:88px;min-height:var(--toast-default-min-height,88px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:36px;font-size:var(--toast-icon-size,36px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)} \ No newline at end of file diff --git a/components/toast/toast.js b/components/toast/toast.js deleted file mode 100644 index 4a1b63a..0000000 --- a/components/toast/toast.js +++ /dev/null @@ -1,70 +0,0 @@ -import { isObj } from '../common/validator'; -const defaultOptions = { - type: 'text', - mask: false, - message: '', - show: true, - zIndex: 1000, - duration: 2000, - position: 'middle', - forbidClick: false, - loadingType: 'circular', - selector: '#van-toast', -}; -let queue = []; -let currentOptions = Object.assign({}, defaultOptions); -function parseOptions(message) { - return isObj(message) ? message : { message }; -} -function getContext() { - const pages = getCurrentPages(); - return pages[pages.length - 1]; -} -function Toast(toastOptions) { - const options = Object.assign( - Object.assign({}, currentOptions), - parseOptions(toastOptions) - ); - const context = options.context || getContext(); - const toast = context.selectComponent(options.selector); - if (!toast) { - console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确'); - return; - } - delete options.context; - delete options.selector; - toast.clear = () => { - toast.setData({ show: false }); - if (options.onClose) { - options.onClose(); - } - }; - queue.push(toast); - toast.setData(options); - clearTimeout(toast.timer); - if (options.duration != null && options.duration > 0) { - toast.timer = setTimeout(() => { - toast.clear(); - queue = queue.filter((item) => item !== toast); - }, options.duration); - } - return toast; -} -const createMethod = (type) => (options) => - Toast(Object.assign({ type }, parseOptions(options))); -Toast.loading = createMethod('loading'); -Toast.success = createMethod('success'); -Toast.fail = createMethod('fail'); -Toast.clear = () => { - queue.forEach((toast) => { - toast.clear(); - }); - queue = []; -}; -Toast.setDefaultOptions = (options) => { - Object.assign(currentOptions, options); -}; -Toast.resetDefaultOptions = () => { - currentOptions = Object.assign({}, defaultOptions); -}; -export default Toast; diff --git a/pages/home/user-info/index.js b/pages/home/user-info/index.js index 1604fa8..6fb7a92 100644 --- a/pages/home/user-info/index.js +++ b/pages/home/user-info/index.js @@ -8,7 +8,6 @@ const storage = require('../../../utils/storage') const app = getApp() Scene({ - /** * 页面的初始数据 */ @@ -62,7 +61,6 @@ Scene({ makeCall: function() { wx.makePhoneCall({ phoneNumber: '020-82516486' }) }, - loginOut: function () { Dialog.confirm({ title: '温馨提示', message: '确定退出纸通宝账号?' }).then(() => { storage.remove('Authorization') diff --git a/utils/util.js b/utils/util.js index 6586ca7..cf713c5 100644 --- a/utils/util.js +++ b/utils/util.js @@ -69,10 +69,7 @@ function showToast(content) { if (isEmpty(content)) { return } - wx.showToast({ - title: content, - icon: 'none' - }) + wx.showToast({ title: content, icon: 'none' }) } function extend(obj) {