| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- <script>//com.cityexpress1688.ptsj
- import {
- changeLanguages
- } from '@/pages/api/login';
- import api from "@/pages/api/api.js"
- export default {
- data() {
- return {
- audioObj:null
- }
- },
- globalData:{
- _i18n:{},
- $t:{},
- token:'',
- imViewOpen:false
- },
- onLaunch: function() {
- console.log('App Launch');
- this.globalData._i18n=this.$i18n;
- this.globalData.$t=str=>this.$t(str);
-
- let systemInfo = uni.getSystemInfoSync();
- var isAndroid = systemInfo.platform.toLowerCase() === 'android';
- var language = uni.getStorageSync('language');
- if(''==language||null==language||undefined==language){
- uni.setStorageSync('language',"zh-Hant");
- uni.setLocale('zh-Hant');
- if(!isAndroid){
- this.$i18n.locale = 'zh-Hant';
- }
- this.uploadLanguagesSet('zh-Hant');
- }
- else{
- uni.setLocale(language);
- if(!isAndroid){
- this.$i18n.locale = language;
- }
- this.uploadLanguagesSet(language);
- }
- uni.onPushMessage((res) => {
- console.log("收到推送消息:",res) //监听推送消息
- if(res.type=='click'){
- var content=res.data.content;
- plus.runtime.setBadgeNumber(0);
- if(content.indexOf("发起通话")!=-1){
-
- return
- }
- plus.runtime.setBadgeNumber(0);
- return
- }
- if(res.type=='receive'){
- var content=res.data.content;
- if(content.indexOf("发起通话")!=-1){
- plus.runtime.setBadgeNumber(0);
- if(this.globalData.imViewOpen==false){
-
- }
- return
- }
- if(content.indexOf("通话")!=-1){
- plus.runtime.setBadgeNumber(0);
- return;
- }
- plus.runtime.setBadgeNumber(0);
-
- if(content.indexOf("新订单")!=-1){
- this.audioObj.play();
- }
- uni.createPushMessage({
- content:res.data.content,
- success: (res) => {
- console.log(res);
- },
- fail(er) {
- }
- });
- }
- })
-
- this.audioObj=uni.createInnerAudioContext();
- this.audioObj.src='static/nyxddl.mp3';
-
- },
- onShow: function() {
- console.log('App Show')
- // uni.onPushMessage((res) => {
- // console.log(res);
- // })
- },
- onHide: function() {
- console.log('App Hide')
- },
- methods:{
- async uploadLanguagesSet(lang){
- var userId = uni.getStorageSync('userId');
- if(lang=='yuenan'){
- lang='vi';
- }
- if(lang=='zh-Hans'){
- lang='zh-CN';
- }
- if(lang=='zh-Hant'){
- lang='zh-TW';
- }
- console.log("changeLanguages");
- api('changeLanguages',{
- id:userId,
- lang:lang
- },
- res=>{
- console.log(res)
-
- },failc=>{
- //console.log('getadvertis----',failc)
-
- });
-
- },
- },
- }
- </script>
- <style>
- .container {
- padding: 15px;
- }
- /*
- button {
- margin-bottom: 15px;
- }
- */
- .ztextfontB1{
- font-size: 36rpx;
- }
- .ztextfontB2{
- font-size: 34rpx;
- }
- .ztextfontB3{
- font-size: 32rpx;
- }
- .ztextfontB4{
- font-size: 30rpx;
- }
- .ztextfontB5{
- font-size: 28rpx;
- }
- .ztextfontS1{
- font-size: 26rpx;
- }
- .ztextfontS2{
- font-size: 24rpx;
- }
- .ztextfontS3{
- font-size: 22rpx;
- }
-
- .textfontB1{
- font-size: 36rpx;
- }
- .textfontB2{
- font-size: 34rpx;
- }
- .textfontB3{
- font-size: 32rpx;
- }
- .textfontB4{
- font-size: 30rpx;
- }
- .textfontB5{
- font-size: 28rpx;
- }
- .textfontS1{
- font-size: 26rpx;
- }
- .textfontS2{
- font-size: 24rpx;
- }
- .textfontS3{
- font-size: 22rpx;
- }
- /*每个页面公共css */
- .content{
- display: flex;
- flex-direction: column;
- width: 94%;
- margin-left: 3%;
- background-color: white;
- border-radius: 16rpx;
- box-shadow: 0rpx 0rpx 10rpx 0rpx lightgray;
- }
-
- .content4{
- display: flex;
- flex-direction: column;
- width: 92%;
- margin-left: 4%;
- }
-
- .contentInRowL{
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
-
- .contentInRowC{
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- }
- .contentInRowR{
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- }
- .contentInRowS{
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- }
-
- .contentColumn{
- display: flex;
- flex-direction: column;
- }
-
- .contentColumnC{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .text1row{
- overflow: hidden;
- text-overflow: ellipsis;
- /* #ifndef APP-PLUS-NVUE */
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- /* #endif */
- }
- .text2row{
- overflow: hidden;
- text-overflow: ellipsis;
- /* #ifndef APP-PLUS-NVUE */
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- /* #endif */
- }
- </style>
|