1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- /**
- * Created by JianJia.Zhou<jianjia.zhou> on 2022/5/26.
- */
- export function copyText(text, tips) {
- uni.setClipboardData({
- data: text,
- success: function() {
- uni.hideLoading()
- uni.showToast({
- title: tips || '复制成功',
- icon: 'none'
- })
- }
- })
- }
- export function checkOS() {
- if (uni.getSystemInfoSync().platform === 'ios') {
- uni.showModal({
- title: '提示',
- content: '由于相关规范,iOS功能暂不可用',
- showCancel: false,
- success: function(res) {
- // res.confirm res.cancel
- }
- })
- return false
- }
- return true
- }
- const shareMessage = user => {
- // #ifdef MP-KUAISHOU
- const title ="四海剧场"
- // #endif
- // #ifdef MP-TOUTIAO | MP-WEIXIN
- const title ="张四爷剧场"
- // #endif
- console.log('-->data', user)
- return {
- path: `/pages/index/index?user_id=${user.id}`,
- title: title,
- desc: title
- // imageUrl: ''
- }
- }
- const tranNumber = (num, point = 2) => {
- let numStr = parseFloat(num).toString()
- // 万以内直接返回
- if (numStr.length < 5) {
- return numStr;
- }
- //大于6位数是百万
- else if (numStr.length > 6) {
- let decimal = numStr.substring(numStr.length - 5, numStr.length - 5 + point);
- return parseFloat(parseInt(num / 100000) + '.' + decimal) + 'M';
- }
- //大于5位数是万 (以1W分割 1W以下全部显示)
- else if (numStr.length > 4) {
- let decimal = numStr.substring(numStr.length - 4, numStr.length - 4 + point)
- return parseFloat(parseInt(num / 1000) + '.' + decimal) + 'K';
- }
- }
- export default {
- copyText,
- checkOS,
- shareMessage,
- tranNumber
- }
|