diff --git a/.env.local b/.env.local
index 466a285..e2bf5be 100644
--- a/.env.local
+++ b/.env.local
@@ -1,2 +1,2 @@
-VITE_API_BASE_URL=http://localhost:80
+VITE_API_BASE_URL=http://localhost:48080
VITE_APP_TITLE=湖南12301文旅专区
diff --git a/app.js b/app.js
deleted file mode 100644
index 1ed57c4..0000000
--- a/app.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// app.js
-App({
- onLaunch() {
- // 展示本地存储能力
- const logs = wx.getStorageSync('logs') || []
- logs.unshift(Date.now())
- wx.setStorageSync('logs', logs)
-
- // 登录
- wx.login({
- success: res => {
- // 发送 res.code 到后台换取 openId, sessionKey, unionId
- }
- })
- },
- globalData: {
- userInfo: null
- }
-})
diff --git a/app.json b/app.json
deleted file mode 100644
index 042e029..0000000
--- a/app.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "pages": [
- "pages/index/index",
- "pages/logs/logs"
- ],
- "window": {
- "navigationBarTextStyle": "black",
- "navigationBarTitleText": "Weixin",
- "navigationBarBackgroundColor": "#ffffff"
- },
- "style": "v2",
- "componentFramework": "glass-easel",
- "sitemapLocation": "sitemap.json",
- "lazyCodeLoading": "requiredComponents"
-}
diff --git a/app.wxss b/app.wxss
deleted file mode 100644
index 06c6fc9..0000000
--- a/app.wxss
+++ /dev/null
@@ -1,10 +0,0 @@
-/**app.wxss**/
-.container {
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- padding: 200rpx 0;
- box-sizing: border-box;
-}
diff --git a/pages/index/index.js b/pages/index/index.js
deleted file mode 100644
index a8d6aa5..0000000
--- a/pages/index/index.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// index.js
-const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
-
-Page({
- data: {
- motto: 'Hello World',
- userInfo: {
- avatarUrl: defaultAvatarUrl,
- nickName: '',
- },
- hasUserInfo: false,
- canIUseGetUserProfile: wx.canIUse('getUserProfile'),
- canIUseNicknameComp: wx.canIUse('input.type.nickname'),
- },
- bindViewTap() {
- wx.navigateTo({
- url: '../logs/logs'
- })
- },
- onChooseAvatar(e) {
- const { avatarUrl } = e.detail
- const { nickName } = this.data.userInfo
- this.setData({
- "userInfo.avatarUrl": avatarUrl,
- hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
- })
- },
- onInputChange(e) {
- const nickName = e.detail.value
- const { avatarUrl } = this.data.userInfo
- this.setData({
- "userInfo.nickName": nickName,
- hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
- })
- },
- getUserProfile(e) {
- // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
- wx.getUserProfile({
- desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
- success: (res) => {
- console.log(res)
- this.setData({
- userInfo: res.userInfo,
- hasUserInfo: true
- })
- }
- })
- },
-})
diff --git a/pages/index/index.json b/pages/index/index.json
deleted file mode 100644
index b55b5a2..0000000
--- a/pages/index/index.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "usingComponents": {
- }
-}
\ No newline at end of file
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
deleted file mode 100644
index 0721ba0..0000000
--- a/pages/index/index.wxml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
- 昵称
-
-
-
-
-
- 请使用2.10.4及以上版本基础库
-
-
-
- {{userInfo.nickName}}
-
-
-
- {{motto}}
-
-
-
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
deleted file mode 100644
index 1ebed4b..0000000
--- a/pages/index/index.wxss
+++ /dev/null
@@ -1,62 +0,0 @@
-/**index.wxss**/
-page {
- height: 100vh;
- display: flex;
- flex-direction: column;
-}
-.scrollarea {
- flex: 1;
- overflow-y: hidden;
-}
-
-.userinfo {
- display: flex;
- flex-direction: column;
- align-items: center;
- color: #aaa;
- width: 80%;
-}
-
-.userinfo-avatar {
- overflow: hidden;
- width: 128rpx;
- height: 128rpx;
- margin: 20rpx;
- border-radius: 50%;
-}
-
-.usermotto {
- margin-top: 200px;
-}
-
-.avatar-wrapper {
- padding: 0;
- width: 56px !important;
- border-radius: 8px;
- margin-top: 40px;
- margin-bottom: 40px;
-}
-
-.avatar {
- display: block;
- width: 56px;
- height: 56px;
-}
-
-.nickname-wrapper {
- display: flex;
- width: 100%;
- padding: 16px;
- box-sizing: border-box;
- border-top: .5px solid rgba(0, 0, 0, 0.1);
- border-bottom: .5px solid rgba(0, 0, 0, 0.1);
- color: black;
-}
-
-.nickname-label {
- width: 105px;
-}
-
-.nickname-input {
- flex: 1;
-}
diff --git a/sitemap.json b/sitemap.json
deleted file mode 100644
index ca02add..0000000
--- a/sitemap.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
- "rules": [{
- "action": "allow",
- "page": "*"
- }]
-}
\ No newline at end of file
diff --git a/src/api/index.ts b/src/api/index.ts
deleted file mode 100644
index 46ff3a6..0000000
--- a/src/api/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export * from './types'
-export * from './user'
-export * from './card'
-export * from './order'
-export { get, post, put, del, getToken, setToken, removeToken } from './request'
diff --git a/src/api/types.ts b/src/api/types.ts
index d56dfda..12b2a7e 100644
--- a/src/api/types.ts
+++ b/src/api/types.ts
@@ -16,12 +16,6 @@ export interface WxLoginResult {
expiresTime: string
}
-/** 账号密码登录参数(降级方案) */
-export interface LoginParams {
- username: string
- password: string
-}
-
/** 年卡基本信息 */
export interface CardInfo {
id: string
diff --git a/src/api/user.ts b/src/api/user.ts
index 7b4093a..bc911de 100644
--- a/src/api/user.ts
+++ b/src/api/user.ts
@@ -1,19 +1,14 @@
import { get, post } from './request'
-import type { UserInfo, WxLoginResult, LoginParams } from './types'
+import type { UserInfo, WxLoginResult } from './types'
/** 微信小程序登录(loginCode + phoneCode) */
export function wxLogin(data: { loginCode: string; phoneCode: string }): Promise {
return post('/auth/wx-login', data, false)
}
-/** 账号密码登录(降级方案) */
-export function login(params: LoginParams): Promise {
- return post('/auth/login', params, false)
-}
-
/** 获取当前用户信息 */
export function getUserInfo(): Promise {
return get('/user/info')
}
-export type { UserInfo, WxLoginResult, LoginParams }
+export type { UserInfo, WxLoginResult }
diff --git a/src/components/McGlass.vue b/src/components/McGlass.vue
new file mode 100644
index 0000000..4b2589c
--- /dev/null
+++ b/src/components/McGlass.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/manifest.json b/src/manifest.json
index 98232c6..51e55d4 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1 +1,11 @@
{
+ "mp-weixin": {
+ "appid": "wx636bc46a6570e9fd",
+ "setting": {
+ "urlCheck": false,
+ "es6": true,
+ "postcss": false,
+ "minified": false
+ }
+ }
+}
diff --git a/src/packages/user/pages/card/activate.vue b/src/packages/user/pages/card/activate.vue
index a3870ad..0deb0a2 100644
--- a/src/packages/user/pages/card/activate.vue
+++ b/src/packages/user/pages/card/activate.vue
@@ -32,10 +32,9 @@
-
-
diff --git a/src/pages.json b/src/pages.json
index 33a0667..f5f3155 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -1,103 +1,97 @@
{
- "easycom": {
- "autoscan": true,
- "custom": {
- "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
- }
- },
- "pages": [
- {
- "path": "pages/index/index",
- "style": {
- "navigationBarTitleText": "湖南12301"
- }
- },
- {
- "path": "pages/login/login",
- "style": {
- "navigationBarTitleText": "登录"
- }
- }
- ],
- "subPackages": [
- {
- "root": "packages/user",
- "pages": [
- {
- "path": "pages/index/index",
- "style": {
- "navigationBarTitleText": "文旅专区"
- }
- },
- {
- "path": "pages/card/list",
- "style": {
- "navigationBarTitleText": "年卡列表"
- }
- },
- {
- "path": "pages/card/detail",
- "style": {
- "navigationBarTitleText": "年卡详情"
- }
- },
- {
- "path": "pages/card/buy",
- "style": {
- "navigationBarTitleText": "确认购买"
- }
- },
- {
- "path": "pages/card/activate",
- "style": {
- "navigationBarTitleText": "激活年卡"
- }
- },
- {
- "path": "pages/card/qrcode",
- "style": {
- "navigationBarTitleText": "入园码"
- }
- },
- {
- "path": "pages/card/bind",
- "style": {
- "navigationBarTitleText": "绑定年卡"
- }
- },
- {
- "path": "pages/profile/index",
- "style": {
- "navigationBarTitleText": "个人中心"
- }
- }
- ]
- }
- ],
- "globalStyle": {
- "navigationBarTextStyle": "black",
- "navigationBarTitleText": "湖南12301",
- "navigationBarBackgroundColor": "#FFFFFF",
- "backgroundColor": "#F5F5F5"
- },
- "tabBar": {
- "color": "#7A7E83",
- "selectedColor": "#4A90D9",
- "borderStyle": "white",
- "backgroundColor": "#ffffff",
- "list": [
- {
- "pagePath": "packages/user/pages/index/index",
- "text": "首页",
- "iconPath": "static/tabbar/home.png",
- "selectedIconPath": "static/tabbar/home-active.png"
- },
- {
- "pagePath": "packages/user/pages/profile/index",
- "text": "我的",
- "iconPath": "static/tabbar/profile.png",
- "selectedIconPath": "static/tabbar/profile-active.png"
- }
- ]
- }
+ "easycom": {
+ "autoscan": true,
+ "custom": {
+ "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
+ }
+ },
+ "pages": [
+ {
+ "path": "pages/index/index",
+ "style": {
+ "navigationBarTitleText": "文旅专区"
+ }
+ },
+ {
+ "path": "pages/login/login",
+ "style": {
+ "navigationBarTitleText": "登录"
+ }
+ },
+ {
+ "path": "pages/profile/index",
+ "style": {
+ "navigationBarTitleText": "个人中心"
+ }
+ }
+ ],
+ "subPackages": [
+ {
+ "root": "packages/user",
+ "pages": [
+ {
+ "path": "pages/card/list",
+ "style": {
+ "navigationBarTitleText": "年卡列表"
+ }
+ },
+ {
+ "path": "pages/card/detail",
+ "style": {
+ "navigationBarTitleText": "年卡详情"
+ }
+ },
+ {
+ "path": "pages/card/buy",
+ "style": {
+ "navigationBarTitleText": "确认购买"
+ }
+ },
+ {
+ "path": "pages/card/activate",
+ "style": {
+ "navigationBarTitleText": "激活年卡"
+ }
+ },
+ {
+ "path": "pages/card/qrcode",
+ "style": {
+ "navigationBarTitleText": "入园码"
+ }
+ },
+ {
+ "path": "pages/card/bind",
+ "style": {
+ "navigationBarTitleText": "绑定年卡"
+ }
+ }
+ ]
+ }
+ ],
+ "globalStyle": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "湖南12301",
+ "navigationBarBackgroundColor": "#FFFFFF",
+ "backgroundColor": "#F5F5F5"
+ },
+ "tabBar": {
+ "color": "#7A7E83",
+ "selectedColor": "#4A90D9",
+ "borderStyle": "white",
+ "backgroundColor": "#ffffff",
+ "list": [
+ {
+ "pagePath": "pages/index/index",
+ "text": "首页",
+ "iconPath": "static/tabbar/home.png",
+ "selectedIconPath": "static/tabbar/home-active.png"
+ },
+ {
+ "pagePath": "pages/profile/index",
+ "text": "我的",
+ "iconPath": "static/tabbar/profile.png",
+ "selectedIconPath": "static/tabbar/profile-active.png"
+ }
+ ]
+ }
}
diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue
index 10bde67..1dd8fe7 100644
--- a/src/pages/login/login.vue
+++ b/src/pages/login/login.vue
@@ -7,36 +7,12 @@
-
-
-
-
-
- 请在微信小程序中使用本应用
-
-
-
- 账号
-
-
-
- 密码
-
-
-
-
-
-
@@ -49,18 +25,12 @@
diff --git a/src/store/card.ts b/src/store/card.ts
deleted file mode 100644
index fa89e13..0000000
--- a/src/store/card.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { defineStore } from 'pinia'
-import { ref } from 'vue'
-import * as cardApi from '../api/card'
-import type { CardInfo, CardDetail, MyCard, ActivateParams, QrCodeInfo } from '../api/types'
-
-export const useCardStore = defineStore('card', () => {
- const cardList = ref([])
- const currentCard = ref(null)
- const myCards = ref([])
- const loading = ref(false)
-
- /** 获取年卡列表 */
- async function fetchCardList(params?: { keyword?: string; category?: string }) {
- loading.value = true
- try {
- cardList.value = await cardApi.getCardList(params)
- } finally {
- loading.value = false
- }
- }
-
- /** 获取年卡详情 */
- async function fetchCardDetail(id: string) {
- loading.value = true
- try {
- currentCard.value = await cardApi.getCardDetail(id)
- } finally {
- loading.value = false
- }
- }
-
- /** 获取我的年卡 */
- async function fetchMyCards() {
- myCards.value = await cardApi.getMyCards()
- }
-
- /** 激活年卡 */
- async function activateCard(cardId: string, data: ActivateParams) {
- return await cardApi.activateCard(cardId, data)
- }
-
- /** 绑定年卡 */
- async function bindCard(cardNo: string) {
- return await cardApi.bindCard(cardNo)
- }
-
- /** 获取入园码 */
- async function getEntryQrCode(cardId: string): Promise {
- return await cardApi.getEntryQrCode(cardId)
- }
-
- return {
- cardList,
- currentCard,
- myCards,
- loading,
- fetchCardList,
- fetchCardDetail,
- fetchMyCards,
- activateCard,
- bindCard,
- getEntryQrCode
- }
-})
diff --git a/src/store/user.ts b/src/store/user.ts
index 6956b77..15682fb 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -1,8 +1,8 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { getToken, setToken, removeToken } from '../api/request'
-import { wxLogin as apiWxLogin, login as apiLogin, getUserInfo as apiGetUserInfo } from '../api/user'
-import type { UserInfo, LoginParams } from '../api/types'
+import { wxLogin as apiWxLogin, getUserInfo as apiGetUserInfo } from '../api/user'
+import type { UserInfo } from '../api/types'
import { TOKEN_KEY, REFRESH_TOKEN_KEY } from '../config'
export const useUserStore = defineStore('user', () => {
@@ -22,16 +22,6 @@ export const useUserStore = defineStore('user', () => {
return result
}
- /** 账号密码登录(降级方案) */
- async function login(params: LoginParams) {
- const result = await apiLogin(params)
- token.value = result.accessToken
- refreshToken.value = result.refreshToken
- setToken(result.accessToken)
- uni.setStorageSync(REFRESH_TOKEN_KEY, result.refreshToken)
- return result
- }
-
/** 获取用户信息 */
async function fetchUserInfo() {
if (!token.value) return
@@ -55,7 +45,6 @@ export const useUserStore = defineStore('user', () => {
userInfo,
isLogin,
wxLogin,
- login,
fetchUserInfo,
logout
}
diff --git a/utils/util.js b/utils/util.js
deleted file mode 100644
index 764bc2c..0000000
--- a/utils/util.js
+++ /dev/null
@@ -1,19 +0,0 @@
-const formatTime = date => {
- const year = date.getFullYear()
- const month = date.getMonth() + 1
- const day = date.getDate()
- const hour = date.getHours()
- const minute = date.getMinutes()
- const second = date.getSeconds()
-
- return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
-}
-
-const formatNumber = n => {
- n = n.toString()
- return n[1] ? n : `0${n}`
-}
-
-module.exports = {
- formatTime
-}