Browse Source

2023-3-17

消息通知
master
guoxing 2 years ago
parent
commit
a049d9905c
  1. 32
      mallplusui-uniapp-app/.hbuilderx/launch.json
  2. 106
      mallplusui-uniapp-app/App.vue
  3. 5
      mallplusui-uniapp-app/common/api.js
  4. 3
      mallplusui-uniapp-app/manifest.json
  5. 17
      mallplusui-uniapp-app/pages/index/messageList.vue
  6. 3
      mallplusui-uniapp-app/pages/public/login.vue
  7. 4
      mallplusui-uniapp-app/pages/set/set.vue
  8. 72
      mallplusui-uniapp-app/pagesA/product/product.vue
  9. 2
      mallplusui-uniapp-app/pagesU/user/forget.vue

32
mallplusui-uniapp-app/.hbuilderx/launch.json

@ -1,16 +1,20 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ {
// launchtypelocalremote, localremote // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
"version": "0.0", // launchtypelocalremote, localremote
"configurations": [{ "version" : "0.0",
"app-plus" : "configurations" : [
{ {
"launchtype" : "local" "app-plus" : {
}, "launchtype" : "local"
"default" : },
{ "default" : {
"launchtype" : "local" "launchtype" : "local"
}, },
"type" : "uniCloud" "type" : "uniCloud"
} },
{
"playground" : "custom",
"type" : "uni-app:app-android"
}
] ]
} }

106
mallplusui-uniapp-app/App.vue

@ -1,4 +1,5 @@
<script> <script>
import index from '@/store/index.js';
import Api from '@/common/api'; import Api from '@/common/api';
// #ifdef APP-PLUS // #ifdef APP-PLUS
import APPUpdate from "plugins/APPUpdate/index.js"; import APPUpdate from "plugins/APPUpdate/index.js";
@ -54,6 +55,7 @@
getCid() { getCid() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
var t1_time = 0; var t1_time = 0;
let that = this;
var t1 = setInterval(function() { var t1 = setInterval(function() {
var cid = plus.push.getClientInfo().clientid; var cid = plus.push.getClientInfo().clientid;
console.log(cid != undefined, cid != "undefined", cid) console.log(cid != undefined, cid != "undefined", cid)
@ -61,43 +63,99 @@
if (cid != null || cid != "null") { if (cid != null || cid != "null") {
uni.setStorageSync('cid', cid); uni.setStorageSync('cid', cid);
clearInterval(t1); clearInterval(t1);
that.pushCid();
return return
} }
}, 130); }, 130);
// #endif // #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() { handlePush() {
let that = this;
// #ifdef APP-PLUS // #ifdef APP-PLUS
const _handlePush = function(message) { const _handlePush = function(message) {
console.log("message>>>>>>>>>>", message) console.log("message>>>>>>>>>>", message)
uni.setStorageSync('message', message); console.log("payload>>>>>>>>>>", message.payload.code)
获取自定义信息 // uni.setStorageSync('message', message);
let payload = message.payload; //
// let payload = message.payload;
// uni.switchTab({ // console.log("payload>>>>>>>>>>", payload.code)
// url: `${payload.path}` if ("系统消息" == message.payload.code) {
// }) //
console.log("系统消息>>>>>>>>>>", message.payload.code)
// uni.navigateTo({ that.goToMessageDetail(message.payload)
// url: '/pages/index/messageDetail', } else {
// // 2.8.9+ //
// success: (res) => {
// // , $emit if (that.hasLogin) {
// res.eventChannel.emit('sendTestValue', { //
// info: item console.log("登录状态>>>>>>>>>>", message.payload.code)
// }) that.goToMessageDetail(message.payload)
// } } else {
// });
//
console.log("非登录状态>>>>>>>>>>", message.payload.code)
// uni.navigateTo({
// 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) plus.push.addEventListener('receive', _handlePush)
// #endif // #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() { onLaunch: function() {
// uni.removeStorageSync('userInfo'); // uni.removeStorageSync('userInfo');
@ -108,14 +166,14 @@
console.log('App onLaunch>>>', userInfo) console.log('App onLaunch>>>', userInfo)
console.log('App onLaunch>>>', token) console.log('App onLaunch>>>', token)
if (token) { if (token) {
index.state.hasLogin = true
// //
uni.getStorage({ uni.getStorage({
key: 'userInfo', key: 'userInfo',
success: (res) => { data: userInfo
console.log('App onLaunch>>', res)
this.login(res.data);
}
}); });
console.log('hasLogin>>>', index.state.hasLogin)
} }
let isWeiXin = this.$common.isWeiXinBrowser() let isWeiXin = this.$common.isWeiXinBrowser()
@ -135,7 +193,7 @@
this.handlePush(); this.handlePush();
this.getCid(); this.getCid();
console.log('App onLaunch111111111111>>>', token) // console.log('App onLaunch111111111111>>>', token)
// let sss = { // let sss = {
// "url": "http://mall.yyundong.com/portalapi/api/appVersion/versioninfo", // "url": "http://mall.yyundong.com/portalapi/api/appVersion/versioninfo",
// "resolve": { // "resolve": {

5
mallplusui-uniapp-app/common/api.js

@ -2,8 +2,8 @@ import store from '../store/index';
export default { export default {
// qq 237524947 wx15d4269d3210863d // qq 237524947 wx15d4269d3210863d
// BASEURI: 'http://192.168.3.9:8083/api/', // BASEURI: 'http://192.168.3.9:8083/api/',
BASEURI: 'http://mall.yyundong.com/portalapi/api/', // BASEURI: 'http://mall.yyundong.com/portalapi/api/',
// BASEURI: 'http://192.168.31.52:8083/api/', BASEURI: 'http://192.168.3.116:8083/api/',
ADMINURI: 'http://mall.yyundong.com/adminapi/', ADMINURI: 'http://mall.yyundong.com/adminapi/',
ESURI: 'http://www.yyundong.com:8081/', ESURI: 'http://www.yyundong.com:8081/',
h5Appid: 'wxb4660f37187c0b8e', // h5微信登录的appId 暂时测试用 h5Appid: 'wxb4660f37187c0b8e', // h5微信登录的appId 暂时测试用
@ -55,6 +55,7 @@ export default {
storeCommentList: 'single/store/storeComment/list', // 商户评论 storeCommentList: 'single/store/storeComment/list', // 商户评论
noticeList: 'single/home/notice/list', noticeList: 'single/home/notice/list',
noticeDetail: 'single/home/notice/detail', noticeDetail: 'single/home/notice/detail',
pushCid: 'single/home/pushCid',// 保存cid
}, },
member: { member: {
applyMember: 'single/user/applyMember', // 会员升级等级 applyMember: 'single/user/applyMember', // 会员升级等级

3
mallplusui-uniapp-app/manifest.json

@ -56,7 +56,8 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>", "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH\"/>", "<uses-permission android:name=\"android.permission.BLUETOOTH\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>" "<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>"
] ],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
}, },
"ios" : { "ios" : {
"dSYMs" : false "dSYMs" : false

17
mallplusui-uniapp-app/pages/index/messageList.vue

@ -4,7 +4,7 @@
<view v-for="(item, index) in goodsList" :key="index" class="goods-item"> <view v-for="(item, index) in goodsList" :key="index" class="goods-item">
<view class="listcard" @click="navToDetailPage(item)"> <view class="listcard" @click="navToDetailPage(item)">
<view class="listcard-image"> <view class="listcard-image">
<image :src="item.code=='交易物流'?pic1:pic2" mode="aspectFill"></image> <image :src="typeUrl(item)" mode="aspectFill"></image>
</view> </view>
<view class="listcard-content"> <view class="listcard-content">
<view class="listcard-content_title"> <view class="listcard-content_title">
@ -33,6 +33,7 @@
pageNum: 1, pageNum: 1,
pic1: "http://mall.yyundong.com/wl.png", pic1: "http://mall.yyundong.com/wl.png",
pic2: "http://mall.yyundong.com/tx.png", pic2: "http://mall.yyundong.com/tx.png",
pic3: "http://mall.yyundong.com/tz.png",
goodsList: [ goodsList: [
// { // {
// title: "", // title: "",
@ -70,7 +71,7 @@
}, },
// //
onPullDownRefresh() { onPullDownRefresh() {
this.pageNum = this.pageNum + 1; this.pageNum = 1;
this.loadData('refresh'); this.loadData('refresh');
}, },
// //
@ -85,6 +86,14 @@
}, },
}, },
methods: { 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) { async loadData(type = 'add', loading) {
// //
@ -96,7 +105,9 @@
} else { } else {
this.loadingType = 'more'; this.loadingType = 'more';
} }
let params = {}; let params = {
// pageNum: this.pageNum
};
let list = await Api.apiCall('get', Api.member.mesList, params); let list = await Api.apiCall('get', Api.member.mesList, params);

3
mallplusui-uniapp-app/pages/public/login.vue

@ -525,6 +525,7 @@
authCode: this.code, authCode: this.code,
cid: uni.getStorageSync('cid') cid: uni.getStorageSync('cid')
}; };
console.log("params>>>>", params);
let data = await Api.apiCall('post', Api.index.loginByCode, params); let data = await Api.apiCall('post', Api.index.loginByCode, params);
//this.logining = false; //this.logining = false;
if (data) { if (data) {
@ -552,7 +553,7 @@
password: this.password, password: this.password,
cid: uni.getStorageSync('cid') cid: uni.getStorageSync('cid')
}; };
console.log("params>>>>",params); console.log("params>>>>", params);
let data = await Api.apiCall('post', Api.index.login, params); let data = await Api.apiCall('post', Api.index.login, params);
if (data) { if (data) {
console.log(data); console.log(data);

4
mallplusui-uniapp-app/pages/set/set.vue

@ -82,7 +82,9 @@
if (e.confirm) { if (e.confirm) {
this.logout(); this.logout();
this.$db.del('token'); this.$db.del('token');
Api.apiCall('post', Api.index.logout, {}); Api.apiCall('post', Api.index.logout, {
cid: uni.getStorageSync('cid')
});
setTimeout(() => { setTimeout(() => {
uni.navigateBack(); uni.navigateBack();
uni.removeStorageSync('userInfo'); uni.removeStorageSync('userInfo');

72
mallplusui-uniapp-app/pagesA/product/product.vue

@ -257,6 +257,8 @@
let detailData = data.goods; let detailData = data.goods;
let goods = detailData.goods; let goods = detailData.goods;
this.goods = goods; this.goods = goods;
console.log("goods》》》》》",goods)
console.log("goods.price》》》》》",goods.price)
this.favorite = data.favorite; this.favorite = data.favorite;
this.typeGoodsList = detailData.typeGoodsList; this.typeGoodsList = detailData.typeGoodsList;
var subImages = goods.albumPics; var subImages = goods.albumPics;
@ -316,41 +318,41 @@
this.couponList = couponList1; this.couponList = couponList1;
} }
// // //
if (this.specList) { // if (this.specList) {
var specs = ''; // var specs = '';
this.specList.forEach(item => { // this.specList.forEach(item => {
for (let cItem of this.specChildList) { // for (let cItem of this.specChildList) {
if (cItem.pid === item.id) { // if (cItem.pid === item.id) {
this.$set(cItem, 'selected', true); // this.$set(cItem, 'selected', true);
this.specSelected.push(cItem); // this.specSelected.push(cItem);
specs = cItem.name + ',' + specs; // specs = cItem.name + ',' + specs;
break; //forEach使break // break; //forEach使break
} // }
} // }
}); // });
let valuesA = specs.substr(0, specs.length - 1).split(','); // let valuesA = specs.substr(0, specs.length - 1).split(',');
this.skuList.forEach(item => { // this.skuList.forEach(item => {
if (valuesA.length == 1 && item.sp1 == valuesA[0]) { // if (valuesA.length == 1 && item.sp1 == valuesA[0]) {
this.sku = item; // this.sku = item;
} // }
if (valuesA.length == 2 && item.sp2 == valuesA[0] && item.sp1 == valuesA[1]) { // if (valuesA.length == 2 && item.sp2 == valuesA[0] && item.sp1 == valuesA[1]) {
this.sku = item; // this.sku = item;
} // }
if (valuesA.length == 3 && item.sp3 == valuesA[0] && item.sp2 == valuesA[1] && item.sp1 == // if (valuesA.length == 3 && item.sp3 == valuesA[0] && item.sp2 == valuesA[1] && item.sp1 ==
valuesA[2]) { // valuesA[2]) {
this.sku = item; // this.sku = item;
} // }
if (!this.sku.pic) { // if (!this.sku.pic) {
this.sku.pic = this.goods.pic; // this.sku.pic = this.goods.pic;
} // }
if (!this.sku.stock) { // if (!this.sku.stock) {
this.sku.stock = 0; // this.sku.stock = 0;
} // }
this.goods.price = this.sku.price; // this.goods.price = this.sku.price;
}); // });
} // }
}, },
computed: { computed: {
...mapState(['hasLogin', 'userInfo']) ...mapState(['hasLogin', 'userInfo'])

2
mallplusui-uniapp-app/pagesU/user/forget.vue

@ -169,7 +169,7 @@
let _this = this; let _this = this;
// //
if (this.verifTime == 0) { if (this.verifTime == 0) {
if (!/^1[1234567890]\d{9}$/.test(this.phone)) { if (!/^1[3456789]\d{9}$/.test(this.phone)) {
uni.showToast({ uni.showToast({
title: '电话号码有误,请重新输入', title: '电话号码有误,请重新输入',
icon: 'none' icon: 'none'

Loading…
Cancel
Save