123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- <script>
- import api from "./library/index.js"
- import http from "./library/http.js"
- export default {
- data() {
- return {
- state: 0
- };
- },
- methods: {
- check_update() {
- /** 检测升级 */
- // #ifdef APP-PLUS
- let _this = this;
- plus.runtime.getProperty(plus.runtime.appid, function(info) {
- api.update({
- version: info.version,
- osname: plus.os.name
- }).then(res => {
- console.log(res);
- if (res.data.status == 1) {
- uni.navigateTo({
- url: '/pages/index/upApp'
- })
- // uni.showModal({ //提醒用户更新
- // title: "更新提示",
- // content: res.data.content,
- // cancelText: '下次再说',
- // confirmText: '立即更新',
- // success: (r) => {
- // if (r.confirm) {
- // plus.runtime.openURL(res.data.downurl);
- // }
- // }
- // })
- }
- })
- });
- // #endif
- },
- tochat(message) {
- if (uni.getStorageSync('ispush') != false) {
- if (message.id > 0) {
- var url = "pages/friend/chat?id=" + message.id;
- if (message.type == 'group') url = "pages/group/chat?id=" + message.id;
- uni.navigateTo({
- url: url
- })
- // console.log(url)
- } else {
- uni.navigateTo({
- url: 'pages/index/index',
- success: () => {
- uni.setStorageSync('ispush', false)
- }
- })
- }
- }
- },
- handlePush(message, type) {
- try {
- message = JSON.parse(message);
- } catch (e) {
- //TODO handle the exception
- }
- if (message.payload != undefined) {
- message = message.payload;
- try {
- message = JSON.parse(message);
- } catch (e) {
- //TODO handle the exception
- }
- }
- uni.setStorageSync('ispush', true);
- uni.setStorageSync('pushmessage', message)
- if (type == 'click') {
- var that = this;
- uni.$emit('toChat', message);
- } else {
- if(state==0){
- console.log(message);
- plus.push.createMessage(message.content, JSON.stringify(message), {
- cover: true,
- title: message.title
- });
- }
- }
- },
- bindcid() {
- var user = uni.getStorageSync('userInfo');
- if (user.id > 0) {
-
- var clientid= plus.push.getClientInfo().clientid;
-
- http.setWait(false).get('index.php?act=bindcid',{cid:clientid,userid:user.id,osname:plus.os.name}).then(res=>{
-
- })
- }
- },
- client_change(isonline) {
- this.state = isonline;
- // #ifdef APP-PLUS
-
- if(isonline==1) plus.push.clear();
- var clientid= plus.push.getClientInfo().clientid;
- http.setWait(false).get('index.php?act=client_change',{cid:clientid,isonline:isonline}).then(res=>{
-
- });
- // #endif
- }
- },
- onLaunch() {
- this.$action.init();
- // #ifdef APP-PLUS
- /** 锁定屏幕方向 */
- plus.screen.lockOrientation('portrait-primary');
- var that = this;
- // this.bindcid();
- setTimeout(function() {
- that.check_update();
- }, 1000)
- // var that = this;
- //监听push推送通知
- plus.push.addEventListener('receive', function(message) {
- // console.log('receive')
- that.handlePush(message, 'receive');
- });
- //监听点击通知栏
- plus.push.addEventListener('click', function(message) {
- that.handlePush(message, 'click');
- });
- // #endif
- },
- onHide() {
- this.client_change(0);
- // var message={title:'标题测试',content:'内容2222',id:86668,type:'friend'}
- // plus.push.createMessage(message.content, JSON.stringify(message), {
- // cover: true,
- // title: message.title
- // });
- // console.log(message);
- // uni.createPushMessage({
- // title: '测试',
- // content: '测试内容',
- // complete(e) {
- // console.log(e,'err')
- // }
- // })
- },
- onShow() {
- this.client_change(1);
- },
- }
- </script>
- <style lang="scss">
- // 图标字体
- @font-face {
- font-family: fonticon;
- src: url('~@/static/iconfont.ttf');
- }
- .emoji {
- font-family: fonticon;
- font-size: 44upx;
- }
- // 所有页面都应该使用该类类初始化页面背景、大小和盒子模型
- .page {
- -webkit-touch-callout: none;
- /*系统默认菜单被禁用*/
- -webkit-user-select: none;
- /*webkit浏览器*/
- -khtml-user-select: none;
- /*早起浏览器*/
- -moz-user-select: none;
- /*火狐浏览器*/
- -ms-user-select: none;
- /*IE浏览器*/
- user-select: none;
- /*用户是否能够选中文本*/
- background-color: #FFFFFF;
- width: 100vw;
- min-height: 100vh;
- box-sizing: border-box;
- &--divider::before {
- z-index: 100;
- position: fixed;
- top: 0;
- left: 0;
- width: 100vw;
- height: 1upx;
- background-color: #ddd;
- display: block;
- content: '';
- transform: scaleY(0.5);
- }
- }
- // 参考 https://uniapp.dcloud.io/component/navigator?id=navigator
- // 去掉 navigator 组件的默认的点击态效果
- .navigator-hover {
- position: relative;
- background-color: transparent;
- opacity: 1;
- }
- // 简单容器样式
- .widget {
- background-color: transparent;
- padding: 0px 0px;
- &+& {
- padding-top: 0;
- }
- &-inner {
- border-radius: $uni-border-radius-base;
- background-color: $uni-text-color-inverse;
- }
- &-inner+&-inner {
- margin-top: $uni-spacing-col-base;
- }
- }
- // 基本按钮样式
- .btn {
- padding: 28upx;
- border-radius: $uni-border-radius-base;
- text-align: center;
- font-size: 30upx;
- background-color: $uni-text-color-inverse;
- color: $uni-text-color;
- border: 1upx solid rgba(#000000, .1);
- &-round {
- border-radius: 100upx;
- }
- &-primary {
- background-color: $uni-color-primary;
- color: $uni-text-color-inverse;
- }
- &-success {
- background-color: $uni-color-success;
- color: $uni-text-color-inverse;
- }
- &-warning {
- background-color: $uni-color-warning;
- color: $uni-text-color-inverse;
- }
- &-error {
- background-color: $uni-color-error;
- color: $uni-text-color-inverse;
- }
- }
- .cell-wrapper {
- position: relative;
- margin-top: $uni-spacing-col-base;
- background-color: #fff;
- .cell-hd::before,
- &::before,
- &::after {
- display: block;
- content: '';
- position: absolute;
- right: 0;
- height: 1upx;
- transform: scaleY(0.5);
- background-color: #ddd;
- }
- &::before {
- left: 0;
- top: 0;
- }
- &:after {
- left: 0;
- bottom: 0;
- }
- }
- .cell {
- position: relative;
- padding: 0 $uni-spacing-row-lg;
- line-height: 106upx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- flex-direction: row;
- box-sizing: border-box;
- &:first-child &-hd::before {
- display: none;
- }
- &-hd {
- font-size: 30upx;
- &::before {
- top: 0;
- left: $uni-spacing-row-lg;
- }
- }
- &-hb {
- font-size: 30upx;
- color: #777;
- }
- &.arrow {
- padding-right: $uni-spacing-row-lg + 25upx;
- }
- &.arrow::before,
- &.arrow::after {
- position: absolute;
- transform: rotate(45deg);
- width: 20upx;
- height: 20upx;
- content: '';
- display: block;
- top: 50%;
- margin-top: -11upx;
- }
- &.arrow::before {
- background-color: #777;
- right: $uni-spacing-row-lg;
- }
- &.arrow::after {
- background-color: #fff;
- right: $uni-spacing-row-lg + 4upx;
- }
- }
- @font-face {
- font-family: "HMfont-home";
- src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAn8AAsAAAAAE1wAAAmvAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCFDAqWYJI9ATYCJANACyIABCAFhFUHgV8bThBRlFFWNdkXBXbDsSFQq221McNWrxUbYqGhiTju98MTeXqNh/9fo90388cEMe0bwSOJRIjavZIgESqnE5J5JqQVDZH/XdNfoHSAjqKqRsA+Tf/Ruya33E/bkdHsJtycY2XWAGbM5oenzf173A3lHrEilsmMbu74Y5VmYtxpgza9DMxkWL0gfjGbGRE54AL2f2ut3h2u8Q7RaZRCjDPLIv8cfAUR30MtEUWbSReVJkk0RB4lWWkNg7WVA1sBKmIUdr0uzibQOmxA4vrWwQXkJUweKHPfdwXkA+FSik2o1aVizyTegEKdvWINwGv59bEGY9GeTJFjW95pswIrzz3LYi//0O4JEaDrY3DZjxwXgUR8V3IfIeXARaloVRXT3mK/tsi3LubcJfese8l96Xbd1l1ve2z7eJp5lv3zB7URSdJNYd3Dfm7UUxxkGu0sLFcbVEa5pP3D6/QmokQw3OGzfJp/2kBkLJYQDYuziJbFJ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bjFkwL/lV6az7APzZ5qvVmmy7b1bJGrTDhmRfMBYbWMZmNOu3bJdPlLL/5WOR2XZCTJpmU4mx8lv9Fg76T8NagO4vUacJ+n/Sr0b/LYb8+1z5QCb935a0m6WWYXzwh4DO2Sa9g2jEnJ6tYwTU5jp7N2RmaHkn/gjEb/fXpmpXbkpAGaAv7pnKAfdc6bg4GZx1L3QuQ8lVC3BvXbC8f2eHQEqkBuc9aO6h9849M3oPucrgAyQY/HEv7PYJJQy23Ft3/R+xczqmsHWDgrDCyzfcl1o5ehKxnUOr5Bm6NhTGR4u1rtDEvlZ8dGgklLeNCk3ZbeKaO0bkcMfoKt+6ng/DUPPI6AAlDXlE0dzwsKPadkjqKjDXGEgg4b2CK7vx65M0xSlPmNsOA58/g1xWSDDKeq/KV5AR89+zc6OGjKSKtxUqR4NtF47VuMZemcTBDQxGqzqqrXIMCnm2xkXq1QJIIkO8EpmROcOkIyevYmhUqurWBmgCe4U5WJFHiiLKqKKOJtrooo8hxphihl6g5bGv3MAXkfBvPaFbVq6ga4Uq+wWdEfo6NVTmr1oVkYoye2NvfCWLmYQx0sjozFSxszhZ4Ctjb7QtavLQDNa0L5HRZQYJYxrNLbJR4QhZvOV46Fm/lqB428nsrJSx/OwbEgYA') format('woff2');
- }
- .n-icon {
- font-family: "HMfont-home" !important;
- }
- .n-icon-face:before {
- content: "\e797";
- }
- .n-icon-keyboard:before {
- content: "\e7b2";
- }
- .n-icon-voice:before {
- content: "\e805";
- }
- .n-icon-image:before {
- content: "\e639";
- }
- .n-icon-paizhao:before {
- content: "\e63e";
- }
- .n-icon-thunder:before {
- content: "\e63a";
- }
- </style>
|