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