页面
Some checks are pending
Auto Merge Main to Other Branches / Merge main into i18n (push) Waiting to run
Auto Merge Main to Other Branches / Merge main into base-sard-ui (push) Waiting to run

This commit is contained in:
sjeam 2025-09-03 11:51:45 +08:00
parent 649470558e
commit 7edaec912b
9 changed files with 301 additions and 149 deletions

View File

@ -1,41 +1,8 @@
<template>
<!-- <view class="fly-login" v-if="modelValue"></view> -->
<view class="fly-login" v-if="modelValue">
<view class="fly-login-mask" />
<view class="fly-login-content px-4">
<!-- <view class="font-bold h-16 leading-16">获取您的昵称头像</view> -->
<!-- <view
class="rounded-full bg-light-600 w-6 h-6 text-center absolute top-4 right-4"
@click="onClose"
>
<view class="i-carbon-close text-gray-700" />
</view> -->
<!-- <view
class="flex items-center h-16 leading-16 border-b-gray-400 border-b-solid border-[0rpx]"
>
<text class="mr-4 flex-shrink-0">头像</text>
<button
class="bg-transparent flex items-center after:b-none w-full h-12 leading-12"
open-type="chooseAvatar"
@chooseavatar="onChooseAvatar"
>
<image class="w-8 h-8 rounded-full" :src="avatarUrl"></image>
<text class="ml-auto i-carbon-chevron-right"></text>
</button>
</view>
<view
class="flex items-center h-16 leading-16 border-b-gray-400 border-b-solid border-[0rpx] mt-2"
>
<text class="mr-4 flex-shrink-0">昵称</text>
<input
type="nickname"
placeholder="请输入昵称"
v-model="nickname"
@change="onChange"
@blur="onChange"
/>
</view> -->
<view class="text-center m-10">
<wd-button
type="primary"
@ -50,15 +17,6 @@
<view class="text-center">
<text class="color-white font-bold font-size-4 text-shadow" @click="onClose">暂不登录</text>
</view>
<!-- <button
size="default"
type="default"
style="color: #fff; background-color: #1aad19; border-color: #1aad19"
class="text-center leading-12 w-60 my-4"
@click="onSubmit"
>
授权登录
</button> -->
</view>
</view>
</template>
@ -126,7 +84,7 @@ const onSubmit = () => {
height: 100%;
display: flex;
bottom: 0;
z-index: 1;
z-index: 999;
position: fixed;
inset: 0;

View File

@ -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`
},
}

View File

@ -44,17 +44,89 @@
</view>
</wd-card>
</view>
<view class="p-2">
<wd-card>
<wd-grid :gutter="2" :column="4">
<view
@click="more(item)"
v-for="item in [
{
name: '我的钱包',
url: '/pages/users/user_money/index',
type: 2,
icon: '/static/icons/village_service.png',
color: 'green',
},
{
name: '我的订单',
url: '/pages/users/user_money/index',
type: 2,
icon: '/static/icons/village_service.png',
color: 'green',
},
{
name: '我的收藏',
url: '/pages/users/user_goods_collection/index',
type: 2,
icon: '/static/icons/agriculture_service.png',
color: 'blue',
},
{
name: '浏览记录',
url: '/pages/users/browsingHistory/index',
type: 2,
icon: '/static/icons/agriculture_service.png',
color: 'blue',
},
{
name: '问题反馈',
url: '/pages/users/feedback/index',
type: 2,
icon: '/static/icons/rural_ecommerce.png',
color: 'red',
},
{
name: '平台客服',
url: '17309090670',
type: 2,
icon: '/static/icons/rural_ecommerce.png',
color: 'red',
},
{
name: '设置',
url: '/pages/my/setting',
type: 1,
icon: '/static/icons/rural_ecommerce.png',
color: 'red',
},
]"
>
<wd-grid-item use-slot>
<view class="p-2">
<wd-img radius="20rpx" :width="'100rpx'" :height="'100rpx'" :src="item.icon" />
<view class="ps-2 pt-2 pb-2 text-center text-gray-500 font-size-3">
{{ item.name }}
</view>
</view>
</wd-grid-item>
</view>
</wd-grid>
</wd-card>
<button v-if="!hasLogin" class="mt-2" @click="logout">退出登录</button>
</view>
<fly-login v-model="show" />
</view>
</template>
<script lang="ts" setup name="WxLogin">
import { useUserStore } from '@/store'
import { getUrl, getWebUrl } from '@/utils'
const show = ref(false)
const userStore = useUserStore()
console.log('获取用户信息', userStore.userInfo)
const hasLogin = computed(() => userStore.userInfo?.nickname)
const hasLogin = computed(() => userStore.userInfo?.id)
const logout = () => {
uni.showModal({
title: '确认退出当前账号?',
@ -65,4 +137,16 @@ const logout = () => {
},
})
}
function more(item) {
if (hasLogin.value) {
show.value = true
return
}
if (item.type == 1) {
getUrl(item.url)
} else if (item.type == 2) {
getWebUrl(item.url)
}
}
</script>

View File

@ -6,37 +6,6 @@
<template>
<view>
<wx-login />
<!-- <view class="ml-4">wx的openid:</view> -->
<!-- <view class="ml-4">{{ openId }}</view> -->
<view class="p-2">
<wd-card>
<wd-grid :gutter="2" :column="4">
<view
@click="more(item)"
v-for="item in [
{ name: '我的订单', icon: '/static/icons/village_service.png', color: 'green' },
{ name: '我的收藏', icon: '/static/icons/agriculture_service.png', color: 'blue' },
{ name: '我的评论', icon: '/static/icons/agriculture_course.png', color: 'orange' },
{ name: '我的点赞', icon: '/static/icons/rural_ecommerce.png', color: 'red' },
{ name: '我的券包', icon: '/static/icons/rural_ecommerce.png', color: 'red' },
{ name: '我的预约', icon: '/static/icons/rural_ecommerce.png', color: 'red' },
{ name: '设置', icon: '/static/icons/rural_ecommerce.png', color: 'red' },
]"
>
<wd-grid-item use-slot>
<view class="p-2">
<wd-img radius="20rpx" :width="'100rpx'" :height="'100rpx'" :src="item.icon" />
<view class="ps-2 pt-2 pb-2 text-center text-gray-500 font-size-3">
{{ item.name }}
</view>
</view>
</wd-grid-item>
</view>
</wd-grid>
</wd-card>
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
</view>
</view>
</template>
@ -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

View File

@ -35,35 +35,96 @@
:border="false"
size="large"
custom-style="padding:20rpx;font-size:28rpx"
@click="showPhone = true"
/>
<wd-cell
icon="order"
title="我的订单"
icon=""
title="地址"
is-link
value=""
right-icon="lock"
:value="address_string"
:border="false"
size="large"
custom-style="padding:20rpx;font-size:28rpx"
@click="myOrder"
@click="show = true"
/>
<wd-cell
title="我的钱包"
is-link
to="/pages/index/index"
:border="false"
</wd-cell-group>
<!-- <wd-popup
v-model="showName"
position="bottom"
custom-style="height: 480rpx;padding:20rpx;font-size:28rpx"
>
<wd-input
label="修改昵称"
type="text"
prop="nickname"
no-border
center
size="large"
custom-style="padding:20rpx;font-size:28rpx"
>
<view class="custom-text"></view>
</wd-cell>
clearable
v-model="nickname"
placeholder="请填写昵称"
/>
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
<view class="text-center m-10">
<wd-button
type="primary"
custom-class="font-bold font-size-4 "
block
size="large"
@click="onSubmitInfo"
>
<text class="color-white font-bold font-size-4 text-shadow">提交修改</text>
</wd-button>
</view>
</wd-popup> -->
<wd-popup
v-model="showPhone"
position="bottom"
custom-style="height: 480rpx;padding:20rpx;font-size:28rpx"
>
<wd-input
label="修改手机号"
type="number"
prop="phone"
no-border
center
size="large"
clearable
v-model="phone"
placeholder="请填写联系电话"
:rules="[{ required: false, pattern: /^1[3-9]\d{9}$/, message: '请输入有效手机号码' }]"
/>
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
<view class="text-center m-10">
<wd-button
type="primary"
custom-class="font-bold font-size-4 "
block
size="large"
@click="onSubmitPhone"
>
<text class="color-white font-bold font-size-4 text-shadow">提交修改</text>
</wd-button>
</view>
</wd-popup>
<wd-popup
v-model="show"
position="bottom"
custom-style="height: 480rpx;padding:20rpx;font-size:28rpx"
>
<wd-col-picker
label="做宴地址"
label="修改地址"
v-model="address"
prop="address"
:columns="area"
:column-change="columnChange"
placeholder="请填写做宴地址"
placeholder="请填写地址"
@confirm="handleConfirm"
:border="false"
size="large"
@ -77,11 +138,14 @@
}
return false
},
message: '做宴地址不能为空,请填写',
message: '地址不能为空,请填写',
},
]"
></wd-col-picker>
</wd-cell-group>
</wd-popup>
<!-- <wd-popup v-model="show" custom-style="border-radius:32rpx;" @close="handleClose">
<text class="custom-txt">弹弹弹</text>
</wd-popup> -->
</wd-card>
</view>
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
@ -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() {

View File

@ -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, //

View File

@ -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() {

View File

@ -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;

View File

@ -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,
})
}