6
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://openim.io">
|
<a href="https://openim.io">
|
||||||
<img src="./docs/images/logo.jpg" width="60%" height="30%"/>
|
<img n1e5a6s6m7 src="./docs/images/logo.jpg" width="60%" height="30%"/>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -228,3 +228,21 @@ OpenIM 为开发者提供开源即时通讯 SDK,作为 Twilio、Sendbird 等
|
|||||||
|
|
||||||
4. 如何使用离线推送?
|
4. 如何使用离线推送?
|
||||||
答: [参考文档](CONFIGKEY.md)
|
答: [参考文档](CONFIGKEY.md)
|
||||||
|
|
||||||
|
## WeUI 风格样式覆盖(新增)
|
||||||
|
|
||||||
|
为了让 `uni-ui` / `uView` 的组件样式更接近 WeChat / WeUI 风格,项目中新增了一个覆盖样式文件:
|
||||||
|
|
||||||
|
- `styles/weui-overrides.scss`:放置了一组全局覆盖规则(主要调整按钮、列表、导航栏、输入框、标签等)。
|
||||||
|
|
||||||
|
如何启用/禁用:
|
||||||
|
|
||||||
|
- 本覆盖样式已在 `uni.scss` 中通过 `@import "@/styles/weui-overrides.scss";` 引入,默认启用。
|
||||||
|
- 若要还原原样,只需从 `uni.scss` 中移除或注释该 import 行,然后重新编译项目。
|
||||||
|
|
||||||
|
如何微调:
|
||||||
|
|
||||||
|
- 直接修改 `styles/weui-overrides.scss` 中的规则或颜色变量(顶部使用 `--weui-primary`),保存后重新编译即可生效。
|
||||||
|
|
||||||
|
后续建议:如果你希望更深入地定制(例如把主题色变量传递到 uView 的主题编译阶段),我可以帮你把变量提前并修改 `@/uni_modules/uview-ui/theme.scss` 的引入顺序,以在编译时替换主题变量。
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const getApiUrl = () => uni.getStorageSync("IMApiUrl") || API_URL;
|
|||||||
const getWsUrl = () => uni.getStorageSync("IMWsUrl") || WS_URL;
|
const getWsUrl = () => uni.getStorageSync("IMWsUrl") || WS_URL;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
cdnUrl:BASE_DOMAIN,
|
||||||
version,
|
version,
|
||||||
getRegisterUrl,
|
getRegisterUrl,
|
||||||
getApiUrl,
|
getApiUrl,
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import util from "@/util";
|
||||||
|
import {mapState,mapMutations} from 'vuex';
|
||||||
|
const appinfo = uni.getAppBaseInfo();
|
||||||
|
export default {
|
||||||
|
name: 'Base',
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
appinfo:appinfo,
|
||||||
|
userInfo :this.$store.getters.storeSelfInfo,
|
||||||
|
isDebug : process.env.NODE_ENV == 'development',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// computed: {
|
||||||
|
// ...mapState(['storeSelfInfo']),
|
||||||
|
// ...mapState(['config'])
|
||||||
|
// },
|
||||||
|
methods:util,
|
||||||
|
filters:{
|
||||||
|
toDate:util.toDate,
|
||||||
|
cdn:util.cdn,
|
||||||
|
formatAmount:util.formatAmount
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Base from '@/components/Base.vue'
|
||||||
|
export default {
|
||||||
|
name: 'User',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mixins: [Base],
|
||||||
|
created() {
|
||||||
|
const token = uni.getStorageSync('IMToken');
|
||||||
|
if (!token) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/login/index"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {},
|
||||||
|
methods: {}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" >
|
||||||
|
//@import '@/style/mixin.scss';
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,56 @@
|
|||||||
|
<template>
|
||||||
|
<view class="uni-searchbar">
|
||||||
|
<view class="uni-searchbar__box" style="border-radius: 5px; background-color: rgb(255, 255, 255);">
|
||||||
|
<view class="uni-searchbar__box-icon-search">
|
||||||
|
<uni-icons type="search" size="18" color="rgb(192, 196, 204)"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<text class="uni-searchbar__text-placeholder"><slot></slot></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name:"searchbar",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.uni-searchbar{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
position: relative;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.uni-searchbar__box{
|
||||||
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
height: 36px;
|
||||||
|
padding: 5px 8px 5px 0px;
|
||||||
|
}
|
||||||
|
.uni-searchbar__box-icon-search{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
color: #B3B3B3;
|
||||||
|
}
|
||||||
|
.uni-searchbar__text-placeholder{
|
||||||
|
font-size: 14px;
|
||||||
|
color: #B3B3B3;
|
||||||
|
margin-left: 5px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -6,8 +6,44 @@ import store from "./store";
|
|||||||
|
|
||||||
// 引入全局uView
|
// 引入全局uView
|
||||||
import uView from "@/uni_modules/uview-ui";
|
import uView from "@/uni_modules/uview-ui";
|
||||||
|
//import pagejson from "@/pages.json"
|
||||||
Vue.use(uView);
|
Vue.use(uView);
|
||||||
|
uni.addInterceptor('navigateTo',{
|
||||||
|
invoke(e){
|
||||||
|
// uni.showModal({
|
||||||
|
// content:"aaaaaaaa",
|
||||||
|
// })
|
||||||
|
//const pages = getCurrentPages(); // 获取当前页面栈
|
||||||
|
//const currentPage = pages[pages.length - 1]; // 获取当前页面对象
|
||||||
|
//console.log(currentPage.$page);
|
||||||
|
//return true;
|
||||||
|
},
|
||||||
|
returnValue(e){
|
||||||
|
// uni.showModal({
|
||||||
|
// content:"sss",
|
||||||
|
// })
|
||||||
|
//console.log(JSON.stringify(e))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
uni.$u.setConfig({
|
||||||
|
// 修改$u.config对象的属性
|
||||||
|
config: {
|
||||||
|
// 修改默认单位为rpx,相当于执行 uni.$u.config.unit = 'rpx'
|
||||||
|
//unit: 'rpx'
|
||||||
|
},
|
||||||
|
// 修改$u.props对象的属性
|
||||||
|
props: {
|
||||||
|
// 修改radio组件的size参数的默认值,相当于执行 uni.$u.props.radio.size = 30
|
||||||
|
radio: {
|
||||||
|
size: 15
|
||||||
|
},
|
||||||
|
tabs:{
|
||||||
|
lineColor:'#07c160'
|
||||||
|
}
|
||||||
|
// 其他组件属性配置
|
||||||
|
// ......
|
||||||
|
}
|
||||||
|
})
|
||||||
Vue.prototype.$store = store;
|
Vue.prototype.$store = store;
|
||||||
|
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
|
|||||||
+14
-5
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "探探",
|
"name" : "回声",
|
||||||
"appid" : "__UNI__F0A946D",
|
"appid" : "__UNI__CA458BA",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "3.3.4",
|
"versionName" : "3.3.4",
|
||||||
"versionCode" : 334,
|
"versionCode" : 334,
|
||||||
@@ -51,8 +51,10 @@
|
|||||||
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
|
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
],
|
],
|
||||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
|
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
|
||||||
"minSdkVersion" : 21
|
"minSdkVersion" : 21,
|
||||||
|
"targetSdkVersion" : 26,
|
||||||
|
"schemes" : "huisheng"
|
||||||
},
|
},
|
||||||
"ios" : {
|
"ios" : {
|
||||||
"dSYMs" : false,
|
"dSYMs" : false,
|
||||||
@@ -65,7 +67,14 @@
|
|||||||
"NSLocationAlwaysAndWhenInUseUsageDescription" : "请求获取位置权限",
|
"NSLocationAlwaysAndWhenInUseUsageDescription" : "请求获取位置权限",
|
||||||
"NSLocationAlwaysUsageDescription" : "请求获取位置权限",
|
"NSLocationAlwaysUsageDescription" : "请求获取位置权限",
|
||||||
"NSBluetoothAlwaysUsageDescription" : "请求获取蓝牙权限"
|
"NSBluetoothAlwaysUsageDescription" : "请求获取蓝牙权限"
|
||||||
}
|
},
|
||||||
|
"capabilities" : {
|
||||||
|
"entitlements" : {
|
||||||
|
"com.apple.developer.associated-domains" : [ "huisheng", "applinks:url.huisheng.hk" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idfa" : false,
|
||||||
|
"urltypes" : "huisheng"
|
||||||
},
|
},
|
||||||
"sdkConfigs" : {
|
"sdkConfigs" : {
|
||||||
"ad" : {},
|
"ad" : {},
|
||||||
|
|||||||
+1
-1
@@ -4,9 +4,9 @@
|
|||||||
"date-fns": "^2.30.0",
|
"date-fns": "^2.30.0",
|
||||||
"dayjs": "^1.11.6",
|
"dayjs": "^1.11.6",
|
||||||
"image-tools": "^1.4.0",
|
"image-tools": "^1.4.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
"md5": "^2.3.0",
|
"md5": "^2.3.0",
|
||||||
"openim-uniapp-polyfill": "^1.4.1",
|
"openim-uniapp-polyfill": "^1.4.1",
|
||||||
"qrcode": "^1.5.4",
|
|
||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,131 @@
|
|||||||
|
<template>
|
||||||
|
<view style="display: flex;height: 100vh;align-items: center;flex-direction: column;">
|
||||||
|
<uni-nav-bar
|
||||||
|
style="width: 100%;"
|
||||||
|
statusBar
|
||||||
|
left-icon="left"
|
||||||
|
@clickLeft="goto(1)"
|
||||||
|
right-icon="more-filled"
|
||||||
|
@clickRight="scan"
|
||||||
|
:border="false"
|
||||||
|
backgroundColor="transparent"
|
||||||
|
title=""
|
||||||
|
>
|
||||||
|
</uni-nav-bar>
|
||||||
|
<view style="flex:1;display: flex;flex-direction: column;align-items: center;justify-content: center;">
|
||||||
|
<view class="info_card">
|
||||||
|
<my-avatar :src="userInfo.faceURL" :desc="userInfo.nickname" size="64" />
|
||||||
|
<view class="id_row">
|
||||||
|
<text class="nickname">{{ userInfo.nickname }}</text>
|
||||||
|
<view class="id_row_copy" @click="copy">
|
||||||
|
<text class="id">{{ userInfo.userID }}</text>
|
||||||
|
<image style="width: 32rpx; height: 32rpx" src="@/static/images/id_copy.png" mode="" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<canvas canvas-id="qrcode_canvas" id="qrcode_canvas" style="width: 600rpx; height: 600rpx"></canvas>
|
||||||
|
<view style="color: #b4b4b4;">扫一扫上面的二维码图案,加我为朋友</view>
|
||||||
|
</view>
|
||||||
|
<view style="width: 80%;display: flex;align-items: center;justify-content: center;height: 20%;">
|
||||||
|
<u-button type="default" plain :hairline="false" iconColor="#9aa2b2" @click="scan">扫一扫</u-button>
|
||||||
|
<u-button type="default" plain :hairline="false" iconColor="#9aa2b2">换个样式</u-button>
|
||||||
|
<u-button type="default" plain :hairline="false" iconColor="#9aa2b2">保存图片</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||||
|
import QRCode from "@/components/qrcode.js";
|
||||||
|
import UserBase from '@/components/User.vue';
|
||||||
|
import util from "@/util";
|
||||||
|
export default {
|
||||||
|
mixins:[UserBase],
|
||||||
|
components: {
|
||||||
|
MyAvatar,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
console.log(this.userInfo)
|
||||||
|
this.createQrcode();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...util,
|
||||||
|
createQrcode() {
|
||||||
|
const _this = this;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
new QRCode({
|
||||||
|
context: _this, // 上下文环境
|
||||||
|
canvasId: 'qrcode_canvas', // canvas-id
|
||||||
|
usingComponents: true, // 是否是自定义组件
|
||||||
|
showLoading: false, // 是否显示loading
|
||||||
|
loadingText: "", // loading文字
|
||||||
|
text: "/pages/common/invite_register?code=", // 生成内容
|
||||||
|
size: 320, // 二维码大小
|
||||||
|
background: "#fff", // 背景色
|
||||||
|
foreground: '#000000', // 前景色
|
||||||
|
pdground: '#000000', // 定位角点颜色
|
||||||
|
correctLevel: 3, // 容错级别
|
||||||
|
image: "", // 二维码图标
|
||||||
|
imageSize: 40, // 二维码图标大小
|
||||||
|
cbResult: function(res) { // 生成二维码的回调
|
||||||
|
//_this.qrcode_src = (res)
|
||||||
|
//resolve(res);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.info_card {
|
||||||
|
width: 600rpx;
|
||||||
|
height: 196rpx;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #fff;
|
||||||
|
margin: 0 auto 0 auto;
|
||||||
|
padding: 0 36rpx;
|
||||||
|
color: #0c1c33;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.id_row {
|
||||||
|
@include vCenterBox();
|
||||||
|
display: flex;
|
||||||
|
//height: 46px;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
|
||||||
|
&_copy {
|
||||||
|
@include vCenterBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
.nickname {
|
||||||
|
@include nomalEllipsis();
|
||||||
|
max-width: 400rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.id {
|
||||||
|
color: #8e9ab0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,151 +1,138 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="menu_list">
|
<view class="menu_list">
|
||||||
<view
|
<view @click="menuClick(item)" v-for="item in getMenus" :key="item.idx" class="menu_list_item">
|
||||||
@click="menuClick(item)"
|
<image class="menu_icon" :src="item.icon" mode=""></image>
|
||||||
v-for="item in getMenus"
|
<view class="item_content">
|
||||||
:key="item.idx"
|
<text class="title">
|
||||||
class="menu_list_item"
|
{{ item.title }}
|
||||||
>
|
</text>
|
||||||
<image class="menu_icon" :src="item.icon" mode=""></image>
|
<view class="icon">
|
||||||
<view class="item_content">
|
<u-icon name="arrow-right" color="#999" size="18" />
|
||||||
<text class="title">
|
</view>
|
||||||
{{ item.title }}
|
</view>
|
||||||
</text>
|
</view>
|
||||||
<view class="icon">
|
<view @click="menuClick(item)" v-for="item in getFriendsMenus" :key="item.idx" class="menu_list_item">
|
||||||
<u-icon name="arrow-right" color="#999" size="18" />
|
<image class="menu_icon" :src="item.icon" mode=""></image>
|
||||||
</view>
|
<view class="item_content">
|
||||||
</view>
|
<text class="title">
|
||||||
</view>
|
{{ item.title }}
|
||||||
</view>
|
</text>
|
||||||
<view class="menu_list">
|
<view class="icon">
|
||||||
<view
|
<u-icon name="arrow-right" color="#999" size="18" />
|
||||||
@click="menuClick(item)"
|
</view>
|
||||||
v-for="item in getFriendsMenus"
|
</view>
|
||||||
:key="item.idx"
|
</view>
|
||||||
class="menu_list_item"
|
</view>
|
||||||
>
|
</view>
|
||||||
<image class="menu_icon" :src="item.icon" mode=""></image>
|
|
||||||
<view class="item_content">
|
|
||||||
<text class="title">
|
|
||||||
{{ item.title }}
|
|
||||||
</text>
|
|
||||||
<view class="icon">
|
|
||||||
<u-icon name="arrow-right" color="#999" size="18" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from "vuex";
|
import {mapGetters} from "vuex";
|
||||||
import { ContactMenuTypes } from "@/constant";
|
import {ContactMenuTypes} from "@/constant";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "",
|
name: "",
|
||||||
props: {},
|
props: {},
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getMenus() {
|
getMenus() {
|
||||||
return [
|
return [{
|
||||||
{
|
idx: 0,
|
||||||
idx: 0,
|
type: ContactMenuTypes.NewFriend,
|
||||||
type: ContactMenuTypes.NewFriend,
|
title: "新的好友",
|
||||||
title: "新的好友",
|
icon: require("static/images/contact_new_friend.png"),
|
||||||
icon: require("static/images/contact_new_friend.png"),
|
},
|
||||||
},
|
// {
|
||||||
{
|
// idx: 1,
|
||||||
idx: 1,
|
// type: ContactMenuTypes.NewGroup,
|
||||||
type: ContactMenuTypes.NewGroup,
|
// title: "新的群组",
|
||||||
title: "新的群组",
|
// icon: require("static/images/contact_new_group.png"),
|
||||||
icon: require("static/images/contact_new_group.png"),
|
// },
|
||||||
},
|
];
|
||||||
];
|
},
|
||||||
},
|
getFriendsMenus() {
|
||||||
getFriendsMenus() {
|
return [
|
||||||
return [
|
// {
|
||||||
{
|
// idx: 2,
|
||||||
idx: 2,
|
// type: ContactMenuTypes.MyFriend,
|
||||||
type: ContactMenuTypes.MyFriend,
|
// title: "我的好友",
|
||||||
title: "我的好友",
|
// icon: require("static/images/contact_my_friend.png"),
|
||||||
icon: require("static/images/contact_my_friend.png"),
|
// badge: 0,
|
||||||
badge: 0,
|
// },
|
||||||
},
|
{
|
||||||
{
|
idx: 3,
|
||||||
idx: 3,
|
type: ContactMenuTypes.MyGroup,
|
||||||
type: ContactMenuTypes.MyGroup,
|
title: "群聊",
|
||||||
title: "我的群组",
|
icon: require("static/images/contact_my_group.png"),
|
||||||
icon: require("static/images/contact_my_group.png"),
|
badge: 0,
|
||||||
badge: 0,
|
},
|
||||||
},
|
];
|
||||||
];
|
},
|
||||||
},
|
},
|
||||||
},
|
methods: {
|
||||||
methods: {
|
menuClick({type}) {
|
||||||
menuClick({ type }) {
|
switch (type) {
|
||||||
switch (type) {
|
case ContactMenuTypes.NewFriend:
|
||||||
case ContactMenuTypes.NewFriend:
|
case ContactMenuTypes.NewGroup:
|
||||||
case ContactMenuTypes.NewGroup:
|
uni.navigateTo({
|
||||||
uni.navigateTo({
|
url: `/pages/contact/applicationList/index?applicationType=${type}`,
|
||||||
url: `/pages/contact/applicationList/index?applicationType=${type}`,
|
});
|
||||||
});
|
break;
|
||||||
break;
|
case ContactMenuTypes.MyFriend:
|
||||||
case ContactMenuTypes.MyFriend:
|
uni.navigateTo({
|
||||||
uni.navigateTo({
|
url: "/pages/contact/friendList/index",
|
||||||
url: "/pages/contact/friendList/index",
|
});
|
||||||
});
|
break;
|
||||||
break;
|
case ContactMenuTypes.MyGroup:
|
||||||
case ContactMenuTypes.MyGroup:
|
uni.navigateTo({
|
||||||
uni.navigateTo({
|
url: "/pages/contact/groupList/index",
|
||||||
url: "/pages/contact/groupList/index",
|
});
|
||||||
});
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
break;
|
||||||
break;
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.menu_list {
|
.menu_list {
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
|
||||||
&_item {
|
&_item {
|
||||||
@include vCenterBox();
|
@include vCenterBox();
|
||||||
margin: 0 44rpx;
|
margin: 0 44rpx;
|
||||||
padding: 24rpx 0;
|
padding: 24rpx 0;
|
||||||
color: #0c1c33;
|
color: #0c1c33;
|
||||||
|
|
||||||
.menu_icon {
|
.menu_icon {
|
||||||
width: 42px;
|
width: 42px;
|
||||||
min-width: 42px;
|
min-width: 42px;
|
||||||
height: 42px;
|
height: 42px;
|
||||||
min-height: 42px;
|
min-height: 42px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item_content {
|
.item_content {
|
||||||
@include btwBox();
|
@include btwBox();
|
||||||
margin-left: 24rpx;
|
margin-left: 24rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
.u-badge {
|
.u-badge {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
padding: 8rpx 12rpx;
|
padding: 8rpx 12rpx;
|
||||||
line-height: 18rpx;
|
line-height: 18rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
.contact_container {
|
.contact_container {
|
||||||
@include colBox(false);
|
@include colBox(false);
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: #f6f6f6;
|
background-color: #fff;
|
||||||
|
|
||||||
.contact_title {
|
.contact_title {
|
||||||
padding-left: 44rpx;
|
padding-left: 44rpx;
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
</u-input>
|
</u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item prop="phoneNumber" label="手机号码" v-if="userInfo.type == 'mobile'">
|
<u-form-item prop="phoneNumber" label="手机号码" v-if="userInfo.type == 'mobile'">
|
||||||
<u-input v-model="userInfo.phoneNumber" border="surround" placeholder="请输入手机号码" clearable>
|
<u-input v-model="userInfo.mobile" border="surround" placeholder="请输入手机号码" clearable>
|
||||||
<view slot="prefix" class="phoneNumber_areacode" @click="showPicker">
|
<view slot="prefix" class="phoneNumber_areacode" @click="showPicker">
|
||||||
<text class="areacode_content">+{{ userInfo.areaCode }}</text>
|
<text class="areacode_content">+{{ userInfo.region }}</text>
|
||||||
<u-icon class="arrow_down" name="arrow-down"></u-icon>
|
<u-icon class="arrow_down" name="arrow-down"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</u-input>
|
</u-input>
|
||||||
@@ -50,15 +50,15 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userInfo: {
|
userInfo: {
|
||||||
phoneNumber: "",
|
mobile: "",
|
||||||
email: "",
|
email: "",
|
||||||
areaCode: "86",
|
region: "86",
|
||||||
invitationCode: "",
|
invitationCode: "",
|
||||||
type:'email',
|
type:'mobile',
|
||||||
},
|
},
|
||||||
checked: [true],
|
checked: [true],
|
||||||
rules: {
|
rules: {
|
||||||
phoneNumber: [{
|
mobile: [{
|
||||||
type: "string",
|
type: "string",
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入手机号码",
|
message: "请输入手机号码",
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
const options = {
|
const options = {
|
||||||
mobile: this.userInfo.mobile,
|
mobile: this.userInfo.mobile,
|
||||||
email: this.userInfo.email,
|
email: this.userInfo.email,
|
||||||
areaCode: `+${this.userInfo.areaCode}`,
|
region: `+${this.userInfo.region}`,
|
||||||
event: this.isRegister ? 'register' : "reset_pwd",
|
event: this.isRegister ? 'register' : "reset_pwd",
|
||||||
invitationCode: this.userInfo.invitationCode,
|
invitationCode: this.userInfo.invitationCode,
|
||||||
type:this.userInfo.type
|
type:this.userInfo.type
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
this.$refs.AreaPicker.init();
|
this.$refs.AreaPicker.init();
|
||||||
},
|
},
|
||||||
chooseArea(areaCode) {
|
chooseArea(areaCode) {
|
||||||
this.userInfo.areaCode = areaCode;
|
this.userInfo.region = areaCode;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,9 +39,9 @@
|
|||||||
isRegister: false,
|
isRegister: false,
|
||||||
codeValue: "",
|
codeValue: "",
|
||||||
userInfo: {
|
userInfo: {
|
||||||
phoneNumber: "",
|
mobile: "",
|
||||||
email:"",
|
email:"",
|
||||||
areaCode: "",
|
region: "",
|
||||||
},
|
},
|
||||||
formData: {
|
formData: {
|
||||||
password: "",
|
password: "",
|
||||||
@@ -101,9 +101,9 @@
|
|||||||
this.$refs.loginForm.validate().then((valid) => {
|
this.$refs.loginForm.validate().then((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const options = {
|
const options = {
|
||||||
mobile: this.userInfo.phoneNumber,
|
mobile: this.userInfo.mobile,
|
||||||
email: this.userInfo.em,
|
email: this.userInfo.email,
|
||||||
areaCode: `+${this.userInfo.areaCode}`,
|
region: `+${this.userInfo.region}`,
|
||||||
code: this.codeValue,
|
code: this.codeValue,
|
||||||
password: this.formData.password,
|
password: this.formData.password,
|
||||||
platform: uni.$u.os(),
|
platform: uni.$u.os(),
|
||||||
|
|||||||
@@ -50,9 +50,9 @@
|
|||||||
comfirmEying: false,
|
comfirmEying: false,
|
||||||
codeValue: "",
|
codeValue: "",
|
||||||
userInfo: {
|
userInfo: {
|
||||||
phoneNumber: "",
|
mobile: "",
|
||||||
email: "",
|
email: "",
|
||||||
areaCode: "",
|
region: "",
|
||||||
nickname: "",
|
nickname: "",
|
||||||
password: "",
|
password: "",
|
||||||
confirmPassword: "",
|
confirmPassword: "",
|
||||||
@@ -135,9 +135,9 @@
|
|||||||
platform: uni.$u.os(),
|
platform: uni.$u.os(),
|
||||||
autoLogin: true,
|
autoLogin: true,
|
||||||
...this.userInfo,
|
...this.userInfo,
|
||||||
areaCode: `+${this.userInfo.areaCode}`,
|
region: `+${this.userInfo.region}`,
|
||||||
password: md5(this.userInfo.password),
|
password: md5(this.userInfo.password),
|
||||||
mobile: this.userInfo.phoneNumber
|
mobile: this.userInfo.mobile
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await businessRegister(options);
|
await businessRegister(options);
|
||||||
@@ -162,11 +162,11 @@
|
|||||||
saveLoginInfo() {
|
saveLoginInfo() {
|
||||||
uni.setStorage({
|
uni.setStorage({
|
||||||
key: "lastPhoneNumber",
|
key: "lastPhoneNumber",
|
||||||
data: this.userInfo.phoneNumber,
|
data: this.userInfo.mobile,
|
||||||
});
|
});
|
||||||
uni.setStorage({
|
uni.setStorage({
|
||||||
key: "lastAreaCode",
|
key: "lastAreaCode",
|
||||||
data: this.userInfo.areaCode,
|
data: this.userInfo.region,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,17 +5,17 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="title">验证码已发送至手机</view>
|
<view class="title">验证码已发送至手机</view>
|
||||||
<view class="sub_title">
|
<view class="sub_title">
|
||||||
{{ `+${userInfo.areaCode} ${userInfo.phoneNumber}` }}
|
{{ `+${userInfo.region} ${userInfo.mobile}` }}
|
||||||
</view>
|
</view>
|
||||||
<view class="code_container">
|
<view class="code_container">
|
||||||
<!-- <view class="code_title">请输入验证码</view> -->
|
<!-- <view class="code_title">请输入验证码</view> -->
|
||||||
<u-code-input fontSize="24" color="#000" :focus="true" v-model="codeValue" hairline space="16"
|
<u-code-input fontSize="24" color="#000" :focus="true" v-model="codeValue" hairline space="16"
|
||||||
@finish="checkCode" />
|
@finish="checkCode" />
|
||||||
<view class="code_des">
|
<view class="code_des">
|
||||||
<text>
|
<text v-if="count > 0">
|
||||||
{{ `${count}s` }}
|
{{ `${count}s` }}
|
||||||
|
后
|
||||||
</text>
|
</text>
|
||||||
后
|
|
||||||
<text @click="getSmsAgain"> 重发验证码 </text>
|
<text @click="getSmsAgain"> 重发验证码 </text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -23,16 +23,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import user from "../../../store/modules/user";
|
import user from "../../../store/modules/user";
|
||||||
import {
|
import { businessSendSms, businessVerifyCode } from "@/api/login";
|
||||||
businessSendSms,
|
import { SmsUserFor } from "@/constant";
|
||||||
businessVerifyCode
|
import { checkLoginError } from "@/util/common";
|
||||||
} from "@/api/login";
|
|
||||||
import {
|
|
||||||
SmsUserFor
|
|
||||||
} from "@/constant";
|
|
||||||
import {
|
|
||||||
checkLoginError
|
|
||||||
} from "@/util/common";
|
|
||||||
let timer;
|
let timer;
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -40,8 +33,8 @@ import {
|
|||||||
codeValue: "",
|
codeValue: "",
|
||||||
count: 60,
|
count: 60,
|
||||||
userInfo: {
|
userInfo: {
|
||||||
phoneNumber: "",
|
mobile: "",
|
||||||
areaCode: "",
|
region: "",
|
||||||
email: "",
|
email: "",
|
||||||
code: "",
|
code: "",
|
||||||
type: "email",
|
type: "email",
|
||||||
@@ -74,10 +67,10 @@ import {
|
|||||||
},
|
},
|
||||||
checkCode(value) {
|
checkCode(value) {
|
||||||
const options = {
|
const options = {
|
||||||
mobile: this.userInfo.phoneNumber,
|
mobile: this.userInfo.mobile,
|
||||||
email: this.userInfo.email,
|
email: this.userInfo.email,
|
||||||
type: this.userInfo.type,
|
type: this.userInfo.type,
|
||||||
areaCode: `+${this.userInfo.areaCode}`,
|
region: `+${this.userInfo.region}`,
|
||||||
event: this.isRegister ? 'register' : 'reset_pwd',
|
event: this.isRegister ? 'register' : 'reset_pwd',
|
||||||
code: value,
|
code: value,
|
||||||
};
|
};
|
||||||
@@ -115,10 +108,10 @@ import {
|
|||||||
getSmsAgain() {
|
getSmsAgain() {
|
||||||
if (this.count === 0) {
|
if (this.count === 0) {
|
||||||
const options = {
|
const options = {
|
||||||
mobile: this.userInfo.phoneNumber,
|
mobile: this.userInfo.mobile,
|
||||||
email: this.userInfo.email,
|
email: this.userInfo.email,
|
||||||
type: this.userInfo.type,
|
type: this.userInfo.type,
|
||||||
areaCode: `+${this.userInfo.areaCode}`,
|
region: `+${this.userInfo.region}`,
|
||||||
event: this.isRegister ? 'register' : 'reset_pwd',
|
event: this.isRegister ? 'register' : 'reset_pwd',
|
||||||
};
|
};
|
||||||
businessSendSms(options)
|
businessSendSms(options)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 503 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB |
@@ -11,6 +11,7 @@ export default {
|
|||||||
storeSentFriendApplications: (state) => state.contact.sentFriendApplications,
|
storeSentFriendApplications: (state) => state.contact.sentFriendApplications,
|
||||||
storeRecvGroupApplications: (state) => state.contact.recvGroupApplications,
|
storeRecvGroupApplications: (state) => state.contact.recvGroupApplications,
|
||||||
storeSentGroupApplications: (state) => state.contact.sentGroupApplications,
|
storeSentGroupApplications: (state) => state.contact.sentGroupApplications,
|
||||||
|
storeUnHandleFriendApplicationNum: (state) => state.contact.unHandleFriendApplicationNum,
|
||||||
storeHistoryMessageList: (state) => state.message.historyMessageList,
|
storeHistoryMessageList: (state) => state.message.historyMessageList,
|
||||||
storeHasMoreMessage: (state) => state.message.hasMoreMessage,
|
storeHasMoreMessage: (state) => state.message.hasMoreMessage,
|
||||||
storeSelfInfo: (state) => state.user.selfInfo,
|
storeSelfInfo: (state) => state.user.selfInfo,
|
||||||
|
|||||||
+5
-16
@@ -1,13 +1,7 @@
|
|||||||
import {
|
import { v4 as uuidv4} from "uuid";
|
||||||
v4 as uuidv4
|
|
||||||
} from "uuid";
|
|
||||||
import IMSDK from "openim-uniapp-polyfill";
|
import IMSDK from "openim-uniapp-polyfill";
|
||||||
import {
|
import { businessGetUserInfo} from "@/api/login";
|
||||||
businessGetUserInfo
|
import { filterEmptyValue} from "@/util/common";
|
||||||
} from "@/api/login";
|
|
||||||
import {
|
|
||||||
filterEmptyValue
|
|
||||||
} from "@/util/common";
|
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
selfInfo: {},
|
selfInfo: {},
|
||||||
@@ -44,9 +38,7 @@ const mutations = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
async getSelfInfo({
|
async getSelfInfo({ commit }) {
|
||||||
commit
|
|
||||||
}) {
|
|
||||||
try {
|
try {
|
||||||
const result = await IMSDK.asyncApi(IMSDK.IMMethods.GetSelfUserInfo,uuidv4(),);
|
const result = await IMSDK.asyncApi(IMSDK.IMMethods.GetSelfUserInfo,uuidv4(),);
|
||||||
const res = await businessGetUserInfo(result.data.userID);
|
const res = await businessGetUserInfo(result.data.userID);
|
||||||
@@ -62,10 +54,7 @@ const actions = {
|
|||||||
uni.$u.toast("获取个人信息失败");
|
uni.$u.toast("获取个人信息失败");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async updateBusinessInfo({
|
async updateBusinessInfo({ commit, state }) {
|
||||||
commit,
|
|
||||||
state
|
|
||||||
}) {
|
|
||||||
try {
|
try {
|
||||||
const res = await businessGetUserInfo(state.selfInfo.userID);
|
const res = await businessGetUserInfo(state.selfInfo.userID);
|
||||||
const businessData = res.data[0] ?? {};
|
const businessData = res.data[0] ?? {};
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* weui-like overrides for uni-ui / uView components
|
||||||
|
* 目的:通过较高优先级的选择器和必要的 !important,调整常用组件外观
|
||||||
|
* 只做最小改动,便于后续微调
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 基础色(WeUI 常用绿色) */
|
||||||
|
:root {
|
||||||
|
--weui-primary: #07c160;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 按钮 */
|
||||||
|
uni-button[type=primary],
|
||||||
|
.u-btn--primary,
|
||||||
|
.u-button--primary {
|
||||||
|
background-color: var(--weui-primary) !important;
|
||||||
|
color: #ffffff !important;
|
||||||
|
border: none !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
padding: 8px 14px !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 默认按钮风格更扁平,白底带边框 */
|
||||||
|
uni-button[type=default],
|
||||||
|
.u-btn--default,
|
||||||
|
.u-button--default {
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
color: #333 !important;
|
||||||
|
border: 1px solid #e6e6e6 !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 列表 / cell 风格:白底、细分割线 */
|
||||||
|
.uni-list,
|
||||||
|
.uni-list__item,
|
||||||
|
.uni-list-cell,
|
||||||
|
.u-list,
|
||||||
|
.u-list-item {
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
border-bottom: 1px solid #f2f2f2 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-list__item,
|
||||||
|
.u-list-item {
|
||||||
|
padding: 12px 16px !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
color: #333 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-list__item .uni-list-item-sub,
|
||||||
|
.u-list-item__desc {
|
||||||
|
color: #888 !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 导航栏 */
|
||||||
|
.u-navbar,
|
||||||
|
.uni-navbar,
|
||||||
|
.custom-nav-bar,
|
||||||
|
.custom-nav-bar * {
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
color: #000000 !important;
|
||||||
|
border-bottom: 1px solid #e9e9e9 !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 头像圆形 */
|
||||||
|
.uni-avatar,
|
||||||
|
.u-avatar,
|
||||||
|
.avatar {
|
||||||
|
border-radius: 50% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标签风格 */
|
||||||
|
.uni-tag,
|
||||||
|
.u-tag {
|
||||||
|
background-color: #f5f5f5 !important;
|
||||||
|
color: #333 !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
padding: 2px 6px !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹窗 / toast 圆角 */
|
||||||
|
.uni-toast,
|
||||||
|
.uni-modal,
|
||||||
|
.u-toast,
|
||||||
|
.u-modal {
|
||||||
|
border-radius: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框下边线样式更接近 WeUI */
|
||||||
|
uni-input,
|
||||||
|
.uni-input,
|
||||||
|
.u-input {
|
||||||
|
border-bottom: 1px solid #eaeaea !important;
|
||||||
|
padding: 10px 0 !important;
|
||||||
|
color: #333 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 全局小字体调整,避免太大 */
|
||||||
|
body,
|
||||||
|
.uni-page,
|
||||||
|
.u-page {
|
||||||
|
font-size: 14px !important;
|
||||||
|
color: #222 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 细节:移除不必要阴影,使用扁平化视觉 */
|
||||||
|
* {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 提示:若需要进一步微调某些组件,请告诉我你想调整的组件名或截屏 */
|
||||||
@@ -50,6 +50,96 @@ export const getDbDir = () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
export const formatIndexListData = (list, key = "nickname") => {
|
||||||
|
// 兼容:list 为数组,数组元素可以是字符串或对象;key 为要分组的字段名(若元素为字符串则忽略 key)
|
||||||
|
if (!Array.isArray(list) || list.length === 0) return [];
|
||||||
|
|
||||||
|
const ucfirst = (l1) => {
|
||||||
|
if (!l1) return "";
|
||||||
|
if (l1.length > 0) {
|
||||||
|
var first = l1.substr(0, 1).toUpperCase();
|
||||||
|
var spare = l1.substr(1, l1.length);
|
||||||
|
return first + spare;
|
||||||
|
}
|
||||||
|
return l1;
|
||||||
|
};
|
||||||
|
|
||||||
|
const arraySearch = (l1) => {
|
||||||
|
for (var name in PinYin) {
|
||||||
|
if (PinYin[name].indexOf(l1) != -1) {
|
||||||
|
return ucfirst(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 将字符串转为可排序的拼音/字母表示
|
||||||
|
const codefans = (l1) => {
|
||||||
|
l1 = l1 ?? "";
|
||||||
|
var l2 = l1.length;
|
||||||
|
var I1 = "";
|
||||||
|
var reg = new RegExp("[a-zA-Z0-9- ]");
|
||||||
|
for (var i = 0; i < l2; i++) {
|
||||||
|
var val = l1.substr(i, 1);
|
||||||
|
var name = arraySearch(val);
|
||||||
|
if (reg.test(val)) {
|
||||||
|
I1 += val;
|
||||||
|
} else if (name !== false) {
|
||||||
|
I1 += name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
I1 = I1.replace(/ /g, "-");
|
||||||
|
while (I1.indexOf("--") > 0) {
|
||||||
|
I1 = I1.replace("--", "-");
|
||||||
|
}
|
||||||
|
return I1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 构建分组 map
|
||||||
|
const groups = {};
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
const item = list[i];
|
||||||
|
const val = (typeof item === "string") ? item : (item && item[key]) ? item[key] : "";
|
||||||
|
const coded = codefans(String(val));
|
||||||
|
let initial = (coded && coded.length > 0) ? coded.substr(0, 1).toUpperCase() : "#";
|
||||||
|
if (!/^[A-Z]$/.test(initial)) initial = "#";
|
||||||
|
if (!groups[initial]) groups[initial] = [];
|
||||||
|
groups[initial].push({
|
||||||
|
raw: item,
|
||||||
|
sortKey: coded || String(val)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按字母顺序构建结果,A-Z 然后 #
|
||||||
|
const letters = Object.keys(groups).filter((l) => l !== "#").sort();
|
||||||
|
const result = [];
|
||||||
|
for (const L of letters) {
|
||||||
|
// 组内按照 sortKey 排序
|
||||||
|
groups[L].sort((a, b) => {
|
||||||
|
if (a.sortKey < b.sortKey) return -1;
|
||||||
|
if (a.sortKey > b.sortKey) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
result.push({
|
||||||
|
letter: L,
|
||||||
|
data: groups[L].map((x) => x.raw)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 特殊字符组放最后
|
||||||
|
if (groups["#"] && groups["#"].length > 0) {
|
||||||
|
groups["#"].sort((a, b) => {
|
||||||
|
if (a.sortKey < b.sortKey) return -1;
|
||||||
|
if (a.sortKey > b.sortKey) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
result.push({
|
||||||
|
letter: "#",
|
||||||
|
data: groups["#"].map((x) => x.raw)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
export const formatChooseData = (data, key = "nickname") => {
|
export const formatChooseData = (data, key = "nickname") => {
|
||||||
const ucfirst = (l1) => {
|
const ucfirst = (l1) => {
|
||||||
|
|||||||
+148
@@ -0,0 +1,148 @@
|
|||||||
|
import _ from "lodash";
|
||||||
|
//import i18n from '@/locales'
|
||||||
|
import base from '@/common/config';
|
||||||
|
//import store from "@/store";
|
||||||
|
export default{
|
||||||
|
cdn(v){
|
||||||
|
v= v || "";
|
||||||
|
v = v.replace(/\\/ig,"/").replace('/\/\/ig',"/");
|
||||||
|
if(_.isString(v)){
|
||||||
|
if(v.substr(0,5) == 'blob:'){
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
v= v.substring(0,1) == '/' ? v : '/'+v;
|
||||||
|
return base.cdnUrl+''+v;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
goto(url,type){
|
||||||
|
console.log(url);
|
||||||
|
type = type || '0'; //0 navigateTo 1 redirectTo
|
||||||
|
if(url){
|
||||||
|
if(_.isInteger(url)){
|
||||||
|
uni.navigateBack({
|
||||||
|
delta:url,
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
url+="";
|
||||||
|
if(url.substr(0,6) != '/pages'){
|
||||||
|
url='/pages'+url
|
||||||
|
}
|
||||||
|
if(type == '1'){
|
||||||
|
return uni.redirectTo({
|
||||||
|
url:url
|
||||||
|
});
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url:url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showToast(msg,url,icon){
|
||||||
|
const _this = this;
|
||||||
|
//msg = i18n.t(msg);
|
||||||
|
// #ifdef APP
|
||||||
|
plus.nativeUI.closeToast();
|
||||||
|
plus.nativeUI.toast(msg,{
|
||||||
|
align:'center',
|
||||||
|
verticalAlign:"center",
|
||||||
|
style:"inline",
|
||||||
|
icon:icon=='error' ? '/static/img/common/error.png' : '/static/img/common/success.png',
|
||||||
|
iconWidth:24,
|
||||||
|
iconHeight:24
|
||||||
|
});
|
||||||
|
|
||||||
|
if(url){
|
||||||
|
setTimeout(()=>{
|
||||||
|
_this.goto(url);
|
||||||
|
},3000)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP
|
||||||
|
uni.showToast({
|
||||||
|
//image:icon=='error' ? '/static/img/common/error.png' : '/static/img/common/success.png',
|
||||||
|
icon:icon=='error' ? icon : 'success',
|
||||||
|
title:msg,
|
||||||
|
showToast:3000,
|
||||||
|
complete:()=>{
|
||||||
|
if(url){
|
||||||
|
setTimeout(()=>{
|
||||||
|
_this.goto(url);
|
||||||
|
},3000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
error(msg,url){
|
||||||
|
this.showToast(msg,url,'error');
|
||||||
|
},
|
||||||
|
success(msg,url){
|
||||||
|
this.showToast(msg,url,'success');
|
||||||
|
},
|
||||||
|
scan(){
|
||||||
|
uni.scanCode({
|
||||||
|
success(res){
|
||||||
|
/**
|
||||||
|
* result 所扫码的内容
|
||||||
|
scanType 所扫码的类型 App、微信小程序、百度小程序、QQ小程序、京东小程序、支付宝小程序
|
||||||
|
charSet 所扫码的字符集 App、微信小程序、百度小程序(所扫码的字符集,仅支持 Android 系统)、QQ小程序、京东小程序
|
||||||
|
path 当所扫的码为当前应用的合法二维码时,会返回此字段,内容为二维码携带的 path。 微信小程序、QQ小程序、京东小程序
|
||||||
|
rawData 原始数据,base64 编码 微信小程序、QQ小程序、京东小程序、支付宝小程序
|
||||||
|
code 扫码所得数据 支付宝小程序
|
||||||
|
qrCode 扫描二维码时返回二维码数据 支付宝小程序
|
||||||
|
barCode 扫描条形码时返回条形码数据 支付宝小程序
|
||||||
|
imageChannel 来源 支付宝小程序
|
||||||
|
*/
|
||||||
|
if(res.result){
|
||||||
|
if(res.result.indexOf('blackcatp:/')){
|
||||||
|
uni.navigateTo({
|
||||||
|
url:res.result.substring(11)
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.success(res.result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(res){
|
||||||
|
|
||||||
|
},
|
||||||
|
complete(res){
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
copy(v){
|
||||||
|
let that = this;
|
||||||
|
uni.setClipboardData({
|
||||||
|
data:v+'',
|
||||||
|
success() {
|
||||||
|
that.success('复制成功');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toDate(time) {
|
||||||
|
var date = new Date(time * 1000);
|
||||||
|
var fmt = 'yyyy-MM-dd hh:mm:ss';
|
||||||
|
var o = {
|
||||||
|
'M+': date.getMonth() + 1, //月份
|
||||||
|
'd+': date.getDate(), //日
|
||||||
|
'h+': date.getHours(), //小时
|
||||||
|
'm+': date.getMinutes(), //分
|
||||||
|
's+': date.getSeconds(), //秒
|
||||||
|
'q+': Math.floor((date.getMonth() + 3) / 3), //季度
|
||||||
|
S: date.getMilliseconds() //毫秒
|
||||||
|
};
|
||||||
|
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
|
||||||
|
for (var k in o) if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
|
||||||
|
return fmt;
|
||||||
|
},
|
||||||
|
formatAmount(v,wei){
|
||||||
|
if(!v){return 0.00;}
|
||||||
|
v=v+"";
|
||||||
|
v = parseFloat(v).toFixed(wei || 2);
|
||||||
|
return parseFloat(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user