common.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. import {checkLogin,logoutjpushId,updateHistoryApp} from '@/api/user'
  2. // import { getSopCourseStudyList } from "@/api/courseAnswer.js"
  3. import { bdCallBackReq } from '@/api/index.js'
  4. import { bindCompanyFsUser } from '@/api/companyUser.js'
  5. const TOKEN_KEY = 'AppToken'; // token 信息
  6. const CONFIG_KEY = 'QXT_MAGMT_CONFIG_KEY'; // 系统配置
  7. const USER_KEY = 'QXT_MAGMT_USER_KEY'; // 账号信息
  8. const SITE_BASE_URL_KEY = 'SITE_BASE_URL_KEY'; // 链接信息
  9. const SIP_ACCOUNT_KEY = 'SIP_ACCOUNT_KEY'; // 链接信息
  10. let idCode=null;
  11. let sdkwx = null;
  12. // #ifdef APP-PLUS
  13. idCode = uni.requireNativePlugin('Ba-IdCode');
  14. sdkwx = uni.requireNativePlugin('Wework-SdkWX'); // 企业微信登陆、分享插件
  15. // #endif
  16. // tabBar
  17. const tabBarPages = [
  18. '/pages/index/index',
  19. // '/pages/course/index',
  20. // '/pages/course/video/living-app',
  21. // '/pages/TUIKit/TUIPages/TUIConversation/index',
  22. // '/pages/user/index'
  23. ]
  24. function userDefaults(key) {
  25. let ret = '';
  26. ret = uni.getStorageSync(key);
  27. if (!ret) {
  28. ret = '{}';
  29. }
  30. let obj = JSON.parse(ret);
  31. return obj;
  32. }
  33. /**
  34. * 获取当前登录用户的令牌信息
  35. * @return {Object} 登录令牌信息
  36. */
  37. function getUserToken() {
  38. let usertoken = userDefaults(TOKEN_KEY);
  39. return usertoken;
  40. };
  41. /**
  42. * 添加当前登录用户的令牌信息
  43. * @param {Object} tokenInfo 令牌信息
  44. */
  45. function setUserToken(tokenInfo) {
  46. let tokens = getUserToken()
  47. let newToken = Object.assign(tokens, tokenInfo); // 只有在登陆是才能获取签名、实名状态,刷新token时只会返回token,不能直接得到状态,这里只调整覆盖原来的token
  48. uni.setStorageSync(TOKEN_KEY, JSON.stringify(newToken));
  49. };
  50. export function parseText(txt,len) {
  51. if(txt.length>len){
  52. var text=txt.substr(0,len)+"..."
  53. return text;
  54. }
  55. return txt;
  56. }
  57. export function parseIDCardInfo(idCard) {
  58. // 正则表达式匹配身份证号格式
  59. var reg = /^\d{17}[\dXx]$/;
  60. if (reg.test(idCard)) {
  61. // 提取出生日期
  62. var birthday = idCard.substring(6, 14);
  63. var year = birthday.substring(0, 4);
  64. var month = birthday.substring(4, 6);
  65. var day = birthday.substring(6, 8);
  66. // 计算年龄
  67. var currentYear = new Date().getFullYear();
  68. var age = currentYear - parseInt(year);
  69. // 提取性别
  70. var genderCode = parseInt(idCard.charAt(16));
  71. var gender = genderCode % 2 === 0 ? "女" : "男";
  72. return {
  73. birthday: year + "-" + month + "-" + day,
  74. age: age,
  75. gender: gender
  76. };
  77. }
  78. return null; // 身份证号格式不正确
  79. }
  80. export function isEmpty(obj) {
  81. if (obj == undefined || obj == null || obj=="") {
  82. return true;
  83. } else {
  84. return false;
  85. }
  86. }
  87. /**
  88. * 是否登录
  89. * @return {Boolean} true 登录 false 未登录
  90. */
  91. export function isLogin() {
  92. let obj=uni.getStorageSync(TOKEN_KEY);
  93. return !!obj;
  94. }
  95. export function logout() {
  96. const logoutAction=()=>{
  97. uni.setStorageSync(TOKEN_KEY,null);
  98. uni.removeStorageSync("userInfo");
  99. uni.removeStorageSync("onLaunch");
  100. uni.removeStorageSync("companyUser");
  101. uni.removeStorageSync("CompanyUserToken");
  102. uni.$emit("refreshUserInfo")
  103. uni.navigateTo({
  104. url: '/pages/auth/loginIndex'
  105. });
  106. //关闭推送事件监听
  107. uni.offPushMessage();
  108. plus.runtime.setBadgeNumber(0);
  109. };
  110. // #ifdef APP-PLUS
  111. logoutjpushId().then(res=>{
  112. if(res.code == 200){
  113. logoutAction();
  114. } else {
  115. uni.showToast({
  116. title: res.msg,
  117. icon: 'none'
  118. });
  119. }
  120. },
  121. rej => {
  122. logoutAction();
  123. }
  124. );
  125. // #endif
  126. // #ifndef APP-PLUS
  127. uni.setStorageSync(TOKEN_KEY,null);
  128. uni.removeStorageSync("companyUser");
  129. uni.removeStorageSync("CompanyUserToken");
  130. uni.removeStorageSync("onLaunch")
  131. uni.$emit("refreshUserInfo")
  132. uni.navigateTo({
  133. url: '/pages/auth/loginIndex'
  134. })
  135. // #endif
  136. }
  137. var toast=function(msg) {
  138. // #ifdef APP-PLUS
  139. uni.showToast({title: msg,icon: 'none',duration:2000,position:'bottom'});
  140. // #endif
  141. // #ifdef H5
  142. uni.showToast({ title: msg,icon: 'none',duration:2000});
  143. // #endif
  144. }
  145. export function getDictLabelName(dicts,dictValue) {
  146. if(dictValue==null){
  147. return "";
  148. }
  149. var name="";
  150. dicts.forEach(function(item, index, array) {
  151. if(dictValue.toString()==item.dictValue.toString()){
  152. name=item.dictLabel
  153. }
  154. });
  155. return name;
  156. }
  157. export function getStoreDictByName(key,dictValue) {
  158. if(dictValue==null || dictValue==-1){
  159. return "请选择";
  160. }
  161. var dicts = uni.getStorageSync(key);
  162. var dict=JSON.parse(dicts);
  163. var name="";
  164. dict.forEach(function(item, index, array) {
  165. if(dictValue.toString()==item.dictValue.toString()){
  166. name=item.dictLabel
  167. }
  168. });
  169. return name;
  170. }
  171. var getStoreIndexByName= function(key,dictValue) {
  172. if(dictValue==null || dictValue==-1){
  173. return [0];
  174. }
  175. var dicts = uni.getStorageSync(key);
  176. var dict=JSON.parse(dicts);
  177. var defIndexs=[0];
  178. dict.forEach(function(item, index, array) {
  179. if(dictValue.toString()==item.dictValue.toString()){
  180. defIndexs=[index];
  181. }
  182. });
  183. return defIndexs;
  184. }
  185. var getStorageByKey=function(key){
  186. let storageObj=uni.getStorageSync(key);
  187. var dataArr=[];
  188. if(!!storageObj){
  189. dataArr=JSON.parse(storageObj);
  190. }
  191. return dataArr;
  192. }
  193. var getStorageNamesByKey=function(key){
  194. let storageObj=uni.getStorageSync(key);
  195. if(!!storageObj){
  196. var tempArr=JSON.parse(storageObj);
  197. var valueArr=[];
  198. tempArr.forEach(function(item, index, array) {
  199. valueArr.push(item.dictLabel);
  200. });
  201. return valueArr;
  202. }
  203. }
  204. var getDict= function(key) {
  205. var dicts = uni.getStorageSync('dicts');
  206. dicts=JSON.parse(dicts);
  207. var dict=dicts[key]
  208. return dict;
  209. }
  210. var photosToArr= function(photoUrl) {
  211. var photos=[];
  212. if(photoUrl!=null&&photoUrl!=''){
  213. photos=photoUrl.split(',');
  214. }
  215. return photos
  216. }
  217. var dateFormat=function dateFormat(fmt, date) {
  218. let ret;
  219. const opt = {
  220. "Y+": date.getFullYear().toString(), // 年
  221. "m+": (date.getMonth() + 1).toString(), // 月
  222. "d+": date.getDate().toString(), // 日
  223. "H+": date.getHours().toString(), // 时
  224. "M+": date.getMinutes().toString(), // 分
  225. "S+": date.getSeconds().toString() // 秒
  226. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  227. };
  228. for (let k in opt) {
  229. ret = new RegExp("(" + k + ")").exec(fmt);
  230. if (ret) {
  231. fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
  232. };
  233. };
  234. return fmt;
  235. }
  236. var getProvider = service => {
  237. return new Promise((resolve, reject) => {
  238. // 获取当前环境的服务商
  239. uni.getProvider({
  240. service: service || 'oauth',
  241. success: function (res) {
  242. // 此处可以排除h5
  243. if (res.provider) {
  244. resolve(res.provider[0])
  245. }
  246. },
  247. fail() {
  248. reject('获取环境服务商失败')
  249. },
  250. })
  251. }).catch(error => {
  252. console.log('167', error)
  253. })
  254. }
  255. export function parsePhone(mobile) {
  256. var str = mobile.substr(0,3)+"****"+mobile.substr(7);
  257. return str;
  258. }
  259. export function getAge(strBirthday){
  260. var returnAge,
  261. strBirthdayArr=strBirthday.split("-"),
  262. birthYear = strBirthdayArr[0],
  263. birthMonth = strBirthdayArr[1],
  264. birthDay = strBirthdayArr[2],
  265. d = new Date(),
  266. nowYear = d.getFullYear(),
  267. nowMonth = d.getMonth() + 1,
  268. nowDay = d.getDate();
  269. if(nowYear == birthYear){
  270. returnAge = 0;//同年 则为0周岁
  271. }
  272. else{
  273. var ageDiff = nowYear - birthYear ; //年之差
  274. if(ageDiff > 0){
  275. if(nowMonth == birthMonth) {
  276. var dayDiff = nowDay - birthDay;//日之差
  277. if(dayDiff < 0) {
  278. returnAge = ageDiff - 1;
  279. }else {
  280. returnAge = ageDiff;
  281. }
  282. }else {
  283. var monthDiff = nowMonth - birthMonth;//月之差
  284. if(monthDiff < 0) {
  285. returnAge = ageDiff - 1;
  286. }
  287. else {
  288. returnAge = ageDiff ;
  289. }
  290. }
  291. }else {
  292. returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天
  293. }
  294. }
  295. return returnAge;//返回周岁年龄
  296. }
  297. const urlToObj = function(url) {
  298. let obj = {}
  299. let str = url.slice(url.indexOf('?') + 1)
  300. let arr = str.split('&')
  301. for (let j = arr.length, i = 0; i < j; i++) {
  302. let arr_temp = arr[i].split('=')
  303. obj[arr_temp[0]] = arr_temp[1]
  304. }
  305. return obj
  306. }
  307. /**
  308. * 判断是否为空对象
  309. * @param {Object} 时间字符串
  310. */
  311. var isNullObj=function(obj) {
  312. let isNull=(JSON.stringify(obj) == "{}");
  313. return isNull;
  314. }
  315. var arrContainsVal=function(arr,val){
  316. var isContains=false;
  317. for (var i = 0; i < arr.length; i++) {
  318. if (arr[i] == val) {
  319. isContains= true;
  320. break;
  321. }
  322. }
  323. return isContains;
  324. }
  325. var arrIndexOf = function(arr,val) {
  326. var isContains = this.arrContainsVal(arr,val);
  327. if (isContains) {
  328. return arr.indexOf(val);
  329. } else{
  330. return -1;
  331. }
  332. }
  333. export function navBack() {
  334. uni.navigateBack({
  335. animationType: 'pop-out',
  336. animationDuration: 200
  337. });
  338. }
  339. export function navTo(url) {
  340. uni.navigateTo({
  341. url: url
  342. });
  343. }
  344. export function loginNavTo(url){
  345. if(isLogin()){
  346. uni.navigateTo({
  347. url: url
  348. });
  349. }else{
  350. this.$showLoginPage();
  351. }
  352. }
  353. export function loginCallBack(){
  354. if(isLogin()){
  355. callBack();
  356. }else{
  357. this.$showLoginPage();
  358. }
  359. }
  360. /**
  361. * 获取用户信息
  362. *
  363. */
  364. export function getUserInfo(){
  365. let userInfo=uni.getStorageSync('userInfo');
  366. if(userInfo&&JSON.stringify(userInfo)!='{}') {
  367. userInfo= JSON.parse(userInfo);
  368. } else {
  369. userInfo= {}
  370. }
  371. return userInfo;
  372. };
  373. export function parseIdCard(idCard) {
  374. var str = idCard.substr(0,4)+"****"+idCard.substr(8);
  375. return str;
  376. }
  377. /**
  378. * 获取腕表用户信息
  379. *
  380. */
  381. export function getUser(callback) {
  382. getWatchUserInfo({isFamily:false}).then(res => {
  383. if (res.code == 200) {
  384. uni.setStorageSync("userWatchInfo", JSON.stringify(res.user))
  385. callback(res.user)
  386. } else {
  387. callback({})
  388. }
  389. })
  390. }
  391. /**
  392. * type == 1表示 00:00 改成0, 01:00 改成1, 23:00 改成23格式
  393. * type != 1表示 0 改成00:00, 1 改成01:00, 23 改成23:00格式
  394. */
  395. export function formatHour(time,type) {
  396. if(type == 1) {
  397. const parts = time.split(":");
  398. const hour = parseInt(parts[0]);
  399. return hour;
  400. } else {
  401. let str = time.toString();
  402. if (str.length === 1) {
  403. str = '0' + str;
  404. }
  405. return str + ':00';
  406. }
  407. }
  408. var bdCallBack=function(data,bdCmdType) {
  409. bdCallBackReq(data).then(res => {
  410. if(res.code==200){
  411. uni.setStorageSync("bdCmdType",bdCmdType);
  412. if(bdCmdType==2){
  413. uni.setStorageSync("bdCmdType",3);
  414. }
  415. }else{
  416. uni.showToast({
  417. icon:'none',
  418. title: res.msg
  419. });
  420. }
  421. });
  422. }
  423. var bdAdvFeedback=function(aType,aValue,bdCmdType,userId) { //获取设备的各种标识码
  424. let devinfo=uni.getDeviceInfo();
  425. console.log("qxj bdAdvFeedback devInfo:"+JSON.stringify(devinfo));
  426. let that=this;
  427. // #ifdef APP-PLUS
  428. idCode.getIdCodes(res => {
  429. console.log("qxj getIdCodes:"+JSON.stringify(res));
  430. if (res.data) {
  431. let params={"oaid":res.data.OAID,"model":devinfo.model,"osType":2,"aType":aType,"aValue":aValue.toString()};
  432. if(!!userId){
  433. params["userId"]=userId;
  434. }
  435. bdCallBack(params,bdCmdType);
  436. }
  437. });
  438. // #endif
  439. }
  440. export function registerIdCode(aType,bdCmdType,aValue,userId) {
  441. //bdCmdType -1未操作 0:激活 1:已注册 2:已下单 3:已回传
  442. //注册,先注册再获取,注意APP合规性,若最终用户未同意隐私政策则不要调用
  443. // #ifdef APP-PLUS
  444. let that=this;
  445. idCode.register(res => {
  446. console.log(res);
  447. bdAdvFeedback(aType,aValue,bdCmdType,userId);
  448. });
  449. // #endif
  450. }
  451. export function dateFormatStr(fmt, date){
  452. let dateStr=dateFormat(fmt,date);
  453. return dateStr;
  454. }
  455. // 设置tabbar消息红点
  456. // export async function updateMsgDot(){
  457. // const resOther = await getLastAndReadStatus()
  458. // let num1 = resOther.data && resOther.data.unReadNum ? resOther.data.unReadNum : 0
  459. // const resCourse = await getSopCourseStudyList({pageNum: 1,pageSize: 10})
  460. // let num2 = resCourse.isNotRead || 0
  461. // const imUnred = uni.getStorageSync("imUnread") || 0;
  462. // let BadgeNumber = (num1 + num2+imUnred) > 0 ? num1 + num2+imUnred : -1;
  463. // //BadgeNumber=num2;
  464. // const status = BadgeNumber > 0 ? 1 : 0;
  465. // // console.log("--qxj num1:"+num1+" num2:"+num2);
  466. // // 获取当前页面实例(通常在页面生命周期或方法中调用)
  467. // const currentPages = getCurrentPages();
  468. // const currentPage = currentPages[currentPages.length - 1];
  469. // const currentRoute = currentPage.route;
  470. // const formattedRoute = `/${currentRoute}`;
  471. // const isTabBarPage = tabBarPages.includes(formattedRoute);
  472. // return;
  473. // // if(isTabBarPage) {
  474. // // if(status == 1) {
  475. // // uni.showTabBarRedDot({
  476. // // index: 3,
  477. // // });
  478. // // } else {
  479. // // uni.hideTabBarRedDot({
  480. // // index: 3,
  481. // // });
  482. // // }
  483. // // }
  484. // // #ifdef APP-PLUS
  485. // plus.runtime.setBadgeNumber(BadgeNumber)
  486. // // #endif
  487. // }
  488. // 绑定销售
  489. export function handleBindCompanyFsUser(comUserId) {
  490. bindCompanyFsUser(comUserId).then(res=>{
  491. if(res.code == 200) {
  492. uni.navigateTo({
  493. url: '/pages/user/bindCompanyUser'
  494. })
  495. } else {
  496. uni.showToast({
  497. title: res.msg,
  498. icon: 'none'
  499. })
  500. }
  501. // #ifdef APP-PLUS
  502. plus.runtime.arguments = ''
  503. // #endif
  504. }).catch(()=>{
  505. // #ifdef APP-PLUS
  506. plus.runtime.arguments = ''
  507. // #endif
  508. })
  509. }
  510. // 设置来源
  511. export function setSource() {
  512. // #ifdef APP-PLUS
  513. let historyApp = plus.runtime.channel || 'app'
  514. if(plus.os.name == 'iOS'){
  515. historyApp="iOS";
  516. }
  517. console.log("qxj setSource");
  518. updateHistoryApp({historyApp:historyApp})
  519. // #endif
  520. }
  521. // 设置来源
  522. export function companyUserIsLogin() {
  523. let companyUser = uni.getStorageSync('companyUser');
  524. if(!!companyUser && companyUser!=''){
  525. return true;
  526. }
  527. return false;
  528. }
  529. // 关闭订单
  530. export function finishTransaction(transaction, iapChannel) {
  531. console.log("关闭订单")
  532. return new Promise((resolve, reject) => {
  533. iapChannel.finishTransaction(transaction, (res) => {
  534. console.log("关闭订单成功", res)
  535. resolve(res);
  536. }, (err) => {
  537. reject(err);
  538. });
  539. });
  540. }
  541. // 初始化注册到企业微信
  542. export function registerQW(callback,shareItem) {
  543. let schema = getApp().globalData.shareSchema;//应用跳转标识,显示在具体应用下的 Schema字段
  544. let appid = getApp().globalData.shareCorpId;//企业唯一标识。创建企业后显示在,我的企业 CorpID字段
  545. let agentid = getApp().globalData.shareAgentid;//应用唯一标识。显示在具体应用下的 AgentId字段
  546. console.log(schema, appid, agentid)
  547. if(!schema||!appid||!agentid) {
  548. uni.showToast({
  549. title: "企业微信配置不正确",
  550. icon: "none"
  551. })
  552. return
  553. }
  554. sdkwx.registerApp(schema, appid, agentid);
  555. isAppInstalledShare(callback,shareItem)
  556. }
  557. function uploadFilePromise(url) {
  558. return new Promise((resolve, reject) => {
  559. let a = uni.uploadFile({
  560. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', // 仅为示例,非真实的接口地址
  561. filePath: url,
  562. name: 'file',
  563. formData: {
  564. user: 'test'
  565. },
  566. success: (res) => {
  567. resolve(JSON.parse(res.data).url)
  568. },
  569. fail: (e) => {
  570. uni.showToast({
  571. title: "分享失败",
  572. icon: "none"
  573. })
  574. }
  575. });
  576. })
  577. }
  578. //检测是否安装企业微信并分享
  579. function isAppInstalledShare(callback,shareItem) {
  580. sdkwx.isAppInstalled(async function(ret) {
  581. if (ret) {
  582. // 处理图片
  583. let newImg = ''
  584. const isHttp = typeof shareItem.imageUrl === 'string' && shareItem.imageUrl.startsWith("http");
  585. if(isHttp) {
  586. newImg = shareItem.imageUrl
  587. } else {
  588. newImg = await uploadFilePromise(shareItem.imageUrl)
  589. }
  590. newImg = newImg+"?imageMogr2/thumbnail/300x"
  591. // console.log('企业微信已安装');
  592. if(shareItem.isMini) {
  593. let appid_gh = getApp().globalData.shareAppid_gh;//必须是应用关联的小程序,注意要有@app后缀
  594. const path = shareItem.path.replace(/\?/g, '.html?')
  595. // 分享到小程序
  596. uni.downloadFile({
  597. url: newImg,
  598. success: (images)=> {
  599. let imagePath = plus.io.convertLocalFileSystemURL(images.tempFilePath)
  600. sdkwx.shareMiniProgram({
  601. username:appid_gh,//必须是应用关联的小程序,注意要有@app后缀
  602. title: shareItem.title,
  603. hdImageData:imagePath,
  604. path:path
  605. }, (resp) => {
  606. // console.log("分享到小程序",JSON.stringify(resp));
  607. if(resp&&resp.errCode == 5) {
  608. uni.showToast({
  609. title: JSON.stringify(resp),
  610. icon: "none",
  611. duration: 2000
  612. })
  613. } else {
  614. if (typeof callback === 'function') {
  615. callback(ret);
  616. }
  617. }
  618. });
  619. },
  620. fail: (e) => {
  621. uni.showToast({
  622. title: "分享失败",
  623. icon: "none"
  624. })
  625. }
  626. });
  627. } else {
  628. // 分享链接
  629. let thumbUrl = newImg;
  630. let webpageUrl = shareItem.url;
  631. let title = shareItem.title;
  632. let description = shareItem.summary;
  633. try{
  634. sdkwx.shareLink(thumbUrl, webpageUrl, title, description);
  635. if (typeof callback === 'function') {
  636. callback(ret);
  637. }
  638. } catch (e) {
  639. console.log(e)
  640. }
  641. }
  642. } else {
  643. uni.showToast({
  644. title: "未安装企业微信",
  645. icon: "error"
  646. })
  647. }
  648. });
  649. }
  650. export function checkWechatInstalled(){
  651. let isInstalled=false;
  652. if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
  653. isInstalled=true;
  654. }
  655. return isInstalled;
  656. }
  657. export function isAndroid(){
  658. const systemInfo = uni.getSystemInfoSync();
  659. let isAndroid = systemInfo.platform === 'android';
  660. return isAndroid;
  661. }
  662. export function isIos(){
  663. const systemInfo = uni.getSystemInfoSync();
  664. let isIos = systemInfo.platform === 'ios';
  665. return isIos;
  666. }