Browse Source

修复bug

master
longjieli 11 months ago
parent
commit
d1cc257697
10 changed files with 79 additions and 267 deletions
  1. +5
    -0
      App.vue
  2. +3
    -141
      components/base/navbar.vue
  3. +1
    -4
      config.js
  4. +7
    -3
      manifest.json
  5. +41
    -16
      pages.json
  6. +0
    -39
      pages/index/index.vue
  7. +0
    -22
      pages/map/map.vue
  8. +2
    -2
      utils/index.js
  9. +0
    -39
      utils/upload.js
  10. +20
    -1
      utils/utils.js

+ 5
- 0
App.vue View File

@ -1,15 +1,20 @@
<script> <script>
export default { export default {
onLaunch: function() { onLaunch: function() {
}, },
onShow: function() { onShow: function() {
// this.$store.commit('initConfig') // this.$store.commit('initConfig')
}, },
onHide: function() { onHide: function() {
} }
} }
</script> </script>
<style> <style>
/*每个页面公共css */ /*每个页面公共css */
.reserveSpace {
padding-top: var(--status-bar-height);
}
</style> </style>

+ 3
- 141
components/base/navbar.vue View File

@ -1,37 +1,6 @@
<template> <template>
<view class="navbar"> <view class="navbar">
<view class="title">
<view class="left">
<uv-icon name="arrow-left"
v-if="leftClick"
@click="leftClick()"
color="#333" size="46rpx"></uv-icon>
</view>
<view>{{ title }}</view>
<view class="icon">
<uv-icon name="search"
v-if="isSearch"
color="#333" size="58rpx"></uv-icon>
<uv-icon name="plus-circle" color="#333"
v-if="isPlus"
@click="plusCircleShow = true"
size="46rpx" style="margin-left: 30rpx;"></uv-icon>
<view v-if="moreClick" style="margin-left: 30rpx;">
<uv-icon name="more-dot-fill" color="#333"
v-if="!moreText"
@click="moreClick()"
size="46rpx"></uv-icon>
<view v-else @click="moreClick"
style="font-weight: 400;font-size: 30rpx;">
{{ moreText }}
</view>
</view>
</view>
</view>
<uv-navbar :title="title" @leftClick="leftClick" placeholder></uv-navbar>
</view> </view>
</template> </template>
@ -41,124 +10,17 @@
props : { props : {
title : { title : {
type : String, type : String,
default : ''
default : '参数'
}, },
leftClick : { leftClick : {
type : Function, type : Function,
},
moreClick : {
type : Function,
},
isSearch : {
type : Boolean,
default : false,
},
isPlus : {
type : Boolean,
default : false,
},
moreText : {
require : true
} }
},
created() {
},
beforeDestroy() {
},
data() {
return {
};
},
methods : {
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar{
width: 100%;
height: 100rpx;
.cover{
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
z-index: 9999999;
}
.plusCircle{
position: fixed;
top: calc(100rpx + var(--status-bar-height));
right: 10rpx;
background-color: rgb(76, 76, 76);
z-index: 99999999;
border-radius: 10rpx;
animation: fade-in .5s;
&::after{
content: '';
display: block;
position: absolute;
top: -34rpx;
right: 35rpx;
border-left: 20rpx solid transparent;
border-right: 20rpx solid transparent;
border-top: 20rpx solid transparent;
border-bottom: 20rpx solid rgb(76, 76, 76);
}
&>view{
display: flex;
color: #fff;
width: 300rpx;
height: 120rpx;
align-items: center;
border-bottom: 1px solid #ffffff22;
font-size: 30rpx;
.icon{
padding-left: 30rpx;
padding-right: 20rpx;
image{
width: 40rpx;
height: 40rpx;
}
}
}
}
}
.title{
position: fixed;
top: 0;
left: 0;
padding-top: var(--status-bar-height);
width: 100%;
height: 100rpx;
background-color: #f7f7f7;
display: flex;
justify-content: center;
font-size: 32rpx;
align-items: center;
z-index: 99999;
.left{
position: absolute;
left: 40rpx;
display: flex;
justify-content: flex-start;
}
.icon{
position: absolute;
right: 40rpx;
display: flex;
justify-content: flex-end;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
</style> </style>

+ 1
- 4
config.js View File

@ -4,7 +4,7 @@ import api from '@/api/api.js'
import utils from './utils/utils.js' import utils from './utils/utils.js'
import uvUI from '@/uni_modules/uv-ui-tools' import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI);
Vue.use(uvUI)
// 当前环境 // 当前环境
const type = 'dev' const type = 'dev'
@ -40,11 +40,8 @@ const defaultConfig = {
}, },
} }
uni.$uv.setConfig({ uni.$uv.setConfig({
// 修改$uv.config对象的属性
config: { config: {
// 修改默认单位为rpx,相当于执行 uni.$uv.config.unit = 'rpx'
unit: 'rpx' unit: 'rpx'
}, },
}) })


+ 7
- 3
manifest.json View File

@ -1,6 +1,6 @@
{ {
"name" : "unapp模板", "name" : "unapp模板",
"appid" : "__UNI__197A38F",
"appid" : "__UNI__F370613",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
@ -41,9 +41,13 @@
] ]
}, },
/* ios */ /* ios */
"ios" : {},
"ios" : {
"dSYMs" : false
},
/* SDK */ /* SDK */
"sdkConfigs" : {}
"sdkConfigs" : {
"ad" : {}
}
} }
}, },
/* */ /* */


+ 41
- 16
pages.json View File

@ -1,30 +1,55 @@
{ {
"easycom": {
"autoscan": true,
"custom": {
"^uv-(.*)": "@/uni_modules/uv-$1/components/uv-$1/uv-$1.vue"
}
},
"pages": [
"pages": [{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
}, {
"path": "pages/repair/repair",
"style": {
"navigationBarTitleText": "报修"
}
},
{ {
"path": "pages/index/index",
"path": "pages/repairList/repairList",
"style": { "style": {
"navigationBarTitleText": "unapp模板"
"navigationBarTitleText": "记录"
} }
}, },
{ {
"path" : "pages/map/map",
"style" :
{
"navigationBarTitleText" : ""
"path": "pages/reject/reject",
"style": {
"navigationBarTitleText": "驳回"
}
},
{
"path": "pages/finish/finish",
"style": {
"navigationBarTitleText": "结单"
} }
} }
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "unapp模板",
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#F8F8F8", "navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
"backgroundColor": "#F8F8F8",
"navigationStyle": "custom"
},
"tabBar": {
"backgroundColor": "white",
"selectedColor": "#3c9cff",
"list": [{
"selectedIconPath": "/static/bar/2.png",
"iconPath": "/static/bar/1.png",
"pagePath": "pages/repair/repair",
"text": "报修"
}, {
"selectedIconPath": "/static/bar/4.png",
"iconPath": "/static/bar/3.png",
"pagePath": "pages/repairList/repairList",
"text": "记录"
}]
}, },
"uniIdRouter": {} "uniIdRouter": {}
}
}

+ 0
- 39
pages/index/index.vue View File

@ -1,39 +0,0 @@
<template>
<view class="content">
<button @click="$refs.configPopup.open()">{{ locale.agreement }}</button>
<button @click="$refs.changeLanguage.open()">切换语言</button>
<button @click="$utils.navigateTo('/map/map')">地图</button>
<changeLanguage ref="changeLanguage"/>
<configPopup
keyValue="asd"
ref="configPopup"/>
</view>
</template>
<script>
export default {
data() {
return {
}
},
computed : {
locale(){
return this.$t('pages.index.index')
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
.content{
padding: 20px;
button{
margin-bottom: 10rpx;
}
}
</style>

+ 0
- 22
pages/map/map.vue View File

@ -1,22 +0,0 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

+ 2
- 2
utils/index.js View File

@ -18,11 +18,11 @@ Vue.prototype.$wxPay = wxPay
dayjs.locale('zh-cn') dayjs.locale('zh-cn')
import uploadFileToOSS from './upload.js'
import Oss from '@/utils/oss-upload/oss/index.js'
import { handleTree } from './tree.js' import { handleTree } from './tree.js'
Vue.prototype.$handleTree = handleTree Vue.prototype.$handleTree = handleTree
Vue.prototype.$uploadFileToOSS = uploadFileToOSS
Vue.prototype.$Oss = Oss
Vue.prototype.$dayjs = dayjs Vue.prototype.$dayjs = dayjs
Vue.prototype.$timeUtils = time Vue.prototype.$timeUtils = time


+ 0
- 39
utils/upload.js View File

@ -1,39 +0,0 @@
import OSS from "ali-oss"
import utils from './utils.js'
import config from '../config.js'
function uploadFileToOSS(file) {
uni.showLoading({
title: '上传中...'
});
return new Promise((resolve,reject) => {
// 创建OSS实例
const client = new OSS(config.aliOss.config);
// 设置文件名和文件目录
const suffix = '.' + file.name.split('.').pop();
const fileName = utils.generateUUID() + suffix; // 注意:文件名需要是唯一的
// 使用put接口上传文件
client.multipartUpload(fileName, file, {
headers: {
'Content-Disposition': 'inline',
'Content-Type': file.type
}
}).then(res => {
uni.hideLoading();
resolve(config.aliOss.url + res.name);
}).catch(err => {
uni.hideLoading();
reject(err)
})
})
}
export default uploadFileToOSS

+ 20
- 1
utils/utils.js View File

@ -120,6 +120,23 @@ export function navigateBack(num = -1){
uni.navigateBack(num) uni.navigateBack(num)
} }
//选择图片
export function chooseImage(callBack){
uni.chooseImage({
count: 5, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function(res) {
callBack && callBack(res)
}
});
}
//图片预览
export function previewImage(options){
uni.previewImage(options);
}
export default { export default {
toArray, toArray,
generateUUID, generateUUID,
@ -130,5 +147,7 @@ export default {
getHrefParams, getHrefParams,
deepMergeObject, deepMergeObject,
navigateTo, navigateTo,
navigateBack
navigateBack,
chooseImage,
previewImage
} }

Loading…
Cancel
Save