feat: 登录功能调试,添加平台客服页

This commit is contained in:
mayubo@gmail.com 2025-05-09 15:16:21 +08:00
parent b47373e7ce
commit 28271c150f
10 changed files with 125 additions and 24 deletions

View File

@ -0,0 +1,32 @@
image {
width: 100%;
height: 100%;
}
.box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
.btn {
width: 650rpx;
height: 80rpx;
background: #FF512A;
border-radius: 100rpx 100rpx 100rpx 100rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
font-size: 36rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
margin-top: 120rpx;
}
#img {
width: 400rpx;
margin-bottom: 300rpx;
}

View File

@ -0,0 +1,60 @@
<template>
<view class="box">
<image id="img" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/customer.jpg" mode="widthFix"/>
<view class="btn" @click="save">保存到相册</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
save() {
uni.downloadFile({
url: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/customer.jpg',
success(res) {
console.log('downloadFile res', res);
if (res.statusCode === 200) {
const tempFilePath = res.tempFilePath; //
//
uni.saveImageToPhotosAlbum({
filePath: tempFilePath,
success() {
uni.showToast({
title: '保存成功',
icon: 'success',
});
},
fail(err) {
console.error('保存失败', err);
uni.showToast({
title: '保存失败,请重试',
icon: 'none',
});
},
});
}
},
fail(err) {
console.error('下载失败', err);
uni.showToast({
title: '下载失败,请重试',
icon: 'none',
});
},
});
},
}
}
</script>
<style>
@import url("./index.css");
</style>

View File

@ -261,6 +261,10 @@
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path": "customerService/index",
"style": {}
} }
] ]
}, },

View File

@ -17,8 +17,12 @@
<view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 30rpx;">为了更好的体验申请获取您的公开信息</view> <view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 30rpx;">为了更好的体验申请获取您的公开信息</view>
<view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 14rpx;">头像昵称等</view> <view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 14rpx;">头像昵称等</view>
<view class="login-button"> <view class="login-button">
<button class="login-btn" open-type="getPhoneNumber" @click="headerLoginClick" <button
getPhoneNumber="getPhoneNumber"> class="login-btn"
open-type="getPhoneNumber"
@click="headerLoginClick"
@getphonenumber="getPhoneNumber"
>
授权登录 授权登录
</button> </button>
</view> </view>
@ -64,10 +68,12 @@
onlyAuthorize: true, onlyAuthorize: true,
success: (res) => { success: (res) => {
console.log('res', res); console.log('res', res);
// return
request(apiArr.login, 'POST', { request(apiArr.login, 'POST', {
code: res.code code: res.code,
phone: '',
password: '',
}).then((loginRes) => { }).then((loginRes) => {
console.log('11231231', loginRes);
// //
uni.setStorageSync('ctoken', loginRes.token); uni.setStorageSync('ctoken', loginRes.token);
uni.setStorageSync('is_deal', loginRes.is_deal); uni.setStorageSync('is_deal', loginRes.is_deal);
@ -80,7 +86,6 @@
request(apiArr.loginInfo, 'POST', {}, { request(apiArr.loginInfo, 'POST', {}, {
token: loginRes.token token: loginRes.token
}).then((res2) => { }).then((res2) => {
console.log('11231231', res2);
if (res2.error) return; if (res2.error) return;
// userId 使 // userId 使
uni.setStorageSync('userId', res2.user_id); uni.setStorageSync('userId', res2.user_id);
@ -99,10 +104,8 @@
// //
getPhoneNumber(event) { getPhoneNumber(event) {
let that = this let that = this
console.log('thias', that); console.log('小程序登录获取手机号');
const { const { isLogin } = this;
isLogin
} = this;
console.log('获取信息', event); console.log('获取信息', event);
if (event.detail.errMsg === "getPhoneNumber:ok") { if (event.detail.errMsg === "getPhoneNumber:ok") {
request(apiArr.loginGetPhone, 'POST', { request(apiArr.loginGetPhone, 'POST', {
@ -154,6 +157,7 @@
mask: true mask: true
}) })
const loginRes = await request(apiArr.login, 'POST', { const loginRes = await request(apiArr.login, 'POST', {
code: '',
phone: this.userId, phone: this.userId,
password: this.passWord password: this.passWord
}, { silent: false }); }, { silent: false });
@ -207,8 +211,8 @@
onLoad() { onLoad() {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
console.log('platformplatform', systemInfo) console.log('platformplatform', systemInfo)
this.loginChannel = systemInfo.osName; // this.loginChannel = systemInfo.osName;
return; // return;
if (systemInfo.uniPlatform === 'mp-weixin') { if (systemInfo.uniPlatform === 'mp-weixin') {
this.loginChannel = systemInfo.uniPlatform; this.loginChannel = systemInfo.uniPlatform;
} else { } else {

View File

@ -180,16 +180,16 @@
{ {
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_29.png", "image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_29.png",
"name": "平台客服", "name": "平台客服",
"url": "/packages/WaterPurifier/pages/Addfriend/Addfriend", "url": "/packages/user/customerService/index",
"type": "h5" "type": "h5"
}, },
{ // {
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/repairList.png", // "image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/repairList.png",
"name": "报修列表", // "name": "",
"url": "/packages/OneRepair/pages/OwnerRepairList/OwnerRepairList", // "url": "/packages/OneRepair/pages/OwnerRepairList/OwnerRepairList",
"type": "h5" // "type": "h5"
}, // },
], ],
shopServer: [{ shopServer: [{
@ -278,7 +278,7 @@
return return
} }
// //
if (event.url === '/packages/WaterPurifier/pages/Addfriend/Addfriend') { if (event.url === '/packages/user/customerService/index') {
NavgateTo( event.url, { isLogin: false}) NavgateTo( event.url, { isLogin: false})
return; return;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,8 @@
"pointsSign/index", "pointsSign/index",
"pointsRule/index", "pointsRule/index",
"marketing/index", "marketing/index",
"share/index" "share/index",
"customerService/index"
] ]
}, },
{ {

View File

@ -19373,7 +19373,7 @@ var request = function request(url) {
} }
; ;
var params = _objectSpread({ var params = _objectSpread({
user_id: uni.getStorageSync('userId') || 67 user_id: uni.getStorageSync('userId')
}, data); }, data);
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
uni.request({ uni.request({

View File

@ -55,7 +55,7 @@ export const request = (url, method = 'POST', data = {}, options = {}) => {
}) })
}; };
let params = { let params = {
user_id: uni.getStorageSync('userId') || 67, user_id: uni.getStorageSync('userId'),
...data, ...data,
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {