123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- export function cardType(index, card) {
- let type = index
- switch (card.status) {
- case 1:
- type = 5
- break
- case 2:
- type = 4
- break
- }
- return type
- }
- export function navigateTo(url, query) {
- console.log('进入页面跳转事件')
- if (query && Object.keys(query).length != 0) {
- url += '?'
- for (let i in query) {
- url += i
- url += '='
- url += query[i]
- url += '&'
- }
- }
- console.log(url, 'url')
- wx.navigateTo({
- url: url,
- })
- }
- export function redirectTo(url, query) {
- console.log('进入页面跳转事件')
- if (query && Object.keys(query).length != 0) {
- url += '?'
- for (let i in query) {
- url += i
- url += '='
- url += query[i]
- url += '&'
- }
- }
- console.log(url, 'url')
- wx.redirectTo({
- url: url,
- })
- }
- // 回显数据字典
- export function selectDictLabel(datas, value) {
- var actions = []
- Object.keys(datas).some(key => {
- if (datas[key].value == '' + value) {
- actions.push(datas[key].label)
- return true
- }
- })
- return actions.join('')
- }
- // 时间戳转时分秒
- export const formatSeconds = value => {
- if (value === 0 || value < 1000) return '00:00:00'
- var timestamp = parseInt(value) / 1000 // 毫秒转秒
- // 小时取余数
- const remainder = timestamp % 3600
- // 时、分、秒
- let hour, minute, second
- if (remainder === 0) {
- // 整除 小时
- hour = parseInt(timestamp / 3600)
- } else {
- hour = parseInt(timestamp / 3600)
- let remainderMinute = remainder % 60
- if (remainderMinute === 0) {
- // 整除 分钟
- minute = parseInt(remainder / 60)
- } else {
- minute = parseInt(remainder / 60)
- second = parseInt(remainderMinute)
- }
- }
- let text = ''
- if (hour > 0) {
- if (hour < 10) {
- text += '0'
- }
- text += hour + ':'
- } else {
- text += '00' + ':'
- }
- if (minute > 0) {
- if (minute < 10) {
- text += '0'
- }
- text += minute + ':'
- } else {
- text += '00' + ':'
- }
- if (second > 0) {
- if (second < 10) {
- text += '0'
- }
- text += second
- } else {
- text += '00'
- }
- return text
- }
|