2023-3-17
消息通知
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||
{
|
||||
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||
"version" : "0.0",
|
||||
"configurations": [{
|
||||
"app-plus" :
|
||||
"configurations" : [
|
||||
{
|
||||
"app-plus" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" :
|
||||
{
|
||||
"default" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
},
|
||||
{
|
||||
"playground" : "custom",
|
||||
"type" : "uni-app:app-android"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script>
|
||||
import index from '@/store/index.js';
|
||||
import Api from '@/common/api';
|
||||
// #ifdef APP-PLUS
|
||||
import APPUpdate from "plugins/APPUpdate/index.js";
|
||||
@@ -54,6 +55,7 @@
|
||||
getCid() {
|
||||
// #ifdef APP-PLUS
|
||||
var t1_time = 0;
|
||||
let that = this;
|
||||
var t1 = setInterval(function() {
|
||||
var cid = plus.push.getClientInfo().clientid;
|
||||
console.log(cid != undefined, cid != "undefined", cid)
|
||||
@@ -61,43 +63,99 @@
|
||||
if (cid != null || cid != "null") {
|
||||
uni.setStorageSync('cid', cid);
|
||||
clearInterval(t1);
|
||||
that.pushCid();
|
||||
return
|
||||
}
|
||||
}, 130);
|
||||
// #endif
|
||||
},
|
||||
async pushCid() {
|
||||
console.log('pushCid1111111>>>>>')
|
||||
let params = {
|
||||
cid: uni.getStorageSync('cid')
|
||||
};
|
||||
console.log("pushCid>>>>", params);
|
||||
let data = await Api.apiCall('post', Api.index.pushCid, params);
|
||||
console.log('pushCid22222222>>>>>', data)
|
||||
},
|
||||
// 监听通知信息
|
||||
handlePush() {
|
||||
let that = this;
|
||||
// #ifdef APP-PLUS
|
||||
const _handlePush = function(message) {
|
||||
|
||||
console.log("message>>>>>>>>>>", message)
|
||||
uni.setStorageSync('message', message);
|
||||
获取自定义信息
|
||||
let payload = message.payload;
|
||||
console.log("payload>>>>>>>>>>", message.payload.code)
|
||||
// uni.setStorageSync('message', message);
|
||||
//获取自定义信息
|
||||
// let payload = message.payload;
|
||||
// console.log("payload>>>>>>>>>>", payload.code)
|
||||
if ("系统消息" == message.payload.code) {
|
||||
// 系统消息
|
||||
console.log("系统消息>>>>>>>>>>", message.payload.code)
|
||||
that.goToMessageDetail(message.payload)
|
||||
} else {
|
||||
// 非系统消息
|
||||
|
||||
// uni.switchTab({
|
||||
// url: `${payload.path}`
|
||||
// })
|
||||
if (that.hasLogin) {
|
||||
// 登录状态
|
||||
console.log("登录状态>>>>>>>>>>", message.payload.code)
|
||||
that.goToMessageDetail(message.payload)
|
||||
} else {
|
||||
|
||||
// 非登录状态
|
||||
console.log("非登录状态>>>>>>>>>>", message.payload.code)
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/index/messageDetail',
|
||||
// // 版本2.8.9+ 支持
|
||||
// success: (res) => {
|
||||
// // 和上面其实没差什么,但是这种方式是可以的 这里不是$emit
|
||||
// res.eventChannel.emit('sendTestValue', {
|
||||
// info: item
|
||||
// })
|
||||
// }
|
||||
// url: "/pages/public/login"
|
||||
// });
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
uni.switchTab({
|
||||
url: '/pages/index/messageList'
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 事件处理
|
||||
plus.push.addEventListener('click', _handlePush)
|
||||
|
||||
// 从系统消息中心点击消息启动应用事件
|
||||
// plus.push.addEventListener('click', _handlePush)
|
||||
// 应用从推送服务器接收到推送消息事件
|
||||
plus.push.addEventListener('receive', _handlePush)
|
||||
// #endif
|
||||
},
|
||||
|
||||
goToMessageDetail(payload) {
|
||||
|
||||
let item = {
|
||||
params: payload.params,
|
||||
code: payload.code,
|
||||
ctime: payload.ctime,
|
||||
content: payload.content,
|
||||
}
|
||||
console.log("goToMessageDetail>>>>>>>>>>", item)
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/messageDetail',
|
||||
// 版本2.8.9+ 支持
|
||||
success: (res) => {
|
||||
// 和上面其实没差什么,但是这种方式是可以的 这里不是$emit
|
||||
res.eventChannel.emit('sendTestValue', {
|
||||
info: item
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
onLaunch: function() {
|
||||
// uni.removeStorageSync('userInfo');
|
||||
@@ -108,14 +166,14 @@
|
||||
console.log('App onLaunch>>>', userInfo)
|
||||
console.log('App onLaunch>>>', token)
|
||||
if (token) {
|
||||
index.state.hasLogin = true
|
||||
//更新登陆状态
|
||||
uni.getStorage({
|
||||
key: 'userInfo',
|
||||
success: (res) => {
|
||||
console.log('App onLaunch>>', res)
|
||||
this.login(res.data);
|
||||
}
|
||||
data: userInfo
|
||||
});
|
||||
|
||||
console.log('hasLogin>>>', index.state.hasLogin)
|
||||
}
|
||||
|
||||
let isWeiXin = this.$common.isWeiXinBrowser()
|
||||
@@ -135,7 +193,7 @@
|
||||
|
||||
this.handlePush();
|
||||
this.getCid();
|
||||
console.log('App onLaunch111111111111>>>', token)
|
||||
// console.log('App onLaunch111111111111>>>', token)
|
||||
// let sss = {
|
||||
// "url": "http://mall.yyundong.com/portalapi/api/appVersion/versioninfo",
|
||||
// "resolve": {
|
||||
|
||||
@@ -2,8 +2,8 @@ import store from '../store/index';
|
||||
export default {
|
||||
// qq 237524947 wx15d4269d3210863d
|
||||
// BASEURI: 'http://192.168.3.9:8083/api/',
|
||||
BASEURI: 'http://mall.yyundong.com/portalapi/api/',
|
||||
// BASEURI: 'http://192.168.31.52:8083/api/',
|
||||
// BASEURI: 'http://mall.yyundong.com/portalapi/api/',
|
||||
BASEURI: 'http://192.168.3.116:8083/api/',
|
||||
ADMINURI: 'http://mall.yyundong.com/adminapi/',
|
||||
ESURI: 'http://www.yyundong.com:8081/',
|
||||
h5Appid: 'wxb4660f37187c0b8e', // h5微信登录的appId 暂时测试用
|
||||
@@ -55,6 +55,7 @@ export default {
|
||||
storeCommentList: 'single/store/storeComment/list', // 商户评论
|
||||
noticeList: 'single/home/notice/list',
|
||||
noticeDetail: 'single/home/notice/detail',
|
||||
pushCid: 'single/home/pushCid',// 保存cid
|
||||
},
|
||||
member: {
|
||||
applyMember: 'single/user/applyMember', // 会员升级等级
|
||||
|
||||
@@ -56,7 +56,8 @@
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.BLUETOOTH\"/>",
|
||||
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>"
|
||||
]
|
||||
],
|
||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
|
||||
},
|
||||
"ios" : {
|
||||
"dSYMs" : false
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view v-for="(item, index) in goodsList" :key="index" class="goods-item">
|
||||
<view class="listcard" @click="navToDetailPage(item)">
|
||||
<view class="listcard-image">
|
||||
<image :src="item.code=='交易物流'?pic1:pic2" mode="aspectFill"></image>
|
||||
<image :src="typeUrl(item)" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="listcard-content">
|
||||
<view class="listcard-content_title">
|
||||
@@ -33,6 +33,7 @@
|
||||
pageNum: 1,
|
||||
pic1: "http://mall.yyundong.com/wl.png",
|
||||
pic2: "http://mall.yyundong.com/tx.png",
|
||||
pic3: "http://mall.yyundong.com/tz.png",
|
||||
goodsList: [
|
||||
// {
|
||||
// title: "交易物流",
|
||||
@@ -70,7 +71,7 @@
|
||||
},
|
||||
//下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.pageNum = this.pageNum + 1;
|
||||
this.pageNum = 1;
|
||||
this.loadData('refresh');
|
||||
},
|
||||
//加载更多
|
||||
@@ -85,6 +86,14 @@
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
typeUrl(item) {
|
||||
if ("交易物流" == item.code)
|
||||
return this.pic1
|
||||
if ("云链助手" == item.code)
|
||||
return this.pic2
|
||||
if ("系统消息" == item.code)
|
||||
return this.pic3
|
||||
},
|
||||
//加载商品 ,带下拉刷新和上滑加载
|
||||
async loadData(type = 'add', loading) {
|
||||
//没有更多直接返回
|
||||
@@ -96,7 +105,9 @@
|
||||
} else {
|
||||
this.loadingType = 'more';
|
||||
}
|
||||
let params = {};
|
||||
let params = {
|
||||
// pageNum: this.pageNum
|
||||
};
|
||||
|
||||
|
||||
let list = await Api.apiCall('get', Api.member.mesList, params);
|
||||
|
||||
@@ -525,6 +525,7 @@
|
||||
authCode: this.code,
|
||||
cid: uni.getStorageSync('cid')
|
||||
};
|
||||
console.log("params>>>>", params);
|
||||
let data = await Api.apiCall('post', Api.index.loginByCode, params);
|
||||
//this.logining = false;
|
||||
if (data) {
|
||||
|
||||
@@ -82,7 +82,9 @@
|
||||
if (e.confirm) {
|
||||
this.logout();
|
||||
this.$db.del('token');
|
||||
Api.apiCall('post', Api.index.logout, {});
|
||||
Api.apiCall('post', Api.index.logout, {
|
||||
cid: uni.getStorageSync('cid')
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
uni.removeStorageSync('userInfo');
|
||||
|
||||
@@ -257,6 +257,8 @@
|
||||
let detailData = data.goods;
|
||||
let goods = detailData.goods;
|
||||
this.goods = goods;
|
||||
console.log("goods》》》》》",goods)
|
||||
console.log("goods.price》》》》》",goods.price)
|
||||
this.favorite = data.favorite;
|
||||
this.typeGoodsList = detailData.typeGoodsList;
|
||||
var subImages = goods.albumPics;
|
||||
@@ -316,41 +318,41 @@
|
||||
this.couponList = couponList1;
|
||||
}
|
||||
|
||||
//规格 默认选中第一条
|
||||
if (this.specList) {
|
||||
var specs = '';
|
||||
this.specList.forEach(item => {
|
||||
for (let cItem of this.specChildList) {
|
||||
if (cItem.pid === item.id) {
|
||||
this.$set(cItem, 'selected', true);
|
||||
this.specSelected.push(cItem);
|
||||
specs = cItem.name + ',' + specs;
|
||||
break; //forEach不能使用break
|
||||
}
|
||||
}
|
||||
});
|
||||
let valuesA = specs.substr(0, specs.length - 1).split(',');
|
||||
// //规格 默认选中第一条
|
||||
// if (this.specList) {
|
||||
// var specs = '';
|
||||
// this.specList.forEach(item => {
|
||||
// for (let cItem of this.specChildList) {
|
||||
// if (cItem.pid === item.id) {
|
||||
// this.$set(cItem, 'selected', true);
|
||||
// this.specSelected.push(cItem);
|
||||
// specs = cItem.name + ',' + specs;
|
||||
// break; //forEach不能使用break
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// let valuesA = specs.substr(0, specs.length - 1).split(',');
|
||||
|
||||
this.skuList.forEach(item => {
|
||||
if (valuesA.length == 1 && item.sp1 == valuesA[0]) {
|
||||
this.sku = item;
|
||||
}
|
||||
if (valuesA.length == 2 && item.sp2 == valuesA[0] && item.sp1 == valuesA[1]) {
|
||||
this.sku = item;
|
||||
}
|
||||
if (valuesA.length == 3 && item.sp3 == valuesA[0] && item.sp2 == valuesA[1] && item.sp1 ==
|
||||
valuesA[2]) {
|
||||
this.sku = item;
|
||||
}
|
||||
if (!this.sku.pic) {
|
||||
this.sku.pic = this.goods.pic;
|
||||
}
|
||||
if (!this.sku.stock) {
|
||||
this.sku.stock = 0;
|
||||
}
|
||||
this.goods.price = this.sku.price;
|
||||
});
|
||||
}
|
||||
// this.skuList.forEach(item => {
|
||||
// if (valuesA.length == 1 && item.sp1 == valuesA[0]) {
|
||||
// this.sku = item;
|
||||
// }
|
||||
// if (valuesA.length == 2 && item.sp2 == valuesA[0] && item.sp1 == valuesA[1]) {
|
||||
// this.sku = item;
|
||||
// }
|
||||
// if (valuesA.length == 3 && item.sp3 == valuesA[0] && item.sp2 == valuesA[1] && item.sp1 ==
|
||||
// valuesA[2]) {
|
||||
// this.sku = item;
|
||||
// }
|
||||
// if (!this.sku.pic) {
|
||||
// this.sku.pic = this.goods.pic;
|
||||
// }
|
||||
// if (!this.sku.stock) {
|
||||
// this.sku.stock = 0;
|
||||
// }
|
||||
// this.goods.price = this.sku.price;
|
||||
// });
|
||||
// }
|
||||
},
|
||||
computed: {
|
||||
...mapState(['hasLogin', 'userInfo'])
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
let _this = this;
|
||||
// 验证是否已进行验证码操作
|
||||
if (this.verifTime == 0) {
|
||||
if (!/^1[1234567890]\d{9}$/.test(this.phone)) {
|
||||
if (!/^1[3456789]\d{9}$/.test(this.phone)) {
|
||||
uni.showToast({
|
||||
title: '电话号码有误,请重新输入',
|
||||
icon: 'none'
|
||||
|
||||
Reference in New Issue
Block a user