From 3382462036dd84d1e6a59de99beb3111a5c4d3a4 Mon Sep 17 00:00:00 2001
From: Strange <3304393868@qq.com>
Date: Sun, 16 Jun 2024 09:04:56 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
comm/api.js | 17 ++
main.js | 3 +
manifest.json | 2 +-
pages.json | 7 +
pages/user/login.vue | 52 +++++
pages/user/user.vue | 31 ++-
unpackage/dist/dev/mp-weixin/app.js | 1 +
unpackage/dist/dev/mp-weixin/app.json | 3 +-
unpackage/dist/dev/mp-weixin/comm/api.js | 17 ++
unpackage/dist/dev/mp-weixin/common/vendor.js | 221 ++++++++++++++++--
.../components/u-button/u-button.js | 199 ++++++++++++++++
.../components/u-button/u-button.json | 7 +
.../components/u-button/u-button.wxml | 1 +
.../components/u-button/u-button.wxss | 188 +++++++++++++++
.../uview-plus/components/u-icon/u-icon.js | 2 +-
.../uview-plus/components/u-line/u-line.js | 2 +-
.../uview-plus/components/u-link/u-link.js | 2 +-
.../u-loading-icon/u-loading-icon.js | 2 +-
.../u-swiper-indicator/u-swiper-indicator.js | 2 +-
.../dist/dev/mp-weixin/pages/user/login.js | 57 +++++
.../dist/dev/mp-weixin/pages/user/login.json | 7 +
.../dist/dev/mp-weixin/pages/user/login.wxml | 1 +
.../dist/dev/mp-weixin/pages/user/login.wxss | 6 +
.../dist/dev/mp-weixin/pages/user/user.js | 28 ++-
.../dist/dev/mp-weixin/project.config.json | 5 +-
unpackage/dist/dev/mp-weixin/utils/Auth.js | 15 ++
unpackage/dist/dev/mp-weixin/utils/http.js | 37 +++
utils/Auth.js | 14 ++
utils/http.js | 60 +++++
utils/location.js | 24 ++
utils/msg.js | 13 ++
31 files changed, 982 insertions(+), 44 deletions(-)
create mode 100644 comm/api.js
create mode 100644 pages/user/login.vue
create mode 100644 unpackage/dist/dev/mp-weixin/comm/api.js
create mode 100644 unpackage/dist/dev/mp-weixin/node-modules/uview-plus/components/u-button/u-button.js
create mode 100644 unpackage/dist/dev/mp-weixin/node-modules/uview-plus/components/u-button/u-button.json
create mode 100644 unpackage/dist/dev/mp-weixin/node-modules/uview-plus/components/u-button/u-button.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/node-modules/uview-plus/components/u-button/u-button.wxss
create mode 100644 unpackage/dist/dev/mp-weixin/pages/user/login.js
create mode 100644 unpackage/dist/dev/mp-weixin/pages/user/login.json
create mode 100644 unpackage/dist/dev/mp-weixin/pages/user/login.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/pages/user/login.wxss
create mode 100644 unpackage/dist/dev/mp-weixin/utils/Auth.js
create mode 100644 unpackage/dist/dev/mp-weixin/utils/http.js
create mode 100644 utils/Auth.js
create mode 100644 utils/http.js
create mode 100644 utils/location.js
create mode 100644 utils/msg.js
diff --git a/comm/api.js b/comm/api.js
new file mode 100644
index 0000000..712a613
--- /dev/null
+++ b/comm/api.js
@@ -0,0 +1,17 @@
+import {http} from "../utils/http.js"
+
+
+export function loginByCode(data){
+ return http({
+ url:"/api/wxLogin",
+ data,
+ method:'post'
+ })
+}
+
+export function userInfo(){
+ return http({
+ url:"/api/getUserInfo",
+ method:'get'
+ })
+}
\ No newline at end of file
diff --git a/main.js b/main.js
index b6db895..4c32b33 100644
--- a/main.js
+++ b/main.js
@@ -3,10 +3,13 @@ import App from './App'
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
+import msg from "./utils/msg.js"
Vue.config.productionTip = false
App.mpType = 'app'
+Vue.prototype.$msg = msg
import uviewPlus from 'uview-plus'
+
const app = new Vue({
...App
})
diff --git a/manifest.json b/manifest.json
index 79505cf..2f92ccf 100644
--- a/manifest.json
+++ b/manifest.json
@@ -50,7 +50,7 @@
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
- "appid" : "",
+ "appid" : "wx0beef2b22e05d3d1",
"setting" : {
"urlCheck" : false
},
diff --git a/pages.json b/pages.json
index c95a15a..4719ebe 100644
--- a/pages.json
+++ b/pages.json
@@ -28,6 +28,13 @@
"navigationStyle": "custom",
"disableScroll": false
}
+ },
+ {
+ "path": "pages/user/login",
+ "style": {
+ "navigationBarTitleText": "登录",
+ "navigationStyle": "default"
+ }
}
],
"globalStyle": {
diff --git a/pages/user/login.vue b/pages/user/login.vue
new file mode 100644
index 0000000..665ff59
--- /dev/null
+++ b/pages/user/login.vue
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/user.vue b/pages/user/user.vue
index 4bd8480..f2e4064 100644
--- a/pages/user/user.vue
+++ b/pages/user/user.vue
@@ -4,10 +4,10 @@
reactive
} from 'vue';
import {
- onLoad
+ onLoad,onShow
} from "@dcloudio/uni-app"
-
-
+ import {isLogin,getToken} from "../../utils/Auth.js"
+ import {loginByCode,userInfo} from "@/comm/api.js"
const serviceList = reactive([{
title: "个人信息",
thumb: '/static/icon/icon_wdgrxx.png',
@@ -25,9 +25,24 @@
avatar: "/static/icon/tx.png",
nickName: "点击登录"
})
-
+ function gologin(){
+ console.log(getToken())
+ if(isLogin()){
+ return
+ }
+ uni.navigateTo({
+ url:"/pages/user/login"
+ })
+ }
+ async function getUserInfo(){
+ const resp = await userInfo()
+ console.log(resp)
+ user.value = resp.data
+ }
+ onShow(()=>{
+ getUserInfo()
+ })
onLoad(() => {
-
})
@@ -36,13 +51,13 @@
我的
-
+
- {{user.nickName}}
+ {{user.username}}
- {{user.phonenumber}}
+ {{user.phoneNumber}}
diff --git a/unpackage/dist/dev/mp-weixin/app.js b/unpackage/dist/dev/mp-weixin/app.js
index e773c07..d137b92 100644
--- a/unpackage/dist/dev/mp-weixin/app.js
+++ b/unpackage/dist/dev/mp-weixin/app.js
@@ -5,6 +5,7 @@ if (!Math) {
"./pages/index/index.js";
"./pages/news/news.js";
"./pages/user/user.js";
+ "./pages/user/login.js";
}
const _sfc_main = {
onLaunch: function() {
diff --git a/unpackage/dist/dev/mp-weixin/app.json b/unpackage/dist/dev/mp-weixin/app.json
index 1ef0c15..2bba785 100644
--- a/unpackage/dist/dev/mp-weixin/app.json
+++ b/unpackage/dist/dev/mp-weixin/app.json
@@ -2,7 +2,8 @@
"pages": [
"pages/index/index",
"pages/news/news",
- "pages/user/user"
+ "pages/user/user",
+ "pages/user/login"
],
"window": {
"navigationBarTextStyle": "black",
diff --git a/unpackage/dist/dev/mp-weixin/comm/api.js b/unpackage/dist/dev/mp-weixin/comm/api.js
new file mode 100644
index 0000000..64ddf19
--- /dev/null
+++ b/unpackage/dist/dev/mp-weixin/comm/api.js
@@ -0,0 +1,17 @@
+"use strict";
+const utils_http = require("../utils/http.js");
+function loginByCode(data) {
+ return utils_http.http({
+ url: "/api/wxLogin",
+ data,
+ method: "post"
+ });
+}
+function userInfo() {
+ return utils_http.http({
+ url: "/api/getUserInfo",
+ method: "get"
+ });
+}
+exports.loginByCode = loginByCode;
+exports.userInfo = userInfo;
diff --git a/unpackage/dist/dev/mp-weixin/common/vendor.js b/unpackage/dist/dev/mp-weixin/common/vendor.js
index 664c81d..32af752 100644
--- a/unpackage/dist/dev/mp-weixin/common/vendor.js
+++ b/unpackage/dist/dev/mp-weixin/common/vendor.js
@@ -6872,6 +6872,7 @@ const createSubpackageApp = initCreateSubpackageApp();
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
};
+const onShow = /* @__PURE__ */ createHook(ON_SHOW);
const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
const version = "3";
{
@@ -8416,7 +8417,7 @@ const defProps = {
...Transition,
...Upload
};
-const props$d = {
+const props$e = {
props: {
// 搜索框形状,round-圆形,square-方形
shape: {
@@ -9275,7 +9276,7 @@ const mixin = {
}
}
};
-const props$c = {
+const props$d = {
props: {
// 列表数组,元素可为字符串,如为对象可通过keyName指定目标属性名
list: {
@@ -9400,7 +9401,7 @@ const props$c = {
}
}
};
-const props$b = {
+const props$c = {
props: {
// 宫格的name
name: {
@@ -9414,7 +9415,7 @@ const props$b = {
}
}
};
-const props$a = {
+const props$b = {
props: {
// 分成几列
col: {
@@ -9433,7 +9434,7 @@ const props$a = {
}
}
};
-const props$9 = {
+const props$a = {
props: {
// 主题颜色
type: {
@@ -9655,7 +9656,7 @@ const openType = {
}
}
};
-const props$8 = {
+const props$9 = {
props: {
// 头像图片路径(不能为相对路径)
src: {
@@ -9733,7 +9734,7 @@ const props$8 = {
}
}
};
-const props$7 = {
+const props$8 = {
props: {
// 标题
title: {
@@ -9843,7 +9844,7 @@ const props$7 = {
}
}
};
-const props$6 = {
+const props$7 = {
props: {
// 用于滚动到指定item
anchor: {
@@ -9852,7 +9853,7 @@ const props$6 = {
}
}
};
-const props$5 = {
+const props$6 = {
props: {
// 控制是否出现滚动条,仅nvue有效
showScrollbar: {
@@ -9951,6 +9952,176 @@ const props$5 = {
}
}
};
+const props$5 = {
+ props: {
+ // 是否细边框
+ hairline: {
+ type: Boolean,
+ default: () => defProps.button.hairline
+ },
+ // 按钮的预置样式,info,primary,error,warning,success
+ type: {
+ type: String,
+ default: () => defProps.button.type
+ },
+ // 按钮尺寸,large,normal,small,mini
+ size: {
+ type: String,
+ default: () => defProps.button.size
+ },
+ // 按钮形状,circle(两边为半圆),square(带圆角)
+ shape: {
+ type: String,
+ default: () => defProps.button.shape
+ },
+ // 按钮是否镂空
+ plain: {
+ type: Boolean,
+ default: () => defProps.button.plain
+ },
+ // 是否禁止状态
+ disabled: {
+ type: Boolean,
+ default: () => defProps.button.disabled
+ },
+ // 是否加载中
+ loading: {
+ type: Boolean,
+ default: () => defProps.button.loading
+ },
+ // 加载中提示文字
+ loadingText: {
+ type: [String, Number],
+ default: () => defProps.button.loadingText
+ },
+ // 加载状态图标类型
+ loadingMode: {
+ type: String,
+ default: () => defProps.button.loadingMode
+ },
+ // 加载图标大小
+ loadingSize: {
+ type: [String, Number],
+ default: () => defProps.button.loadingSize
+ },
+ // 开放能力,具体请看uniapp稳定关于button组件部分说明
+ // https://uniapp.dcloud.io/component/button
+ openType: {
+ type: String,
+ default: () => defProps.button.openType
+ },
+ // 用于