123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /**
- * 显示消息提示框
- * @param content 提示的标题
- */
- export function toast(content) {
- uni.showToast({
- icon: 'none',
- title: content
- })
- }
- /**
- * 显示模态弹窗
- * @param content 提示的标题
- */
- export function showConfirm(content) {
- return new Promise((resolve, reject) => {
- uni.showModal({
- title: '提示',
- content: content,
- cancelText: '取消',
- confirmText: '确定',
- success: function(res) {
- resolve(res)
- }
- })
- })
- }
- /**
- * 参数处理
- * @param params 参数
- */
- export function tansParams(params) {
- let result = ''
- // FIXME 拼接参数
- return result
- }
- export function getStaticUrl(url) {
- let result = '';
- // #ifdef H5
- result = `/mdist/${url}`
- // #endif
- // #ifdef APP-PLUS
- result = url
- // #endif
- return result;
- }
- /************* 将时间格式化成 年月+日 ***********/
- export function formatDateToYearMonthDay(dateStr) {
- let date = new Date(dateStr.replace(/-/g, '/'));
- let dataStr1 = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`
- const yearMonth = dataStr1.substring(0, 7); // "2025-06"
- const day = dataStr1.substring(8); // "01"
- return [yearMonth, day]
- }
- export function getStringByHtml3(html) {
- return html ? html.replace(/<img [^.]*">/g, '')
- .replace(/<(style|script|iframe)[^>]*?>[\s\S]+?<\/\1\s*>/gi, '')
- .replace(/<[^>]+?>/g, '')
- .replace(/\s+/g, ' ')
- .replace(/ /g, ' ')
- .replace(/>/g, ' ')
- .replace(/<?img[^>]*>/g, '')
- .replace(/<video[^>]*>.*?<\/video>/gi, '') : '';
- }
|