Browse Source

feat(login): 登录界面和用户信息请求更新

EvilDragon 6 months ago
parent
commit
8612d001fb

+ 11 - 0
src/assets/svgs/logo.svg

@@ -0,0 +1,11 @@
+<svg width="29" height="29" viewBox="0 0 29 29" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="Frame">
+<circle id="Ellipse 38" cx="13.8693" cy="13.8696" r="11.3478" fill="#0CBE7D" stroke="#0CBE7D" stroke-width="1.3"/>
+<path id="Vector" fill-rule="evenodd" clip-rule="evenodd" d="M7.85547 16.4778C8.04846 17.1904 8.15172 17.9203 7.94011 18.6156H9.89707C10.2746 18.6156 10.6876 18.4841 10.6876 17.9358C10.6876 17.2544 10.2915 17.1973 9.89876 17.1938C9.42137 17.2008 8.6308 17.3737 7.85547 16.4778Z" fill="white"/>
+<path id="Vector_2" fill-rule="evenodd" clip-rule="evenodd" d="M20.0625 16.8548C19.8644 17.4031 19.7713 17.9929 19.9728 18.5498H14.4862C14.3457 18.5498 12.2855 18.6069 12.2685 20.1739C12.2533 21.8395 14.0952 21.5697 15.336 20.7724C16.5769 19.975 18.5982 20.5994 19.4903 21.6683C19.4903 21.6683 17.9295 20.8709 16.7716 21.312C15.6137 21.753 14.2323 22.8686 12.812 22.6662C11.3916 22.4639 10.6789 21.4555 10.7636 20.1445C10.8482 18.8335 12.0739 17.6245 13.8108 17.6245H17.3522C17.3522 17.6245 19.3092 17.6712 20.0625 16.8548Z" fill="white"/>
+<path id="Vector_3" fill-rule="evenodd" clip-rule="evenodd" d="M9.60743 16.2858C9.84274 15.843 9.82243 15.3622 9.50586 14.8623C11.7269 15.6251 15.7559 15.6268 17.9821 14.8623C17.6655 15.3622 17.6435 15.843 17.8822 16.2858H9.60743Z" fill="white"/>
+<path id="Vector_4" fill-rule="evenodd" clip-rule="evenodd" d="M4.33105 6.93392C7.22078 7.68802 11.1364 7.45279 13.4996 6.30435C13.0917 6.8042 13.0679 7.28502 13.3693 7.7278H4.33105V6.93392Z" fill="white"/>
+<path id="Vector_5" fill-rule="evenodd" clip-rule="evenodd" d="M23.5774 7.72607C20.5302 6.9737 16.4013 7.20719 13.9111 8.35564C14.3411 7.85752 14.3665 7.37669 14.0483 6.93219H23.5774V7.72607Z" fill="white"/>
+<path id="Vector_6" fill-rule="evenodd" clip-rule="evenodd" d="M13.4536 9.24465C13.6838 9.45739 14.3694 9.98837 15.5036 10.8307C16.5597 11.6271 17.6944 12.3082 18.8894 12.8629C20.0112 13.3761 21.6995 13.9151 23.9544 14.4801L23.7327 14.8675L23.6176 15.2636L23.13 15.1685L20.5907 14.4023L18.8792 13.7589L18.3443 13.5323L18.285 13.5115L18.241 13.5392H9.14185L8.74402 13.6741C7.44848 14.2899 6.11304 14.8141 4.74716 15.2429L4.1682 15.4158L4.05309 15.0405L3.78223 14.6064C4.5367 14.389 5.27972 14.1321 6.00835 13.8367C6.95184 13.4654 7.9021 13.0486 8.85914 12.5862C9.84771 12.1066 10.7806 11.5154 11.6405 10.8238C12.2767 10.3367 12.8822 9.80933 13.4536 9.24465Z" fill="white"/>
+</g>
+</svg>

+ 1 - 0
src/core/libs/requests.ts

@@ -129,5 +129,6 @@ export const weixinMiniAppLogin = (phoneCode: string, loginCode: string, state:
     loginCode,
     state,
   })
+export const getMemberUserInfo = () => httpGet<any>('/app-api/member/user/get')
 export const httpGetMock = <T>(data: T) =>
   new Promise<IResData<T>>((resolve) => resolve({ code: 1, msg: '', data } as IResData<T>))

+ 2 - 0
src/core/libs/svgs.ts

@@ -13,6 +13,7 @@ import coupon from '@/assets/svgs/coupon.svg'
 import order from '@/assets/svgs/order.svg'
 import agent from '@/assets/svgs/agent.svg'
 import setting from '@/assets/svgs/setting.svg'
+import logo from '@/assets/svgs/logo.svg'
 export {
   polygon16,
   frame,
@@ -29,4 +30,5 @@ export {
   order,
   agent,
   setting,
+  logo,
 }

+ 4 - 1
src/pages.json

@@ -77,7 +77,10 @@
     },
     {
       "path": "pages/login/index",
-      "type": "page"
+      "type": "page",
+      "style": {
+        "navigationBarTitleText": "登录"
+      }
     },
     {
       "path": "pages/material/index",

+ 50 - 22
src/pages/login/index.vue

@@ -1,5 +1,10 @@
+<route lang="yaml">
+style:
+  navigationBarTitleText: 登录
+</route>
 <script lang="ts" setup>
 import { weixinMiniAppLogin } from '@/core/libs/requests'
+import { logo } from '@/core/libs/svgs'
 
 const loginCode = ref('')
 const phoneCode = ref('')
@@ -40,17 +45,11 @@ const toUserInfoPage = () => {
     url: '/uni_modules/uni-id-pages/pages/userinfo/userinfo?showLoginManage=true',
   })
 }
-const weixinLogin = async () => {
-  //   wx.getPhoneNumber
-}
-const getPhoneNumber = async ({ detail }) => {
-  console.log(phoneCode)
-  phoneCode.value = detail.code
+const getPhoneNumber = async ({ detail: { code: phoneCode } }) => {
   const { code } = await uni.login()
-  loginCode.value = code
-  console.log(code)
-  const a = await weixinMiniAppLogin(phoneCode.value, code, '9b2ffbc1-7425-4155-9894-9d5c08541d62')
-  console.log(a)
+  console.log(code, phoneCode)
+  const res = await weixinMiniAppLogin(phoneCode, code, '9b2ffbc1-7425-4155-9894-9d5c08541d62')
+  console.log(res)
 }
 const getTestCode = async ({ detail }) => {
   phoneCode.value = detail.code
@@ -59,7 +58,36 @@ const getTestCode = async ({ detail }) => {
 }
 </script>
 <template>
-  <view class="content">
+  <div class="w-full flex flex-col items-center justify-around px-3.5">
+    <div>
+      <wd-img :src="logo" width="78" height="78"></wd-img>
+      <div class="text-black text-2xl font-normal font-['PingFang SC'] leading-[10.18px]">
+        筑巢荟
+      </div>
+    </div>
+    <div class="w-full">
+      <button
+        type="primary"
+        size="large"
+        :style="{
+          backgroundColor: 'black',
+        }"
+        open-type="getPhoneNumber"
+        @getphonenumber="getPhoneNumber"
+      >
+        手机号一键登录
+      </button>
+      <div class="w-[318px] mt-8">
+        <span class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-tight">
+          如您点击授权,您将同意并授权
+        </span>
+        <span class="text-[#0cbe7c] text-xs font-normal font-['PingFang SC'] leading-tight">
+          《筑巢荟用户服务协议》、《隐私政策》、《注册协议》
+        </span>
+      </div>
+    </div>
+  </div>
+  <!-- <view class="content">
     <textarea v-model="loginCode" placeholder="" placeholder-class="textarea-placeholder" />
     <textarea v-model="phoneCode" placeholder="" placeholder-class="textarea-placeholder" />
     <button style="margin: 20px 0 20px 0" @click="toUserInfoPage">个人资料</button>
@@ -71,18 +99,18 @@ const getTestCode = async ({ detail }) => {
         mode="button"
       ></uni-data-checkbox>
     </uni-forms-item>
-    <button @click="weixinLogin">前往登录</button>
-    <!-- #ifdef MP-WEIXIN -->
-    <button type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
-      手机号一键登录
-    </button>
-    <!-- #endif -->
-    <!-- #ifdef MP-WEIXIN -->
-    <button type="primary" open-type="getPhoneNumber" @getphonenumber="getTestCode">
+    <button @click="weixinLogin">前往登录</button> -->
+  <!-- #ifdef MP-WEIXIN -->
+  <!-- <button type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> -->
+  <!-- 手机号一键登录
+    </button> -->
+  <!-- #endif -->
+  <!-- #ifdef MP-WEIXIN -->
+  <!-- <button type="primary" open-type="getPhoneNumber" @getphonenumber="getTestCode">
       获取测试码
-    </button>
-    <!-- #endif -->
-  </view>
+    </button> -->
+  <!-- #endif -->
+  <!-- </view> -->
 </template>
 
 <style lang="scss">

+ 6 - 0
src/pages/mine/index.vue

@@ -10,7 +10,9 @@ import SectionHeading from '@/components/section-heading.vue'
 import StartMenuButton from '@/components/start-menu-button.vue'
 import { designer, settled, treaty, vipBg } from '@/core/libs/pngs'
 import { integral, coupon, order, agent, setting, wechat, award, camera } from '@/core/libs/svgs'
+import { getMemberUserInfo } from '@/core/libs/requests'
 
+const { data, run } = useRequest(getMemberUserInfo)
 const menus = ref([
   { title: '积分明细', icon: integral },
   { title: '优惠券包', icon: coupon },
@@ -41,6 +43,10 @@ const pieces = ref([
     iconSize: 44,
   },
 ])
+onMounted(async () => {
+  await run()
+  console.log(data)
+})
 </script>
 
 <template>