提交 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>
<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,7 +58,7 @@
uni.preLogin({
provider: 'univerify',
success: this.univerify(), //预登录成功
fail:(res)=> { // 预登录失败
fail: (res) => { // 预登录失败
// 不显示一键登录选项(或置灰)
console.log(res)
this.bindMobileBySmsCode()
......@@ -90,17 +96,21 @@
// }
// )
uniCloud.callFunction({
name:'uni-id-cf',
data:{
action:'bind_mobile_by_univerify',
params:e.authResult,
name: 'uni-id-cf',
data: {
action: 'bind_mobile_by_univerify',
params: e.authResult,
},
success: ({result}) => {
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,
......@@ -114,7 +124,7 @@
},
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,6 +219,7 @@
justify-content: space-between;
align-items: center;
}
.avatarUrl {
width: 50px;
height: 50px;
......
......@@ -24,6 +24,11 @@
"title": "头像地址",
"trim": "both"
},
"avatar_file": {
"bsonType": "file",
"title": "头像文件",
"description": "用file类型方便使用uni-file-picker组件"
},
"comment": {
"bsonType": "string",
"description": "备注",
......
## 0.0.7(2021-05-12)
- 新增 组件示例地址
## 0.0.6(2021-04-09)
- 修复 选择的文件非 file-extname 字段指定的扩展名报错的Bug
## 0.0.5(2021-04-09)
......
......@@ -40,10 +40,14 @@
</template>
<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: {
......
......@@ -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",
"displayName": "uni-file-picker 文件选择上传",
"version": "0.0.7",
"description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间",
"keywords": [
"uni-ui",
"uniui",
"图片上传",
"文件上传",
"uni-file-picker"
"文件上传"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册