Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
817f3691
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
817f3691
编写于
9月 02, 2024
作者:
zhaofengliang920817
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
no message
上级
1c58f566
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
104 addition
and
152 deletion
+104
-152
pages/API/provider/provider.uvue
pages/API/provider/provider.uvue
+104
-152
未找到文件。
pages/API/provider/provider.uvue
浏览文件 @
817f3691
...
@@ -7,19 +7,10 @@
...
@@ -7,19 +7,10 @@
<view class="service-item" v-for="(item, index) in serviceList" :key="index">
<view class="service-item" v-for="(item, index) in serviceList" :key="index">
<text class="service-name">{{item.name}}:</text>
<text class="service-name">{{item.name}}:</text>
<view class="provider-list">
<view class="provider-list">
<!-- #ifdef APP-IOS -->
<text class="provider-item" v-for="(item2, index2) in item.provider" :key="index2">
{{item2}}
{{item.providerObjMap.length > 0 ? ':' + JSON.stringify(item.providerObjMap[index2]) : '' }}
</text>
<!-- #endif -->
<!-- #ifdef APP-ANDROID -->
<text class="provider-item" v-for="(item2, index2) in item.provider" :key="index2">
<text class="provider-item" v-for="(item2, index2) in item.provider" :key="index2">
{{item2}}
{{item2}}
{{item.providerObj.length > 0 ? ':' + JSON.stringify(item.providerObj[index2]) : '' }}
{{item.providerObj.length > 0 ? ':' + JSON.stringify(item.providerObj[index2]) : '' }}
</text>
</text>
<!-- #endif -->
</view>
</view>
</view>
</view>
<button class="btn-get-provider" type="primary" @click="getProvider">getProviderSync</button>
<button class="btn-get-provider" type="primary" @click="getProvider">getProviderSync</button>
...
@@ -34,8 +25,7 @@
...
@@ -34,8 +25,7 @@
service : string,
service : string,
name : string,
name : string,
provider : string[],
provider : string[],
providerObj : UniProvider[],
providerObj : UniProvider[]
providerObjMap : Object[],
}
}
export default {
export default {
...
@@ -44,8 +34,8 @@
...
@@ -44,8 +34,8 @@
title: 'provider',
title: 'provider',
flag: false,
flag: false,
serviceList: [
serviceList: [
{ service: "payment", name: "支付", provider: [], providerObj: [], providerObjMap: [] },
{ service: "payment", name: "支付", provider: [], providerObj: []},
{ service: "location", name: "定位", provider: [], providerObj: [], providerObjMap: [] }
{ service: "location", name: "定位", provider: [], providerObj: []}
] as ProviderItem[],
] as ProviderItem[],
providerIds: [] as string[],
providerIds: [] as string[],
providerObjects: [] as UniProvider[],
providerObjects: [] as UniProvider[],
...
@@ -57,7 +47,9 @@
...
@@ -57,7 +47,9 @@
var provider = uni.getProviderSync({
var provider = uni.getProviderSync({
service: item.service,
service: item.service,
} as GetProviderSyncOptions)
} as GetProviderSyncOptions)
console.log('getProvider',provider,provider.providerIds.length)
provider.providerIds.forEach((value) => {
provider.providerIds.forEach((value) => {
console.log('getProvider','value',value)
this.providerIds.push(value)
this.providerIds.push(value)
})
})
this.updateProvider(item.service, provider.providerIds, provider.providerObjects);
this.updateProvider(item.service, provider.providerIds, provider.providerObjects);
...
@@ -79,49 +71,9 @@
...
@@ -79,49 +71,9 @@
console.log(isWeChatInstalled)
console.log(isWeChatInstalled)
}
}
// #endif
// #endif
// #ifdef APP-IOS
const providerObjMap = this.getProviderObjectMap(obj)
console.log(providerObjMap)
item.providerObjMap.push(providerObjMap)
// #endif
})
})
}
}
},
// #ifdef APP-IOS
getProviderObjectMap(provider : UniProvider) {
const map = new Map()
if (this.hasProperty(provider, 'id') && provider.id != null) {
map.set('id', provider.id)
}
if (this.hasProperty(provider, 'description') && provider.description != null) {
map.set('description', provider.description)
}
if (this.hasProperty(provider, 'isAppExist') && provider.isAppExist != null) {
map.set('isAppExist', provider.isAppExist)
}
if (this.hasProperty(provider, 'isWeChatInstalled') && provider.isWeChatInstalled != null) {
map.set('isWeChatInstalled', provider.isWeChatInstalled)
}
if (this.hasMethod(provider, 'uniqueMethodForProvider')) {
map.set('func-uniqueMethodForProvider', provider.uniqueMethodForProvider())
}
return Object.fromEntries(map)
},
hasMethod(provider : UniProvider, methodName : string) {
return typeof provider[methodName] === 'function';
},
hasProperty(provider : UniProvider, propName : string) {
return propName in provider
}
}
// #endif
}
}
}
}
</script>
</script>
...
...
zhaofengliang920817
@zhaofengliang920817
mentioned in commit
6a9810ed
·
9月 02, 2024
mentioned in commit
6a9810ed
mentioned in commit 6a9810ed422e5347869e99945f102c08e8684bae
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录