authentication.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view style="height: 100%;">
  3. <view v-if="agreeFlag" :style="'margin-top: ' + (height * 2 - 2) + 'rpx; height: calc(100vh - ' + (height * 2 - 2) + 'rpx)'">
  4. <view class="userinfo">
  5. <image class="userinfo-avatar" src="/assets/image/pro_icon.png" mode="cover"></image>
  6. </view>
  7. <view class="usermotto">
  8. <view class="account">
  9. <text class="title">医院IP/端口:</text>
  10. <input class="text-input" v-model="hospUrlIP" type="text" />
  11. </view>
  12. <view class="account">
  13. <text class="title">工号/手机号:</text>
  14. <input class="text-input" v-model="wxUserValue" type="number" />
  15. </view>
  16. <view class="account">
  17. <text class="title">密码:</text>
  18. <input class="text-input" v-model="wxUserValuePass" type="text" confirm-type="done" password />
  19. </view>
  20. <view class="bottomBtn">
  21. <text @tap="confirm" class="applyBtn">登录</text>
  22. </view>
  23. <text @tap="agreemeetOpen" class="user-agreement">《用户隐私协议》</text>
  24. </view>
  25. <view class="usermotto">
  26. <text class="user-motto">{{ motto }}</text>
  27. </view>
  28. </view>
  29. <scroll-view :scroll-y="true" style="height: 100%; width: 100%;" v-if="!agreeFlag">
  30. <text style="font-size: 40rpx; font-weight: 700; margin-top: 100rpx; display: block; text-align: center">隐私协议</text>
  31. <text :decode="true" style="padding: 0 20rpx; display: block; line-height: 35px">
  32. 1.开发者处理的信息 根据法律规定,开发者仅处理实现小程序功能所必要的信息。 为了身份识别,开发者将在获取你的明示同意后,收集你的微信昵称、头像。
  33. 为了身份验证,开发者将在获取你的明示同意后,收集你的手机号。 2.你的权益 2.1&emsp;关于收集你的手机号,你可以通过以下路径:小程序主页右上角“...” — “设置” —
  34. “小程序已获取的信息” — 点击特定信息 — 点击“通知开发者删除”,开发者承诺收到通知后将删除信息。
  35. 2.2&emsp;关于你的个人信息,你可以通过以下方式与开发者联系,行使查阅、复制、更正、删除等法定权利。
  36. 2.3&emsp;若你在小程序中注册了账号,你可以通过以下方式与开发者联系,申请注销你在小程序中使用的账号。在受理你的申请后,开发者承诺在十五个工作日内完成核查和处理,并按照法律法规要求处理你的相关信息。
  37. 电话:15884411612 3.开发者对信息的存储 3.1&emsp;开发者承诺,除法律法规另有规定外,开发者对你的信息的保存期限应当为实现处理目的所必要的最短时间。 4.信息的使用规则
  38. 4.1&emsp;开发者将会在本指引所明示的用途内使用收集的信息
  39. 4.2&emsp;如开发者使用你的信息超出本指引目的或合理范围,开发者必须在变更使用目的或范围前,再次以通知方式告知并征得你的明示同意。 5.信息对外提供
  40. 5.1&emsp;开发者承诺,不会主动共享或转让你的信息至任何第三方,如存在确需共享或转让时,开发者应当直接征得或确认第三方征得你的单独同意。
  41. 5.2&emsp;开发者承诺,不会对外公开披露你的信息,如必须公开披露时,开发者应当向你告知公开披露的目的、披露信息的类型及可能涉及的信息,并征得你的单独同意。
  42. 6.你认为开发者未遵守上述约定,或有其他的投诉建议、或未成年人个人信息保护相关问题,可通过以下方式与开发者联系;或者向微信进行投诉。 电话 : 15884411612
  43. </text>
  44. <button style="width: 100%; background-color: rgb(48, 118, 250); padding: 10rpx; color: white" type="default" @tap.stop.prevent="agree">已阅读并同意</button>
  45. </scroll-view>
  46. </view>
  47. </template>
  48. <script setup>
  49. import { onLaunch, onShow } from '@dcloudio/uni-app'
  50. import { ref, onMounted, onUnmounted, computed } from 'vue';
  51. import Aes from '../../config/Aes';
  52. import { $http } from '../../config/https';
  53. // 获取应用实例
  54. const app = getApp();
  55. // 响应式数据
  56. const hospUrlIP = ref('http://10.1.?.29:8090');
  57. // const hospUrlIP = ref('https://np.h03.p0551.com');
  58. const wxUserValue = ref('');
  59. const wxUserValuePass = ref('');
  60. const motto = ref('请确保设备在医院内网环境下使用!');
  61. const userInfo = ref({});
  62. const hasUserInfo = ref(false);
  63. const canIUse = ref(uni.canIUse('button.open-type.getUserInfo'));
  64. const agreeFlag = ref(true);
  65. // 导航栏数据
  66. const navbarData = ref({
  67. background: '',
  68. title: '登录移动护理',
  69. height: '100',
  70. bottom: true,
  71. isGoBack: true,
  72. cleanPat: 'Y'
  73. });
  74. // 计算高度
  75. const height = ref(app.globalData.height * 2 + 20);
  76. // 页面加载时
  77. onMounted(() => {
  78. // 可以在这里处理页面初始化逻辑
  79. const storageUrl = uni.getStorageSync('appUrlAddress');
  80. if (storageUrl) {
  81. hospUrlIP.value = storageUrl;
  82. }
  83. });
  84. // 页面显示时
  85. onShow(() => {
  86. const storageUrl = uni.getStorageSync('appUrlAddress');
  87. if (storageUrl) {
  88. hospUrlIP.value = storageUrl;
  89. }
  90. });
  91. // 方法定义
  92. const getUserInfo = (e) => {
  93. // 注释掉的代码保持不变
  94. // userInfo.value = e.detail.userInfo;
  95. // hasUserInfo.value = true;
  96. };
  97. const confirm = () => {
  98. const currentHospUrl = hospUrlIP.value;
  99. const userName = wxUserValue.value;
  100. const passWord = wxUserValuePass.value;
  101. uni.setStorageSync('appUrlAddress', currentHospUrl);
  102. const data = {
  103. params: [
  104. {
  105. userName,
  106. passWord: Aes.Encrypt(passWord)
  107. }
  108. ]
  109. };
  110. $http.post('urlDeault', this , {
  111. code: '1001',
  112. data: data,
  113. success: (res) => {
  114. if (res.errorCode === '0') {
  115. uni.setStorageSync('userData', res.result[0]);
  116. uni.showToast({
  117. title: '登录成功',
  118. icon: 'none'
  119. });
  120. setTimeout(() => {
  121. uni.redirectTo({
  122. url: '../index/index'
  123. });
  124. }, 1000);
  125. }
  126. }
  127. });
  128. };
  129. const agreemeetOpen = () => {
  130. agreeFlag.value = false;
  131. };
  132. const agree = () => {
  133. agreeFlag.value = true;
  134. };
  135. </script>
  136. <style scoped>
  137. .userinfo {
  138. display: flex;
  139. flex-direction: column;
  140. align-items: center;
  141. padding-top: 200rpx;
  142. }
  143. .userinfo-avatar {
  144. width: 128rpx;
  145. height: 138rpx;
  146. margin: 20rpx;
  147. }
  148. .userinfo-nickname {
  149. color: #809aff;
  150. }
  151. .usermotto {
  152. display: flex;
  153. flex-direction: column;
  154. align-items: center;
  155. margin-top: 30px;
  156. }
  157. .user-motto {
  158. color: red;
  159. }
  160. .applyBtn {
  161. display: block;
  162. text-align: center;
  163. padding: 15rpx 110rpx;
  164. letter-spacing: 4px;
  165. font-size: 32rpx;
  166. color: #fff;
  167. background: dodgerblue;
  168. margin: 35rpx 14rpx !important;
  169. border-radius: 20px;
  170. }
  171. .account {
  172. font-size: 32rpx;
  173. height: 88rpx;
  174. padding-left: 50rpx;
  175. line-height: 88rpx;
  176. border-bottom: 2rpx solid #ebedf0e0;
  177. }
  178. .account .title {
  179. width: 200rpx;
  180. height: 100%;
  181. display: inline-block;
  182. }
  183. .account .text-input {
  184. display: inline-block;
  185. width: calc(100% - 220rpx);
  186. font-size: 30rpx;
  187. vertical-align: sub;
  188. }
  189. .bottomBtn {
  190. display: flex;
  191. }
  192. .user-agreement {
  193. font-size: 22rpx;
  194. color: rgb(61, 95, 245);
  195. }
  196. </style>