19 changed files with 492 additions and 316 deletions
-
12common/api.js
-
32common/mixin.js
-
77common/uploadFile.js
-
4main.js
-
12pages.json
-
32pages/about/buy_agree.vue
-
32pages/about/register_agree.vue
-
36pages/collect/index.vue
-
4pages/goodsDetail/index.vue
-
2pages/index/index.vue
-
20pages/login/index.vue
-
31pages/message/index.vue
-
10pages/notice/notice.vue
-
85pages/order/apply_refund.vue
-
98pages/order/order.vue
-
67pages/order/order_details.vue
-
162pages/order/refund_detail.vue
-
45pages/order/unpay_details.vue
-
47pages/user/user.vue
@ -0,0 +1,77 @@ |
|||
/* |
|||
*上传文件 |
|||
*@param - filePath :图片的本地资源路径 |
|||
*@param - dir:表示要传到哪个目录下 |
|||
*@param - successc:成功回调 |
|||
*@param - failc:失败回调 |
|||
*/ |
|||
const uploadFile = function (filePath, successc, failc) { |
|||
if (!filePath || filePath.length < 9) { |
|||
wx.showModal({ |
|||
title: '图片错误', |
|||
content: '请重试', |
|||
showCancel: false, |
|||
}) |
|||
return; |
|||
} |
|||
|
|||
// 上传的服务器地址
|
|||
let url = this.API.DEVURL; |
|||
if (this.API.DEV == 'prod') { |
|||
url = this.API.PRODURL; |
|||
} |
|||
const url_a = this.API.API_UPPLOAD_APPLY; |
|||
|
|||
// 上传图片的目录
|
|||
var nowTime = formatTime(new Date()); |
|||
const dir = 'wxmini/images/' + nowTime + '/'; |
|||
|
|||
// 获取上传的文件类型 fileType
|
|||
let fileTypeIndex = filePath.lastIndexOf('.'); |
|||
let fileType = filePath.substring(fileTypeIndex); |
|||
|
|||
console.log('上传方法的图片',filePath) |
|||
|
|||
uni.uploadFile({ |
|||
url: url + url_a,//开发者服务器 url
|
|||
filePath: filePath,//要上传文件资源的路径
|
|||
name: 'image', |
|||
header: { |
|||
appid: 'wx0e8ebcd9ca9e4b97', |
|||
Authentication: uni.getStorageSync('userinfo').token |
|||
}, |
|||
|
|||
success: function (res) { |
|||
console.log('上传文件...', res) |
|||
if (res.statusCode != 200 || !res.data) { |
|||
failc(new Error('上传错误:' + JSON.stringify(res))) |
|||
return; |
|||
} |
|||
let res_data = JSON.parse(res.data); |
|||
successc && successc(res_data.data); |
|||
}, |
|||
fail: function (err) { |
|||
failc(err); |
|||
}, |
|||
}) |
|||
} |
|||
|
|||
// 获取当前日期(年-月-日),并不足十位补零
|
|||
function formatTime(date) { |
|||
const year = date.getFullYear() |
|||
const month = date.getMonth() + 1 |
|||
const day = date.getDate() |
|||
const hour = date.getHours() |
|||
const minute = date.getMinutes() |
|||
const second = date.getSeconds() |
|||
return [year, month, day].map(formatNumber).join('-') |
|||
// + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
|||
} |
|||
const formatNumber = n => { |
|||
n = n.toString() |
|||
return n[1] ? n : '0' + n |
|||
} |
|||
|
|||
module.exports = { |
|||
uploadFile |
|||
}; |
|||
@ -0,0 +1,32 @@ |
|||
<template> |
|||
<view> |
|||
<rich-text :nodes="content" v-if="$isRight(content)"></rich-text> |
|||
<lf-nocontent v-else></lf-nocontent> |
|||
<!-- 回到顶部 --> |
|||
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data(){ |
|||
return { |
|||
content: '' |
|||
} |
|||
}, |
|||
onLoad(){ |
|||
this.getData(); |
|||
}, |
|||
methods: { |
|||
getData(){ |
|||
this.$http(this.API.API_BUYAGREE).then(res => { |
|||
this.content = res.data?.buy_protocol; |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped="scoped"> |
|||
|
|||
</style> |
|||
@ -0,0 +1,32 @@ |
|||
<template> |
|||
<view> |
|||
<rich-text :nodes="content" v-if="$isRight(content)"></rich-text> |
|||
<lf-nocontent v-else></lf-nocontent> |
|||
<!-- 回到顶部 --> |
|||
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data(){ |
|||
return { |
|||
content: '' |
|||
} |
|||
}, |
|||
onLoad(){ |
|||
this.getData(); |
|||
}, |
|||
methods: { |
|||
getData(){ |
|||
this.$http(this.API.API_REGISTERAGREE).then(res => { |
|||
this.content = res.data?.reg_protocol; |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped="scoped"> |
|||
|
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue