提交 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> <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> </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,7 +58,7 @@ ...@@ -52,7 +58,7 @@
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()
...@@ -90,17 +96,21 @@ ...@@ -90,17 +96,21 @@
// } // }
// ) // )
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,
...@@ -114,7 +124,7 @@ ...@@ -114,7 +124,7 @@
}, },
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,6 +219,7 @@ ...@@ -209,6 +219,7 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.avatarUrl { .avatarUrl {
width: 50px; width: 50px;
height: 50px; height: 50px;
......
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
"title": "头像地址", "title": "头像地址",
"trim": "both" "trim": "both"
}, },
"avatar_file": {
"bsonType": "file",
"title": "头像文件",
"description": "用file类型方便使用uni-file-picker组件"
},
"comment": { "comment": {
"bsonType": "string", "bsonType": "string",
"description": "备注", "description": "备注",
......
## 0.0.7(2021-05-12)
- 新增 组件示例地址
## 0.0.6(2021-04-09) ## 0.0.6(2021-04-09)
- 修复 选择的文件非 file-extname 字段指定的扩展名报错的Bug - 修复 选择的文件非 file-extname 字段指定的扩展名报错的Bug
## 0.0.5(2021-04-09) ## 0.0.5(2021-04-09)
......
...@@ -40,10 +40,14 @@ ...@@ -40,10 +40,14 @@
</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: {
......
...@@ -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": {
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册