提交 fa9a5e40 编写于 作者: DCloud_JSON's avatar DCloud_JSON

修复拦截器在ios app端会报错:Unhandled promise...的问题

上级 2f4c9be8
## 1.0.12(2021-05-28)
修复拦截器在ios app端会报错:Unhandled promise...的问题
## 1.0.10(2021-05-27)
新增callfunction的拦截器废除this.request的写法。为callFunction添加:请求失败是否断网判断并提示、恢复网络自动重新执行、自动处理响应体,目前处理了403为token过期自动跳转到登陆页面,今后会添加更多的自动行为、自动延续token过期时间
## 1.0.9(2021-05-23)
修复变量被重复定义的问题
## 1.0.8(2021-05-22)
......
......@@ -155,6 +155,7 @@ export default function() {
list.forEach(item => { //用遍历的方式分别为,uni.navigateTo,uni.redirectTo,uni.reLaunch,uni.switchTab这4个路由方法添加拦截器
uni.addInterceptor(item, {
invoke(e) { // 调用前拦截
console.log(e);
//获取用户的token
const token = uni.getStorageSync('uni_id_token')
//获取当前页面路径(即url去掉"?"和"?"后的参数)
......@@ -180,9 +181,10 @@ export default function() {
title: '请先登录',
icon: 'none'
})
return uni.navigateTo({
uni.navigateTo({
url: "/pages/ucenter/login-page/index/index"
})
return false
}
}
},
......
......@@ -119,7 +119,7 @@
oauthServices.forEach(({
id
}) => {
console.log(9527,id);
// console.log(9527,id);
if (this.config[id].isChecked&&this.loginConfig.includes(id)) {
this.servicesList.push({
...this.config[id],
......
{
"id": "uni-starter",
"displayName": "uni-starter",
"version": "1.0.9",
"version": "1.0.12",
"description": "云端一体应用快速开发模版",
"keywords": [
"uni-starter",
......@@ -12,7 +12,7 @@
],
"repository": "https://codechina.csdn.net/dcloud/uni-starter.git",
"engines": {
"HBuilderX": "^3.1.14"
"HBuilderX": "^3.1.16"
},
"dcloudext": {
"category": [
......
<template>
<view>
<uni-list>
<uni-list-item class="item" @click="setAvatar" link>
<uni-list-item class="item" link>
<view slot="body" class="item">
<text>头像</text>
<image class="avatarUrl" :src="userInfo.avatar||nullAvatarUrl" mode="widthFix"></image>
<text>头像</text>
<uni-file-picker file-mediatype="image" return-type="object" v-model="userInfo.avatar" />
<!-- <uni-file-picke disable-preview :del-icon="false" return-type="object" fileMediatype="image" /> -->
<!-- <image class="avatarUrl" :src="userInfo.avatar||nullAvatarUrl" mode="widthFix"></image> -->
</view>
</uni-list-item>
<uni-list-item class="item" @click="setNickname('')" title="昵称" :rightText="userInfo.nickname||'未设置'" link></uni-list-item>
<uni-list-item class="item" @click="bindMobile" title="手机号" :rightText="userInfo.mobile||'未绑定'" link></uni-list-item>
<uni-list-item class="item" @click="setNickname('')" title="昵称" :rightText="userInfo.nickname||'未设置'" link>
</uni-list-item>
<uni-list-item class="item" @click="bindMobile" title="手机号" :rightText="userInfo.mobile||'未绑定'" link>
</uni-list-item>
</uni-list>
<uni-popup ref="dialog" type="dialog">
<uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" title="设置昵称" placeholder="请输入要设置的昵称">
<uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" title="设置昵称"
placeholder="请输入要设置的昵称">
</uni-popup-dialog>
</uni-popup>
</view>
......@@ -52,16 +58,16 @@
uni.preLogin({
provider: 'univerify',
success: this.univerify(), //预登录成功
fail:(res)=> { // 预登录失败
fail: (res) => { // 预登录失败
// 不显示一键登录选项(或置灰)
console.log(res)
console.log(res)
this.bindMobileBySmsCode()
}
})
// #endif
// #ifndef APP-PLUS
this.bindMobileBySmsCode()
//...去用验证码绑定
this.bindMobileBySmsCode()
//...去用验证码绑定
// #endif
},
univerify() {
......@@ -88,19 +94,23 @@
// });
// }
// }
// )
uniCloud.callFunction({
name:'uni-id-cf',
data:{
action:'bind_mobile_by_univerify',
params:e.authResult,
},
success: ({result}) => {
// )
uniCloud.callFunction({
name: 'uni-id-cf',
data: {
action: 'bind_mobile_by_univerify',
params: e.authResult,
},
success: ({
result
}) => {
console.log(result);
if(result.code===0){
this.setUserInfo({"mobile":result.mobile})
if (result.code === 0) {
this.setUserInfo({
"mobile": result.mobile
})
uni.closeAuthView()
}else{
} else {
uni.showModal({
content: JSON.stringify(result.msg),
showCancel: false,
......@@ -108,13 +118,13 @@
uni.closeAuthView()
}
});
}
}
}
}
})
},
fail: (err) => {
console.log(err);
if(err.code=='30002'){
if (err.code == '30002') {
this.bindMobileBySmsCode()
}
}
......@@ -122,11 +132,11 @@
},
bindMobileBySmsCode() {
uni.navigateTo({
url:'/pages/ucenter/userinfo/bind-mobile/bind-mobile'
url: '/pages/ucenter/userinfo/bind-mobile/bind-mobile'
})
},
setNickname(nickname) {
console.log(9527,nickname);
console.log(9527, nickname);
if (nickname) {
usersTable.where('_id==$env.uid').update({
nickname
......@@ -209,9 +219,10 @@
justify-content: space-between;
align-items: center;
}
.avatarUrl {
width: 50px;
height: 50px;
border-radius: 6px;
}
</style>
</style>
......@@ -23,6 +23,11 @@
"description": "头像地址",
"title": "头像地址",
"trim": "both"
},
"avatar_file": {
"bsonType": "file",
"title": "头像文件",
"description": "用file类型方便使用uni-file-picker组件"
},
"comment": {
"bsonType": "string",
......
## 0.0.6(2021-04-09)
- 修复 选择的文件非 file-extname 字段指定的扩展名报错的Bug
## 0.0.5(2021-04-09)
- 优化 更新组件示例
## 0.0.4(2021-04-09)
- 优化 file-extname 字段支持字符串写法,多个扩展名需要用逗号分隔
## 0.0.3(2021-02-05)
- 调整为uni_modules目录规范
- 修复 微信小程序不指定 fileExtname 属性选择失败的Bug
## 0.0.7(2021-05-12)
- 新增 组件示例地址
## 0.0.6(2021-04-09)
- 修复 选择的文件非 file-extname 字段指定的扩展名报错的Bug
## 0.0.5(2021-04-09)
- 优化 更新组件示例
## 0.0.4(2021-04-09)
- 优化 file-extname 字段支持字符串写法,多个扩展名需要用逗号分隔
## 0.0.3(2021-02-05)
- 调整为uni_modules目录规范
- 修复 微信小程序不指定 fileExtname 属性选择失败的Bug
......@@ -39,11 +39,15 @@
</view>
</template>
<script>
<script>
import { chooseAndUploadFile } from './choose-and-upload-file.js'
import uploadImage from './upload-image.vue'
import uploadFile from './upload-file.vue'
let fileInput = null
/**
* FilePicker
* FilePicker 文件选择上传
* @description 文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间
* @tutorial https://ext.dcloud.net.cn/plugin?id=-1
* @tutorial https://ext.dcloud.net.cn/plugin?id=4079
* @property {Object|Array} value 组件数据,通常用来回显 ,类型由return-type属性决定
* @property {Boolean} disabled=[true|false] 组件禁用
* @value true 禁用
......@@ -81,11 +85,6 @@
* @event {Function} fail 上传失败触发
* @event {Function} delete 文件从列表移除时触发
*/
import { chooseAndUploadFile } from './choose-and-upload-file.js'
import uploadImage from './upload-image.vue'
import uploadFile from './upload-file.vue'
let fileInput = null
export default {
name: 'uniFilePicker',
components: {
......@@ -332,8 +331,8 @@ export default {
} else {
filePaths = res.tempFilePaths
files = res.tempFiles
}
}
let currentData = []
for (let i = 0; i < files.length; i++) {
if (this.limitLength - this.files.length <= 0) break
......
......@@ -234,7 +234,7 @@
margin-right: 25px;
/* #ifndef APP-NVUE */
word-break: break-all;
word-wrap: break-word
word-wrap: break-word;
/* #endif */
}
......
{
"id": "uni-file-picker",
"displayName": "FilePicker 文件选择上传",
"version": "0.0.6",
"description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间",
"keywords": [
"uni-ui",
"图片上传",
"文件上传",
"uni-file-picker"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "n"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
{
"id": "uni-file-picker",
"displayName": "uni-file-picker 文件选择上传",
"version": "0.0.7",
"description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间",
"keywords": [
"uni-ui",
"uniui",
"图片上传",
"文件上传"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "n"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
......@@ -294,3 +294,8 @@ export default {
</uni-file-picker>
```
## 组件示例
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/file-picker/file-picker](https://hellouniapp.dcloud.net.cn/pages/extUI/file-picker/file-picker)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册