Browse Source

no message

feature/v1.2
xpz2018 5 years ago
parent
commit
143b52489d
11 changed files with 12 additions and 124 deletions
  1. 1
      app.js
  2. 60
      components/notify/index.js
  3. 6
      components/notify/index.json
  4. 7
      components/notify/index.wxml
  5. 1
      components/notify/index.wxss
  6. 42
      components/notify/notify.js
  7. 4
      pages/home/index/index.wxml
  8. 4
      pages/home/mobile/index.wxml
  9. 5
      pages/index/index.js
  10. 1
      pages/message/notification/index.js
  11. 5
      pages/process/index/index.wxml

1
app.js

@ -5,6 +5,7 @@ App({
version: 152, version: 152,
xAppId: '503258978847953926', xAppId: '503258978847953926',
userInfo: null, userInfo: null,
msgIdList: [],
//----------------------------------------------globalData-------------------------------------- //----------------------------------------------globalData--------------------------------------
globalData: { globalData: {
token: null, token: null,

60
components/notify/index.js

@ -1,60 +0,0 @@
import { VantComponent } from '../common/component';
import { WHITE } from '../common/color';
VantComponent({
props: {
message: String,
background: String,
type: {
type: String,
value: 'danger'
},
color: {
type: String,
value: WHITE
},
duration: {
type: Number,
value: 3000
},
zIndex: {
type: Number,
value: 110
},
safeAreaInsetTop: {
type: Boolean,
value: false
}
},
data: {
show: false,
},
created() {
const { statusBarHeight } = wx.getSystemInfoSync();
this.setData({ statusBarHeight });
},
methods: {
show() {
const { duration, onOpened } = this.data;
clearTimeout(this.timer);
this.setData({ show: true });
wx.nextTick(onOpened);
if (duration > 0 && duration !== Infinity) {
this.timer = setTimeout(() => {
this.hide();
}, duration);
}
},
hide() {
const { onClose } = this.data;
clearTimeout(this.timer);
this.setData({ show: false });
wx.nextTick(onClose);
},
onTap(event) {
const { onClick } = this.data;
if (onClick) {
onClick(event.detail);
}
}
}
});

6
components/notify/index.json

@ -1,6 +0,0 @@
{
"component": true,
"usingComponents": {
"van-transition": "../transition/index"
}
}

7
components/notify/index.wxml

@ -1,7 +0,0 @@
<van-transition name="slide-down" show="{{ show }}" custom-class="van-notify__container"
custom-style="z-index: {{ zIndex }};" bind:tap="onTap">
<view class="van-notify van-notify--{{ type }}" style="background:{{ background }};color:{{ color }};">
<view wx:if="{{ safeAreaInsetTop }}" style="height: {{ statusBarHeight }}px"></view>
<text>{{ message }}</text>
</view>
</van-transition>

1
components/notify/index.wxss

@ -1 +0,0 @@
@import '../common/index.wxss';.van-notify{text-align:center;word-wrap:break-word;padding:6px 15px;padding:var(--notify-padding,6px 15px);font-size:14px;font-size:var(--notify-font-size,14px);line-height:20px;line-height:var(--notify-line-height,20px)}.van-notify__container{position:fixed;top:0;box-sizing:border-box;width:100%}.van-notify--primary{background-color:#1989fa;background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:#07c160;background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:#ee0a24;background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:#ff976a;background-color:var(--notify-warning-background-color,#ff976a)}

42
components/notify/notify.js

@ -1,42 +0,0 @@
import { WHITE } from '../common/color';
const defaultOptions = {
selector: '#van-notify',
type: 'danger',
message: '',
background: '',
duration: 3000,
zIndex: 110,
color: WHITE,
safeAreaInsetTop: false,
onClick: () => { },
onOpened: () => { },
onClose: () => { }
};
function parseOptions(message) {
return typeof message === 'string' ? { message } : message;
}
function getContext() {
const pages = getCurrentPages();
return pages[pages.length - 1];
}
export default function Notify(options) {
options = Object.assign(Object.assign({}, defaultOptions), parseOptions(options));
const context = options.context || getContext();
const notify = context.selectComponent(options.selector);
delete options.context;
delete options.selector;
if (notify) {
notify.setData(options);
notify.show();
return notify;
}
console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确');
}
Notify.clear = function (options) {
options = Object.assign(Object.assign({}, defaultOptions), parseOptions(options));
const context = options.context || getContext();
const notify = context.selectComponent(options.selector);
if (notify) {
notify.hide();
}
};

4
pages/home/index/index.wxml

@ -88,12 +88,12 @@
<text class="text-sg" style="margin-left:12rpx">修改手机号码</text> <text class="text-sg" style="margin-left:12rpx">修改手机号码</text>
</view> </view>
</van-cell> </van-cell>
<van-cell is-link clickable bind:click="loginOut">
<!-- <van-cell is-link clickable bind:click="loginOut">
<view class="flex" slot="title" style="align-items: center"> <view class="flex" slot="title" style="align-items: center">
<van-icon name="setting-o" size="18" /> <van-icon name="setting-o" size="18" />
<text class="text-sg" style="margin-left:12rpx">退出当前账号</text> <text class="text-sg" style="margin-left:12rpx">退出当前账号</text>
</view> </view>
</van-cell>
</van-cell> -->
</van-cell-group> </van-cell-group>
<view style="height:16rpx"></view> <view style="height:16rpx"></view>

4
pages/home/mobile/index.wxml

@ -23,4 +23,6 @@
<view class="flex flex-direction" style="padding:120rpx 32rpx"> <view class="flex flex-direction" style="padding:120rpx 32rpx">
<van-button block type="info" bind:click="submitForm" disabled="{{loginEnable}}">提交</van-button> <van-button block type="info" bind:click="submitForm" disabled="{{loginEnable}}">提交</van-button>
</view>
</view>
<notification id="qn-notification"/>

5
pages/index/index.js

@ -52,11 +52,8 @@ Scene({
} }
}, },
fetchMessage: function(){ fetchMessage: function(){
getMessageList({productType: 'ZTB_FACTORY'}).then(result => {
getMessageList({ productType: 'ZTB_FACTORY', status: 0 }).then(result => {
if(result.data && result.data.records && result.data.records.length){ if(result.data && result.data.records && result.data.records.length){
// if(result.data.records[0].status == 1){
// return
// }
let pages = getCurrentPages() //当前页面栈 let pages = getCurrentPages() //当前页面栈
let nowPage = pages[pages.length - 1] //当前页面 let nowPage = pages[pages.length - 1] //当前页面
if(nowPage.onNotice){ if(nowPage.onNotice){

1
pages/message/notification/index.js

@ -1,5 +1,6 @@
// pages/setting/notification.js // pages/setting/notification.js
import { readMessage } from "../../../api/saas" import { readMessage } from "../../../api/saas"
const util = require('../../../utils/util')
const app = getApp() const app = getApp()
Component({ Component({

5
pages/process/index/index.wxml

@ -105,6 +105,10 @@
<view class="bg-white" style="border-radius: 20rpx;padding: 24rpx 0rpx 8rpx 0rpx"> <view class="bg-white" style="border-radius: 20rpx;padding: 24rpx 0rpx 8rpx 0rpx">
<view class="flex flex-justify" style="padding: 0rpx 28rpx 24rpx 28rpx"> <view class="flex flex-justify" style="padding: 0rpx 28rpx 24rpx 28rpx">
<view class="text-black text-sg text-bold">千鸟代付额度</view> <view class="text-black text-sg text-bold">千鸟代付额度</view>
<view class="flex flex-center" style="padding:4rpx 0rpx 4rpx 4rpx">
<view class="text-gray text-sm" style="margin-right:8rpx">查看详情</view>
<van-icon name="arrow" color="#aaa"/>
</view>
</view> </view>
<view class="flex" style="padding:0rpx 0rpx 24rpx 0rpx" bindtap="agentList"> <view class="flex" style="padding:0rpx 0rpx 24rpx 0rpx" bindtap="agentList">
<view style="flex:1;padding:0rpx 32rpx;margin-right:12rpx"> <view style="flex:1;padding:0rpx 32rpx;margin-right:12rpx">
@ -125,7 +129,6 @@
</view> </view>
</view> </view>
</view> </view>
<view style="height:24rpx;"></view> <view style="height:24rpx;"></view>
</scroll-view> </scroll-view>

Loading…
Cancel
Save