Commit 6c1d8c83 authored by xieyishang's avatar xieyishang

addxx

parent 4c44adb2
......@@ -70,11 +70,11 @@
this.is_closed=this.$store.state.is_closed;
},
updated (){
console.log('玩了')
// console.log('玩了')
},
watch:{
dataorder(){
console.log('变了')
// console.log('变了')
}
},
computed: {
......
......@@ -33,8 +33,8 @@
<view @tap="catphone" class="iconsbtn">
<image class="iconsimg" src="/static/chat/telephony.png" mode=""></image>
</view>
<view @tap="tostorehome" class="iconsbtn">
<image class="iconsimg" src="/static/chat/storeicon.png" mode=""></image>
<view @tap="toorderinfo" class="iconsbtn">
<image class="iconsimg" src="/static/chat/ordericonss.png" mode=""></image>
</view>
</view>
</view>
......@@ -328,25 +328,25 @@
scrollInputh: 0, //底部的高度
commonwords: [{
name: "请问门店位置在哪?"
name: "你好,我们的出餐速度很快的"
},
{
name: "请问营业时间是几点到几点?"
name: "你好,您的订单骑手已经取餐。"
},
{
name: "请问有什么优惠活动吗?"
name: "你还,店铺主页有优惠券可以领取。"
},
{
name: "请问你们店铺支持配送吗?"
name: "我们的店铺是支持配送的"
},
{
name: "你好,微辣谢谢"
name: "好的,收到"
},
{
name: "你好,我不吃香菜"
name: "你好,请问要微辣还是中辣?"
},
],
isshowtisgoods: true, //是否显示提示产品
isshowtisgoods: false, //是否显示提示产品
qunusermelist: [],
......@@ -627,20 +627,12 @@
//打电话
catphone() {
uni.showActionSheet({
itemList: ['商家电话', '骑手电话', '客服电话', '用户电话'],
itemList: ['用户电话','客服电话','骑手电话'],
success: (res) => {
let sleectindex = res.tapIndex;
let callphone = '';
switch (sleectindex) {
case 0:
let Merchantinfo = this.Merchantinfo;//商家
if (Merchantinfo.customInfo) {
if (Merchantinfo.customInfo.identity == '2') {
callphone = Merchantinfo.customInfo.stel;
}
}
break;
case 1:
case 2:
let riderinfo = this.riderinfo;//骑手
if (riderinfo.customInfo) {
if (riderinfo.customInfo.identity == '3') {
......@@ -648,7 +640,7 @@
}
}
break;
case 2:
case 1:
let serviceinfo = this.serviceinfo;//客服
if (serviceinfo.customInfo) {
if (serviceinfo.customInfo.identity == '4') {
......@@ -656,8 +648,8 @@
}
}
break;
case 3:
let Userinformation = this.Userinformation;
case 0:
let Userinformation = this.Userinformation;//用户
if (Userinformation.customInfo) {
if (Userinformation.customInfo.identity == '1') {
callphone = Userinformation.customInfo.utel;
......@@ -679,9 +671,10 @@
}
});
},
//进入店铺主页
tostorehome() {
console.info('进入店铺主页');
//查看订单
toorderinfo() {
console.info('查看订单详情');
return false;
let Merchantinfo = this.Merchantinfo;//商家
let shopid = '';
let shoptype = '';
......
......@@ -12,8 +12,8 @@
<view class="usertxbox">
<view class="tagmsgs" v-if="item.unreadCount!=0 && item.unreadCount<99">{{item.unreadCount}}</view>
<view class="tagmsgs" v-else-if="item.unreadCount!=0 && item.unreadCount>=99">99</view>
<view v-if="item.type==2 && item.txlen" :class="'avatar-box-'+item.txlen">
<image class="img" :src="dataa" v-for="(dataa,i) in item.migtxs" :key="i"></image>
<view v-if="item.type==2 && qunavatarlist[index].txlen" :class="'avatar-box-'+qunavatarlist[index].txlen">
<image class="img" :src="dataa" v-for="(dataa,i) in qunavatarlist[index].migtxs" :key="i"></image>
</view>
<image v-else class="usertx" :src="item.avatar" mode=""></image>
</view>
......@@ -29,7 +29,7 @@
<view v-if="item.lastMessage" class="isliaotcon oneline">
<text v-show="item.unreadCount==0">[已读]</text>
<text v-show="item.unreadCount!=0">[未读]</text>
<text v-if="item.lastMessage.textElem && item.type==1">{{item.lastMessage.textElem.msg}}</text>
<text v-if="item.lastMessage.textElem && (item.type==1 || item.type==2)">{{item.lastMessage.textElem.msg}}</text>
<text v-if="item.lastMessage.elemType==2">[自定义消息]</text>
<text v-if="item.lastMessage.elemType==3">[图片消息]</text>
<text v-if="item.lastMessage.elemType==4">[语音消息]</text>
......@@ -62,6 +62,9 @@
data() {
return {
conversationListtwo:[],
//先这样写 暂时没有找到更好的写法
//群头像
qunavatarlist:[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},],
};
},
onLoad() {
......@@ -80,39 +83,45 @@
},
},
watch:{
conversationList(){
this.conversationListtwo = this.conversationList;
conversationList: {
  handler(newName, oldName) {
console.info("conversationList 监听ooo");
let {conversationList} = this;
this.conversationListtwo = conversationList;
this.handchangelist();
  },
deep: false,
  immediate: true
}
},
methods: {
loginfun() {
let IMUserID = uni.getStorageSync("IMUserID");
this.$store.dispatch("baselogin", IMUserID); //登录
// let IMUserID = 'u_817157';
// this.$store.dispatch("baselogin", IMUserID); //登录
setTimeout(()=>{
if(this.conversationList.length==0){
// #ifdef APP-PLUS
this.getConversationList();
// #endif
this.$store.dispatch("loginStatus").then((res)=>{
if (res.loginStatus != 1) {
//没登录
let IMUserID = uni.getStorageSync("IMUserID");
this.$store.dispatch("baselogin", IMUserID); //登录
setTimeout(()=>{
if(this.conversationList.length==0){
// #ifdef APP-PLUS
this.getConversationList();
// #endif
}
},4000)
} else {
//已经登录了
if(this.conversationList.length==0){
// #ifdef APP-PLUS
this.getConversationList();
// #endif
}
}
},4000)
// let userInfo = uni.getStorageSync("userInfo");
// if(userInfo.shop_id ){
// let userids = 'u_'+String(userInfo.shop_id)
// }
})
},
//获取会话列表 APP
getConversationList() {
this.$store.dispatch("getConversationList", {}).then((res)=>{
console.info("APP获取会话列表成功");
setTimeout(()=>{
this.handchangelist();
},1000)
}); //获取会话列表
},
tochats(item) {
......@@ -126,8 +135,11 @@
//获取群回话里面的群成员 生成群头像
handchangelist(){
let {conversationList} = this;
let succunm = 0;
let qunavatarlist = [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},];
for(let i=0;i<conversationList.length;i++){
let item = conversationList[i];
let qunavatarobj = {};
if(item.type==2){//群
this.$store.dispatch("getGroupMemberList", {groupId:item.groupId}).then((res) => {
if(res.code==0){
......@@ -138,17 +150,25 @@
migtxs.push(ulist[j].userAvatar);
}
}
conversationList[i].migtxs = migtxs;
conversationList[i].txlen = String(migtxs.length);
this.$set(this.conversationListtwo, i,conversationList[i]);
qunavatarobj.migtxs = migtxs;
qunavatarobj.txlen = String(migtxs.length);
qunavatarlist[i] = qunavatarobj;
succunm++;
}else{
succunm++;
}
});
}else{
succunm++;
}
}
setTimeout(()=>{
console.info("conversationListtwo",this.conversationListtwo);
},6000)
//等待异步函数执行成功
let valss = setInterval(()=>{
if(succunm==conversationList.length){
this.qunavatarlist = qunavatarlist;
clearInterval(valss);
}
},100)
}
}
}
......
......@@ -93,10 +93,7 @@
<script>
import uniIcon from "@/components/uni/uni-icon/uni-icon.vue"
import {userLogin,userUpdatePassword,userSendSms,importShopAccount} from "@/utils/api/api.js";
import showxieyi from "@/components/showxieyi/showxieyi.vue"
console.info("importShopAccount",importShopAccount);
import showxieyi from "@/components/showxieyi/showxieyi.vue"
export default {
components:{
......@@ -274,7 +271,6 @@
//有多个门店 需要切换
uni.setStorageSync('token', tokens);
this.$store.commit('changetoken',tokens);
this.importShopAccountfun();//去导账号
uni.setStorageSync('storelsit', res.data.store);
uni.navigateTo({
url:"/pages/tagglestore/tagglestore?istologin=1"
......@@ -348,14 +344,10 @@
}
},
//导入账号信息
async importShopAccountfun(){
console.info("导入账号66");
let res = await importShopAccount({});
console.info(res,"导入账号");
if(res.code==0){
importShopAccountfun(){
this.$store.dispatch('importShopAccountfun',{}).then((res)=>{
}
});
}
}
}
......
......@@ -8,7 +8,6 @@
<view class="info towline">{{item.addr}}</view>
</view>
</view>
</view>
</view>
</template>
......@@ -52,6 +51,7 @@
//登录的时候选的
this.$store.commit('changeuserInfo', this.storelsit[index]);
uni.setStorageSync('userInfo', this.storelsit[index]);
this.importShopAccountfun();
uni.switchTab({
url:'/pages/index/index'
});
......@@ -59,10 +59,17 @@
}else{
this.$store.commit('changeuserInfo', this.storelsit[index]);
uni.setStorageSync('userInfo', this.storelsit[index]);
this.importShopAccountfun();
setTimeout(()=>{
uni.navigateBack({});
},1000)
}
},
//导入账号信息
importShopAccountfun(){
this.$store.dispatch('importShopAccountfun',{}).then((res)=>{
});
}
}
}
......
......@@ -69,12 +69,12 @@ const Im_store = {
},
//APP或者小程序 都调用 初始化IM登录
InItImlogin(store, type) {
let userinfo = uni.getStorageSync("userinfo");
let IMUserID = uni.getStorageSync("IMUserID");
// #ifdef APP-PLUS
store.dispatch("loginStatus", String(userinfo.id)).then((res) => { //获取登录状态
if (res.loginStatus != 0) {
store.dispatch("loginStatus", String(IMUserID)).then((res) => { //获取登录状态
if (res.loginStatus != 1) {
//没登录
store.dispatch("baselogin", String(userinfo.id))
store.dispatch("baselogin", String(IMUserID))
} else {
//已经登录了
}
......@@ -105,6 +105,7 @@ const Im_store = {
txIm = uni.requireNativePlugin('TX-TencentIM');
// #endif
console.info("新消息来了");
//新消息来了
//震动
// uni.vibrateLong({
......
......@@ -7,16 +7,7 @@ import debug from "@/utils/debug.js";
Vue.use(Vuex)
import Voice from '@/utils/QS-baiduyy/QS-baiduyy.js';//接入百度语音播报api
// let obj = {
// staticUrl:"https://kazuma.jxdsy.cn/attachs/",//图片静态资源地址
// staticUrl1:"https://zxluma.jxdsy.cn/attachs/",
// joinurl:"https://kazuma.jxdsy.cn/static/applet5/",//关于我们里面的url
// statictowUrl:"https://kazuma.jxdsy.cn/",//域名
// staticFile:"static/applet5/images/bank/",//图片路径
// uploadurl:"https://kazuma.jxdsy.cn/",//上传图片的地址 用在上传图片组件
// uploadurl1:"https://zxluma.jxdsy.cn/merchant.php/FileUpload/uploadify",
// };
import {importShopAccount} from "@/utils/api/api.js";
//IMadd
......@@ -215,6 +206,23 @@ const store = new Vuex.Store({
})
})
},
//导入IM 账号信息
importShopAccountfun(context,text){
console.log(uni.getStorageSync('token'));
return new Promise((resolve, reject) => {
importShopAccount({}).then((res)=>{
console.info(res,"导入账号");
if(res.code==0){
if(res.data.code==0){
let IMUserID = res.data.data.Identifier?res.data.data.Identifier:res.data.data.UserID;
uni.setStorageSync("IMUserID",IMUserID);
context.dispatch("baselogin", IMUserID); //登录
}
}
resolve(res);
})
})
},
...Im_store.actions,//IMadd
}
})
......
......@@ -578,4 +578,15 @@ $bordercodes:rgba(242,242,242,1);
}
}
}
// 高级搜索end
\ No newline at end of file
// 高级搜索end
.emptybox{
padding-top: 20upx;
text-align: center;
}
.emptybox .img{
width: 300upx;
height: 300upx;
}
\ No newline at end of file
......@@ -119,7 +119,7 @@ export default function request(api, method, data, {noAuth = false, noVerify = f
header: header,
data: data || {},
success: (res) => {
console.info("res",res);
// console.info("res",res);
// uni.hideLoading();
if (noVerify)
reslove(res.data, res);
......
......@@ -362,6 +362,38 @@ const checkPhone = (phone)=>{
}
}
//时间戳解析多久前
const formatMsgTime = (timespan)=> {
timespan = timespan*1000;//
var dateTime = new Date(timespan) // 将传进来的字符串或者毫秒转为标准时间
var year = dateTime.getFullYear()
var month = dateTime.getMonth() + 1
var day = dateTime.getDate()
var hour = dateTime.getHours()
var minute = dateTime.getMinutes()
// var second = dateTime.getSeconds()
var millisecond = dateTime.getTime() // 将当前编辑的时间转换为毫秒
var now = new Date() // 获取本机当前的时间
var nowNew = now.getTime() // 将本机的时间转换为毫秒
var milliseconds = 0
var timeSpanStr
milliseconds = nowNew - millisecond
if (milliseconds <= 1000 * 60 * 1) { // 小于一分钟展示为刚刚
timeSpanStr = '刚刚'
} else if (1000 * 60 * 1 < milliseconds && milliseconds <= 1000 * 60 * 60) { // 大于一分钟小于一小时展示为分钟
timeSpanStr = Math.round((milliseconds / (1000 * 60))) + '分钟前'
} else if (1000 * 60 * 60 * 1 < milliseconds && milliseconds <= 1000 * 60 * 60 * 24) { // 大于一小时小于一天展示为小时
timeSpanStr = Math.round(milliseconds / (1000 * 60 * 60)) + '小时前'
} else if (1000 * 60 * 60 * 24 < milliseconds && milliseconds <= 1000 * 60 * 60 * 24 * 15) { // 大于一天小于十五天展示位天
timeSpanStr = Math.round(milliseconds / (1000 * 60 * 60 * 24)) + '天前'
} else if (milliseconds > 1000 * 60 * 60 * 24 * 15 && year === now.getFullYear()) {
timeSpanStr = month + '-' + day + ' ' + hour + ':' + minute
} else {
timeSpanStr = year + '-' + month + '-' + day + ' ' + hour + ':' + minute
}
return timeSpanStr
}
export {
getTimeOut,
timestampToTime,//10位时间戳 转年月日时分秒
......@@ -382,6 +414,7 @@ export {
getRandomColor,//生成随机颜色
checkPwd,//检测密码强度
checkPhone,//检测手机号码
formatMsgTime
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment