2025-05-28 17:36:42 +08:00
|
|
|
|
<template>
|
2025-06-03 17:29:22 +08:00
|
|
|
|
<view class="login-container">
|
|
|
|
|
页面跳转中,请稍后...
|
|
|
|
|
<!-- 底部的栏,为啥这样写,是因为要做左右拉动 -->
|
|
|
|
|
<!-- <view class="botton-view">
|
|
|
|
|
<view v-for="(item,index) in itemArray" class="array-father">
|
|
|
|
|
<view :class="itemTarget===index ? `bottom-button-target` : `bottom-button`" @click="itemTarget=index">
|
|
|
|
|
<view class="">
|
|
|
|
|
{{item}}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-show="itemTarget===index" class="blue-heng"></view>
|
|
|
|
|
</view>
|
|
|
|
|
</view> -->
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
<!-- <view class="callback-container">
|
|
|
|
|
回调成功{{ceshi.name}}{{ceshi.openid}} -->
|
2025-05-28 17:36:42 +08:00
|
|
|
|
<!-- {{look}} -->
|
|
|
|
|
<!-- <text v-if="!userInfo">授权中...</text>
|
|
|
|
|
<view v-else>
|
|
|
|
|
<text>OpenID: {{ openid }}</text>
|
|
|
|
|
<text v-if="userInfo.nickname">昵称: {{ userInfo.nickname }}</text>
|
|
|
|
|
<image v-if="userInfo.headimgurl" :src="userInfo.headimgurl" class="avatar" />
|
|
|
|
|
</view> -->
|
2025-06-03 17:29:22 +08:00
|
|
|
|
<!-- <view v-for="(item,index) in jigouArray" :key="index">
|
2025-05-28 17:36:42 +08:00
|
|
|
|
<view style="font-size: 30rpx;margin-top: 10rpx;font-weight: 700;" @click="jigouClick(item)">
|
|
|
|
|
{{item.departName}}
|
|
|
|
|
</view>
|
|
|
|
|
<image style="width: 60rpx;height: 60rpx;"
|
|
|
|
|
:src="`https://www.focusnu.com/nursing-unit/sys/common/static/${item.picUrl}`" />
|
|
|
|
|
</view>
|
|
|
|
|
<view v-for="(item,index) in secondArray" :key="index" @click="jumpto">
|
|
|
|
|
<view style="font-size: 30rpx;margin-top: 10rpx;font-weight: 700;">
|
|
|
|
|
{{item.nuName}}
|
|
|
|
|
</view>
|
2025-06-03 17:29:22 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view> -->
|
2025-05-28 17:36:42 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import {
|
|
|
|
|
onLoad
|
|
|
|
|
} from '@dcloudio/uni-app';
|
2025-06-03 17:29:22 +08:00
|
|
|
|
// import {
|
|
|
|
|
// useWeChatAuth
|
|
|
|
|
// } from '@/compontent/useWeChatAuth.js';
|
2025-05-28 17:36:42 +08:00
|
|
|
|
import request from '@/request/index.js';
|
|
|
|
|
import {
|
|
|
|
|
reactive,
|
|
|
|
|
ref
|
|
|
|
|
} from 'vue';
|
2025-06-03 17:29:22 +08:00
|
|
|
|
import {getList} from "@/api/loginApi.js"
|
|
|
|
|
|
|
|
|
|
const itemArray = ["NU", "动态", "我的"];
|
|
|
|
|
const itemTarget = ref(0);
|
|
|
|
|
// const {
|
|
|
|
|
// fetchUserInfo,
|
|
|
|
|
// openid,
|
|
|
|
|
// userInfo
|
|
|
|
|
// } = useWeChatAuth();
|
2025-05-28 17:36:42 +08:00
|
|
|
|
|
|
|
|
|
const ceshi = reactive({
|
|
|
|
|
name: "",
|
|
|
|
|
openid: "",
|
|
|
|
|
accessToken: ""
|
|
|
|
|
})
|
2025-06-03 17:29:22 +08:00
|
|
|
|
// const jumpto = () => {
|
|
|
|
|
// console.log("???")
|
|
|
|
|
// uni.navigateTo({
|
|
|
|
|
// url: "/pages/pay/index"
|
|
|
|
|
// });
|
|
|
|
|
// }
|
2025-05-28 17:36:42 +08:00
|
|
|
|
const getOpenId = (code) => {
|
|
|
|
|
const url = `https://www.focusnu.com/nursing-unit/weixin/wechat/callback?code=${encodeURIComponent(code)}`;
|
|
|
|
|
|
|
|
|
|
fetch(url)
|
|
|
|
|
.then(res => res.json())
|
2025-06-03 17:29:22 +08:00
|
|
|
|
.then(data => {
|
2025-05-28 17:36:42 +08:00
|
|
|
|
ceshi.name = data.data.nickname
|
|
|
|
|
ceshi.openid = data.data.openid
|
|
|
|
|
ceshi.accessToken = data.accessToken
|
|
|
|
|
uni.setStorage({
|
|
|
|
|
key: 'openid',
|
|
|
|
|
data: {
|
|
|
|
|
openid: data.data.openid,
|
|
|
|
|
accessToken: data.accessToken,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
getUserMessage()
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
console.error("❌ 获取用户信息失败:", err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// const serve = ref("")
|
|
|
|
|
const look = ref("")
|
|
|
|
|
const getUserMessage = () => {
|
|
|
|
|
const url =
|
2025-06-03 17:29:22 +08:00
|
|
|
|
`https://www.focusnu.com/nursing-unit/h5Api/nuBizAdvisoryInfo/queryWeixinInfo?openId=${encodeURIComponent(ceshi.openid)}`;
|
2025-05-28 17:36:42 +08:00
|
|
|
|
fetch(url)
|
|
|
|
|
.then(res => res.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
console.log("个人信息打印", data)
|
2025-06-03 17:29:22 +08:00
|
|
|
|
uni.setStorageSync('token', data.result.token);
|
|
|
|
|
uni.setStorageSync('serverUrl', data.result.serverUrl);
|
|
|
|
|
console.log("???token存储",data.result.token)
|
|
|
|
|
// uni.getStorageSync('token')
|
|
|
|
|
|
|
|
|
|
const post = `${data.result.serverUrl}/weiXinPay/getJsApiInfo`;
|
|
|
|
|
const pay = {
|
2025-05-28 17:36:42 +08:00
|
|
|
|
access_token: ceshi.accessToken,
|
|
|
|
|
};
|
2025-06-03 17:29:22 +08:00
|
|
|
|
console.log("???/", pay)
|
|
|
|
|
fetch(post, {
|
2025-05-28 17:36:42 +08:00
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
2025-06-03 17:29:22 +08:00
|
|
|
|
body: JSON.stringify(pay)
|
2025-05-28 17:36:42 +08:00
|
|
|
|
})
|
|
|
|
|
.then(res => res.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
// secondArray.value = [...data.result];
|
2025-06-03 17:29:22 +08:00
|
|
|
|
console.log("???调取微信", data)
|
|
|
|
|
|
2025-05-28 17:36:42 +08:00
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
console.error('请求失败:', err);
|
|
|
|
|
});
|
2025-06-03 17:29:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const urlpost = `${data.result.serverUrl}/weiXinPay/getUserInfo`;
|
|
|
|
|
// const payload = {
|
|
|
|
|
// openid: ceshi.openid,
|
|
|
|
|
// access_token: ceshi.accessToken,
|
|
|
|
|
// // serverUrl: serve.value
|
|
|
|
|
// };
|
|
|
|
|
// console.log("???/", payload)
|
|
|
|
|
// fetch(urlpost, {
|
|
|
|
|
// method: 'POST',
|
|
|
|
|
// headers: {
|
|
|
|
|
// 'Content-Type': 'application/json'
|
|
|
|
|
// },
|
|
|
|
|
// body: JSON.stringify(payload)
|
|
|
|
|
// })
|
|
|
|
|
// .then(res => res.json())
|
|
|
|
|
// .then(data => {
|
|
|
|
|
// // secondArray.value = [...data.result];
|
|
|
|
|
// look.value = data
|
|
|
|
|
// console.log("!!!!!!!!!!!!!!!!!!!!!!!", data)
|
|
|
|
|
// })
|
|
|
|
|
// .catch(err => {
|
|
|
|
|
// console.error('请求失败:', err);
|
|
|
|
|
// });
|
2025-05-28 17:36:42 +08:00
|
|
|
|
|
2025-06-03 17:29:22 +08:00
|
|
|
|
if(!data.result.tel){
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: `/pages/login/phonebumber`
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: `/pages/index/index`
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-05-28 17:36:42 +08:00
|
|
|
|
getjigou()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const jigouArray = ref([]);
|
|
|
|
|
const getjigou = () => {
|
|
|
|
|
const url = `https://www.focusnu.com/nursing-unit/sys/sysDepart/queryInstitutionsList`;
|
|
|
|
|
fetch(url)
|
|
|
|
|
.then(res => res.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
jigouArray.value = [...data]
|
|
|
|
|
console.log("机构打印", jigouArray.value)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const secondArray = ref([]);
|
|
|
|
|
const jigouClick = (element) => {
|
|
|
|
|
const url = `${element.serverUrl}/h5Api/nuBaseInfo/list`;
|
|
|
|
|
fetch(url)
|
|
|
|
|
.then(res => res.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
secondArray.value = [...data.result]
|
|
|
|
|
})
|
|
|
|
|
uni.setStorage({
|
|
|
|
|
key: 'serverUrl',
|
|
|
|
|
data: {
|
|
|
|
|
url: element.serverUrl,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const urlpost = `https://www.focusnu.com/nursing-unit/h5Api/nuBizAdvisoryInfo/editNuBizAdvisoryInfo`;
|
|
|
|
|
const payload = {
|
|
|
|
|
openId: ceshi.openid,
|
|
|
|
|
serverUrl: element.serverUrl
|
|
|
|
|
};
|
|
|
|
|
console.log("???/", payload)
|
|
|
|
|
fetch(urlpost, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify(payload)
|
|
|
|
|
})
|
|
|
|
|
.then(res => res.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
// secondArray.value = [...data.result];
|
|
|
|
|
console.log("???", data)
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
console.error('请求失败:', err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onLoad(() => {
|
|
|
|
|
const href = window.location.href;
|
|
|
|
|
const queryString = href.split('?')[1]?.split('#')[0]; // 提取 ? 和 # 之间的参数
|
|
|
|
|
const query = {};
|
|
|
|
|
|
|
|
|
|
if (queryString) {
|
|
|
|
|
queryString.split('&').forEach(pair => {
|
|
|
|
|
const [key, value] = pair.split('=');
|
|
|
|
|
query[key] = decodeURIComponent(value);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('解析到的 query 参数:', query);
|
|
|
|
|
|
|
|
|
|
if (query.code) {
|
|
|
|
|
getOpenId(query.code)
|
|
|
|
|
// 调用你的方法,比如 fetchUserInfo(query.code)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2025-06-03 17:29:22 +08:00
|
|
|
|
<style scoped lang="scss">
|
2025-05-28 17:36:42 +08:00
|
|
|
|
.callback-container {
|
|
|
|
|
padding: 24px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.avatar {
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 80px;
|
|
|
|
|
border-radius: 40px;
|
|
|
|
|
margin-top: 12px;
|
|
|
|
|
}
|
2025-06-03 17:29:22 +08:00
|
|
|
|
.login-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
width: 100%;
|
|
|
|
|
background-color: rgb(239, 241, 252);
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.array-father {
|
|
|
|
|
width: 33%;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.botton-view {
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
height: 200rpx;
|
|
|
|
|
width: 100%;
|
|
|
|
|
// background-color: greenyellow;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
|
|
|
|
.bottom-button {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bottom-button-target {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
color: rgb(42, 133, 235);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.blue-heng {
|
|
|
|
|
height: 6rpx;
|
|
|
|
|
width: 150rpx;
|
|
|
|
|
background-color: rgb(42, 133, 235);
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 55rpx;
|
|
|
|
|
left: 50%;
|
|
|
|
|
/* 左边缘到父容器左边的距离占父宽度 50% */
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-28 17:36:42 +08:00
|
|
|
|
</style>
|