Browse Source

上传

master
前端-胡立永 5 months ago
parent
commit
27b04a4847
5 changed files with 247 additions and 14 deletions
  1. +64
    -0
      mixins/list.js
  2. +3
    -0
      pages.json
  3. +129
    -0
      pages_order/mine/help.vue
  4. BIN
      pages_order/static/help/uploading.png
  5. +51
    -14
      utils/utils.js

+ 64
- 0
mixins/list.js View File

@ -0,0 +1,64 @@
function query(self, queryParams){
// return (self.beforeGetData && self.beforeGetData()) ||
// queryParams || self.queryParams
// 深度合并对象
return self.$utils.deepMergeObject(
self.$utils.deepMergeObject(self.queryParams,
(self.beforeGetData && self.beforeGetData()) || {}),
queryParams)
}
export default {
data() {
return {
queryParams: {
pageNo: 1,
pageSize: 10,
},
total : 0,
list : [],
}
},
onReachBottom() {
this.loadMoreData()
},
methods: {
getData(queryParams){
return new Promise((success, error) => {
if(!this.mixinsListApi){
return console.error('mixinsListApi 缺失');
}
this.$api(this.mixinsListApi,
query(this, queryParams), res => {
uni.stopPullDownRefresh()
if(res.code == 200){
this.getDataThen && this.getDataThen(res.result.records, res.result.total, res.result)
success(res.result)
this[this.mixinsListKey || 'list'] = res.result.records
this.total = res.result.total
}
})
})
},
loadMoreData(){
console.log('loadMoreData----', this.queryParams.pageSize < this.total);
if(this.queryParams.pageSize < this.total){
this.queryParams.pageSize += 10
this.getData()
}
},
}
}

+ 3
- 0
pages.json View File

@ -64,6 +64,9 @@
},
{
"path": "auth/loginAndRegisterAndForgetPassword"
},
{
"path": "mine/help"
}
]
}],


+ 129
- 0
pages_order/mine/help.vue View File

@ -0,0 +1,129 @@
<template>
<!-- 帮助与反馈 -->
<view class="help">
<navbar title="帮助与反馈" leftClick @leftClick="$utils.navigateBack" />
<view class="help-box">
<view>
<view class="help-issue">
<text>问题和意见</text>
<text style="color: #BD3624;">*</text>
</view>
<uv-textarea v-model="value" :count="true" border="none" height="400"
placeholder="请把发现的问题提交给我们,感谢您的参与(必填)"
:text-style="{color:'#BCB7B7',fontSize:'28rpx'}" />
</view>
<view>
<view class="help-issue">
<text>问题截图</text>
<text style="color: #BD3624;">*</text>
</view>
<view class="help-screenshot">
<uv-upload :fileList="fileList" multiple :maxCount="3" width="180rpx"
height="180rpx" multiple @afterRead="afterRead" @delete="deleteImage">
<image src="../static/help/uploading.png" mode="aspectFill"
style="width: 180rpx;height: 180rpx;" />
</uv-upload>
</view>
</view>
<!-- <view>
<view class="help-issue">
<text>联系方式</text>
<text style="color: #BD3624;">*</text>
</view>
<uv-input placeholder="请输入联系方式" fontSize="24rpx" border="bottom"
:custom-style="{backgroundColor: '#fff'}">
<template #prefix>
<uv-text text="联系姓名" size="24rpx" margin="20rpx 10rpx 20rpx 10rpx" />
</template>
</uv-input>
<uv-input placeholder="请输入联系姓名" border="none" fontSize="24rpx"
:custom-style="{backgroundColor: '#fff'}">
<template #prefix>
<uv-text text="联系方式" size="24rpx" margin="20rpx 10rpx 20rpx 10rpx" />
</template>
</uv-input>
</view> -->
<view class="help-button">
<view>确认</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
value: "",
fileList: []
}
},
onLoad(args) {
},
methods: {
deleteImage(e){
this.fileList.splice(e.index, 1)
},
afterRead(e){
let self = this
e.file.forEach(file => {
self.$Oss.ossUpload(file.url).then(url => {
self.fileList.push({
url
})
})
})
},
}
}
</script>
<style scoped lang="scss">
.help {
.help-box {
width: 92%;
margin-left: 4%;
.help-issue {
margin: 20rpx;
font-size: 28rpx;
font-weight: 600;
color: #333333;
}
.help-screenshot {
display: flex;
align-items: center;
background-color: #fff;
padding: 20rpx;
}
.help-button {
display: flex;
justify-content: center;
font-size: 24rpx;
flex-shrink: 0;
margin-top: 60rpx;
view {
padding: 14rpx 120rpx;
border-radius: 38rpx;
}
view:nth-child(1) {
background: $uni-color;
color: #fff;
}
view:nth-child(2) {
color: #FFFDF6;
background-color: #C83741;
}
}
}
}
</style>

BIN
pages_order/static/help/uploading.png View File

Before After
Width: 216  |  Height: 216  |  Size: 7.2 KiB

+ 51
- 14
utils/utils.js View File

@ -36,33 +36,56 @@ function generateLightRandomColor() {
function verificationAll(data, msg){
let Msgs = {
default : msg || '表单数据未填写'
}
if(typeof msg == 'object'){
Msgs = {
default : '表单数据未填写',
...msg,
}
if (!msg){
console.log(msg);
return false
}
if (!data){
uni.showToast({
title: Msgs.default,
title: '表单数据未填写',
icon: "none"
})
return true
}
for (let key in data) {
if (!data[key] || data[key] === "") {
for (let key in msg) {
if (!data[key]) {
uni.showToast({
title: (Msgs[key] || Msgs.default),
title: msg[key],
icon: "none"
})
return true
}
}
// let Msgs = {
// default : msg || '表单数据未填写'
// }
// if(typeof msg == 'object'){
// Msgs = {
// default : '表单数据未填写',
// ...msg,
// }
// }
// if (!data){
// uni.showToast({
// title: Msgs.default,
// icon: "none"
// })
// return true
// }
// for (let key in data) {
// if (!data[key] || data[key] === "") {
// uni.showToast({
// title: (Msgs[key] || Msgs.default),
// icon: "none"
// })
// return true
// }
// }
return false
}
@ -108,6 +131,19 @@ export function deepMergeObject(a, b){
return mergeObject(data, b)
}
//复制内容
export function copyText(content) {
uni.setClipboardData({
data: content,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'none'
})
}
})
}
function params(url){
if(typeof url == 'object'){
return url
@ -149,4 +185,5 @@ export default {
navigateTo,
navigateBack,
redirectTo,
copyText
}

Loading…
Cancel
Save