common.js 1001 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. export default {
  2. methods: {
  3. navigateBack(num = 1) {
  4. uni.navigateBack({
  5. delta: num
  6. });
  7. },
  8. sendCode(phone) {
  9. // this.$http
  10. // .get('', {
  11. // phone: phone
  12. // })
  13. // .then(() => {
  14. this.checkTime();
  15. // })
  16. // .catch(e => {
  17. // this.$message.error(e.error);
  18. // });
  19. },
  20. navigateTo(url) {
  21. uni.navigateTo({
  22. url: url
  23. });
  24. },
  25. toast(title, icon = 'none', duration = 1500) {
  26. uni.showToast({
  27. icon: icon,
  28. title: title,
  29. mask: true,
  30. duration: duration
  31. });
  32. },
  33. preview(img, urls = []) {
  34. if (!img) {
  35. return;
  36. }
  37. if (urls.length === 0) {
  38. urls = [img];
  39. }
  40. uni.previewImage({
  41. current: img, // 当前显示图片的http链接
  42. urls: urls // 需要预览的图片http链接列表
  43. });
  44. },
  45. checkTime() {
  46. this.time = 60;
  47. let i = setInterval(() => {
  48. this.time--;
  49. if (this.time === 0) {
  50. clearInterval(i);
  51. }
  52. }, 1000);
  53. },
  54. }
  55. }