接口调用

main
123456 2 months ago
parent 6a1aa0e558
commit 5df68bc4f2
  1. 72
      api/index.js
  2. 2
      pages.json
  3. 94
      pages/dongtai/add.vue
  4. 51
      pages/dongtai/index.vue
  5. 2
      pages/login/avatar.vue
  6. 24
      pages/peiwan/xiangce.vue
  7. 32
      pages/user/index.vue
  8. 22
      pages/users/about/index.vue
  9. 125
      pages/users/center/index.vue
  10. 352
      pages/users/edit/index.vue
  11. 82
      pages/users/personal/index.vue
  12. 156
      pages/users/yuyin/index.vue
  13. 2
      unpackage/dist/dev/app-plus/app-config-service.js
  14. 2433
      unpackage/dist/dev/app-plus/app-service.js
  15. 1654
      unpackage/dist/dev/app-plus/app-view.js

@ -1,5 +1,77 @@
import { request } from './request'
const api = {
//会员协议
getConfigData(data){
return request({
url: 'api/getConfigData',
method: 'get',
data
})
},
//会员列表
memberList(data) {
return request({
url: 'api/memberList',
method: 'get',
data
})
},
//签到
sign(data) {
return request({
url: 'api/user/sign',
method: 'post',
data
})
},
//动态详情
articleDetailt(data) {
return request({
url: 'api/user/articleDetailt',
method: 'post',
data
})
},
//发布动态
publishArticle(data) {
return request({
url: 'api/user/publishArticle',
method: 'post',
data
})
},
//动态列表
articleList(data) {
return request({
url: 'api/user/articleList',
method: 'post',
data
})
},
//我的相册
myAlbums(data) {
return request({
url: 'api/user/myAlbums',
method: 'post',
data
})
},
//保存个人资料
editUser(data) {
return request({
url: 'api/user/editUser',
method: 'post',
data
})
},
//保存语音签名
voiceSign(data) {
return request({
url: 'api/user/voiceSign',
method: 'post',
data
})
},
//根据字典类型获取字典 学历 education_type 薪资 salary_type 婚姻 marriage_type 居住 live_type 异性-女标签 sex_type_2 星座 constellation_type 异性-男标签 sex_type_1
getDictDataByType(data) {
return request({

@ -132,7 +132,7 @@
"path" : "pages/users/about/index",
"style" :
{
"navigationBarTitleText" : "关于我们"
"navigationBarTitleText" : ""
}
},
{

@ -2,16 +2,16 @@
<view class="add">
<view class="add-content">
<view class="content">
<textarea maxlength="-1" placeholder="请输入您想发布的内容哦~"></textarea>
<textarea v-model="content" maxlength="-1" placeholder="请输入您想发布的内容哦~"></textarea>
</view>
<view class="content">
<view class="title">上传图片/视频</view>
<view class="title">上传图片</view>
<view class="list">
<view class="item">
<image class="pic" src="@/static/1.png"></image>
<image class="del" src="@/static/fabu-cha.png"></image>
<view class="item" v-for="(a,index) in imgurl" :key="index">
<image class="pic" :src="a"></image>
<image class="del" @click="toDel(index)" src="@/static/fabu-cha.png"></image>
</view>
<view class="upload">
<view class="upload" @click="toNext()">
<image class="pic" src="@/static/fabu-tianjia.png"></image>
<view class="txt">上传</view>
</view>
@ -19,7 +19,7 @@
</view>
</view>
<view class="add-fd">
<view class="btn">发布</view>
<view class="btn" @click="toReg()">发布</view>
</view>
</view>
</template>
@ -28,11 +28,87 @@
export default {
data() {
return {
content: "",
imgurl: []
};
},
onReady() {
//
uni.$on('uAvatarCropper', path => {
const that = this;
//
uni.uploadFile({
url: that.$baseUrl+'/prod-api/common/upload',
filePath: path,
name: 'file',
complete: (res) => {
if(res.statusCode == 200){
const {code, fileName, url, msg} = JSON.parse(res.data);
if(code == 200){
uni.showToast({
title: "上传成功"
})
that.imgurl.push(url)
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}
});
})
},
methods: {
async toReg() {
const { code, data } = await this.$api.publishArticle({
userId: uni.getStorageSync("userInfo").id,
content: this.content,
imgurl: this.imgurl,
})
if(code == 200){
uni.showToast({
title:"发布成功"
})
uni.$emit("toAddDongtai")
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
},2000)
}else{
uni.showToast({
icon: "none",
position: "bottom",
title: msg
})
}
},
toDel(index) {
this.imgurl.splice(index,1)
},
toNext(){
this.$u.route({
// ""
url: '/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-cropper',
//
params: {
// px
destWidth: 900,
// px
rectWidth: 300,
// 'png'"jpg"
fileType: 'jpg',
}
})
}
}
}
</script>

@ -54,14 +54,61 @@
return {
isShare: false,
current: 0,
pageNum: 1,
total: 1,
list:[{'name': '广场'},{'name': '关注'}],
activeStyle:{'fontSize': '35rpx'}
}
},
onLoad() {
onReady() {
const that = this;
that.getList();
uni.$on("toAddDongtai",res=>{
that.pageNum = 1;
that.current = 0;
that.list = [];
that.getList();
})
},
onReachBottom() {
const that = this;
uni.showLoading({
title: "加载中"
})
if(this.list.length <= this.total){
that.offset ++;
setTimeout(function() {
that.getList(1);
}, 1000);
}
},
methods: {
//
arrayUnique (arr, name) {
var hash = {};
return arr.reduce(function (item, next) {
hash[next[name]]
? ""
: (hash[next[name]] = true && item.push(next));
return item;
}, []);
},
//
async getList(type) {
const { code, data } = await this.$api.articleList({
userId: uni.getStorageSync("userInfo").id,
type: Number(this.current)+1,
limit: 20,
pageNum: this.pageNum,
})
if(code == 200){
if(type == 1){
uni.hideLoading();
}
this.total = data.total;
this.list = arrayUnique([...this.list,...data.list],"id")
}
},
openPage(index,id){
if(index == 1){
uni.navigateTo({

@ -52,7 +52,7 @@
title: "上传成功"
})
let userInfo = uni.getStorageSync("userInfo");
userInfo.img = fileName
userInfo.img = url
uni.setStorageSync("userInfo", userInfo);
that.avatar = url;

@ -1,6 +1,6 @@
<template>
<view class="xiangce">
<image v-for="i in 6" :key="i" src="@/static/pic.jpg"></image>
<image v-for="(a,i) in list" :key="i" :src="a" @click="previewImage(i)"></image>
</view>
</template>
@ -8,8 +8,28 @@
export default {
data() {
return {
list: [],
};
},
onLoad(o) {
this.id = o.id;
this.getList();
},
methods: {
async getList() {
const { code, data, msg } = await this.$api.myAlbums({
userId: this.id
})
if(code == 200){
this.list = data.split(",")
}
},
previewImage(id) {
uni.previewImage({
urls: this.list,
count: id
})
}
}
}
</script>

@ -12,10 +12,11 @@
<view class="user-info">
<view class="a">
<view class="pic" @click="openPage(2)">
<image :src="baseUrl+userInfo.img"></image>
<image v-if="userInfo.faceImage" :src="userInfo.faceImage"></image>
<image v-else :src="userInfo.img"></image>
</view>
<view class="info" @click="openPage(2)">
<view class="name">{{userInfo.nickname}}
<view class="name">{{userInfo.realname?userInfo.realname:userInfo.nickname}}
<view class="vip" v-if="userInfo.memberflag>=1">vip{{userInfo.memberflag}}</view>
<view class="status" v-if="userInfo.acceptStatus == 1"><text></text>接单中</view>
</view>
@ -30,8 +31,8 @@
<view class="li">{{userInfo.fansNum}}<text>粉丝</text></view>
<view class="li">{{userInfo.visitorNum}}<text>访客</text></view>
</view>
<view class="c">
<view class="dt">VIP会员中心<text v-if="userInfo.memberflag>=1">{{userInfo.memberEndTime}}到期</text></view>
<view class="c" @click="openPage(4)">
<view class="dt">VIP会员中心<text v-if="userInfo.memberflag>=1">{{userInfo.memberEndTime}}到期</text><text v-else>立即开通</text></view>
<view class="dd">
<view class="item">
<image src="@/static/hongbao.png"></image>
@ -198,8 +199,31 @@
uni.navigateTo({
url: "/pages/users/personal/index"
})
}else if(index == 3){
this.toSign();
}else if(index == 4){
uni.navigateTo({
url: "/pages/users/center/index"
})
}
},
//
async toSign() {
const { code, data , msg } = await this.$api.sign({userId: uni.getStorageSync("userInfo").id});
if(code == 200){
uni.showToast({
title: "签到成功",
})
this.getUserInfo();
}else{
uni.showToast({
title: mgs,
position: "bottom",
icon: "none",
})
}
},
//
async getUserInfo() {
const { code, data , msg } = await this.$api.findUserInfo({userId: uni.getStorageSync("userInfo").id});
if(code == 200){

@ -1,6 +1,6 @@
<template>
<view>
<view class="about">
<view class="content" v-html="content"></view>
</view>
</template>
@ -8,8 +8,24 @@
export default {
data() {
return {
content: "",
type: ""
};
},
onLoad(o) {
this.type = o.type;
this.getInfo();
},
methods: {
async getInfo() {
const { code,data } = await this.$api.getConfigData({dictType: this.type});
if(code == 200){
this.content = data.content;
uni.setNavigationBarTitle({
title: data.title
})
}
},
}
}
</script>

@ -1,27 +1,27 @@
<template>
<view class="task">
<view class="task-navbar">
<u-navbar title="任务中心" back-icon-color="#333333" title-color="#333333" :background="background"></u-navbar>
<u-navbar title="会员中心" back-icon-color="#333333" title-color="#333333" :background="background"></u-navbar>
</view>
<view class="task-content">
<view class="info">
<view class="a">
<view class="fl">
<view class="pic">
<image src="@/static/nan.png"></image>
<image :src="userInfo.faceImage?userInfo.faceImage:userInfo.img"></image>
</view>
<view class="xinxi">
<view class="name">李哈哈<text>LV.1</text></view>
<!-- <view class="status">您还不是会员</view> -->
<view class="status">2024年12月12日到期</view>
<view class="name">{{userInfo.realname}}<text v-if="userInfo.memberflag >=1">LV.{{userInfo.memberflag}}</text></view>
<view class="status" v-if="userInfo.memberflag==0">您还不是会员</view>
<view class="status" v-else>{{userInfo.memberEndTime}}到期</view>
</view>
</view>
<image class="king" src="@/static/user-king.png"></image>
</view>
<view class="b">开通会员尊享酷炫好玩会员特权</view>
<view class="b" v-if="userInfo.memberflag==0">开通会员尊享酷炫好玩会员特权</view>
</view>
<view class="title">您的特权</view>
<view class="content">
<view class="title" v-if="userInfo.memberflag>=1">您的特权</view>
<view class="content" v-if="userInfo.memberflag>=1">
<view class="item">
<view class="a"><view class="btn">特权1</view><view class="txt">会员专属标识</view></view>
<view class="b">
@ -53,72 +53,44 @@
</view>
</view>
</view>
<view class="title">开通会员</view>
<view class="title">{{userInfo.memberflag==0?'开通会员':'续费会员'}}</view>
<scroll-view scroll-x class="kaitong">
<view class="item">
<view class="a">1</view>
<view class="b"><text>18</text></view>
<view class="c">9</view>
<view class="d">原价28</view>
<view class="e">LV.1</view>
</view>
<view class="item">
<view class="a">1</view>
<view class="b"><text>18</text></view>
<view class="c">8</view>
<view class="d">原价28</view>
<view class="e">LV.2</view>
</view>
<view class="item">
<view class="a">1个月</view>
<view class="b"><text>18</text></view>
<view class="c">7</view>
<view class="d">原价28</view>
<view class="e">LV.3</view>
</view>
<view class="item">
<view class="a">季卡</view>
<view class="b"><text>18</text></view>
<view class="c">6</view>
<view class="d">原价28</view>
<view class="e">LV.4</view>
</view>
<view class="item">
<view class="a">年卡</view>
<view class="b"><text>18</text></view>
<view class="c">5</view>
<view class="d">原价28</view>
<view class="e">LV.5</view>
<view class="item" v-for="(a,i) in list" :class="tabIndex == i?'item-on':''" @click="tabItem(i)">
<view class="a">{{a.cycle}}{{a.danwei}}</view>
<view class="b"><text>{{a.presentPrice}}</text></view>
<view class="c">{{a.discount}}</view>
<view class="d">原价{{a.presentPrice}}</view>
<view class="e">{{a.name}}</view>
</view>
</scroll-view>
<view class="title">会员特权</view>
<view class="content">
<view class="item">
<view class="a"><view class="btn">特权1</view><view class="txt">会员专属标识</view></view>
<view class="a"><view class="btn">特权1</view><view class="txt">文字语音视频聊天折扣{{list[tabIndex].wordVoiceDiscount}}</view></view>
<view class="b">
<image src="@/static/icon-svip.png"></image>
</view>
</view>
<view class="item">
<view class="a"><view class="btn">特权2</view><view class="txt">支持查看访客信息</view></view>
<view class="a"><view class="btn">特权2</view><view class="txt">每天可领金币{{list[tabIndex].receiveCoins}}</view></view>
<view class="b">
<image src="@/static/icon-svip.png"></image>
</view>
</view>
<view class="item">
<view class="a"><view class="btn">特权3</view><view class="txt">文字语音视频聊天8折</view></view>
<view class="a"><view class="btn">特权3</view><view class="txt">可累积领取金币{{list[tabIndex].totalReceiveCoins}}</view></view>
<view class="b">
<image src="@/static/icon-svip.png"></image>
</view>
</view>
<view class="item">
<view class="a"><view class="btn">特权4</view><view class="txt">每天可领10金币可累计领取1000金币</view></view>
<view class="a"><view class="btn">特权3</view><view class="txt">每天免费信息数量{{list[tabIndex].freeMsg}}</view></view>
<view class="b">
<image src="@/static/icon-svip.png"></image>
</view>
</view>
<view class="item">
<view class="a"><view class="btn">特权5</view><view class="txt">每天免费10条信息2分钟语音2分钟视频聊天</view></view>
<view class="a"><view class="btn">特权4</view><view class="txt">每天免费信息数量{{list[tabIndex].freeVoice}}分钟</view></view>
<view class="b">
<image src="@/static/icon-svip.png"></image>
</view>
@ -126,14 +98,14 @@
</view>
<view class="title">支付方式</view>
<view class="pay">
<view class="item" :class="tabIndex == 1?'item-on':''" @click="tabItem(1)">
<view class="item" :class="payIndex == 1?'item-on':''" @click="tabPay(1)">
<view class="a"><image src="@/static/wxpay.png"></image>微信支付</view>
<view class="b">
<image class="img1" src="@/static/icon-check.png"></image>
<image class="img2" src="@/static/icon-check-on.png"></image>
</view>
</view>
<view class="item" :class="tabIndex == 2?'item-on':''" @click="tabItem(2)">
<view class="item" :class="payIndex == 2?'item-on':''" @click="tabPay(2)">
<view class="a"><image src="@/static/zfb.png"></image>支付宝支付</view>
<view class="b">
<image class="img1" src="@/static/icon-check.png"></image>
@ -144,7 +116,7 @@
<view class="agreement">
<image class="img1" @click="toggleImg()" v-if="isToggle" src="@/static/icon-check-on.png"></image>
<image class="img2" @click="toggleImg()" v-else src="@/static/icon-check.png"></image>
请阅读并同意<text>会员协议</text>
请阅读并同意<text @click="openPPage()">会员协议</text>
</view>
</view>
<view class="task-fd">
@ -157,8 +129,11 @@
export default {
data() {
return {
list: [],
userInfo: {},
isToggle: false,
tabIndex: 1,
tabIndex: 0,
payIndex: 1,
background: {
//
background: 'url(@/static/task-bg.png) center top no-repeat',
@ -167,13 +142,45 @@
},
};
},
onReady() {
this.getUserInfo();
this.getList();
},
methods: {
openPPage() {
uni.navigateTo({
url: "/pages/users/about/index?type=CONFIG_MEMBERSHIP_AGREEMENT"
})
},
tabItem(i){
this.tabIndex = i;
},
tabPay(i){
this.payIndex = i;
},
toggleImg() {
this.isToggle = !this.isToggle;
}
},
//
async getUserInfo() {
const { code, data , msg } = await this.$api.findUserInfo({userId: uni.getStorageSync("userInfo").id});
if(code == 200){
this.userInfo = data;
}else{
uni.showToast({
title: mgs,
position: "bottom",
icon: "none",
})
}
},
//
async getList() {
const {code, data } = await this.$api.memberList({});
if(code == 200){
this.list = data
}
},
}
}
</script>
@ -210,6 +217,7 @@
&-content{
padding: 0 25rpx;
overflow: hidden;
margin-top: 20rpx;
.info{
width: 100%;
background: linear-gradient(90deg, #17150E, #373632);
@ -282,7 +290,7 @@
font-weight: 500;
font-size: 32rpx;
color: #222222;
margin-top: 40rpx;
margin-top: 30rpx;
}
.agreement{
display: flex;
@ -356,12 +364,13 @@
}
.kaitong{
white-space: nowrap;
margin-top: 30rpx;
margin-top: 40rpx;
.item{
display: inline-block;
width: 220rpx;
height: 280rpx;
background: #FFFFFF;
border: 1px solid #FFFFFF;
border-radius: 20rpx;
text-align: center;
position: relative;
@ -412,10 +421,14 @@
font-size: 24rpx;
color: #F3F4F5;
}
&-on{
background: #EDEDED;
border: 1px solid #000000;
}
}
}
.content{
padding-bottom: 20rpx;
margin-top: 10rpx;
overflow: hidden;
.item{
width: 100%;

@ -3,20 +3,20 @@
<view class="edit-navbar">
<u-navbar title="编辑资料" back-icon-color="#333333" title-color="#333333" :background="background">
<view class="slot-wrap" slot="right">
<view class="btn" @click="toReg()">保存</view>
<view class="btn" @click="toSave()">保存</view>
</view>
</u-navbar>
</view>
<view class="edit-user">
<view class="user">
<view class="pic" @click="toNext(1)">
<view class="pic" @click="toNext(userInfo.faceImage?1:3)">
<image class="avatar" v-if="userInfo.faceImage" :src="userInfo.faceImage"></image>
<image class="avatar" v-else :src="baseUrl+userInfo.img"></image>
<image class="xiangji" src="@/static/xiangji.png"></image>
</view>
</view>
<view class="tips">
尊敬的用户个人资料内容必须遵守相关法规和平台规则上传过于暴露的照片违规昵称宣言将会被封禁您的头像会用于进行实名认证图片比对若比对不通过则修改失败
<text>尊敬的用户个人资料内容必须遵守相关法规和平台规则上传过于暴露的照片违规昵称宣言将会被封禁\n\n您的头像会用于进行实名认证图片比对若比对不通过则修改失败</text>
</view>
</view>
<view class="edit-hd">
@ -60,26 +60,26 @@
</view>
<view class="item">
<view class="a">身高</view>
<view class="b"><picker :range="pickerList1" :value="userInfo.height" @change="pickerDate2">
<view class="b"><picker :range="pickerList1" :value="pickerIndex1" @change="pickerDate2">
<view class="txt" :class="userInfo.height?'txt-on':''">{{userInfo.height?userInfo.height:'请选择'}}</view>
</picker><image src="@/static/icon-arrow.png"></image></view>
</view>
<view class="item">
<view class="a">体重</view>
<view class="b"><picker :range="pickerList2" :value="userInfo.weight" @change="pickerDate3">
<view class="a">体重{{pickerIndex2}}</view>
<view class="b"><picker :range="pickerList2" :value="pickerIndex2" @change="pickerDate3">
<view class="txt" :class="userInfo.weight?'txt-on':''">{{userInfo.weight?userInfo.weight:'请选择'}}</view>
</picker><image src="@/static/icon-arrow.png"></image></view>
</view>
<view class="item">
<view class="a">年收入</view>
<view class="b"><picker :range="pickerList3" range-key="dictLabel" :value="userInfo.annualIncome" @change="pickerDate4">
<view class="b"><picker :range="pickerList3" range-key="dictLabel" :value="pickerIndex3" @change="pickerDate4">
<view class="txt" :class="userInfo.annualIncome?'txt-on':''">{{userInfo.annualIncome?userInfo.annualIncome:'请选择'}}</view>
</picker><image src="@/static/icon-arrow.png"></image>
</view>
</view>
<view class="item">
<view class="a">学历</view>
<view class="b"><picker :range="pickerList4" range-key="dictLabel" :value="userInfo.xueli" @change="pickerDate5">
<view class="b"><picker :range="pickerList4" range-key="dictLabel" :value="pickerIndex4" @change="pickerDate5">
<view class="txt" :class="userInfo.xueli?'txt-on':''">{{userInfo.xueli?userInfo.xueli:'请选择'}}</view>
</picker><image src="@/static/icon-arrow.png"></image>
</view>
@ -99,7 +99,7 @@
<view class="item">
<view class="a">星座</view>
<view class="b">
<picker :range="pickerList5" range-key="dictLabel" :value="userInfo.constellation" @change="pickerDate6">
<picker :range="pickerList5" range-key="dictLabel" :value="pickerIndex5" @change="pickerDate6">
<view class="txt" :class="userInfo.constellation?'txt-on':''">{{userInfo.constellation?userInfo.constellation:'请选择'}}</view>
</picker><image src="@/static/icon-arrow.png"></image>
</view>
@ -111,7 +111,7 @@
<view class="content">
<view class="item">
<view class="a">情感状态</view>
<view class="b"><picker :range="pickerList6" range-key="dictLabel" :value="userInfo.emotion" @change="pickerDate7">
<view class="b"><picker :range="pickerList6" range-key="dictLabel" :value="pickerIndex6" @change="pickerDate7">
<view class="txt" :class="userInfo.emotion?'txt-on':''">{{userInfo.emotion?userInfo.emotion:'请选择'}}</view>
</picker><image src="@/static/icon-arrow.png"></image></view>
</view>
@ -132,7 +132,7 @@
<view class="content">
<view class="items" v-for="(a,i) in userInfo.xiangce" :key="i">
<image class="del" @click.stop="toDel(i)" src="@/static/icon-del.png"></image>
<image class="pic" :src="baseUrl+a"></image>
<image class="pic" :src="a"></image>
</view>
<view class="upload" @click="toNext(2)">
<image src="@/static/jia.png"></image>
@ -172,6 +172,12 @@
pickerList6: [],
pickerList7: [],
pickerList8: [],
pickerIndex1: 0,
pickerIndex2: 0,
pickerIndex3: 0,
pickerIndex4: 0,
pickerIndex5: 0,
pickerIndex6: 0,
cityType: 1,
defaultRegion: [],
uploadType: 1
@ -188,20 +194,13 @@
onReady() {
const that = this;
that.baseUrl = that.$baseUrl;
for(let i = 150;i<=210;i++){
that.pickerList1.push(i+"cm")
}
for(let i = 40;i<=120;i++){
that.pickerList2.push(i+"kg")
}
that.getUserInfo();
that.getDictDataByType();
uni.$on("yuyin",res=>{
uni.$on("changVioce",res=>{
that.getUserInfo();
})
//
uni.$on('uAvatarCropper', path => {
if(that.uploadType == 2){
if(that.uploadType == 2 || that.uploadType == 3){
//
uni.uploadFile({
url: that.$baseUrl+'/prod-api/common/upload',
@ -214,7 +213,11 @@
uni.showToast({
title: "上传成功"
})
that.userInfo.xiangce.push(fileName);
if(that.uploadType == 2){
that.userInfo.xiangce.push(url);
}else{
that.userInfo.img = url;
}
that.$forceUpdate();
}else{
uni.showToast({
@ -232,41 +235,38 @@
}
});
}else{
//
uni.$on('uAvatarCropper', path => {
const that = this;
//
uni.uploadFile({
url: that.$baseUrl+'/prod-api/api/user/uploadOSSFile',
filePath: path,
name: 'file',
formData: {
"userId": uni.getStorageSync("userInfo").id
},
complete: (res) => {
if(res.statusCode == 200){
const {code, data, msg} = JSON.parse(res.data);
if(code == 200){
uni.showToast({
title: "上传成功"
})
that.toReg(data)
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
//
uni.uploadFile({
url: that.$baseUrl+'/prod-api/api/user/uploadOSSFile',
filePath: path,
name: 'file',
formData: {
"userId": uni.getStorageSync("userInfo").id
},
complete: (res) => {
if(res.statusCode == 200){
const {code, data, msg} = JSON.parse(res.data);
if(code == 200){
uni.showToast({
title: "上传成功"
})
that.toReg(data)
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
});
})
}
});
}
})
@ -331,6 +331,8 @@
this.userInfo.city = this.defaultRegion[1];
this.userInfo.district = this.defaultRegion[2];
console.log(this.defaultRegion)
this.getDictDataByType();
}else{
uni.showToast({
title: mgs,
@ -341,40 +343,103 @@
},
//
async getDictDataByType() {
const res1 = await this.$api.getDictDataByType({dictType: 'salary_type'});
const res2 = await this.$api.getDictDataByType({dictType: 'education_type'});
const res3 = await this.$api.getDictDataByType({dictType: 'constellation_type'});
const res5 = await this.$api.getDictDataByType({dictType: this.userInfo.sex == 1?'sex_type_2':'sex_type_1'});
const res4 = await this.$api.getDictDataByType({dictType: 'marriage_type'});
const res6 = await this.$api.getDictDataByType({dictType: 'live_type'});
const that = this;
for(let i = 150;i<=210;i++){
if((i+"cm") == that.userInfo.height){
that.pickerIndex1 = (i-150)
}
that.pickerList1.push(i+"cm")
}
for(let i = 40;i<=120;i++){
if((i+"kg") == that.userInfo.weight){
that.pickerIndex2 = (i-40)
}
that.pickerList2.push(i+"kg")
}
let res1 = await that.$api.getDictDataByType({dictType: 'salary_type'});
let res2 = await that.$api.getDictDataByType({dictType: 'education_type'});
let res3 = await that.$api.getDictDataByType({dictType: 'constellation_type'});
let res4 = await that.$api.getDictDataByType({dictType: 'marriage_type'});
let res5 = await that.$api.getDictDataByType({dictType: that.userInfo.sex == 1?'sex_type_2':'sex_type_1'});
if(res1.data && res1.data.length > 0){
res1.data.map((a,index)=>{
if(that.userInfo.annualIncome == a.dictValue){
that.userInfo.annualIncome = a.dictLabel
that.userInfo.annualIncomeId = a.dictValue
that.pickerIndex3 = index;
}
})
}
if(res2.data && res2.data.length > 0){
res2.data.map((a,index)=>{
if(that.userInfo.xueli == a.dictValue){
that.userInfo.xueli = a.dictLabel
that.userInfo.xueliId = a.dictValue
that.pickerIndex4 = index
}
})
}
if(res3.data && res3.data.length > 0){
res3.data.map((a,index)=>{
if(that.userInfo.constellation == a.dictValue){
that.userInfo.constellation = a.dictLabel;
that.userInfo.constellationId = a.dictValue;
that.pickerIndex5 = index
}
})
}
if(res4.data && res4.data.length > 0){
res4.data.map((a,index)=>{
if(that.userInfo.emotion == a.dictValue){
that.userInfo.emotion = a.dictLabel;
that.userInfo.emotionId = a.dictValue;
that.pickerIndex6 = index
}
})
}
this.pickerList3 = res1.data;
this.pickerList4 = res2.data;
this.pickerList5 = res3.data;
this.pickerList6 = res4.data;
let arr = res5.data;
if(arr && arr.length > 0){
arr.map(a=>{
a.isSelect = false
let sexFlag = "",arr=[],arr1=[];
if(res5.data && res5.data.length > 0){
res5.data.map(a=>{
a.isSelect = false;
if(that.userInfo.sexFlag ){
sexFlag = that.userInfo.sexFlag.split(",")
sexFlag.map(b=>{
if(b== a.dictValue){
arr.push(a.dictLabel)
arr1.push(a.dictValue)
a.isSelect = true
}
})
}
})
}
this.pickerList7 = arr;
this.pickerList8 = res6.data;
if(that.userInfo.sexFlag ){
that.userInfo.sexFlag = arr;
that.userInfo.sexFlagIds = arr1;
}
this.pickerList7 = res5.data;
},
tabItem(index){
this.pickerList7[index].isSelect = !this.pickerList7[index].isSelect;
},
toClick(){
this.show = false
let arr = [];
let arr = [],arr1=[];
if(this.pickerList7 && this.pickerList7.length > 0){
this.pickerList7.map(a=>{
if(a.isSelect){
arr.push(a.dictLabel)
arr1.push(a.dictValue)
}
})
}
this.userInfo.sexFlag = arr.length>=1?arr:""
this.userInfo.sexFlagIds = arr1.length>=1?arr1:""
},
pickerDate1(e){
this.userInfo.birthday = e.detail.value
@ -387,15 +452,23 @@
},
pickerDate4(e){
this.userInfo.annualIncome = this.pickerList3[e.detail.value].dictLabel
this.userInfo.annualIncomeId = this.pickerList3[e.detail.value].dictValue;
this.pickerIndex3 = e.detail.value;
},
pickerDate5(e){
this.userInfo.xueli = this.pickerList4[e.detail.value].dictLabel
this.userInfo.xueliId = this.pickerList4[e.detail.value].dictValue
this.pickerIndex4 = e.detail.value;
},
pickerDate6(e){
this.userInfo.constellation = this.pickerList5[e.detail.value].dictLabel
this.userInfo.constellationId = this.pickerList5[e.detail.value].dictValue
this.pickerIndex5 = e.detail.value;
},
pickerDate7(e){
this.userInfo.emotion = this.pickerList6[e.detail.value].dictLabel
this.userInfo.emotionId = this.pickerList6[e.detail.value].dictValue
this.pickerIndex6 = e.detail.value;
},
toDel(i){
this.userInfo.xiangce.splice(i,1);
@ -403,6 +476,7 @@
},
toNext(index) {
this.uploadType=index;
console.log(222,this.uploadType)
this.$u.route({
// ""
url: '/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-cropper',
@ -438,12 +512,160 @@
toPage() {
uni.setStorageSync("yuyinInfo",{
voice: this.userInfo.voice,
voiceTime: Math.floor(this.userInfo.voiceTime/60)+":"+(this.userInfo.voiceTime-Math.floor(this.userInfo.voiceTime/60)*60),
voiceTime: this.userInfo.voiceTime,
})
uni.navigateTo({
url: "/pages/users/yuyin/index"
})
},
async toSave() {
if(!this.userInfo.declaration){
uni.showToast({
icon: "none",
position: "bottom",
title: "交友宣言不能为空!"
})
return ;
}
if(!this.userInfo.nickname){
uni.showToast({
icon: "none",
position: "bottom",
title: "昵称不能为空!"
})
return ;
}
if(!this.userInfo.birthday){
uni.showToast({
icon: "none",
position: "bottom",
title: "出生日期不能为空!"
})
return ;
}
if(!this.userInfo.height){
uni.showToast({
icon: "none",
position: "bottom",
title: "请选择身高"
})
return ;
}
if(!this.userInfo.weight){
uni.showToast({
icon: "none",
position: "bottom",
title: "请选择体重"
})
return ;
}
if(!this.userInfo.annualIncome){
uni.showToast({
icon: "none",
position: "bottom",
title: "请选择年收入"
})
return ;
}
if(!this.userInfo.xueli){
uni.showToast({
icon: "none",
position: "bottom",
title: "请选择学历"
})
return ;
}
if(!this.userInfo.post){
uni.showToast({
icon: "none",
position: "bottom",
title: "职业不能为空!"
})
return ;
}
if(!this.userInfo.city){
uni.showToast({
icon: "none",
position: "bottom",
title: "请选择现居城市"
})
return ;
}
if(!this.userInfo.home){
uni.showToast({
icon: "none",
position: "bottom",
title: "请选择家乡"
})
return ;
}
if(!this.userInfo.emotion){
uni.showToast({
icon: "none",
position: "bottom",
title: "请选择情感状态"
})
return ;
}
if(!this.userInfo.sexFlag){
uni.showToast({
icon: "none",
position: "bottom",
title: "请选择喜欢什么异性"
})
return ;
}
if(this.userInfo.xiangce.length == 0){
uni.showToast({
icon: "none",
position: "bottom",
title: "请上传照片"
})
return ;
}
const {code, data, msg} = await this.$api.editUser({
id: uni.getStorageSync("userInfo").id,
nickname: this.userInfo.nickname,
faceImage: this.userInfo.faceImage,
xueli: this.userInfo.xueliId,
img: this.userInfo.img,
birthday: this.userInfo.birthday,
declaration: this.userInfo.declaration,
voice: this.userInfo.voice,
voiceTime: this.userInfo.voiceTime,
height: this.userInfo.height,
weight: this.userInfo.weight,
post: this.userInfo.post,
emotion: this.userInfo.emotionId,
annualIncome: this.userInfo.annualIncomeId,
home: this.userInfo.home,
constellation: this.userInfo.constellationId,
sexFlag: this.userInfo.sexFlagIds.join(","),
province: this.userInfo.province,
district: this.userInfo.district,
city: this.userInfo.city,
address: this.userInfo.address,
reserved1: this.userInfo.xiangce.join(","),
})
if(code == 200){
uni.showToast({
title: "保存成功"
})
// this.getUserInfo();
// this.$forceUpdate();
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
},2000)
}else{
uni.showToast({
icon: "none",
position: "bottom",
title: msg
})
}
},
}
}
</script>

@ -17,8 +17,8 @@
</view>
<view class="b">
<view class="tag" v-if="userInfo.age">{{userInfo.age}}</view>
<view class="tag" v-if="userInfo.height">{{userInfo.height}}cm</view>
<view class="tag" v-if="userInfo.weight">{{userInfo.weight}}kg</view>
<view class="tag" v-if="userInfo.height">{{userInfo.height}}</view>
<view class="tag" v-if="userInfo.weight">{{userInfo.weight}}</view>
<view class="tag" v-if="userInfo.post">{{userInfo.post}}</view>
</view>
<view class="c" v-if="userInfo.declaration">
@ -34,12 +34,12 @@
</view>
</view>
<view class="user-bd" v-if="current == 0">
<view class="xiangce">
<view class="xiangce" v-if="userInfo.xiangce.length > 0">
<view class="title">相册
<view class="more" v-if="userInfo.xiangce && userInfo.xiangce.length > 0" @click="openPage(7)">{{userInfo.xiangce.length > 0}}张<image src="@/static/icon-arrow.png"></image></view>
<view class="more" v-if="userInfo.xiangce && userInfo.xiangce.length > 0" @click="openPage(7,userInfo.id)">{{userInfo.xiangce.length}}张<image src="@/static/icon-arrow.png"></image></view>
</view>
<view class="list" v-if="userInfo.xiangce && userInfo.xiangce.length > 0">
<image v-for="(a,i) in userInfo.xiangce" @click="openPage(8)" :key="i" :src="baseUrl+a"></image>
<image v-for="(a,i) in userInfo.xiangce" @click="openPage(8,i)" :key="i" :src="a"></image>
</view>
</view>
<view class="xiangce">
@ -67,7 +67,7 @@
<view class="title">个人信息
</view>
<view class="qinggan">
<view class="li">年收入<text>{{userInfo.annualIncome}}w</text></view>
<view class="li">年收入<text>{{userInfo.annualIncome}}</text></view>
<view class="li">家乡<text>{{userInfo.home}}</text></view>
<view class="li">学历<text>{{userInfo.xueli}}</text></view>
<view class="li">星座<text>{{userInfo.constellation}}</text></view>
@ -91,10 +91,10 @@
</view>
<view class="user-bd" v-if="current==2">
<view class="dongtai">
<view class="item" v-for="i in 10" :key="i" @click="openPage(5,1)">
<view class="item" v-for="(a,i) in userInfo.sitterServiceList" :key="i" @click="openPage(5,a.id)">
<view class="a">
<view class="fl">
<image src="@/static/nv.png"></image>
<image :src="a"></image>
<view class="info">
<view class="name">幽默的先生</view>
<view class="desc">2024-06-06 11:23</view>
@ -180,7 +180,6 @@
onLoad() {
this.statusBarHeight = systemInfoSync.statusBarHeight;
this.baseUrl = this.$baseUrl
},
onShow() {
this.getUserInfo();
@ -194,6 +193,10 @@
if(data.reserved1){
this.userInfo.xiangce = data.reserved1.split(",")
}
if(data.home){
this.userInfo.home = data.home.split("-")[0]+"-"+data.home.split("-")[1]
}
this.getDictDataByType();
}else{
uni.showToast({
title: mgs,
@ -202,6 +205,60 @@
})
}
},
//
async getDictDataByType() {
const that = this;
let res1 = await that.$api.getDictDataByType({dictType: 'salary_type'});
let res2 = await that.$api.getDictDataByType({dictType: 'education_type'});
let res3 = await that.$api.getDictDataByType({dictType: 'constellation_type'});
let res4 = await that.$api.getDictDataByType({dictType: 'marriage_type'});
let res5 = await that.$api.getDictDataByType({dictType: that.userInfo.sex == 1?'sex_type_2':'sex_type_1'});
if(res1.data && res1.data.length > 0){
res1.data.map((a,index)=>{
if(that.userInfo.annualIncome == a.dictValue){
that.userInfo.annualIncome = a.dictLabel
}
})
}
if(res2.data && res2.data.length > 0){
res2.data.map((a,index)=>{
if(that.userInfo.xueli == a.dictValue){
that.userInfo.xueli = a.dictLabel
}
})
}
if(res3.data && res3.data.length > 0){
res3.data.map((a,index)=>{
if(that.userInfo.constellation == a.dictValue){
that.userInfo.constellation = a.dictLabel;
}
})
}
if(res4.data && res4.data.length > 0){
res4.data.map((a,index)=>{
if(that.userInfo.emotion == a.dictValue){
that.userInfo.emotion = a.dictLabel;
}
})
}
let sexFlag = "",arr=[],arr1=[];
if(res5.data && res5.data.length > 0){
res5.data.map(a=>{
if(that.userInfo.sexFlag ){
sexFlag = that.userInfo.sexFlag.split(",")
sexFlag.map(b=>{
if(b== a.dictValue){
arr.push(a.dictLabel)
}
})
}
})
}
if(that.userInfo.sexFlag ){
that.userInfo.sexFlag = arr;
}
},
openPage(index,id){
if(index == 1){
uni.navigateTo({
@ -223,6 +280,11 @@
uni.navigateTo({
url: "/pages/peiwan/xiangce?id="+id
})
}else if(index == 8){
uni.previewImage({
urls: this.userInfo.xiangce,
count: id
})
}
},
changeTabs(index){
@ -231,7 +293,7 @@
toToggle () {
this.isPlay = !this.isPlay
if(this.isPlay){
innerAudioContext.src = 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3';
innerAudioContext.src = this.userInfo.voice;
innerAudioContext.play();
}else{
innerAudioContext.pause();

@ -1,7 +1,7 @@
<template>
<view class="yuyin">
<view class="a" v-if="!yuyinInfo.voice">
<view class="item" @click="toDo(1)">
<view class="item">
<image class="img1" v-if="isPlays == false" @click="toDo(5)" src="@/static/yuying-04.png"></image>
<image class="img2" v-else @click="toDo(6)" src="@/static/yuying-02.png"></image>
<view class="txt">{{isPlays?'停止录音':'点击录音'}}</view>
@ -16,12 +16,14 @@
<view class="item">
<image class="img1" v-if="isPlay == false" @click="toDo(3)" src="@/static/yuying-04.png"></image>
<image class="img2" v-else @click="toDo(4)" src="@/static/yuying-02.png"></image>
<view class="txt">{{yuyinInfo.voiceTime}}</view>
<view class="txt" v-if="isPlay == false">{{counts?counts:yuyinInfo.voiceTime}}</view>
<view class="txt" v-else>{{counts}}</view>
</view>
<view class="items" @click="toDo(5)">
<view class="items" @click="toDo(51)" v-if="isRest">
<image src="/static/yuying-03.png"></image>
<view class="txt">保存提交</view>
</view>
<view class="items" v-else></view>
</view>
<u-popup v-model="show" mode="top" :mask-close-able='false' :zIndex="5">
<view class="permissions_box">
@ -32,9 +34,9 @@
</template>
<script>
import permision from "@/js_sdk/wa-permission/permission.js"
const recorderManager = uni.getRecorderManager();
const innerAudioContext = uni.createInnerAudioContext();
import permision from "@/js_sdk/wa-permission/permission.js"
innerAudioContext.autoplay = true;
let timer = 0;
export default {
@ -45,49 +47,37 @@
show: false,
isPlay: false,
isPlays: false,
yuyinInfo: {}
yuyinInfo: {},
isRest: false,
counts: 0,
isPlay1: false
};
},
onLoad() {
onReady() {
const that = this;
that.yuyinInfo = uni.getStorageSync("yuyinInfo");
that.baseUrl = that.$baseUrl;
console.log(that.yuyinInfo)
that.yuyinInfo.voiceTime = that.formatFun(that.yuyinInfo.voiceTime);
that.baseUrl = that.$baseUrl;
recorderManager.onStop(function (res) {
console.log('recorder stop' + JSON.stringify(res));
//
uni.uploadFile({
url: that.$baseUrl+'/prod-api/common/upload',
filePath: res.tempFilePath,
name: 'file',
complete: (res) => {
console.log(res)
if(res.statusCode == 200){
const {code, fileName, url, msg} = JSON.parse(res.data);
if(code == 200){
uni.showToast({
title: "上传成功"
})
that.yuyinInfo.voice = url;
that.$forceUpdate();
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}
});
console.log('that.voicePath:' +that.yuyinInfo.voice);
that.yuyinInfo.voice = res.tempFilePath;
that.isPlays = false;
that.count = 0;
that.counts = 0;
that.isPlay = false;
clearInterval(timer);
that.$forceUpdate();
console.log('that.yuyinInfo:' +JSON.stringify(that.yuyinInfo));
console.log(that.yuyinInfo.voice)
console.log(that.yuyinInfo.voiceTime)
});
innerAudioContext.onEnded(res=>{
that.isPlay = false
})
innerAudioContext.onTimeUpdate(res=>{
console.log(innerAudioContext.currentTime)
that.counts = that.formatFun(Math.ceil(innerAudioContext.currentTime.toFixed(0)))
})
uni.$on("onPopup",res=>{
if(res == 1){
that.show = false
@ -133,6 +123,15 @@
that.show=false
that.yuyinInfo.voice = ""
that.yuyinInfo.voiceTime = that.formatFun(0);
that.yuyinInfo.voiceTimes = 0;
that.counts = 0;
that.count = 0;
that.isRest = true;
if(that.isPlay1){
console.log(1111)
innerAudioContext.pause();
that.isPlay1 = false
}
}
},
error => {
@ -142,16 +141,27 @@
that.requestAndroidPermission('android.permission.RECORD_AUDIO')
return ;
}
that.counts = 0;
that.count = 0;
that.yuyinInfo.voice = ""
that.yuyinInfo.voiceTime = that.formatFun(0);
that.yuyinInfo.voiceTimes = 0;
that.isRest = true;
}else if(index == 2){
recorderManager.stop();
}else if(index == 3){
innerAudioContext.src = this.yuyinInfo.voice;
this.isPlay = true;
console.log(111,innerAudioContext)
if(innerAudioContext){
console.log(innerAudioContext.src)
}
innerAudioContext.src = that.yuyinInfo.voice;
that.isPlay = true;
innerAudioContext.play();
that.isPlay1 = true;
}else if(index == 4){
this.isPlay = false;
console.log(222,innerAudioContext)
that.isPlay = false;
that.isPlay1 = false;
innerAudioContext.pause();
}else if(index == 5){
// APP
@ -190,15 +200,57 @@
timer = setInterval(()=>{
that.count++
that.yuyinInfo.voiceTime = that.formatFun(that.count)
that.yuyinInfo.voiceTimes = that.count
},1000)
recorderManager.start({
format: "mp3"
})
}else if(index == 6){
this.isPlays = false;
that.count = 0;
clearInterval(timer);
recorderManager.stop();
}else if(index == 51){
//
uni.uploadFile({
url: that.$baseUrl+'/prod-api/api/user/voiceSign',
filePath: that.yuyinInfo.voice,
name: 'file',
formData: {
userId: uni.getStorageSync("userInfo").id,
voiceTime: that.formatFun2(that.yuyinInfo.voiceTime)
},
complete: (res) => {
console.log({
userId: uni.getStorageSync("userInfo").id,
voiceTime: that.formatFun2(that.yuyinInfo.voiceTime)
})
console.log(res)
if(res.statusCode == 200){
const {code, fileName, url, msg} = JSON.parse(res.data);
if(code == 200){
uni.showToast({
title: "上传成功"
})
that.isRest = false;
uni.$emit("changVioce",111)
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
},2000)
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}
});
}
},
formatFun(num){
@ -209,13 +261,19 @@
str = (h<=9?'0'+h:h)+":"+(m<=9?'0'+m:m)+":"+(s<=9?'0'+s:s)
return str;
},
formatFun2(num){
let str = "",h,m,s,arr = num.split(":");
h=parseInt(arr[0])*3600;
m=parseInt(arr[1])*60;
s=parseInt(arr[2]);
str = h+m+s
return str;
},
},
destroyed() {
if (innerAudioContext) {
try {
innerAudioContext.pause();
innerAudioContext.destroy()
innerAudioContext = null
} catch (e) {
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save