Compare commits
185 Commits
master_new
...
改版
| Author | SHA1 | Date |
|---|---|---|
|
|
c8c82fb93a | |
|
|
cc5f824858 | |
|
|
177fbb35f9 | |
|
|
7a071227e7 | |
|
|
d01b04bce0 | |
|
|
7fe55a5c6f | |
|
|
bb183e89fc | |
|
|
0eb6237e41 | |
|
|
b38847ada8 | |
|
|
5578a25653 | |
|
|
b542e85624 | |
|
|
128ebf0124 | |
|
|
2fcfba42ea | |
|
|
f72f164fd8 | |
|
|
e96c468c38 | |
|
|
a28cc75da8 | |
|
|
181a93e314 | |
|
|
5ac5be413b | |
|
|
62632e0aff | |
|
|
adf6cea0b7 | |
|
|
5c42041cbd | |
|
|
f7755041ad | |
|
|
6364072991 | |
|
|
89d53394f1 | |
|
|
2851b8e13b | |
|
|
d8d6be6206 | |
|
|
fc3bd046e9 | |
|
|
d6d5f533cf | |
|
|
1e56c78f12 | |
|
|
d5d7242ec7 | |
|
|
3779b9f753 | |
|
|
12826becd5 | |
|
|
7549907688 | |
|
|
811a72cf34 | |
|
|
c51f20a320 | |
|
|
6b85f31b62 | |
|
|
653858b9f8 | |
|
|
c54fb1f2a9 | |
|
|
14e47ccf0e | |
|
|
5a34bde3b7 | |
|
|
18805583c1 | |
|
|
6ae7b4d889 | |
|
|
753c9932aa | |
|
|
ea6ad65b86 | |
|
|
ceff1c73d6 | |
|
|
45f6215e2f | |
|
|
e253399699 | |
|
|
55fd66f872 | |
|
|
9610fe2679 | |
|
|
85fbbd0990 | |
|
|
fc78b157a9 | |
|
|
b03ffe7225 | |
|
|
00833b4208 | |
|
|
8299492d12 | |
|
|
f65e18ea3d | |
|
|
917a0af084 | |
|
|
a800372ad2 | |
|
|
6d6c279731 | |
|
|
d6bae3034b | |
|
|
fa17e04f30 | |
|
|
2ecd26d609 | |
|
|
92637b114f | |
|
|
0a8e130c33 | |
|
|
8d885c3ec5 | |
|
|
e94a376395 | |
|
|
e79c8eda8a | |
|
|
21425c0306 | |
|
|
ce03c0de2b | |
|
|
2e13ec14aa | |
|
|
d723a5f2db | |
|
|
87fae84240 | |
|
|
d3ae42b664 | |
|
|
b67b581775 | |
|
|
95f097f8c9 | |
|
|
1184d73a75 | |
|
|
dda0f4d7d6 | |
|
|
ab99d37f99 | |
|
|
6c5347bb9c | |
|
|
c4c134417a | |
|
|
27d4107679 | |
|
|
66760ee72a | |
|
|
b6945acf9b | |
|
|
a9455ce98d | |
|
|
1d611bee0b | |
|
|
bbe660cbfc | |
|
|
c0f5ca513b | |
|
|
2f9055454c | |
|
|
f6ed231d12 | |
|
|
0c6ce09506 | |
|
|
8895bef4e1 | |
|
|
3c3159d5d8 | |
|
|
d008710130 | |
|
|
c2978b30db | |
|
|
af91692ba6 | |
|
|
057147d385 | |
|
|
d6f09178ac | |
|
|
4b51811351 | |
|
|
624888f58c | |
|
|
d5690bc51b | |
|
|
4e21e22bdf | |
|
|
a5180be20f | |
|
|
2836b0712f | |
|
|
3e9235844a | |
|
|
659ec0f473 | |
|
|
665ca23d3b | |
|
|
0130ad939d | |
|
|
5bb78163b4 | |
|
|
7b54ba6749 | |
|
|
ad97d5683c | |
|
|
8347f81269 | |
|
|
54cb3b744d | |
|
|
7618492df5 | |
|
|
7399719cdf | |
|
|
46e0975e89 | |
|
|
83b1a6f1a6 | |
|
|
f5e3e96be8 | |
|
|
8aed4815fd | |
|
|
f4e9bcc0f6 | |
|
|
0d66d41f15 | |
|
|
9de417bdfc | |
|
|
7a5181a638 | |
|
|
64dea3ff2b | |
|
|
a159fbdb22 | |
|
|
f1e4ee07b0 | |
|
|
aa43bcf4fd | |
|
|
d25533df33 | |
|
|
211b33f63f | |
|
|
e500cb9e71 | |
|
|
0e3e1fb5fa | |
|
|
95f880a251 | |
|
|
c5896dc853 | |
|
|
49b50dc1f0 | |
|
|
90de758ff0 | |
|
|
7fabbd8549 | |
|
|
3e50131bdb | |
|
|
b584f8f97b | |
|
|
b4ebbd533c | |
|
|
f560bcb69d | |
|
|
4dc74695de | |
|
|
7bca1214ae | |
|
|
0c411882d9 | |
|
|
566b6f8929 | |
|
|
9ecaf1a1de | |
|
|
0c1204ed20 | |
|
|
dc1898ebb1 | |
|
|
227b63b6bf | |
|
|
a592cd9af8 | |
|
|
1ed3b8eec4 | |
|
|
fcf1a4ed5e | |
|
|
81f455dcf5 | |
|
|
0dc0992858 | |
|
|
35dca559d3 | |
|
|
e4b7646da9 | |
|
|
b963e6a182 | |
|
|
32dd0a94d2 | |
|
|
8066f80b0c | |
|
|
33dc910b05 | |
|
|
70074a2fc6 | |
|
|
cced2804e2 | |
|
|
246917e31d | |
|
|
3f65e276fe | |
|
|
48cc4f66a9 | |
|
|
7f432b6bf6 | |
|
|
3772269122 | |
|
|
230e32c934 | |
|
|
9ba35a12b4 | |
|
|
ea3eeac57b | |
|
|
5d10a155c0 | |
|
|
5638873295 | |
|
|
5f0f22e62a | |
|
|
7c19010c51 | |
|
|
345cc91660 | |
|
|
b4a1b9f9a2 | |
|
|
591cb7ee0b | |
|
|
f8cf409141 | |
|
|
d6fda784a8 | |
|
|
9cb254c10c | |
|
|
4eedf350fa | |
|
|
cbbcb0c5a3 | |
|
|
81c34f7559 | |
|
|
bca875ddb7 | |
|
|
7e107a4ea4 | |
|
|
5ac33a6c87 | |
|
|
059b846f28 | |
|
|
00869adb70 |
|
|
@ -0,0 +1,8 @@
|
|||
# 忽略依赖目录
|
||||
/node_modules/
|
||||
|
||||
# 忽略 UniApp 编译输出目录
|
||||
/unpackage/
|
||||
|
||||
# 忽略 VS Code 配置目录
|
||||
/.vscode/
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"version" : "1.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"customPlaygroundType" : "local",
|
||||
"playground" : "custom",
|
||||
"type" : "uni-app:app-ios"
|
||||
},
|
||||
{
|
||||
"customPlaygroundType" : "local",
|
||||
"playground" : "custom",
|
||||
"type" : "uni-app:app-android"
|
||||
}
|
||||
]
|
||||
}
|
||||
560
App.vue
560
App.vue
|
|
@ -1,299 +1,285 @@
|
|||
<script>
|
||||
// #ifdef APP-PLUS
|
||||
import {
|
||||
isNotificationsEnabled,
|
||||
permissions,
|
||||
registPush
|
||||
} from '@/utils/AS-NotifyTheAuthority.js'
|
||||
import {
|
||||
permissionListener
|
||||
} from './utils/permissionTips.js'
|
||||
// import { appUpdateListener } from '@/common/utils/appUpdateTips.js'
|
||||
import locationService from './utils/locationService.js'
|
||||
// import uploadApp from './utils/uploadApp.js'
|
||||
// #endif
|
||||
import request from './utils/request'
|
||||
import {
|
||||
setVersion
|
||||
} from './utils/version.js'
|
||||
//初始化一键登录插件
|
||||
const aLiSDKModule = uni.requireNativePlugin('AliCloud-NirvanaPns');
|
||||
export default {
|
||||
globalData: {
|
||||
artisanType: null,
|
||||
latitude: '38.366667',
|
||||
longitude: '117.333333',
|
||||
address: '黄骅市',
|
||||
servers_region: `河北省-沧州市-黄骅市`,
|
||||
deviceid: '',
|
||||
addressRes: {
|
||||
"type": "gcj02",
|
||||
"altitude": 0,
|
||||
"latitude": 38.372266,
|
||||
"longitude": 117.332895,
|
||||
"speed": 0,
|
||||
"accuracy": 30,
|
||||
// #ifdef APP-PLUS
|
||||
import {
|
||||
isNotificationsEnabled,
|
||||
permissions,
|
||||
registPush
|
||||
} from '@/utils/AS-NotifyTheAuthority.js'
|
||||
import {
|
||||
permissionListener
|
||||
} from './utils/permissionTips.js'
|
||||
// import { appUpdateListener } from '@/common/utils/appUpdateTips.js'
|
||||
import locationService from './utils/locationService.js'
|
||||
// import uploadApp from './utils/uploadApp.js'
|
||||
// #endif
|
||||
import request from './utils/request'
|
||||
import {
|
||||
setVersion
|
||||
} from './utils/version.js'
|
||||
//初始化一键登录插件
|
||||
const aLiSDKModule = uni.requireNativePlugin('AliCloud-NirvanaPns');
|
||||
export default {
|
||||
globalData: {
|
||||
artisanType: 2,
|
||||
latitude: '38.366667',
|
||||
longitude: '117.333333',
|
||||
address: '黄骅市',
|
||||
servers_region: `河北省-沧州市-黄骅市`,
|
||||
deviceid: '',
|
||||
addressRes: {
|
||||
"type": "gcj02",
|
||||
"altitude": 0,
|
||||
"latitude": 38.372266,
|
||||
"longitude": 117.332895,
|
||||
"speed": 0,
|
||||
"accuracy": 30,
|
||||
"adcode": "130983",
|
||||
"cCode": "130900",
|
||||
"pcode": "130000",
|
||||
"address": {
|
||||
"country": "中国",
|
||||
"province": "河北省",
|
||||
"city": "沧州市",
|
||||
"district": "黄骅市",
|
||||
"street": "渤海西路",
|
||||
"streetNum": "35号",
|
||||
// "poiName": "请开启位置权限",
|
||||
"poiName": "黄骅市人民政府",
|
||||
"cityCode": "0317",
|
||||
"adcode": "130983",
|
||||
"cCode": "130900",
|
||||
"pcode": "130000",
|
||||
"address": {
|
||||
"country": "中国",
|
||||
"province": "河北省",
|
||||
"city": "沧州市",
|
||||
"district": "黄骅市",
|
||||
"street": "渤海西路",
|
||||
"streetNum": "35号",
|
||||
// "poiName": "请开启位置权限",
|
||||
"poiName": "黄骅市人民政府",
|
||||
"cityCode": "0317",
|
||||
"adcode": "130983",
|
||||
"cCode": "130900",
|
||||
"pcode": "130000",
|
||||
}
|
||||
}
|
||||
},
|
||||
onLaunch: async function() {
|
||||
// plus.android.requestPermissions(['POST_NOTIFICATIONS'], function(e) {
|
||||
// console.log('1111111111' + e.deniedAlways.length);
|
||||
// if (e.deniedAlways.length > 0) { //权限被永久拒绝
|
||||
// // 弹出提示框解释为何需要定位权限,引导用户打开设置页面开启
|
||||
// console.log('Always Denied!!! ' + e.deniedAlways.toString());
|
||||
// }
|
||||
// if (e.deniedPresent.length > 0) { //权限被临时拒绝
|
||||
// // 弹出提示框解释为何需要定位权限,可再次调用plus.android.requestPermissions申请权限
|
||||
// console.log('Present Denied!!! ' + e.deniedPresent.toString());
|
||||
// }
|
||||
// if (e.granted.length > 0) { //权限被允许
|
||||
// //调用依赖获取定位权限的代码
|
||||
// console.log('Granted!!! ' + e.granted.toString());
|
||||
// }
|
||||
// }, function(e) {
|
||||
// console.log('Request Permissions error:' + JSON.stringify(e));
|
||||
// });
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
if (uni.getStorageSync('accessToken')) {
|
||||
registPush()
|
||||
}
|
||||
// #endif
|
||||
|
||||
}
|
||||
},
|
||||
onLaunch: async function () {
|
||||
// #ifdef APP-PLUS
|
||||
uni.hideTabBar();
|
||||
if (uni.getStorageSync('accessToken')) {
|
||||
registPush()
|
||||
//跟新底部消息数量
|
||||
this.messageUpudateNum()
|
||||
|
||||
//隐藏原生Tabar
|
||||
uni.hideTabBar({
|
||||
animation: true
|
||||
});
|
||||
//缓存手机版本号
|
||||
// await setVersion()
|
||||
|
||||
//获取访问路由
|
||||
// 发起 GET 请求
|
||||
let version = uni.getStorageSync('setVersion')
|
||||
let baseUrl
|
||||
await uni.request({
|
||||
url: 'https://app.mrrweb.com.cn/api/openPuc/getApiUrl', // 接口地址
|
||||
method: 'GET', // 请求方法(默认 GET)
|
||||
header: {
|
||||
'Content-Type': 'application/json', // 请求头
|
||||
'VersionCode': version.VersionCode,
|
||||
'DeviceBrand': version.DeviceBrand,
|
||||
'DeviceType': version.DeviceType
|
||||
},
|
||||
success: (res) => {
|
||||
|
||||
if (res.data.code == 200) {
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.setStorageSync('baseUrl', res.data.data.url)
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.setStorageSync('baseUrl', res.data.data.url)
|
||||
// #endif
|
||||
this.$store.commit("setLocation", true)
|
||||
}
|
||||
console.log('请求成功', res.data);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('请求失败', err);
|
||||
},
|
||||
complete: () => {
|
||||
console.log('请求完成(无论成功失败都会执行)');
|
||||
}
|
||||
});
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
//禁止手机横屏
|
||||
plus.screen.lockOrientation("portrait-primary")
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
//权限提示监听
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
let platform = systemInfo.platform;
|
||||
if (platform === 'android') {
|
||||
// console.log('安卓用户')
|
||||
permissionListener()
|
||||
} else if (platform === 'ios') {
|
||||
// console.log('苹果用户')
|
||||
} else {
|
||||
// console.log('平台未知')
|
||||
}
|
||||
|
||||
//一键登录密钥设置
|
||||
let sdkInfo = '';
|
||||
//设置秘钥
|
||||
if (platform == 'android') {
|
||||
//开启SDK日志打印
|
||||
aLiSDKModule.setLoggerEnable(true);
|
||||
aLiSDKModule.expandAuthPageCheckedScope(true);
|
||||
//禁用物理返回键
|
||||
//aLiSDKModule.closeAuthPageReturnBack(true);
|
||||
//开启区分界面返回及物理返回功能,自动控制后续返回事件
|
||||
aLiSDKModule.userControlAuthPageCancel();
|
||||
//是否跟随系统深色模式
|
||||
aLiSDKModule.setAuthPageUseDayLight(false);
|
||||
sdkInfo =
|
||||
'VXQhWWtyx6hqQIh6W8oMB2Kdzarg+2TSlQOvRb8fCUA1ygRWUKLsYkTuncn1VB1EK5gVvwoYZNXPF26x853cRzOfYW+lLKDNjMX7QZFgift8remIOFof9wjwyZFuHW2gBQAef6O6vxXeobInLVmJ/6sPqpJylk0ipYe+KBkEhKwiaNZudEHGrTFMQ2PvaNNjnnIWTB6WQJRTljArPvbgVT4FjXTwY8BJlFBR84CGE4k6HRRs1/ov1cBbON3zz6xE9DUlJhS43eEYVRYosJxrfDHfgz+++CfjinSGOX1m474=';
|
||||
} else if (platform == 'ios') {
|
||||
sdkInfo =
|
||||
'+4L59pm2xfA84cMIyUc4//tTAznhbtCGZ5bXa3Ax8UUTCH3IwxX0F0o8gVw7eanDoI3XVvriXMpQA3wcnAEbBD75JswXKAG0+ekz2cVUAgpHLGU3rDkakqTyRC9LIS4aHsJ/i9yv94tEAifXkxlIzdmZbT6dyYAexeJL6dLd6olEnFuKaaSRRl0VBtvSC5HQKlYqRZQ82ljIpAWCqaDG74lvsKfdxKU0wQPBQPzO15nJQOSfLIQpRsBm8STvkmeR'
|
||||
}
|
||||
aLiSDKModule.setAuthSDKInfo(sdkInfo)
|
||||
|
||||
|
||||
|
||||
// await uploadApp.uploadApp('onLaunch');
|
||||
// #endif
|
||||
|
||||
|
||||
console.log('App Launch')
|
||||
this.globalData.deviceId = uni.getDeviceInfo().deviceId;
|
||||
// this.globalData.deviceid = 'AC6F605124DFA87DCE40D5C062C94C3B';
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
if (uni.getStorageSync('refreshToken')) {
|
||||
let endTime = uni.getStorageSync('refresh_token_expries');
|
||||
endTime = new Date(endTime)
|
||||
// 当前系统时间
|
||||
var nowTime = new Date();
|
||||
var residueTime = (endTime.getTime() - nowTime.getTime() / 1000);
|
||||
// 4小时 14400
|
||||
if (residueTime < 4 * 60 * 60) {
|
||||
console.log('----------------------------')
|
||||
|
||||
uni.removeStorageSync('accessToken')
|
||||
uni.removeStorageSync('refreshToken')
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
if (wx.getStorageSync('refreshToken')) {
|
||||
let endTime = wx.getStorageSync('refresh_token_expries');
|
||||
endTime = new Date(endTime)
|
||||
// 当前系统时间
|
||||
var nowTime = new Date();
|
||||
var residueTime = (endTime.getTime() - nowTime.getTime() / 1000);
|
||||
// 4小时 14400
|
||||
if (residueTime < 4 * 60 * 60) {
|
||||
console.log('----------------------------')
|
||||
|
||||
wx.removeStorageSync('accessToken')
|
||||
wx.removeStorageSync('refreshToken')
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
onShow: function() {
|
||||
//隐藏原生Tabar
|
||||
uni.hideTabBar()
|
||||
console.log('App Show')
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide')
|
||||
},
|
||||
methods: {
|
||||
// 验证登陆的全局方法
|
||||
verifyLogin() {
|
||||
if (!vuex.state.userInfo.token) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您需要登陆后才能进行此操作',
|
||||
confirmColor: '#F1AC66',
|
||||
success(e) {
|
||||
if (e.confirm) {
|
||||
// uni.oprPresentLogin()
|
||||
uni.navigateTo({
|
||||
url: '/pages/blogPopup/blogPopup'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 区/县adcode转换为6位市adcode(后两位补0)
|
||||
* @param {string|number} districtAdcode - 6位区/县编码(字符串或数字类型)
|
||||
* @returns {string|null} 6位市编码,无效编码返回null
|
||||
*/
|
||||
districtAdcodeTo6DigitCityAdcode(districtAdcode) {
|
||||
// 1. 统一转换为字符串并去除空格
|
||||
const adcodeStr = String(districtAdcode).trim();
|
||||
|
||||
// 2. 验证编码有效性(6位数字)
|
||||
const adcodeReg = /^\d{6}$/;
|
||||
if (!adcodeReg.test(adcodeStr)) {
|
||||
console.warn('无效的区/县编码,必须是6位数字');
|
||||
return null;
|
||||
}
|
||||
|
||||
// 3. 截取前4位 + 拼接"00" → 6位市编码
|
||||
const cityAdcode4Digit = adcodeStr.slice(0, 4);
|
||||
const cityAdcode6Digit = cityAdcode4Digit + '00';
|
||||
|
||||
// 4. 可选验证:确保结果为6位数字
|
||||
if (!/^\d{6}$/.test(cityAdcode6Digit)) {
|
||||
console.warn('编码转换异常');
|
||||
return null;
|
||||
}
|
||||
|
||||
return cityAdcode6Digit;
|
||||
},
|
||||
// 更新全局定位
|
||||
updateAddress(item) {
|
||||
console.log('item', item)
|
||||
let location = item.location.split(',');
|
||||
this.globalData.latitude = location[1];
|
||||
this.globalData.longitude = location[0];
|
||||
this.globalData.address = item.name;
|
||||
this.globalData.servers_region = `${item.pname}-${item.cityname}-${item.adname}`;
|
||||
this.globalData.pcode = item.pcode;
|
||||
this.globalData.cCode = this.districtAdcodeTo6DigitCityAdcode(item.adcode);
|
||||
this.globalData.adcode = item.adcode;
|
||||
//存储用户定位
|
||||
this.globalData.addressRes.latitude = location[1];
|
||||
this.globalData.addressRes.longitude = location[0];
|
||||
this.globalData.addressRes.address.province = item.pname;
|
||||
this.globalData.addressRes.address.city = item.cityname;
|
||||
this.globalData.addressRes.address.district = item.adname;
|
||||
this.globalData.addressRes.address.street = item.address;
|
||||
this.globalData.addressRes.address.poiName = item.name;
|
||||
this.globalData.addressRes.address.streetNum = '';
|
||||
this.globalData.addressRes.address.cityCode = '';
|
||||
this.globalData.addressRes.address.pcode = item.pcode;
|
||||
this.globalData.addressRes.address.cCode = this.districtAdcodeTo6DigitCityAdcode(item.adcode);
|
||||
this.globalData.addressRes.address.adcode = item.adcode;
|
||||
this.globalData.addressRes.pcode = item.pcode;
|
||||
this.globalData.addressRes.cCode = this.districtAdcodeTo6DigitCityAdcode(item.adcode);
|
||||
this.globalData.addressRes.adcode = item.adcode;
|
||||
console.log('globalData', this.globalData)
|
||||
uni.setStorageSync('userAdrees', this.globalData)
|
||||
},
|
||||
}
|
||||
// #endif
|
||||
|
||||
//缓存手机版本号
|
||||
// await setVersion()
|
||||
|
||||
//获取访问路由
|
||||
// 发起 GET 请求
|
||||
let version = uni.getStorageSync('setVersion')
|
||||
let baseUrl
|
||||
await uni.request({
|
||||
url: 'https://api.mrrwlkj.top/api/openPuc/getSjApiUrl', // 接口地址
|
||||
method: 'GET', // 请求方法(默认 GET)
|
||||
header: {
|
||||
'Content-Type': 'application/json', // 请求头
|
||||
'VersionCode': version.VersionCode,
|
||||
'DeviceBrand': version.DeviceBrand,
|
||||
'DeviceType': version.DeviceType
|
||||
},
|
||||
success: (res) => {
|
||||
|
||||
if (res.data.code == 200) {
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.setStorageSync('baseUrl', res.data.data.url)
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.setStorageSync('baseUrl', res.data.data.url)
|
||||
// #endif
|
||||
this.$store.commit("setLocation", true)
|
||||
}
|
||||
console.log('请求成功', res.data);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('请求失败', err);
|
||||
},
|
||||
complete: () => {
|
||||
console.log('请求完成(无论成功失败都会执行)');
|
||||
}
|
||||
});
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
//禁止手机横屏
|
||||
plus.screen.lockOrientation("portrait-primary")
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
//权限提示监听
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
let platform = systemInfo.platform;
|
||||
if (platform === 'android') {
|
||||
// console.log('安卓用户')
|
||||
permissionListener()
|
||||
} else if (platform === 'ios') {
|
||||
// console.log('苹果用户')
|
||||
} else {
|
||||
// console.log('平台未知')
|
||||
}
|
||||
|
||||
//一键登录密钥设置
|
||||
let sdkInfo = '';
|
||||
//设置秘钥
|
||||
if (platform == 'android') {
|
||||
//开启SDK日志打印
|
||||
aLiSDKModule.setLoggerEnable(true);
|
||||
aLiSDKModule.expandAuthPageCheckedScope(true);
|
||||
//禁用物理返回键
|
||||
//aLiSDKModule.closeAuthPageReturnBack(true);
|
||||
//开启区分界面返回及物理返回功能,自动控制后续返回事件
|
||||
aLiSDKModule.userControlAuthPageCancel();
|
||||
//是否跟随系统深色模式
|
||||
aLiSDKModule.setAuthPageUseDayLight(false);
|
||||
sdkInfo =
|
||||
'cvJWYFO9s7xgJrzD+Ok2m2kCh3x0kdRkfJzGI0oxnyUXGlNAwAzvj87Yd6y030BWposVHUT84av2adBG9SdHl5CJpL0mGi+BRtachnyADJjfdpkJC0e0Uqb45pO7h7ZZvT+sNWQs1sa4JpL0U7hYKkgCP1iVXHoA1zKfzZynON6eKyvkzL1xpoPPag4O50slww4+6XuRVplCOSNCcsLRtot4CYnfsdcMvlV34MY5qB/rV+HNb1velpx4rg5atk3iTEiSLjla69c6pOT6vpjkK1qFVpNMxrEY';
|
||||
} else if (platform == 'ios') {
|
||||
sdkInfo =
|
||||
'BONXQSabNMt1a8Cru1TjeW94aXen5rQHeAxzLGgpFzIUicDYeb9SD0l35MkKvjq7gQemE2HDp6B7adKZ8nrdUk4wgg1LIYSGDYVSc/Q1CwrJ9A3lMUeBfS1UUu3nBBg58bDvG1bl3j6tS4h6FjnYmP5+dDsyqb0YNmIhlSmia5Et7cfBMv2OT85N9WLJc/tOMQ9ZQCnuizKVlofkmDGFgjsBN/Bf2gLq6lTQyVqsgPJE5yEPd4riNg=='
|
||||
}
|
||||
aLiSDKModule.setAuthSDKInfo(sdkInfo)
|
||||
|
||||
|
||||
|
||||
// await uploadApp.uploadApp('onLaunch');
|
||||
// #endif
|
||||
|
||||
|
||||
console.log('App Launch')
|
||||
this.globalData.deviceId = uni.getDeviceInfo().deviceId;
|
||||
// this.globalData.deviceid = 'AC6F605124DFA87DCE40D5C062C94C3B';
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
if (uni.getStorageSync('refreshToken')) {
|
||||
let endTime = uni.getStorageSync('refresh_token_expries');
|
||||
endTime = new Date(endTime)
|
||||
// 当前系统时间
|
||||
var nowTime = new Date();
|
||||
var residueTime = (endTime.getTime() - nowTime.getTime() / 1000);
|
||||
// 4小时 14400
|
||||
if (residueTime < 4 * 60 * 60) {
|
||||
console.log('----------------------------')
|
||||
|
||||
uni.removeStorageSync('accessToken')
|
||||
uni.removeStorageSync('refreshToken')
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
if (wx.getStorageSync('refreshToken')) {
|
||||
let endTime = wx.getStorageSync('refresh_token_expries');
|
||||
endTime = new Date(endTime)
|
||||
// 当前系统时间
|
||||
var nowTime = new Date();
|
||||
var residueTime = (endTime.getTime() - nowTime.getTime() / 1000);
|
||||
// 4小时 14400
|
||||
if (residueTime < 4 * 60 * 60) {
|
||||
console.log('----------------------------')
|
||||
|
||||
wx.removeStorageSync('accessToken')
|
||||
wx.removeStorageSync('refreshToken')
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
onShow: function () {
|
||||
uni.hideTabBar();
|
||||
console.log('App Show')
|
||||
uni.$emit('appShowRefresh')
|
||||
},
|
||||
onHide: function () {
|
||||
console.log('App Hide')
|
||||
},
|
||||
methods: {
|
||||
// 验证登陆的全局方法
|
||||
verifyLogin() {
|
||||
if (!vuex.state.userInfo.token) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您需要登陆后才能进行此操作',
|
||||
confirmColor: '#F1AC66',
|
||||
success(e) {
|
||||
if (e.confirm) {
|
||||
// uni.oprPresentLogin()
|
||||
uni.navigateTo({
|
||||
url: '/pages/blogPopup/blogPopup'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 区/县adcode转换为6位市adcode(后两位补0)
|
||||
* @param {string|number} districtAdcode - 6位区/县编码(字符串或数字类型)
|
||||
* @returns {string|null} 6位市编码,无效编码返回null
|
||||
*/
|
||||
districtAdcodeTo6DigitCityAdcode(districtAdcode) {
|
||||
// 1. 统一转换为字符串并去除空格
|
||||
const adcodeStr = String(districtAdcode).trim();
|
||||
|
||||
// 2. 验证编码有效性(6位数字)
|
||||
const adcodeReg = /^\d{6}$/;
|
||||
if (!adcodeReg.test(adcodeStr)) {
|
||||
console.warn('无效的区/县编码,必须是6位数字');
|
||||
return null;
|
||||
}
|
||||
|
||||
// 3. 截取前4位 + 拼接"00" → 6位市编码
|
||||
const cityAdcode4Digit = adcodeStr.slice(0, 4);
|
||||
const cityAdcode6Digit = cityAdcode4Digit + '00';
|
||||
|
||||
// 4. 可选验证:确保结果为6位数字
|
||||
if (!/^\d{6}$/.test(cityAdcode6Digit)) {
|
||||
console.warn('编码转换异常');
|
||||
return null;
|
||||
}
|
||||
|
||||
return cityAdcode6Digit;
|
||||
},
|
||||
// 更新全局定位
|
||||
updateAddress(item) {
|
||||
console.log('item', item)
|
||||
let location = item.location.split(',');
|
||||
this.globalData.latitude = location[1];
|
||||
this.globalData.longitude = location[0];
|
||||
this.globalData.address = item.name;
|
||||
this.globalData.servers_region = `${item.pname}-${item.cityname}-${item.adname}`;
|
||||
this.globalData.pcode = item.pcode;
|
||||
this.globalData.cCode = this.districtAdcodeTo6DigitCityAdcode(item.adcode);
|
||||
this.globalData.adcode = item.adcode;
|
||||
//存储用户定位
|
||||
this.globalData.addressRes.latitude = location[1];
|
||||
this.globalData.addressRes.longitude = location[0];
|
||||
this.globalData.addressRes.address.province = item.pname;
|
||||
this.globalData.addressRes.address.city = item.cityname;
|
||||
this.globalData.addressRes.address.district = item.adname;
|
||||
this.globalData.addressRes.address.street = item.address;
|
||||
this.globalData.addressRes.address.poiName = item.name;
|
||||
this.globalData.addressRes.address.streetNum = '';
|
||||
this.globalData.addressRes.address.cityCode = '';
|
||||
this.globalData.addressRes.address.pcode = item.pcode;
|
||||
this.globalData.addressRes.address.cCode = this.districtAdcodeTo6DigitCityAdcode(item.adcode);
|
||||
this.globalData.addressRes.address.adcode = item.adcode;
|
||||
this.globalData.addressRes.pcode = item.pcode;
|
||||
this.globalData.addressRes.cCode = this.districtAdcodeTo6DigitCityAdcode(item.adcode);
|
||||
this.globalData.addressRes.adcode = item.adcode;
|
||||
console.log('globalData', this.globalData)
|
||||
uni.setStorageSync('userAdrees', this.globalData)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/*每个页面公共css */
|
||||
@import '@/static/css/common.css';
|
||||
</style>
|
||||
/*每个页面公共css */
|
||||
@import '@/static/css/common.css';
|
||||
|
||||
/* App.vue全局style */
|
||||
page,
|
||||
html,
|
||||
body {
|
||||
-webkit-text-size-adjust: 100% !important;
|
||||
text-size-adjust: 100% !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
# 改动记录
|
||||
|
||||
## 2026-06-12
|
||||
|
||||
### 后台长时间运行后首页登录态不同步
|
||||
|
||||
问题现象:
|
||||
|
||||
- APP 后台运行较长时间后再次进入。
|
||||
- 商家首页显示未登录或无法及时获取商家信息。
|
||||
- “我的”页面仍显示已登录。
|
||||
- 从“我的”页面切回首页后,首页才能正常获取商家信息。
|
||||
|
||||
涉及文件:
|
||||
|
||||
- `App.vue`
|
||||
- `pages/home/home.vue`
|
||||
- `utils/request.js`
|
||||
|
||||
改动内容:
|
||||
|
||||
- `App.vue`
|
||||
- 在全局 `onShow` 中新增 `uni.$emit('appShowRefresh')`。
|
||||
- APP 从后台恢复前台时主动通知页面刷新状态,避免只依赖页面级 `onShow`。
|
||||
|
||||
- `pages/home/home.vue`
|
||||
- 新增 `refreshPageState` 方法,统一处理首页登录态刷新。
|
||||
- `onShow`、下拉刷新、APP 前台恢复事件都调用同一套刷新逻辑。
|
||||
- `onLoad` 注册 `appShowRefresh` 事件。
|
||||
- `onUnload` 解除 `appShowRefresh` 事件,避免重复监听。
|
||||
- 有 token 时主动重新请求 `/sj/user/getUser`。
|
||||
- 无 token 时清空 `userInfo`、`authDetails`、`sjId`,并重置 `isUserInfoLoaded`。
|
||||
- `getUserInfo` 请求成功后显式设置 `isLogin = true` 和 `isUserInfoLoaded = true`。
|
||||
- `getUserInfo` 请求失败时,如果本地 token 已被清理,则同步首页为未登录状态。
|
||||
|
||||
- `utils/request.js`
|
||||
- `refreshToken` 兼容后端返回结构:
|
||||
- 支持 token 在 `res.access_token`。
|
||||
- 支持 token 在 `res.data.access_token`。
|
||||
- 刷新 token 成功后同步更新:
|
||||
- `accessToken`
|
||||
- `refreshToken`
|
||||
- `refresh_token_expries`
|
||||
- 如果刷新接口成功但没有返回 `access_token`,主动抛错,避免写入 `undefined` token。
|
||||
|
||||
验证情况:
|
||||
|
||||
- 已检查相关 diff,未做全文件重构。
|
||||
- `pages/home/home.vue` 原文件为 CRLF 行尾;为避免整文件行尾改造造成大面积 diff,本次保留原行尾。
|
||||
- 项目 `package.json` 未配置 build/lint 脚本,未执行完整构建校验。
|
||||
|
||||
### 订单详情顾客头像被挤压
|
||||
|
||||
问题现象:
|
||||
|
||||
- `pages/shop/SellerDetail` 页面“顾客信息”一栏中,客户头像在部分图片比例下显示被拉伸或挤压。
|
||||
|
||||
涉及文件:
|
||||
|
||||
- `pages/shop/SellerDetail.vue`
|
||||
|
||||
改动内容:
|
||||
|
||||
- 给顾客头像 `<image>` 增加 `mode="aspectFill"`,按头像容器比例裁剪填充,避免原图比例不一致时被拉伸。
|
||||
- 为 `.shop_photo` 增加 `min-width` 和 `min-height`,在 flex 布局中进一步锁定头像为固定正方形尺寸。
|
||||
|
||||
验证情况:
|
||||
|
||||
- 已执行 `pages/shop/SellerDetail.vue` 与 `CHANGE_RECORD.md` 的空白格式检查。
|
||||
|
||||
### 核销成功后工时/工位订单详情跳转错误
|
||||
|
||||
问题现象:
|
||||
|
||||
- 商家扫码核销或输入核销码核销成功后,工时订单和工位订单跳转到详情页时参数或页面类型不正确。
|
||||
- 工时订单会进入工位详情链路,工位订单会落到普通订单详情链路。
|
||||
|
||||
涉及文件:
|
||||
|
||||
- `pages/shop/verify/verify-order-detail.vue`
|
||||
|
||||
改动内容:
|
||||
|
||||
- 新增 `getOrderDetailUrl`,统一按 `order_type` 生成核销成功后的详情页地址。
|
||||
- `order_type=3` 工时订单跳转到 `/pages/shop/SellerDetail?order_id=...&identity=1`,使用手艺人工时订单详情链路。
|
||||
- `order_type=4` 工位订单跳转到 `/pages/shop/SellerDetail?order_id=...`,使用商家工位订单详情链路。
|
||||
- `order_type=6` 自营订单跳转普通订单详情并携带 `serviceType=2`。
|
||||
- 其他普通订单跳转普通订单详情,不再误携带自营参数。
|
||||
|
||||
验证情况:
|
||||
|
||||
- 已执行 `pages/shop/verify/verify-order-detail.vue` 与 `CHANGE_RECORD.md` 的空白格式检查。
|
||||
27
Info.plist
27
Info.plist
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>WeChat</key>
|
||||
<dict>
|
||||
<key>appid</key>
|
||||
<string>wx5b1c0c8d01ded35d</string>
|
||||
<key>universalLink</key>
|
||||
<string>https://app.mrrweb.com.cn/</string>
|
||||
</dict>
|
||||
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>WeChat</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>wx5b1c0c8d01ded35d</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
"version" : "1",
|
||||
"prompt" : "template",
|
||||
"title" : "美融融平台服务协议及隐私政策",
|
||||
"message" : "您注册为美融融用户的过程中,需要完成我们的注册流程并且以点击的形式在线签署以下协议, 请您务必仔细阅读、充分理解协议中的条款内容后点击同意: <a href=\"https://www.mrrweb.com.cn/junit/system/yhxy\">《美融融平台服务协议》</a>和<a href=\"https://www.mrrweb.com.cn/junit/system/yszc\">《隐私政策》</a>",
|
||||
"message" : "您注册为美融融用户的过程中,需要完成我们的注册流程并且以点击的形式在线签署以下协议, 请您务必仔细阅读、充分理解协议中的条款内容后点击同意: <a href=\"https://www.mrrweb.com.cn/junit/system/sjappzcxy\">《美融融商家服务协议》</a>和<a href=\"https://www.mrrweb.com.cn/junit/system/sjappyszc\">《隐私政策》</a>",
|
||||
"buttonAccept" : "同意",
|
||||
"buttonRefuse" : "不同意",
|
||||
"hrefLoader" : "system",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"apps": [],
|
||||
"details": [
|
||||
{
|
||||
"appID": "wx5b1c0c8d01ded35d",
|
||||
"appID": "wx17eef65c270b4869",
|
||||
"paths": ["*"]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ export default {
|
|||
color: #999;
|
||||
}
|
||||
.tab-text.active {
|
||||
color: #E8101E; /* 选中颜色 */
|
||||
color: #FF4767; /* 选中颜色 */
|
||||
}
|
||||
.tab-badge {
|
||||
position: absolute;
|
||||
|
|
|
|||
|
|
@ -188,115 +188,101 @@ export default {
|
|||
},
|
||||
// 触发上传
|
||||
async handleUpload() {
|
||||
// 判断
|
||||
try {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
if(systemInfo.platform === 'ios') {
|
||||
this.openCamera();
|
||||
}else {
|
||||
let xcpermission = '';
|
||||
let xjpermission = '';
|
||||
if(systemInfo.platform === 'ios') {
|
||||
xcpermission = 'photo_library',
|
||||
xjpermission = 'camera'
|
||||
}else {
|
||||
xcpermission = `android.permission.READ_EXTERNAL_STORAGE,android.permission.WRITE_EXTERNAL_STORAGE`
|
||||
xjpermission = 'android.permission.CAMERA'
|
||||
}
|
||||
const xjfirstRequest = !plus.storage.getItem(`perm_${xjpermission}`)
|
||||
const xcfirstRequest = !plus.storage.getItem(`perm_${xcpermission}`)
|
||||
if(xcfirstRequest || xjfirstRequest) {
|
||||
// this.isShowPer = true;
|
||||
console.log('ckeckisShowPer',true)
|
||||
this.$emit('ckeckisShowPer',true)
|
||||
}
|
||||
|
||||
// 1. 检查权限
|
||||
// const { granted } = await permissionUtils.checkPermission('photo_library', '需要相册权限用于上传照片');
|
||||
this.$emit('ckecknowQer','xc')
|
||||
const xc = await permissionUtils.checkPermission('photo_library', '需要相册权限用于上传照片');
|
||||
this.$emit('ckecknowQer','xj')
|
||||
const xj = await permissionUtils.checkPermission('camera', '需要相机权限用于拍摄照片');
|
||||
this.$emit('ckeckisShowPer',false)
|
||||
this.$emit('ckecknowQer','')
|
||||
if (xc.granted && xj.granted) {
|
||||
this.openCamera();
|
||||
return;
|
||||
}
|
||||
// this.isShowPer = false;
|
||||
// 2. 显示权限说明弹窗
|
||||
const confirm = await this.showPermissionDialog(
|
||||
'相机相册权限申请',
|
||||
'我们需要访问您的相机以及相册以完成更换头像功能'
|
||||
);
|
||||
|
||||
if (!confirm) return;
|
||||
|
||||
// 3. 请求权限
|
||||
this.$emit('ckeckisShowPer',true)
|
||||
this.$emit('ckecknowQer','xc')
|
||||
const result1 = await permissionUtils.requestPermission('photo_library', '我们需要访问您的相册以上传图片/视频');
|
||||
this.$emit('ckecknowQer','xj')
|
||||
const result2 = await permissionUtils.requestPermission('camera', '我们需要访问您的相机以上传图片/视频');
|
||||
if (result1 && result2) {
|
||||
this.openCamera();
|
||||
} else {
|
||||
locationService.openAppSettings();
|
||||
// uni.showToast({ title: '相机权限被拒绝', icon: 'none' });
|
||||
}
|
||||
this.$emit('ckeckisShowPer',false)
|
||||
this.$emit('ckecknowQer','')
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('上传出错:', error)
|
||||
this.$emit('error', error)
|
||||
} finally {
|
||||
this.loading = false
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const isIOS = systemInfo.platform === 'ios';
|
||||
|
||||
// 弹出操作菜单
|
||||
const res = await new Promise((resolve, reject) => {
|
||||
uni.showActionSheet({
|
||||
itemList: ['拍照', '从相册选择'],
|
||||
success: resolve,
|
||||
fail: reject
|
||||
});
|
||||
}).catch(() => ({ tapIndex: -1 }));
|
||||
|
||||
if (res.tapIndex === -1) return;
|
||||
|
||||
// 拍照
|
||||
if (res.tapIndex === 0) {
|
||||
if (isIOS) {
|
||||
this._openPicker('camera');
|
||||
} else {
|
||||
// 显示相机权限说明
|
||||
this.$emit('ckeckisShowPer', true);
|
||||
this.$emit('ckecknowQer', 'xj');
|
||||
const { granted } = await permissionUtils.checkPermission('camera', '需要相机权限以拍照');
|
||||
if (granted) {
|
||||
this.$emit('ckeckisShowPer', false);
|
||||
this._openPicker('camera');
|
||||
return;
|
||||
}
|
||||
this.$emit('ckeckisShowPer', false);
|
||||
const confirm = await this.showPermissionDialog('相机权限申请', '我们需要访问您的相机权限,以便您拍照上传');
|
||||
if (!confirm) return;
|
||||
const result = await permissionUtils.requestPermission('camera', '需要相机权限以拍照');
|
||||
if (result) {
|
||||
this._openPicker('camera');
|
||||
} else {
|
||||
locationService.openAppSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 从相册选择
|
||||
else if (res.tapIndex === 1) {
|
||||
if (isIOS) {
|
||||
this._openPicker('album');
|
||||
} else {
|
||||
// 显示存储权限说明
|
||||
this.$emit('ckeckisShowPer', true);
|
||||
this.$emit('ckecknowQer', 'xc');
|
||||
const { granted } = await permissionUtils.checkPermission('photo_library', '需要存储权限以选择照片');
|
||||
if (granted) {
|
||||
this.$emit('ckeckisShowPer', false);
|
||||
this._openPicker('album');
|
||||
return;
|
||||
}
|
||||
this.$emit('ckeckisShowPer', false);
|
||||
const confirm = await this.showPermissionDialog('存储权限申请', '我们需要访问您的相册权限,以便您选择照片');
|
||||
if (!confirm) return;
|
||||
const result = await permissionUtils.requestPermission('photo_library', '需要存储权限以选择照片');
|
||||
if (result) {
|
||||
this._openPicker('album');
|
||||
} else {
|
||||
locationService.openAppSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 实际打开选择器(图片或视频)
|
||||
async _openPicker(sourceType) {
|
||||
try {
|
||||
if (this.accept === 'image/*') {
|
||||
const count = this.maxCount - this.fileList.length;
|
||||
if (count <= 0) {
|
||||
uni.showToast({ title: `最多上传${this.maxCount}个文件`, icon: 'none' });
|
||||
return;
|
||||
}
|
||||
const res = await uni.chooseImage({
|
||||
count: count,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: [sourceType]
|
||||
});
|
||||
for (const file of res.tempFiles) {
|
||||
await this.uploadFile(file);
|
||||
}
|
||||
} else if (this.accept === 'video/*') {
|
||||
const res = await uni.chooseVideo({
|
||||
sourceType: [sourceType],
|
||||
compressed: true,
|
||||
maxDuration: 60
|
||||
});
|
||||
await this.uploadFile(res);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('选择文件失败:', error);
|
||||
}
|
||||
},
|
||||
async openCamera() {
|
||||
if (this.loading) return
|
||||
if (this.fileList.length >= this.maxCount) {
|
||||
return uni.showToast({
|
||||
title: `最多上传${this.maxCount}个文件`,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
this.loading = true
|
||||
let res;
|
||||
let tempFiles;
|
||||
if(this.accept == 'image/*') {
|
||||
const res = await uni.chooseImage({
|
||||
count: this.maxCount - this.fileList.length,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera']
|
||||
})
|
||||
const tempFiles = res.tempFiles
|
||||
for (const file of tempFiles) {
|
||||
await this.uploadFile(file)
|
||||
}
|
||||
}else if(this.accept == 'video/*') {
|
||||
const res = await uni.chooseVideo({
|
||||
count: 1,
|
||||
sourceType: ['album', 'camera'],
|
||||
compressed: false
|
||||
})
|
||||
// #ifdef H5
|
||||
const file = res.tempFile;
|
||||
// #endif
|
||||
// #ifdef APP-PLUS || MP-WEIXIN
|
||||
const file = res;
|
||||
// #endif
|
||||
await this.uploadFile(file)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('上传出错:', error)
|
||||
this.$emit('error', error)
|
||||
}
|
||||
},
|
||||
// 上传文件到OSS
|
||||
async uploadFile(file) {
|
||||
// 检查文件大小
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export default {
|
|||
// 圆环颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: '#E8101E'
|
||||
default: '#FF4767'
|
||||
},
|
||||
// 背景圆环颜色
|
||||
backgroundColor: {
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ export default {
|
|||
}
|
||||
|
||||
.time-option.active .time-text {
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
|
@ -413,7 +413,7 @@ export default {
|
|||
|
||||
.time-discount {
|
||||
font-size: 24rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
padding: 4rpx 12rpx;
|
||||
background-color: #fff5f6;
|
||||
border-radius: 20rpx;
|
||||
|
|
@ -444,7 +444,7 @@ export default {
|
|||
color: #666;
|
||||
}
|
||||
.active {
|
||||
color: #E8101E; /* 选中态主题色 */
|
||||
color: #FF4767; /* 选中态主题色 */
|
||||
}
|
||||
|
||||
/* 服务时间按钮专属:控制下拉图标尺寸 */
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@
|
|||
|
||||
/* 列表容器 */
|
||||
.list-container {
|
||||
padding: 0 20rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
|
||||
/* 加载提示 */
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export default {
|
|||
// 已定义的激活色props(无需修改)
|
||||
activeColor: {
|
||||
type: String,
|
||||
default: "#E8101E",
|
||||
default: "#FF4767",
|
||||
},
|
||||
// 已定义的非激活色props(无需修改)
|
||||
inactiveColor: {
|
||||
|
|
@ -138,6 +138,8 @@ export default {
|
|||
font-size: 30rpx;
|
||||
color: var(--inactive-color);
|
||||
transition: color 0.2s;
|
||||
white-space: nowrap;
|
||||
|
||||
}
|
||||
|
||||
/* 激活色:使用CSS变量 --active-color */
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export default {
|
|||
// 激活状态的颜色
|
||||
activeColor: {
|
||||
type: String,
|
||||
default: "#E8101E",
|
||||
default: "#FF4767",
|
||||
},
|
||||
// 非激活状态的颜色
|
||||
inactiveColor: {
|
||||
|
|
@ -129,7 +129,7 @@ export default {
|
|||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border: 2rpx solid #E8101E;
|
||||
border: 2rpx solid #FF4767;
|
||||
border-radius: 48rpx;
|
||||
}
|
||||
|
||||
|
|
@ -143,6 +143,6 @@ export default {
|
|||
}
|
||||
|
||||
.icon-item.active .icon-text {
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ export default {
|
|||
padding-left: 30rpx;
|
||||
position: relative;
|
||||
&__point {
|
||||
background-color: #E8101E;
|
||||
background-color: #FF4767;
|
||||
height: 6rpx;
|
||||
width: 6rpx;
|
||||
border-radius: 50%;
|
||||
|
|
@ -221,7 +221,7 @@ export default {
|
|||
}
|
||||
.active {
|
||||
background: #ffffff;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
}
|
||||
}
|
||||
&__right {
|
||||
|
|
@ -295,17 +295,17 @@ export default {
|
|||
height: 82rpx;
|
||||
font-weight: 400;
|
||||
font-size: 30rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
line-height: 42rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
}
|
||||
&__sure {
|
||||
border-radius: 41rpx;
|
||||
border: 2rpx solid #E8101E;
|
||||
border: 2rpx solid #FF4767;
|
||||
}
|
||||
&__reset {
|
||||
background: #E8101E;
|
||||
background: #FF4767;
|
||||
border-radius: 41rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ export default {
|
|||
}
|
||||
.active {
|
||||
background: rgba(252, 67, 124, 0.1);
|
||||
color: #E8101E;
|
||||
border: 1rpx solid #E8101E;
|
||||
color: #FF4767;
|
||||
border: 1rpx solid #FF4767;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@
|
|||
width: 690rpx;
|
||||
height: 68rpx;
|
||||
background: #FFFFFF;
|
||||
border: 2rpx solid #E8101E;
|
||||
border: 2rpx solid #FF4767;
|
||||
background-color: #fafafa;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ export default {
|
|||
border: 1rpx solid #fba9bb;
|
||||
font-weight: 500;
|
||||
font-size: 24rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ export default {
|
|||
margin-top: 10rpx;
|
||||
font-weight: 500;
|
||||
font-size: 24rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
line-height: 33rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,56 @@
|
|||
<template>
|
||||
<view class="noData">
|
||||
<image src="/static/images/shop/noData.png" class="noData-img" mode="widthFix"></image>
|
||||
<text class="noData-text">暂无数据哦~</text>
|
||||
</view>
|
||||
<view class="noData">
|
||||
<image
|
||||
:style="{ 'margin-top': top }"
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/57309ff1-476c-43ec-8bad-f9e529e0a25b"
|
||||
class="noData-img"
|
||||
mode="widthFix"
|
||||
></image>
|
||||
<text class="noData-text">{{ tipText }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "noData",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
props: {
|
||||
tipText: {
|
||||
type: String,
|
||||
default: "暂无数据哦~",
|
||||
},
|
||||
top: {
|
||||
type: String,
|
||||
default: "154rpx",
|
||||
},
|
||||
},
|
||||
components: {},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.noData{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
.noData-img{
|
||||
margin-top: 100rpx;
|
||||
width: 348rpx;
|
||||
height: 348rpx;
|
||||
}
|
||||
.noData-text{
|
||||
width: 100%;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
line-height: 40rpx;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.noData {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
.noData-img {
|
||||
margin-top: 154rpx;
|
||||
width: 348rpx;
|
||||
height: 348rpx;
|
||||
}
|
||||
.noData-text {
|
||||
width: 100%;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
line-height: 40rpx;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
<template>
|
||||
<view class="noLogin">
|
||||
<image
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/55d8e65a-04e4-4164-b956-278c6bc28a2b.png"
|
||||
class="noLogin-img"
|
||||
mode="widthFix"
|
||||
></image>
|
||||
<text class="noLogin-text">{{ tipText }}</text>
|
||||
<view class="loginBtn" @click="goLogin">立即登录</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "noLogin",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
props: {
|
||||
tipText: {
|
||||
type: String,
|
||||
default: "您还没有登录,请登录后查看订单",
|
||||
},
|
||||
},
|
||||
components: {},
|
||||
methods: {
|
||||
goLogin() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/blogPopup/blogPopup",
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.noLogin {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
// justify-content: center;
|
||||
height: 100%;
|
||||
.noLogin-img {
|
||||
margin-top: 154rpx;
|
||||
width: 247rpx;
|
||||
height: 187rpx;
|
||||
}
|
||||
.noLogin-text {
|
||||
font-family: PingFangSC, PingFang SC;
|
||||
font-weight: 400;
|
||||
font-size: 30rpx;
|
||||
color: #333333;
|
||||
line-height: 42rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
margin-top: 60rpx;
|
||||
margin-bottom: 31rpx;
|
||||
}
|
||||
.loginBtn {
|
||||
width: 262rpx;
|
||||
height: 86rpx;
|
||||
background: #FF4767;
|
||||
border-radius: 43rpx;
|
||||
text-align: center;
|
||||
line-height: 86rpx;
|
||||
font-weight: 500;
|
||||
font-size: 34rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,216 @@
|
|||
<template>
|
||||
<view class="popup-picker" v-if="show">
|
||||
<!-- 遮罩层 -->
|
||||
<view
|
||||
class="popup-mask"
|
||||
v-if="show"
|
||||
:class="{ show: show }"
|
||||
@click="handleClose"
|
||||
></view>
|
||||
|
||||
<!-- 选择器内容 -->
|
||||
<view class="popup-content" :class="{ show: show }">
|
||||
<!-- 头部 -->
|
||||
<view class="popup-header">
|
||||
<text class="cancel" @click="handleClose">取消</text>
|
||||
<text class="title">{{ title }}</text>
|
||||
<text class="confirm" @click="handleConfirm">确定</text>
|
||||
</view>
|
||||
|
||||
<!-- 选择器 -->
|
||||
<picker-view
|
||||
:value="currentValue"
|
||||
@change="handleChange"
|
||||
class="picker-view"
|
||||
immediate-change
|
||||
>
|
||||
<picker-view-column v-for="(column, index) in columns" :key="index">
|
||||
<view
|
||||
class="picker-item"
|
||||
v-for="(item, itemIndex) in column"
|
||||
:key="item.id"
|
||||
>
|
||||
{{ item[labelKey] || item.title }}
|
||||
</view>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "PopupPicker",
|
||||
props: {
|
||||
// 是否显示
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// 标题
|
||||
title: {
|
||||
type: String,
|
||||
default: "请选择",
|
||||
},
|
||||
// 选项数据
|
||||
columns: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
// 当前选中的值
|
||||
value: {
|
||||
type: Array,
|
||||
default: () => [0],
|
||||
},
|
||||
// 选项的标签字段
|
||||
labelKey: {
|
||||
type: String,
|
||||
default: "label",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentValue: this.value,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(val) {
|
||||
console.log("selectedType.id", val);
|
||||
this.currentValue = val;
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 处理选择变化
|
||||
handleChange(e) {
|
||||
console.log(e.detail.value, "e.detail.value");
|
||||
this.currentValue = e.detail.value;
|
||||
},
|
||||
|
||||
// 处理关闭
|
||||
handleClose() {
|
||||
this.$emit("close");
|
||||
setTimeout(() => {
|
||||
this.show = false;
|
||||
}, 300);
|
||||
},
|
||||
|
||||
// 处理确认
|
||||
handleConfirm() {
|
||||
const selectedItems = this.columns;
|
||||
console.log(selectedItems, "selectedItems");
|
||||
if (this.currentValue[0] >= selectedItems[0].length) {
|
||||
this.currentValue = [0];
|
||||
}
|
||||
this.$emit("confirm", {
|
||||
value: this.currentValue[0],
|
||||
items: selectedItems[0],
|
||||
item: selectedItems[0][this.currentValue[0] || 0],
|
||||
});
|
||||
this.handleClose();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.popup-picker {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
/* 遮罩层 */
|
||||
.popup-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.popup-mask.show {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* 内容区 */
|
||||
.popup-content {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ffffff;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
transform: translateY(-100%);
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.popup-content.show {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* 头部 */
|
||||
.popup-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 88rpx;
|
||||
padding: 0 32rpx;
|
||||
border-bottom: 1rpx solid #eeeeee;
|
||||
}
|
||||
|
||||
.cancel {
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.confirm {
|
||||
font-size: 32rpx;
|
||||
color: #4080ff;
|
||||
}
|
||||
|
||||
/* 选择器 */
|
||||
.picker-view {
|
||||
width: 100%;
|
||||
height: 480rpx;
|
||||
}
|
||||
|
||||
.picker-item {
|
||||
line-height: 68rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
/* 平台适配 */
|
||||
/* #ifdef H5 */
|
||||
.popup-content {
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef MP-WEIXIN */
|
||||
.popup-content {
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
/* #endif */
|
||||
</style>
|
||||
|
|
@ -35,13 +35,13 @@
|
|||
class="time-picker-content__time__list__item"
|
||||
v-for="(time, index) in timeOptions[selectedDateIndex]"
|
||||
:key="index"
|
||||
:class="[getItemClass(time.state || 0), {
|
||||
firstActive: selectedTimeIndex == index,
|
||||
lastActive: selectedTimeIndex + serviceTimeNum - 1 == index,
|
||||
isActive: index >= selectedTimeIndex &&
|
||||
index <= selectedTimeIndex + serviceTimeNum - 1 &&
|
||||
sureTimeDataIndex === selectedDateIndex &&
|
||||
selectedTimeIndex !== null
|
||||
:class="[getItemClass(time.state || 0),{
|
||||
lastActive:selectedTimeIndex + serviceTimeNum==index,
|
||||
firstActive:selectedTimeIndex==index,
|
||||
isActive:
|
||||
index >= selectedTimeIndex && index <= selectedTimeIndex + serviceTimeNum &&
|
||||
sureTimeDataIndex === selectedDateIndex &&
|
||||
selectedTimeIndex !== null,
|
||||
}]"
|
||||
@click="selectTime(time, index)"
|
||||
>
|
||||
|
|
@ -149,7 +149,7 @@ export default {
|
|||
watch: {
|
||||
service: {
|
||||
handler(newValue) {
|
||||
this.serviceTimeNum = Math.max(1, Math.ceil((newValue.server_time || 0) / 10 + 1));
|
||||
this.serviceTimeNum = Math.max(1, Math.ceil((newValue.server_time || 0) / 10));
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
|
|
@ -408,11 +408,11 @@ export default {
|
|||
|
||||
.isActive {
|
||||
background: rgba(252, 67, 124, 0.08);
|
||||
color: #e8101e !important;
|
||||
color: #FF4767 !important;
|
||||
}
|
||||
|
||||
.isActive .time-picker-content__time__list__item__text {
|
||||
color: #e8101e !important;
|
||||
color: #FF4767 !important;
|
||||
}
|
||||
|
||||
/* 选中样式前后弧度 */
|
||||
|
|
@ -433,7 +433,7 @@ border-radius: 0rpx 51rpx 51rpx 0rpx}
|
|||
.time-picker-content__time__sure__box {
|
||||
width: 648rpx;
|
||||
height: 94rpx;
|
||||
background: #E8101E;
|
||||
background: #FF4767;
|
||||
border-radius: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -467,8 +467,8 @@
|
|||
.isActive {
|
||||
background: rgba(252, 67, 124, 0.08);
|
||||
border-radius: 10rpx;
|
||||
border: 1rpx solid #E8101E;
|
||||
color: #E8101E;
|
||||
border: 1rpx solid #FF4767;
|
||||
color: #FF4767;
|
||||
/* 选中状态 */
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +493,7 @@
|
|||
&__box {
|
||||
width: 648rpx;
|
||||
height: 94rpx;
|
||||
background: linear-gradient(140deg, #fa4e9a 0%, #E8101E 100%);
|
||||
background: linear-gradient(140deg, #fa4e9a 0%, #FF4767 100%);
|
||||
border-radius: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -1,30 +1,19 @@
|
|||
<template>
|
||||
<view class="service-code-modal" v-if="show" :style="{bottom:`${popBotom}px`}">
|
||||
<view class="service-code-modal" v-if="show" :style="{ bottom: `${popBotom}px` }">
|
||||
<view class="modal-mask" @touchmove.stop.prevent></view>
|
||||
<view class="modal-content">
|
||||
<view class="modal-title">开始服务</view>
|
||||
<view class="modal-subtitle">请输入服务码</view>
|
||||
<view class="code-box">
|
||||
<view
|
||||
v-for="(item, idx) in codeLength"
|
||||
:key="idx"
|
||||
<view v-for="(item, idx) in codeLength" :key="idx"
|
||||
:class="['code-cell', idx === currentIndex ? 'active' : '', code[idx] ? 'filled' : '']">
|
||||
<text v-if="code[idx]">{{ code[idx] }}</text>
|
||||
</view>
|
||||
<!-- 隐藏真实输入框 -->
|
||||
<input
|
||||
:adjust-position="false"
|
||||
class="real-input"
|
||||
type="number"
|
||||
:maxlength="codeLength"
|
||||
v-model="inputValue"
|
||||
:focus="true"
|
||||
@input="onInput"
|
||||
@focus="onFocus"
|
||||
@keyboardheightchange="onkeyboardheightchange"
|
||||
@blur="onBlur"
|
||||
cursor-spacing="100"
|
||||
ref="realInput" />
|
||||
<input :adjust-position="false" class="real-input" type="number" :maxlength="codeLength"
|
||||
v-model="inputValue" :focus="true" @input="onInput" @focus="onFocus"
|
||||
@keyboardheightchange="onkeyboardheightchange" @blur="onBlur" cursor-spacing="100"
|
||||
cursor-color="transparent" ref="realInput" />
|
||||
</view>
|
||||
<button class="confirm-btn" :disabled="code.length < codeLength" @click="onConfirm">确定</button>
|
||||
<view class="close-btn" @click="close">×</view>
|
||||
|
|
@ -33,210 +22,212 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'serviceCodeInput',
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
codeLength: {
|
||||
type: Number,
|
||||
default: 6
|
||||
export default {
|
||||
name: 'serviceCodeInput',
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
codeLength: {
|
||||
type: Number,
|
||||
default: 6
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
inputValue: '',
|
||||
isFocus: true,
|
||||
keyboardHeight: 0,
|
||||
popBotom: 0,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
code() {
|
||||
return this.inputValue.split('').slice(0, this.codeLength)
|
||||
},
|
||||
currentIndex() {
|
||||
return this.inputValue.length
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// show(val) {
|
||||
// if (val) {
|
||||
// this.$refs.realInput && this.$refs.realInput.focus
|
||||
// } else {
|
||||
// this.inputValue = ''
|
||||
// }
|
||||
// }
|
||||
},
|
||||
mounted() {
|
||||
// uni.onKeyboardHeightChange((res)=>{
|
||||
// this.keyboardHeight = res.height;
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
onInput(e) {
|
||||
let val = e.detail.value.replace(/[^0-9]/g, '').slice(0, this.codeLength)
|
||||
this.inputValue = val
|
||||
this.$emit('input', val)
|
||||
if (val.length === this.codeLength) {
|
||||
this.$emit('finish', val)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
inputValue: '',
|
||||
isFocus: true,
|
||||
keyboardHeight: 0,
|
||||
popBotom:0,
|
||||
onFocus(e) {
|
||||
this.isFocus = true
|
||||
this.inputValue = ''
|
||||
},
|
||||
onkeyboardheightchange(e) {
|
||||
this.popBotom = e.target.height || 0
|
||||
},
|
||||
onBlur() {
|
||||
this.isFocus = false
|
||||
},
|
||||
onConfirm() {
|
||||
if (this.inputValue.length === this.codeLength) {
|
||||
this.$emit('confirm', this.inputValue);
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
code() {
|
||||
return this.inputValue.split('').slice(0, this.codeLength)
|
||||
},
|
||||
currentIndex() {
|
||||
return this.inputValue.length
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// show(val) {
|
||||
// if (val) {
|
||||
// this.$refs.realInput && this.$refs.realInput.focus
|
||||
// } else {
|
||||
// this.inputValue = ''
|
||||
// }
|
||||
// }
|
||||
},
|
||||
mounted() {
|
||||
// uni.onKeyboardHeightChange((res)=>{
|
||||
// this.keyboardHeight = res.height;
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
onInput(e) {
|
||||
let val = e.detail.value.replace(/[^0-9]/g, '').slice(0, this.codeLength)
|
||||
this.inputValue = val
|
||||
this.$emit('input', val)
|
||||
if (val.length === this.codeLength) {
|
||||
this.$emit('finish', val)
|
||||
}
|
||||
},
|
||||
onFocus(e) {
|
||||
this.isFocus = true
|
||||
this.inputValue = ''
|
||||
},
|
||||
onkeyboardheightchange(e){
|
||||
this.popBotom = e.target.height || 0
|
||||
},
|
||||
onBlur() {
|
||||
this.isFocus = false
|
||||
},
|
||||
onConfirm() {
|
||||
if (this.inputValue.length === this.codeLength) {
|
||||
this.$emit('confirm', this.inputValue);
|
||||
}
|
||||
|
||||
},
|
||||
close() {
|
||||
this.$emit('close')
|
||||
}
|
||||
close() {
|
||||
this.$emit('close')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.service-code-modal {
|
||||
.service-code-modal {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 999999;
|
||||
|
||||
.modal-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 999999;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.modal-mask {
|
||||
.modal-content {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
padding: 56rpx 40rpx 40rpx 40rpx;
|
||||
box-shadow: 0 -8rpx 32rpx rgba(0, 0, 0, 0.08);
|
||||
min-height: 340rpx;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
animation: modalUp 0.25s;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #222;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-subtitle {
|
||||
font-size: 28rpx;
|
||||
color: #888;
|
||||
margin: 24rpx 0 40rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.code-box {
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 48rpx;
|
||||
position: relative;
|
||||
|
||||
.code-cell {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border: 2rpx solid #eee;
|
||||
border-radius: 16rpx;
|
||||
margin-right: 24rpx;
|
||||
font-size: 40rpx;
|
||||
color: #ff4d8d;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
line-height: 72rpx;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.2s;
|
||||
|
||||
&.active {
|
||||
border-color: #ff4d8d;
|
||||
}
|
||||
|
||||
&.filled {
|
||||
border-color: #ff4d8d;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.real-input {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
padding: 56rpx 40rpx 40rpx 40rpx;
|
||||
box-shadow: 0 -8rpx 32rpx rgba(0, 0, 0, 0.08);
|
||||
min-height: 340rpx;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
animation: modalUp 0.25s;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #222;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-subtitle {
|
||||
font-size: 28rpx;
|
||||
color: #888;
|
||||
margin: 24rpx 0 40rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.code-box {
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 48rpx;
|
||||
position: relative;
|
||||
|
||||
.code-cell {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border: 2rpx solid #eee;
|
||||
border-radius: 16rpx;
|
||||
margin-right: 24rpx;
|
||||
font-size: 40rpx;
|
||||
color: #ff4d8d;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
line-height: 72rpx;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.2s;
|
||||
|
||||
&.active {
|
||||
border-color: #ff4d8d;
|
||||
}
|
||||
|
||||
&.filled {
|
||||
border-color: #ff4d8d;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.real-input {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #ff4d8d;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
z-index: 2;
|
||||
caret-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #ff4d8d;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-top: 16rpx;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border: none;
|
||||
|
||||
&:disabled {
|
||||
background: #ffd1e3;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-top: 16rpx;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border: none;
|
||||
|
||||
&:disabled {
|
||||
background: #ffd1e3;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
position: absolute;
|
||||
right: 32rpx;
|
||||
top: 32rpx;
|
||||
font-size: 48rpx;
|
||||
color: #bbb;
|
||||
z-index: 10;
|
||||
font-weight: bold;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes modalUp {
|
||||
from {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.close-btn {
|
||||
position: absolute;
|
||||
right: 32rpx;
|
||||
top: 32rpx;
|
||||
font-size: 48rpx;
|
||||
color: #bbb;
|
||||
z-index: 10;
|
||||
font-weight: bold;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes modalUp {
|
||||
from {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -181,7 +181,7 @@
|
|||
position: absolute;
|
||||
top: 0rpx;
|
||||
left: 0rpx;
|
||||
background-color: #E8101E;
|
||||
background-color: #FF4767;
|
||||
color: #FFFFFF;
|
||||
font-size: 24rpx;
|
||||
padding: 6rpx 14rpx;
|
||||
|
|
@ -247,7 +247,7 @@
|
|||
.price-symbol {
|
||||
font-weight: 500;
|
||||
font-size: 24rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
line-height: 33rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
|
|
@ -256,7 +256,7 @@
|
|||
.price-value {
|
||||
font-weight: 500;
|
||||
font-size: 36rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
line-height: 33rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
|
|
@ -332,12 +332,12 @@
|
|||
|
||||
.price-symbol {
|
||||
font-size: 24rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 32rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
font-weight: 500;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@
|
|||
.price-text{
|
||||
font-weight: 500;
|
||||
font-size: 24rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
line-height: 33rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
|
|
@ -345,7 +345,7 @@
|
|||
.price-symbol {
|
||||
font-weight: 500;
|
||||
font-size: 20rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
line-height: 33rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
|
|
@ -354,7 +354,7 @@
|
|||
.price-value {
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
line-height: 33rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
|
|
|
|||
|
|
@ -1,63 +1,54 @@
|
|||
<template>
|
||||
<view class="step-tab">
|
||||
<view class="step-container">
|
||||
<!-- 步骤1: 入驻协议 -->
|
||||
<view class="step-item" :class="getStepClass(0)">
|
||||
<view class="step-icon">
|
||||
<image
|
||||
v-if="currentStep === 0"
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/55a51333-318f-4ae4-8402-aca265bd499d"
|
||||
<image
|
||||
v-if="mappedStep === 0"
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d62a1d01-52cb-418e-ba5b-afef513061b9.png"
|
||||
class="step-img active-circle"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<view v-else-if="currentStep > 0" class="step-done">1</view>
|
||||
<view v-else-if="mappedStep > 0" class="step-done">1</view>
|
||||
<view v-else class="step-number">1</view>
|
||||
</view>
|
||||
<text class="step-text" :class="{ active: currentStep === 0 }">入驻协议</text>
|
||||
<text class="step-text" :class="{ active: mappedStep === 0 }">入驻协议</text>
|
||||
</view>
|
||||
|
||||
<!-- 第一个连接线 -->
|
||||
|
||||
<view class="line-segment line-1">
|
||||
<view class="line-progress" :class="{ active: line1Active, deactivating: line1Deactivating }"></view>
|
||||
</view>
|
||||
|
||||
<!-- 步骤2: 根据身份显示不同信息 -->
|
||||
|
||||
<view class="step-item" :class="getStepClass(1)">
|
||||
<view class="step-icon">
|
||||
<image
|
||||
v-if="currentStep === 1"
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/55a51333-318f-4ae4-8402-aca265bd499d"
|
||||
<image
|
||||
v-if="mappedStep === 1"
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d62a1d01-52cb-418e-ba5b-afef513061b9.png"
|
||||
class="step-img active-circle"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<view v-else-if="currentStep > 1" class="step-done">2</view>
|
||||
<view v-else-if="mappedStep > 1" class="step-done">2</view>
|
||||
<view v-else class="step-number">2</view>
|
||||
</view>
|
||||
<text class="step-text" :class="{ active: currentStep === 1 }">
|
||||
{{ identity === 1 ? '个人信息' : '资质信息' }}
|
||||
</text>
|
||||
<text class="step-text" :class="{ active: mappedStep === 1 }">基本信息</text>
|
||||
</view>
|
||||
|
||||
<!-- 第二个连接线 -->
|
||||
|
||||
<view class="line-segment line-2">
|
||||
<view class="line-progress" :class="{ active: line2Active, deactivating: line2Deactivating }"></view>
|
||||
</view>
|
||||
|
||||
<!-- 步骤3: 根据身份显示不同信息 -->
|
||||
|
||||
<view class="step-item" :class="getStepClass(2)">
|
||||
<view class="step-icon">
|
||||
<image
|
||||
v-if="currentStep === 2"
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/55a51333-318f-4ae4-8402-aca265bd499d"
|
||||
<image
|
||||
v-if="mappedStep === 2"
|
||||
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d62a1d01-52cb-418e-ba5b-afef513061b9.png"
|
||||
class="step-img active-circle"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<view v-else-if="currentStep > 2" class="step-done">3</view>
|
||||
<view v-else-if="mappedStep > 2" class="step-done">3</view>
|
||||
<view v-else class="step-number">3</view>
|
||||
</view>
|
||||
<text class="step-text" :class="{ active: currentStep === 2 }">
|
||||
{{ identity === 1 ? '资质信息' : '门店信息' }}
|
||||
</text>
|
||||
<text class="step-text" :class="{ active: mappedStep === 2 }">资质认证</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -67,32 +58,23 @@
|
|||
export default {
|
||||
name: "StepTab",
|
||||
props: {
|
||||
// 当前步骤索引 (0, 1, 2)
|
||||
currentStep: {
|
||||
mappedStep: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 身份类型:1-手艺人,2-商家
|
||||
identity: {
|
||||
type: Number,
|
||||
default: 2
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
prevStep: 0, // 记录上一步骤
|
||||
line1Active: false, // 第一条线激活状态
|
||||
line2Active: false, // 第二条线激活状态
|
||||
line1Deactivating: false, // 第一条线正在取消激活
|
||||
line2Deactivating: false // 第二条线正在取消激活
|
||||
prevStep: 0,
|
||||
line1Active: false,
|
||||
line2Active: false,
|
||||
line1Deactivating: false,
|
||||
line2Deactivating: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 监听currentStep变化,处理线条动画
|
||||
currentStep(newVal, oldVal) {
|
||||
mappedStep(newVal, oldVal) {
|
||||
this.prevStep = oldVal;
|
||||
|
||||
// 处理前进动画
|
||||
if (newVal > oldVal) {
|
||||
if (newVal >= 1) {
|
||||
this.line1Active = true;
|
||||
|
|
@ -102,38 +84,34 @@ export default {
|
|||
this.line2Active = true;
|
||||
this.line2Deactivating = false;
|
||||
}
|
||||
}
|
||||
// 处理返回动画
|
||||
else if (newVal < oldVal) {
|
||||
} else if (newVal < oldVal) {
|
||||
if (newVal < 2) {
|
||||
this.line2Deactivating = true;
|
||||
setTimeout(() => {
|
||||
this.line2Active = false;
|
||||
this.line2Deactivating = false;
|
||||
}, 300); // 与动画持续时间匹配
|
||||
}, 300);
|
||||
}
|
||||
if (newVal < 1) {
|
||||
this.line1Deactivating = true;
|
||||
setTimeout(() => {
|
||||
this.line1Active = false;
|
||||
this.line1Deactivating = false;
|
||||
}, 300); // 与动画持续时间匹配
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 初始化线条状态
|
||||
this.line1Active = this.currentStep >= 1;
|
||||
this.line2Active = this.currentStep >= 2;
|
||||
this.line1Active = this.mappedStep >= 1;
|
||||
this.line2Active = this.mappedStep >= 2;
|
||||
},
|
||||
methods: {
|
||||
// 获取步骤的CSS类名
|
||||
getStepClass(stepIndex) {
|
||||
if (stepIndex === this.currentStep) {
|
||||
if (stepIndex === this.mappedStep) {
|
||||
return 'active';
|
||||
}
|
||||
else if (stepIndex < this.currentStep) {
|
||||
else if (stepIndex < this.mappedStep) {
|
||||
return 'completed';
|
||||
}
|
||||
return '';
|
||||
|
|
@ -206,7 +184,7 @@ export default {
|
|||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: inset 0 0 4rpx rgba(232, 16, 30, 0.2);
|
||||
|
|
@ -259,35 +237,16 @@ export default {
|
|||
transform-origin: left center;
|
||||
}
|
||||
|
||||
/* 激活状态的线条 - 前进动画 */
|
||||
.line-progress.active {
|
||||
width: 100%;
|
||||
background-color: #E8101E;
|
||||
background-color: #FF4767;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
/* 取消激活状态的线条 - 返回动画 */
|
||||
.line-progress.deactivating {
|
||||
width: 0%;
|
||||
background-color: #E8101E;
|
||||
background-color: #FF4767;
|
||||
transition: width 0.3s ease;
|
||||
transform-origin: right center;
|
||||
}
|
||||
|
||||
/* 响应式调整 */
|
||||
@media (max-width: 750rpx) {
|
||||
.step-container {
|
||||
/* padding: 5rpx 40rpx; */
|
||||
}
|
||||
|
||||
.line-segment {
|
||||
/* width: 100rpx; */
|
||||
}
|
||||
|
||||
/* .line-1,
|
||||
.line-2 {
|
||||
margin-left: 15rpx;
|
||||
margin-right: 15rpx;
|
||||
} */
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,124 +1,209 @@
|
|||
<template>
|
||||
<uv-tabbar fixed :value="selected" @change="change1" activeColor="#ee0a24" :placeholder="false"
|
||||
:safeAreaInsetBottom="false" :customStyle="{height:`110rpx`}">
|
||||
<uv-tabbar-item v-for="(item,index) in $store.state.tabbarList" :key="index" :badge="getNum(index)" :customStyle="{height:`110rpx`}">
|
||||
<template v-slot:active-icon>
|
||||
<image class="icon" :src="item.selectedIconPath"></image>
|
||||
</template>
|
||||
<template v-slot:inactive-icon>
|
||||
<image class="icon" :src="item.iconPath"></image>
|
||||
</template>
|
||||
</uv-tabbar-item>
|
||||
</uv-tabbar>
|
||||
<uv-tabbar
|
||||
v-if="tabbarReady"
|
||||
:key="refreshKey"
|
||||
fixed
|
||||
:value="currentTabIndex"
|
||||
@change="onTabChange"
|
||||
activeColor="#FF4767"
|
||||
:placeholder="false"
|
||||
:safeAreaInsetBottom="false"
|
||||
:customStyle="{height:'110rpx'}"
|
||||
>
|
||||
<uv-tabbar-item
|
||||
v-for="(item, idx) in tabbarList"
|
||||
:key="idx"
|
||||
:name="idx"
|
||||
:text="item.text"
|
||||
:badge="getNum(idx)"
|
||||
:customStyle="{height:'110rpx'}"
|
||||
@click="onItemClick(idx)"
|
||||
>
|
||||
<template v-slot:active-icon>
|
||||
<image class="icon" :src="item.selectedIconPath"></image>
|
||||
</template>
|
||||
<template v-slot:inactive-icon>
|
||||
<image class="icon" :src="item.iconPath"></image>
|
||||
</template>
|
||||
</uv-tabbar-item>
|
||||
</uv-tabbar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
export default {
|
||||
name: "tab-bar",
|
||||
props: {
|
||||
selected: {
|
||||
type: [Number, String]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabbarList: [{
|
||||
"iconPath": "/static/images/tabbar/new_home_gray.png",
|
||||
"text": "首页",
|
||||
"selectedIconPath": "/static/images/tabbar/new_home.png",
|
||||
"pagePath": "/pages/home/home"
|
||||
},
|
||||
{
|
||||
"iconPath": "/static/images/tabbar/new_order_gray.png",
|
||||
"text": "订单",
|
||||
"selectedIconPath": "/static/images/tabbar/new_order.png",
|
||||
"pagePath": "/pages/order/userorder-list"
|
||||
},
|
||||
{
|
||||
"iconPath": "/static/images/tabbar/new_message_gray.png",
|
||||
"text": "消息",
|
||||
"selectedIconPath": "/static/images/tabbar/new_message.png",
|
||||
"pagePath": "/pages/message/message"
|
||||
},
|
||||
{
|
||||
"iconPath": "/static/images/tabbar/new_my_gray.png",
|
||||
"text": "我的",
|
||||
"selectedIconPath": "/static/images/tabbar/new_my.png",
|
||||
"pagePath": "/pages/my/my"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
messageNum(){
|
||||
return this.$store.state.messageNum || 0
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
if (!this.$store.state.tabbarList.length) {
|
||||
let isnNetwork = uni.getStorageSync("isnNetwork");
|
||||
if (isnNetwork) {
|
||||
await this.getButtonImg()
|
||||
} else {
|
||||
uni.getNetworkType({
|
||||
success: (res) => {
|
||||
console.log(res.networkType);
|
||||
if (res.networkType == "none") {
|
||||
|
||||
this.$store.commit("setTabbarList", this.tabbarList)
|
||||
} else {
|
||||
// 页面加载逻辑
|
||||
uni.setStorageSync("isnNetwork", 1);
|
||||
this.getButtonImg()
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
import { mapState, mapMutations } from 'vuex';
|
||||
import request from "@/utils/request";
|
||||
|
||||
}
|
||||
export default {
|
||||
name: "tab-bar",
|
||||
// 不再需要 props.selected,完全由 Vuex 控制高亮
|
||||
data() {
|
||||
return {
|
||||
refreshKey: 0, // 强制重建标识
|
||||
tabbarReady: false, // 组件就绪标识
|
||||
tabbarList: [ // tab 配置
|
||||
{
|
||||
iconPath: "/static/images/tabbar/new_home_gray.png",
|
||||
text: "首页",
|
||||
selectedIconPath: "/static/images/tabbar/new_home.png",
|
||||
pagePath: "/pages/home/home"
|
||||
},
|
||||
{
|
||||
iconPath: "/static/images/tabbar/new_order_gray.png",
|
||||
text: "订单",
|
||||
selectedIconPath: "/static/images/tabbar/new_order.png",
|
||||
pagePath: "/pages/order/userorder-list"
|
||||
},
|
||||
{
|
||||
iconPath: "/static/images/tabbar/new_message_gray.png",
|
||||
text: "消息",
|
||||
selectedIconPath: "/static/images/tabbar/new_message.png",
|
||||
pagePath: "/pages/message/message"
|
||||
},
|
||||
{
|
||||
iconPath: "/static/images/tabbar/new_my_gray.png",
|
||||
text: "我的",
|
||||
selectedIconPath: "/static/images/tabbar/new_my.png",
|
||||
pagePath: "/pages/my/my"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 保留对消息数量的映射
|
||||
...mapState(['messageNum']),
|
||||
|
||||
// ========= 动态计算当前高亮索引 =========
|
||||
// 替代原先直接获取 Vuex 的方式,改为根据当前真实路由计算,解决刷新状态丢失问题
|
||||
currentTabIndex() {
|
||||
try {
|
||||
// 获取当前页面栈
|
||||
const pages = getCurrentPages();
|
||||
if (pages && pages.length > 0) {
|
||||
// 获取当前页面实例
|
||||
const currentPage = pages[pages.length - 1];
|
||||
// 拼接当前页面路径(兼容不同平台获取路由的方式)
|
||||
const currentPath = '/' + (currentPage.route || currentPage.__route__);
|
||||
|
||||
// 在 tabbarList 中查找匹配当前路径的索引
|
||||
const index = this.tabbarList.findIndex(item => item.pagePath === currentPath);
|
||||
if (index !== -1) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
// 如果由于某些原因匹配不到,降级去取 Vuex 中的值(防止其他极端情况报错)
|
||||
return this.$store.state.currentTabIndex || 0;
|
||||
} catch (e) {
|
||||
return this.$store.state.currentTabIndex || 0;
|
||||
}
|
||||
}
|
||||
// =================================================
|
||||
},
|
||||
watch: {
|
||||
// 当 tabbarList 内容变化(如异步更新图标)时,强制重建组件
|
||||
tabbarList: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.rebuildTabbar();
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 初始化时延迟显示,避免闪烁
|
||||
this.tabbarReady = false;
|
||||
this.$nextTick(() => {
|
||||
this.tabbarReady = true;
|
||||
// 如果需要异步加载图标,取消下面注释
|
||||
// this.getButtonImg();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_CURRENT_TAB_INDEX']),
|
||||
|
||||
},
|
||||
methods: {
|
||||
getNum(index){
|
||||
if(index==2){
|
||||
return this.messageNum
|
||||
}else{
|
||||
return 0
|
||||
}
|
||||
},
|
||||
//获取头部背景图片
|
||||
async getButtonImg() {
|
||||
let res = await request.post("/user/poster/getButtonImg", {});
|
||||
if (res.code == 200) {
|
||||
// if (res.data?.photo) {
|
||||
// this.topBgImage = res.data?.photo + '?time=666'
|
||||
// }
|
||||
this.tabbarList.forEach((item, index) => {
|
||||
if (res.data[index].iconPath) {
|
||||
item.iconPath = res.data[index].iconPath
|
||||
}
|
||||
if (res.data[index].selectedIconPath) {
|
||||
item.selectedIconPath = res.data[index].selectedIconPath
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$store.commit("setTabbarList", this.tabbarList)
|
||||
},
|
||||
change1(val) {
|
||||
// 因为在pages中配置了需要跳转的页面为 tabbar页面
|
||||
// 所以不能使用navigateTo 只能使用下面这个方法跳转。
|
||||
uni.switchTab({
|
||||
url: this.tabbarList[val].pagePath
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
// 设置全局选中索引(简化调用)
|
||||
setCurrentTabIndex(index) {
|
||||
this.SET_CURRENT_TAB_INDEX(index);
|
||||
},
|
||||
|
||||
// 强制重建 uv-tabbar(用于异步更新图标后)
|
||||
rebuildTabbar() {
|
||||
this.tabbarReady = false;
|
||||
this.$nextTick(() => {
|
||||
this.refreshKey++;
|
||||
this.tabbarReady = true;
|
||||
});
|
||||
},
|
||||
|
||||
// 获取角标数字(只有消息 tab 且数量 > 0 才显示)
|
||||
getNum(index) {
|
||||
if (index === 2 && this.messageNum > 0) {
|
||||
return this.messageNum;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
// 异步更新图标(保留你的业务逻辑)
|
||||
async getButtonImg() {
|
||||
try {
|
||||
let res = await request.post("/sj/poster/getButtonImg", {});
|
||||
if (res.code === 200) {
|
||||
this.tabbarList.forEach((item, index) => {
|
||||
if (res.data[index]?.iconPath) {
|
||||
item.iconPath = res.data[index].iconPath;
|
||||
}
|
||||
if (res.data[index]?.selectedIconPath) {
|
||||
item.selectedIconPath = res.data[index].selectedIconPath;
|
||||
}
|
||||
});
|
||||
this.$store.commit("setTabbarList", this.tabbarList);
|
||||
// 图标更新后,强制重建组件
|
||||
this.rebuildTabbar();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('getButtonImg 请求失败', err);
|
||||
}
|
||||
},
|
||||
|
||||
// uv-tabbar 的 change 事件(组件内部触发)
|
||||
onTabChange(val) {
|
||||
const idx = parseInt(val, 10);
|
||||
this.doJump(idx);
|
||||
},
|
||||
|
||||
// 手动点击 item 时触发
|
||||
onItemClick(idx) {
|
||||
this.doJump(idx);
|
||||
},
|
||||
|
||||
// 实际跳转逻辑 + 更新全局高亮
|
||||
doJump(index) {
|
||||
const idx = parseInt(index, 10);
|
||||
if (isNaN(idx) || !this.tabbarList[idx]) return;
|
||||
|
||||
// 依然更新全局高亮,确保其他可能依赖 Vuex 状态的逻辑正常运行
|
||||
this.setCurrentTabIndex(idx);
|
||||
|
||||
// 跳转页面
|
||||
const targetPage = this.tabbarList[idx].pagePath;
|
||||
uni.switchTab({
|
||||
url: targetPage,
|
||||
fail: (err) => console.error('switchTab 失败', err)
|
||||
});
|
||||
|
||||
// 保留你原有的消息更新方法
|
||||
if (typeof this.messageUpudateNum === 'function') {
|
||||
this.messageUpudateNum();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.icon {
|
||||
height: 98rpx;
|
||||
width: 98rpx;
|
||||
}
|
||||
.icon {
|
||||
height: 54rpx;
|
||||
width: 54rpx;
|
||||
}
|
||||
::v-deep .uv-tabbar__content {
|
||||
z-index: 999 !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -383,7 +383,7 @@
|
|||
justify-content: center;
|
||||
width: 690rpx;
|
||||
height: 80rpx;
|
||||
background: #E8101E;
|
||||
background: #FF4767;
|
||||
border-radius: 38rpx;
|
||||
font-weight: 400;
|
||||
font-size: 30rpx;
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ export default {
|
|||
justify-content: center;
|
||||
width: 690rpx;
|
||||
height: 80rpx;
|
||||
background: #E8101E;
|
||||
background: #FF4767;
|
||||
border-radius: 38rpx;
|
||||
font-weight: 400;
|
||||
font-size: 30rpx;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import request from "../../utils/request";
|
||||
import request from "@/utils/request";
|
||||
import uniPopup from "@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
|
||||
export default {
|
||||
name: "uploadAppVue",
|
||||
|
|
@ -237,7 +237,7 @@ export default {
|
|||
return this.version;
|
||||
},
|
||||
async getUpdateInfo() {
|
||||
const response = await request.post("/user/getappversion");
|
||||
const response = await request.post("/sj/getAppVersion");
|
||||
this.newVersion = response.data?.version;
|
||||
this.updateAPKPath = response.data?.url;
|
||||
this.is_force = response.data?.is_force;
|
||||
|
|
@ -307,7 +307,7 @@ export default {
|
|||
&__text {
|
||||
font-weight: 400;
|
||||
font-size: 18rpx;
|
||||
color: #E8101E;
|
||||
color: #FF4767;
|
||||
line-height: 25rpx;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
|
|
@ -371,7 +371,7 @@ export default {
|
|||
&__immediately {
|
||||
width: 236rpx;
|
||||
height: 78rpx;
|
||||
background: #E8101E;
|
||||
background: #FF4767;
|
||||
border-radius: 39rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
@ -405,7 +405,7 @@ export default {
|
|||
|
||||
&__active {
|
||||
height: 28rpx;
|
||||
background: linear-gradient(270deg, #fe78b3 0%, #E8101E 100%);
|
||||
background: linear-gradient(270deg, #fe78b3 0%, #FF4767 100%);
|
||||
border-radius: 39rpx;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,25 @@
|
|||
{
|
||||
"name" : "美融融plus",
|
||||
"appid" : "__UNI__DA7CE05",
|
||||
"name" : "美融融商家",
|
||||
"appid" : "__UNI__BBE6285",
|
||||
"description" : "同城便捷到家美业“技术外卖”服务、同城预约到店服务平台美融融为同城爱美人群提供更优质的更全面的服务。",
|
||||
"versionName" : "1.2.20",
|
||||
"versionCode" : 1220,
|
||||
"versionName" : "1.0.21",
|
||||
"versionCode" : 1021,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"screenOrientation" : [
|
||||
//可选,字符串数组类型,应用支持的横竖屏
|
||||
"portrait-primary", //可选,字符串类型,支持竖屏
|
||||
"portrait-secondary", //可选,字符串类型,支持反向竖屏
|
||||
"landscape-primary", //可选,字符串类型,支持横屏
|
||||
"landscape-secondary" //可选,字符串类型,支持反向横屏
|
||||
],
|
||||
"compatible" : {
|
||||
"ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
|
||||
},
|
||||
"video" : {
|
||||
"hardwareAcceleration" : "auto",
|
||||
"decode" : {
|
||||
|
|
@ -31,7 +41,8 @@
|
|||
"Payment" : {},
|
||||
"VideoPlayer" : {},
|
||||
"OAuth" : {},
|
||||
"Camera" : {}
|
||||
"Camera" : {},
|
||||
"Barcode" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
|
|
@ -66,6 +77,7 @@
|
|||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {
|
||||
"UIRequiresFullScreen" : false, // 允许非全屏模式
|
||||
"urlschemewhitelist" : [ "iosmap" ],
|
||||
"dSYMs" : false,
|
||||
"plistcmds" : [
|
||||
|
|
@ -104,8 +116,8 @@
|
|||
"payment" : {
|
||||
"weixin" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appid" : "wx2381a791a52a402d",
|
||||
"UniversalLinks" : "https://app.mrrweb.com.cn/"
|
||||
"appid" : "wx17eef65c270b4869",
|
||||
"UniversalLinks" : "https://api.mrrwlkj.top/"
|
||||
},
|
||||
"appleiap" : {},
|
||||
"alipay" : {
|
||||
|
|
@ -114,8 +126,8 @@
|
|||
},
|
||||
"share" : {
|
||||
"weixin" : {
|
||||
"appid" : "wx2381a791a52a402d",
|
||||
"UniversalLinks" : "https://app.mrrweb.com.cn/"
|
||||
"appid" : "wx17eef65c270b4869",
|
||||
"UniversalLinks" : "https://api.mrrwlkj.top/"
|
||||
}
|
||||
},
|
||||
"geolocation" : {
|
||||
|
|
@ -131,8 +143,8 @@
|
|||
},
|
||||
"oauth" : {
|
||||
"weixin" : {
|
||||
"appid" : "wx2381a791a52a402d",
|
||||
"UniversalLinks" : "https://app.mrrweb.com.cn/"
|
||||
"appid" : "wx17eef65c270b4869",
|
||||
"UniversalLinks" : "https://api.mrrwlkj.top/"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -180,10 +192,8 @@
|
|||
"description" : "阿里云号码认证SDK,包含一键登录和本机号码校验两个功能。",
|
||||
"platforms" : "Android,iOS",
|
||||
"url" : "https://ext.dcloud.net.cn/plugin?id=4297",
|
||||
"android_package_name" : "cn.mrrweb",
|
||||
"ios_bundle_id" : "cn.mrrweb",
|
||||
"android_package_name" : "cn.mrrweb",
|
||||
"ios_bundle_id" : "cn.mrrweb",
|
||||
"android_package_name" : "cn.mrrsj",
|
||||
"ios_bundle_id" : "cn.mrrsj",
|
||||
"isCloud" : true,
|
||||
"bought" : 1,
|
||||
"pid" : "4297",
|
||||
|
|
@ -196,7 +206,7 @@
|
|||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wxb486b10a60d2c78d",
|
||||
"appid" : "wx17eef65c270b4869",
|
||||
"privacy" : {
|
||||
"requiredPrivateInfos" : [ "getBackgroundFetchData" ]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -110,12 +110,25 @@ export default {
|
|||
let screenWidth = this.$store.state.systemInfo.screenWidth
|
||||
return this.pxToRpx(statusBarHeight, screenWidth)
|
||||
},
|
||||
|
||||
//消息数量跟新
|
||||
messageUpudateNum() {
|
||||
request.post("/user/push/messageUnreadNum").then(res => {
|
||||
if( res.code==200){
|
||||
this.$store.commit("setMessageNum", res.data.count)
|
||||
}
|
||||
if (uni.getStorageSync('accessToken')) {
|
||||
request.post("/sj/push/messageUnreadNum").then(res => {
|
||||
if (res.code == 200) {
|
||||
this.$store.commit("setMessageNum", res.data.count)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
//消息列表跳转阅读
|
||||
messageRead(id) {
|
||||
request.post("/sj/push/messageRead", {
|
||||
id: id
|
||||
}).then(res => {
|
||||
console.log("messageRead:", res)
|
||||
this.messageUpudateNum()
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"agcgw":{"url":"connect-drcn.dbankcloud.cn","backurl":"connect-drcn.hispace.hicloud.com","websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn","websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com"},"agcgw_all":{"SG":"connect-dra.dbankcloud.cn","SG_back":"connect-dra.hispace.hicloud.com","CN":"connect-drcn.dbankcloud.cn","CN_back":"connect-drcn.hispace.hicloud.com","RU":"connect-drru.hispace.dbankcloud.ru","RU_back":"connect-drru.hispace.dbankcloud.cn","DE":"connect-dre.dbankcloud.cn","DE_back":"connect-dre.hispace.hicloud.com"},"websocketgw_all":{"SG":"connect-ws-dra.hispace.dbankcloud.cn","SG_back":"connect-ws-dra.hispace.dbankcloud.com","CN":"connect-ws-drcn.hispace.dbankcloud.cn","CN_back":"connect-ws-drcn.hispace.dbankcloud.com","RU":"connect-ws-drru.hispace.dbankcloud.ru","RU_back":"connect-ws-drru.hispace.dbankcloud.cn","DE":"connect-ws-dre.hispace.dbankcloud.cn","DE_back":"connect-ws-dre.hispace.dbankcloud.com"},"client":{"cp_id":"260086000058238908","product_id":"461323198430018699","client_id":"1707180678149323456","client_secret":"2FCF8113D06D9C43DDDD4D291632F3769D4B991BBBF142448955B982673F3BF6","project_id":"461323198430018699","app_id":"114445451","api_key":"DgEDAP73r+rgXVMxFcwnVKN09OMmc1zg7Je7hSyx1o+hZpcOBR7cBZC40l/ehJBUzOuUGblIPOhhJOVPMHBdX1L1SFnEMcUjAEtgWA==","package_name":"cn.mrrweb"},"oauth_client":{"client_id":"114445451","client_type":1},"app_info":{"app_id":"114445451","package_name":"cn.mrrweb"},"service":{"analytics":{"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn","collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com","collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn","resource_id":"p1","channel_id":""},"ml":{"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"},"cloudstorage":{"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg":"https://ops-dra.agcstorage.link","storage_url_de":"https://ops-dre.agcstorage.link","storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia","storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu","storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn"},"search":{"url":"https://search-drcn.cloud.huawei.com"},"edukit":{"edu_url":"edukit.cloud.huawei.com.cn","dh_url":"edukit.cloud.huawei.com.cn"}},"region":"CN","configuration_version":"3.0","appInfos":[{"package_name":"cn.mrrweb","client":{"app_id":"114445451"},"app_info":{"package_name":"cn.mrrweb","app_id":"114445451"},"oauth_client":{"client_type":1,"client_id":"114445451"}}]}
|
||||
{"agcgw":{"url":"connect-drcn.dbankcloud.cn","backurl":"connect-drcn.hispace.hicloud.com","websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn","websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com"},"agcgw_all":{"SG":"connect-dra.dbankcloud.cn","SG_back":"connect-dra.hispace.hicloud.com","CN":"connect-drcn.dbankcloud.cn","CN_back":"connect-drcn.hispace.hicloud.com","RU":"connect-drru.hispace.dbankcloud.ru","RU_back":"connect-drru.hispace.dbankcloud.cn","DE":"connect-dre.dbankcloud.cn","DE_back":"connect-dre.hispace.hicloud.com"},"websocketgw_all":{"SG":"connect-ws-dra.hispace.dbankcloud.cn","SG_back":"connect-ws-dra.hispace.dbankcloud.com","CN":"connect-ws-drcn.hispace.dbankcloud.cn","CN_back":"connect-ws-drcn.hispace.dbankcloud.com","RU":"connect-ws-drru.hispace.dbankcloud.ru","RU_back":"connect-ws-drru.hispace.dbankcloud.cn","DE":"connect-ws-dre.hispace.dbankcloud.cn","DE_back":"connect-ws-dre.hispace.dbankcloud.com"},"client":{"cp_id":"10086000895395701","product_id":"101653523863625063","client_id":"1897301574611379136","client_secret":"B08B3EE2C3107D65FE6E6F5172E65ED76FAEF6448CFEB18B440D86A7D90A24BF","project_id":"101653523863625063","app_id":"117020145","api_key":"DgEDALJ+x0TW5eLso9RiPSEPqw63X0kvUB19D44f1oJuRlgh6O1k6JJswepOpPs15POJ7QXZLHRHgx6+FgmrwAeVR6/tewiLexEwmg==","package_name":"cn.mrrsj"},"oauth_client":{"client_id":"117020145","client_type":1},"app_info":{"app_id":"117020145","package_name":"cn.mrrsj"},"service":{"analytics":{"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn","collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com","collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn","resource_id":"p1","channel_id":""},"ml":{"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"},"cloudstorage":{"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg":"https://ops-dra.agcstorage.link","storage_url_de":"https://ops-dre.agcstorage.link","storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia","storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu","storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn"},"search":{"url":"https://search-drcn.cloud.huawei.com"},"edukit":{"edu_url":"edukit.cloud.huawei.com.cn","dh_url":"edukit.cloud.huawei.com.cn"}},"region":"CN","configuration_version":"3.0","appInfos":[{"package_name":"cn.mrrsj","client":{"app_id":"117020145"},"app_info":{"package_name":"cn.mrrsj","app_id":"117020145"},"oauth_client":{"client_type":1,"client_id":"117020145"}}]}
|
||||
|
|
@ -1 +1 @@
|
|||
{"version":"1.0.1","cn.mrrweb":{"manifestPlaceholders":{"VIVO_APPKEY":"aa27f4e4839fd1345bf57025778df558","VIVO_APPID":"105916679","HONOR_APPID":"104505186"},"oppoPushBussinessId":"46175","oppoPushAppKey":"b30fc37dd1f54108bb464e963dc427df","oppoPushAppSecret":"7cfff81389cf426c92e249d89f41ddb0","huaweiPushBussinessId":"46176","huaweiBadgeClassName":"","honorPushBussinessId":"46177","honorBadgeClassName":"","xiaomiPushBussinessId":"46191","xiaomiPushAppId":"2882303761520423236","xiaomiPushAppKey":"5772042339236","vivoPushBussinessId":"46192"}}
|
||||
{"version":"1.0.1","cn.mrrsj":{"manifestPlaceholders":{"VIVO_APPKEY":"50d16a217c1eedc0217f1de2a3a065f2","VIVO_APPID":"106043356","HONOR_APPID":"104549279"},"xiaomiPushBussinessId":"46241","xiaomiPushAppId":"2882303761520503034","xiaomiPushAppKey":"5732050392034","huaweiPushBussinessId":"46244","huaweiBadgeClassName":"","honorPushBussinessId":"46249","honorBadgeClassName":"","oppoPushBussinessId":"46311","oppoPushAppKey":"aa07e769bacb4e0db3c6e35be2047c2e","oppoPushAppSecret":"b2d753036c7a47d582e1fc534af4db2f","vivoPushBussinessId":"46313"}}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"VIVO_APPKEY": "aa27f4e4839fd1345bf57025778df558 ",
|
||||
"VIVO_APPID": "105916679",
|
||||
"HONOR_APPID":"104505186"
|
||||
"VIVO_APPKEY": "50d16a217c1eedc0217f1de2a3a065f2 ",
|
||||
"VIVO_APPID": "106043356",
|
||||
"HONOR_APPID":"104549279"
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"developer_id":"110000064495",
|
||||
"app_id":"104505186",
|
||||
"package_name":"cn.mrrweb",
|
||||
"developer_id":"110000156162",
|
||||
"app_id":"104549279",
|
||||
"package_name":"cn.mrrsj",
|
||||
"version":"1.0"
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"businessID":"47959"
|
||||
"businessID":"48032"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
../mime/cli.js
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../mime/cli.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../mime/cli.js" "$@"
|
||||
fi
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mime\cli.js" %*
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../mime/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../mime/cli.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../mime/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
|
|
@ -1 +0,0 @@
|
|||
../mkdirp/bin/cmd.js
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
fi
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
|
|
@ -1 +0,0 @@
|
|||
../nanoid/bin/nanoid.cjs
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../nanoid/bin/nanoid.cjs" "$@"
|
||||
else
|
||||
exec node "$basedir/../nanoid/bin/nanoid.cjs" "$@"
|
||||
fi
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nanoid\bin\nanoid.cjs" %*
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
|
|
@ -1 +0,0 @@
|
|||
../os-name/cli.js
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../os-name/cli.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../os-name/cli.js" "$@"
|
||||
fi
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\os-name\cli.js" %*
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../os-name/cli.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../os-name/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../os-name/cli.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../os-name/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
|
|
@ -1 +0,0 @@
|
|||
../osx-release/cli.js
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../osx-release/cli.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../osx-release/cli.js" "$@"
|
||||
fi
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\osx-release\cli.js" %*
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../osx-release/cli.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../osx-release/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../osx-release/cli.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../osx-release/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
|
|
@ -1 +0,0 @@
|
|||
../@babel/parser/bin/babel-parser.js
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../@babel/parser/bin/babel-parser.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../@babel/parser/bin/babel-parser.js" "$@"
|
||||
fi
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@babel\parser\bin\babel-parser.js" %*
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../@babel/parser/bin/babel-parser.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
|
|
@ -1 +0,0 @@
|
|||
../semver/bin/semver
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../semver/bin/semver" "$@"
|
||||
else
|
||||
exec node "$basedir/../semver/bin/semver" "$@"
|
||||
fi
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver" %*
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../semver/bin/semver" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../semver/bin/semver" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../semver/bin/semver" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "mrr.app.front",
|
||||
"name": "mrr.sj.front",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
|
@ -60,12 +60,6 @@
|
|||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@tencentcloud/chat": {
|
||||
"version": "3.6.5",
|
||||
"resolved": "https://registry.npmmirror.com/@tencentcloud/chat/-/chat-3.6.5.tgz",
|
||||
"integrity": "sha512-2Wseaqn8AWdkO4iaznJcdtvIsD6U/rujoWWOlFtSK778ZFASWNLEdw0PFwycZaGZJYUb2WSyR9oOXqQH/YvrCw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@vue/compiler-core": {
|
||||
"version": "3.5.18",
|
||||
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.5.18.tgz",
|
||||
|
|
@ -1353,7 +1347,7 @@
|
|||
},
|
||||
"node_modules/weapp-qrcode-canvas-2d": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmmirror.com/weapp-qrcode-canvas-2d/-/weapp-qrcode-canvas-2d-1.1.6.tgz",
|
||||
"resolved": "https://registry.npmjs.org/weapp-qrcode-canvas-2d/-/weapp-qrcode-canvas-2d-1.1.6.tgz",
|
||||
"integrity": "sha512-98/Al6OgYJwJIQFRypux43a21TZpeVy/63uYzAR4YQrIm9+vxq7bKH5v+hRwshWdku4TySDmhXC8la8wZmh5UQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -1,205 +0,0 @@
|
|||
|
||||
# Official JavaScript SDK for Tencent Cloud Chat
|
||||
|
||||
## About Tencent Cloud Chat
|
||||
|
||||
[Tencent Cloud Chat](https://trtc.io/products/chat) provides globally interconnected chat APIs, multi-platform SDKs, and UIKit components to help you quickly bring messaging capabilities such as one-to-one chat, group chat, chat rooms, and system notifications to your applications and websites.
|
||||
|
||||
## Benefits
|
||||
### Higher Engagement with Our Feature-rich Chat
|
||||
<img src="https://trtc.io/_next/static/media/pic1.3de62d45.png?auto=format&fit=max&w=3840" width=580 height=360 />
|
||||
|
||||
### Manage Groups and Conversations at Ease
|
||||
<img src="https://trtc.io/_next/static/media/pic2.55b58e0d.png?auto=format&fit=max&w=3840" width=580 height=360 />
|
||||
|
||||
### Build Your Own Chat App in just One Day
|
||||
<img src="https://trtc.io/_next/static/media/pic3.a1b13e76.png?auto=format&fit=max&w=3840" width=580 height=360 />
|
||||
|
||||
👉🏻 [Free Demo](https://trtc.io/demo/homepage/#/detail?scene=messenger)
|
||||
|
||||
📄 [Documentation](https://trtc.io/document/50061?platform=web&product=chat)
|
||||
|
||||
## Global Compliance Certifications
|
||||
<table>
|
||||
<tr>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/Vk2L735_1SOC.png" width=90 height=80 /> </td>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/Mp5i133_2ISO%209001.png" width=88 height=90 /> </td>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/AfnR546_4ISO%2027001.png" width=90 height=87 /> </td>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/WQjf098_5ISO%2027017.png" width=90 height=87 /> </td>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/aNQJ919_6ISO%2027018.png" width=90 height=86 /> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/Rj5T795_7CSASTAR.png" width=90 height=90 /> </td>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/BXNX111_8NIST%20CSF.png" width=90 height=84 /> </td>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/dHEg621_9ISO%2027701.png" width=90 height=86 /> </td>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/BLQI655_10ISO%2029151.png" width=90 height=86 /> </td>
|
||||
<td> <img src="https://staticintl.cloudcachetci.com/cms/backend-cms/dHDE860_11BS10012.png" width=90 height=42 /> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Core Capabilities
|
||||
|
||||
- 1 Billion+ Monthly active users
|
||||
- 550 Billion+ Daily peak messages
|
||||
- 100,000+ Customers worldwid
|
||||
- 99.99% Message success rate
|
||||
|
||||
## Use Cases
|
||||
|
||||
### Social
|
||||
Build real-time community interactions in your app using a simple chat API.
|
||||
✓Various message types ✓Announcement ✓Group chat
|
||||
|
||||
<img src="https://trtc.io/_next/static/media/group1.3289e577.png?auto=format&fit=max&w=3840" width=588 height=602 />
|
||||
|
||||
### Live
|
||||
Welcome a large audience to your immersive live show using a simple chat API.
|
||||
✓Unlimited participants ✓Interactive live streaming ✓Online chat
|
||||
|
||||
<img src="https://trtc.io/_next/static/media/group6.3937f7d8.png?auto=format&fit=max&w=3840" width=588 height=602 />
|
||||
|
||||
### Metaverse
|
||||
Bridge the limitless virtual and physical worlds using simple chat SDKs.
|
||||
✓Chat in metaverse ✓User profile and management ✓Immersive interactions
|
||||
|
||||
<img src="https://trtc.io/_next/static/media/group5.6975e625.png?auto=format&fit=max&w=3840" width=588 height=602 />
|
||||
|
||||
### Gaming
|
||||
Intensify gaming with real-time chat engagement using a simple chat API.
|
||||
✓Chat in game ✓Global message access ✓User profile and management
|
||||
|
||||
<img src="https://trtc.io/_next/static/media/group4.0361228f.png?auto=format&fit=max&w=3840" width=588 height=602 />
|
||||
|
||||
### Education
|
||||
Create interactive virtual classrooms with real-time chat experiences using simple chat SDK and API.
|
||||
✓Class start notifications ✓Student management ✓Class messages
|
||||
|
||||
<img src="https://trtc.io/_next/static/media/group2.08a44cc6.png?auto=format&fit=max&w=3840" width=588 height=602 />
|
||||
|
||||
### On-demand Service
|
||||
Resolve order issues with in-app conversations quickly, with simple SDK and API.
|
||||
✓Customer service support ✓Order cancellations minimization ✓Social features
|
||||
|
||||
<img src="https://trtc.io/_next/static/media/group3.45675954.png?auto=format&fit=max&w=3840" width=588 height=602 />
|
||||
|
||||
## Installation
|
||||
|
||||
```javascript
|
||||
npm install @tencentcloud/chat --save
|
||||
// The upload plugin is required to send messages such as images and files.
|
||||
npm install tim-upload-plugin --save
|
||||
```
|
||||
|
||||
## Getting started
|
||||
|
||||
```javascript
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
import TIMUploadPlugin from 'tim-upload-plugin';
|
||||
|
||||
// Create an SDK instance.
|
||||
// The `TencentCloudChat.create()` method returns the same instance for the same `SDKAppID`.
|
||||
// The SDK instance is usually represented by `chat`.
|
||||
let chat = TencentCloudChat.create({
|
||||
SDKAppID: 0 // Replace `0` with the `SDKAppID` of your Chat app during access.
|
||||
});
|
||||
|
||||
// Common level. You are advised to use this level during connection as it covers more logs.
|
||||
chat.setLogLevel(0);
|
||||
// Release level, at which the SDK outputs important information.
|
||||
// You are advised to use this log level in a production environment.
|
||||
// chat.setLogLevel(1);
|
||||
|
||||
// Register the Tencent Cloud Chat upload plugin.
|
||||
chat.registerPlugin({'tim-upload-plugin': TIMUploadPlugin});
|
||||
```
|
||||
|
||||
## Sending your first message
|
||||
|
||||
### 1. Generate UserSig
|
||||
|
||||
UserSig is a password used to log in to Tencent Cloud Chat. It is the ciphertext obtained after data such as UserID is encrypted. This [document](https://trtc.io/document/34385) describes how to generate a UserSig.
|
||||
|
||||
### 2. Listen to the SDK_READY event
|
||||
|
||||
```javascript
|
||||
// This event is triggered when the SDK enters the ready state.
|
||||
// When SDK is ready, the access side can call SDK APIs such as the message sending API to use various features of the SDK
|
||||
let onSdkReady = function(event) {
|
||||
// Now you can create a message instance and send it.
|
||||
};
|
||||
chat.on(TencentCloudChat.EVENT.SDK_READY, onSdkReady);
|
||||
|
||||
let onMessageReceived = function(event) {
|
||||
// A newly pushed one-to-one message, group message, group tip, or group system notification is received. You can traverse event.data to obtain the message list and render it to the UI.
|
||||
// event.name - TencentCloudChat.EVENT.MESSAGE_RECEIVED
|
||||
// event.data - An array that stores Message objects - [Message]
|
||||
};
|
||||
chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
|
||||
|
||||
```
|
||||
|
||||
### 3. Login in to the Chat SDK
|
||||
|
||||
```javascript
|
||||
let promise = chat.login({userID: 'your userID', userSig: 'your userSig'});
|
||||
promise.then(function(imResponse) {
|
||||
console.log(imResponse.data); // Login successful
|
||||
if (imResponse.data.repeatLogin === true) {
|
||||
// Indicates that the account has logged in and that the current login will be a repeated login.
|
||||
console.log(imResponse.data.errorInfo);
|
||||
}
|
||||
}).catch(function(imError) {
|
||||
console.warn('login error:', imError); // Error information
|
||||
});
|
||||
```
|
||||
|
||||
After successful login, to call APIs that require authentication, such as `sendMessage`, you must wait until the SDK enters the ready state (you can obtain the status of the SDK by listening to the `TencentCloudChat.EVENT.SDK_READY` event.
|
||||
|
||||
### 3. Create a message instance
|
||||
|
||||
```javascript
|
||||
let message = chat.createTextMessage({
|
||||
to: 'user1',
|
||||
conversationType: TencentCloudChat.TYPES.CONV_C2C,
|
||||
payload: {
|
||||
text: 'Hello Tencent!'
|
||||
},
|
||||
// Message custom data (saved in the cloud, will be sent to the peer end, and can still be pulled after the app is uninstalled and reinstalled)
|
||||
// cloudCustomData: 'your cloud custom data'
|
||||
});
|
||||
```
|
||||
|
||||
### 4. Send the message instance
|
||||
|
||||
```javascript
|
||||
let promise = chat.sendMessage(message);
|
||||
promise.then(function(imResponse) {
|
||||
// The message is sent successfully.
|
||||
console.log(imResponse);
|
||||
}).catch(function(imError) {
|
||||
// The message fails to be sent.
|
||||
console.warn('sendMessage error:', imError);
|
||||
});
|
||||
```
|
||||
|
||||
## Contact Us
|
||||
|
||||
Join a Tencent Cloud Chat developer group for Reliable technical support & Product details & Constant exchange of ideas.
|
||||
|
||||
- Telegram group (EN): [join](https://t.me/+1doS9AUBmndhNGNl)
|
||||
- WhatsApp group (EN): [join](https://chat.whatsapp.com/Gfbxk7rQBqc8Rz4pzzP27A)
|
||||
- Telegram group (ZH): [join](https://t.me/tencent_imsdk)
|
||||
- WhatsApp group (ZH): [join](https://chat.whatsapp.com/IVa11ZkVmKTEwSWsAzSyik)
|
||||
|
||||
## Supported Browsers
|
||||
|
||||
| Browser | Supported versions |
|
||||
| ---- | ---- |
|
||||
| Chrome | 16 or higher |
|
||||
| Edge | 13 or higher |
|
||||
| Firefox | 11 or higher |
|
||||
| Safari | 7 or higher |
|
||||
| Internet Explorer | 10 or higher |
|
||||
| Opera | 12.1 or higher |
|
||||
| iOS Safari | 7 or higher |
|
||||
| Android Browswer | 4.4 (Kitkat) or higher |
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"name": "@tencentcloud/chat",
|
||||
"version": "3.6.5",
|
||||
"description": "Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut",
|
||||
"main": "index.js",
|
||||
"keywords": ["chat", "real-time chat", "uni-app", "React Native", "Donut", "push", "messaging", "IM", "trtc"],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://trtc.io/products/chat"
|
||||
},
|
||||
"author": "Tencent Cloud Terminal R&D Center",
|
||||
"license": "ISC"
|
||||
}
|
||||
|
|
@ -20145,232 +20145,232 @@ function objectToString(o) {
|
|||
}
|
||||
|
||||
},{"buffer":103}],383:[function(require,module,exports){
|
||||
/*
|
||||
* Date Format 1.2.3
|
||||
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
|
||||
* MIT license
|
||||
*
|
||||
* Includes enhancements by Scott Trenda <scott.trenda.net>
|
||||
* and Kris Kowal <cixar.com/~kris.kowal/>
|
||||
*
|
||||
* Accepts a date, a mask, or a date and a mask.
|
||||
* Returns a formatted version of the given date.
|
||||
* The date defaults to the current date/time.
|
||||
* The mask defaults to dateFormat.masks.default.
|
||||
*/
|
||||
|
||||
(function(global) {
|
||||
'use strict';
|
||||
|
||||
var dateFormat = (function() {
|
||||
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
|
||||
var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
|
||||
var timezoneClip = /[^-+\dA-Z]/g;
|
||||
|
||||
// Regexes and supporting functions are cached through closure
|
||||
return function (date, mask, utc, gmt) {
|
||||
|
||||
// You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
|
||||
if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
|
||||
mask = date;
|
||||
date = undefined;
|
||||
}
|
||||
|
||||
date = date || new Date;
|
||||
|
||||
if(!(date instanceof Date)) {
|
||||
date = new Date(date);
|
||||
}
|
||||
|
||||
if (isNaN(date)) {
|
||||
throw TypeError('Invalid date');
|
||||
}
|
||||
|
||||
mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
|
||||
|
||||
// Allow setting the utc/gmt argument via the mask
|
||||
var maskSlice = mask.slice(0, 4);
|
||||
if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
|
||||
mask = mask.slice(4);
|
||||
utc = true;
|
||||
if (maskSlice === 'GMT:') {
|
||||
gmt = true;
|
||||
}
|
||||
}
|
||||
|
||||
var _ = utc ? 'getUTC' : 'get';
|
||||
var d = date[_ + 'Date']();
|
||||
var D = date[_ + 'Day']();
|
||||
var m = date[_ + 'Month']();
|
||||
var y = date[_ + 'FullYear']();
|
||||
var H = date[_ + 'Hours']();
|
||||
var M = date[_ + 'Minutes']();
|
||||
var s = date[_ + 'Seconds']();
|
||||
var L = date[_ + 'Milliseconds']();
|
||||
var o = utc ? 0 : date.getTimezoneOffset();
|
||||
var W = getWeek(date);
|
||||
var N = getDayOfWeek(date);
|
||||
var flags = {
|
||||
d: d,
|
||||
dd: pad(d),
|
||||
ddd: dateFormat.i18n.dayNames[D],
|
||||
dddd: dateFormat.i18n.dayNames[D + 7],
|
||||
m: m + 1,
|
||||
mm: pad(m + 1),
|
||||
mmm: dateFormat.i18n.monthNames[m],
|
||||
mmmm: dateFormat.i18n.monthNames[m + 12],
|
||||
yy: String(y).slice(2),
|
||||
yyyy: y,
|
||||
h: H % 12 || 12,
|
||||
hh: pad(H % 12 || 12),
|
||||
H: H,
|
||||
HH: pad(H),
|
||||
M: M,
|
||||
MM: pad(M),
|
||||
s: s,
|
||||
ss: pad(s),
|
||||
l: pad(L, 3),
|
||||
L: pad(Math.round(L / 10)),
|
||||
t: H < 12 ? 'a' : 'p',
|
||||
tt: H < 12 ? 'am' : 'pm',
|
||||
T: H < 12 ? 'A' : 'P',
|
||||
TT: H < 12 ? 'AM' : 'PM',
|
||||
Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
|
||||
o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
||||
S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
|
||||
W: W,
|
||||
N: N
|
||||
};
|
||||
|
||||
return mask.replace(token, function (match) {
|
||||
if (match in flags) {
|
||||
return flags[match];
|
||||
}
|
||||
return match.slice(1, match.length - 1);
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
||||
dateFormat.masks = {
|
||||
'default': 'ddd mmm dd yyyy HH:MM:ss',
|
||||
'shortDate': 'm/d/yy',
|
||||
'mediumDate': 'mmm d, yyyy',
|
||||
'longDate': 'mmmm d, yyyy',
|
||||
'fullDate': 'dddd, mmmm d, yyyy',
|
||||
'shortTime': 'h:MM TT',
|
||||
'mediumTime': 'h:MM:ss TT',
|
||||
'longTime': 'h:MM:ss TT Z',
|
||||
'isoDate': 'yyyy-mm-dd',
|
||||
'isoTime': 'HH:MM:ss',
|
||||
'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
|
||||
'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
|
||||
'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
|
||||
};
|
||||
|
||||
// Internationalization strings
|
||||
dateFormat.i18n = {
|
||||
dayNames: [
|
||||
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
|
||||
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
|
||||
],
|
||||
monthNames: [
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
||||
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
|
||||
]
|
||||
};
|
||||
|
||||
function pad(val, len) {
|
||||
val = String(val);
|
||||
len = len || 2;
|
||||
while (val.length < len) {
|
||||
val = '0' + val;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ISO 8601 week number
|
||||
* Based on comments from
|
||||
* http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
|
||||
*
|
||||
* @param {Object} `date`
|
||||
* @return {Number}
|
||||
*/
|
||||
function getWeek(date) {
|
||||
// Remove time components of date
|
||||
var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
|
||||
// Change date to Thursday same week
|
||||
targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
|
||||
|
||||
// Take January 4th as it is always in week 1 (see ISO 8601)
|
||||
var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
|
||||
|
||||
// Change date to Thursday same week
|
||||
firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
|
||||
|
||||
// Check if daylight-saving-time-switch occurred and correct for it
|
||||
var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
|
||||
targetThursday.setHours(targetThursday.getHours() - ds);
|
||||
|
||||
// Number of weeks between target Thursday and first Thursday
|
||||
var weekDiff = (targetThursday - firstThursday) / (86400000*7);
|
||||
return 1 + Math.floor(weekDiff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ISO-8601 numeric representation of the day of the week
|
||||
* 1 (for Monday) through 7 (for Sunday)
|
||||
*
|
||||
* @param {Object} `date`
|
||||
* @return {Number}
|
||||
*/
|
||||
function getDayOfWeek(date) {
|
||||
var dow = date.getDay();
|
||||
if(dow === 0) {
|
||||
dow = 7;
|
||||
}
|
||||
return dow;
|
||||
}
|
||||
|
||||
/**
|
||||
* kind-of shortcut
|
||||
* @param {*} val
|
||||
* @return {String}
|
||||
*/
|
||||
function kindOf(val) {
|
||||
if (val === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (val === undefined) {
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
if (typeof val !== 'object') {
|
||||
return typeof val;
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
return 'array';
|
||||
}
|
||||
|
||||
return {}.toString.call(val)
|
||||
.slice(8, -1).toLowerCase();
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return dateFormat;
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = dateFormat;
|
||||
} else {
|
||||
global.dateFormat = dateFormat;
|
||||
}
|
||||
})(this);
|
||||
/*
|
||||
* Date Format 1.2.3
|
||||
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
|
||||
* MIT license
|
||||
*
|
||||
* Includes enhancements by Scott Trenda <scott.trenda.net>
|
||||
* and Kris Kowal <cixar.com/~kris.kowal/>
|
||||
*
|
||||
* Accepts a date, a mask, or a date and a mask.
|
||||
* Returns a formatted version of the given date.
|
||||
* The date defaults to the current date/time.
|
||||
* The mask defaults to dateFormat.masks.default.
|
||||
*/
|
||||
|
||||
(function(global) {
|
||||
'use strict';
|
||||
|
||||
var dateFormat = (function() {
|
||||
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
|
||||
var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
|
||||
var timezoneClip = /[^-+\dA-Z]/g;
|
||||
|
||||
// Regexes and supporting functions are cached through closure
|
||||
return function (date, mask, utc, gmt) {
|
||||
|
||||
// You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
|
||||
if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
|
||||
mask = date;
|
||||
date = undefined;
|
||||
}
|
||||
|
||||
date = date || new Date;
|
||||
|
||||
if(!(date instanceof Date)) {
|
||||
date = new Date(date);
|
||||
}
|
||||
|
||||
if (isNaN(date)) {
|
||||
throw TypeError('Invalid date');
|
||||
}
|
||||
|
||||
mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
|
||||
|
||||
// Allow setting the utc/gmt argument via the mask
|
||||
var maskSlice = mask.slice(0, 4);
|
||||
if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
|
||||
mask = mask.slice(4);
|
||||
utc = true;
|
||||
if (maskSlice === 'GMT:') {
|
||||
gmt = true;
|
||||
}
|
||||
}
|
||||
|
||||
var _ = utc ? 'getUTC' : 'get';
|
||||
var d = date[_ + 'Date']();
|
||||
var D = date[_ + 'Day']();
|
||||
var m = date[_ + 'Month']();
|
||||
var y = date[_ + 'FullYear']();
|
||||
var H = date[_ + 'Hours']();
|
||||
var M = date[_ + 'Minutes']();
|
||||
var s = date[_ + 'Seconds']();
|
||||
var L = date[_ + 'Milliseconds']();
|
||||
var o = utc ? 0 : date.getTimezoneOffset();
|
||||
var W = getWeek(date);
|
||||
var N = getDayOfWeek(date);
|
||||
var flags = {
|
||||
d: d,
|
||||
dd: pad(d),
|
||||
ddd: dateFormat.i18n.dayNames[D],
|
||||
dddd: dateFormat.i18n.dayNames[D + 7],
|
||||
m: m + 1,
|
||||
mm: pad(m + 1),
|
||||
mmm: dateFormat.i18n.monthNames[m],
|
||||
mmmm: dateFormat.i18n.monthNames[m + 12],
|
||||
yy: String(y).slice(2),
|
||||
yyyy: y,
|
||||
h: H % 12 || 12,
|
||||
hh: pad(H % 12 || 12),
|
||||
H: H,
|
||||
HH: pad(H),
|
||||
M: M,
|
||||
MM: pad(M),
|
||||
s: s,
|
||||
ss: pad(s),
|
||||
l: pad(L, 3),
|
||||
L: pad(Math.round(L / 10)),
|
||||
t: H < 12 ? 'a' : 'p',
|
||||
tt: H < 12 ? 'am' : 'pm',
|
||||
T: H < 12 ? 'A' : 'P',
|
||||
TT: H < 12 ? 'AM' : 'PM',
|
||||
Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
|
||||
o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
||||
S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
|
||||
W: W,
|
||||
N: N
|
||||
};
|
||||
|
||||
return mask.replace(token, function (match) {
|
||||
if (match in flags) {
|
||||
return flags[match];
|
||||
}
|
||||
return match.slice(1, match.length - 1);
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
||||
dateFormat.masks = {
|
||||
'default': 'ddd mmm dd yyyy HH:MM:ss',
|
||||
'shortDate': 'm/d/yy',
|
||||
'mediumDate': 'mmm d, yyyy',
|
||||
'longDate': 'mmmm d, yyyy',
|
||||
'fullDate': 'dddd, mmmm d, yyyy',
|
||||
'shortTime': 'h:MM TT',
|
||||
'mediumTime': 'h:MM:ss TT',
|
||||
'longTime': 'h:MM:ss TT Z',
|
||||
'isoDate': 'yyyy-mm-dd',
|
||||
'isoTime': 'HH:MM:ss',
|
||||
'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
|
||||
'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
|
||||
'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
|
||||
};
|
||||
|
||||
// Internationalization strings
|
||||
dateFormat.i18n = {
|
||||
dayNames: [
|
||||
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
|
||||
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
|
||||
],
|
||||
monthNames: [
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
||||
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
|
||||
]
|
||||
};
|
||||
|
||||
function pad(val, len) {
|
||||
val = String(val);
|
||||
len = len || 2;
|
||||
while (val.length < len) {
|
||||
val = '0' + val;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ISO 8601 week number
|
||||
* Based on comments from
|
||||
* http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
|
||||
*
|
||||
* @param {Object} `date`
|
||||
* @return {Number}
|
||||
*/
|
||||
function getWeek(date) {
|
||||
// Remove time components of date
|
||||
var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
|
||||
// Change date to Thursday same week
|
||||
targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
|
||||
|
||||
// Take January 4th as it is always in week 1 (see ISO 8601)
|
||||
var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
|
||||
|
||||
// Change date to Thursday same week
|
||||
firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
|
||||
|
||||
// Check if daylight-saving-time-switch occurred and correct for it
|
||||
var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
|
||||
targetThursday.setHours(targetThursday.getHours() - ds);
|
||||
|
||||
// Number of weeks between target Thursday and first Thursday
|
||||
var weekDiff = (targetThursday - firstThursday) / (86400000*7);
|
||||
return 1 + Math.floor(weekDiff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ISO-8601 numeric representation of the day of the week
|
||||
* 1 (for Monday) through 7 (for Sunday)
|
||||
*
|
||||
* @param {Object} `date`
|
||||
* @return {Number}
|
||||
*/
|
||||
function getDayOfWeek(date) {
|
||||
var dow = date.getDay();
|
||||
if(dow === 0) {
|
||||
dow = 7;
|
||||
}
|
||||
return dow;
|
||||
}
|
||||
|
||||
/**
|
||||
* kind-of shortcut
|
||||
* @param {*} val
|
||||
* @return {String}
|
||||
*/
|
||||
function kindOf(val) {
|
||||
if (val === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (val === undefined) {
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
if (typeof val !== 'object') {
|
||||
return typeof val;
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
return 'array';
|
||||
}
|
||||
|
||||
return {}.toString.call(val)
|
||||
.slice(8, -1).toLowerCase();
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return dateFormat;
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = dateFormat;
|
||||
} else {
|
||||
global.dateFormat = dateFormat;
|
||||
}
|
||||
})(this);
|
||||
|
||||
},{}],384:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
test
|
||||
.travis.yml
|
||||
test
|
||||
.travis.yml
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"CurrentProjectSetting": null
|
||||
{
|
||||
"CurrentProjectSetting": null
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,20 +1,20 @@
|
|||
(c) 2007-2009 Steven Levithan <stevenlevithan.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
(c) 2007-2009 Steven Levithan <stevenlevithan.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
|
|||
|
|
@ -1,134 +1,134 @@
|
|||
# dateformat
|
||||
|
||||
A node.js package for Steven Levithan's excellent [dateFormat()][dateformat] function.
|
||||
|
||||
[](https://travis-ci.org/felixge/node-dateformat)
|
||||
|
||||
## Modifications
|
||||
|
||||
* Removed the `Date.prototype.format` method. Sorry folks, but extending native prototypes is for suckers.
|
||||
* Added a `module.exports = dateFormat;` statement at the bottom
|
||||
* Added the placeholder `N` to get the ISO 8601 numeric representation of the day of the week
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install dateformat
|
||||
$ dateformat --help
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
As taken from Steven's post, modified to match the Modifications listed above:
|
||||
```js
|
||||
var dateFormat = require('dateformat');
|
||||
var now = new Date();
|
||||
|
||||
// Basic usage
|
||||
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");
|
||||
// Saturday, June 9th, 2007, 5:46:21 PM
|
||||
|
||||
// You can use one of several named masks
|
||||
dateFormat(now, "isoDateTime");
|
||||
// 2007-06-09T17:46:21
|
||||
|
||||
// ...Or add your own
|
||||
dateFormat.masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
|
||||
dateFormat(now, "hammerTime");
|
||||
// 17:46! Can't touch this!
|
||||
|
||||
// You can also provide the date as a string
|
||||
dateFormat("Jun 9 2007", "fullDate");
|
||||
// Saturday, June 9, 2007
|
||||
|
||||
// Note that if you don't include the mask argument,
|
||||
// dateFormat.masks.default is used
|
||||
dateFormat(now);
|
||||
// Sat Jun 09 2007 17:46:21
|
||||
|
||||
// And if you don't include the date argument,
|
||||
// the current date and time is used
|
||||
dateFormat();
|
||||
// Sat Jun 09 2007 17:46:22
|
||||
|
||||
// You can also skip the date argument (as long as your mask doesn't
|
||||
// contain any numbers), in which case the current date/time is used
|
||||
dateFormat("longTime");
|
||||
// 5:46:22 PM EST
|
||||
|
||||
// And finally, you can convert local time to UTC time. Simply pass in
|
||||
// true as an additional argument (no argument skipping allowed in this case):
|
||||
dateFormat(now, "longTime", true);
|
||||
// 10:46:21 PM UTC
|
||||
|
||||
// ...Or add the prefix "UTC:" or "GMT:" to your mask.
|
||||
dateFormat(now, "UTC:h:MM:ss TT Z");
|
||||
// 10:46:21 PM UTC
|
||||
|
||||
// You can also get the ISO 8601 week of the year:
|
||||
dateFormat(now, "W");
|
||||
// 42
|
||||
|
||||
// and also get the ISO 8601 numeric representation of the day of the week:
|
||||
dateFormat(now,"N");
|
||||
// 6
|
||||
```
|
||||
|
||||
### Mask options
|
||||
|
||||
Mask | Description
|
||||
---- | -----------
|
||||
`d` | Day of the month as digits; no leading zero for single-digit days.
|
||||
`dd` | Day of the month as digits; leading zero for single-digit days.
|
||||
`ddd` | Day of the week as a three-letter abbreviation.
|
||||
`dddd` | Day of the week as its full name.
|
||||
`m` | Month as digits; no leading zero for single-digit months.
|
||||
`mm` | Month as digits; leading zero for single-digit months.
|
||||
`mmm` | Month as a three-letter abbreviation.
|
||||
`mmmm` | Month as its full name.
|
||||
`yy` | Year as last two digits; leading zero for years less than 10.
|
||||
`yyyy` | Year represented by four digits.
|
||||
`h` | Hours; no leading zero for single-digit hours (12-hour clock).
|
||||
`hh` | Hours; leading zero for single-digit hours (12-hour clock).
|
||||
`H` | Hours; no leading zero for single-digit hours (24-hour clock).
|
||||
`HH` | Hours; leading zero for single-digit hours (24-hour clock).
|
||||
`M` | Minutes; no leading zero for single-digit minutes.
|
||||
`MM` | Minutes; leading zero for single-digit minutes.
|
||||
`N` | ISO 8601 numeric representation of the day of the week.
|
||||
`o` | GMT/UTC timezone offset, e.g. -0500 or +0230.
|
||||
`s` | Seconds; no leading zero for single-digit seconds.
|
||||
`ss` | Seconds; leading zero for single-digit seconds.
|
||||
`S` | The date's ordinal suffix (st, nd, rd, or th). Works well with `d`.
|
||||
`l` | Milliseconds; gives 3 digits.
|
||||
`L` | Milliseconds; gives 2 digits.
|
||||
`t` | Lowercase, single-character time marker string: a or p.
|
||||
`tt` | Lowercase, two-character time marker string: am or pm.
|
||||
`T` | Uppercase, single-character time marker string: A or P.
|
||||
`TT` | Uppercase, two-character time marker string: AM or PM.
|
||||
`W` | ISO 8601 week number of the year, e.g. 42
|
||||
`Z` | US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the
|
||||
`'...'`, `"..."` | Literal character sequence. Surrounding quotes are removed.
|
||||
`UTC:` | Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The "UTC:" prefix is removed.
|
||||
|
||||
### Named Formats
|
||||
|
||||
Name | Mask | Example
|
||||
---- | ---- | -------
|
||||
`default` | `ddd mmm dd yyyy HH:MM:ss` | Sat Jun 09 2007 17:46:21
|
||||
`shortDate` | `m/d/yy` | 6/9/07
|
||||
`mediumDate` | `mmm d, yyyy` | Jun 9, 2007
|
||||
`longDate` | `mmmm d, yyyy` | June 9, 2007
|
||||
`fullDate` | `dddd, mmmm d, yyyy` | Saturday, June 9, 2007
|
||||
`shortTime` | `h:MM TT` | 5:46 PM
|
||||
`mediumTime` | `h:MM:ss TT` | 5:46:21 PM
|
||||
`longTime` | `h:MM:ss TT Z` | 5:46:21 PM EST
|
||||
`isoDate` | `yyyy-mm-dd` | 2007-06-09
|
||||
`isoTime` | `HH:MM:ss` | 17:46:21
|
||||
`isoDateTime` | `yyyy-mm-dd'T'HH:MM:ss` | 2007-06-09T17:46:21
|
||||
`isoUtcDateTime` | `UTC:yyyy-mm-dd'T'HH:MM:ss'Z'` | 2007-06-09T22:46:21Z
|
||||
## License
|
||||
|
||||
(c) 2007-2009 Steven Levithan [stevenlevithan.com][stevenlevithan], MIT license.
|
||||
|
||||
[dateformat]: http://blog.stevenlevithan.com/archives/date-time-format
|
||||
[stevenlevithan]: http://stevenlevithan.com/
|
||||
# dateformat
|
||||
|
||||
A node.js package for Steven Levithan's excellent [dateFormat()][dateformat] function.
|
||||
|
||||
[](https://travis-ci.org/felixge/node-dateformat)
|
||||
|
||||
## Modifications
|
||||
|
||||
* Removed the `Date.prototype.format` method. Sorry folks, but extending native prototypes is for suckers.
|
||||
* Added a `module.exports = dateFormat;` statement at the bottom
|
||||
* Added the placeholder `N` to get the ISO 8601 numeric representation of the day of the week
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install dateformat
|
||||
$ dateformat --help
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
As taken from Steven's post, modified to match the Modifications listed above:
|
||||
```js
|
||||
var dateFormat = require('dateformat');
|
||||
var now = new Date();
|
||||
|
||||
// Basic usage
|
||||
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");
|
||||
// Saturday, June 9th, 2007, 5:46:21 PM
|
||||
|
||||
// You can use one of several named masks
|
||||
dateFormat(now, "isoDateTime");
|
||||
// 2007-06-09T17:46:21
|
||||
|
||||
// ...Or add your own
|
||||
dateFormat.masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
|
||||
dateFormat(now, "hammerTime");
|
||||
// 17:46! Can't touch this!
|
||||
|
||||
// You can also provide the date as a string
|
||||
dateFormat("Jun 9 2007", "fullDate");
|
||||
// Saturday, June 9, 2007
|
||||
|
||||
// Note that if you don't include the mask argument,
|
||||
// dateFormat.masks.default is used
|
||||
dateFormat(now);
|
||||
// Sat Jun 09 2007 17:46:21
|
||||
|
||||
// And if you don't include the date argument,
|
||||
// the current date and time is used
|
||||
dateFormat();
|
||||
// Sat Jun 09 2007 17:46:22
|
||||
|
||||
// You can also skip the date argument (as long as your mask doesn't
|
||||
// contain any numbers), in which case the current date/time is used
|
||||
dateFormat("longTime");
|
||||
// 5:46:22 PM EST
|
||||
|
||||
// And finally, you can convert local time to UTC time. Simply pass in
|
||||
// true as an additional argument (no argument skipping allowed in this case):
|
||||
dateFormat(now, "longTime", true);
|
||||
// 10:46:21 PM UTC
|
||||
|
||||
// ...Or add the prefix "UTC:" or "GMT:" to your mask.
|
||||
dateFormat(now, "UTC:h:MM:ss TT Z");
|
||||
// 10:46:21 PM UTC
|
||||
|
||||
// You can also get the ISO 8601 week of the year:
|
||||
dateFormat(now, "W");
|
||||
// 42
|
||||
|
||||
// and also get the ISO 8601 numeric representation of the day of the week:
|
||||
dateFormat(now,"N");
|
||||
// 6
|
||||
```
|
||||
|
||||
### Mask options
|
||||
|
||||
Mask | Description
|
||||
---- | -----------
|
||||
`d` | Day of the month as digits; no leading zero for single-digit days.
|
||||
`dd` | Day of the month as digits; leading zero for single-digit days.
|
||||
`ddd` | Day of the week as a three-letter abbreviation.
|
||||
`dddd` | Day of the week as its full name.
|
||||
`m` | Month as digits; no leading zero for single-digit months.
|
||||
`mm` | Month as digits; leading zero for single-digit months.
|
||||
`mmm` | Month as a three-letter abbreviation.
|
||||
`mmmm` | Month as its full name.
|
||||
`yy` | Year as last two digits; leading zero for years less than 10.
|
||||
`yyyy` | Year represented by four digits.
|
||||
`h` | Hours; no leading zero for single-digit hours (12-hour clock).
|
||||
`hh` | Hours; leading zero for single-digit hours (12-hour clock).
|
||||
`H` | Hours; no leading zero for single-digit hours (24-hour clock).
|
||||
`HH` | Hours; leading zero for single-digit hours (24-hour clock).
|
||||
`M` | Minutes; no leading zero for single-digit minutes.
|
||||
`MM` | Minutes; leading zero for single-digit minutes.
|
||||
`N` | ISO 8601 numeric representation of the day of the week.
|
||||
`o` | GMT/UTC timezone offset, e.g. -0500 or +0230.
|
||||
`s` | Seconds; no leading zero for single-digit seconds.
|
||||
`ss` | Seconds; leading zero for single-digit seconds.
|
||||
`S` | The date's ordinal suffix (st, nd, rd, or th). Works well with `d`.
|
||||
`l` | Milliseconds; gives 3 digits.
|
||||
`L` | Milliseconds; gives 2 digits.
|
||||
`t` | Lowercase, single-character time marker string: a or p.
|
||||
`tt` | Lowercase, two-character time marker string: am or pm.
|
||||
`T` | Uppercase, single-character time marker string: A or P.
|
||||
`TT` | Uppercase, two-character time marker string: AM or PM.
|
||||
`W` | ISO 8601 week number of the year, e.g. 42
|
||||
`Z` | US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the
|
||||
`'...'`, `"..."` | Literal character sequence. Surrounding quotes are removed.
|
||||
`UTC:` | Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The "UTC:" prefix is removed.
|
||||
|
||||
### Named Formats
|
||||
|
||||
Name | Mask | Example
|
||||
---- | ---- | -------
|
||||
`default` | `ddd mmm dd yyyy HH:MM:ss` | Sat Jun 09 2007 17:46:21
|
||||
`shortDate` | `m/d/yy` | 6/9/07
|
||||
`mediumDate` | `mmm d, yyyy` | Jun 9, 2007
|
||||
`longDate` | `mmmm d, yyyy` | June 9, 2007
|
||||
`fullDate` | `dddd, mmmm d, yyyy` | Saturday, June 9, 2007
|
||||
`shortTime` | `h:MM TT` | 5:46 PM
|
||||
`mediumTime` | `h:MM:ss TT` | 5:46:21 PM
|
||||
`longTime` | `h:MM:ss TT Z` | 5:46:21 PM EST
|
||||
`isoDate` | `yyyy-mm-dd` | 2007-06-09
|
||||
`isoTime` | `HH:MM:ss` | 17:46:21
|
||||
`isoDateTime` | `yyyy-mm-dd'T'HH:MM:ss` | 2007-06-09T17:46:21
|
||||
`isoUtcDateTime` | `UTC:yyyy-mm-dd'T'HH:MM:ss'Z'` | 2007-06-09T22:46:21Z
|
||||
## License
|
||||
|
||||
(c) 2007-2009 Steven Levithan [stevenlevithan.com][stevenlevithan], MIT license.
|
||||
|
||||
[dateformat]: http://blog.stevenlevithan.com/archives/date-time-format
|
||||
[stevenlevithan]: http://stevenlevithan.com/
|
||||
|
|
|
|||
|
|
@ -1,226 +1,226 @@
|
|||
/*
|
||||
* Date Format 1.2.3
|
||||
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
|
||||
* MIT license
|
||||
*
|
||||
* Includes enhancements by Scott Trenda <scott.trenda.net>
|
||||
* and Kris Kowal <cixar.com/~kris.kowal/>
|
||||
*
|
||||
* Accepts a date, a mask, or a date and a mask.
|
||||
* Returns a formatted version of the given date.
|
||||
* The date defaults to the current date/time.
|
||||
* The mask defaults to dateFormat.masks.default.
|
||||
*/
|
||||
|
||||
(function(global) {
|
||||
'use strict';
|
||||
|
||||
var dateFormat = (function() {
|
||||
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
|
||||
var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
|
||||
var timezoneClip = /[^-+\dA-Z]/g;
|
||||
|
||||
// Regexes and supporting functions are cached through closure
|
||||
return function (date, mask, utc, gmt) {
|
||||
|
||||
// You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
|
||||
if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
|
||||
mask = date;
|
||||
date = undefined;
|
||||
}
|
||||
|
||||
date = date || new Date;
|
||||
|
||||
if(!(date instanceof Date)) {
|
||||
date = new Date(date);
|
||||
}
|
||||
|
||||
if (isNaN(date)) {
|
||||
throw TypeError('Invalid date');
|
||||
}
|
||||
|
||||
mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
|
||||
|
||||
// Allow setting the utc/gmt argument via the mask
|
||||
var maskSlice = mask.slice(0, 4);
|
||||
if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
|
||||
mask = mask.slice(4);
|
||||
utc = true;
|
||||
if (maskSlice === 'GMT:') {
|
||||
gmt = true;
|
||||
}
|
||||
}
|
||||
|
||||
var _ = utc ? 'getUTC' : 'get';
|
||||
var d = date[_ + 'Date']();
|
||||
var D = date[_ + 'Day']();
|
||||
var m = date[_ + 'Month']();
|
||||
var y = date[_ + 'FullYear']();
|
||||
var H = date[_ + 'Hours']();
|
||||
var M = date[_ + 'Minutes']();
|
||||
var s = date[_ + 'Seconds']();
|
||||
var L = date[_ + 'Milliseconds']();
|
||||
var o = utc ? 0 : date.getTimezoneOffset();
|
||||
var W = getWeek(date);
|
||||
var N = getDayOfWeek(date);
|
||||
var flags = {
|
||||
d: d,
|
||||
dd: pad(d),
|
||||
ddd: dateFormat.i18n.dayNames[D],
|
||||
dddd: dateFormat.i18n.dayNames[D + 7],
|
||||
m: m + 1,
|
||||
mm: pad(m + 1),
|
||||
mmm: dateFormat.i18n.monthNames[m],
|
||||
mmmm: dateFormat.i18n.monthNames[m + 12],
|
||||
yy: String(y).slice(2),
|
||||
yyyy: y,
|
||||
h: H % 12 || 12,
|
||||
hh: pad(H % 12 || 12),
|
||||
H: H,
|
||||
HH: pad(H),
|
||||
M: M,
|
||||
MM: pad(M),
|
||||
s: s,
|
||||
ss: pad(s),
|
||||
l: pad(L, 3),
|
||||
L: pad(Math.round(L / 10)),
|
||||
t: H < 12 ? 'a' : 'p',
|
||||
tt: H < 12 ? 'am' : 'pm',
|
||||
T: H < 12 ? 'A' : 'P',
|
||||
TT: H < 12 ? 'AM' : 'PM',
|
||||
Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
|
||||
o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
||||
S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
|
||||
W: W,
|
||||
N: N
|
||||
};
|
||||
|
||||
return mask.replace(token, function (match) {
|
||||
if (match in flags) {
|
||||
return flags[match];
|
||||
}
|
||||
return match.slice(1, match.length - 1);
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
||||
dateFormat.masks = {
|
||||
'default': 'ddd mmm dd yyyy HH:MM:ss',
|
||||
'shortDate': 'm/d/yy',
|
||||
'mediumDate': 'mmm d, yyyy',
|
||||
'longDate': 'mmmm d, yyyy',
|
||||
'fullDate': 'dddd, mmmm d, yyyy',
|
||||
'shortTime': 'h:MM TT',
|
||||
'mediumTime': 'h:MM:ss TT',
|
||||
'longTime': 'h:MM:ss TT Z',
|
||||
'isoDate': 'yyyy-mm-dd',
|
||||
'isoTime': 'HH:MM:ss',
|
||||
'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
|
||||
'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
|
||||
'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
|
||||
};
|
||||
|
||||
// Internationalization strings
|
||||
dateFormat.i18n = {
|
||||
dayNames: [
|
||||
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
|
||||
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
|
||||
],
|
||||
monthNames: [
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
||||
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
|
||||
]
|
||||
};
|
||||
|
||||
function pad(val, len) {
|
||||
val = String(val);
|
||||
len = len || 2;
|
||||
while (val.length < len) {
|
||||
val = '0' + val;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ISO 8601 week number
|
||||
* Based on comments from
|
||||
* http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
|
||||
*
|
||||
* @param {Object} `date`
|
||||
* @return {Number}
|
||||
*/
|
||||
function getWeek(date) {
|
||||
// Remove time components of date
|
||||
var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
|
||||
// Change date to Thursday same week
|
||||
targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
|
||||
|
||||
// Take January 4th as it is always in week 1 (see ISO 8601)
|
||||
var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
|
||||
|
||||
// Change date to Thursday same week
|
||||
firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
|
||||
|
||||
// Check if daylight-saving-time-switch occurred and correct for it
|
||||
var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
|
||||
targetThursday.setHours(targetThursday.getHours() - ds);
|
||||
|
||||
// Number of weeks between target Thursday and first Thursday
|
||||
var weekDiff = (targetThursday - firstThursday) / (86400000*7);
|
||||
return 1 + Math.floor(weekDiff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ISO-8601 numeric representation of the day of the week
|
||||
* 1 (for Monday) through 7 (for Sunday)
|
||||
*
|
||||
* @param {Object} `date`
|
||||
* @return {Number}
|
||||
*/
|
||||
function getDayOfWeek(date) {
|
||||
var dow = date.getDay();
|
||||
if(dow === 0) {
|
||||
dow = 7;
|
||||
}
|
||||
return dow;
|
||||
}
|
||||
|
||||
/**
|
||||
* kind-of shortcut
|
||||
* @param {*} val
|
||||
* @return {String}
|
||||
*/
|
||||
function kindOf(val) {
|
||||
if (val === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (val === undefined) {
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
if (typeof val !== 'object') {
|
||||
return typeof val;
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
return 'array';
|
||||
}
|
||||
|
||||
return {}.toString.call(val)
|
||||
.slice(8, -1).toLowerCase();
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return dateFormat;
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = dateFormat;
|
||||
} else {
|
||||
global.dateFormat = dateFormat;
|
||||
}
|
||||
})(this);
|
||||
/*
|
||||
* Date Format 1.2.3
|
||||
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
|
||||
* MIT license
|
||||
*
|
||||
* Includes enhancements by Scott Trenda <scott.trenda.net>
|
||||
* and Kris Kowal <cixar.com/~kris.kowal/>
|
||||
*
|
||||
* Accepts a date, a mask, or a date and a mask.
|
||||
* Returns a formatted version of the given date.
|
||||
* The date defaults to the current date/time.
|
||||
* The mask defaults to dateFormat.masks.default.
|
||||
*/
|
||||
|
||||
(function(global) {
|
||||
'use strict';
|
||||
|
||||
var dateFormat = (function() {
|
||||
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
|
||||
var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
|
||||
var timezoneClip = /[^-+\dA-Z]/g;
|
||||
|
||||
// Regexes and supporting functions are cached through closure
|
||||
return function (date, mask, utc, gmt) {
|
||||
|
||||
// You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
|
||||
if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
|
||||
mask = date;
|
||||
date = undefined;
|
||||
}
|
||||
|
||||
date = date || new Date;
|
||||
|
||||
if(!(date instanceof Date)) {
|
||||
date = new Date(date);
|
||||
}
|
||||
|
||||
if (isNaN(date)) {
|
||||
throw TypeError('Invalid date');
|
||||
}
|
||||
|
||||
mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
|
||||
|
||||
// Allow setting the utc/gmt argument via the mask
|
||||
var maskSlice = mask.slice(0, 4);
|
||||
if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
|
||||
mask = mask.slice(4);
|
||||
utc = true;
|
||||
if (maskSlice === 'GMT:') {
|
||||
gmt = true;
|
||||
}
|
||||
}
|
||||
|
||||
var _ = utc ? 'getUTC' : 'get';
|
||||
var d = date[_ + 'Date']();
|
||||
var D = date[_ + 'Day']();
|
||||
var m = date[_ + 'Month']();
|
||||
var y = date[_ + 'FullYear']();
|
||||
var H = date[_ + 'Hours']();
|
||||
var M = date[_ + 'Minutes']();
|
||||
var s = date[_ + 'Seconds']();
|
||||
var L = date[_ + 'Milliseconds']();
|
||||
var o = utc ? 0 : date.getTimezoneOffset();
|
||||
var W = getWeek(date);
|
||||
var N = getDayOfWeek(date);
|
||||
var flags = {
|
||||
d: d,
|
||||
dd: pad(d),
|
||||
ddd: dateFormat.i18n.dayNames[D],
|
||||
dddd: dateFormat.i18n.dayNames[D + 7],
|
||||
m: m + 1,
|
||||
mm: pad(m + 1),
|
||||
mmm: dateFormat.i18n.monthNames[m],
|
||||
mmmm: dateFormat.i18n.monthNames[m + 12],
|
||||
yy: String(y).slice(2),
|
||||
yyyy: y,
|
||||
h: H % 12 || 12,
|
||||
hh: pad(H % 12 || 12),
|
||||
H: H,
|
||||
HH: pad(H),
|
||||
M: M,
|
||||
MM: pad(M),
|
||||
s: s,
|
||||
ss: pad(s),
|
||||
l: pad(L, 3),
|
||||
L: pad(Math.round(L / 10)),
|
||||
t: H < 12 ? 'a' : 'p',
|
||||
tt: H < 12 ? 'am' : 'pm',
|
||||
T: H < 12 ? 'A' : 'P',
|
||||
TT: H < 12 ? 'AM' : 'PM',
|
||||
Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
|
||||
o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
||||
S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
|
||||
W: W,
|
||||
N: N
|
||||
};
|
||||
|
||||
return mask.replace(token, function (match) {
|
||||
if (match in flags) {
|
||||
return flags[match];
|
||||
}
|
||||
return match.slice(1, match.length - 1);
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
||||
dateFormat.masks = {
|
||||
'default': 'ddd mmm dd yyyy HH:MM:ss',
|
||||
'shortDate': 'm/d/yy',
|
||||
'mediumDate': 'mmm d, yyyy',
|
||||
'longDate': 'mmmm d, yyyy',
|
||||
'fullDate': 'dddd, mmmm d, yyyy',
|
||||
'shortTime': 'h:MM TT',
|
||||
'mediumTime': 'h:MM:ss TT',
|
||||
'longTime': 'h:MM:ss TT Z',
|
||||
'isoDate': 'yyyy-mm-dd',
|
||||
'isoTime': 'HH:MM:ss',
|
||||
'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
|
||||
'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
|
||||
'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
|
||||
};
|
||||
|
||||
// Internationalization strings
|
||||
dateFormat.i18n = {
|
||||
dayNames: [
|
||||
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
|
||||
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
|
||||
],
|
||||
monthNames: [
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
||||
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
|
||||
]
|
||||
};
|
||||
|
||||
function pad(val, len) {
|
||||
val = String(val);
|
||||
len = len || 2;
|
||||
while (val.length < len) {
|
||||
val = '0' + val;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ISO 8601 week number
|
||||
* Based on comments from
|
||||
* http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
|
||||
*
|
||||
* @param {Object} `date`
|
||||
* @return {Number}
|
||||
*/
|
||||
function getWeek(date) {
|
||||
// Remove time components of date
|
||||
var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
|
||||
// Change date to Thursday same week
|
||||
targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
|
||||
|
||||
// Take January 4th as it is always in week 1 (see ISO 8601)
|
||||
var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
|
||||
|
||||
// Change date to Thursday same week
|
||||
firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
|
||||
|
||||
// Check if daylight-saving-time-switch occurred and correct for it
|
||||
var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
|
||||
targetThursday.setHours(targetThursday.getHours() - ds);
|
||||
|
||||
// Number of weeks between target Thursday and first Thursday
|
||||
var weekDiff = (targetThursday - firstThursday) / (86400000*7);
|
||||
return 1 + Math.floor(weekDiff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ISO-8601 numeric representation of the day of the week
|
||||
* 1 (for Monday) through 7 (for Sunday)
|
||||
*
|
||||
* @param {Object} `date`
|
||||
* @return {Number}
|
||||
*/
|
||||
function getDayOfWeek(date) {
|
||||
var dow = date.getDay();
|
||||
if(dow === 0) {
|
||||
dow = 7;
|
||||
}
|
||||
return dow;
|
||||
}
|
||||
|
||||
/**
|
||||
* kind-of shortcut
|
||||
* @param {*} val
|
||||
* @return {String}
|
||||
*/
|
||||
function kindOf(val) {
|
||||
if (val === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (val === undefined) {
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
if (typeof val !== 'object') {
|
||||
return typeof val;
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
return 'array';
|
||||
}
|
||||
|
||||
return {}.toString.call(val)
|
||||
.slice(8, -1).toLowerCase();
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return dateFormat;
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = dateFormat;
|
||||
} else {
|
||||
global.dateFormat = dateFormat;
|
||||
}
|
||||
})(this);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"presets": [
|
||||
"es2015"
|
||||
]
|
||||
{
|
||||
"presets": [
|
||||
"es2015"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
# 汉字转拼音
|
||||
把汉字转化为拼音字母,由[chinalu/JSPinyin](https://github.com/chinalu/JSPinyin)改写,使用新语法并去掉mootools的依赖
|
||||
|
||||
## 安装
|
||||
```base
|
||||
npm install js-pinyin
|
||||
|
||||
import pinyin from 'js-pinyin'
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
```js
|
||||
let pinyin = require('js-pinyin');
|
||||
|
||||
pinyin.setOptions({checkPolyphone: false, charCase: 0});
|
||||
|
||||
console.log(pinyin.getFullChars('管理员'))
|
||||
console.log(pinyin.getCamelChars('管理员'))
|
||||
console.log(pinyin.getCamelChars('1234'))
|
||||
console.log(pinyin.getCamelChars('english'))
|
||||
console.log(pinyin.getCamelChars('昕'))
|
||||
console.log(pinyin.getCamelChars('佛'))
|
||||
console.log(pinyin.getFullChars('佛'))
|
||||
console.log(pinyin.getFullChars('凃一二'))
|
||||
console.log(pinyin.getCamelChars('凃一二'))
|
||||
```
|
||||
# 汉字转拼音
|
||||
把汉字转化为拼音字母,由[chinalu/JSPinyin](https://github.com/chinalu/JSPinyin)改写,使用新语法并去掉mootools的依赖
|
||||
|
||||
## 安装
|
||||
```base
|
||||
npm install js-pinyin
|
||||
|
||||
import pinyin from 'js-pinyin'
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
```js
|
||||
let pinyin = require('js-pinyin');
|
||||
|
||||
pinyin.setOptions({checkPolyphone: false, charCase: 0});
|
||||
|
||||
console.log(pinyin.getFullChars('管理员'))
|
||||
console.log(pinyin.getCamelChars('管理员'))
|
||||
console.log(pinyin.getCamelChars('1234'))
|
||||
console.log(pinyin.getCamelChars('english'))
|
||||
console.log(pinyin.getCamelChars('昕'))
|
||||
console.log(pinyin.getCamelChars('佛'))
|
||||
console.log(pinyin.getFullChars('佛'))
|
||||
console.log(pinyin.getFullChars('凃一二'))
|
||||
console.log(pinyin.getCamelChars('凃一二'))
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
* @fileOverview 汉字拼音转换主题功能
|
||||
* @author waterchestnut 2017/3/13
|
||||
* @module
|
||||
/**
|
||||
* @fileOverview 汉字拼音转换主题功能
|
||||
* @author waterchestnut 2017/3/13
|
||||
* @module
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @typedef Option
|
||||
* @type Object
|
||||
* @property {Boolean} [checkPolyphone=false] 是否检查多音字
|
||||
* @property {Number} [charCase=0] 输出拼音的大小写模式,0-首字母大写;1-全小写;2-全大写
|
||||
/**
|
||||
* @typedef Option
|
||||
* @type Object
|
||||
* @property {Boolean} [checkPolyphone=false] 是否检查多音字
|
||||
* @property {Number} [charCase=0] 输出拼音的大小写模式,0-首字母大写;1-全小写;2-全大写
|
||||
*/
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
|
@ -17,9 +17,9 @@ var _createClass = function () { function defineProperties(target, props) { for
|
|||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Pinyin = function () {
|
||||
/**
|
||||
* 构造函数,设置参数并初始化数据
|
||||
* @param {Option} [options] 参数对象
|
||||
/**
|
||||
* 构造函数,设置参数并初始化数据
|
||||
* @param {Option} [options] 参数对象
|
||||
*/
|
||||
function Pinyin(options) {
|
||||
_classCallCheck(this, Pinyin);
|
||||
|
|
@ -28,9 +28,9 @@ var Pinyin = function () {
|
|||
this.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置参数
|
||||
* @param {Option} [options] 参数对象
|
||||
/**
|
||||
* 设置参数
|
||||
* @param {Option} [options] 参数对象
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -41,8 +41,8 @@ var Pinyin = function () {
|
|||
this.options = Object.assign({ checkPolyphone: false, charCase: 0 }, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
|
||||
}, {
|
||||
|
|
@ -827,9 +827,9 @@ var Pinyin = function () {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拼音首字母
|
||||
* @param {String} str 输入的中文字符串
|
||||
/**
|
||||
* 获取拼音首字母
|
||||
* @param {String} str 输入的中文字符串
|
||||
*/
|
||||
|
||||
}, {
|
||||
|
|
@ -850,9 +850,9 @@ var Pinyin = function () {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拼音
|
||||
* @param {String} str 输入的中文字符串
|
||||
/**
|
||||
* 获取拼音
|
||||
* @param {String} str 输入的中文字符串
|
||||
*/
|
||||
|
||||
}, {
|
||||
|
|
@ -890,8 +890,8 @@ var Pinyin = function () {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 首字母大写
|
||||
/**
|
||||
* 首字母大写
|
||||
*/
|
||||
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -1,47 +1,47 @@
|
|||
/**
|
||||
* 拼音选项
|
||||
*/
|
||||
interface PinyinOptions {
|
||||
/**
|
||||
* 是否检查多音字
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
checkPolyphone: boolean
|
||||
|
||||
/**
|
||||
* 输出拼音的大小写模式
|
||||
*
|
||||
* @default 0
|
||||
* @description `0` - 首字母大写 `1` - 全小写 `2` - 全大写
|
||||
*/
|
||||
charCase: 0 | 1 | 2
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字拼音转换
|
||||
*/
|
||||
declare class Pinyin {
|
||||
constructor(options?: PinyinOptions)
|
||||
|
||||
/**
|
||||
* 设置参数
|
||||
* @param options 拼音选项
|
||||
*/
|
||||
setOptions(options?: PinyinOptions): void
|
||||
|
||||
/**
|
||||
* 获取拼音首字母
|
||||
* @param str 输入的中文字符串
|
||||
*/
|
||||
getCamelChars(str: string): string
|
||||
|
||||
/**
|
||||
* 获取拼音
|
||||
* @param str 输入的中文字符串
|
||||
*/
|
||||
getFullChars(str: string): string
|
||||
}
|
||||
|
||||
declare const pinyin: Pinyin
|
||||
export default pinyin
|
||||
/**
|
||||
* 拼音选项
|
||||
*/
|
||||
interface PinyinOptions {
|
||||
/**
|
||||
* 是否检查多音字
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
checkPolyphone: boolean
|
||||
|
||||
/**
|
||||
* 输出拼音的大小写模式
|
||||
*
|
||||
* @default 0
|
||||
* @description `0` - 首字母大写 `1` - 全小写 `2` - 全大写
|
||||
*/
|
||||
charCase: 0 | 1 | 2
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字拼音转换
|
||||
*/
|
||||
declare class Pinyin {
|
||||
constructor(options?: PinyinOptions)
|
||||
|
||||
/**
|
||||
* 设置参数
|
||||
* @param options 拼音选项
|
||||
*/
|
||||
setOptions(options?: PinyinOptions): void
|
||||
|
||||
/**
|
||||
* 获取拼音首字母
|
||||
* @param str 输入的中文字符串
|
||||
*/
|
||||
getCamelChars(str: string): string
|
||||
|
||||
/**
|
||||
* 获取拼音
|
||||
* @param str 输入的中文字符串
|
||||
*/
|
||||
getFullChars(str: string): string
|
||||
}
|
||||
|
||||
declare const pinyin: Pinyin
|
||||
export default pinyin
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue