feat: 登录功能调试,添加平台客服页
This commit is contained in:
parent
b47373e7ce
commit
28271c150f
32
packages/user/customerService/index.css
Normal file
32
packages/user/customerService/index.css
Normal 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;
|
||||
}
|
||||
60
packages/user/customerService/index.vue
Normal file
60
packages/user/customerService/index.vue
Normal 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>
|
||||
@ -261,6 +261,10 @@
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "customerService/index",
|
||||
"style": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -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: 14rpx;">(头像、昵称等)</view>
|
||||
<view class="login-button">
|
||||
<button class="login-btn" open-type="getPhoneNumber" @click="headerLoginClick"
|
||||
getPhoneNumber="getPhoneNumber">
|
||||
<button
|
||||
class="login-btn"
|
||||
open-type="getPhoneNumber"
|
||||
@click="headerLoginClick"
|
||||
@getphonenumber="getPhoneNumber"
|
||||
>
|
||||
授权登录
|
||||
</button>
|
||||
</view>
|
||||
@ -64,10 +68,12 @@
|
||||
onlyAuthorize: true,
|
||||
success: (res) => {
|
||||
console.log('res', res);
|
||||
// return
|
||||
request(apiArr.login, 'POST', {
|
||||
code: res.code
|
||||
code: res.code,
|
||||
phone: '',
|
||||
password: '',
|
||||
}).then((loginRes) => {
|
||||
console.log('11231231', loginRes);
|
||||
// 存储用户信息
|
||||
uni.setStorageSync('ctoken', loginRes.token);
|
||||
uni.setStorageSync('is_deal', loginRes.is_deal);
|
||||
@ -80,7 +86,6 @@
|
||||
request(apiArr.loginInfo, 'POST', {}, {
|
||||
token: loginRes.token
|
||||
}).then((res2) => {
|
||||
console.log('11231231', res2);
|
||||
if (res2.error) return;
|
||||
// 保存userId 后续接口使用
|
||||
uni.setStorageSync('userId', res2.user_id);
|
||||
@ -99,10 +104,8 @@
|
||||
// 小程序登录获取手机号接口
|
||||
getPhoneNumber(event) {
|
||||
let that = this
|
||||
console.log('thias', that);
|
||||
const {
|
||||
isLogin
|
||||
} = this;
|
||||
console.log('小程序登录获取手机号');
|
||||
const { isLogin } = this;
|
||||
console.log('获取信息', event);
|
||||
if (event.detail.errMsg === "getPhoneNumber:ok") {
|
||||
request(apiArr.loginGetPhone, 'POST', {
|
||||
@ -154,6 +157,7 @@
|
||||
mask: true
|
||||
})
|
||||
const loginRes = await request(apiArr.login, 'POST', {
|
||||
code: '',
|
||||
phone: this.userId,
|
||||
password: this.passWord
|
||||
}, { silent: false });
|
||||
@ -207,8 +211,8 @@
|
||||
onLoad() {
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
console.log('platformplatform', systemInfo)
|
||||
this.loginChannel = systemInfo.osName;
|
||||
return;
|
||||
// this.loginChannel = systemInfo.osName;
|
||||
// return;
|
||||
if (systemInfo.uniPlatform === 'mp-weixin') {
|
||||
this.loginChannel = systemInfo.uniPlatform;
|
||||
} else {
|
||||
|
||||
@ -180,16 +180,16 @@
|
||||
{
|
||||
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_29.png",
|
||||
"name": "平台客服",
|
||||
"url": "/packages/WaterPurifier/pages/Addfriend/Addfriend",
|
||||
"url": "/packages/user/customerService/index",
|
||||
"type": "h5"
|
||||
},
|
||||
|
||||
{
|
||||
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/repairList.png",
|
||||
"name": "报修列表",
|
||||
"url": "/packages/OneRepair/pages/OwnerRepairList/OwnerRepairList",
|
||||
"type": "h5"
|
||||
},
|
||||
// {
|
||||
// "image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/repairList.png",
|
||||
// "name": "报修列表",
|
||||
// "url": "/packages/OneRepair/pages/OwnerRepairList/OwnerRepairList",
|
||||
// "type": "h5"
|
||||
// },
|
||||
|
||||
],
|
||||
shopServer: [{
|
||||
@ -278,7 +278,7 @@
|
||||
return
|
||||
}
|
||||
// 如果点击为平台客服则允许跳转
|
||||
if (event.url === '/packages/WaterPurifier/pages/Addfriend/Addfriend') {
|
||||
if (event.url === '/packages/user/customerService/index') {
|
||||
NavgateTo( event.url, { isLogin: false})
|
||||
return;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3
unpackage/dist/dev/mp-weixin/app.json
vendored
3
unpackage/dist/dev/mp-weixin/app.json
vendored
@ -58,7 +58,8 @@
|
||||
"pointsSign/index",
|
||||
"pointsRule/index",
|
||||
"marketing/index",
|
||||
"share/index"
|
||||
"share/index",
|
||||
"customerService/index"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -19373,7 +19373,7 @@ var request = function request(url) {
|
||||
}
|
||||
;
|
||||
var params = _objectSpread({
|
||||
user_id: uni.getStorageSync('userId') || 67
|
||||
user_id: uni.getStorageSync('userId')
|
||||
}, data);
|
||||
return new Promise(function (resolve, reject) {
|
||||
uni.request({
|
||||
|
||||
@ -55,7 +55,7 @@ export const request = (url, method = 'POST', data = {}, options = {}) => {
|
||||
})
|
||||
};
|
||||
let params = {
|
||||
user_id: uni.getStorageSync('userId') || 67,
|
||||
user_id: uni.getStorageSync('userId'),
|
||||
...data,
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user