master
dongmu 1 year ago
parent 27e031ac1b
commit 4929b2cede

@ -1,16 +1,25 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
{
// launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version" : "0.0",
"configurations": [{
"app-plus" :
"configurations" : [
{
"app-plus" : {
"launchtype" : "local"
},
"default" :
{
"default" : {
"launchtype" : "local"
},
"type" : "uniCloud"
},
{
"openVueDevtools" : true,
"type" : "uni-app:app-ios"
},
{
"openVueDevtools" : true,
"playground" : "standard",
"type" : "uni-app:app-android"
}
]
}

@ -8,7 +8,11 @@
- 状态管理:[pinia](https://pinia.vuejs.org/zh/)
- 组件库:[uni-ui](https://uniapp.dcloud.net.cn/component/uniui/uni-ui.html)
## 资料说明
资料说明
- 账号18387785159
- 密码Hhkj@123456
### 📗 接口文档

@ -14,8 +14,8 @@ onHide(() => {
<style lang="scss">
//
// @import '@/styles/fonts.scss';
@import '@/static/scss/index.scss';
// @import '@/styles/fonts.scss';
// 使 vw rem
html {

@ -0,0 +1,164 @@
<script setup lang="ts">
// import { getHomeGoodsGuessLikeAPI } from '@/services/home'
// import type { PageParams } from '@/types/global'
// import type { GuessItem } from '@/types/home'
import { ref } from 'vue'
import { onMounted } from 'vue'
//
const guessList: any = ref([])
//
const pageParams: Required<any> = ref({
page: 1,
pageSize: 10,
})
//
const resetData = () => {
pageParams.value.page = 1
guessList.value = []
finish.value = false
}
//
const finish = ref(false)
//
// const getHomeGoodsGuessLikeData = async () => {
// // 退
// if (finish.value) {
// uni.showToast({
// icon: 'none',
// title: '~',
// })
// return
// }
// //
// const res = await getHomeGoodsGuessLikeAPI(pageParams)
// //
// guessList.value.push(...res.result.items)
// //
// if (pageParams.page < res.result.pages) {
// //
// pageParams.page++
// } else {
// finish.value = true
// }
// }
//
onMounted(() => {
// getHomeGoodsGuessLikeData()
})
// --
defineExpose({
// getMore: getHomeGoodsGuessLikeData,
resetData,
})
</script>
<template>
<!-- 猜你喜欢 -->
<view class="caption">
<text class="text">接单历史</text>
</view>
<view class="guess">
<navigator
class="guess-item"
v-for="item in guessList"
:key="item.id"
:url="`/pages/goods/goods?id=4007498`"
>
<image class="image" mode="aspectFill" :src="item.picture"></image>
<view class="name"> {{ item.name }}</view>
<view class="price">
<text class="small">¥</text>
<text>{{ item.price }}</text>
</view>
</navigator>
</view>
<view class="loading-text"> {{ finish ? '没有更多数据~' : '正在加载...' }} </view>
</template>
<style lang="scss">
:host {
display: block;
}
/* 分类标题 */
.caption {
display: flex;
justify-content: center;
line-height: 1;
padding: 36rpx 0 40rpx;
font-size: 32rpx;
color: #262626;
.text {
display: flex;
justify-content: center;
align-items: center;
padding: 0 28rpx 0 30rpx;
&::before,
&::after {
content: '';
width: 20rpx;
height: 20rpx;
background-image: url(@/static/images/bubble.png);
background-size: contain;
margin: 0 10rpx;
}
}
}
/* 猜你喜欢 */
.guess {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 20rpx;
.guess-item {
width: 345rpx;
padding: 24rpx 20rpx 20rpx;
margin-bottom: 20rpx;
border-radius: 10rpx;
overflow: hidden;
background-color: #fff;
}
.image {
width: 304rpx;
height: 304rpx;
}
.name {
height: 75rpx;
margin: 10rpx 0;
font-size: 26rpx;
color: #262626;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.price {
line-height: 1;
padding-top: 4rpx;
color: #cf4444;
font-size: 26rpx;
}
.small {
font-size: 80%;
}
}
//
.loading-text {
text-align: center;
font-size: 28rpx;
color: #666;
padding: 20rpx 0;
}
</style>

@ -17,7 +17,9 @@
"delay" : 0
},
/* */
"modules": {},
"modules" : {
"OAuth" : {}
},
/* */
"distribute" : {
/* android */
@ -43,7 +45,11 @@
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs": {}
"sdkConfigs" : {
"oauth" : {
"univerify" : {}
}
}
}
},
/* */

@ -52,6 +52,20 @@
"style": {
"navigationBarTitleText": "注册账号"
}
},
{
"path": "pages/message/setting",
"style": {
"navigationBarTitleText": "设置"
}
},
{
"path" : "pages/login/OneClickLogin/OneClickLogin",
"style" :
{
"navigationBarTitleText" : "一键登录",
"enablePullDownRefresh" : false
}
}
],
"globalStyle": {

@ -64,13 +64,13 @@
import deiverPendingOrders from './componets/deiverPendingOrders.vue'
import { queryList } from '@/services/home'
import { ENV } from '@/utils/env'
import { onLoad } from '@dcloudio/uni-app' // -----
import { onShow } from '@dcloudio/uni-app' // -----
import { onMounted } from 'vue'
import { ref } from 'vue'
import { decrypt } from '@/utils/decrypt'
// --
onLoad(() => {
onShow(() => {
// getHomeBannerData()
queryLists()
})

@ -0,0 +1,101 @@
<template>
<view> </view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
onShow(() => {
loginFun()
})
//
const loginFun = () => {
uni.login({
provider: 'univerify',
univerifyStyle: {
fullScreen: true, // false
backgroundColor: '#ffffff', // #ffffff
backgroundImage: '', // ""
icon: {
path: 'static/images/blank_cart.png', // logo App logo
width: '60px', // 60px
height: '60px', // 60px
},
closeIcon: {
path: 'static/xxx.png', // HBuilderX3.3.7+
},
phoneNum: {
color: '#202020', // #202020
},
slogan: {
color: '#BBBBBB', // slogan #BBBBBB
},
authButton: {
normalColor: '#3479f5', // #3479f5
highlightColor: '#2861c5', // #2861c5ios
disabledColor: '#73aaf5', // #73aaf5ios
textColor: '#ffffff', // #ffffff
title: '本机号码一键登录', //
borderRadius: '24px', // "24px"
},
otherLoginButton: {
visible: true, // true
normalColor: '', //
highlightColor: '', //
textColor: '#656565', // #656565
title: '其他登录方式', //
borderColor: '', // iOS
borderRadius: '0px', // "24px"
},
privacyTerms: {
defaultCheckBoxState: true, // true
isCenterHint: false, // : false (3.7.13+ )
uncheckedImage: '', // 24x24px(3.2.0+ )
checkedImage: '', // 24x24px(3.2.0+ )
checkBoxSize: 12, //
textColor: '#BBBBBB', // #BBBBBB
termsColor: '#5496E3', // #5496E3
prefix: '我已阅读并同意', //
suffix: '并使用本机号码登录', // 使
privacyItems: [
// 2urltitle.
{
url: 'https://hongsentong.com/#/serviceProtocol', //
title: '用户服务协议', //
},
],
},
buttons: {
// 3.1.14+
iconWidth: '45px', // 45px
list: [
{
provider: 'apple',
iconPath: '/static/apple.png', //
},
{
provider: 'weixin',
iconPath: '/static/wechat.png', //
},
],
},
},
success(res: any) {
//
console.log(res.authResult) // {openid:'',access_token:' token'}
// loginForm.value.jsCode = res.authResult?.openid
},
fail(res) {
//
console.log(res.errCode)
console.log(res.errMsg)
uni.redirectTo({
url: '/pages/login/login',
})
// uni.closeAuthView() //
},
})
}
</script>
<style></style>

@ -102,6 +102,7 @@ import { ENV } from '@/utils/env'
import { useMemberStore } from '@/stores'
import { onMounted } from 'vue'
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
const feilUrl = ref()
const feilUrl1 = ref()
@ -126,6 +127,19 @@ const UniCode = ref() // 记录
const canclick = ref(true) //
const clock = ref() //
onLoad(() => {
// uni.login({
// provider: 'weixin', //使
// success: function (loginRes: any) {
// console.log(loginRes, 'weixin')
// uni.showToast({
// title: `${loginRes.authResult?.openid}`,
// icon: 'success',
// })
// },
// })
})
//
const agreementSearchItem = (e: any) => {
if (agreementSearch.value[0]) {
@ -186,15 +200,13 @@ const handleLogin = async () => {
return
} else {
//
loginForm.value.jsCode = UniCode.value
// loginForm.value.jsCode = UniCode.value
let URL = '/pages/index/index'
loginUser(loginForm.value)
.then((res: any) => {
console.log(res, 'res登录获取到的token')
if (res.code == 200) {
// vuex token
// setToken(res.data.access_token)
// setExpiresIn(res.data.expires_in)
//
const memberStore = useMemberStore()
memberStore.setProfile(res.data.access_token)

@ -0,0 +1,230 @@
<template>
<view>
<view>
<headTabbar tabbarName="个人设置"></headTabbar>
<view>
<!-- 外壳 -->
<view class="main" style="">
<!-- 内容区 -->
<view class="content" style="">
<!-- 头像区域 -->
<view class="mainItem">
<view>头像</view>
<view>
<uni-file-picker
@select="(even) => imgSuccess(even)"
limit="1"
:del-icon="false"
disable-preview
:imageStyles="imageStyles"
file-mediatype="image"
>
<image
style="width: 50px; height: 50px"
mode="scaleToFill"
:src="feilUrl + dataInfo.avatar"
></image>
</uni-file-picker>
</view>
</view>
<!-- 昵称 -->
<view class="mainItem">
<view>昵称</view>
<view>{{ dataInfo.userName }}</view>
</view>
<!-- 性别 -->
<view class="mainItem" @click="showGender = true">
<view>性别</view>
<view style="display: flex">
<text>{{ dataInfo.gender }}</text>
<view style="padding-top: 1px">
<uni-icons type="right" size="16" color="#b5b5b5"></uni-icons>
</view>
</view>
</view>
<!-- 手机号 -->
<view class="mainItem" style="border-bottom: none">
<view>手机号</view>
<view>{{ dataInfo.userPhone }}</view>
</view>
</view>
</view>
<!-- 保存信息 -->
<view class="btnSave" style="" @click="getupdateBaseInfo">
<view class="saveItem" style="">保存信息</view>
</view>
<!-- 退出登录 -->
<view @click="goBack" class="btnSave" style="color: #878787">
<view class="saveItem">退出登录</view>
</view>
<view>
<view @click="clickNativeRule" style="text-align: center; color: #008bd1; font-size: 14px"
>鸿森通用户服务协议</view
>
</view>
<!-- <u-action-sheet
:closeOnClickOverlay="true"
:closeOnClickAction="true"
@select="selectClick"
:actions="list"
:show="showGender"
></u-action-sheet> -->
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { uploadAtt } from '@/services/common'
import { baseInfo, logout, updateBaseInfo } from '@/services/home'
import { ENV } from '@/utils/env'
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
const feilUrl = ref()
const showGender = ref(false)
const dataInfo = ref({
gender: '男',
avatar: '',
userName: '',
userPhone: '',
})
const imageStyles = ref({
width: 50,
height: 50,
border: {
radius: '50%',
},
})
const list = ref([
{
name: '男',
fontSize: '20',
value: 1,
},
{
name: '女',
fontSize: '20',
value: 0,
},
])
onLoad(() => {
feilUrl.value = ENV.APP_FILE_URL
// getbaseInfo()
})
// ---
const getbaseInfo = () => {
let _this = this
baseInfo().then((res: any) => {
console.log(res)
dataInfo.value = res.data
dataInfo.value.gender = '男'
})
}
//
const getupdateBaseInfo = () => {
let obj = {
avatar: dataInfo.value.avatar,
birthday: '2023-10-31 20:24:00',
userNickname: dataInfo.value.userName,
}
updateBaseInfo(obj).then((res: any) => {
console.log('更新成功')
uni.navigateBack({
delta: 1,
})
})
}
//
const selectClick = (val: any) => {
showGender.value = false
dataInfo.value.gender = val.name
}
//
const imgSuccess = async (event: any) => {
const tempFilePaths = event.tempFilePaths
uploadAtt(tempFilePaths[0]).then((res: any) => {
if (res.code == 200) {
dataInfo.value.avatar = res.data.url
}
})
}
//
const clickNativeRule = () => {
uni.navigateTo({
url: '/pageOthers/pageLoginAccent/pageLoginAccent',
})
}
// 退
const goBack = () => {
uni.showModal({
title: '提示',
content: '是否退出登录',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定')
logout().then((res: any) => {
uni.reLaunch({
url: '/pages/login/OneClickLogin/OneClickLogin',
})
})
} else if (res.cancel) {
console.log('用户点击取消')
}
},
})
}
</script>
<style lang="scss">
page {
background-color: #eaeaea;
}
.main {
width: 100vw;
padding: 10px 10px;
font-size: 14px;
.content {
padding: 0 20px;
border-radius: 5px;
background-color: #fff;
}
.mainItem {
padding: 10px 0;
display: flex;
justify-content: space-between;
border-bottom: 1px solid #e6e6e6;
height: 45px;
align-items: center;
}
}
.btnSave {
width: 100vw;
font-size: 14px;
padding: 0 10px 10px 10px;
color: #ff557f;
.saveItem {
border-radius: 5px;
background-color: #fff;
padding: 10px 0;
text-align: center;
}
}
</style>

@ -32,7 +32,7 @@ const orderTypes = [
</view>
<!-- 情况2未登录 -->
<view class="overview" v-else>
<navigator url="/pages/login/login" hover-class="none">
<navigator url="/pages/login/OneClickLogin/OneClickLogin" hover-class="none">
<image
class="avatar gray"
mode="aspectFill"
@ -40,7 +40,11 @@ const orderTypes = [
></image>
</navigator>
<view class="meta">
<navigator url="/pages/login/login" hover-class="none" class="nickname">
<navigator
url="/pages/login/OneClickLogin/OneClickLogin"
hover-class="none"
class="nickname"
>
未登录
</navigator>
<view class="extra">
@ -48,16 +52,14 @@ const orderTypes = [
</view>
</view>
</view>
<navigator class="settings" url="/pagesMember/settings/settings" hover-class="none">
设置
</navigator>
<navigator class="settings" url="/pages/message/setting" hover-class="none"> 设置 </navigator>
</view>
<!-- 我的订单 -->
<view class="orders">
<view class="title">
我的订单
<navigator class="navigator" url="/pagesOrder/list/list?type=0" hover-class="none">
查看全部订单<text class="icon-right"></text>
查看全部订单<uni-icons type="right" color="#939393" size="14"></uni-icons>
</navigator>
</view>
<view class="section">
@ -77,14 +79,18 @@ const orderTypes = [
</view>
</view>
<!-- 猜你喜欢 -->
<view>
<view class="guess">
<!-- <XtxGuess ref="guessRef" /> -->
<view> 其他信息 </view>
<XtxGuess ref="guessRef" />
</view>
</view>
</scroll-view>
</template>
<style lang="scss">
//
@import '@/styles/fonts.scss';
page {
height: 100%;
overflow: hidden;

@ -0,0 +1,13 @@
// 存放路径: src/services/home.ts
import { http, uploadRequest } from '@/utils/http'
/**
*
* @param data
*/
export function uploadAtt(filePath: any) {
return uploadRequest({
url: '/file/upload',
filePath: filePath,
})
}

@ -2,20 +2,6 @@
import type { BannerItem } from '@/types/home'
import { http } from '@/utils/http'
/**
* -广-
* @param distributionSite 广 12 1
*/
// export const getHomeBannerAPI = (distributionSite = 1) => {
// return http<BannerItem[]>({
// method: 'GET',
// url: '/home/banner',
// data: {
// distributionSite,
// },
// })
// }
// 查询车型
export const queryList = () => {
return http({
@ -73,6 +59,7 @@ export function updStatusRefuse(data: any) {
})
}
// 登录接口
export const loginUser = (data: any) => {
// 如果index是1 就是登录/找回密码
return http({
@ -121,3 +108,28 @@ export const loginRegistered = (data: any) => {
data,
})
}
// 退出登录
export const logout = () => {
return http({
method: 'GET',
url: `/auth/weiXin/logout`,
})
}
// 用户查询用户头像、昵称、生日等信息
export function baseInfo() {
return http({
url: '/system/member/client/baseInfo',
method: 'GET',
})
}
// 更新 用户头像、昵称、生日等信息
export function updateBaseInfo(data: any) {
return http({
url: '/system/member/client/updateBaseInfo',
method: 'POST',
data: data,
})
}

@ -51,32 +51,48 @@ type Data<T> = {
msg: string
data: T
}
// 2.2 添加类型,支持泛型
// 公共请求 2.2 添加类型,支持泛型
export const http = <T>(options: UniApp.RequestOptions) => {
uni.showLoading({
title: '加载中...',
mask: true,
})
// 1. 返回 Promise 对象
return new Promise<Data<T>>((resolve, reject) => {
uni.request({
...options,
// 响应成功
success(res: any) {
uni.hideLoading()
console.log('500请求错误', res)
// 状态码 2xx参考 axios 的设计
if (res.statusCode >= 200 && res.statusCode < 300) {
// 2.1 提取核心数据 res.data
resolve(res.data as Data<T>)
// resolve(res.data as Data<T>)
// ---------------响应是200 但数据内部是500|400----------------------------
const resList = res.data
if (resList.code === 200) {
// uni.showToast({
// icon: 'none',
// title: '请求成功',
// })
resolve(res.data as Data<T>)
return
}
if (resList.code === 401) {
// 401错误 -> 清理用户信息,跳转到登录页
uni.showToast({
title: resList?.msg || '请求错误',
title: '请求错误',
icon: 'error',
})
const memberStore = useMemberStore()
memberStore.clearProfile()
uni.navigateTo({ url: '/pages/login/login' })
setTimeout(() => {
uni.navigateTo({ url: '/pages/login/OneClickLogin/OneClickLogin' })
}, 1000)
reject(resList)
} else {
console.log('500请求错误', res.data)
@ -97,7 +113,7 @@ export const http = <T>(options: UniApp.RequestOptions) => {
})
const memberStore = useMemberStore()
memberStore.clearProfile()
uni.navigateTo({ url: '/pages/login/login' })
uni.navigateTo({ url: '/pages/login/OneClickLogin/OneClickLogin' })
reject(res)
} else {
console.log('500请求错误', res.data)
@ -120,3 +136,25 @@ export const http = <T>(options: UniApp.RequestOptions) => {
})
})
}
// 上传图片接口
export const uploadRequest = <T>(options: any) => {
// 1. 返回 Promise 对象
return new Promise((resolve, reject) => {
uni.uploadFile({
url: baseURL + options.url, // 仅为示例,非真实的接口地址
filePath: options.filePath,
name: 'file',
formData: {
user: '',
},
success: (res) => {
resolve(JSON.parse(res.data))
},
fail: (error) => {
console.log('err' + error)
reject(error)
},
})
})
}

Loading…
Cancel
Save