Merge branch 'lr' of http://1.94.221.165:3000/sx/jiuyiUniapp
# Conflicts: # jiuyi2/pages.json
This commit is contained in:
commit
944f9da0ed
218
jiuyi2/App.vue
218
jiuyi2/App.vue
|
@ -1,122 +1,124 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
onLaunch,
|
onLaunch,
|
||||||
onExit
|
onExit
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
// 工具库
|
// 工具库
|
||||||
import util from '@/common/js/util';
|
import util from '@/common/js/util';
|
||||||
//
|
//
|
||||||
import api from '@/api/index.js'
|
import api from '@/api/index.js'
|
||||||
// vuex
|
// vuex
|
||||||
import store from '@/store/index.js'
|
import store from '@/store/index.js'
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
// 引入各种权限配置
|
// 引入各种权限配置
|
||||||
import {
|
import {
|
||||||
registerRequestPermissionTipsListener,
|
registerRequestPermissionTipsListener,
|
||||||
unregisterRequestPermissionTipsListener,
|
unregisterRequestPermissionTipsListener,
|
||||||
setRequestPermissionTips
|
setRequestPermissionTips
|
||||||
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
||||||
var PermissionTips = {
|
var PermissionTips = {
|
||||||
"android.permission.CAMERA": "<h4 style=\"font-size:40px;\">相机使用权限说明</h4><font color=#cccccc>用于在添加、上传、发布、图片和视频等场景中读取和写入相册和文件内容</font>",
|
"android.permission.CAMERA": "<h4 style=\"font-size:40px;\">相机使用权限说明</h4><font color=#cccccc>用于在添加、上传、发布、图片和视频等场景中读取和写入相册和文件内容</font>",
|
||||||
"android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">存储空间/照片权限说明</h4><font color=#cccccc>用于在添加、上传、发布、图片和视频等场景中读取和写入相册和文件内容</font>",
|
"android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">存储空间/照片权限说明</h4><font color=#cccccc>用于在添加、上传、发布、图片和视频等场景中读取和写入相册和文件内容</font>",
|
||||||
"android.permission.RECORD_AUDIO": "<h4 style=\"font-size:40px;\">录音权限说明</h4><font color=#cccccc>用于发送语音消息、语音通话功能</font>",
|
"android.permission.RECORD_AUDIO": "<h4 style=\"font-size:40px;\">录音权限说明</h4><font color=#cccccc>用于发送语音消息、语音通话功能</font>",
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
onLaunch(() => {
|
|
||||||
// 获取用户信息
|
|
||||||
getUserinfo()
|
|
||||||
// 获取系统配置
|
|
||||||
getConfig()
|
|
||||||
// #ifdef APP
|
|
||||||
// 处理用户在app端提交的权限
|
|
||||||
init()
|
|
||||||
// #endif
|
|
||||||
})
|
|
||||||
|
|
||||||
onExit(() => {
|
|
||||||
// #ifdef APP
|
|
||||||
unregisterRequestPermissionTipsListener(null)
|
|
||||||
// #endif
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理用户在app端申请的权限
|
|
||||||
* 文档地址:https://ext.dcloud.net.cn/plugin?name=uni-registerRequestPermissionTips
|
|
||||||
*/
|
|
||||||
function init() {
|
|
||||||
var brand = uni.getSystemInfoSync().deviceBrand
|
|
||||||
setRequestPermissionTips(PermissionTips)
|
|
||||||
registerRequestPermissionTipsListener({
|
|
||||||
// 申请系统权限回调
|
|
||||||
onRequest: (e) => {
|
|
||||||
console.log(e)
|
|
||||||
},
|
|
||||||
// 弹出系统权限授权框回调
|
|
||||||
onConfirm: (e) => {
|
|
||||||
console.log(e)
|
|
||||||
},
|
|
||||||
// onComplete
|
|
||||||
onComplete: (e) => {
|
|
||||||
// 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
|
||||||
if (brand.toLowerCase() == "huawei") {
|
|
||||||
var tips = {}
|
|
||||||
var hasDeniedPermission = false
|
|
||||||
for (var k in PermissionTips) {
|
|
||||||
if (e[k] != "denied") {
|
|
||||||
tips[k] = PermissionTips[k]
|
|
||||||
} else {
|
|
||||||
hasDeniedPermission = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setRequestPermissionTips(tips) // 更新弹框提醒,防止华为手机不出现权限申请框时权限提醒框闪烁的情况
|
|
||||||
if (hasDeniedPermission)
|
|
||||||
uni.showModal({
|
|
||||||
content: "权限已经被拒绝,请前往设置中开启"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
onLaunch(() => {
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
function getUserinfo() {
|
getUserinfo()
|
||||||
// 登录令牌
|
// 获取系统配置
|
||||||
const token = uni.getStorageSync('token')
|
getConfig()
|
||||||
|
// #ifdef APP
|
||||||
|
// 处理用户在app端提交的权限
|
||||||
|
init()
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
|
||||||
|
onExit(() => {
|
||||||
|
// #ifdef APP
|
||||||
|
unregisterRequestPermissionTipsListener(null)
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理用户在app端申请的权限
|
||||||
|
* 文档地址:https://ext.dcloud.net.cn/plugin?name=uni-registerRequestPermissionTips
|
||||||
|
*/
|
||||||
|
function init() {
|
||||||
|
var brand = uni.getSystemInfoSync().deviceBrand
|
||||||
|
setRequestPermissionTips(PermissionTips)
|
||||||
|
registerRequestPermissionTipsListener({
|
||||||
|
// 申请系统权限回调
|
||||||
|
onRequest: (e) => {
|
||||||
|
console.log(e)
|
||||||
|
},
|
||||||
|
// 弹出系统权限授权框回调
|
||||||
|
onConfirm: (e) => {
|
||||||
|
console.log(e)
|
||||||
|
},
|
||||||
|
// onComplete
|
||||||
|
onComplete: (e) => {
|
||||||
|
// 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
||||||
|
if (brand.toLowerCase() == "huawei") {
|
||||||
|
var tips = {}
|
||||||
|
var hasDeniedPermission = false
|
||||||
|
for (var k in PermissionTips) {
|
||||||
|
if (e[k] != "denied") {
|
||||||
|
tips[k] = PermissionTips[k]
|
||||||
|
} else {
|
||||||
|
hasDeniedPermission = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setRequestPermissionTips(tips) // 更新弹框提醒,防止华为手机不出现权限申请框时权限提醒框闪烁的情况
|
||||||
|
if (hasDeniedPermission)
|
||||||
|
uni.showModal({
|
||||||
|
content: "权限已经被拒绝,请前往设置中开启"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户信息
|
||||||
|
function getUserinfo() {
|
||||||
|
// 登录令牌
|
||||||
|
const token = uni.getStorageSync('token')
|
||||||
|
// 用户信息
|
||||||
|
const userinfo = uni.getStorageSync('userinfo')
|
||||||
|
|
||||||
|
// 如果登录保活
|
||||||
|
if (token) {
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userinfo = uni.getStorageSync('userinfo')
|
if (userinfo) store.commit('setState', {
|
||||||
|
key: 'userinfo',
|
||||||
|
value: userinfo
|
||||||
|
})
|
||||||
|
|
||||||
// 如果登录保活
|
//
|
||||||
if (token) {
|
util.getUserinfo().then(rs => {
|
||||||
// 用户信息
|
if (userinfo.isRealName) {
|
||||||
if (userinfo) store.commit('setState', {
|
|
||||||
key: 'userinfo',
|
|
||||||
value: userinfo
|
|
||||||
})
|
|
||||||
|
|
||||||
//
|
|
||||||
util.getUserinfo().then(rs => {
|
|
||||||
// 腾讯im登录
|
// 腾讯im登录
|
||||||
util.loginTencent(userinfo)
|
util.loginTencent(userinfo)
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取系统配置
|
|
||||||
function getConfig() {
|
|
||||||
api.getConfig().then(rs => {
|
|
||||||
if (rs.code == 200) {
|
|
||||||
store.commit('setState', {
|
|
||||||
key: 'config',
|
|
||||||
value: rs.data
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取系统配置
|
||||||
|
function getConfig() {
|
||||||
|
api.getConfig().then(rs => {
|
||||||
|
if (rs.code == 200) {
|
||||||
|
store.commit('setState', {
|
||||||
|
key: 'config',
|
||||||
|
value: rs.data
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
@import "./common/css/style.scss";
|
@import "./common/css/style.scss";
|
||||||
</style>
|
</style>
|
|
@ -416,6 +416,45 @@ const mine = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改账号
|
||||||
|
* @param {Object} param
|
||||||
|
*/
|
||||||
|
updateAccount(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/home/update/account`,
|
||||||
|
data: param.data,
|
||||||
|
method: 'POST',
|
||||||
|
load: true,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改手机号
|
||||||
|
* @param {Object} param
|
||||||
|
*/
|
||||||
|
updatePhone(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/login/updatePhone`,
|
||||||
|
data: param.data,
|
||||||
|
method: 'POST',
|
||||||
|
load: true,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改登录密码
|
||||||
|
* @param {Object} param
|
||||||
|
*/
|
||||||
|
updatePassword(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/login/updatePassword`,
|
||||||
|
data: param.data,
|
||||||
|
method: 'POST',
|
||||||
|
load: true,
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default mine
|
export default mine
|
|
@ -240,9 +240,9 @@ const shop = {
|
||||||
*/
|
*/
|
||||||
merchant(param) {
|
merchant(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/shopify/merchant`,
|
url: `/shopify/appMerInfoApi/getMerDetail`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: param.path,
|
query: param.query,
|
||||||
load: true,
|
load: true,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -224,20 +224,21 @@ function handleAlert(ev) {
|
||||||
|
|
||||||
// 获取未读消息数量
|
// 获取未读消息数量
|
||||||
function getNoReadNum() {
|
function getNoReadNum() {
|
||||||
// 验证sdk是否准备完毕
|
if (userinfo.value.isRealName) {
|
||||||
let isReady = uni.$chat.isReady();
|
// 验证sdk是否准备完毕
|
||||||
if (!isReady) {
|
let isReady = uni.$chat.isReady();
|
||||||
setTimeout(function () {
|
if (!isReady) {
|
||||||
getNoReadNum();
|
setTimeout(function () {
|
||||||
}, 800);
|
getNoReadNum();
|
||||||
return
|
}, 800);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// #ifdef APP
|
||||||
|
const unreadCount = uni.$chat.getTotalUnreadMessageCount();
|
||||||
|
noReadNum.value = +unreadCount > 99 ? '99+' : unreadCount;
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// #ifdef APP
|
|
||||||
const unreadCount = uni.$chat.getTotalUnreadMessageCount();
|
|
||||||
noReadNum.value = +unreadCount > 99 ? '99+' : unreadCount;
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -89,23 +89,26 @@ function handleBuy() {
|
||||||
|
|
||||||
// 客服
|
// 客服
|
||||||
function toCustomer() {
|
function toCustomer() {
|
||||||
api.shop.getCustomerService({ merchantId: props.detail.merId }).then(rs => {
|
uni.navigateTo({
|
||||||
if (rs.code == 200) {
|
url: util.setUrl('/pages/mine/setting/feedback')
|
||||||
let param = {};
|
|
||||||
param.type = 'C2C'
|
|
||||||
param.name = `${props.detail.merName}`
|
|
||||||
param.msgId = `${rs.data.serviceId}`
|
|
||||||
param.isCustomer = true
|
|
||||||
|
|
||||||
util.toChat(param)
|
|
||||||
|
|
||||||
uni.navigateTo({
|
|
||||||
url: util.setUrl('/pages/news/chat/chat', param)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
util.alert(rs.msg)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
// api.shop.getCustomerService({ merchantId: props.detail.merId }).then(rs => {
|
||||||
|
// if (rs.code == 200) {
|
||||||
|
// let param = {};
|
||||||
|
// param.type = 'C2C'
|
||||||
|
// param.name = `${props.detail.merName}`
|
||||||
|
// param.msgId = `${rs.data.serviceId}`
|
||||||
|
// param.isCustomer = true
|
||||||
|
|
||||||
|
// util.toChat(param)
|
||||||
|
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: util.setUrl('/pages/news/chat/chat', param)
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// util.alert(rs.msg)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -116,7 +119,7 @@ function toCustomer() {
|
||||||
<view class="menu df fdr jcsb aic">
|
<view class="menu df fdr jcsb aic">
|
||||||
<view class="option df fdc aic">
|
<view class="option df fdc aic">
|
||||||
<image class="wh30" src="/static/store.png" mode="aspectFit" />
|
<image class="wh30" src="/static/store.png" mode="aspectFit" />
|
||||||
<text class="text mt10">店铺</text>
|
<text class="text mt10" @click="link(`/pages/shop/store/index?storeId=${detail.merId}`)">店铺</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="option df fdc aic" @click="handleCollect">
|
<view class="option df fdc aic" @click="handleCollect">
|
||||||
|
|
|
@ -753,8 +753,27 @@
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : "隐私设置"
|
"navigationBarTitleText" : "隐私设置"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/mine/setting/updateAccount",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "修改账号"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/mine/setting/updatePhoneNum",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "修改手机号"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/mine/setting/loginPassword",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "登录密码"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
{
|
{
|
||||||
"root": "TUIKit",
|
"root": "TUIKit",
|
||||||
|
|
|
@ -58,7 +58,6 @@ function toCustomer() {
|
||||||
|
|
||||||
util.toChat(param)
|
util.toChat(param)
|
||||||
|
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: util.setUrl('/pages/news/chat/chat', param)
|
url: util.setUrl('/pages/news/chat/chat', param)
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
<script setup>
|
||||||
|
/**
|
||||||
|
* 修改账号
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
computed,
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
useStore
|
||||||
|
} from 'vuex'
|
||||||
|
// 工具库
|
||||||
|
import util from '@/common/js/util.js'
|
||||||
|
// api
|
||||||
|
import api from '@/api/index.js'
|
||||||
|
// 加密
|
||||||
|
import CryptoJS from 'crypto-js';
|
||||||
|
|
||||||
|
// 显示密码
|
||||||
|
const showPwd = ref(false)
|
||||||
|
const showPwds = ref(false)
|
||||||
|
//
|
||||||
|
const store = useStore()
|
||||||
|
// 表单
|
||||||
|
const form = reactive({
|
||||||
|
oldPassword: '',
|
||||||
|
password: ''
|
||||||
|
})
|
||||||
|
// 用户信息
|
||||||
|
const userinfo = computed(() => {
|
||||||
|
let result = store.state.userinfo
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
// 实名认证
|
||||||
|
function handleSubmit() {
|
||||||
|
const data = {
|
||||||
|
...form
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
if (!data.oldPassword) {
|
||||||
|
util.alert('请输入旧密码')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!data.password) {
|
||||||
|
util.alert('请输入新密码')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data.oldPassword = CryptoJS.MD5(data.oldPassword).toString();
|
||||||
|
data.password = CryptoJS.MD5(data.password).toString();
|
||||||
|
|
||||||
|
api.mine.updatePassword({ data }).then(rs => {
|
||||||
|
if (rs.code == 200) {
|
||||||
|
util.alert('修改成功')
|
||||||
|
util.getUserinfo()
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 500)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="line df aic">
|
||||||
|
<view class="key">旧密码</view>
|
||||||
|
<view class="value">
|
||||||
|
<input :password="showPwd ? false : true" v-model="form.oldPassword" placeholder="请输入旧密码" />
|
||||||
|
</view>
|
||||||
|
<view class="btn sm ml20 plr20">
|
||||||
|
<uni-icons :type="showPwd ? 'eye' : 'eye-slash'" color="#999" size="40rpx"
|
||||||
|
@click="showPwd = !showPwd" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="line df aic">
|
||||||
|
<view class="key">新密码</view>
|
||||||
|
<view class="value">
|
||||||
|
<input :password="showPwds ? false : true" v-model="form.password" placeholder="请输入新密码" />
|
||||||
|
</view>
|
||||||
|
<view class="btn sm ml20 plr20">
|
||||||
|
<uni-icons :type="showPwds ? 'eye' : 'eye-slash'" color="#999" size="40rpx"
|
||||||
|
@click="showPwds = !showPwds" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn bar lg black mtb60 mlr60" @click="handleSubmit">提交</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
// 容器
|
||||||
|
.container {
|
||||||
|
padding: 50rpx 30rpx;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 34rpx;
|
||||||
|
|
||||||
|
.line {
|
||||||
|
padding: 35rpx 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.key {
|
||||||
|
width: 200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,139 +1,139 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
// 设置
|
// 设置
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
computed,
|
computed,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
useStore
|
useStore
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
// 工具库
|
// 工具库
|
||||||
import util from '@/common/js/util.js'
|
import util from '@/common/js/util.js'
|
||||||
// api
|
// api
|
||||||
import api from '@/api/index.js'
|
import api from '@/api/index.js'
|
||||||
// 腾讯云聊天
|
// 腾讯云聊天
|
||||||
import TencentCloudChat from '@tencentcloud/chat';
|
import TencentCloudChat from '@tencentcloud/chat';
|
||||||
// 仓库
|
// 仓库
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userinfo = computed(() => store.state.userinfo)
|
const userinfo = computed(() => store.state.userinfo)
|
||||||
// 添加好友方式
|
// 添加好友方式
|
||||||
const allowType = [{
|
const allowType = [{
|
||||||
id: 'AllowType_Type_AllowAny',
|
id: 'AllowType_Type_AllowAny',
|
||||||
name: '允许任何人添加',
|
name: '允许任何人添加',
|
||||||
}, {
|
}, {
|
||||||
id: 'AllowType_Type_NeedConfirm',
|
id: 'AllowType_Type_NeedConfirm',
|
||||||
name: '需要确认才能添加',
|
name: '需要确认才能添加',
|
||||||
}, {
|
}, {
|
||||||
id: 'AllowType_Type_DenyAny',
|
id: 'AllowType_Type_DenyAny',
|
||||||
name: '不允许任何人添加 ',
|
name: '不允许任何人添加 ',
|
||||||
}, ]
|
},]
|
||||||
// 添加好友下标
|
// 添加好友下标
|
||||||
const allowTypeIndex = ref(0)
|
const allowTypeIndex = ref(0)
|
||||||
// im用户信息
|
// im用户信息
|
||||||
const imUserinfo = ref({})
|
const imUserinfo = ref({})
|
||||||
// app版本号
|
// app版本号
|
||||||
const appVersion = ref(0)
|
const appVersion = ref(0)
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
util.isLogin(() => {
|
util.isLogin(() => {
|
||||||
// 获取添加好友方式
|
// 获取添加好友方式
|
||||||
getAddType()
|
getAddType()
|
||||||
})
|
|
||||||
// #ifdef APP
|
|
||||||
let system = uni.getSystemInfoSync()
|
|
||||||
appVersion.value = system.appVersion
|
|
||||||
// #endif
|
|
||||||
})
|
})
|
||||||
|
// #ifdef APP
|
||||||
|
let system = uni.getSystemInfoSync()
|
||||||
|
appVersion.value = system.appVersion
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
|
||||||
// 修改加好友方式
|
// 修改加好友方式
|
||||||
function handleAllowType(ev) {
|
function handleAllowType(ev) {
|
||||||
const index = ev.detail.value
|
const index = ev.detail.value
|
||||||
if (index === allowTypeIndex.value) return
|
if (index === allowTypeIndex.value) return
|
||||||
allowTypeIndex.value = index
|
allowTypeIndex.value = index
|
||||||
// 更新个人资料
|
// 更新个人资料
|
||||||
updateMyProfile()
|
updateMyProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取添加好友方式
|
// 获取添加好友方式
|
||||||
function getAddType() {
|
function getAddType() {
|
||||||
api.mine.getImUserInfo({
|
api.mine.getImUserInfo({
|
||||||
query: {
|
query: {
|
||||||
userIds: userinfo.value.id
|
userIds: userinfo.value.id
|
||||||
}
|
}
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.code === 200) {
|
if (rs.code === 200) {
|
||||||
console.log('rs', rs)
|
console.log('rs', rs)
|
||||||
const result = JSON.parse(rs.msg)
|
const result = JSON.parse(rs.msg)
|
||||||
allowTypeIndex.value = allowType.findIndex(item => item.id === result.UserProfileItem[0]
|
allowTypeIndex.value = allowType.findIndex(item => item.id === result.UserProfileItem[0]
|
||||||
.ProfileItem[0].Value)
|
.ProfileItem[0].Value)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新im个人资料
|
||||||
|
function updateMyProfile() {
|
||||||
|
// 修改个人标配资料
|
||||||
|
api.mine.setImUserInfo({
|
||||||
|
query: {
|
||||||
|
'allowType': allowType[allowTypeIndex.value].id,
|
||||||
|
userId: userinfo.value.id,
|
||||||
|
},
|
||||||
|
}).then(rs => {
|
||||||
|
if (rs.code != 200)
|
||||||
util.alert({
|
util.alert({
|
||||||
content: rs.msg,
|
content: rs.msg,
|
||||||
showCancel: false
|
showCancel: false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新im个人资料
|
// 登录跳转
|
||||||
function updateMyProfile() {
|
function loginLink(url) {
|
||||||
// 修改个人标配资料
|
util.isLogin().then(() => {
|
||||||
api.mine.setImUserInfo({
|
link(url)
|
||||||
query: {
|
}).catch(() => {
|
||||||
'allowType': allowType[allowTypeIndex.value].id,
|
link('/pages/login/login')
|
||||||
userId: userinfo.value.id,
|
})
|
||||||
},
|
}
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code != 200)
|
|
||||||
util.alert({
|
|
||||||
content: rs.msg,
|
|
||||||
showCancel: false
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 登录跳转
|
// 跳转
|
||||||
function loginLink(url) {
|
function link(url) {
|
||||||
util.isLogin().then(() => {
|
uni.navigateTo({
|
||||||
link(url)
|
url,
|
||||||
}).catch(() => {
|
})
|
||||||
link('/pages/login/login')
|
}
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 跳转
|
// 退出登录
|
||||||
function link(url) {
|
function logOff() {
|
||||||
uni.navigateTo({
|
util.alert({
|
||||||
url,
|
title: '提示',
|
||||||
})
|
content: '确定退出登录?',
|
||||||
}
|
}).then(res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
api.login.logout({
|
||||||
|
query: {
|
||||||
|
phoneNumber: userinfo.phoneNumber,
|
||||||
|
}
|
||||||
|
}).then(rs => { })
|
||||||
|
|
||||||
// 退出登录
|
// 退出登录
|
||||||
function logOff() {
|
util.logout(() => {
|
||||||
util.alert({
|
// #ifdef APP
|
||||||
title: '提示',
|
plus.runtime.restart()
|
||||||
content: '确定退出登录?',
|
// #endif
|
||||||
}).then(res => {
|
})
|
||||||
if (res.confirm) {
|
}
|
||||||
api.login.logout({
|
})
|
||||||
query: {
|
}
|
||||||
phoneNumber: userinfo.phoneNumber,
|
|
||||||
}
|
|
||||||
}).then(rs => {})
|
|
||||||
|
|
||||||
// 退出登录
|
|
||||||
util.logout(() => {
|
|
||||||
// #ifdef APP
|
|
||||||
plus.runtime.restart()
|
|
||||||
// #endif
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -146,19 +146,25 @@
|
||||||
<image class="head-portrait wh80" :src="userinfo.avatar" mode="aspectFill" />
|
<image class="head-portrait wh80" :src="userinfo.avatar" mode="aspectFill" />
|
||||||
</view>
|
</view>
|
||||||
<view class="info f1 ml20">
|
<view class="info f1 ml20">
|
||||||
<view class="">{{userinfo.userNickname}}</view>
|
<view class="">{{ userinfo.userNickname }}</view>
|
||||||
<!-- <view class="account mt10 c999 f26">账号:{{userinfo.account}}</view> -->
|
<!-- <view class="account mt10 c999 f26">账号:{{userinfo.account}}</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="line rows">
|
<view class="line rows" @click="link('/pages/mine/setting/updateAccount')">
|
||||||
<view class="">修改账号</view>
|
<view class="key">修改账号</view>
|
||||||
<view class="f1 tar c999 f28">{{userinfo.account}}</view>
|
<view class="col f1 ml20 tar c999 f28">
|
||||||
|
<view class="">{{ userinfo.account }}</view>
|
||||||
|
</view>
|
||||||
|
<uni-icons class="ml20" type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="line rows">
|
<view class="line rows" @click="link('/pages/mine/setting/updatePhoneNum')">
|
||||||
<view class="">绑定手机号</view>
|
<view class="key">修改手机号</view>
|
||||||
<view class="f1 tar c999 f28">{{userinfo.phoneNumber}}</view>
|
<view class="col f1 ml20 tar c999 f28">
|
||||||
|
<view class="">{{ userinfo.phoneNumber }}</view>
|
||||||
|
</view>
|
||||||
|
<uni-icons class="ml20" type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="line rows" @click="link('/pages/mine/realname')">
|
<view class="line rows" @click="link('/pages/mine/realname')">
|
||||||
|
@ -189,7 +195,7 @@
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="line rows">
|
<view class="line rows" @click="link('/pages/mine/setting/loginPassword')">
|
||||||
<view class="">登录密码</view>
|
<view class="">登录密码</view>
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
@ -222,7 +228,7 @@
|
||||||
<view class=" rows">
|
<view class=" rows">
|
||||||
<view class="">好友验证方式</view>
|
<view class="">好友验证方式</view>
|
||||||
<view class="value mlr20 f1 tar c666 f28">
|
<view class="value mlr20 f1 tar c666 f28">
|
||||||
{{allowType[allowTypeIndex].name}}
|
{{ allowType[allowTypeIndex].name }}
|
||||||
</view>
|
</view>
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
@ -247,17 +253,17 @@
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article',{id: 2,}))">
|
<view class="line rows" @click="link(util.setUrl('/pages/index/article', { id: 2, }))">
|
||||||
<view class="">关于我们</view>
|
<view class="">关于我们</view>
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article',{id: 3,}))">
|
<view class="line rows" @click="link(util.setUrl('/pages/index/article', { id: 3, }))">
|
||||||
<view class="">用户协议</view>
|
<view class="">用户协议</view>
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article',{id: 1,}))">
|
<view class="line rows" @click="link(util.setUrl('/pages/index/article', { id: 1, }))">
|
||||||
<view class="">隐私政策</view>
|
<view class="">隐私政策</view>
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
@ -265,7 +271,7 @@
|
||||||
<!-- #ifdef APP -->
|
<!-- #ifdef APP -->
|
||||||
<view class="line rows ptb20 plr10">
|
<view class="line rows ptb20 plr10">
|
||||||
<view class="">版本号</view>
|
<view class="">版本号</view>
|
||||||
<view class="c999 f28">{{appVersion}}</view>
|
<view class="c999 f28">{{ appVersion }}</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
|
@ -287,27 +293,27 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
//
|
//
|
||||||
.area {
|
.area {
|
||||||
margin: 30rpx;
|
margin: 30rpx;
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
padding: 20rpx 10rpx;
|
padding: 20rpx 10rpx;
|
||||||
}
|
|
||||||
|
|
||||||
.line+.line {
|
|
||||||
border-top: 1px solid #eeeeee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-portrait {
|
|
||||||
background: #999999;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 20rpx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.line+.line {
|
||||||
|
border-top: 1px solid #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.head-portrait {
|
||||||
|
background: #999999;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -0,0 +1,93 @@
|
||||||
|
<script setup>
|
||||||
|
/**
|
||||||
|
* 修改账号
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
reactive,
|
||||||
|
computed,
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
useStore
|
||||||
|
} from 'vuex'
|
||||||
|
// 工具库
|
||||||
|
import util from '@/common/js/util.js'
|
||||||
|
// api
|
||||||
|
import api from '@/api/index.js'
|
||||||
|
|
||||||
|
//
|
||||||
|
const store = useStore()
|
||||||
|
// 表单
|
||||||
|
const form = reactive({
|
||||||
|
id: '',
|
||||||
|
account: ''
|
||||||
|
})
|
||||||
|
// 用户信息
|
||||||
|
const userinfo = computed(() => {
|
||||||
|
let result = store.state.userinfo
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
// 实名认证
|
||||||
|
function handleSubmit() {
|
||||||
|
const data = {
|
||||||
|
...form
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
if (!data.account) {
|
||||||
|
util.alert('请输入账号')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data.id = userinfo.value.id
|
||||||
|
|
||||||
|
api.mine.updateAccount({ data }).then(rs => {
|
||||||
|
if (rs.code == 200) {
|
||||||
|
util.alert('修改成功')
|
||||||
|
util.getUserinfo()
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 500)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="line df aic">
|
||||||
|
<view class="key">账号</view>
|
||||||
|
<view class="value">
|
||||||
|
<input class="input" type="text" v-model="form.account" placeholder="请输入账号" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn bar lg black mtb60 mlr60" @click="handleSubmit">提交</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
// 容器
|
||||||
|
.container {
|
||||||
|
padding: 50rpx 30rpx;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 34rpx;
|
||||||
|
|
||||||
|
.line {
|
||||||
|
padding: 35rpx 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.key {
|
||||||
|
width: 200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,118 @@
|
||||||
|
<script setup>
|
||||||
|
/**
|
||||||
|
* 修改手机号
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
reactive,
|
||||||
|
computed,
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
useStore
|
||||||
|
} from 'vuex'
|
||||||
|
// 获取验证码
|
||||||
|
import getCode from '@/components/getCode/getCode.vue'
|
||||||
|
// 工具库
|
||||||
|
import util from '@/common/js/util.js'
|
||||||
|
// api
|
||||||
|
import api from '@/api/index.js'
|
||||||
|
|
||||||
|
//
|
||||||
|
const store = useStore()
|
||||||
|
// 表单
|
||||||
|
const form = reactive({
|
||||||
|
phoneNumber: '',
|
||||||
|
verifyCode: ''
|
||||||
|
})
|
||||||
|
// 用户信息
|
||||||
|
const userinfo = computed(() => {
|
||||||
|
let result = store.state.userinfo
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
// 实名认证
|
||||||
|
function handleSubmit() {
|
||||||
|
const data = {
|
||||||
|
...form
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
if (!data.phoneNumber) {
|
||||||
|
util.alert('请输入手机号')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!data.verifyCode) {
|
||||||
|
util.alert('请输入验证码')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
api.mine.updatePhone({ data }).then(rs => {
|
||||||
|
if (rs.code == 200) {
|
||||||
|
util.alert('修改成功')
|
||||||
|
util.getUserinfo()
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 500)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="line df aic">
|
||||||
|
<view class="key">手机号</view>
|
||||||
|
<view class="value">
|
||||||
|
<input class="input" type="text" v-model="form.phoneNumber" placeholder="请输入手机号" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="line df aic">
|
||||||
|
<view class="key">验证码</view>
|
||||||
|
<view class="value">
|
||||||
|
<input type="text" v-model="form.verifyCode" placeholder="请输入验证码" class="f1" />
|
||||||
|
</view>
|
||||||
|
<view class="getCode btn sm ml20 plr20">
|
||||||
|
<getCode :phone="form.phoneNumber" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn bar lg black mtb60 mlr60" @click="handleSubmit">提交</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
// 容器
|
||||||
|
.container {
|
||||||
|
padding: 50rpx 30rpx;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 34rpx;
|
||||||
|
|
||||||
|
.line+.line {
|
||||||
|
border-top: 2rpx solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
padding: 35rpx 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.key {
|
||||||
|
width: 200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取验证码
|
||||||
|
.getCode {
|
||||||
|
color: #666;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,132 +1,144 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* 个人信息
|
* 个人信息
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
computed,
|
computed,
|
||||||
reactive,
|
reactive,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import {
|
import {
|
||||||
useStore
|
useStore
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
// 工具库
|
// 工具库
|
||||||
import util from '@/common/js/util';
|
import util from '@/common/js/util';
|
||||||
// 接口
|
// 接口
|
||||||
import api from '@/api';
|
import api from '@/api';
|
||||||
|
|
||||||
// vuex
|
// vuex
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
// 用户
|
// 用户
|
||||||
const user = reactive({})
|
const user = reactive({})
|
||||||
|
|
||||||
// 性别
|
// 性别
|
||||||
const gender = reactive([{
|
const gender = reactive([{
|
||||||
id: 0,
|
id: 0,
|
||||||
name: '男',
|
name: '男',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '女',
|
name: '女',
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
// 性别下标
|
// 性别下标
|
||||||
const genderIndex = ref(0)
|
const genderIndex = ref(0)
|
||||||
|
|
||||||
onLoad(() => {
|
|
||||||
// 同步用户信息
|
|
||||||
syncInfo()
|
|
||||||
})
|
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
// 同步用户信息
|
// 同步用户信息
|
||||||
function syncInfo() {
|
syncInfo()
|
||||||
// 用户信息
|
})
|
||||||
const userinfo = store.state.userinfo
|
|
||||||
user.background = userinfo.background
|
|
||||||
user.account = userinfo.account
|
|
||||||
user.userAccount = userinfo.userAccount
|
|
||||||
user.userNickname = userinfo.userNickname
|
|
||||||
user.homeTown = userinfo.homeTown
|
|
||||||
user.personalSignature = userinfo.personalSignature
|
|
||||||
user.id = userinfo.id + ''
|
|
||||||
user.birthday = userinfo.birthday
|
|
||||||
user.avatar = userinfo.avatar
|
|
||||||
// 修改性别下标
|
|
||||||
genderIndex.value = gender.findIndex(item => item.id == userinfo.sex)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// 同步用户信息
|
||||||
* 选择生日日期
|
function syncInfo() {
|
||||||
* @param {Object} ev 默认事件
|
// 用户信息
|
||||||
*/
|
const userinfo = store.state.userinfo
|
||||||
function handleBirthday(ev) {
|
user.background = userinfo.background
|
||||||
const value = ev.detail.value
|
user.account = userinfo.account
|
||||||
if (user.birthday === value) return
|
user.userAccount = userinfo.userAccount
|
||||||
user.birthday = value
|
user.userNickname = userinfo.userNickname
|
||||||
}
|
user.homeTown = userinfo.homeTown
|
||||||
|
user.personalSignature = userinfo.personalSignature
|
||||||
|
user.id = userinfo.id + ''
|
||||||
|
user.birthday = userinfo.birthday
|
||||||
|
user.avatar = userinfo.avatar
|
||||||
|
user.email = userinfo.email
|
||||||
|
// 修改性别下标
|
||||||
|
genderIndex.value = gender.findIndex(item => item.id == userinfo.sex)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择性别
|
* 选择生日日期
|
||||||
* @param {Object} ev 默认事件
|
* @param {Object} ev 默认事件
|
||||||
*/
|
*/
|
||||||
function handleGender(ev) {
|
function handleBirthday(ev) {
|
||||||
const value = ev.detail.value
|
const value = ev.detail.value
|
||||||
if (genderIndex.value === value) return
|
if (user.birthday === value) return
|
||||||
genderIndex.value = value
|
user.birthday = value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传图片
|
* 选择性别
|
||||||
* @param {String} key 需要修改个人信息的字段
|
* @param {Object} ev 默认事件
|
||||||
*/
|
*/
|
||||||
function uploadImg(key) {
|
function handleGender(ev) {
|
||||||
util.upload_image({
|
const value = ev.detail.value
|
||||||
value: user[key],
|
if (genderIndex.value === value) return
|
||||||
type: 1,
|
genderIndex.value = value
|
||||||
success: rs => {
|
}
|
||||||
// 同步值
|
|
||||||
user[key] = rs.value
|
|
||||||
console.log('user', user)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存个人信息
|
/**
|
||||||
function handleSubmit() {
|
* 上传图片
|
||||||
// 同步性别值
|
* @param {String} key 需要修改个人信息的字段
|
||||||
if (gender[genderIndex.value]) user.sex = gender[genderIndex.value].id
|
*/
|
||||||
|
function uploadImg(key) {
|
||||||
const data = {
|
util.upload_image({
|
||||||
...user,
|
value: user[key],
|
||||||
|
type: 1,
|
||||||
|
success: rs => {
|
||||||
|
// 同步值
|
||||||
|
user[key] = rs.value
|
||||||
|
console.log('user', user)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 去域名地址
|
// 保存个人信息
|
||||||
// if(data.avatar) data.avatar = util.replace_url(data.avatar)
|
function handleSubmit() {
|
||||||
// if(data.background) data.background = util.replace_url(data.background)
|
// 同步性别值
|
||||||
|
if (gender[genderIndex.value]) user.sex = gender[genderIndex.value].id
|
||||||
|
|
||||||
//
|
if (!IsEmail(user.email)) {
|
||||||
api.mine.updateUserInfo({
|
util.alert('邮箱格式不正确!')
|
||||||
data,
|
return
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code === 200) {
|
|
||||||
store.commit('setState', {
|
|
||||||
key: 'userinfo',
|
|
||||||
value: Object.assign(store.state.userinfo, user)
|
|
||||||
})
|
|
||||||
|
|
||||||
util.alert('修改成功')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
util.alert({
|
|
||||||
content: rs.msg,
|
|
||||||
showCancel: false,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
...user,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 去域名地址
|
||||||
|
// if(data.avatar) data.avatar = util.replace_url(data.avatar)
|
||||||
|
// if(data.background) data.background = util.replace_url(data.background)
|
||||||
|
|
||||||
|
//
|
||||||
|
api.mine.updateUserInfo({
|
||||||
|
data,
|
||||||
|
}).then(rs => {
|
||||||
|
if (rs.code === 200) {
|
||||||
|
store.commit('setState', {
|
||||||
|
key: 'userinfo',
|
||||||
|
value: Object.assign(store.state.userinfo, user)
|
||||||
|
})
|
||||||
|
|
||||||
|
util.alert('修改成功')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 校验邮箱地址
|
||||||
|
function IsEmail(str) {
|
||||||
|
var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
|
||||||
|
return reg.test(str);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -156,7 +168,7 @@
|
||||||
<view class="line rows ptb20">
|
<view class="line rows ptb20">
|
||||||
<view class="key">账号</view>
|
<view class="key">账号</view>
|
||||||
<view class="value tar f1">
|
<view class="value tar f1">
|
||||||
<text>{{user.account}}</text>
|
<text>{{ user.account }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -171,7 +183,7 @@
|
||||||
<view class="line rows ptb20">
|
<view class="line rows ptb20">
|
||||||
<view class="key">生日</view>
|
<view class="key">生日</view>
|
||||||
<picker class="value tar f1" mode="date" @change="handleBirthday">
|
<picker class="value tar f1" mode="date" @change="handleBirthday">
|
||||||
<text v-if="user.birthday">{{user.birthday}}</text>
|
<text v-if="user.birthday">{{ user.birthday }}</text>
|
||||||
<text v-else>请选择</text>
|
<text v-else>请选择</text>
|
||||||
</picker>
|
</picker>
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
|
@ -182,7 +194,7 @@
|
||||||
<picker class="value tar f1" :range="gender" :value="genderIndex" range-key="name"
|
<picker class="value tar f1" :range="gender" :value="genderIndex" range-key="name"
|
||||||
@change="handleGender">
|
@change="handleGender">
|
||||||
<text v-if="genderIndex == -1">请选择</text>
|
<text v-if="genderIndex == -1">请选择</text>
|
||||||
<text v-else>{{gender[genderIndex].name}}</text>
|
<text v-else>{{ gender[genderIndex].name }}</text>
|
||||||
</picker>
|
</picker>
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
@ -195,6 +207,14 @@
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="line rows ptb20">
|
||||||
|
<view class="key">邮箱</view>
|
||||||
|
<view class="value tar f1">
|
||||||
|
<input type="text" v-model="user.email" placeholder="请输入你的邮箱" />
|
||||||
|
</view>
|
||||||
|
<uni-icons type="right" />
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="line ptb20">
|
<view class="line ptb20">
|
||||||
<view class="key">个性签名</view>
|
<view class="key">个性签名</view>
|
||||||
<view class="value textareaBox inputBox mt20 ptb20 plr20">
|
<view class="value textareaBox inputBox mt20 ptb20 plr20">
|
||||||
|
@ -213,26 +233,26 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
// 背景
|
// 背景
|
||||||
.bgBox {
|
.bgBox {
|
||||||
.content {
|
.content {
|
||||||
height: 400rpx;
|
height: 400rpx;
|
||||||
}
|
|
||||||
|
|
||||||
// 修改背景
|
|
||||||
.changeBg {
|
|
||||||
background-color: rgba(0, 0, 0, .3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 头像
|
// 修改背景
|
||||||
.avatarBox {
|
.changeBg {
|
||||||
padding: 2rpx;
|
background-color: rgba(0, 0, 0, .3);
|
||||||
background-color: #fff;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 资料
|
// 头像
|
||||||
.info {
|
.avatarBox {
|
||||||
margin-top: -20rpx;
|
padding: 2rpx;
|
||||||
}
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 资料
|
||||||
|
.info {
|
||||||
|
margin-top: -20rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -1,141 +1,151 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* 发起群聊
|
* 发起群聊
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
computed
|
computed
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
useStore
|
useStore
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
import {
|
import {
|
||||||
onLoad
|
onLoad
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
// 工具库
|
// 工具库
|
||||||
import util from '@/common/js/util.js'
|
import util from '@/common/js/util.js'
|
||||||
// 头部
|
// 头部
|
||||||
import apex from '@/components/header/apex.vue'
|
import apex from '@/components/header/apex.vue'
|
||||||
// 腾讯云聊天
|
// 腾讯云聊天
|
||||||
import TencentCloudChat from '@tencentcloud/chat';
|
import TencentCloudChat from '@tencentcloud/chat';
|
||||||
// api
|
// api
|
||||||
import api from '@/api/index.js'
|
import api from '@/api/index.js'
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
// 已选择的用户id
|
// 已选择的用户id
|
||||||
const ids = ref([])
|
const ids = ref([])
|
||||||
// 表单
|
// 表单
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
groupFaceUrl: '',
|
groupFaceUrl: '',
|
||||||
type: 'Public',
|
type: 'Public',
|
||||||
})
|
})
|
||||||
// 列表
|
// 列表
|
||||||
const list = reactive([])
|
const list = reactive([])
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userinfo = computed(() => {
|
const userinfo = computed(() => {
|
||||||
let result = store.state.userinfo
|
let result = store.state.userinfo
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
||||||
onLoad(() => {
|
|
||||||
// 获取朋友列表
|
|
||||||
getFriendList()
|
|
||||||
})
|
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
// 获取朋友列表
|
// 获取朋友列表
|
||||||
function getFriendList() {
|
getFriendList()
|
||||||
api.news.getFriendList().then(rs => {
|
})
|
||||||
if (rs.code == 200) {
|
|
||||||
const result = rs.data
|
|
||||||
list.length = 0
|
|
||||||
//
|
|
||||||
list.push(...result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
util.alert({
|
|
||||||
content: rs.msg,
|
|
||||||
showCancel: false,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// 获取朋友列表
|
||||||
* 点击用户
|
function getFriendList() {
|
||||||
* @param {Object} item 当前用户信息
|
api.news.getFriendList().then(rs => {
|
||||||
*/
|
if (rs.code == 200) {
|
||||||
function handleUser(item) {
|
const result = rs.data
|
||||||
const find_index = ids.value.findIndex(node => node == item.userId)
|
list.length = 0
|
||||||
console.log(find_index)
|
//
|
||||||
if (find_index >= 0) ids.value.splice(find_index, 1)
|
list.push(...result)
|
||||||
else ids.value.push(item.userId)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新建群组
|
|
||||||
function handleCreateGroup() {
|
|
||||||
const data = {
|
|
||||||
...form
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data.name) {
|
|
||||||
util.alert('群聊名称不能为空')
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!data.groupFaceUrl) {
|
util.alert({
|
||||||
util.alert('群聊头像不能为空')
|
content: rs.msg,
|
||||||
return
|
showCancel: false,
|
||||||
}
|
|
||||||
if (ids.length < 2) {
|
|
||||||
util.alert('请至少选择两名用户')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 群主id
|
|
||||||
data.ownerAccount = userinfo.value.id
|
|
||||||
// 群成员
|
|
||||||
data.groupUsers = [{
|
|
||||||
userId: userinfo.value.id
|
|
||||||
},
|
|
||||||
...ids.value.map(item => {
|
|
||||||
return {
|
|
||||||
userId: item
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]
|
|
||||||
// 群聊id
|
|
||||||
data.groupId = Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
|
|
||||||
|
|
||||||
// 创建好友工作群
|
|
||||||
api.news.addChatGroup({
|
|
||||||
data: data
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code == 200) {
|
|
||||||
util.alert('创建成功')
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
form.name = ''
|
|
||||||
form.groupFaceUrl = ''
|
|
||||||
uni.navigateBack()
|
|
||||||
}, 2000)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
util.alert({
|
|
||||||
content: rs.msg,
|
|
||||||
showCancel: false,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击用户
|
||||||
|
* @param {Object} item 当前用户信息
|
||||||
|
*/
|
||||||
|
function handleUser(item) {
|
||||||
|
const find_index = ids.value.findIndex(node => node == item.userId)
|
||||||
|
console.log(find_index)
|
||||||
|
if (find_index >= 0) ids.value.splice(find_index, 1)
|
||||||
|
else ids.value.push(item.userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新建群组
|
||||||
|
function handleCreateGroup() {
|
||||||
|
const data = {
|
||||||
|
...form
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传图片
|
if (!data.name) {
|
||||||
function uploadImg() {
|
util.alert('群聊名称不能为空')
|
||||||
util.upload_image({
|
return
|
||||||
type: 1,
|
|
||||||
success: (res) => {
|
|
||||||
form.groupFaceUrl = res.value
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
if (!data.groupFaceUrl) {
|
||||||
|
util.alert('群聊头像不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (ids.length < 2) {
|
||||||
|
util.alert('请至少选择两名用户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 群主id
|
||||||
|
data.ownerAccount = userinfo.value.id
|
||||||
|
// 群成员
|
||||||
|
data.groupUsers = [{
|
||||||
|
userId: userinfo.value.id
|
||||||
|
},
|
||||||
|
...ids.value.map(item => {
|
||||||
|
return {
|
||||||
|
userId: item
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
// 群聊id
|
||||||
|
data.groupId = Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
|
||||||
|
|
||||||
|
// 创建好友工作群
|
||||||
|
api.news.addChatGroup({
|
||||||
|
data: data
|
||||||
|
}).then(rs => {
|
||||||
|
if (rs.code == 200) {
|
||||||
|
util.alert('创建成功')
|
||||||
|
createGroup(data)
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
form.name = ''
|
||||||
|
form.groupFaceUrl = ''
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 2000)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function createGroup(data) {
|
||||||
|
uni.$chat.createGroup({
|
||||||
|
type: TencentCloudChat.TYPES.GRP_PUBLIC,
|
||||||
|
name: data.name,
|
||||||
|
groupID: data.groupId,
|
||||||
|
avatar: data.groupFaceUrl
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上传图片
|
||||||
|
function uploadImg() {
|
||||||
|
util.upload_image({
|
||||||
|
type: 1,
|
||||||
|
success: (res) => {
|
||||||
|
form.groupFaceUrl = res.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -148,7 +158,7 @@
|
||||||
<view class="li" v-for="(item, index) in list" :key="index" @click="handleUser(item)">
|
<view class="li" v-for="(item, index) in list" :key="index" @click="handleUser(item)">
|
||||||
<view class="item rows ptb20 pl30 pr50">
|
<view class="item rows ptb20 pl30 pr50">
|
||||||
<image class="wh80 avatar cir" :src="item.avatar" mode="aspectFill" />
|
<image class="wh80 avatar cir" :src="item.avatar" mode="aspectFill" />
|
||||||
<view class="name thd f1 ml20 c333 f32">{{item.remark || item.userNickname}}</view>
|
<view class="name thd f1 ml20 c333 f32">{{ item.remark || item.userNickname }}</view>
|
||||||
<uni-icons type="circle-filled" size="40rpx" color="#20D200"
|
<uni-icons type="circle-filled" size="40rpx" color="#20D200"
|
||||||
v-if="ids.includes(item.userId)" />
|
v-if="ids.includes(item.userId)" />
|
||||||
<uni-icons type="circle" size="40rpx" color="#ccc" v-else />
|
<uni-icons type="circle" size="40rpx" color="#ccc" v-else />
|
||||||
|
@ -163,7 +173,7 @@
|
||||||
<view class="fill" style="height: 120rpx;"></view>
|
<view class="fill" style="height: 120rpx;"></view>
|
||||||
|
|
||||||
<view class="footer plr30 bfff shadow">
|
<view class="footer plr30 bfff shadow">
|
||||||
<view class="btn lg colourful" @click="$refs.groupAlt.open() ">下一步</view>
|
<view class="btn lg colourful" @click="$refs.groupAlt.open()">下一步</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -199,26 +209,26 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
// 朋友列表
|
// 朋友列表
|
||||||
.firendBox {
|
.firendBox {
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.scroll {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.scroll {
|
// 列表项
|
||||||
height: 100%;
|
.li {
|
||||||
}
|
.letter {
|
||||||
|
background-color: #eee;
|
||||||
// 列表项
|
|
||||||
.li {
|
|
||||||
.letter {
|
|
||||||
background-color: #eee;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 子集
|
|
||||||
.child {
|
|
||||||
.item+.item {
|
|
||||||
border-top: 2rpx solid #eee;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 子集
|
||||||
|
.child {
|
||||||
|
.item+.item {
|
||||||
|
border-top: 2rpx solid #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -1,68 +1,198 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
// 店铺首页
|
// 店铺首页
|
||||||
import {
|
import {
|
||||||
ref
|
computed,
|
||||||
} from 'vue'
|
reactive,
|
||||||
import {
|
ref,
|
||||||
onLoad,
|
defineExpose,
|
||||||
onPageScroll
|
} from 'vue'
|
||||||
} from '@dcloudio/uni-app';
|
import {
|
||||||
|
onLoad,
|
||||||
|
onPageScroll
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
|
|
||||||
// 顶部
|
// 工具库
|
||||||
import apex from '@/components/header/apex.vue'
|
import util from '@/common/js/util.js'
|
||||||
// 商品列表
|
// 顶部
|
||||||
import productList from '@/components/shop/productList/productList'
|
import apex from '@/components/header/apex.vue'
|
||||||
|
// 商品列表
|
||||||
|
import productList from '@/components/shop/productList/productList'
|
||||||
|
|
||||||
// 分类选项
|
import api from '@/api/index.js'
|
||||||
const filteredList = ref([{
|
|
||||||
label: '默认',
|
|
||||||
value: 1,
|
|
||||||
isUpDown: false,
|
|
||||||
slot: null
|
|
||||||
}, {
|
|
||||||
label: '销量',
|
|
||||||
value: 2,
|
|
||||||
isUpDown: false,
|
|
||||||
slot: null
|
|
||||||
}, {
|
|
||||||
label: '新品',
|
|
||||||
value: 3,
|
|
||||||
isUpDown: false,
|
|
||||||
slot: null
|
|
||||||
}, {
|
|
||||||
label: '价格',
|
|
||||||
value: 4,
|
|
||||||
isUpDown: true,
|
|
||||||
slot: null
|
|
||||||
}])
|
|
||||||
// 顶部导航背景颜色
|
|
||||||
const apexBgColor = ref('#ffffff00')
|
|
||||||
// 店铺id
|
|
||||||
const storeId = ref('')
|
|
||||||
|
|
||||||
onLoad((option) => {
|
// 分类选项
|
||||||
if (option.storeId) storeId.value = option.storeId
|
const filteredList = ref([{
|
||||||
|
label: '默认',
|
||||||
|
value: 1,
|
||||||
|
isUpDown: false,
|
||||||
|
slot: null
|
||||||
|
}, {
|
||||||
|
label: '销量',
|
||||||
|
value: 2,
|
||||||
|
isUpDown: false,
|
||||||
|
slot: null
|
||||||
|
}, {
|
||||||
|
label: '新品',
|
||||||
|
value: 3,
|
||||||
|
isUpDown: false,
|
||||||
|
slot: null
|
||||||
|
}, {
|
||||||
|
label: '价格',
|
||||||
|
value: 4,
|
||||||
|
isUpDown: true,
|
||||||
|
slot: null
|
||||||
|
}])
|
||||||
|
// 顶部导航背景颜色
|
||||||
|
const apexBgColor = ref('#ffffff00')
|
||||||
|
// 店铺id
|
||||||
|
const storeId = ref('')
|
||||||
|
// 详情
|
||||||
|
const detail = reactive({})
|
||||||
|
// 参数
|
||||||
|
const listPrototype = reactive({
|
||||||
|
pageSize: 10,
|
||||||
|
pageNum: 1,
|
||||||
|
total: 0,
|
||||||
|
// 商户主键
|
||||||
|
merId: '',
|
||||||
|
data: [],
|
||||||
|
})
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const userinfo = computed(() => uni.$store.state.userinfo || {})
|
||||||
|
onLoad((option) => {
|
||||||
|
if (option.storeId) storeId.value = option.storeId
|
||||||
|
getDetail()
|
||||||
|
listPrototype.merId = storeId.value
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
onPageScroll((ev) => {
|
||||||
|
apexBgColor.value = ev.scrollTop > 44 ? '#fff' : '#ffffff00'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取店铺详情
|
||||||
|
function getDetail() {
|
||||||
|
api.shop.merchant({
|
||||||
|
query: {
|
||||||
|
merId: storeId.value,
|
||||||
|
userId: userinfo.value.id,
|
||||||
|
}
|
||||||
|
}).then(rs => {
|
||||||
|
if (rs.code == 200) {
|
||||||
|
Object.assign(detail, {}, rs.data)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
// 收藏店铺
|
||||||
|
function handleCollectStore() {
|
||||||
|
api.shop.followShop({
|
||||||
|
data: {
|
||||||
|
shopId: storeId.value,
|
||||||
|
status: {
|
||||||
|
0: 1,
|
||||||
|
1: 0,
|
||||||
|
}[detail.isFollow]
|
||||||
|
}
|
||||||
|
}).then(rs => {
|
||||||
|
if (rs.code == 200) {
|
||||||
|
// 关注状态
|
||||||
|
detail.isFollow = {
|
||||||
|
0: 1,
|
||||||
|
1: 0,
|
||||||
|
}[detail.isFollow]
|
||||||
|
// 关注数量
|
||||||
|
detail.followNum = rs.data
|
||||||
|
|
||||||
onPageScroll((ev) => {
|
getDetail()
|
||||||
apexBgColor.value = ev.scrollTop > 44 ? '#fff' : '#ffffff00'
|
return
|
||||||
})
|
}
|
||||||
|
util.alert({
|
||||||
// 获取店铺详情
|
content: rs.msg,
|
||||||
function getDetail() {
|
showCancel: false,
|
||||||
//
|
|
||||||
api.shop.merchant({
|
|
||||||
path: [id.value],
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code == 200) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
util.alert({
|
|
||||||
content: rs.msg,
|
|
||||||
showCancel: false
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
|
}
|
||||||
|
// 客服
|
||||||
|
function toCustomer() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: util.setUrl('/pages/mine/setting/feedback')
|
||||||
|
})
|
||||||
|
// api.shop.getCustomerService({ merchantId: storeId.value }).then(rs => {
|
||||||
|
// if (rs.code == 200) {
|
||||||
|
// let param = {};
|
||||||
|
// param.type = 'C2C'
|
||||||
|
// param.name = `${detail.name}`
|
||||||
|
// param.msgId = `${rs.data.serviceId}`
|
||||||
|
// param.isCustomer = true
|
||||||
|
|
||||||
|
// util.toChat(param)
|
||||||
|
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: util.setUrl('/pages/news/chat/chat', param)
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// util.alert(rs.msg)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
}
|
||||||
|
// 商品列表
|
||||||
|
function getList() {
|
||||||
|
|
||||||
|
api.shop.getProduct({
|
||||||
|
data: {
|
||||||
|
pageSize: listPrototype.pageSize,
|
||||||
|
pageNum: listPrototype.pageNum,
|
||||||
|
// 商户主键
|
||||||
|
merId: listPrototype.merId,
|
||||||
|
},
|
||||||
|
}).then(rs => {
|
||||||
|
if (rs.code == 200) {
|
||||||
|
if (listPrototype.pageNum == 1) listPrototype.data.length = []
|
||||||
|
listPrototype.data.push(...rs.rows)
|
||||||
|
listPrototype.total = rs.total
|
||||||
|
return
|
||||||
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
}).finally(rs => {
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 点击列表项
|
||||||
|
function handleItem(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: util.setUrl('/pages/shop/commodity/index', {
|
||||||
|
productId: item.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 重载列表
|
||||||
|
function refreshList() {
|
||||||
|
listPrototype.pageNum = 1
|
||||||
|
listPrototype.total = 0
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载更多列表
|
||||||
|
function getMoreList() {
|
||||||
|
if (listPrototype.total <= listPrototype.data.length) return
|
||||||
|
listPrototype.pageNum++
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
refreshList,
|
||||||
|
getMoreList,
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -71,25 +201,24 @@
|
||||||
<apex :bgColor="apexBgColor" mode="flex">
|
<apex :bgColor="apexBgColor" mode="flex">
|
||||||
<template #content>
|
<template #content>
|
||||||
<view class="search df jcr">
|
<view class="search df jcr">
|
||||||
<view class="">
|
<view class="" v-if="0">
|
||||||
<image class="wh50" src="/static/share2.png" mode="aspectFit" />
|
<image class="wh50" src="/static/share2.png" mode="aspectFit" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</apex>
|
</apex>
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
<view class="shopHeaderBg"></view>
|
<view class="shopHeaderBg"></view>
|
||||||
|
|
||||||
<!-- 店铺卡片 -->
|
<!-- 店铺卡片 -->
|
||||||
<view class="store pr rows ptb25 plr25 mt40">
|
<view class="store pr rows ptb25 plr25 mt40">
|
||||||
<!-- 店铺头像 -->
|
<!-- 店铺头像 -->
|
||||||
<image class="wh120 fs0 br10" src="/static/logo.png" mode="aspectFill" />
|
<image class="wh120 fs0 br10" :src="detail.rectangleLogo" mode="aspectFill" />
|
||||||
<!-- 店铺信息 名称 评分 关注数量 -->
|
<!-- 店铺信息 名称 评分 关注数量 -->
|
||||||
<view class="info f1 ml20">
|
<view class="info f1 ml20">
|
||||||
<!-- 店铺名称 -->
|
<!-- 店铺名称 -->
|
||||||
<view class="c333 f28">
|
<view class="c333 f28">
|
||||||
<text>店铺名称</text>
|
<text>{{ detail.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="df aic mt10">
|
<view class="df aic mt10">
|
||||||
|
@ -101,7 +230,7 @@
|
||||||
</view>
|
</view>
|
||||||
<!-- 关注数量 -->
|
<!-- 关注数量 -->
|
||||||
<view class="c666 f24">
|
<view class="c666 f24">
|
||||||
<text>123关注</text>
|
<text>{{ detail.followNum }}关注</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -109,13 +238,14 @@
|
||||||
<!-- 按钮区 -->
|
<!-- 按钮区 -->
|
||||||
<view class="btns w150">
|
<view class="btns w150">
|
||||||
<view>
|
<view>
|
||||||
<view class="btn ti warmHollow fmid" @click="followButton">
|
<view @click="handleCollectStore" class="btn sm warm fmid fdr plr30">
|
||||||
<uni-icons class="mr10" color="#FF9B27" type="plusempty" size="13" />
|
<uni-icons class="mr10" color="#fff" type="plusempty" size="13" v-if="detail.isFollow != 1" />
|
||||||
<text>关注</text>
|
<text class="cfff f28" v-else>已</text>
|
||||||
|
<text class="cfff f28">关注</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mt10">
|
<view class="mt10" @click="toCustomer">
|
||||||
<view class="btn ti warmHollow fmid">
|
<view class="btn ti warmHollow fmid">
|
||||||
<image class="kefu wh30" src="/static/customer-service1.png" mode="aspectFit" />
|
<image class="kefu wh30" src="/static/customer-service1.png" mode="aspectFit" />
|
||||||
<text>客服</text>
|
<text>客服</text>
|
||||||
|
@ -126,14 +256,46 @@
|
||||||
|
|
||||||
<!-- 商品列表 -->
|
<!-- 商品列表 -->
|
||||||
<view class="product oh ptb30 plr30">
|
<view class="product oh ptb30 plr30">
|
||||||
<productList ref="product" />
|
<view class="list">
|
||||||
|
<view class="item oh bfff br20" v-for="(item, index) in listPrototype.data" :key="index"
|
||||||
|
@click="handleItem(item)">
|
||||||
|
<!-- 需要展示的图 -->
|
||||||
|
<image class="poster" :src="item.sliderImage.split(',')[0]" mode="aspectFill" />
|
||||||
|
|
||||||
|
<!-- 标题 -->
|
||||||
|
<view class="main plr20">
|
||||||
|
<view class="title mtb10 thd c333 f30">{{ item.name }}</view>
|
||||||
|
<view class="info mtb10 df aic">
|
||||||
|
<!-- 价格 -->
|
||||||
|
<view class="price thd wsn cFF9B27">
|
||||||
|
<text class="txt f20">¥</text>
|
||||||
|
<text class="txt f36">{{ item.price }}</text>
|
||||||
|
</view>
|
||||||
|
<!-- 销量 -->
|
||||||
|
<view class="sales fs0 thd wsn ml10 c999 f26">销量:{{ item.sales }}</view>
|
||||||
|
<view class="f1"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
//
|
// 卡片
|
||||||
.store {
|
.list {
|
||||||
// margin-top: -50rpx;
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
grid-gap: 20rpx;
|
||||||
|
|
||||||
|
// 单个
|
||||||
|
.item {
|
||||||
|
.poster {
|
||||||
|
width: 100%;
|
||||||
|
height: 340rpx;
|
||||||
|
border-radius: 20rpx 20rpx 0 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue