Commit d5c243ca authored by Damon's avatar Damon

Merge branch 'fix-photo' into dev-1.5.0

parents 72eccfed ff83edde
...@@ -158,7 +158,7 @@ export default { ...@@ -158,7 +158,7 @@ export default {
} }
} else { } else {
uni.showModal({ uni.showModal({
title: "登录失败", title: "登录失败,请重试",
content: "未获取到code", content: "未获取到code",
}); });
} }
......
...@@ -11,7 +11,6 @@ export default { ...@@ -11,7 +11,6 @@ export default {
const options = { const options = {
files: uploadTask, // 必填 临时文件路径 格式: [{path: "图片地址"}] files: uploadTask, // 必填 临时文件路径 格式: [{path: "图片地址"}]
load: false, //(默认 true 说明:本接口是否提示加载动画) load: false, //(默认 true 说明:本接口是否提示加载动画)
maxSize: 300000, //(默认 无 说明:上传的文件最大字节数限制,默认不限制)
onEachUpdate: res => { onEachUpdate: res => {
console.log("上传成功返回:",res); console.log("上传成功返回:",res);
}, },
...@@ -19,22 +18,29 @@ export default { ...@@ -19,22 +18,29 @@ export default {
console.log("上传进度返回:",res); console.log("上传进度返回:",res);
} }
} }
const result = await uploader.qnFileUpload(options)
if (result && !result.statusCode) { // 匹配已上传完成的图片,更新缓存数据 uploader.qnFileUpload(options).then(res => {
let newTask = [] this.refreshTask(that, res)
let delImg = [] }).catch(err => {
uploadTask.forEach(v => { console.log("err", err)
if (result.includes(`/${v.key}`)) { // 删除已上传的图片 if (err.errMsg.indexOf('fail file not found') !== -1) { // 在任务中删除不存在的图片
delImg.push(v.path) this.refreshTask(that, ['failErr'])
} else { // 未上传的重新存储 }
newTask.push(v) })
} },
}) refreshTask(that, result) {
const uploadTask = that.uploadTask
let newTask = []
let delImg = []
uploadTask.forEach(v => {
if (result.includes(`/${v.key}`) || result.includes('failErr')) { // 删除已上传的图片
delImg.push(v.path)
} else { // 未上传的重新存储
newTask.push(v)
}
})
// uni.setStorageSync('delImg', delImg) // 已上传完的图片,会在启动系统的时候做一次清理 // uni.setStorageSync('delImg', delImg) // 已上传完的图片,会在启动系统的时候做一次清理
that.$u.vuex('uploadTask', newTask) that.$u.vuex('uploadTask', newTask)
}
} }
} }
\ No newline at end of file
...@@ -21,13 +21,18 @@ ...@@ -21,13 +21,18 @@
<view class="bind-tips">{{ bindTips }}</view> <view class="bind-tips">{{ bindTips }}</view>
</view> </view>
<u-gap height="480"></u-gap> <u-gap height="480"></u-gap>
<button class="loginBtn" v-if="needAuth" lang="zh_CN" @tap="getUserProfile"> <view v-if="needAuth" @click.capture="loadLogin">
<text class="u-font-32 white">{{ loginTitle }}</text> <button class="loginBtn" lang="zh_CN"
</button> @tap="getUserProfile">
<button class="loginBtn" v-else open-type="getPhoneNumber" throttle-time="1000" <text class="u-font-32 white">{{ loginTitle }}</text>
@getphonenumber="signupLogin"> </button>
<text class="u-font-32 white">{{ bindTitle }}</text> </view>
</button> <view @click.capture="getCode" v-else>
<button class="loginBtn" open-type="getPhoneNumber"
throttle-time="1000" @getphonenumber="signupLogin">
<text class="u-font-32 white">{{ bindTitle }}</text>
</button>
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -64,9 +69,14 @@ export default { ...@@ -64,9 +69,14 @@ export default {
if (this.vuex_auth_user && Object.keys(this.vuex_auth_user).length) { if (this.vuex_auth_user && Object.keys(this.vuex_auth_user).length) {
this.needAuth = false this.needAuth = false
} }
this.getCode()
}, },
methods: { methods: {
loadLogin() {
uni.showLoading({
title: '加载中..',
mask: true
});
},
qnFile(src) { qnFile(src) {
return process.uniEnv.qn_base_url + src return process.uniEnv.qn_base_url + src
}, },
...@@ -97,6 +107,7 @@ export default { ...@@ -97,6 +107,7 @@ export default {
} }
}, },
fail: function (res) { fail: function (res) {
uni.hideLoading()
uni.showModal({ uni.showModal({
title: '授权失败', title: '授权失败',
content: '请允许获取用户信息的授权', content: '请允许获取用户信息的授权',
...@@ -105,6 +116,7 @@ export default { ...@@ -105,6 +116,7 @@ export default {
} }
}) })
} else { } else {
uni.hideLoading()
// 可能由于账号配置,或者其他原因导致无法调起微信用户授权 // 可能由于账号配置,或者其他原因导致无法调起微信用户授权
uni.showModal({ uni.showModal({
title: '授权失败', title: '授权失败',
...@@ -138,7 +150,12 @@ export default { ...@@ -138,7 +150,12 @@ export default {
that.setLoginStatus() that.setLoginStatus()
}) })
}, },
inGetAuth() {
uni.showLoading({
title: '授权中..',
mask: true
});
},
signupLogin(e) { signupLogin(e) {
var that = this var that = this
if(e && e.detail) { if(e && e.detail) {
...@@ -156,20 +173,24 @@ export default { ...@@ -156,20 +173,24 @@ export default {
iv: e.detail.iv, iv: e.detail.iv,
} }
if (that.code) { if (that.code) {
that.inGetAuth()
uni.checkSession({ uni.checkSession({
success () { success () {
//session_key 未过期,并且在本生命周期一直有效 //session_key 未过期,并且在本生命周期一直有效
params.code = that.code params.code = that.code
that.inGetAuth()
login.signup(params).then(res => { login.signup(params).then(res => {
uni.hideLoading() that.inGetAuth()
if (res) { if (res) {
login.setUserData(res.data, that) login.setUserData(res.data, that)
app.track('signup_login', {mobile: res.data.mobile}); app.track('signup_login', {mobile: res.data.mobile});
app.profileSet(that) app.profileSet(that)
app.profileAppend(that) app.profileAppend(that)
app.getBaseInfo(that) app.getBaseInfo(that)
uni.hideLoading()
that.goBackPage() that.goBackPage()
} else { } else {
uni.hideLoading()
uni.showToast({ uni.showToast({
title: '授权失败,请重新授权', title: '授权失败,请重新授权',
icon: 'none' icon: 'none'
...@@ -190,13 +211,15 @@ export default { ...@@ -190,13 +211,15 @@ export default {
that.toLogin(params) that.toLogin(params)
} }
} else { } else {
uni.hideLoading()
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
showCancel: false, showCancel: false,
content: e.detail.errMsg content: '用户取消授权'
}); });
} }
} else { } else {
uni.hideLoading()
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
showCancel: false, showCancel: false,
...@@ -209,7 +232,6 @@ export default { ...@@ -209,7 +232,6 @@ export default {
params.code = res.code params.code = res.code
return login.signup(params); return login.signup(params);
}).then(res => { }).then(res => {
uni.hideLoading()
if (res) { if (res) {
login.setUserData(res.data, this) login.setUserData(res.data, this)
app.track('signup_login', {mobile: res.data.mobile}); app.track('signup_login', {mobile: res.data.mobile});
...@@ -218,6 +240,7 @@ export default { ...@@ -218,6 +240,7 @@ export default {
app.getBaseInfo(this) app.getBaseInfo(this)
this.goBackPage() this.goBackPage()
} else { } else {
uni.hideLoading()
uni.showToast({ uni.showToast({
title: '授权失败,请重新授权', title: '授权失败,请重新授权',
icon: 'none' icon: 'none'
...@@ -361,6 +384,20 @@ export default { ...@@ -361,6 +384,20 @@ export default {
justify-content: center; justify-content: center;
} }
.disable {
background-color: #2272FF !important;
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF !important;
line-height: 104px;
width: 600rpx;
height: 104rpx;
border-radius: 52rpx;
display: flex;
align-items: center;
justify-content: center;
}
.cancelView { .cancelView {
width: 100%; width: 100%;
margin-top: 30rpx; margin-top: 30rpx;
......
...@@ -1154,7 +1154,7 @@ export default { ...@@ -1154,7 +1154,7 @@ export default {
let options = { let options = {
sourceType: ['album'], //['album', 'camera'] sourceType: ['album'], //['album', 'camera']
count: 3, count: 3,
sizeType: ['compressed'], sizeType: ['original'],
} }
const value = await this.chooseImg(options) const value = await this.chooseImg(options)
self.$refs[ self.$refs[
......
...@@ -15,7 +15,7 @@ function appLogin() { ...@@ -15,7 +15,7 @@ function appLogin() {
fail() { fail() {
uni.hideLoading(); uni.hideLoading();
uni.showModal({ uni.showModal({
content: '小程序登录失败', content: '小程序登录失败,请重试',
showCancel: false showCancel: false
}); });
reject(); reject();
...@@ -57,7 +57,7 @@ function signup(data) { ...@@ -57,7 +57,7 @@ function signup(data) {
} else { } else {
console.log(res.message) console.log(res.message)
uni.showModal({ uni.showModal({
content: '登录失败', content: '登录失败,请重试',
showCancel: false showCancel: false
}); });
reject(res); reject(res);
......
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