From 7edaec912b6c68a3c55ceb8b12e903505d7f75a9 Mon Sep 17 00:00:00 2001
From: sjeam <359824901@qq.com>
Date: Wed, 3 Sep 2025 11:51:45 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/fly-login/fly-login.vue | 46 +-----
src/interceptors/request.ts | 2 +-
src/pages/my/components/wx-login.vue | 88 ++++++++++-
src/pages/my/index.vue | 58 +-------
src/pages/my/setting.vue | 195 ++++++++++++++++++++-----
src/pages/web_view/index.vue | 13 +-
src/service/crmeb/product.ts | 12 +-
src/style/index.scss | 11 +-
src/utils/index.ts | 25 +++-
9 files changed, 301 insertions(+), 149 deletions(-)
diff --git a/src/components/fly-login/fly-login.vue b/src/components/fly-login/fly-login.vue
index a6b369b..37f43c0 100644
--- a/src/components/fly-login/fly-login.vue
+++ b/src/components/fly-login/fly-login.vue
@@ -1,41 +1,8 @@
+
-
-
-
-
暂不登录
-
@@ -126,7 +84,7 @@ const onSubmit = () => {
height: 100%;
display: flex;
bottom: 0;
- z-index: 1;
+ z-index: 999;
position: fixed;
inset: 0;
diff --git a/src/interceptors/request.ts b/src/interceptors/request.ts
index f055b0f..a0ece44 100644
--- a/src/interceptors/request.ts
+++ b/src/interceptors/request.ts
@@ -84,7 +84,7 @@ const httpInterceptor = {
// if (token) {
// options.header.Authorization = `Bearer ${token.access_token}`
// }
- options.header.Authorization = `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3ZWJtYW4udGlueXdhbi5jbiIsImF1ZCI6IndlYm1hbi50aW55d2FuLmNuIiwiaWF0IjoxNzU2ODAyMTM3LCJuYmYiOjE3NTY4MDIxMzcsImV4cCI6MTc1NjgwOTMzNywiZXh0ZW5kIjp7ImlkIjoyMX19.3Zp61BOC34ZC919a2ifNUoZJb2RAYZxNjH7j_Enj1P0`
+ options.header.Authorization = `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3ZWJtYW4udGlueXdhbi5jbiIsImF1ZCI6IndlYm1hbi50aW55d2FuLmNuIiwiaWF0IjoxNzU2ODYzNDAwLCJuYmYiOjE3NTY4NjM0MDAsImV4cCI6MTc1Njg3MDYwMCwiZXh0ZW5kIjp7ImlkIjoyMX19.5jmRqytXC-mqeNZBvef6vo4fm4RE0T-QR_mGzjZaAYM`
},
}
diff --git a/src/pages/my/components/wx-login.vue b/src/pages/my/components/wx-login.vue
index 4bdf975..33619c4 100644
--- a/src/pages/my/components/wx-login.vue
+++ b/src/pages/my/components/wx-login.vue
@@ -44,17 +44,89 @@
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
diff --git a/src/pages/my/index.vue b/src/pages/my/index.vue
index 26be8d8..72d9300 100644
--- a/src/pages/my/index.vue
+++ b/src/pages/my/index.vue
@@ -6,37 +6,6 @@
-
-
-
-
-
-
-
-
-
-
-
- {{ item.name }}
-
-
-
-
-
-
-
-
@@ -45,32 +14,7 @@ import { useUserStore } from '@/store'
import { http } from '@/utils/http'
import WxLogin from './components/wx-login.vue'
const userStore = useUserStore()
-const hasLogin = computed(() => userStore.userInfo?.nickname)
-
-const openId = ref('')
-
-const logout = () => {
- uni.showModal({
- title: '确认退出当前账号?',
- success: (res) => {
- if (res.confirm) {
- userStore.logout()
- }
- },
- })
-}
-function more(item) {
- if (item.name == '设置') {
- setting()
- return
- }
-}
-
-function setting() {
- uni.navigateTo({
- url: '/pages/my/setting',
- })
-}
+// const hasLogin = computed(() => userStore.userInfo?.nickname)
// userStore.wxLogin()
// // 用户登录,获取openId
diff --git a/src/pages/my/setting.vue b/src/pages/my/setting.vue
index e05b952..0b70b97 100644
--- a/src/pages/my/setting.vue
+++ b/src/pages/my/setting.vue
@@ -35,35 +35,96 @@
:border="false"
size="large"
custom-style="padding:20rpx;font-size:28rpx"
+ @click="showPhone = true"
/>
-
+
+
+
+
+
+
+
+ 提交修改
+
+
+
+
+
-
+
+
@@ -109,26 +173,24 @@ import {
getDistrictAPI,
getStreetAPI,
getVillageAPI,
+ setGroupAPI,
+ setPhoneAPI,
+ setInfoPI,
} from '@/service/crmeb/product.ts'
export default defineComponent({
data() {
return {
hasLogin: false,
- totalPrice: 0,
- pre_price: 0,
- server_user: {
- phone: '',
- public_name: '',
- },
- server_user_id: 0,
- order_id: 0, //订单id
+ showPhone: false,
+ showName: false,
+ show: false,
address_string: '',
- // banquetType: this.getBanquetType(),
+
propShowOrder: false,
area: [],
value: [],
- order_type: 1, //厨师 2 酒店
+
userInfo: {
nickname: '',
phone: '',
@@ -137,6 +199,17 @@ export default defineComponent({
},
address: [],
+ addressinfo: {
+ group_id: 1,
+ phone: '',
+ province: ' ',
+ city: ' ',
+ district: ' ',
+ street: ' ',
+ village: ' ',
+ },
+ nickname: '',
+ phone: '',
// district: 0, //区
// street: 0, //街道
// village: 0, //村
@@ -181,13 +254,16 @@ export default defineComponent({
if (res.code === 1) {
console.log('用户信息:', res.data)
this.userInfo = res.data
+ this.addressinfo.group_id = res.data.group_id
+ this.addressinfo.phone = res.data.phone
+ this.address_string = res.data.district_name + res.data.street_name + res.data.village_name
}
},
- pickDate(e) {
- // this.userInfo.banquet_date = e[0]
- this.showDatePicker = false
- },
+ // pickDate(e) {
+ // // this.userInfo.banquet_date = e[0]
+ // this.showDatePicker = false
+ // },
close() {
this.propShowOrder = false
},
@@ -214,9 +290,63 @@ export default defineComponent({
//选择地址后--记录地址字符串
handleConfirm(value) {
// console.log(value.value.length)
- this.addressNumber = value.value.length
+ // this.addressNumber = value.value.length
this.address_string = value.selectedItems.map((item) => item.label).join('')
+ console.log(value)
+ this.addressinfo.district = this.address[0]
+ this.addressinfo.street = this.address[1]
+ this.addressinfo.village = this.address[2]
+
+ // console.log(this.addressinfo)
+ this.submitGroup()
},
+
+ // async onSubmitInfo() {
+ // if (!this.nickname) {
+ // uni.showToast({
+ // title: '请填写昵称',
+ // icon: 'none',
+ // })
+ // return
+ // }
+
+ // this.userInfo.nickname = this.nickname
+
+ // const data = {
+ // nickname: this.nickname,
+ // }
+ // const res = await setInfoPI(data)
+ // console.log(res)
+ // this.showName = false
+ // },
+ async onSubmitPhone() {
+ if (!this.phone) {
+ uni.showToast({
+ title: '请填写手机号',
+ icon: 'none',
+ })
+ return
+ }
+
+ const phoneRegex = /^1[3-9]\d{9}$/
+ if (!phoneRegex.test(this.phone)) {
+ uni.showToast({
+ title: '手机号格式不正确',
+ icon: 'none',
+ })
+ return
+ }
+ this.userInfo.phone = this.phone
+ const res = await setPhoneAPI(this.phone)
+ console.log(res)
+ this.showPhone = false
+ },
+ async submitGroup() {
+ const res = await setGroupAPI(this.addressinfo)
+ console.log(res)
+ this.show = false
+ },
+
//地址改版事件
async columnChange({ selectedItem, resolve, finish }) {
try {
@@ -264,7 +394,6 @@ export default defineComponent({
finish() // 确保在发生错误时也能完成操作以避免卡顿
}
},
- myOrder() {},
// 返回上一级
goBack() {
diff --git a/src/pages/web_view/index.vue b/src/pages/web_view/index.vue
index c661a7d..efaf73f 100644
--- a/src/pages/web_view/index.vue
+++ b/src/pages/web_view/index.vue
@@ -22,7 +22,7 @@
import { defineComponent, computed } from 'vue'
import CustomNavbar from '@/components/CustomNavbar.vue'
import { getUrlCrmebLogin } from '@/utils'
-
+import { isMpWeixin } from '@/utils/platform'
export default defineComponent({
data() {
return {
@@ -46,8 +46,15 @@ export default defineComponent({
onLoad(option) {
// this.local_url = decodeURIComponent(getUrlCrmebLogin() + option.target)
console.log(getUrlCrmebLogin())
- const target = encodeURIComponent(option.target)
- this.local_url = getUrlCrmebLogin() + '?target=' + target
+ // const target = encodeURIComponent(option.target)
+
+ const target = option.target
+ if (isMpWeixin) {
+ this.local_url = getUrlCrmebLogin() + '?target=' + target
+ } else {
+ this.local_url = getUrlCrmebLogin() + target
+ }
+ console.log(this.local_url)
this.title = option.title || ''
uni.setNavigationBarTitle({
title: this.title, // 运行时修改标题
diff --git a/src/service/crmeb/product.ts b/src/service/crmeb/product.ts
index ce5da11..2625b7d 100644
--- a/src/service/crmeb/product.ts
+++ b/src/service/crmeb/product.ts
@@ -31,16 +31,16 @@ export function getInfoAPI() {
return http.post('/api/user/info', {})
}
-export function setInfoPI() {
- return http.get('/api/user/setInfo', {})
+export function setInfoPI(data: any) {
+ return http.post('/api/user/setInfo', data)
}
-export function setPhoneAPI() {
- return http.get('/api/user/setPhone', {})
+export function setPhoneAPI(phone: any) {
+ return http.post('/api/user/setPhone', { phone: phone })
}
-export function setGroupAPI() {
- return http.get('/api/user/setGroup', {})
+export function setGroupAPI(data: any) {
+ return http.post('/api/user/setGroup', data)
}
export function getCityAPI() {
diff --git a/src/style/index.scss b/src/style/index.scss
index a3a1717..6d77a35 100644
--- a/src/style/index.scss
+++ b/src/style/index.scss
@@ -119,7 +119,16 @@ page {
color: rgba(0, 0, 0, 0.25);
font-size: 12px;
}
-
+.custom-txt {
+ color: black;
+ width: 400rpx;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 40rpx;
+ border-radius: 32rpx;
+}
//文字换行
$container-width: 100%;
$padding-width: 20rpx;
diff --git a/src/utils/index.ts b/src/utils/index.ts
index f58f901..c5660f2 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -164,8 +164,14 @@ export function getEnvBaseUploadUrl() {
export function getUrlCrmebLogin() {
// 请求基准地址
- let baseUrl = import.meta.env.VITE_CRMEB_SERVER_BASEURL_LOGIN
- return baseUrl
+
+ if (isMpWeixin) {
+ let baseUrl = import.meta.env.VITE_CRMEB_SERVER_BASEURL_LOGIN
+ return baseUrl
+ } else {
+ let baseUrl = import.meta.env.VITE_CRMEB_SERVER_BASEURL
+ return baseUrl
+ }
}
export function getUrlCrmeb() {
@@ -179,3 +185,18 @@ export function getUrlCrmebProxy() {
let baseUrl = import.meta.env.VITE_APP_PROXY_PREFIX_CRMEB
return baseUrl
}
+
+// 代登录跳转
+export function getWebUrl(url) {
+ console.log(url)
+ return uni.navigateTo({
+ url: `/pages/web_view/index?target=${url}`,
+ })
+}
+//模块跳转
+export function getUrl(url) {
+ console.log(url)
+ return uni.navigateTo({
+ url: url,
+ })
+}