diff --git a/App.vue b/App.vue
index a9f495e..eee430b 100644
--- a/App.vue
+++ b/App.vue
@@ -1,8 +1,21 @@
+
+
\ No newline at end of file
diff --git a/components/CheckBox/propmt.md b/components/CheckBox/propmt.md
new file mode 100644
index 0000000..a865b92
--- /dev/null
+++ b/components/CheckBox/propmt.md
@@ -0,0 +1,12 @@
+## 复选框组件
+
+## 提示词:
+
+使用 uniapp + vue3 组合式 api 开发微信小程序,要求如下:
+1、按照提供的图片高度还原交互设计
+2、要求布局样式结构简洁明了,class 命名请按照模块名称来命名,例如:.checkbox-wrapper
+3、可以使用 uniapp 内置的组件
+
+## 备注
+
+仅供学习、交流使用,请勿用于商业用途。
diff --git a/components/CheckBox/styles/index.scss b/components/CheckBox/styles/index.scss
new file mode 100644
index 0000000..16c16a9
--- /dev/null
+++ b/components/CheckBox/styles/index.scss
@@ -0,0 +1,10 @@
+.checkbox-wrapper {
+ display: flex;
+ align-items: center;
+
+ .checkbox-icon {
+ width: 20px;
+ height: 20px;
+ margin-right: 8px;
+ }
+}
\ No newline at end of file
diff --git a/hooks/useGoHome.js b/hooks/useGoHome.js
new file mode 100644
index 0000000..2b5156d
--- /dev/null
+++ b/hooks/useGoHome.js
@@ -0,0 +1 @@
+export const goHome = () => uni.reLaunch({ url: "/pages/index/index" });
\ No newline at end of file
diff --git a/manager/AuthManager.js b/manager/AuthManager.js
index 777f8bc..219d9c2 100644
--- a/manager/AuthManager.js
+++ b/manager/AuthManager.js
@@ -1,13 +1,10 @@
-export function getWeChatAuthCode() {
+export const getWeChatAuthCode = () => {
return new Promise((resolve, reject) => {
uni.login({
provider: 'weixin',
+ onlyAuthorize: true,
success: (res) => {
- if (res.code) {
- resolve(res.code);
- } else {
- reject(new Error('未获取到微信授权code'));
- }
+ resolve(res.code);
},
fail: (err) => {
reject(err);
diff --git a/manager/LoginManager.js b/manager/LoginManager.js
index 73ecd5b..539839c 100644
--- a/manager/LoginManager.js
+++ b/manager/LoginManager.js
@@ -1,20 +1,18 @@
-import { login } from "../request/api/LoginApi";
-
+import { wxLogin, bindUserPhone, checkUserPhone } from "../request/api/LoginApi";
import { getWeChatAuthCode } from "./AuthManager";
-export async function loginAuth() {
+const loginAuth = async () => {
try {
- const openIdCode = 'brother7'// await getWeChatAuthCode();
+ const openIdCode = await getWeChatAuthCode();
console.log('获取到的微信授权code:', openIdCode);
- const response = await login({
+ const response = await wxLogin({
openIdCode: [openIdCode],
- grant_type: 'password',
+ grant_type: 'wechat',
scope: 'server',
- //clientId: '1',
- username: 'admin',
- password: 'YehdBPev',
-
+ clientId: '2'
});
+ console.log('获取到的微信授权response:', response);
+
if (response.access_token) {
uni.setStorageSync('token', response.access_token)
return response;
@@ -25,3 +23,23 @@ export async function loginAuth() {
throw err;
}
}
+
+const bindPhone = async (params) => {
+ try {
+ const response = await bindUserPhone(params)
+ return response;
+ } catch (error) {
+ throw err;
+ }
+}
+
+const checkPhone = async (phone) => {
+ try {
+ const response = await checkUserPhone(phone)
+ return response;
+ } catch (error) {
+ throw err;
+ }
+}
+
+export { loginAuth, bindPhone, checkPhone }
diff --git a/manifest.json b/manifest.json
index 6072690..b8dae08 100644
--- a/manifest.json
+++ b/manifest.json
@@ -48,14 +48,16 @@
/* ios打包配置 */
"ios" : {},
/* SDK配置 */
- "sdkConfigs" : {}
+ "sdkConfigs" : {
+ "oauth" : {}
+ }
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
- "appid" : "wx6d8bb61f9480d79f",
+ "appid" : "wx5e79df5996572539",
"setting" : {
"urlCheck" : false
},
diff --git a/pages.json b/pages.json
index 819dce6..abd84d0 100644
--- a/pages.json
+++ b/pages.json
@@ -1,39 +1,42 @@
{
- "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
- {
- "path": "pages/index/index",
- "style": {
- "navigationStyle": "custom"
- }
-
- },
- {
- "path" : "pages/chat/ChatQuickAccess",
- "style" :
- {
- "navigationBarTitleText" : ""
- }
- },
- {
- "path": "pages/order/list",
- "style": {
- "navigationStyle": "custom"
- }
-
- },
- {
- "path": "pages/order/detail",
- "style": {
- "navigationStyle": "custom"
- }
-
- }
- ],
- "globalStyle": {
- // "navigationBarTextStyle": "black",
- // // "navigationBarTitleText": "小沐",
- // "navigationBarBackgroundColor": "#F8F8F8",
- // "backgroundColor": "#F8F8F8"
- },
- "uniIdRouter": {}
+ "pages": [
+ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+ {
+ "path": "pages/login/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/index/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/chat/ChatQuickAccess",
+ "style": {
+ "navigationBarTitleText": ""
+ }
+ },
+ {
+ "path": "pages/order/list",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/order/detail",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ }
+ ],
+ "globalStyle": {
+ // "navigationBarTextStyle": "black",
+ // // "navigationBarTitleText": "小沐",
+ // "navigationBarBackgroundColor": "#F8F8F8",
+ // "backgroundColor": "#F8F8F8"
+ },
+ "uniIdRouter": {}
}
diff --git a/pages/index/index.vue b/pages/index/index.vue
index fefe79a..ba352ce 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -1,44 +1,42 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/login/images/bg.png b/pages/login/images/bg.png
new file mode 100644
index 0000000..75d644a
Binary files /dev/null and b/pages/login/images/bg.png differ
diff --git a/pages/login/images/dh.png b/pages/login/images/dh.png
new file mode 100644
index 0000000..4c76c7e
Binary files /dev/null and b/pages/login/images/dh.png differ
diff --git a/pages/login/images/dhwq.png b/pages/login/images/dhwq.png
new file mode 100644
index 0000000..d4ab4c0
Binary files /dev/null and b/pages/login/images/dhwq.png differ
diff --git a/pages/login/index.vue b/pages/login/index.vue
new file mode 100644
index 0000000..cc54432
--- /dev/null
+++ b/pages/login/index.vue
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 阅读并同意
+ 《服务协议》
+ 和
+ 《隐私协议》
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/login/prompt.md b/pages/login/prompt.md
new file mode 100644
index 0000000..d3c461b
--- /dev/null
+++ b/pages/login/prompt.md
@@ -0,0 +1,12 @@
+## 登录页面
+
+## 提示词:
+
+使用 uniapp + vue3 组合式 api 开发微信小程序,要求如下:
+1、按照提供的图片高度还原交互设计
+2、要求布局样式结构简洁明了,class 命名请按照模块名称来命名,例如:.login-wrapper
+3、可以使用 uniapp 内置的组件
+
+## 备注
+
+仅供学习、交流使用,请勿用于商业用途。
diff --git a/pages/login/styles/index.scss b/pages/login/styles/index.scss
new file mode 100644
index 0000000..ed22766
--- /dev/null
+++ b/pages/login/styles/index.scss
@@ -0,0 +1,70 @@
+.login-wrapper {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ box-sizing: border-box;
+ font-family: PingFang SC, PingFang SC;
+ height: 100vh;
+ padding-top: 168px;
+ position: relative;
+
+ .bg {
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ z-index: -1;
+ width: 100%;
+ height: 100%;
+ }
+
+
+ .login-header {
+ text-align: center;
+
+ .login-avatar {
+ width: 150px;
+ display: block;
+ }
+
+ .login-title {
+ width: 137px;
+ margin: 6px auto;
+ }
+
+ .login-desc {
+ font-size: 12px;
+ color: #1E4C69;
+ line-height: 24px;
+ }
+ }
+
+ .login-btn-area {
+ margin-top: 46px;
+ width: 297px;
+
+ .login-btn {
+ background: linear-gradient( 246deg, #22A7FF 0%, #2567FF 100%);
+ width: 100%;
+ border-radius: 50px;
+ }
+ }
+
+ .login-agreement {
+ margin-top: 20px;
+ display: flex;
+ align-items: center;
+
+ .login-agreement-text {
+ font-size: 14px;
+ color: #666;
+ }
+
+ .login-agreement-link {
+ font-size: 14px;
+ color: #007aff;
+ margin: 0 5px;
+ }
+ }
+}
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
index 03ad7db..a83384f 100644
--- a/project.config.json
+++ b/project.config.json
@@ -1,5 +1,5 @@
{
- "appid": "wx6d8bb61f9480d79f",
+ "appid": "wx5e79df5996572539",
"compileType": "miniprogram",
"libVersion": "3.8.10",
"packOptions": {
diff --git a/request/api/LoginApi.js b/request/api/LoginApi.js
index e4990da..dc6254d 100644
--- a/request/api/LoginApi.js
+++ b/request/api/LoginApi.js
@@ -1,14 +1,26 @@
import request from "../base/request";
-function login(args) {
+const wxLogin = (args) => {
const config = {
- header: {
- Authorization: 'Basic Y3VzdG9tOmN1c3RvbQ==', // 可在此动态设置 token
- 'Content-Type': 'application/x-www-form-urlencoded'
- },
+ header: {
+ 'Authorization': 'Basic Y3VzdG9tOmN1c3RvbQ==', // 可在此动态设置 token
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ },
};
+
uni.setStorageSync('token', '')
- return request.post('/auth/oauth2/token', args, config);
+
+ return request.post('/auth/oauth2/token', args, config);
}
-export { login }
\ No newline at end of file
+// 绑定用户手机号
+const bindUserPhone = (args) => {
+ return request.post('/hotelBiz/user/bindUserPhone', args);
+}
+
+// 检测用户是否绑定手机号
+const checkUserPhone = (args) => {
+ return request.get('/hotelBiz/user/checkUserHasBindPhone', args);
+}
+
+export { wxLogin, bindUserPhone, checkUserPhone }
\ No newline at end of file