Commit b7a7dea8 authored by tanjuanjuan's avatar tanjuanjuan

增加2.1.6的测试页

parent a53e2f74
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"vue": "^3.3.11", "vue": "^3.3.11",
"vue-i18n": "^9.1.9", "vue-i18n": "^9.1.9",
"wot-design-uni": "^1.3.2", "wot-design-uni": "^1.3.2",
"xinhua-sdk": "^1.16.2" "xinhua-sdk": "^2.1.6"
}, },
"devDependencies": { "devDependencies": {
"@dcloudio/types": "^3.3.2", "@dcloudio/types": "^3.3.2",
...@@ -13461,9 +13461,9 @@ ...@@ -13461,9 +13461,9 @@
} }
}, },
"node_modules/xinhua-sdk": { "node_modules/xinhua-sdk": {
"version": "1.16.2", "version": "2.1.6",
"resolved": "https://registry.npmmirror.com/xinhua-sdk/-/xinhua-sdk-1.16.2.tgz", "resolved": "https://registry.npmmirror.com/xinhua-sdk/-/xinhua-sdk-2.1.6.tgz",
"integrity": "sha512-YxuZ1lvxbj48B5v5GMkMtknIfd4Vu2zbcvVysRHgPRo+/tLplJG4UkiQ7E3IUc66yPG4tcH4dXn1H6wb0Amdpw==", "integrity": "sha512-arcFidDslvc4gH+TALt98L7nw0IxmpGZK9CkiU0K55ZXyYBkjIn59jHkKluOE+FP74G3wX8szulKiv61z1snZw==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/xml-name-validator": { "node_modules/xml-name-validator": {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"vue": "^3.3.11", "vue": "^3.3.11",
"vue-i18n": "^9.1.9", "vue-i18n": "^9.1.9",
"wot-design-uni": "^1.3.2", "wot-design-uni": "^1.3.2",
"xinhua-sdk": "^1.16.2" "xinhua-sdk": "^2.1.6"
}, },
"devDependencies": { "devDependencies": {
"@dcloudio/types": "^3.3.2", "@dcloudio/types": "^3.3.2",
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
} }
}, },
"pages": [ // pages 数组中第一项表示应用启动页 "pages": [ // pages 数组中第一项表示应用启动页
{
"path": "pages/test/index",
"style": {
"navigationBarTitleText": "216测试"
}
},
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
...@@ -16,4 +22,4 @@ ...@@ -16,4 +22,4 @@
"globalStyle": { "globalStyle": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
} }
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
const pttype = ref("初始状态") const pttype = ref("初始状态")
const elclick=ref(null) const elclick=ref(null)
const handleClick = () => { const handleClick = () => {
console.log("直接运行")
const isInWechatMiniProgram = () => { const isInWechatMiniProgram = () => {
const ua = window.navigator.userAgent.toLowerCase(); const ua = window.navigator.userAgent.toLowerCase();
// 微信小程序环境特有的UA标识 // 微信小程序环境特有的UA标识
......
<template>
<view class="content">
<view>运行环境:{{pttype}}</view>
<checkbox-group @change="checkboxChange">
<label
class="uni-list-cell uni-list-cell-pd"
v-for="item in list"
:key="item.value"
>
<view>
<checkbox :value="item.value"/>
</view>
<view>{{ item.name }}</view>
</label>
</checkbox-group>
<button @click="handleClick" ref="elclick">获取授权信息</button>
</view>
</template>
<script setup lang="ts">
import xh from 'xinhua-sdk';
import {ref} from 'vue'
const pttype = ref("初始状态")
const elclick=ref(null)
const list=ref([
{
value: 'ACCOUNT',
name: 'ACCOUNT'
},
{
value: 'MOBILE',
name: 'MOBILE'
},
{
value: 'CITIZEN',
name: 'CITIZEN'
}])
const loginType=ref(null)
const handleClick = () => {
console.log("进入点击事件handleClick")
const isInWechatMiniProgram = () => {
const ua = window.navigator.userAgent.toLowerCase();
// 微信小程序环境特有的UA标识
return ua.includes('miniprogram') || ua.includes('micromessenger') && ua.includes('miniprogram');
}
if (isInWechatMiniProgram()) {
console.log('当前运行在微信小程序中');
pttype.value = "微信小程序"
xh.getUserProfile({
goLogin: true,
range: loginType.value,
success(info) {
console.log("in success")
console.log(info.data)
},
fail(err){
console.log("in fail")
}
});
}else
{
console.log('不在微信小程序');
pttype.value = "不在微信小程序环境中"
}
}
const handleClick1 = () => {
xh.getUserInfo({
goLogin: true,//参数 goLogin 如果传 true 的情况下,如果没登录,跳转到登录页,登录成功会返回页面,需要重新调用 getUserInfo
success(res) {
console.log("res的值新加")
console.log(res)
}
});
}
const checkboxChange=(e)=>{
console.log(e)
loginType.value=e.detail.value
}
handleClick()
</script>
<style lang="scss">
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40rpx {
top: 200rpx;
}
gap: 24rpx;
.logo {
width: 80rpx;
height: 80rpx;
}
}
</style>
\ No newline at end of file
...@@ -6251,10 +6251,10 @@ xhr@^2.0.1: ...@@ -6251,10 +6251,10 @@ xhr@^2.0.1:
parse-headers "^2.0.0" parse-headers "^2.0.0"
xtend "^4.0.0" xtend "^4.0.0"
xinhua-sdk@*, xinhua-sdk@^1.16.2: xinhua-sdk@*, xinhua-sdk@^2.1.6:
version "1.16.2" version "2.1.6"
resolved "https://registry.npmmirror.com/xinhua-sdk/-/xinhua-sdk-1.16.2.tgz" resolved "https://registry.npmmirror.com/xinhua-sdk/-/xinhua-sdk-2.1.6.tgz"
integrity sha512-YxuZ1lvxbj48B5v5GMkMtknIfd4Vu2zbcvVysRHgPRo+/tLplJG4UkiQ7E3IUc66yPG4tcH4dXn1H6wb0Amdpw== integrity sha512-arcFidDslvc4gH+TALt98L7nw0IxmpGZK9CkiU0K55ZXyYBkjIn59jHkKluOE+FP74G3wX8szulKiv61z1snZw==
xml-name-validator@^3.0.0: xml-name-validator@^3.0.0:
version "3.0.0" version "3.0.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment