This commit is contained in:
Abbh1 2023-11-19 15:18:25 +08:00
parent c5a47ab3a3
commit 880c000f45
59 changed files with 47 additions and 2496 deletions

2
app.js
View File

@ -2,7 +2,7 @@ import updateManager from './common/updateManager';
// export const ServerBasePath = 'http://localhost:8888/api/'; // export const ServerBasePath = 'http://localhost:8888/api/';
// export const ServerBasePath = 'http://192.168.1.102:8888/api/'; // export const ServerBasePath = 'http://192.168.1.102:8888/api/';
export const ServerBasePath = 'http://emo-api.aerwen.net/api/'; export const ServerBasePath = 'https://emo-api.aerwen.net/api/';
App({ App({
onLaunch: function () {}, onLaunch: function () {},

View File

@ -2,17 +2,7 @@
"pages": [ "pages": [
"pages/home/home", "pages/home/home",
"pages/home/search/index", "pages/home/search/index",
"pages/login/login", "pages/emoticon/result/index"
"pages/login/authorize-avatar-name/index",
"pages/login/phone-register/index",
"pages/login/agree-link/index",
"pages/emoticon/result/index",
"pages/usercenter/index",
"pages/usercenter/goods-collect/index",
"pages/usercenter/goods-history/index",
"pages/usercenter/person-info/index",
"pages/usercenter/set/index",
"pages/usercenter/name-edit/index"
], ],
"tabBar": { "tabBar": {
"custom": true, "custom": true,
@ -26,8 +16,8 @@
"text": "首页" "text": "首页"
}, },
{ {
"pagePath": "pages/usercenter/index", "pagePath": "pages/home/search/index",
"text": "我的" "text": "搜索"
} }
] ]
}, },

View File

@ -3,10 +3,5 @@ export default [
icon: 'home', icon: 'home',
text: '首页', text: '首页',
url: 'pages/home/home', url: 'pages/home/home',
}, }
{
icon: 'person',
text: '个人中心',
url: 'pages/usercenter/index',
},
]; ];

View File

@ -32,7 +32,7 @@ Page({
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 20,
onLoad(options) { onLoad(options) {
const { const {
@ -64,7 +64,7 @@ Page({
const params = { const params = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 20,
search: keywords, search: keywords,
emoticonCategoryGuid: categoryGuid emoticonCategoryGuid: categoryGuid
}; };

View File

@ -26,7 +26,7 @@
<!-- 列表 --> <!-- 列表 -->
<view class="last-updated-list"> <view class="last-updated-list">
<view class="last-updated-list-item" wx:for="{{emoticonDataList}}" wx:for-item="item" wx:for-index="index" wx:key="index"> <view class="last-updated-list-item" wx:for="{{emoticonDataList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<image class="image-box" src="{{item.emoticonDataImg}}" mode="aspectFill" /> <image show-menu-by-longpress="true" class="image-box" src="{{item.emoticonDataImg}}" mode="aspectFill" />
</view> </view>
</view> </view>
<load-more wx:if="{{emoticonDataList.length > 0}}" status="{{loadMoreStatus}}" no-more-text="没有更多了" /> <load-more wx:if="{{emoticonDataList.length > 0}}" status="{{loadMoreStatus}}" no-more-text="没有更多了" />

View File

@ -131,7 +131,7 @@ Page({
getEmoticonDataList(params).then((res) => { getEmoticonDataList(params).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.page.num++; this.page.num++;
this.setData({ this.setData({
lastUpdatedList: this.data.lastUpdatedList.concat(res.data.result), lastUpdatedList: this.data.lastUpdatedList.concat(res.data.result),
loadMoreStatus: 0 loadMoreStatus: 0
@ -200,4 +200,36 @@ Page({
}); });
}, },
// 点击分享
onShareAppMessage() {
const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: '表情包图片大全'
})
}, 2000)
})
return {
title: '表情包图片大全',
path: '/pages/home/home',
promise
}
},
// 点击分享朋友圈
onShareTimeline(){
const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: '表情包图片大全'
})
}, 2000)
})
return {
title: '表情包图片大全',
path: '/pages/home/home',
promise
}
}
}); });

View File

@ -4,7 +4,7 @@
<view class="home-page-header"> <view class="home-page-header">
<!-- 公告 --> <!-- 公告 -->
<!-- <view class="notice-container "> <view class="notice-container ">
<view wx:for="{{noticeList}}"> <view wx:for="{{noticeList}}">
<t-notice-bar class="notice-bar" visible="{{item.visible}}" prefixIcon="null" marquee="{{marquee}}" content="{{item.noticeContent}}"> <t-notice-bar class="notice-bar" visible="{{item.visible}}" prefixIcon="null" marquee="{{marquee}}" content="{{item.noticeContent}}">
<view slot="prefix-icon" class="notice-title"> <view slot="prefix-icon" class="notice-title">
@ -15,7 +15,7 @@
</view> </view>
</t-notice-bar> </t-notice-bar>
</view> </view>
</view> --> </view>
<!-- 轮播图 --> <!-- 轮播图 -->
<view class="swiper-wrap"> <view class="swiper-wrap">
<t-swiper wx:if="{{imgSrcs.length > 0}}" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" imageProps="{{swiperImageProps}}" list="{{imgSrcs}}" /> <t-swiper wx:if="{{imgSrcs.length > 0}}" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" imageProps="{{swiperImageProps}}" list="{{imgSrcs}}" />
@ -47,7 +47,7 @@
<!-- 头部 --> <!-- 头部 -->
<view class="emoticon-header-box"> <view class="emoticon-header-box">
<view class="emoticon-header-title-box"> <view class="emoticon-header-title-box">
<image class="emoticon-header-icon" src="http://mall.api.aerwen.net/Uploads/uploads/20231029/C8ABBC8BEAFA9E5D.png" mode="heightFix" /> <image show-menu-by-longpress="true" class="emoticon-header-icon" src="http://mall.api.aerwen.net/Uploads/uploads/20231029/C8ABBC8BEAFA9E5D.png" mode="heightFix" />
<view class="emoticon-header-title"> <view class="emoticon-header-title">
<view class="emoticon-header-title-text">热门表情包</view> <view class="emoticon-header-title-text">热门表情包</view>
<view class="emoticon-header-title-line"></view> <view class="emoticon-header-title-line"></view>
@ -64,7 +64,7 @@
<view class="hot-emoticon-categoty-lsit"> <view class="hot-emoticon-categoty-lsit">
<view class="hot-emoticon-categoty-item" wx:for="{{hotCategoryList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-value="{{item.emotionCategoryName}}" bind:tap="handleClickHotCategory"> <view class="hot-emoticon-categoty-item" wx:for="{{hotCategoryList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-value="{{item.emotionCategoryName}}" bind:tap="handleClickHotCategory">
<view class="image-box"> <view class="image-box">
<image src="{{item.emotionCategoryImg}}" mode="aspectFill" /> <image show-menu-by-longpress="true" show-menu-by-longpress="true" src="{{item.emotionCategoryImg}}" mode="aspectFill" />
</view> </view>
<view class="text">{{item.emotionCategoryName}}</view> <view class="text">{{item.emotionCategoryName}}</view>
</view> </view>
@ -76,7 +76,7 @@
<!-- 头部 --> <!-- 头部 -->
<view class="emoticon-header-box"> <view class="emoticon-header-box">
<view class="emoticon-header-title-box"> <view class="emoticon-header-title-box">
<image class="emoticon-header-icon" src="http://mall.api.aerwen.net/Uploads/uploads/20231029/C8ABBC8BEAFA9E5D.png" mode="heightFix" /> <image show-menu-by-longpress="true" class="emoticon-header-icon" src="http://mall.api.aerwen.net/Uploads/uploads/20231029/C8ABBC8BEAFA9E5D.png" mode="heightFix" />
<view class="emoticon-header-title"> <view class="emoticon-header-title">
<view class="emoticon-header-title-text">最近更新</view> <view class="emoticon-header-title-text">最近更新</view>
<view class="emoticon-header-title-line"></view> <view class="emoticon-header-title-line"></view>
@ -92,7 +92,7 @@
<!-- 列表 --> <!-- 列表 -->
<view class="last-updated-list"> <view class="last-updated-list">
<view class="last-updated-list-item" wx:for="{{lastUpdatedList}}" wx:for-item="item" wx:for-index="index" wx:key="index"> <view class="last-updated-list-item" wx:for="{{lastUpdatedList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<image class="image-box" src="{{item.emoticonDataImg}}" mode="aspectFill" /> <image show-menu-by-longpress="true" class="image-box" src="{{item.emoticonDataImg}}" mode="aspectFill" />
</view> </view>
</view> </view>

View File

@ -1,70 +0,0 @@
import {
getPlatformSpecDetails
} from '~/services/login/getPlatformSpecDetails';
Page({
/**
* 页面的初始数据
*/
data: {
detailsData: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
getPlatformSpecDetails({
PlatformSpecGuid: options.guid
}).then(res => {
this.setData({
detailsData: res.data
})
wx.setNavigationBarTitle({
title: this.data.detailsData.platformSpecTitle
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
})

View File

@ -1,5 +0,0 @@
{
"usingComponents": {
},
"navigationBarTitleText": ""
}

View File

@ -1,3 +0,0 @@
<view style="width: 90%; margin: 40rpx auto; padding-bottom: 200rpx;">
<rich-text nodes="{{detailsData.platformSpecContent}}"></rich-text>
</view>

View File

@ -1,107 +0,0 @@
// pages/login/authorize-avatar-name/index.js
Page({
/**
* 页面的初始数据
*/
data: {
image: "https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png",
},
login() {
var that = this;
// 基础库要在2.27.1以下才可以使用
wx.getUserProfile({
//获取用户信息。页面产生点击事件(例如 button 上 bindtap 的回调中)后才可调用,每次请求都会弹出授权窗口,用户同意后返回 userInfo,用于替换 wx.getUserInfo
lang: 'zh_CN',
desc: '用于在后台更好的识别您的身份', //声明获取用户个人信息后的用途
success(user) {
//接口调用成功的回调函数
const data = {
encryptedData: user.encryptedData,
iv: user.iv,
// signature: user.signature,
// rawData: user.rawData,
userInfo: user.userInfo,
};
// app.request({
// url: `login`,
// method: 'POST',
// data: data,
// success: async function (res) {
// // wx.setStorageSync('userInfo', res);
// app.put('userInfo', res, 86400);
// const userInfo = app.get('userInfo');
// // 如果第一次登录就注册一个客户账号
// },
// });
},
fail() {
wx.switchTab({
url: '/pages/home/home',
});
},
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,7 +0,0 @@
{
"usingComponents": {
"t-avatar": "tdesign-miniprogram/avatar/avatar",
"van-button": "@vant/weapp/button/index"
},
"navigationBarTitleText": "授权登录"
}

View File

@ -1,25 +0,0 @@
<!-- 授权头像昵称登录页 -->
<view class="mainContainer">
<!-- 头部头像盒子 -->
<view class="top-avatar-box">
<view class="avatar-img-box">
<image class="avatar-img" src="{{image}}"></image>
</view>
<view class="avatar-line"></view>
</view>
<!-- 权限文字盒子 -->
<view class="authorize-content-box">
<view class="authorize-content-title">申请获取以下权限</view>
<view class="authorize-content-text">获得你的公开信息(昵称、头像等)</view>
</view>
<!-- 授权按钮盒子 -->
<view class="authorize-btn-box">
<van-button type="primary" round block bind:tap="login">授权登录</van-button>
<view class="authorize-btn"></view>
<van-button round block>暂不登录</van-button>
</view>
</view>

View File

@ -1,61 +0,0 @@
/* pages/login/authorize-avatar-name/index.wxss */
.mainContainer {
width: 85%;
margin: 0 auto;
}
/* 头部头像盒子 */
.top-avatar-box {
margin-top: 50rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.avatar-img-box {
width: 180rpx;
height: 180rpx;
border-radius: 50%;
overflow: hidden;
padding: 5rpx;
box-shadow: 0 0 15rpx 5rpx #e8e8e8;
}
.avatar-img {
width: 100%;
height: 100%;
object-fit: cover;
}
.avatar-line {
width: 100%;
height: 1px;
background-color: #e3e3e3;
margin-top: 50rpx;
}
/* 权限文字盒子 */
.authorize-content-box {
margin: 80rpx 0;
}
.authorize-content-title {
font-size: 35rpx;
margin-bottom:40rpx;
color: #585858;
}
.authorize-content-text{
font-size:30rpx;
color: #888888;
}
/* 授权按钮盒子 */
.authorize-btn{
margin-bottom: 25rpx;
}

View File

@ -1,148 +0,0 @@
// pages/login/login.js
import Toast from '~/miniprogram_npm/@vant/weapp/toast/toast';
import {
login
} from '~/services/login/login';
import {
getOpenId
} from '~/services/login/getOpenId';
import {
getPlatformSpecList
} from '~/services/login/getPlatformSpecList';
Page({
/**
* 页面的初始数据
*/
data: {
back: true,
bg_image: "",
checked: true,
code: "",
agree_Link: {}
},
// 获取手机号
getPhoneNumber(e) {
console.log(e,'adsasdasdasd');
let that = this
if (that.data.checked == false) {
Toast({
context: this,
selector: '#t-toast',
message: '请勾选同意按钮',
duration: 2000,
icon: '',
});
return;
}
if (e.detail.code) {
let phoneCode = e.detail.code
let openId = wx.getStorageSync('openId')
let data = {
CustomerXcxOpenid: openId,
Code: phoneCode
}
// 登录请求
login(data).then((res) => {
if (res.data != null) {
that.setData({
back: false
})
}
})
} else {}
},
// 跳转到手机号登录
gotoPhoneRegister() {
wx.navigateTo({
url: `/pages/login/phone-register/index`,
});
},
// 选择是否已同意
onChangeChecked() {
this.setData({
checked: !this.data.checked
})
},
//协议点击
agreeLink(data) {
wx.navigateTo({
url: '/pages/login/agree-link/index?guid=' + data.currentTarget.dataset.guid
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
let that = this
// 获取OpenId的code
wx.login({
success(res) {
that.setData({
code: res.code
})
getOpenId({
code: res.code
}).then((res) => {
wx.setStorageSync('openId', res.data)
})
},
});
// 获取平台资质与规范列表
getPlatformSpecList().then(res => {
this.setData({
agree_Link: res.data
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
let that = this
if (that.data.back == true) {
wx.reLaunch({
url: '/pages/home/home'
})
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@ -1,7 +0,0 @@
{
"usingComponents": {
"van-button": "@vant/weapp/button/index",
"van-checkbox": "@vant/weapp/checkbox/index"
},
"navigationBarTitleText": "授权登录"
}

View File

@ -1,29 +0,0 @@
<!-- 登录页 -->
<!-- 背景图盒子 -->
<view class="bg-box">
<image class="bg-box-img" src="http://mall.api.aerwen.net/Uploads/uploads/20231029/E47DAEBE34756E17.jpg" />
</view>
<!-- 登录盒子 -->
<view class="login-pos-box">
<view class="login-container-box">
<view class="login-box">
<view class="login-btn-box">
<van-button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" icon="wechat" type="primary" size="large" custom-style="font-size: 31rpx;font-weight: bold;" round block>微信一键登录</van-button>
<!-- <view class="mb-30"></view>
<van-button icon="phone" color="#eff0f1" size="large" custom-style="font-size: 31rpx;color: #999999;font-weight: bold;" round block bind:click="gotoPhoneRegister">手机号登录/注册</van-button> -->
</view>
<!-- <view class="agree-box">
<van-checkbox icon-size="35rpx" value="{{ checked }}" checked-color="#fc2e2a" bind:change="onChangeChecked"></van-checkbox>
<view class="agree-text">
我已阅读并同意
<span class="agree-link" wx:for="{{agree_Link}}" bindtap='agreeLink' data-Guid='{{item.platformSpecGuid}}'>《{{item.platformSpecTitle}}》</span>
</view>
</view> -->
</view>
</view>
</view>

View File

@ -1,61 +0,0 @@
/* 背景图盒子 */
.bg-box{
width: 100%;
height: 100vh;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
z-index: -1;
}
.bg-box-img{
width: 100%;
height: 100%;
}
/* 登录盒子 */
.login-pos-box{
height: 100vh;
position: relative;
display: flex;
justify-content: center;
}
.login-container-box{
width: 90%;
position: absolute;
top: 20%;
height: 220rpx;
background-color: white;
border-radius: 20rpx;
}
.login-box{
padding: 50rpx 40rpx;
}
.phone-btn{
color: black !important;
font-weight: bold;
}
.agree-box{
margin-top: 50rpx;
display: flex;
}
.agree-text{
font-size: 25rpx;
color: #555555;
margin-top: -3rpx;
}
.agree-link{
font-size: 26rpx;
color: red;
}

View File

@ -1,115 +0,0 @@
// pages/login/phone-register/index.js
import {
sendPhoneCode
} from '~/services/login/phone-register';
Page({
/**
* 页面的初始数据
*/
data: {
logoImg: "https://tool.aerwen.net/prod-api/Open/20230602/8969EAF2294B1FF4.png",
phoneNumber: "", //手机号
phoneError: false, // 手机号验证
verifyCode: "", //验证码
},
/** 发送验证码 */
send() {
if (!this.data.phoneNumber) {
wx.showToast({
icon: 'error',
title: '请输入手机号',
});
return;
}
const isPhoneNumber = /^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.data.phoneNumber);
if(!isPhoneNumber){
wx.showToast({
icon: 'error',
title: '手机号格式不正确',
});
return;
}
let data = {
PhoneNumber: this.data.phoneNumber,
}
sendPhoneCode(data)
},
/** 手机号验证 */
onPhoneInput(e) {
const {
phoneError
} = this.data;
const isPhoneNumber = /^[1][3,4,5,7,8,9][0-9]{9}$/.test(e.detail.value);
if (phoneError === isPhoneNumber) {
this.setData({
phoneError: !isPhoneNumber,
phoneNumber: e.detail.value,
});
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,7 +0,0 @@
{
"usingComponents": {
"t-input": "tdesign-miniprogram/input/input",
"van-button": "@vant/weapp/button/index"
},
"navigationBarTitleText": ""
}

View File

@ -1,50 +0,0 @@
<!-- 手机号登录页 -->
<view class="phone-register-pos-box">
<!-- Logo盒子 -->
<view class="logo-box">
<view class="logo-img-box">
<image class="logo-img" src="{{logoImg}}" mode="heightFix" />
</view>
<view class="logo-title">阿尔文电商</view>
<view class="logo-text">一家有感情的电商模板</view>
</view>
<!-- 表单 -->
<view class="register-form">
<view class="register-form-box">
<!-- 手机号 -->
<t-input
value="{{phoneNumber}}"
placeholder="请输入手机号"
borderless="{{true}}"
style="border-radius: 100rpx; background-color: #f3f4f6;margin-bottom: 50rpx;height: 50rpx;"
tips="{{phoneError ? '手机号输入不正确' : ''}}"
bindchange="onPhoneInput"
/>
<!-- 验证码 -->
<t-input
placeholder="请输入验证码"
value="{{verifyCode}}"
borderless="{{true}}"
style="border-radius: 100rpx; background-color: #f3f4f6; height: 50rpx;"
>
<view slot="suffix" style="display: flex; align-items: center">
<view class="suffix--line"></view>
<van-button size="small" round type="info" bind:click="send">发送验证码</van-button>
</view>
</t-input>
<!-- 提交按钮 -->
<view class="submit-btn">
<van-button type="info" size="large" round block>登录/注册</van-button>
</view>
</view>
</view>
</view>

View File

@ -1,43 +0,0 @@
/* 手机号登录页Css */
/* Logo盒子 */
.logo-box{
margin-top: 50rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.logo-img{
width: 230rpx;
height: 230rpx;
}
.logo-title{
font-size: 40rpx;
letter-spacing: 4rpx;
font-weight: bold;
}
.logo-text{
font-size: 28rpx;
margin-top: 20rpx;
color: #999999;
letter-spacing: 2rpx;
}
/* 表单 */
.register-form{
margin-top: 100rpx;
}
.register-form-box{
width: 90%;
margin: 0 auto;
}
.submit-btn{
margin-top: 50rpx;
}

View File

@ -1,124 +0,0 @@
import { getPermission } from '../../../../utils/getPermission';
import { phoneRegCheck } from '../../../../utils/util';
import Toast from 'tdesign-miniprogram/toast/index';
import { addressParse } from '../../../../utils/addressParse';
import { resolveAddress, rejectAddress } from '../../address/list/util';
Component({
externalClasses: ['t-class'],
properties: {
title: {
type: String,
},
navigateUrl: {
type: String,
},
navigateEvent: {
type: String,
},
isCustomStyle: {
type: Boolean,
value: false,
},
isDisabledBtn: {
type: Boolean,
value: false,
},
isOrderSure: {
type: Boolean,
value: false,
},
},
methods: {
getWxLocation() {
if (this.properties.isDisabledBtn) return;
getPermission({ code: 'scope.address', name: '通讯地址' }).then(() => {
wx.chooseAddress({
success: async (options) => {
const { provinceName, cityName, countyName, detailInfo, userName, telNumber } = options;
if (!phoneRegCheck(telNumber)) {
Toast({
context: this,
selector: '#t-toast',
message: '请填写正确的手机号',
});
return;
}
const target = {
name: userName,
phone: telNumber,
countryName: '中国',
countryCode: 'chn',
detailAddress: detailInfo,
provinceName: provinceName,
cityName: cityName,
districtName: countyName,
isDefault: false,
isOrderSure: this.properties.isOrderSure,
};
try {
const { provinceCode, cityCode, districtCode } = await addressParse(provinceName, cityName, countyName);
const params = Object.assign(target, {
provinceCode,
cityCode,
districtCode,
});
if (this.properties.isOrderSure) {
this.onHandleSubmit(params);
} else if (this.properties.navigateUrl != '') {
const { navigateEvent } = this.properties;
this.triggerEvent('navigate');
wx.navigateTo({
url: this.properties.navigateUrl,
success: function (res) {
res.eventChannel.emit(navigateEvent, params);
},
});
} else {
this.triggerEvent('change', params);
}
} catch (error) {
wx.showToast({ title: '地址解析出错,请稍后再试', icon: 'none' });
}
},
fail(err) {
console.warn('未选择微信收货地址', err);
},
});
});
},
async queryAddress(addressId) {
try {
const { data } = await apis.userInfo.queryAddress({ addressId });
return data.userAddressVO;
} catch (err) {
console.error('查询地址错误', err);
throw err;
}
},
findPage(pageRouteUrl) {
const currentRoutes = getCurrentPages().map((v) => v.route);
return currentRoutes.indexOf(pageRouteUrl);
},
async onHandleSubmit(params) {
try {
const orderPageDeltaNum = this.findPage('pages/order/order-confirm/index');
if (orderPageDeltaNum > -1) {
wx.navigateBack({ delta: 1 });
resolveAddress(params);
return;
}
} catch (err) {
rejectAddress(params);
console.error(err);
}
},
},
});

View File

@ -1,8 +0,0 @@
{
"component": true,
"usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-toast": "tdesign-miniprogram/toast/toast"
}
}

View File

@ -1,16 +0,0 @@
<view class="wx-address t-class" bind:tap="getWxLocation">
<block wx:if="{{isCustomStyle}}">
<view class="wx-address-custom">
<t-icon prefix="wr" t-class="weixin" color="#0ABF5B" name="wechat" size="48rpx" />
<text>{{title}}</text>
</view>
<slot />
</block>
<block wx:else>
<t-cell title="{{title}}" title-class="cell__title" wr-class="cell" border="{{false}}">
<t-icon t-class="weixin" slot="icon" color="#0ABF5B" name="logo-windows" size="48rpx" />
<t-icon slot="right-icon" name="chevron-right" class="custom-icon" color="#bbb" />
</t-cell>
</block>
</view>
<t-toast id="t-toast" />

View File

@ -1,19 +0,0 @@
.wx-address .weixin {
display: inline-block;
font-size: 48rpx !important;
margin-right: 20rpx;
font-weight: normal;
}
.wx-address .cell {
padding: 32rpx 30rpx;
border-radius: 8rpx;
}
.wx-address .cell__title {
font-size: 30rpx;
color: #333333;
}
.wx-address-custom {
display: flex;
align-items: center;
font-size: 32rpx;
}

View File

@ -1,73 +0,0 @@
Component({
properties: {
show: {
type: Boolean,
observer(show) {
if (!show) return;
this.updateDivisions();
},
},
title: {
type: String,
value: '',
},
value: {
type: String,
value: '',
observer() {
if (!this.data.show) return;
this.updateDivisions();
},
},
pickerOptions: {
type: Array,
value: [],
observer() {
if (!this.data.show) return;
this.updateDivisions();
},
},
headerVisible: {
type: Boolean,
value: true,
},
},
data: {
pickerValue: [],
},
methods: {
updateDivisions() {
const { pickerOptions, value } = this.data;
const index = (pickerOptions || []).findIndex(
(item) => item.code === value,
);
setTimeout(() => {
this.setData({ pickerValue: index >= 0 ? [index] : [0] });
}, 0);
},
getAreaByIndex(indexes) {
const { pickerOptions } = this.data;
return pickerOptions[indexes.toString()];
},
onChange(e) {
const currentValue = e.detail.value;
const target = this.getAreaByIndex(currentValue);
if (target === null) return;
this.setData({ pickerValue: currentValue });
this.triggerEvent('change', { value: target.code, target: target });
},
onConfirm() {
const target = this.getAreaByIndex(this.data.pickerValue);
this.triggerEvent('confirm', { value: target?.code, target });
},
onClose() {
this.triggerEvent('close');
},
},
});

View File

@ -1,6 +0,0 @@
{
"component": true,
"usingComponents": {
"t-popup": "tdesign-miniprogram/popup/popup"
}
}

View File

@ -1,21 +0,0 @@
<t-popup visible="{{show}}" placement="bottom">
<view class="city-picker-box" slot="content">
<view wx:if="{{headerVisible}}" class="city-picker-header city-picker-more">
<view class="btn" hover-class="btn__active" catch:tap="onClose">取消</view>
<view wx:if="{{title}}" class="title">{{title}}</view>
<view class="btn primary" hover-class="btn__active" catch:tap="onConfirm">确定</view>
</view>
<view wx:else class="city-picker-header">
<view wx:if="{{title}}" class="title">{{title}}</view>
</view>
<picker-view class="picker" indicator-class="picker-center-row" value="{{pickerValue}}" bind:change="onChange">
<picker-view-column class="picker-column">
<view wx:for="{{ pickerOptions }}" wx:key="code">{{ item.name }}</view>
</picker-view-column>
</picker-view>
<view class="city-picker-footer" wx:if="{{!headerVisible}}">
<view class="btn" hover-class="btn__active" catch:tap="onClose">取消</view>
<view class="btn primary" hover-class="btn__active" catch:tap="onConfirm">确定</view>
</view>
</view>
</t-popup>

View File

@ -1,102 +0,0 @@
.city-picker-container {
opacity: 0;
position: fixed;
top: 100vh;
left: 0;
right: 0;
height: 100vh;
z-index: 100;
}
.city-picker-container.show {
top: 0;
opacity: 1;
}
.city-picker-container.show .city-picker-box {
bottom: 0;
}
.city-picker-shadow {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.65);
}
.city-picker-header {
height: 100rpx;
line-height: 100rpx;
text-align: center;
font-size: 32rpx;
color: #333333;
}
.city-picker-more {
display: flex;
justify-content: space-between;
align-items: center;
}
.city-picker-footer {
height: 100rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.city-picker-footer .btn {
width: 330rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #666666;
font-size: 32rpx;
position: relative;
}
.city-picker-footer .btn__active {
opacity: 0.5;
}
.city-picker-footer .btn::after {
display: block;
content: ' ';
position: absolute;
left: -50%;
right: -50%;
top: -50%;
bottom: -50%;
transform: scale(0.5);
border: 1rpx solid #999999;
border-radius: 16rpx;
}
.city-picker-footer .btn.primary {
color: #fa550f;
}
.city-picker-footer .btn.primary::after {
border-color: #fa550f;
}
.picker-column:not(:first-child) {
margin-left: 40rpx;
}
.city-picker-box {
position: absolute;
bottom: -100%;
transition: 0.3s bottom ease-in-out;
left: 0;
right: 0;
z-index: 100;
background-color: #fff;
padding: 0 30rpx;
color: #333333;
font-size: 34rpx;
border-radius: 20rpx 20rpx 0 0;
padding-bottom: env(safe-area-inset-bottom);
}
.show .city-picker-shadow {
display: block;
}
.picker {
height: 300rpx;
margin: 50rpx 0;
line-height: 88rpx;
text-align: center;
}
/* 似乎小程序picker-view的bugindicator-class仅height生效其他诸如line-height、text-align等放到父class中设置 */
.picker-center-row {
height: 88rpx;
}

View File

@ -1,38 +0,0 @@
const AuthStepType = {
ONE: 1,
TWO: 2,
THREE: 3,
};
Component({
options: {
multipleSlots: true,
},
properties: {
currAuthStep: {
type: Number,
value: AuthStepType.ONE,
},
userInfo: {
type: Object,
value: {},
},
isNeedGetUserInfo: {
type: Boolean,
value: false,
},
},
data: {
defaultAvatarUrl:
'https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png',
AuthStepType,
},
methods: {
gotoUserEditPage() {
this.triggerEvent('gotoUserEditPage');
},
gotoLogin(){
wx.navigateTo({ url: '/pages/login/login' });
}
},
});

View File

@ -1,7 +0,0 @@
{
"component": true,
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-avatar": "tdesign-miniprogram/avatar/avatar"
}
}

View File

@ -1,40 +0,0 @@
<wxs module="phoneReg">
var toHide = function (array) { var mphone = array.substring(0, 3) + '****' + array.substring(7); return mphone; }
module.exports.toHide = toHide;
</wxs>
<view class="user-center-card">
<!-- 未登录的情况 -->
<block wx:if="{{currAuthStep === AuthStepType.ONE}}">
<view class="user-center-card__header" bind:tap="gotoLogin">
<t-avatar image="{{userInfo.avatarUrl || defaultAvatarUrl}}" class="user-center-card__header__avatar" />
<view class="user-center-card__header__name">{{'请登录'}}</view>
</view>
</block>
<!-- 已登录但未授权用户信息情况 -->
<block wx:if="{{currAuthStep === AuthStepType.TWO}}">
<view class="user-center-card__header">
<t-avatar image="{{userInfo.avatarUrl || defaultAvatarUrl}}" class="user-center-card__header__avatar" />
<view class="user-center-card__heade__text__box">
<view class="user-center-card__header__name">{{userInfo.nickName || '微信用户'}}</view>
<view class="user-center-card__header__phone">{{phoneReg.toHide(userInfo.phoneNumber || '')}}</view>
</view>
<!-- 需要授权用户信息通过slot添加弹窗 -->
<view class="user-center-card__header__transparent" wx:if="{{isNeedGetUserInfo}}">
<slot name="getUserInfo" />
</view>
<!-- 不需要授权用户信息仍然触发gotoUserEditPage事件 -->
<view class="user-center-card__header__transparent" bind:tap="gotoUserEditPage" wx:else></view>
</view>
</block>
<!-- 已登录且已经授权用户信息的情况 -->
<block wx:if="{{currAuthStep === AuthStepType.THREE}}">
<view class="user-center-card__header" bind:tap="gotoUserEditPage">
<t-avatar t-class="avatar" mode="aspectFill" class="user-center-card__header__avatar" image="{{userInfo.avatarUrl || defaultAvatarUrl}}" />
<view class="user-center-card__header__name">{{userInfo.nickName || '微信用户'}}</view>
<view class="user-center-card__heade__text__box">
<view class="user-center-card__header__name">{{userInfo.nickName || '微信用户'}}</view>
<view class="user-center-card__header__phone">{{phoneReg.toHide(userInfo.phoneNumber || '')}}</view>
</view>
</view>
</block>
</view>

View File

@ -1,58 +0,0 @@
.user-center-card {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 480rpx;
/* 个人信息背景图 */
background-image: url('https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png');
background-size: cover;
background-repeat: no-repeat;
padding: 0 35rpx;
}
.user-center-card__header {
margin-top: 192rpx;
margin-bottom: 48rpx;
height: 96rpx;
line-height: 48rpx;
display: flex;
justify-content: flex-start;
align-items: center;
color: #333;
position: relative;
}
.user-center-card__header__avatar {
width: 96rpx;
height: 96rpx;
border-radius: 48rpx;
overflow: hidden;
}
.user-center-card__heade__text__box{
margin-left: 24rpx;
}
.user-center-card__header__name {
font-size: 36rpx;
line-height: 48rpx;
color: #333;
font-weight: bold;
margin-right: 16rpx;
}
.user-center-card__header__phone {
font-size: 30rpx;
margin-right: 16rpx;
margin-top: 5rpx;
}
.user-center-card__header__transparent {
position: absolute;
left: 0;
top: 0;
background-color: transparent;
height: 100%;
width: 100%;
}
.user-center-card__icon {
line-height: 96rpx;
}

View File

@ -1,113 +0,0 @@
import {
getGoodsCollectionList
} from '~/services/usercenter/goods-collect/getGoodsCollectionList';
Page({
page: {
size: 10,
num: 1,
},
/**
* 页面的初始数据
*/
data: {
list: [],
goodsListLoadStatus: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init()
},
// 获取售后订单列表
init(reset = false) {
const params = {
pageSize: this.page.size,
pageNum: this.page.num,
};
this.setData({
goodsListLoadStatus: 1,
});
return getGoodsCollectionList(params)
.then((res) => {
this.page.num++;
if (res && res.data && res.data.result) {
this.setData({
list: this.data.list.concat(res.data.result),
goodsListLoadStatus: 0,
});
}
}).catch((err) => {
this.setData({
goodsListLoadStatus: 3,
});
return Promise.reject(err);
});
},
gotoGoodsDetail(e) {
const {
index
} = e.detail;
const {
spuId
} = this.data.list[index];
wx.navigateTo({
url: `/pages/goods/details/index?spuId=${spuId}`,
});
},
onReachBottom() {
if (this.data.goodsListLoadStatus === 0) {
this.init();
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,8 +0,0 @@
{
"navigationBarTitleText": "我的收藏",
"usingComponents": {
"t-empty": "tdesign-miniprogram/empty/empty",
"t-toast": "tdesign-miniprogram/toast/toast",
"load-more": "/components/load-more/index"
}
}

View File

@ -1,9 +0,0 @@
<!--pages/usercenter/goods-collect/index.wxml-->
<view wx:key="index" class="section">
<view class="goods-category-crad">
<view class="empty-wrap" wx:if="{{list.length === 0}}">
<t-empty t-class="empty-tips" size="240rpx" description="暂无收藏商品" />
</view>
<!-- 列表 -->
</view>
</view>

View File

@ -1 +0,0 @@
/* pages/usercenter/goods-collect/index.wxss */

View File

@ -1,119 +0,0 @@
import {
getGoodsBrowsingHistoryList
} from '~/services/usercenter/goods-history/getGoodsBrowsingHistoryList';
Page({
page: {
size: 10,
num: 1,
},
/**
* 页面的初始数据
*/
data: {
list: [],
goodsListLoadStatus: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init()
},
onReTry() {
this.init();
},
// 获取商品浏览记录列表
async init(reset = false) {
const params = {
pageSize: this.page.size,
pageNum: this.page.num,
};
this.setData({
goodsListLoadStatus: 1,
});
return getGoodsBrowsingHistoryList(params)
.then((res) => {
this.page.num++;
if (res && res.data && res.data.result) {
this.setData({
list: this.data.list.concat(res.data.result),
goodsListLoadStatus: 0,
});
}
})
.catch((err) => {
this.setData({
goodsListLoadStatus: 3,
});
return Promise.reject(err);
});
},
gotoGoodsDetail(e) {
const {
index
} = e.detail;
const {
spuId
} = this.data.list[index];
wx.navigateTo({
url: `/pages/goods/details/index?spuId=${spuId}`,
});
},
onReachBottom() {
if (this.data.goodsListLoadStatus === 0) {
this.init();
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,8 +0,0 @@
{
"navigationBarTitleText": "我的浏览记录",
"usingComponents": {
"t-empty": "tdesign-miniprogram/empty/empty",
"t-toast": "tdesign-miniprogram/toast/toast",
"load-more": "/components/load-more/index"
}
}

View File

@ -1,10 +0,0 @@
<!--pages/usercenter/goods-collect/index.wxml-->
<view wx:key="index" class="section">
<view class="goods-category-crad">
<view class="empty-wrap" wx:if="{{list.length === 0}}">
<t-empty t-class="empty-tips" size="240rpx" description="暂无浏览记录" />
</view>
<!-- 列表 -->
<load-more list-is-empty="{{!list.length}}" status="{{goodsListLoadStatus}}" bind:retry="onReTry" />
</view>
</view>

View File

@ -1 +0,0 @@
/* pages/usercenter/goods-history/index.wxss */

View File

@ -1,195 +0,0 @@
import {
fetchUserCenter
} from '~/services/usercenter/fetchUsercenter';
import {
getCustomerServiceList
} from '~/services/usercenter/getCustomerServiceList';
import {
getOpenId
} from '~/services/login/getOpenId';
import Toast from 'tdesign-miniprogram/toast/index';
const menuData = [
[
{
title: '设置',
tit: '',
url: '',
type: 'set',
},
],
[
// {
// title: '帮助中心',
// tit: '',
// url: '',
// type: 'help-center',
// },
{
title: '联系客服',
tit: '',
url: '',
type: 'service',
icon: 'service',
},
],
];
const getDefaultData = () => ({
showMakePhone: false,
userInfo: {
avatarUrl: '',
nickName: '正在登录...',
phoneNumber: '',
},
collectData: {
collectCount: 0,
historyCount: 0,
},
menuData,
customerServiceInfo: {},
currAuthStep: 1,
showKefu: true,
CustomerService: {},
});
Page({
data: getDefaultData(),
onLoad() {
this.onGetCustomerServiceList();
},
onShow() {
this.getTabBar().init();
this.init();
},
onPullDownRefresh() {
this.init();
},
init() {
this.fetUseriInfoHandle();
},
/** 获取客户信息 */
fetUseriInfoHandle() {
fetchUserCenter().then(
({
userInfo,
collectData,
}) => {
this.setData({
userInfo,
collectData,
currAuthStep: 2,
});
wx.stopPullDownRefresh();
},
);
},
onClickCell({
currentTarget
}) {
const {
type
} = currentTarget.dataset;
switch (type) {
case 'service': {
this.openMakePhone();
break;
}
case 'set': {
wx.navigateTo({
url: '/pages/usercenter/set/index'
});
break;
}
default: {
Toast({
context: this,
selector: '#t-toast',
message: '未知跳转',
icon: '',
duration: 1000,
});
break;
}
}
},
jumpAllOrder() {
wx.navigateTo({
url: '/pages/order/order-list/index'
});
},
jumpCollect() {
wx.navigateTo({
url: '/pages/usercenter/goods-collect/index'
});
},
jumpHistory() {
wx.navigateTo({
url: '/pages/usercenter/goods-history/index'
});
},
openMakePhone() {
this.setData({
showMakePhone: true
});
},
closeMakePhone() {
this.setData({
showMakePhone: false
});
},
call() {
wx.makePhoneCall({
phoneNumber: this.data.customerServiceInfo.servicePhone,
});
},
getOpenIdFun() {
wx.login({
success(res) {
getOpenId({
code: res.code
}).then((res) => {
wx.setStorageSync('openId', res.data)
})
},
});
},
gotoUserEditPage() {
const {
currAuthStep
} = this.data;
if (currAuthStep === 2) {
wx.navigateTo({
url: '/pages/usercenter/person-info/index'
});
} else {
// this.fetUseriInfoHandle();
}
},
// 获取客服列表
onGetCustomerServiceList() {
getCustomerServiceList().then((res) => {
if (res.code == 200) {
this.setData({
CustomerService: res.data[0]
})
}
})
},
});

View File

@ -1,13 +0,0 @@
{
"navigationBarTitleText": "个人中心",
"navigationStyle": "custom",
"usingComponents": {
"t-popup": "tdesign-miniprogram/popup/popup",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-user-center-card": "./components/user-center-card/index",
"t-toast": "tdesign-miniprogram/toast/toast"
},
"enablePullDownRefresh": true
}

View File

@ -1,44 +0,0 @@
<t-user-center-card userInfo="{{userInfo}}" isPhoneHide="{{true}}" name-class="custom-name-class" phone-class="custom-phone-class" avatar-class="customer-avatar-class" currAuthStep="{{currAuthStep}}" bind:gotoUserEditPage="gotoUserEditPage" />
<view class="content-wrapper">
<!-- 收藏和足迹 -->
<view class="order-history-box">
<view class="order-history-content-box" bind:tap="jumpCollect">
<view class="order-history-content-num">{{collectData.collectCount}}</view>
<view class="order-history-content-text">收藏</view>
</view>
<view class="order-history-content-line"></view>
<view class="order-history-content-box" bind:tap="jumpHistory">
<view class="order-history-content-num">{{collectData.historyCount}}</view>
<view class="order-history-content-text">浏览记录</view>
</view>
</view>
<!-- <button type="primary" bind:tap="getOpenIdFun">获取OpenID</button> -->
<view wx:for="{{menuData}}" wx:key="item" class="cell-box">
<t-cell-group>
<t-cell wx:for="{{item}}" wx:for-item="xitem" wx:for-index="xindex" wx:key="xindex" title="{{xitem.title}}" arrow="{{!xitem.icon}}" note="{{xitem.tit}}" data-type="{{xitem.type}}" bordered="{{false}}" bind:click="onClickCell" t-class="t-cell-padding" t-class-note="order-group-note" t-class-left="order-group__left">
<t-icon name="{{xitem.icon}}" size="48rpx" slot="note" />
</t-cell>
</t-cell-group>
</view>
</view>
<view wx:if="{{CustomerService}}">
<view class="footer__version" style="margin-top: 50rpx;">客服电话 {{CustomerService.customerServicePhone}}</view>
<view class="footer__version">工作时间 {{CustomerService.workingHoursBeginTime}}-{{CustomerService.workingHoursEndTime}}</view>
</view>
<t-popup visible="{{showMakePhone}}" placement="bottom" bind:visible-change="closeMakePhone" data-index="2">
<view class="popup-content">
<view class="customer-service-img" wx:if="{{CustomerService.customerServiceImg}}">
<image src="{{CustomerService.customerServiceImg}}" mode="widthFix" />
</view>
<!-- <view class="popup-title border-bottom-1px" wx:if="{{customerServiceInfo.serviceTimeDuration}}">
服务时间: {{customerServiceInfo.serviceTimeDuration}}
</view>
<view class="popup-phone {{showKefu ? 'border-bottom-1px' : ''}}" bind:tap="call">电话客服</view>
<button class="popup-phone border-bottom-1px online" open-type="contact" wx:if="{{showKefu}}">在线客服</button> -->
<view class="popup-close" bind:tap="closeMakePhone">取消</view>
</view>
</t-popup>
<t-toast id="t-toast" />

View File

@ -1,188 +0,0 @@
page {
background-color: #f5f5f5;
}
.content-wrapper {
margin-top: 340rpx;
position: relative;
padding: 0 30rpx;
}
.main-content {
height: 500rpx;
}
.order-group-wrapper {
margin-bottom: 16rpx;
}
.order-group-note {
font-size: 28rpx;
}
.cell-box {
border-radius: 10rpx;
overflow: hidden;
margin-bottom: 20rpx;
}
.icon-color {
color: #aaa;
}
.cell-class {
height: 100rpx;
display: flex;
align-items: center;
}
.order-content {
overflow: hidden;
width: 100%;
display: flex;
background-color: #fff;
border-radius: 16rpx;
}
.order-item {
flex: 1;
height: 180rpx;
overflow: hidden;
position: relative;
text-align: center;
}
.order-content-box {
margin: auto;
position: absolute;
width: 100%;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.order-content-t {
margin-top: 10rpx;
font-size: 24rpx;
color: #333;
letter-spacing: 0;
text-align: center;
}
.popup-content {
background: #f5f5f5;
margin-bottom: env(safe-area-inset-bottom);
border-radius: 16rpx 16rpx 0 0;
}
.popup-content .popup-title {
background: #fff;
text-align: center;
font-size: 24rpx;
color: #999;
height: 112rpx;
text-align: center;
line-height: 112rpx;
border-radius: 16rpx 16rpx 0 0;
}
.border-bottom-1px {
position: relative;
}
.border-bottom-1px::after {
position: absolute;
display: block;
content: '';
box-sizing: border-box;
top: 0;
left: 0;
width: 200%;
height: 200%;
transform: scale(0.5);
transform-origin: left top;
border-bottom: 2rpx solid #e5e5e5;
}
.popup-content .popup-phone,
.popup-content .popup-close {
background: #fff;
height: 100rpx;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
font-size: 30rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333;
}
.popup-content .popup-phone.online {
margin-bottom: 20rpx;
}
.popup-content .popup-phone.online::after {
content: none;
}
.popup-content .popup-close {
color: #333;
border: 0;
/* margin-top: 16rpx; */
}
.customer-service-img,
.customer-service-img>image {
width: 100%;
}
.my-order {
border-radius: 10rpx;
}
.footer__version {
text-align: center;
color: #999;
margin-bottom: 4rpx;
font-size: 24rpx;
line-height: 32rpx;
}
.cell-box .order-group__left {
margin-right: 0;
}
.cell-box .t-cell-padding {
padding: 24rpx 18rpx 24rpx 32rpx;
}
.order-history-box {
width: 90%;
display: flex;
justify-content: space-around;
margin: 30rpx auto;
}
.order-history-content-box {
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
}
.order-history-content-num {
font-size: 35rpx;
font-weight: bold;
margin-bottom: 10rpx;
}
.order-history-content-line {
/* width: 1rpx; */
height: 80rpx;
border: 1px solid black;
display: flex;
align-self: center;
}

View File

@ -1,19 +0,0 @@
Page({
data: {
nameValue: '',
},
onLoad(options) {
const { name } = options;
this.setData({
nameValue: name,
});
},
onSubmit() {
wx.navigateBack({ backRefresh: true });
},
clearContent() {
this.setData({
nameValue: '',
});
},
});

View File

@ -1,8 +0,0 @@
{
"navigationBarTitleText": "昵称",
"usingComponents": {
"t-input": "tdesign-miniprogram/input/input",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-button": "tdesign-miniprogram/button/button"
}
}

View File

@ -1,14 +0,0 @@
<view class="name-edit">
<t-input
borderless
model:value="{{nameValue}}"
placeholder="请输入文字"
label="昵称"
clearable
bind:clear="clearContent"
/>
<view class="name-edit__input--desc"> 最多可输入15个字 </view>
<view class="name-edit__wrapper">
<t-button block shape="round" disabled="{{!nameValue}}" bind:tap="onSubmit">保存</t-button>
</view>
</view>

View File

@ -1,18 +0,0 @@
page {
background-color: #f5f5f5;
}
page view {
box-sizing: border-box;
}
.name-edit {
padding-top: 20rpx;
}
.name-edit .name-edit__input--desc {
font-size: 26rpx;
padding: 16rpx 32rpx;
color: #999;
margin-bottom: 200rpx;
}
.name-edit .name-edit__wrapper {
margin: 0 32rpx;
}

View File

@ -1,197 +0,0 @@
import {
fetchPerson
} from '~/services/usercenter/fetchPerson';
import {
updatePerson
} from '~/services/usercenter/updatePerson';
import {
phoneEncryption
} from '~/utils/util';
import Toast from 'tdesign-miniprogram/toast/index';
import { ServerBasePath } from '~/services/_utils/request'
Page({
data: {
personInfo: {
avatarUrl: '',
nickName: '',
gender: 0,
phoneNumber: '',
},
showUnbindConfirm: false,
pickerOptions: [{
name: '男',
code: '1',
},
{
name: '女',
code: '2',
},
],
typeVisible: false,
genderMap: ['', '男', '女'],
},
onLoad() {
this.init();
},
init() {
this.fetchData();
},
fetchData() {
fetchPerson().then(({
personInfo
}) => {
this.setData({
personInfo,
'personInfo.phoneNumber': phoneEncryption(personInfo.phoneNumber),
});
});
},
/** 提交 */
submit() {
let personInfo = this.data.personInfo
let data = {
customerAvatar: personInfo.avatarUrl,
customerNickname: personInfo.nickName,
customerGender: personInfo.gender,
}
updatePerson(data).then((res) => {
if (res.code == 200) {
Toast({
context: this,
selector: '#t-toast',
message: `保存成功`,
theme: 'success',
})
wx.reLaunch({
url: `/pages/usercenter/index`,
});
}
})
},
/** 点击单元格 */
onClickCell({
currentTarget
}) {
const {
dataset
} = currentTarget;
const {
nickName
} = this.data.personInfo;
switch (dataset.type) {
case 'gender':
this.setData({
typeVisible: true,
});
break;
case 'name':
wx.navigateTo({
url: `/pages/usercenter/name-edit/index?name=${nickName}`,
});
break;
case 'avatarUrl':
this.toModifyAvatar();
break;
default: {
break;
}
}
},
onClose() {
this.setData({
typeVisible: false,
});
},
onConfirm(e) {
const {
value
} = e.detail;
this.setData({
typeVisible: false,
'personInfo.gender': value,
},
() => {
Toast({
context: this,
selector: '#t-toast',
message: '设置成功',
theme: 'success',
});
},
);
},
/** 修改昵称 */
changeNickName(e) {
this.setData({
'personInfo.nickName': e.detail.value
})
},
/** 修改头像 */
async toModifyAvatar() {
let that = this
try {
const tempFilePath = await new Promise((resolve, reject) => {
wx.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
const {
path,
size
} = res.tempFiles[0];
const tempFilePaths = res.tempFilePaths;
let tempFilePath = tempFilePaths[0];
// 上传图片到服务器
wx.uploadFile({
url: ServerBasePath + 'Common/UploadFile', // 上传接口地址
filePath: tempFilePath, // 要上传的文件的临时路径
name: 'file', // 上传文件对应的字段名
success: function (uploadRes) {
// 上传成功,服务器返回的数据
let url = JSON.parse(uploadRes.data).data.url
that.setData({
'personInfo.avatarUrl': url
})
},
fail: function (uploadError) {
// 上传失败,处理错误
console.error(uploadError);
}
});
if (size <= 10485760) {
resolve(path);
} else {
reject({
errMsg: '图片大小超出限制,请重新上传'
});
}
},
fail: (err) => reject(err),
});
});
Toast({
context: this,
selector: '#t-toast',
message: `头像上传成功`,
theme: 'success',
})
} catch (error) {
if (error.errMsg === 'chooseImage:fail cancel') return;
Toast({
context: this,
selector: '#t-toast',
message: error.errMsg || error.msg || '修改头像出错了',
theme: 'error',
});
}
},
});

View File

@ -1,15 +0,0 @@
{
"navigationBarTitleText": "个人资料",
"usingComponents": {
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-button": "tdesign-miniprogram/button/button",
"t-image": "/components/webp-image/index",
"t-dialog": "tdesign-miniprogram/dialog/dialog",
"t-toast": "tdesign-miniprogram/toast/toast",
"t-select-picker": "../components/ui-select-picker/index",
"t-upload": "tdesign-miniprogram/upload/upload",
"t-avatar": "tdesign-miniprogram/avatar/avatar",
"t-input": "tdesign-miniprogram/input/input"
}
}

View File

@ -1,47 +0,0 @@
<view class="person-info">
<t-cell-group>
<t-cell
title="头像"
center="{{true}}"
data-type="avatarUrl"
bind:click="onClickCell"
arrow
t-class-left="order-group__left"
>
<t-avatar slot="note" image="{{personInfo.avatarUrl}}" class="user-center-card__header__avatar" />
<!-- <t-image slot="note" src="{{personInfo.avatarUrl}}" t-class="avatarUrl" mode="aspectFill" /> -->
</t-cell>
<t-input value="{{ personInfo.nickName }}" label="昵称" placeholder="请输入昵称" align="right" bindchange="changeNickName" />
<t-cell
title="性别"
arrow
note="{{genderMap[personInfo.gender]}}"
data-type="gender"
bind:click="onClickCell"
t-class="t-cell-class"
t-class-left="order-group__left"
/>
<t-cell
bordered="{{false}}"
title="手机号"
arrow
note="{{personInfo.phoneNumber ? personInfo.phoneNumber : '去绑定手机号'}}"
data-type="phoneNumber"
bind:click="onClickCell"
t-class="t-cell-class"
t-class-left="order-group__left"
/>
</t-cell-group>
</view>
<view class="person-info__wrapper">
<view class="person-info__btn root-bg-color" bind:tap="submit"> 保存 </view>
</view>
<t-select-picker
show="{{typeVisible}}"
picker-options="{{pickerOptions}}"
title="选择性别"
value="{{personInfo.gender}}"
bind:confirm="onConfirm"
bind:close="onClose"
/>
<t-toast id="t-toast" />

View File

@ -1,54 +0,0 @@
:host {
background-color: #f5f5f5;
}
page view {
box-sizing: border-box;
}
.person-info {
padding-top: 20rpx;
}
.person-info__btn {
width: 100%;
color: white;
border: 2rpx solid #ddd;
border-radius: 48rpx;
padding: 18rpx 0;
display: flex;
align-self: center;
justify-content: center;
}
.person-info__wrapper {
width: 100%;
padding: 0 32rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
margin-top: 100rpx;
/* position: absolute; */
/* bottom: 0; */
/* left: 0; */
}
.avatarUrl {
width: 80rpx;
height: 80rpx;
border-radius: 50% !important;
overflow: hidden;
}
.t-class-confirm {
color: #fa550f !important;
}
.person-info .order-group__left {
margin-right: 0;
}
.person-info .t-cell-class {
height: 112rpx;
}
.user-center-card__header__avatar {
width: 96rpx;
height: 96rpx;
border-radius: 48rpx;
overflow: hidden;
}

View File

@ -1,88 +0,0 @@
// pages/usercenter/set/index.js
import { logout } from '~/services/usercenter/set/logout';
import { getPlatformSpecList } from '~/services/usercenter/set/getPlatformSpecList';
Page({
/**
* 页面的初始数据
*/
data: {
platformSpecList: []
},
//协议点击
onClickCell(data){
wx.navigateTo({
url: '/pages/login/agree-link/index?guid=' + data.currentTarget.dataset.guid
});
},
/** 登出 */
logOut(){
logout();
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
getPlatformSpecList().then((res) => {
if(res.code === 200){
this.setData({
platformSpecList: res.data
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,7 +0,0 @@
{
"usingComponents": {
"van-button": "@vant/weapp/button/index",
"t-cell": "tdesign-miniprogram/cell/cell"
},
"navigationBarTitleText": "设置"
}

View File

@ -1,29 +0,0 @@
<!-- 设置页 -->
<view class="set-pos-box">
<t-cell-group>
<t-cell
wx:for="{{platformSpecList}}"
wx:for-item="xitem"
wx:for-index="xindex"
wx:key="xindex"
title="{{xitem.platformSpecTitle}}"
arrow="true"
bordered="{{false}}"
data-guid="{{xitem.platformSpecGuid}}"
bind:click="onClickCell"
t-class="t-cell-padding"
t-class-note="order-group-note"
t-class-left="order-group__left"
>
<!-- <t-icon name="{{xitem.icon}}" size="48rpx" slot="note" /> -->
</t-cell>
</t-cell-group>
<!-- 退出登录按钮 -->
<view class="log-out-btn-box">
<van-button block round bind:click="logOut">退出当前账号</van-button>
</view>
</view>

View File

@ -1,11 +0,0 @@
/* pages/usercenter/set/index.wxss */
.log-out-btn-box{
width:85%;
position: absolute;
bottom: 10%;
left: 8%;
}