17
@@ -10,18 +10,17 @@
|
|||||||
export default {
|
export default {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
console.log("App Launch");
|
console.log("App Launch");
|
||||||
// #ifdef H5
|
// #ifndef APP
|
||||||
console.error(
|
console.error(
|
||||||
`暂时不支持运行到 Web,如果需要移动端的 Web 项目,参考 [H5 demo](https://github.com/openimsdk/openim-h5-demo)`
|
`暂时不支持运行到 Web或小程序端,如果需要移动端的 Web 项目,参考 [H5 demo](https://github.com/openimsdk/openim-h5-demo)`
|
||||||
);
|
);
|
||||||
return ;
|
return ;
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef APP
|
||||||
console.error(`暂时不支持运行到小程序端`);
|
|
||||||
// #endif
|
|
||||||
this.checkUpdate();
|
this.checkUpdate();
|
||||||
this.setGlobalIMlistener();
|
this.setGlobalIMlistener();
|
||||||
this.tryLogin();
|
this.tryLogin();
|
||||||
|
// #endif
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
console.log("App Show");
|
console.log("App Show");
|
||||||
@@ -80,7 +79,7 @@
|
|||||||
uni.removeStorage({
|
uni.removeStorage({
|
||||||
key: "BusinessToken",
|
key: "BusinessToken",
|
||||||
});
|
});
|
||||||
uni.$u.route("/pages/login/index");
|
uni.$u.route("/pages/common/login/index");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
IMSDK.subscribe(IMSDK.IMEvents.OnKickedOffline, (data) => {
|
IMSDK.subscribe(IMSDK.IMEvents.OnKickedOffline, (data) => {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
const token = uni.getStorageSync('IMToken');
|
const token = uni.getStorageSync('IMToken');
|
||||||
if (!token) {
|
if (!token) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: "/pages/login/index"
|
url: "/pages/common/login/index"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
<!-- <script src="/static/wangeditor/index.js"></script>
|
||||||
|
<link rel="stylesheet" href="/static/wangeditor/style.css" /> -->
|
||||||
<script>
|
<script>
|
||||||
var coverSupport =
|
var coverSupport =
|
||||||
"CSS" in window &&
|
"CSS" in window &&
|
||||||
|
|||||||
@@ -2,22 +2,22 @@
|
|||||||
"pages": [
|
"pages": [
|
||||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||||
{
|
{
|
||||||
"path": "pages/login/index"
|
"path": "pages/common/login/index"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/registerOrForget/index"
|
"path": "pages/common/registerOrForget/index"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/setSelfInfo/index"
|
"path": "pages/common/setSelfInfo/index"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/setPassword/index"
|
"path": "pages/common/setPassword/index"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/verifyCode/index"
|
"path": "pages/common/verifyCode/index"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/profile/index/index"
|
"path": "pages/user/index/index"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/conversation/conversationList/index",
|
"path": "pages/conversation/conversationList/index",
|
||||||
@@ -135,6 +135,14 @@
|
|||||||
"disableScroll": true
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/common/contactChoose/chooseGroupMember",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/common/createGroup/index",
|
"path": "pages/common/createGroup/index",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -199,21 +207,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/profile/selfInfo/index",
|
"path": "pages/user/selfInfo/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/profile/accountSetting/index",
|
"path": "pages/user/accountSetting/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/profile/blockList/index",
|
"path": "pages/user/blockList/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
@@ -241,14 +249,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/profile/about/index",
|
"path": "pages/user/about/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/workbench/index/index",
|
"path": "pages/find/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
@@ -274,31 +282,31 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/workbench/friend-circle/friend-circle",
|
"path": "pages/find/friend-circle/friend-circle",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": ""
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/workbench/friend-circle/releaseFriendCircle",
|
"path": "pages/find/friend-circle/releaseFriendCircle",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": ""
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/workbench/friend-circle/chooseLocation",
|
"path": "pages/find/friend-circle/chooseLocation",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": ""
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/workbench/friend-circle/chooseCircleBgImg",
|
"path": "pages/find/friend-circle/chooseCircleBgImg",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": ""
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/workbench/friend-circle/builtinBgImg",
|
"path": "pages/find/friend-circle/builtinBgImg",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": ""
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
@@ -346,7 +354,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/workbench/near/near",
|
"path": "pages/find/near/near",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/user/vip/vip",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": ""
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
@@ -372,13 +386,13 @@
|
|||||||
"text": "通讯录"
|
"text": "通讯录"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/workbench/index/index",
|
"pagePath": "pages/find/index/index",
|
||||||
"iconPath": "./static/images/tabbar/workbench.png",
|
"iconPath": "./static/images/tabbar/workbench.png",
|
||||||
"selectedIconPath": "static/images/tabbar/workbench_active.png",
|
"selectedIconPath": "static/images/tabbar/workbench_active.png",
|
||||||
"text": "发现"
|
"text": "发现"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/profile/index/index",
|
"pagePath": "pages/user/index/index",
|
||||||
"iconPath": "./static/images/tabbar/profile.png",
|
"iconPath": "./static/images/tabbar/profile.png",
|
||||||
"selectedIconPath": "static/images/tabbar/profile_active.png",
|
"selectedIconPath": "static/images/tabbar/profile_active.png",
|
||||||
"text": "我"
|
"text": "我"
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
const _this = this;
|
const _this = this;
|
||||||
let list = [...this.storeConversationList];
|
let list = [...this.storeConversationList];
|
||||||
if(this.keyword){
|
if(this.keyword){
|
||||||
list = list.filter((item)=>{77
|
list = list.filter((item)=>{
|
||||||
return item.showName.indexOf(_this.kw)>-1 || item.userID.indexOf(_this.kw)>-1 || item.groupID.indexOf(_this.kw)>-1
|
return item.showName.indexOf(_this.kw)>-1 || item.userID.indexOf(_this.kw)>-1 || item.groupID.indexOf(_this.kw)>-1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,261 @@
|
|||||||
|
<template>
|
||||||
|
<view class="contact_choose_container">
|
||||||
|
<custom-nav-bar title="群成员">
|
||||||
|
<view slot="more" style="margin-right: 10rpx;">
|
||||||
|
<u-button type="primary" @click="confirm" :disabled="!isConfirmEnable">确定</u-button>
|
||||||
|
</view>
|
||||||
|
</custom-nav-bar>
|
||||||
|
|
||||||
|
<view class="search_bar_wrap">
|
||||||
|
<u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="tab_container">
|
||||||
|
<view class="tab_pane">
|
||||||
|
<choose-index-list
|
||||||
|
@updateCheck="updateCheckedUser"
|
||||||
|
:indexList="getChooseData.indexList"
|
||||||
|
:itemArr="getChooseData.dataList"
|
||||||
|
:checkedIDList="checkedUserIDList"
|
||||||
|
:disabledIDList="disabledUserIDList"
|
||||||
|
:showCheck="muitple" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {mapGetters} from "vuex";
|
||||||
|
import {formatChooseData,toastWithCallback} from "@/util/common";
|
||||||
|
import IMSDK from "openim-uniapp-polyfill";
|
||||||
|
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||||
|
import UserItem from "@/components/UserItem/index.vue";
|
||||||
|
import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
CustomNavBar,
|
||||||
|
UserItem,
|
||||||
|
ChooseIndexList
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
keyword: "",
|
||||||
|
groupID: "",
|
||||||
|
groupMemberList:[],
|
||||||
|
hideUserIDList: [],
|
||||||
|
checkedUserIDList: [],
|
||||||
|
disabledUserIDList: [],
|
||||||
|
comfirmLoading: false,
|
||||||
|
muitple:true
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
getChooseData() {
|
||||||
|
const list = [...this.groupMemberList];
|
||||||
|
if (this.keyword) {
|
||||||
|
return {
|
||||||
|
indexList: ["#"],
|
||||||
|
dataList: [
|
||||||
|
list.filter(
|
||||||
|
(friend) =>{
|
||||||
|
if(friend.nickname && friend.nickname.indexOf(this.keyword) !==-1){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(friend.remark && friend.remark.includes(this.keyword)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
console.log(friend.nickname);
|
||||||
|
return friend.nickname.indexOf(this.keyword) !==-1 || friend?.remark.indexOf(this.keyword) !==-1
|
||||||
|
}
|
||||||
|
),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return formatChooseData(list);
|
||||||
|
},
|
||||||
|
getCheckedUserInfo() {
|
||||||
|
const tmpUserIDList = [...this.checkedUserIDList];
|
||||||
|
const checkedFriends = this.groupMemberList.filter((friend) => {
|
||||||
|
const idx = tmpUserIDList.findIndex(
|
||||||
|
(userID) => userID === friend.userID
|
||||||
|
);
|
||||||
|
if (idx > -1) {
|
||||||
|
tmpUserIDList.splice(idx, 1);
|
||||||
|
}
|
||||||
|
return idx > -1;
|
||||||
|
});
|
||||||
|
return [...checkedFriends];
|
||||||
|
},
|
||||||
|
isConfirmEnable(){
|
||||||
|
if(this.checkedUserIDList.length){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async onLoad(options) {
|
||||||
|
const {groupID,checkedUserIDList,hideUserIDList,muitple} = options;
|
||||||
|
this.groupID = groupID;
|
||||||
|
if(muitple){
|
||||||
|
this.muitple = muitple;
|
||||||
|
}
|
||||||
|
this.checkedUserIDList = checkedUserIDList ? JSON.parse(checkedUserIDList) : [];
|
||||||
|
this.hideUserIDList = hideUserIDList ? JSON.parse(hideUserIDList) : [];
|
||||||
|
const list = await this.getGroupMemberList();
|
||||||
|
|
||||||
|
this.groupMemberList = list.filter(
|
||||||
|
(friend) =>{
|
||||||
|
return false == this.hideUserIDList.includes(friend.userID);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (this.checkedUserIDList.length > 0) {
|
||||||
|
this.checkDisabledUser();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getGroupMemberList() {
|
||||||
|
const _this = this;
|
||||||
|
return new Promise((resolve,reject)=>{
|
||||||
|
if (!_this.groupID) {
|
||||||
|
return reject('groupid is null');
|
||||||
|
}
|
||||||
|
IMSDK.asyncApi(IMSDK.IMMethods.GetGroupMemberList, IMSDK.uuid(), {
|
||||||
|
groupID: _this.groupID,
|
||||||
|
filter: 0,
|
||||||
|
offset: 0,
|
||||||
|
count: 6,
|
||||||
|
}).then(({ data }) => {
|
||||||
|
return resolve(data)
|
||||||
|
}).catch(e=>{
|
||||||
|
return reject(e);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkDisabledUser() {
|
||||||
|
const friendIDList = this.groupMemberList.map((friend) => friend.userID);
|
||||||
|
IMSDK.asyncApi("getUsersInGroup", IMSDK.uuid(), {
|
||||||
|
groupID: this.groupID,
|
||||||
|
userIDList: friendIDList,
|
||||||
|
}).then(({data}) => {
|
||||||
|
this.disabledUserIDList = data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
tabChange(idx) {
|
||||||
|
this.keyword = "";
|
||||||
|
this.activeTab = idx;
|
||||||
|
},
|
||||||
|
updateCheckedUser({userID}) {
|
||||||
|
if(!this.muitple){
|
||||||
|
this.checkedUserIDList = [userID];
|
||||||
|
this.confirm();
|
||||||
|
}else{
|
||||||
|
if (this.checkedUserIDList.includes(userID)) {
|
||||||
|
const idx = this.checkedUserIDList.findIndex((item) => item === userID);
|
||||||
|
const tmpArr = [...this.checkedUserIDList];
|
||||||
|
tmpArr.splice(idx, 1);
|
||||||
|
this.checkedUserIDList = [...tmpArr];
|
||||||
|
} else {
|
||||||
|
this.checkedUserIDList = [...this.checkedUserIDList, userID];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
this.comfirmLoading = true;
|
||||||
|
try{
|
||||||
|
const eventChannel = this.getOpenerEventChannel();
|
||||||
|
eventChannel.emit('onSelectedConfirm', this.getCheckedUserInfo);
|
||||||
|
}catch(e){
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
this.comfirmLoading = false;
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
this.comfirmLoading = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onBackPress() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep.u-popup {
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact_choose_container {
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.search_bar_wrap {
|
||||||
|
height: 34px;
|
||||||
|
padding: 12px 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab_container {
|
||||||
|
@include colBox(false);
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.setting_item {
|
||||||
|
padding: 32rpx 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
height: 60rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
// padding: 16rpx 8rpx;
|
||||||
|
background: #f8f9fa;
|
||||||
|
color: #8e9ab0;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs_bar {
|
||||||
|
@include vCenterBox();
|
||||||
|
justify-content: space-evenly;
|
||||||
|
|
||||||
|
.tab_item {
|
||||||
|
@include colBox(false);
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab_pane {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.member_list {
|
||||||
|
flex: 1;
|
||||||
|
height: 80% !important;
|
||||||
|
|
||||||
|
::v-deepuni-scroll-view {
|
||||||
|
max-height: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user_list {
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.member_anchor {
|
||||||
|
background-color: #f8f8f8 !important;
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -148,7 +148,7 @@ export default {
|
|||||||
this.eying = !this.eying;
|
this.eying = !this.eying;
|
||||||
},
|
},
|
||||||
toRegisterOrForget(isRegister) {
|
toRegisterOrForget(isRegister) {
|
||||||
uni.$u.route("/pages/login/registerOrForget/index", {
|
uni.$u.route("/pages/login/common/index", {
|
||||||
isRegister,
|
isRegister,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -16,11 +16,11 @@
|
|||||||
<view class="search_container" v-if="1==2">
|
<view class="search_container" v-if="1==2">
|
||||||
<u-search placeholder="日照香炉生紫烟" v-model="keyword"></u-search>
|
<u-search placeholder="日照香炉生紫烟" v-model="keyword"></u-search>
|
||||||
<u-cell-group :customStyle="{backgroundColor:'#FFF'}">
|
<u-cell-group :customStyle="{backgroundColor:'#FFF'}">
|
||||||
<u-cell title="摇一摇" icon="/static/images/workbench/05.png" :size="cellSize"></u-cell>
|
<u-cell title="摇一摇" icon="/static/images/find/05.png" :size="cellSize"></u-cell>
|
||||||
<u-cell title="看一看" icon="/static/images/workbench/06.png" :size="cellSize"></u-cell>
|
<u-cell title="看一看" icon="/static/images/find/06.png" :size="cellSize"></u-cell>
|
||||||
<u-cell title="听一听" icon="/static/images/workbench/06.png" :size="cellSize"></u-cell>
|
<u-cell title="听一听" icon="/static/images/find/06.png" :size="cellSize"></u-cell>
|
||||||
<u-cell title="附近" icon="/static/images/workbench/08.png" :size="cellSize"></u-cell>
|
<u-cell title="附近" icon="/static/images/find/08.png" :size="cellSize"></u-cell>
|
||||||
<u-cell title="购物" icon="/static/images/workbench/09.png" :size="cellSize"></u-cell>
|
<u-cell title="购物" icon="/static/images/find/09.png" :size="cellSize"></u-cell>
|
||||||
</u-cell-group>
|
</u-cell-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
uni.$u.toast("验证码已发送!");
|
uni.$u.toast("验证码已发送!");
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() =>
|
() =>
|
||||||
uni.$u.route("/pages/login/verifyCode/index", {
|
uni.$u.route("/pages/common/verifyCode/index", {
|
||||||
userInfo: JSON.stringify(this.userInfo),
|
userInfo: JSON.stringify(this.userInfo),
|
||||||
isRegister: this.isRegister,
|
isRegister: this.isRegister,
|
||||||
}),
|
}),
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
back() {
|
back() {
|
||||||
uni.$u.route("/pages/login/index");
|
uni.$u.route("/pages/common/login/index");
|
||||||
},
|
},
|
||||||
showPicker() {
|
showPicker() {
|
||||||
this.$refs.AreaPicker.init();
|
this.$refs.AreaPicker.init();
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if(err.msg=="验证码过期" || err.msg=="验证码错误"){
|
if(err.msg=="验证码过期" || err.msg=="验证码错误"){
|
||||||
uni.$u.route("/pages/login/verifyCode/index", {
|
uni.$u.route("/pages/common/verifyCode/index", {
|
||||||
userInfo: JSON.stringify(this.userInfo),
|
userInfo: JSON.stringify(this.userInfo),
|
||||||
isRegister: true,
|
isRegister: true,
|
||||||
resend: 1,
|
resend: 1,
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
onReady() {},
|
onReady() {},
|
||||||
methods: {
|
methods: {
|
||||||
back() {
|
back() {
|
||||||
uni.$u.route("/pages/login/registerOrForget/index", {
|
uni.$u.route("/pages/login/common/index", {
|
||||||
isRegister: this.isRegister,
|
isRegister: this.isRegister,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -77,13 +77,13 @@
|
|||||||
businessVerifyCode(options)
|
businessVerifyCode(options)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (this.isRegister) {
|
if (this.isRegister) {
|
||||||
uni.$u.route("/pages/login/setSelfInfo/index", {
|
uni.$u.route("/pages/common/setSelfInfo/index", {
|
||||||
userInfo: JSON.stringify(this.userInfo),
|
userInfo: JSON.stringify(this.userInfo),
|
||||||
isRegister: this.isRegister,
|
isRegister: this.isRegister,
|
||||||
codeValue: this.codeValue,
|
codeValue: this.codeValue,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.$u.route("/pages/login/setPassword/index", {
|
uni.$u.route("/pages/common/setPassword/index", {
|
||||||
userInfo: JSON.stringify(this.userInfo),
|
userInfo: JSON.stringify(this.userInfo),
|
||||||
isRegister: !this.isRegister,
|
isRegister: !this.isRegister,
|
||||||
codeValue: this.codeValue,
|
codeValue: this.codeValue,
|
||||||
@@ -1,193 +1,284 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="editor_wrap">
|
<div id="editor-container" :call="option" :change:call="editorModule.call"><!-- 编辑器 --></div>
|
||||||
<editor
|
|
||||||
:placeholder="placeholder"
|
|
||||||
id="editor2"
|
|
||||||
@ready="editorReady"
|
|
||||||
@focus="editorFocus"
|
|
||||||
@blur="editorBlur"
|
|
||||||
@input="editorInput" />
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { forIn } from "lodash";
|
|
||||||
import {html2Text} from "@/util/common";
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
|
||||||
placeholder: {
|
|
||||||
type: String,
|
|
||||||
default: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
editorCtx: null,
|
timer:null,
|
||||||
lastStr: "",
|
option:null,
|
||||||
isInsertingEmoji: false, // 标记是否正在插入表情
|
events:[],
|
||||||
hasFocus: false, // 记录编辑器是否有焦点
|
}
|
||||||
};
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
editorReady() {
|
insertText(text,successFn,errorFn){
|
||||||
uni
|
this.addEvent('insertText',text);
|
||||||
.createSelectorQuery()
|
|
||||||
.select("#editor2")
|
|
||||||
.context((res) => {
|
|
||||||
//this.$emit("ready", res);
|
|
||||||
this.editorCtx = res.context;
|
|
||||||
})
|
|
||||||
.exec();
|
|
||||||
},
|
},
|
||||||
editorFocus() {
|
insertImgEmoji(src,successFn,errorFn){
|
||||||
this.hasFocus = true;
|
this.addEvent('insertImgEmoji',src);
|
||||||
// 如果正在插入表情,不触发 focus 事件,并立即隐藏键盘
|
|
||||||
if (this.isInsertingEmoji) {
|
|
||||||
// #ifdef APP-PLUS || H5
|
|
||||||
uni.hideKeyboard();
|
|
||||||
// #endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.$emit("focus");
|
|
||||||
},
|
},
|
||||||
editorBlur() {
|
insertMention(username,userid){
|
||||||
this.hasFocus = false;
|
this.addEvent('insertMention',{
|
||||||
this.$emit("blur");
|
username,
|
||||||
|
userid
|
||||||
|
});
|
||||||
},
|
},
|
||||||
clear(){
|
clear(){
|
||||||
this.editorCtx.clear()
|
this.addEvent('clear');
|
||||||
},
|
},
|
||||||
insertText(text,successFn,errFn){
|
blur(){
|
||||||
// 标记正在插入表情,阻止 focus 事件触发
|
this.addEvent('blur');
|
||||||
this.isInsertingEmoji = true;
|
},
|
||||||
|
focus(){
|
||||||
// 先隐藏键盘,避免插入时键盘弹出
|
this.addEvent('focus');
|
||||||
// #ifdef APP-PLUS || H5
|
},
|
||||||
uni.hideKeyboard();
|
setHtml(html){
|
||||||
|
this.addEvent('setHtml',html);
|
||||||
|
},
|
||||||
|
getText(){
|
||||||
|
this.addEvent('getText');
|
||||||
|
},
|
||||||
|
getHtml(){
|
||||||
|
console.log(this);
|
||||||
|
return 1;
|
||||||
|
this.addEvent('getHtml');
|
||||||
|
},
|
||||||
|
getSelectionPosition(){
|
||||||
|
this.addEvent('getSelectionPosition');
|
||||||
|
},
|
||||||
|
getParentNode(){
|
||||||
|
this.addEvent('getParentNode');
|
||||||
|
},
|
||||||
|
// 调用
|
||||||
|
call() {
|
||||||
|
if (this.timer) return;
|
||||||
|
// 消费事件队列(生产者/消费者机制)
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
if (this.events.length) {
|
||||||
|
this.option = this.events.shift();
|
||||||
|
console.log(this.option);
|
||||||
|
} else {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
|
},
|
||||||
|
// 添加事件队列
|
||||||
|
addEvent(name, data) {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
// tips:由于采用监听option改变来调用方法,
|
||||||
|
// 如果连续变化两次option,渲染层只会则监听到最后一次
|
||||||
|
// 导致调用丢失,所以采用事件队列形式解决,稍微延时10ms
|
||||||
|
// 等待渲染进程监听到option变化,在进行更改option
|
||||||
|
// 从性能上,几乎无感可以放心使用
|
||||||
|
const option = {
|
||||||
|
id: this.genId(),
|
||||||
|
name: `_${name}`,
|
||||||
|
data
|
||||||
|
};
|
||||||
|
this.events.push(option);
|
||||||
|
this.call();
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// 如果编辑器当前有焦点,先让它失焦(通过点击外部区域)
|
// #ifndef APP-PLUS
|
||||||
// 但这种方式可能不太可靠,所以我们主要依赖 isInsertingEmoji 标志
|
this[`_${name}`] && this[`_${name}`](data);
|
||||||
|
// #endif
|
||||||
// 使用 insertText 插入文本(这是最可靠的方法)
|
|
||||||
// 虽然会触发焦点,但我们已经通过 isInsertingEmoji 标志阻止了 focus 事件
|
|
||||||
this.editorCtx.insertText({
|
|
||||||
text: text,
|
|
||||||
success: (res) => {
|
|
||||||
successFn && successFn.call(this, [res]);
|
|
||||||
console.log("插入文字成功");
|
|
||||||
|
|
||||||
// 插入后立即隐藏键盘,防止键盘弹出
|
|
||||||
// #ifdef APP-PLUS || H5
|
|
||||||
// 使用多个延迟确保键盘被隐藏
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideKeyboard();
|
|
||||||
}, 10);
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideKeyboard();
|
|
||||||
}, 50);
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideKeyboard();
|
|
||||||
}, 100);
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// 延迟重置标志,确保 focus 事件被完全忽略
|
|
||||||
setTimeout(() => {
|
|
||||||
this.isInsertingEmoji = false;
|
|
||||||
}, 300);
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
errFn && errFn.call(this, [err]);
|
|
||||||
console.log("插入文字失败", err);
|
|
||||||
this.isInsertingEmoji = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
delete(){
|
genId() {
|
||||||
this.editorCtx.getContents({
|
let result = '';
|
||||||
success({html,text,delta}){
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
console.log(html,text,delta);
|
const charactersLength = characters.length;
|
||||||
}
|
for (let i = 0; i < 30; i++) {
|
||||||
})
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||||
return ;
|
|
||||||
//setContents(OBJECT)
|
|
||||||
let emojiStr = this.editorCtx.getContents();
|
|
||||||
let emojiArr = [];
|
|
||||||
emojiStr = emojiStr.replace(/\[([^(\]|\[)]*)\]/g, function(item, index) {
|
|
||||||
emojiArr.unshift(item);
|
|
||||||
});
|
|
||||||
let sendStr ="";
|
|
||||||
if (emojiArr.length > 0) {
|
|
||||||
if (this.sendStr.endsWith(emojiArr[0])) {
|
|
||||||
this.sendStr = this.sendStr.replace(emojiArr[0], "");
|
|
||||||
} else {
|
|
||||||
this.sendStr = this.sendStr.slice(0, this.sendStr.length - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.sendStr = this.sendStr.slice(0, this.sendStr.length - 1);
|
|
||||||
}
|
}
|
||||||
this.editorCtx.setContents({
|
return Date.now() + result;
|
||||||
html:sendStr
|
|
||||||
})
|
|
||||||
console.log('delete')
|
|
||||||
},
|
|
||||||
editorInput(e) {
|
|
||||||
let str = e.detail.html;
|
|
||||||
const oldArr = (this.lastStr ?? '').split("");
|
|
||||||
let contentStr = str;
|
|
||||||
oldArr.forEach((str) => {
|
|
||||||
contentStr = contentStr.replace(str, "");
|
|
||||||
});
|
|
||||||
contentStr = html2Text(contentStr);
|
|
||||||
this.$emit("input", e);
|
|
||||||
this.lastStr = e.detail.html;
|
|
||||||
},
|
},
|
||||||
|
// 开始拖拽地图
|
||||||
|
UserEvent(data) {
|
||||||
|
//console.log(data);
|
||||||
|
this.$emit('onUserEvent',data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script module="editorModule" lang="renderjs">
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
_editorIns:null
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
mounted() {
|
||||||
|
this._initEditor();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
_initEditor() {
|
||||||
|
if (typeof window.wangEditor === 'function') {
|
||||||
|
this._initialize();
|
||||||
|
} else {
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.onload = this._initialize;
|
||||||
|
script.src = "static/wangeditor/index.js";
|
||||||
|
document.head.appendChild(script);
|
||||||
|
|
||||||
|
const link = document.createElement('link');
|
||||||
|
link.href = "static/wangeditor/style.css";
|
||||||
|
link.rel = "stylesheet";
|
||||||
|
document.head.appendChild(link);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 创建地图
|
||||||
|
_initialize() {
|
||||||
|
const _this = this;
|
||||||
|
// 创建地图实例
|
||||||
|
const {createEditor} = window.wangEditor
|
||||||
|
|
||||||
|
const editor = createEditor({
|
||||||
|
selector: '#editor-container',
|
||||||
|
html: '',
|
||||||
|
config: {
|
||||||
|
placeholder: '',
|
||||||
|
maxLength:100,
|
||||||
|
hoverbarKeys:{
|
||||||
|
divider: {menuKeys: [],},
|
||||||
|
link: {menuKeys: [],},
|
||||||
|
image: {menuKeys: [],},
|
||||||
|
pre: {menuKeys: [],},
|
||||||
|
table: {menuKeys: [],},
|
||||||
|
text: {menuKeys: [],},
|
||||||
|
video: {menuKeys: [],},
|
||||||
|
},
|
||||||
|
onCreated(){
|
||||||
|
_this.$ownerInstance.callMethod('UserEvent',{
|
||||||
|
type:'ready'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//onDestroyed(){},
|
||||||
|
onFocus(){
|
||||||
|
_this.$ownerInstance.callMethod('UserEvent',{
|
||||||
|
type:'focus'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onBlur(){
|
||||||
|
_this.$ownerInstance.callMethod('UserEvent',{
|
||||||
|
type:'blur'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//onDestroyed(){},
|
||||||
|
onChange(editor) {
|
||||||
|
const html = editor.getHtml()
|
||||||
|
const text = editor.getText()
|
||||||
|
//console.log('editor content', html)
|
||||||
|
// 也可以同步到 <textarea>
|
||||||
|
_this.$ownerInstance.callMethod('UserEvent',{
|
||||||
|
type:'onChange',
|
||||||
|
html,
|
||||||
|
text,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
editor.on('atevent',()=>{
|
||||||
|
_this.$ownerInstance.callMethod('UserEvent',{
|
||||||
|
type:'atevent'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
this._editorIns = editor;
|
||||||
|
console.log(editor.insertText);
|
||||||
|
this._editorIns.insertText("text");
|
||||||
|
},
|
||||||
|
|
||||||
|
_insertText(text){
|
||||||
|
console.log('_insertText',text);
|
||||||
|
this._editorIns.insertText(text);
|
||||||
|
},
|
||||||
|
_insertNode(node){
|
||||||
|
this._editorIns.insertNode(node);
|
||||||
|
},
|
||||||
|
_insertImgEmoji(src){
|
||||||
|
this._insertNode({
|
||||||
|
type: 'image',
|
||||||
|
style:{width:'30px',height:'30px'},
|
||||||
|
src: src,
|
||||||
|
children: [{text: ''}],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
_insertMention(data){
|
||||||
|
this._insertNode({
|
||||||
|
type: 'mention',
|
||||||
|
username: data.username,
|
||||||
|
userid: data.userid,
|
||||||
|
children: [{
|
||||||
|
text: ''
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
_clear(){
|
||||||
|
this._editorIns.clear();
|
||||||
|
},
|
||||||
|
_delete(){
|
||||||
|
this._editorIns.deleteBackward();
|
||||||
|
},
|
||||||
|
_blur(){
|
||||||
|
this._editorIns.blur();
|
||||||
|
},
|
||||||
|
_focus(){
|
||||||
|
this._editorIns.focus();
|
||||||
|
},
|
||||||
|
_setHtml(html){
|
||||||
|
this._editorIns.setHtml(html);
|
||||||
|
},
|
||||||
|
_getText(){
|
||||||
|
return this._editorIns.getText();
|
||||||
|
},
|
||||||
|
_getHtml(){
|
||||||
|
return this._editorIns.getHtml();
|
||||||
|
},
|
||||||
|
_getSelectionPosition(){
|
||||||
|
return this._editorIns.getSelectionPosition();
|
||||||
|
},
|
||||||
|
_getParentNode(){
|
||||||
|
return this._editorIns.getParentNode();
|
||||||
|
},
|
||||||
|
// 通过监听call来调用渲染层方法
|
||||||
|
call(newValue, oldValue, ownerInstance, instance) {
|
||||||
|
if(!newValue){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this[newValue.name] && typeof this[newValue.name] === "function") {
|
||||||
|
this[newValue.name](newValue.data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.editor_wrap {
|
.custom_editor {
|
||||||
position: relative;
|
::v-deep.w-e-text-container{
|
||||||
}
|
background: transparent;
|
||||||
|
|
||||||
#editor2 {
|
[data-slate-editor]{
|
||||||
background-color: #fff;
|
padding: 0;
|
||||||
min-height: 30px;
|
}
|
||||||
max-height: 120px;
|
p,
|
||||||
height: auto;
|
span{
|
||||||
word-break: break-all;
|
height: 60rpx;
|
||||||
}
|
line-height: 60rpx;
|
||||||
|
}
|
||||||
::v-deep.ql-editor {
|
p{
|
||||||
img {
|
white-space: pre-wrap; /* 保留空格 */
|
||||||
vertical-align: sub !important;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
img{
|
||||||
p {
|
}
|
||||||
padding: 4px;
|
span{
|
||||||
}
|
}
|
||||||
}
|
span[data-w-e-type="mention"]{
|
||||||
|
background-color: #ccc;
|
||||||
.canvas_container {
|
margin-right: 10px;
|
||||||
position: fixed;
|
}
|
||||||
bottom: -99px;
|
|
||||||
z-index: -100;
|
|
||||||
|
|
||||||
&_name {
|
|
||||||
max-width: 480rpx;
|
|
||||||
display: inline-block;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
#atCanvas {
|
|
||||||
height: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.convas_container_name {
|
|
||||||
font-size: 16px !important;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
};
|
};
|
||||||
if (this.voiceCanSend) {
|
if (this.voiceCanSend) {
|
||||||
//console.log("=====上传语音文件,并发送语音信息====");
|
//console.log("=====上传语音文件,并发送语音信息====");
|
||||||
this.$emit('RecodeEvent',{type:"sendVoiceMessage",audio:voiceFile})
|
this.$emit('RecodEvent',{type:"sendVoiceMessage",audio:voiceFile})
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
console.log("=====已经取消发送语音信息====")
|
console.log("=====已经取消发送语音信息====")
|
||||||
|
|||||||
@@ -59,21 +59,22 @@
|
|||||||
this.textValue = e.detail.value;
|
this.textValue = e.detail.value;
|
||||||
// 更新光标位置
|
// 更新光标位置
|
||||||
this.cursorPos = e.detail.cursor || this.textValue.length;
|
this.cursorPos = e.detail.cursor || this.textValue.length;
|
||||||
this.$emit("input", {
|
this.$emit("onUserEvent", {
|
||||||
detail: {
|
"type":"input",
|
||||||
value: this.textValue,
|
text: this.textValue,
|
||||||
text: this.textValue,
|
html: this.textValue // 简单编辑器,HTML 就是文本
|
||||||
html: this.textValue // 简单编辑器,HTML 就是文本
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onFocus(e) {
|
onFocus(e) {
|
||||||
this.$emit("focus", e);
|
this.$emit("onUserEvent",{
|
||||||
|
type:"focus",
|
||||||
|
e
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onBlur(e) {
|
onBlur(e) {
|
||||||
// 保存光标位置
|
// 保存光标位置
|
||||||
this.cursorPos = e.detail.cursor || this.textValue.length;
|
this.cursorPos = e.detail.cursor || this.textValue.length;
|
||||||
this.$emit("blur", e);
|
this.$emit("onUserEvent",{type:"blur", e});
|
||||||
},
|
},
|
||||||
// 插入文本(表情或普通文本)
|
// 插入文本(表情或普通文本)
|
||||||
insertText(text, successFn, errFn) {
|
insertText(text, successFn, errFn) {
|
||||||
@@ -93,12 +94,10 @@
|
|||||||
this.cursorPos = newCursorPos;
|
this.cursorPos = newCursorPos;
|
||||||
|
|
||||||
// 触发 input 事件
|
// 触发 input 事件
|
||||||
this.$emit("input", {
|
this.$emit("onUserEvent", {
|
||||||
detail: {
|
type:"input",
|
||||||
value: newText,
|
html: newText,
|
||||||
text: newText,
|
text: newText,
|
||||||
html: newText
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 使用 $nextTick 确保 DOM 更新后再设置光标
|
// 使用 $nextTick 确保 DOM 更新后再设置光标
|
||||||
@@ -139,12 +138,10 @@
|
|||||||
clear() {
|
clear() {
|
||||||
this.textValue = "";
|
this.textValue = "";
|
||||||
this.cursorPos = 0;
|
this.cursorPos = 0;
|
||||||
this.$emit("input", {
|
this.$emit("onUserEvent", {
|
||||||
detail: {
|
type:"input",
|
||||||
value: "",
|
text: "",
|
||||||
text: "",
|
html: ""
|
||||||
html: ""
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 删除(退格)
|
// 删除(退格)
|
||||||
@@ -180,12 +177,10 @@
|
|||||||
this.cursorPos = currentPos - deletedLength;
|
this.cursorPos = currentPos - deletedLength;
|
||||||
|
|
||||||
// 触发 input 事件
|
// 触发 input 事件
|
||||||
this.$emit("input", {
|
this.$emit("onUserEvent", {
|
||||||
detail: {
|
type:"input",
|
||||||
value: this.textValue,
|
text: this.textValue,
|
||||||
text: this.textValue,
|
html: this.textValue
|
||||||
html: this.textValue
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 使用 $nextTick 确保 DOM 更新后再设置光标
|
// 使用 $nextTick 确保 DOM 更新后再设置光标
|
||||||
@@ -220,12 +215,12 @@
|
|||||||
|
|
||||||
.simple_editor_textarea {
|
.simple_editor_textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 30px;
|
min-height: 60rpx;
|
||||||
max-height: 120px;
|
max-height: 120px;
|
||||||
|
line-height: 60rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
font-size: 14px;
|
font-size: 30rpx;
|
||||||
line-height: 1.5;
|
padding: 0 6rpx;
|
||||||
padding: 4px;
|
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,13 @@
|
|||||||
<image class="action_btn" v-show="inputType == 'keyboard'" @click.prevent="swtichInputType('record')" mode="heightFix" src="@/static/images/chating_footer_audio.png" alt="" srcset="" />
|
<image class="action_btn" v-show="inputType == 'keyboard'" @click.prevent="swtichInputType('record')" mode="heightFix" src="@/static/images/chating_footer_audio.png" alt="" srcset="" />
|
||||||
<image class="action_btn" v-show="inputType == 'record'" @click.prevent="swtichInputType('keyboard')" mode="heightFix" src="@/static/images/chating_footer_audio_recording.png" alt="" srcset="" />
|
<image class="action_btn" v-show="inputType == 'record'" @click.prevent="swtichInputType('keyboard')" mode="heightFix" src="@/static/images/chating_footer_audio_recording.png" alt="" srcset="" />
|
||||||
<view class="input_content">
|
<view class="input_content">
|
||||||
<Recoder v-if="inputType == 'record'" @RecodeEvent="onRecodeEvent"></Recoder>
|
<Recoder v-if="inputType == 'record'" @RecodEvent="onRecodEvent"></Recoder>
|
||||||
<SimpleEditor
|
<SimpleEditor
|
||||||
v-if="inputType == 'keyboard'"
|
v-if="inputType == 'keyboard'"
|
||||||
class="custom_editor"
|
class="custom_editor"
|
||||||
ref="customEditor"
|
ref="customEditor"
|
||||||
:value="inputHtml"
|
@onUserEvent="onEditorEvent"
|
||||||
@focus="editorFocus"
|
:value="inputHtml"/>
|
||||||
@blur="editorBlur"
|
|
||||||
@input="editorInput" />
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="footer_action_area" v-show="inputType == 'keyboard'">
|
<view class="footer_action_area" v-show="inputType == 'keyboard'">
|
||||||
@@ -53,6 +51,7 @@
|
|||||||
import {offlinePushInfo} from "@/util/imCommon";
|
import {offlinePushInfo} from "@/util/imCommon";
|
||||||
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
|
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
|
||||||
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
|
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
|
||||||
|
import CustomEditor from "./CustomEditor";
|
||||||
import SimpleEditor from "./SimpleEditor";
|
import SimpleEditor from "./SimpleEditor";
|
||||||
import ChatingActionBar from "./ChatingActionBar";
|
import ChatingActionBar from "./ChatingActionBar";
|
||||||
import Recoder from "./Recoder";
|
import Recoder from "./Recoder";
|
||||||
@@ -74,7 +73,7 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
SimpleEditor,
|
CustomEditor,SimpleEditor,
|
||||||
ChatingActionBar,
|
ChatingActionBar,
|
||||||
Recoder,
|
Recoder,
|
||||||
},
|
},
|
||||||
@@ -87,7 +86,7 @@
|
|||||||
voiceIconText : "正在录音...",
|
voiceIconText : "正在录音...",
|
||||||
inputType:"keyboard",
|
inputType:"keyboard",
|
||||||
isEmoji:false,
|
isEmoji:false,
|
||||||
inputHtml: '<span>@cansnow</span><span>@baidu</span><span>@jingds</span>',
|
inputHtml: '',
|
||||||
actionBarVisible: false,
|
actionBarVisible: false,
|
||||||
isInputFocus: false,
|
isInputFocus: false,
|
||||||
actionSheetMenu: [],
|
actionSheetMenu: [],
|
||||||
@@ -102,6 +101,7 @@
|
|||||||
"storeCurrentConversation",
|
"storeCurrentConversation",
|
||||||
"storeCurrentGroup",
|
"storeCurrentGroup",
|
||||||
"storeBlackList",
|
"storeBlackList",
|
||||||
|
"storeCurrentUserID"
|
||||||
]),
|
]),
|
||||||
hasContent() {
|
hasContent() {
|
||||||
return html2Text(this.inputHtml) !== "";
|
return html2Text(this.inputHtml) !== "";
|
||||||
@@ -212,17 +212,7 @@
|
|||||||
this.isEmoji = false;
|
this.isEmoji = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
editorFocus() {
|
|
||||||
this.isInputFocus = true;
|
|
||||||
this.$emit("scrollToBottom");
|
|
||||||
},
|
|
||||||
editorBlur() {
|
|
||||||
this.isInputFocus = false;
|
|
||||||
},
|
|
||||||
editorInput(e) {
|
|
||||||
// SimpleEditor 返回的是纯文本,直接使用
|
|
||||||
this.inputHtml = e.detail.value || e.detail.text || e.detail.html || "";
|
|
||||||
},
|
|
||||||
async sendLocationMessage(res){
|
async sendLocationMessage(res){
|
||||||
console.log(res);
|
console.log(res);
|
||||||
const _this = this;
|
const _this = this;
|
||||||
@@ -318,8 +308,45 @@
|
|||||||
disposeKeyboardListener() {
|
disposeKeyboardListener() {
|
||||||
uni.offKeyboardHeightChange(this.keyboardChangeHander);
|
uni.offKeyboardHeightChange(this.keyboardChangeHander);
|
||||||
},
|
},
|
||||||
|
onEditorEvent(e){
|
||||||
onRecodeEvent(e){
|
const _this = this;
|
||||||
|
if(e.type=="atevent" && this.storeCurrentConversation.groupID){
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/common/contactChoose/chooseGroupMember?groupID=${this.storeCurrentConversation.groupID}&checkedUserIDList=[]&hideUserIDList=[${this.storeCurrentUserID}]`,
|
||||||
|
events: {
|
||||||
|
onSelectedConfirm(userList) {
|
||||||
|
userList.forEach((user)=>{
|
||||||
|
_this.$refs.customEditor.insertMention(user.remark || user.nickname || user.showName,user.userID);
|
||||||
|
_this.$refs.customEditor.focus();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if(e.type=="ready"){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if(e.type=="focus"){
|
||||||
|
this.isInputFocus = true;
|
||||||
|
this.$emit("scrollToBottom");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if(e.type=="blur"){
|
||||||
|
this.isInputFocus = false;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if(e.type=="onChange"){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if(e.type=="input"){
|
||||||
|
// SimpleEditor 返回的是纯文本,直接使用
|
||||||
|
this.inputHtml = e.html || e.text || "";
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
console.log(e);
|
||||||
|
},
|
||||||
|
onRecodEvent(e){
|
||||||
const _this = this;
|
const _this = this;
|
||||||
switch(e.type){
|
switch(e.type){
|
||||||
case "voiceIconTextChange":
|
case "voiceIconTextChange":
|
||||||
@@ -366,13 +393,13 @@
|
|||||||
|
|
||||||
// 直接插入文本,不等待 nextTick,减少延迟
|
// 直接插入文本,不等待 nextTick,减少延迟
|
||||||
this.$refs.customEditor.insertText(e.emoji,() =>{
|
this.$refs.customEditor.insertText(e.emoji,() =>{
|
||||||
console.log("插入文字成功");
|
//console.log("插入文字成功");
|
||||||
// 延迟重置标志,确保其他事件不会隐藏表情栏
|
// 延迟重置标志,确保其他事件不会隐藏表情栏
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.isInsertingEmoji = false;
|
this.isInsertingEmoji = false;
|
||||||
}, 300);
|
}, 300);
|
||||||
},(err) => {
|
},(err) => {
|
||||||
console.log("插入文字失败", err);
|
//console.log("插入文字失败", err);
|
||||||
this.isInsertingEmoji = false;
|
this.isInsertingEmoji = false;
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -450,9 +477,8 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.custom_editor {
|
.custom_editor {
|
||||||
img {
|
min-height: 60rpx;
|
||||||
vertical-align: sub;
|
max-height: 240rpx;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.forbidden_footer {
|
.forbidden_footer {
|
||||||
@@ -473,13 +499,11 @@
|
|||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
// height: 50px;
|
// height: 50px;
|
||||||
max-height: 120px;
|
max-height: 120px;
|
||||||
padding: 0 20rpx;
|
padding: 10rpx 20rpx;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
|
|
||||||
.input_content {
|
.input_content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 80rpx;
|
|
||||||
max-height: 240rpx;
|
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
@@ -492,26 +516,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.quote_message {
|
|
||||||
@include vCenterBox();
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 12rpx;
|
|
||||||
padding: 8rpx;
|
|
||||||
// padding-top: 20rpx;
|
|
||||||
border-radius: 6rpx;
|
|
||||||
background-color: #fff;
|
|
||||||
color: #666;
|
|
||||||
|
|
||||||
.content {
|
|
||||||
::v-deep uni-view {
|
|
||||||
@include ellipsisWithLine(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.action_btn{
|
.action_btn{
|
||||||
width: 26px;
|
width: 50rpx;
|
||||||
height: 26px;
|
height: 50rpx;
|
||||||
margin: 24rpx auto;
|
margin-bottom: 6rpx;
|
||||||
}
|
}
|
||||||
.footer_action_area {
|
.footer_action_area {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -520,8 +528,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.send_btn {
|
.send_btn {
|
||||||
height: 30px;
|
height: 50rpx;
|
||||||
line-height: 30px;
|
line-height: 50rpx;
|
||||||
background-color: $uni-color-success;
|
background-color: $uni-color-success;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|||||||
@@ -72,7 +72,6 @@
|
|||||||
const imageWidth = res.width;
|
const imageWidth = res.width;
|
||||||
const aspectRatio = imageHeight / imageWidth;
|
const aspectRatio = imageHeight / imageWidth;
|
||||||
_this.maxHeight = (_this.selfWidth * aspectRatio);
|
_this.maxHeight = (_this.selfWidth * aspectRatio);
|
||||||
console.log(res)
|
|
||||||
_this.src = src;
|
_this.src = src;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -91,7 +90,7 @@
|
|||||||
util.cacheFile(snapshotUrl,coverCachePath,(fn)=>{
|
util.cacheFile(snapshotUrl,coverCachePath,(fn)=>{
|
||||||
self.coverDownloading = false;
|
self.coverDownloading = false;
|
||||||
self.getImageInfo(fn);
|
self.getImageInfo(fn);
|
||||||
console.log(fn);
|
//console.log(fn);
|
||||||
},(e)=>{
|
},(e)=>{
|
||||||
console.log(e);
|
console.log(e);
|
||||||
},(e)=>{
|
},(e)=>{
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
conversationID:String,
|
conversationID:String,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
console.log(this.message);
|
|
||||||
return {
|
return {
|
||||||
src:"",
|
src:"",
|
||||||
};
|
};
|
||||||
@@ -45,7 +44,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async init(){
|
async init(){
|
||||||
console.log(this.message);
|
//console.log(this.message);
|
||||||
const self = this;
|
const self = this;
|
||||||
let audio = this.message.soundElem;
|
let audio = this.message.soundElem;
|
||||||
//soundPath
|
//soundPath
|
||||||
@@ -57,7 +56,7 @@
|
|||||||
if (typeof plus === 'undefined' || !cachePath) return;
|
if (typeof plus === 'undefined' || !cachePath) return;
|
||||||
util.cacheFile(snapshotUrl,cachePath,(fn)=>{
|
util.cacheFile(snapshotUrl,cachePath,(fn)=>{
|
||||||
self.src = fn;
|
self.src = fn;
|
||||||
console.log(fn);
|
//console.log(fn);
|
||||||
},(e)=>{
|
},(e)=>{
|
||||||
console.log(e);
|
console.log(e);
|
||||||
},(e)=>{
|
},(e)=>{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
//console.log("onload");
|
//console.log("onload",this.storeCurrentConversation);
|
||||||
this.setPageListener();
|
this.setPageListener();
|
||||||
if (options?.back2Tab) {
|
if (options?.back2Tab) {
|
||||||
this.back2Tab = JSON.parse(options.back2Tab);
|
this.back2Tab = JSON.parse(options.back2Tab);
|
||||||
@@ -102,6 +102,7 @@
|
|||||||
if (this.Audio) {
|
if (this.Audio) {
|
||||||
this.Audio.stop();
|
this.Audio.stop();
|
||||||
this.Audio.destroy();
|
this.Audio.destroy();
|
||||||
|
this.Audio = null;
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(["storeConversationList", "storeIsSyncing", "storeProgress"]),
|
...mapGetters(["storeConversationList", "storeIsSyncing", "storeProgress",'storeCurrentUserID']),
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
@@ -72,19 +72,13 @@
|
|||||||
this._freshing = false;
|
this._freshing = false;
|
||||||
this.triggered = true;
|
this.triggered = true;
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
// uni.navigateTo({
|
|
||||||
// //url:'/pages/workbench/friend-circle/friend-circle',
|
|
||||||
// url:'/pages/common/map',
|
|
||||||
// events: {
|
|
||||||
// onConfirm(res) {
|
|
||||||
// console.log(res);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// uni.switchTab({
|
// uni.switchTab({
|
||||||
// url:"/pages/profile/index/index"
|
// url:"/pages/user/index/index"
|
||||||
// })
|
// })
|
||||||
prepareConversationState(this.storeConversationList[1]);
|
uni.navigateTo({
|
||||||
|
url:"/pages/user/vip/vip"
|
||||||
|
});
|
||||||
|
//prepareConversationState(this.storeConversationList[2]);
|
||||||
},1000)
|
},1000)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -26,19 +26,6 @@
|
|||||||
<uni-list-item title="附近" thumb="/static/images/workbench/08.png" :thumbSize="thumbSize" to="/pages/workbench/near/near" showArrow></uni-list-item>
|
<uni-list-item title="附近" thumb="/static/images/workbench/08.png" :thumbSize="thumbSize" to="/pages/workbench/near/near" showArrow></uni-list-item>
|
||||||
<uni-list-item title="购物" thumb="/static/images/workbench/09.png" :thumbSize="thumbSize" to="/pages/workbench/friend-circle/friend-circle" showArrow></uni-list-item>
|
<uni-list-item title="购物" thumb="/static/images/workbench/09.png" :thumbSize="thumbSize" to="/pages/workbench/friend-circle/friend-circle" showArrow></uni-list-item>
|
||||||
</uni-list>
|
</uni-list>
|
||||||
<u-cell-group :customStyle="{backgroundColor:'#FFF'}">
|
|
||||||
<u-cell
|
|
||||||
title="扫一扫"
|
|
||||||
icon="/static/images/workbench/03.png" :size="cellSize"
|
|
||||||
isLink
|
|
||||||
@click="scan"
|
|
||||||
></u-cell>
|
|
||||||
<u-cell title="摇一摇" icon="/static/images/workbench/05.png" :size="cellSize" url="/pages/workbench/friend-circle/friend-circle" isLink></u-cell>
|
|
||||||
<u-cell title="看一看" icon="/static/images/workbench/06.png" :size="cellSize" url="/pages/workbench/friend-circle/friend-circle" isLink></u-cell>
|
|
||||||
<u-cell title="听一听" icon="/static/images/workbench/06.png" :size="cellSize" url="/pages/workbench/friend-circle/friend-circle" isLink></u-cell>
|
|
||||||
<u-cell title="附近" icon="/static/images/workbench/08.png" :size="cellSize" url="/pages/workbench/near/near" isLink></u-cell>
|
|
||||||
<u-cell title="购物" icon="/static/images/workbench/09.png" :size="cellSize" url="/pages/workbench/friend-circle/friend-circle" isLink></u-cell>
|
|
||||||
</u-cell-group>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -46,8 +33,7 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
thumbSize:"base",
|
thumbSize:"base"
|
||||||
cellSize:"large"
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
@@ -27,7 +27,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
toBlockList() {
|
toBlockList() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/profile/blockList/index",
|
url: "/pages/user/blockList/index",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -20,10 +20,23 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- v-if="userinfo.role_id==2" -->
|
||||||
|
<view class="vipbar" @click="goto('/pages/user/vip/vip')">
|
||||||
|
<img src="/static/images/user/member_crown.png" alt="" />
|
||||||
|
<text>会员到期时间:{{userinfo.expire_at}}</text>
|
||||||
|
<u-button>我的权益</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="vipbar" @click="goto('/pages/user/vip/vip')">
|
||||||
|
<img src="/static/images/user/member_crown.png" alt="" />
|
||||||
|
<text>开通会员立享特权</text>
|
||||||
|
<u-button>开通</u-button>
|
||||||
|
</view>
|
||||||
|
<u-alert title="我的信息" type = "warning" :closable="closable" :description = "description"></u-alert>
|
||||||
|
|
||||||
<uni-list style="margin: 20rpx auto;width: 100%;">
|
<uni-list style="margin: 20rpx auto;width: 100%;">
|
||||||
<uni-list-item title="我的信息" thumb="/static/images/profile_menu_info.png" to="/pages/profile/selfInfo/index" clickable showArrow ></uni-list-item>
|
<uni-list-item title="我的信息" thumb="/static/images/profile_menu_info.png" to="/pages/user/selfInfo/index" clickable showArrow ></uni-list-item>
|
||||||
<uni-list-item title="账号设置" thumb="/static/images/profile_menu_account.png" to="/pages/profile/messageNotification/index" clickable showArrow ></uni-list-item>
|
<uni-list-item title="账号设置" thumb="/static/images/profile_menu_account.png" to="/pages/user/messageNotification/index" clickable showArrow ></uni-list-item>
|
||||||
<uni-list-item title="关于我们" thumb="/static/images/profile_menu_about.png" to="/pages/profile/accountSetting/index" clickable showArrow ></uni-list-item>
|
<uni-list-item title="关于我们" thumb="/static/images/profile_menu_about.png" to="/pages/user/accountSetting/index" clickable showArrow ></uni-list-item>
|
||||||
</uni-list>
|
</uni-list>
|
||||||
<uni-list>
|
<uni-list>
|
||||||
<uni-list-item title="退出登录" thumb="/static/images/profile_menu_logout.png" @click="logout" clickable showArrow ></uni-list-item>
|
<uni-list-item title="退出登录" thumb="/static/images/profile_menu_logout.png" @click="logout" clickable showArrow ></uni-list-item>
|
||||||
@@ -83,7 +96,7 @@
|
|||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
uni.$u.route("/pages/login/index");
|
uni.$u.route("/pages/common/login/index");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -114,6 +127,11 @@
|
|||||||
@import '@/uni_modules/uni-scss/index.scss';
|
@import '@/uni_modules/uni-scss/index.scss';
|
||||||
.user_page {
|
.user_page {
|
||||||
background-color: #ececec;
|
background-color: #ececec;
|
||||||
|
.vipbar{
|
||||||
|
background: #0c1c33;
|
||||||
|
color: #FFF;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.self_info_row {
|
.self_info_row {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -75,9 +75,7 @@
|
|||||||
...util,
|
...util,
|
||||||
updateNickname() {
|
updateNickname() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/common/markOrIDPage/index?isSelfNickname=true&sourceInfo=${JSON.stringify(
|
url: `/pages/common/markOrIDPage/index?isSelfNickname=true&sourceInfo=${JSON.stringify(this.selfInfo)}`,
|
||||||
this.selfInfo,
|
|
||||||
)}`,
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateGender() {
|
updateGender() {
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<u-popup ref="popup" :closeOnClickOverlay="closeOnClickOverlay" mode="center" bgColor="none">
|
||||||
|
<view :class="['n-ps-all-' + padding, 'n-bg-inverse', 'n-radius-base']" :style="customStyle">
|
||||||
|
<view class="n-flex-column n-align-center">
|
||||||
|
<text class="n-weight-7 n-color-text" :style="{fontSize:'34rpx'}">{{title}}</text>
|
||||||
|
<text class="n-size-ss n-ms-top-s n-color-third" v-if="label">{{label}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="n-flex-column n-align-center n-ms-bottom-ll" v-if="content">
|
||||||
|
<text class="n-size-base n-ms-top-ll n-color-second">{{content}}</text>
|
||||||
|
</view>
|
||||||
|
<u-form class="n-ms-top-l" v-else labelWidth="40rpx" labelPosition="left">
|
||||||
|
<u-form-item :class="['n-radius-' + inputRadius, 'n-bg-page', 'n-ps-base', 'n-ms-bottom-base']">
|
||||||
|
<u-input v-model="input" :type="inputType" :focus="true" :maxlength="maxlength" :placeholder="place" border="none" clearable>
|
||||||
|
<template v-slot:suffix>
|
||||||
|
<text class="n-size-ss n-color-error" v-if="captcha" @click="sendSms">{{code_text}}</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
<u-button class="n-ms-top-base" @click="submit" :text="buttonText" :color="buttonColor" type="error" shape="circle" throttleTime="1000"></u-button>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<!-- 验证码 -->
|
||||||
|
<u-code ref="code" @change="changeCode" :seconds="seconds" :uniqueKey="captchaType" endText="获取验证码"></u-code>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name:"m-popup",
|
||||||
|
props: {
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '提示'
|
||||||
|
},
|
||||||
|
place: {
|
||||||
|
type: String,
|
||||||
|
default: '请输入内容'
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
captcha: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
padding: {
|
||||||
|
type: String,
|
||||||
|
default: 'base'
|
||||||
|
},
|
||||||
|
redirect: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
maxlength: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: 10
|
||||||
|
},
|
||||||
|
inputType: {
|
||||||
|
type: String,
|
||||||
|
default: 'text'
|
||||||
|
},
|
||||||
|
buttonText: {
|
||||||
|
type: String,
|
||||||
|
default: '立即提交'
|
||||||
|
},
|
||||||
|
captchaType: {
|
||||||
|
type: String,
|
||||||
|
default: 'notice'
|
||||||
|
},
|
||||||
|
inputRadius: {
|
||||||
|
type: String,
|
||||||
|
default: 'll'
|
||||||
|
},
|
||||||
|
buttonColor: {
|
||||||
|
type: String,
|
||||||
|
default: '#fc3463'
|
||||||
|
},
|
||||||
|
customStyle: {
|
||||||
|
type: Object,
|
||||||
|
default(){
|
||||||
|
return {width:'600rpx',marginBottom:'200rpx'}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
closeOnClickOverlay: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
input: '',
|
||||||
|
seconds: 60,
|
||||||
|
code_text: '获取验证码'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 展示弹窗
|
||||||
|
open() {
|
||||||
|
// 发送验证码
|
||||||
|
if(this.captcha){
|
||||||
|
this.sendSms()
|
||||||
|
}
|
||||||
|
this.$refs['popup'].open()
|
||||||
|
},
|
||||||
|
// 关闭弹窗
|
||||||
|
close() {
|
||||||
|
uni.hideKeyboard()
|
||||||
|
this.$refs['popup'].close()
|
||||||
|
},
|
||||||
|
// 提交数据
|
||||||
|
submit() {
|
||||||
|
// 跳转链接
|
||||||
|
if(this.redirect) {
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:this.redirect
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 输入提示
|
||||||
|
if(!this.input) return showToast(this.place)
|
||||||
|
|
||||||
|
this.$emit('submit', this.input)
|
||||||
|
|
||||||
|
this.close()
|
||||||
|
this.input = ''
|
||||||
|
},
|
||||||
|
// 获取验证码
|
||||||
|
sendSms() {
|
||||||
|
if(this.$refs['code'].canGetCode){
|
||||||
|
let userinfo = getApp().globalData.userinfo
|
||||||
|
sendSms({type:this.captchaType, mobile:userinfo.mobile}).then(res=>{
|
||||||
|
this.$refs['code'].start()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 验证码变化
|
||||||
|
changeCode(evt) {
|
||||||
|
this.code_text = evt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<uni-nav-bar
|
||||||
|
left-icon="back"
|
||||||
|
title="我的会员"
|
||||||
|
@clickLeft="goto(1)"
|
||||||
|
>
|
||||||
|
</uni-nav-bar>
|
||||||
|
<view class="m-navbg"></view>
|
||||||
|
<view class="m-card n-ms-base n-ps-all-ll n-radius-base n-position-relative">
|
||||||
|
<view class="n-flex-row n-align-center">
|
||||||
|
<image class="m-avatar" :src="userinfo.avatar"></image>
|
||||||
|
<view class="n-ms-left-base">
|
||||||
|
<text class="m-card-text n-size-l n-weight-7">{{userinfo.nickname}}</text>
|
||||||
|
<text class="m-card-text n-size-ss n-weight-7 n-ms-top-ss">{{userinfo.username}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<text class="m-card-text n-size-s" :style="{marginTop:'50rpx'}">会员到期时间:{{userinfo.role_id==2 ? userinfo.expire_at:'未开通'}}</text>
|
||||||
|
<image class="m-card-crown n-position-absolute" src="/static/images/user/member_crown.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="n-ps-base n-ms-top-ll">
|
||||||
|
<text class="n-size-l n-weight-7">会员权益</text>
|
||||||
|
<view class="n-flex-row n-wrap-wrap n-ms-top-ss">
|
||||||
|
<u-cell-group>
|
||||||
|
<u-cell :class="[idx%2==0 ? 'n-ms-right-s':'', 'n-bg-page', 'n-radius-s', 'n-ms-top-s', 'n-ps-tb-ss']"
|
||||||
|
v-for="(item, idx) in powerList" :key="idx"
|
||||||
|
:icon="item.image_text"
|
||||||
|
:title="item.title"
|
||||||
|
:label="item.content"
|
||||||
|
:border="false"
|
||||||
|
:iconStyle="{width:'80rpx',height:'80rpx',borderRadius:'40rpx'}" >
|
||||||
|
</u-cell>
|
||||||
|
</u-cell-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<u-gap></u-gap>
|
||||||
|
<view class="n-ps-base">
|
||||||
|
<text class="n-size-l n-weight-7 n-ms-top-ss">会员套餐</text>
|
||||||
|
<scroll-view class="n-flex-row n-ms-top-ll n-wrap-nowrap" :scroll-x="true" :show-scrollbar="false">
|
||||||
|
<view :class="[idx==current ? 'm-thali-active':'m-thali', 'n-ps-all-ll', 'n-ms-right-l', 'n-flex-column', 'n-radius-base', 'n-align-center', 'n-position-relative']" v-for="(item, idx) in thaliList" :key="idx" @click="current=idx">
|
||||||
|
<text class="n-size-l n-ms-top-s n-weight-7">{{item.title}}</text>
|
||||||
|
<view class="n-flex-row n-align-end n-ms-top-base">
|
||||||
|
<text class="m-card-text n-size-s">¥</text>
|
||||||
|
<text class="m-card-text n-size-ll">{{item.price}}</text>
|
||||||
|
</view>
|
||||||
|
<text class="n-size-ss n-ms-top-ss n-color-forth n-text-decoration-through">¥{{item.orig_price}}</text>
|
||||||
|
<u-tag class="n-ms-bottom-s n-ms-top-base"
|
||||||
|
:text="'立省' + (item.orig_price - item.price) + '元'"
|
||||||
|
size="mini" shape="circle"
|
||||||
|
bgColor="#efcf95"
|
||||||
|
borderColor="#efcf95"></u-tag>
|
||||||
|
<!-- 标签 -->
|
||||||
|
<u-button class="n-position-absolute" v-if="item.label" :text="item.label" :style="{top:0,left:0}" size="mini" color="#fc393f"></u-button>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="n-flex-row n-ms-top-l n-justify-center">
|
||||||
|
<view class="n-flex-row n-wrap-wrap n-align-start n-ms-top-base n-align-center">
|
||||||
|
<view>
|
||||||
|
<u-checkbox-group activeColor="#efcf95" shape="circle">
|
||||||
|
<u-checkbox name="1" size="17" @change="change"></u-checkbox>
|
||||||
|
</u-checkbox-group>
|
||||||
|
</view>
|
||||||
|
<text class="n-size-ss n-lh-base n-color-third">已阅读并同意</text>
|
||||||
|
<text class="n-size-ss n-lh-base n-color-link" v-for="(item, idx) in contractList" :key="idx"
|
||||||
|
@click="goto(item.router)" :style="{color:'#8e6927'}">《{{item.title}}》</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="n-flex-row">
|
||||||
|
<u-button class="n-flex-1 n-ms-top-base n-ms-right-base" v-if="config.member_link" @click="goto('/pages/common/webview' + queryParams({src:config.member_link,title:'购买激活码'}))" text="购买激活码" shape="circle" color="#fdc384" throttleTime="1000" plain></u-button>
|
||||||
|
<u-button class="n-flex-1 n-ms-top-base" @click="showPopup" text="兑换会员" shape="circle" color="linear-gradient(to right, #fee1b7, #fdc384)" throttleTime="1000"></u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 兑换会员弹窗 -->
|
||||||
|
<MPopup ref="popup" @submit="submit" title="兑换会员" place="请输入激活码" padding="l" buttonText="立即兑换" buttonColor="#fdc384"></MPopup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MPopup from "./m-popup";
|
||||||
|
import util from "@/util/index.js"
|
||||||
|
export default {
|
||||||
|
components:{MPopup},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
current: 0,
|
||||||
|
userinfo: {},
|
||||||
|
thaliList: [],
|
||||||
|
powerList: [],
|
||||||
|
contractList: [],
|
||||||
|
contractValue: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
selfInfo() {
|
||||||
|
return this.$store.getters.storeSelfInfo;
|
||||||
|
},
|
||||||
|
config() {
|
||||||
|
return this.$store.getters.config;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
// 获取用户信息
|
||||||
|
this.getUserinfo()
|
||||||
|
// 获取会员套餐
|
||||||
|
this.getMemberThali()
|
||||||
|
// 获取会员权益
|
||||||
|
this.getMemberPower()
|
||||||
|
this.contractList = [
|
||||||
|
{title:'用户协议', router:'/pages/common/webview' + this.queryParams({src:'contract', title:'用户协议'})},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
goto:util.goto,
|
||||||
|
queryParams(){
|
||||||
|
return "1";
|
||||||
|
},
|
||||||
|
// 数据提交
|
||||||
|
submit(code) {
|
||||||
|
return 1;
|
||||||
|
memberExchange({code:code}, {custom:{auth:true}}).then(res=>{
|
||||||
|
// 更新用户信息
|
||||||
|
this.getUserinfo(true)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 展示弹窗
|
||||||
|
showPopup() {
|
||||||
|
if(!this.contractValue){
|
||||||
|
return showToast('请阅读并同意用户协议')
|
||||||
|
}
|
||||||
|
this.$refs['popup'].open()
|
||||||
|
},
|
||||||
|
// 获取用户信息
|
||||||
|
async getUserinfo(refresh) {
|
||||||
|
await this.$store.dispatch("user/updateBusinessInfo");
|
||||||
|
},
|
||||||
|
// 获取会员套餐
|
||||||
|
getMemberThali() {
|
||||||
|
return 1;
|
||||||
|
uni.$u.http.post('/friendcircle/create',param).then(res => {
|
||||||
|
});
|
||||||
|
getMemberThali((res)=>{ this.thaliList = res })
|
||||||
|
},
|
||||||
|
// 获取会员套餐
|
||||||
|
getMemberPower() {
|
||||||
|
return 1;
|
||||||
|
getMemberPower((res)=>{ this.powerList = res })
|
||||||
|
},
|
||||||
|
change(e){
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onPullDownRefresh() {
|
||||||
|
// 获取用户信息
|
||||||
|
this.getUserinfo()
|
||||||
|
// 获取会员套餐
|
||||||
|
this.getMemberThali()
|
||||||
|
// 获取会员权益
|
||||||
|
this.getMemberPower()
|
||||||
|
// 获取系统配置
|
||||||
|
this.config = getApp().globalData.config
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.m-card{
|
||||||
|
margin-top: -160rpx;
|
||||||
|
background-image: linear-gradient(to right, #feebc6, #efcf95);
|
||||||
|
&-text{
|
||||||
|
color: #8e6927;
|
||||||
|
}
|
||||||
|
&-crown{
|
||||||
|
right: 10rpx;
|
||||||
|
width: 220rpx;
|
||||||
|
bottom: 10rpx;
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.m-thali{
|
||||||
|
border: 1px solid #f1f1f1;
|
||||||
|
&-active{
|
||||||
|
background-color: #fef8ec;
|
||||||
|
border: 1px solid #f4c38b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.m-navbg{
|
||||||
|
height: 200rpx;
|
||||||
|
background-color: #282623;
|
||||||
|
}
|
||||||
|
.m-avatar{
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 60rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
@@ -0,0 +1,12 @@
|
|||||||
|
module.exports = {
|
||||||
|
configureWebpack: {
|
||||||
|
// 开启缓存
|
||||||
|
cache: true,
|
||||||
|
// 并行构建
|
||||||
|
parallel: require('os').cpus().length > 1,
|
||||||
|
// 关闭sourcemap加速生产构建
|
||||||
|
productionSourceMap: false
|
||||||
|
},
|
||||||
|
// 关闭文件hash (开发环境)
|
||||||
|
filenameHashing: process.env.NODE_ENV !== 'production'
|
||||||
|
}
|
||||||