tnblog
首页
视频
资源
登录

uin框架搭建

4067人阅读 2022/3/9 19:11 总访问:69562 评论:0 收藏:0 手机
分类: uinapp

app.vue中创建

  1.     .main_content {
  2. position: absolute;top0;right0;bottom0;left0;overflow: hidden;
  3. display: flex;flex-direction: column;align-items: center;
  4. navbar {position: relative;width100%;flex-grow0;flex-shrink0;}
  5. container {position: relative;width100%;flex-grow:1;display: flex;}
  6. .card {
  7. margin-top25rpx;background-color#fff;border-radius10rpx;
  8. &:first-child {margin-top0;}
  9. >.title {
  10. display: flex;padding24rpx 24rpx 0;height65rpx;line-height45rpx;
  11. justify-content: space-between;
  12. text {font-size32rpx;font-weight: bold;color#333333;}
  13. navigator {color#999999;font-size24rpx;}
  14. }
  15. }
  16. .tab_box {
  17. width100%;
  18. &.fixed {
  19. position: fixed;top402rpx;z-index999;box-shadow0 0 3rpx rgba(0, 0, 0, .16);
  20. +.content_box {
  21. margin-top120rpx;
  22. }
  23. }
  24. }
  25. .tabs {
  26. position: relative;width100%;margin-top16rpx;padding-bottom20rpx;height120rpx;
  27. line-height120rpx;background-color#fff;justify-content: flex-start;white-space: nowrap;
  28. .tab {
  29. display: inline-block;padding0 30rpx;color#999999;font-size32rpx;
  30. &.active {
  31. color#333333;
  32. }
  33. }
  34. .hr {
  35. position: absolute;bottom0;height8rpx;transition: all .5s;
  36. &:after {
  37. content"";position: absolute;left50%;width64rpx;
  38. height8rpx;background-color#3FACFF;border-radius4rpx;
  39. transformtranslateX(-50%);
  40. }
  41. }
  42. }
  43. }
  44. /* 搜索 */
  45. .search-box{
  46. padding30rpx 0 30rpx 30rpx;width720rpx;position: relative;z-index1;
  47. .box{
  48. padding0 0rpx 0 30rpx;display: flex;align-items: center;
  49. height68rpx;background#ffffff;border2rpx solid #ec8d77;border-radius36rpx;
  50. .input{flex1;font-size26rpx;color#333333;padding-right30rpx;}
  51. .search-btn{
  52. width80rpx;height100%;display: flex;align-items: center;justify-content: center;
  53. }
  54. }
  55. }
  56. /* 底部 */
  57. .footer {
  58. display: flex;justify-content: space-between;align-content: center;
  59. width100%;height118rpx;background#FFFFFF;
  60. border-top1px solid #EEEEEE;align-items: center;
  61. padding-bottomconstant(safe-area-inset-bottom);
  62. /* 兼容 iOS < 11.2 */
  63. padding-bottomenv(safe-area-inset-bottom);
  64. /* 兼容 iOS >= 11.2 */
  65. .btns {
  66. flex-grow1;display: flex;padding0 20rpx;
  67. .btn {
  68. flex-grow1;margin0 20rpx;height68rpx;
  69. backgroundlinear-gradient(270deg, #70E6EB 0%, #54CDD2 100%);
  70. border-radius34rpx;font-size32rpx;color#FFFFFF;line-height68rpx;
  71. &:after {display: none;}
  72. &~.btn {
  73. border1rpx solid #54CDD2;color#54CDD2;line-height64rpx;background#ffffff;
  74. }
  75. }
  76. }
  77. }
  78. .uni-popup__wrapper-box {padding-bottom0 !important;}
  79. @keyframes rightin {
  80. 0% {transformtranslateX(100%)}
  81. 100% {transformtranslateX(0)}
  82. }
  83. @keyframes rightout {
  84. 0% {transformtranslateX(0)}
  85. 100% {transformtranslateX(100%)}
  86. }
  1. uni.getSystemInfo({
  2.     successfunction(res{
  3.        console.log('mobile:' + res.model)
  4.     that.globalData.statusBarHeight = res.statusBarHeight
  5.     that.globalData.screenWidth = res.screenWidth
  6. }
  7. })
  8. that.globalData.buttonInfo = {bottom80,height32,left281,right368,top10,width87}
  9. //#ifdef MP-WEIXIN
  10.     that.globalData.buttonInfo = wx.getMenuButtonBoundingClientRect();
  11. //#endif

main.js创建

  1. import Vue from 'vue'
  2. import App from './App'
  3. import http from './common/axios.js' //请求封装
  4. import api from './common/api.js'  //接口处理
  5. import json from './common/json.js'  //测试数据
  6. import util from './common/util.js'  //常用工具
  7. import {config} from './common/config.js'  //常用工具
  8. import jweixin from 'jweixin-module' //微信SDK
  9. Vue.config.productionTip = false
  10. App.mpType = 'app'
  11. const msg = (title, duration=1500, mask=false, icon='none')=>{
  12. //统一提示方便全局修改
  13. if(Boolean(title) === false){ return; }
  14. uni.showToast({title,duration, mask,  icon});
  15. }
  16. const app = new Vue({
  17.   ...App
  18. })
  19. app.$mount()
  20. Vue.prototype.$msg = msg;  //提交框
  21. Vue.prototype.$json = json;  //测试josn格式
  22. Vue.prototype.$api = api;  //api管理
  23. Vue.prototype.$util = util;  //工具类
  24. Vue.prototype.$config= config;  //配置文件
  25. Vue.prototype.$wx= jweixin;  //配置文件
  26. Vue.prototype.goview = (path)=>{  //跳转页面
  27. let urls = ['/pages/index/index','/pages/index/artificer','/pages/index/order','/pages/index/user',];
  28. if(urls.includes(path)){
  29. uni.switchTab({url:path})
  30. }else{
  31. uni.navigateTo({url:path})
  32. }
  33. }
  34. Vue.prototype.gobanner = (item)=>{  //跳转页面
  35. if(item.jump_url){
  36. uni.navigateTo({url:item.jump_url})
  37. }
  38. }
  39. Vue.prototype.islogin = (path)=>{  //跳转页面
  40. if(uni.getStorageSync('token')){
  41. util.zdyopt.islogin().then((res)=>{
  42. uni.navigateTo({url:path})
  43. }).catch(()=>{
  44. uni.navigateTo({url:'/pages/login/login'})
  45. })
  46. }else{
  47. uni.navigateTo({url:'/pages/login/login'})
  48. }
  49. }
  50. Vue.prototype.print = (obj,type) => {  //提示文字
  51.  type = type || 'log';
  52.  const log = JSON.parse(JSON.stringify(obj));
  53.  console[type](log)
  54. }


评价
走投无路 才选择了程序员
排名
40
文章
11
粉丝
3
评论
0
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术