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

2
nxTemp/config/requestConfig.js

@ -34,7 +34,7 @@ $http.requestStart = function(options) {
console.error(options.url,"缺少token,触发重新登录",options); console.error(options.url,"缺少token,触发重新登录",options);
} else { } else {
options.header['token'] = token; //header中带上token 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, "easycom": { //easycom,
"autoscan": true, "autoscan": true,
"custom": { "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", "^uni-(.*)": "@/components/uni-$1/uni-$1.vue",
"^nx-(.*)": "@/components/nx-$1/nx-$1.vue" "^nx-(.*)": "@/components/nx-$1/nx-$1.vue"
} }

40
pages/event/event_list.vue

@ -7,7 +7,7 @@
</view> --> </view> -->
<!-- item --> <!-- 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"> <view class="time flex_row">
<image src="../../static/images/event/event_lock.png" mode=""></image> <image src="../../static/images/event/event_lock.png" mode=""></image>
@ -39,24 +39,54 @@
</view> </view>
</template> </template>
<script> <script>
import {matchList} from "../../nxTemp/apis/userAPI.js"
export default { export default {
data() { data() {
return { return {
title:"默认块级元素默认块级元素默认块级元素", title:"默认块级元素默认块级元素默认块级元素",
address:"广州省广州市区白云区广州省广州市区白云区永泰广州省广州市区白云区广州省广州市区白云区永泰", address:"广州省广州市区白云区广州省广州市区白云区永泰广州省广州市区白云区广州省广州市区白云区永泰",
login:true
postData:{
page:1,
page_size:10,
token:123
},
pageList:[]
}; };
}, },
onLoad(parms) {
onLoad(opt) {
this.updatePage()
}, },
onUnload() { onUnload() {
this.resetPostData()
}, },
methods: { methods: {
jumpPage(name){ jumpPage(name){
this.$Router.push({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> </script>

2
pages/index/index.vue

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

4
pages/public/404.vue

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

2
static/style/base.scss

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

2
uni.scss

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

Loading…
Cancel
Save