Browse Source

优化逻辑&去除uview以缩小程序体积

master
zmt 3 years ago
parent
commit
fe10b6ea58
  1. 4
      main.js
  2. 2
      nxTemp/config/requestConfig.js
  3. 2
      pages.json
  4. 44
      pages/event/event_list.vue
  5. 2
      pages/index/index.vue
  6. 4
      pages/public/404.vue
  7. 2
      static/style/base.scss
  8. 2
      uni.scss

4
main.js

@ -5,7 +5,7 @@ import {
RouterMount
} from "@/nxTemp/router";
import store from "@/nxTemp/store";
import uView from "@/uview-ui";
// import uView from "@/uview-ui";
import nxTemp from "@/nxTemp";
@ -14,7 +14,7 @@ async function bootstrap() {
//引入路由
Vue.use(router);
// 引入全局uView
Vue.use(uView);
// Vue.use(uView);
// 加载nxTemp
Vue.use(nxTemp);

2
nxTemp/config/requestConfig.js

@ -34,7 +34,7 @@ $http.requestStart = function(options) {
console.error(options.url,"缺少token,触发重新登录",options);
} else {
options.header['token'] = token; //header中带上token
options.data['token'] = token; //请求data中带上token
if(!options.data.token)options.data['token'] = token; //请求data中带上token,兼容自带token参数
}
}
}

2
pages.json

@ -2,7 +2,7 @@
"easycom": { //easycom,
"autoscan": true,
"custom": {
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue",
// "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue",
"^uni-(.*)": "@/components/uni-$1/uni-$1.vue",
"^nx-(.*)": "@/components/nx-$1/nx-$1.vue"
}

44
pages/event/event_list.vue

@ -7,7 +7,7 @@
</view> -->
<!-- item -->
<view class="item flex_col flex_start_y bg-white padding " v-for="i in 3" @click="jumpPage('eventGrade')">
<view class="item flex_col flex_start_y bg-white padding " v-for="(i,k) in pageList.list" :key="k" @click="jumpPage('eventGrade')">
<view class="time flex_row">
<image src="../../static/images/event/event_lock.png" mode=""></image>
@ -38,25 +38,55 @@
</view>
</template>
<script>
<script>
import {matchList} from "../../nxTemp/apis/userAPI.js"
export default {
data() {
return {
title:"默认块级元素默认块级元素默认块级元素",
address:"广州省广州市区白云区广州省广州市区白云区永泰广州省广州市区白云区广州省广州市区白云区永泰",
login:true
postData:{
page:1,
page_size:10,
token:123
},
pageList:[]
};
},
onLoad(parms) {
onLoad(opt) {
this.updatePage()
},
onUnload() {
this.resetPostData()
},
methods: {
jumpPage(name){
this.$Router.push({name})
},
},
//
updatePage() {
matchList(this.postData).then(res => {
this.$tools.showNone("已更新");
this.pageList.push(res)
this.postData.page++
}).catch(e=>{
this.$tools.showNone(e.errMsg)
})
},
//
getFilteredItem(item){
return Promise.resolve({}=item)
},
//
resetPostData(){
this.postData = {
page:1,
page_size:10
}
},
}
}
</script>

2
pages/index/index.vue

@ -44,7 +44,7 @@
...mapState(['userInfo']),
...mapGetters(['hasLogin']),
},
onLoad(parms) {
onLoad(opt) {
},
onUnload() {

4
pages/public/404.vue

@ -1,11 +1,11 @@
<template>
<u-empty mode="page">
<!-- <u-empty mode="page">
<u-button slot="bottom" size="medium" @click="$Router.pushTab('/pages/tabbar/home')">
去首页
</u-button>
</u-empty>
</u-empty> -->
</template>
<script></script>

2
static/style/base.scss

@ -8,7 +8,7 @@
@import "static/colorui/main.css";
@import "static/colorui/icon.css";
/*uview-ui css */
@import "uview-ui/index.scss";
// @import "uview-ui/index.scss";
page {
min-height: 100%;

2
uni.scss

@ -11,7 +11,7 @@
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
@import 'uview-ui/theme.scss';
// @import 'uview-ui/theme.scss';
/* 颜色变量 */
/* 行为相关颜色 */

Loading…
Cancel
Save