猫妈狗爸伴宠师小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
3.6 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
  1. <template>
  2. <view class="login">
  3. <view class="login-logo">
  4. <image class="logo" :src="configList?.applet_info?.paramValueImage" mode="aspectFill"></image>
  5. <image class="d" :src="configList?.logo_icon?.paramValueImage" mode="aspectFill"></image>
  6. </view>
  7. <view class="login-submit">
  8. <up-button class="mt24" type="primary" text="微信授权登陆" @tap="loginWx" shape="circle"
  9. color="#FFBF60"></up-button>
  10. <up-button @click="cancelLogin" class="mt24" type="primary" text="取消登录" shape="circle"
  11. color="#FFBF60"></up-button>
  12. </view>
  13. <view class="flex-rowc">
  14. <view class="select">
  15. <image mode="widthFix"></image>
  16. </view>
  17. <view class="size-26">
  18. <text>我已阅读并同意猫爸狗妈</text>
  19. <text @click="privacyPolicy('login_xy')" class="main-color">注册协议</text>
  20. <text></text>
  21. <text @click="privacyPolicy('login_ys')" class="main-color">隐私政策</text>
  22. </view>
  23. </view>
  24. </view>
  25. <up-popup :show="show" @close="close" :round="10">
  26. <view style="padding: 10rpx 20rpx;min-height: 50vh;" v-html="content"></view>
  27. </up-popup>
  28. </template>
  29. <script setup>
  30. import {
  31. getOpenIdKey,
  32. getToken,
  33. setIsLogin,
  34. setOpenIdKey,
  35. setStorage,
  36. setToken
  37. } from "../../utils/auth";
  38. import {
  39. getOpenId,
  40. getPersonalInfo,
  41. getPhoneNumber
  42. } from "../../api/system/user";
  43. import {
  44. computed,
  45. onMounted,
  46. ref
  47. } from "vue"
  48. import {
  49. useStore
  50. } from 'vuex'
  51. const store = useStore()
  52. const value = ref(false)
  53. const configList = computed(() => {
  54. return store.getters.configList
  55. })
  56. const show = ref(false)
  57. const content = ref('')
  58. // 微信授权登陆
  59. const loginWx = () => {
  60. store.dispatch("login")
  61. }
  62. // 获取openid
  63. // if (!getOpenIdKey() && !getToken()) {
  64. // uni.login({
  65. // provider: 'weixin',
  66. // success: async (res) => {
  67. // const {
  68. // code,
  69. // data
  70. // } = await getOpenId(res.code)
  71. // if (code === 200 && data) {
  72. // let resData = JSON.parse(data)
  73. // setOpenIdKey(resData.openId)
  74. // }
  75. // },
  76. // fail: function(error) {
  77. // // 授权失败处理
  78. // uni.showToast('授权失败,请授权后再试')
  79. // }
  80. // });
  81. // }
  82. // 获取token
  83. const onGetPhoneNumber = async (e) => {
  84. // uni.login({
  85. // success: res => {
  86. // console.log("====>", res)
  87. // }
  88. // })
  89. getPhoneNumber({
  90. phoneCode: e.detail.code
  91. })
  92. // if (e.detail.errMsg === "getPhoneNumber:ok") {
  93. // if (getOpenIdKey()) {
  94. // try {
  95. // const {
  96. // data
  97. // } = await getPhoneNumber({
  98. // "openId": getOpenIdKey(),
  99. // "code": e.detail.code,
  100. // sourceType: 1
  101. // })
  102. // setToken(data.token)
  103. // setIsLogin(true)
  104. // await getUserInfo()
  105. // } catch (e) {
  106. // uni.showToast({
  107. // icon: 'error',
  108. // title: '获取手机号失败'
  109. // })
  110. // }
  111. // }
  112. // }
  113. }
  114. // // h获取用户信息
  115. // const getUserInfo = async () => {
  116. // const {
  117. // data
  118. // } = await getPersonalInfo()
  119. // setStorage('userInfo', data)
  120. // uni.navigateBack()
  121. // }
  122. const cancelLogin = () => {
  123. uni.switchTab({
  124. url: "/pages/workbenchManage/index"
  125. })
  126. }
  127. const close = () => {
  128. show.value = false
  129. }
  130. const privacyPolicy = (key) => {
  131. content.value = configList.value[key]?.paramValueArea || "";
  132. show.value = true;
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. @import "index";
  137. @import "@/style/index.scss";
  138. .select {
  139. width: 24rpx;
  140. height: 24rpx;
  141. border-radius: 50%;
  142. border: 1rpx solid #C7C7C7;
  143. margin-right: 8rpx;
  144. .active {
  145. background-color: $mainColor;
  146. }
  147. }
  148. .footer {
  149. color: #C7C7C7;
  150. position: fixed;
  151. bottom: 100rpx;
  152. }
  153. </style>