Commit f0b3b6f9 authored by Facius's avatar Facius

Merge branch 'dev-v1.0.0' of https://git.banshouhui.com/wuzhenzhe/study into dev-v1.0.0

parents 3961650c 3bebeef0
let commonApiFun = function(vm) {
let loginWechatAuth = async (params = {}) => await vm.$u.post('/wxapp/unify/authorization', params)
const globalUrl = process.uniEnv || {}
let ucenterApiUrl = globalUrl.uUrl
let loginWechatAuth = async (params = {}) =>
await vm.$u.post('/wxapp/unify/authorization', params)
let payOrder = async (params = {}) => await vm.$u.post('/pay/order', params)
let payQuery = async (params = {}) => await vm.$u.get('/pay/query', params)
let getQiNiuToken = async (params = {}) => await vm.$u.post(ucenterApiUrl + 'v1/tokens', params)
let getQiNiuToken = async (params = {}) =>
await vm.$u.post(ucenterApiUrl + 'v1/tokens', params)
const commonApi = {
loginWechatAuth,
payOrder,
......
......@@ -7,7 +7,19 @@ function hasPermissionOfCamera() {
r(true)
},
fail: function() {
j(false)
uni.showModal({
content: '拒绝授权将无法进行拍照和上传图片,是否去设置打开?',
confirmText: '确认',
cancelText: '取消',
success(res) {
if (res.confirm) {
openSetting()
}
},
fail() {
j(false)
},
})
},
complete: function() {
console.log('done!')
......@@ -16,12 +28,21 @@ function hasPermissionOfCamera() {
})
}
function openSetting() {
// 打开设置
wx.openSetting({
success(res) {
console.log(res)
},
})
}
//吊起设备原生相机相册取得文件,并自动上传七牛,返回七牛key,domain,本地file信息
function getPhoto(type, token) {
return new Promise((resolve, reject) => {
hasPermissionOfCamera().then((r) => {
if (!r) {
console.warn('调用相机失败')
reject(false)
}
})
let sourceType = type == 1 ? ['album'] : ['album', 'camera']
......
......@@ -109,7 +109,7 @@ export default {
if (data.errMsg == 'request:ok') {
this.token = data.data.token //token为七牛云的token一般由后台接口提供
} else {
console.log('get token error')
console.log('get token error', data)
}
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment