index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. <template>
  2. <!-- <page-meta :page-font-size="`${this.scaleFontSize}px`" :root-font-size="`${this.scaleFontSize}px`"></page-meta> -->
  3. <view class="border-box">
  4. <view class="content y-ac">
  5. <view class="logo">
  6. <image class="logo-1" src='/static/image/new/logo.svg'></image>
  7. <image class="logo-2" src='/static/image/new/img_welcom.svg'></image>
  8. </view>
  9. <view class="checkbox">
  10. <view class="btn" @click="goTest()">开始检测</view>
  11. <view class="checkbox-icon x-c" @tap="handleAgree">
  12. <image src="/static/image/new/icon_check_default.svg" v-show="!agree"></image>
  13. <image src="/static/image/new/icon_check.svg" v-show="agree"></image>
  14. <view class="checkbox-text">我已阅读并同意<text @tap="goToWeb(0)">《用户协议》</text><text @tap="goToWeb(1)">《隐私政策》</text></view>
  15. </view>
  16. </view>
  17. <!-- <view class="center-box" :class="{ 'flex-box': width < height }">
  18. <view class="bg-item y-start" @click="goTest()">
  19. <view class="title">体质辨识</view>
  20. <view class="more">
  21. <text>点击了解</text>
  22. </view>
  23. </view>
  24. <view class="bg-item y-start" @click="goUser()">
  25. <view class="title">客户管理</view>
  26. <view class="more">
  27. <text>点击了解</text>
  28. </view>
  29. </view>
  30. </view> -->
  31. <!-- <view class="footer">
  32. <view>登录账号:{{info.userName||'-'}}</view>
  33. <view>姓名:{{info.nickName||'-'}}</view>
  34. </view> -->
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import store from '@/store';
  40. import {selectUserInfo} from '@/api/user.js';
  41. export default {
  42. components: {
  43. },
  44. data() {
  45. return {
  46. height: uni.getSystemInfoSync().screenHeight,
  47. width: uni.getSystemInfoSync().screenWidth,
  48. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  49. option: '',
  50. top: 0,
  51. statusBarBG: 'none',
  52. headerHeight: 44,
  53. // locCity: '国健通',
  54. scaleFontSize: uni.getStorageSync('fontSize'),
  55. info:{},
  56. user:{},
  57. agree: false,
  58. };
  59. },
  60. onPageScroll(e) {
  61. if (this.template == 'homeIndex') {
  62. this.top = e.scrollTop;
  63. }
  64. },
  65. computed: {
  66. // 计算属性的 getter
  67. headerBG() {
  68. if (this.template == 'homeIndex') {
  69. var top = this.top / 88;
  70. return 'rgba(255,92,3, ' + top + ')';
  71. }
  72. }
  73. },
  74. onLoad(option) {
  75. const systemInfo = uni.getSystemInfoSync();
  76. console.log("qxj screenWidth:"+systemInfo.screenWidth);
  77. console.log("qxj screenHeight:"+systemInfo.screenHeight); //定制设备平板 800x1232 平板设备1280x785
  78. let that = this;
  79. uni.setNavigationBarTitle({
  80. title: that.$qconfig.appName
  81. });
  82. uni.setStorageSync('indexTemplate', 0);
  83. this.option = option;
  84. // this.user=JSON.parse(uni.getStorageSync('userInfo'));
  85. // this.selectUserInfo();
  86. //this.scaleFontSize = store.state.timStore.fontSize;
  87. // this.$nextTick(()=>{
  88. // this.$refs[this.template].initLoad(this.option)
  89. // })
  90. },
  91. onReady() {
  92. // this.$refs.indexSubsection.selectorQuery();
  93. // this.$refs[this.template].initReady();
  94. },
  95. onShow() {
  96. // if (!this.$isLogin()) {
  97. // uni.navigateTo({
  98. // url: '/pages/auth/loginIndex'
  99. // });
  100. // } else {
  101. // // this.$updateMsgDot();
  102. // }
  103. },
  104. methods: {
  105. // 同意
  106. handleAgree() {
  107. this.agree = !this.agree
  108. },
  109. goToWeb(index) {
  110. // uni.setStorageSync('url', index == 0 ? "https://userapp.his.cdwjyyh.com/web/userAgreement" :
  111. // "https://userapp.his.cdwjyyh.com/web/privacyPolicy");
  112. uni.navigateTo({
  113. url: "/pages/index/agreement"
  114. })
  115. },
  116. selectUserInfo(){
  117. selectUserInfo().then(res => {
  118. if(res.code==200){
  119. console.log('res',res)
  120. this.info=res.user
  121. }
  122. else{
  123. uni.showToast({title: res.msg,icon: 'none'});
  124. }
  125. },
  126. rej => {}
  127. );
  128. },
  129. logout(){
  130. uni.showModal({
  131. title:"提示",
  132. content:"确认退出登录吗?",
  133. showCancel:true,
  134. cancelText:'取消',
  135. confirmText:'确定',
  136. success:res=>{
  137. if(res.confirm){
  138. // this.$logout();
  139. uni.removeStorageSync('AppToken');
  140. uni.removeStorageSync('selectUser');
  141. uni.$emit('loginOut');
  142. uni.reLaunch({
  143. url: '/pages/auth/loginIndex'
  144. });
  145. }else{
  146. }
  147. }
  148. })
  149. },
  150. goUser(){
  151. // uni.redirectTo({
  152. // url: '/pages/user/myUserList?userId='+this.user.userId
  153. // });
  154. uni.navigateTo({
  155. url: '/pages/user/myUserList?userId='+this.user.userId
  156. })
  157. },
  158. goTest(){
  159. if (!this.agree) {
  160. uni.showToast({
  161. title: "请同意相关协议",
  162. icon: 'none'
  163. });
  164. return
  165. }
  166. // uni.navigateTo({
  167. // //url:"/pages/device/tongue/indexOld"
  168. // url:"/pages/device/tongue/facePhoto"
  169. // });
  170. uni.navigateTo({
  171. url:'/pages/user/userInfo'
  172. })
  173. },
  174. changeTemplate(e) {
  175. const tem = e == 1 ? 'watchIndex' : 'homeIndex';
  176. if (this.template == tem) return;
  177. this.template = tem;
  178. uni.pageScrollTo({
  179. scrollTop: 0,
  180. duration: 100
  181. });
  182. this.$nextTick(() => {
  183. //this.$refs[this.template].initLoad(this.option)
  184. this.$refs[this.template].initReady();
  185. // this.$refs[this.template].initShow();
  186. });
  187. },
  188. registerIdCode() {
  189. //注册,先注册再获取,注意APP合规性,若最终用户未同意隐私政策则不要调用
  190. idCode.register((res) => {
  191. console.log(res);
  192. });
  193. },
  194. async getLocation() {
  195. let status;
  196. // #ifdef APP-PLUS
  197. status = await this.checkPermission();
  198. if (status !== 1) {
  199. return;
  200. }
  201. // #endif
  202. // #ifdef MP-WEIXIN || MP-TOUTIAO || MP-QQ
  203. status = await this.getSetting();
  204. if (status === 2) {
  205. this.showConfirm();
  206. return;
  207. }
  208. // #endif
  209. this.doGetLocation();
  210. },
  211. doGetLocation() {
  212. getLocation().then((res) => {
  213. this.locCity = res.city.replace(/市|区/g, '');
  214. });
  215. },
  216. getSetting: function() {
  217. return new Promise((resolve, reject) => {
  218. uni.getSetting({
  219. success: (res) => {
  220. if (res.authSetting['scope.userLocation'] === undefined) {
  221. resolve(0);
  222. return;
  223. }
  224. if (res.authSetting['scope.userLocation']) {
  225. resolve(1);
  226. } else {
  227. resolve(2);
  228. }
  229. }
  230. });
  231. });
  232. },
  233. openSetting: function() {
  234. this.hideConfirm();
  235. uni.openSetting({
  236. success: (res) => {
  237. if (res.authSetting && res.authSetting['scope.userLocation']) {
  238. this.doGetLocation();
  239. }
  240. },
  241. fail: (err) => {}
  242. });
  243. },
  244. async checkPermission() {
  245. let status = permision1.isIOS ? await permision1.requestIOS('location') : await permision1
  246. .requestAndroid('android.permission.ACCESS_FINE_LOCATION');
  247. if (status === null || status === 1) {
  248. status = 1;
  249. } else if (status === 2) {
  250. uni.showModal({
  251. content: '系统定位已关闭',
  252. confirmText: '确定',
  253. showCancel: false,
  254. success: function(res) {}
  255. });
  256. } else if (status.code) {
  257. uni.showModal({
  258. content: status.message
  259. });
  260. } else {
  261. uni.showModal({
  262. content: '需要定位权限',
  263. confirmText: '设置',
  264. success: function(res) {
  265. if (res.confirm) {
  266. permision1.gotoAppSetting();
  267. }
  268. }
  269. });
  270. }
  271. return status;
  272. },
  273. showQidai() {
  274. uni.showToast({
  275. title: '功能完善中,敬请期待...',
  276. icon: 'none'
  277. });
  278. },
  279. goToMsg() {
  280. uni.switchTab({
  281. url: '/pages_im/pages/conversation/conversationList/index'
  282. });
  283. },
  284. async goToWXMsg() {
  285. const url = getApp().globalData.kfurl; //企业微信客服链接
  286. const corpId = getApp().globalData.corpId; //企业id
  287. // #ifdef H5
  288. window.location.href = url;
  289. // #endif
  290. // #ifdef MP-WEIXIN
  291. wx.openCustomerServiceChat({
  292. extInfo: {
  293. url
  294. },
  295. corpId,
  296. success(res) {
  297. console.log('成功');
  298. },
  299. fail(err) {
  300. console.log(err, '报错');
  301. }
  302. });
  303. // #endif
  304. // #ifdef APP-PLUS
  305. let shares = await this.getAppShare().catch((err) => {
  306. throw Error(err);
  307. });
  308. shares['weixin'].openCustomerServiceChat({
  309. corpid: corpId,
  310. url
  311. },
  312. (suc) => {
  313. console.log('客服打开成功', JSON.stringify(res));
  314. },
  315. (err) => {
  316. console.log('error', JSON.stringify(err));
  317. }
  318. );
  319. // #endif
  320. },
  321. getAppShare() {
  322. // #ifdef APP-PLUS
  323. return new Promise((re, rj) => {
  324. let shares = null;
  325. var pusher = plus.share.getServices(
  326. function(s) {
  327. shares = {};
  328. s.forEach((e) => (shares[e.id] = e));
  329. re(shares);
  330. },
  331. function(e) {
  332. rj(e);
  333. }
  334. );
  335. });
  336. // #endif
  337. },
  338. getIdCodes() {
  339. //获取设备的各种标识码
  340. idCode.getIdCodes((res) => {
  341. if (res.data) {
  342. //this.msgList.unshift(JSON.stringify(res.data));
  343. let ua = plus.navigator.getUserAgent();
  344. console.log('qxj ua:' + ua);
  345. console.log('qxj getIdCodes:' + JSON.stringify(res.data));
  346. }
  347. });
  348. },
  349. scanQRCode() {
  350. const that = this;
  351. uni.scanCode({
  352. success(res) {
  353. if (res.result) {
  354. // 扫描成功,处理二维码内容
  355. console.log('扫描结果:', res.result);
  356. const scanInfo = res.result;
  357. if (scanInfo && scanInfo.indexOf('https://userapp.his.cdwjyyh.com/bindcompanyuser') > -
  358. 1) {
  359. const companyUserId = this.getUrlParam(scanInfo).companyUserId;
  360. console.log('扫描结果公司码:', companyUserId);
  361. this.$handleBindCompanyFsUser(companyUserId);
  362. }
  363. } else {
  364. // 扫描失败
  365. uni.showToast({
  366. title: '扫描失败',
  367. icon: 'none'
  368. });
  369. }
  370. },
  371. fail() {}
  372. });
  373. },
  374. getUrlParam(url) {
  375. const queryStr = url.split('?')[1];
  376. if (!queryStr) {
  377. return {};
  378. }
  379. const params = queryStr.split('&');
  380. const queryParams = {};
  381. params.forEach((param) => {
  382. const [key, value] = param.split('=');
  383. queryParams[key] = value;
  384. });
  385. return queryParams;
  386. }
  387. }
  388. };
  389. </script>
  390. <style lang="scss" scoped>
  391. // @mixin u-flex($flexD, $alignI, $justifyC) {
  392. // display: flex;
  393. // flex-direction: $flexD;
  394. // align-items: $alignI;
  395. // justify-content: $justifyC;
  396. // }
  397. .border-box{
  398. width: 100vw;
  399. height: 100vh;
  400. // background-image:url(/static/image/device/ipad_yjf_boder.png);
  401. // background-repeat: no-repeat;
  402. // position: relative;
  403. // background-size: 100% 100%;
  404. // box-sizing: border-box;
  405. // padding: 10px;
  406. }
  407. .content{
  408. // display: flex;
  409. width: 100%;
  410. height: 100%;
  411. background-image:url(/static/image/new/bg_home.png);
  412. background-repeat: no-repeat;
  413. background-size: 100% 100%;
  414. position: relative;
  415. // padding-top: 20px;
  416. .logo{
  417. margin-top: 30px;
  418. width: 100%;
  419. display: flex;
  420. align-items: center;
  421. flex-direction: column;
  422. .logo-1{
  423. width: 536px;
  424. height: 263px;
  425. }
  426. .logo-2{
  427. margin-top: 55px;
  428. width: 490px;
  429. height: 104px;
  430. }
  431. }
  432. .btn-box{
  433. width: 100%;
  434. text-align: right;
  435. justify-content: right;
  436. margin-top: 50px;
  437. padding-right: 37px;
  438. .item-box{
  439. width: 167px;
  440. height: 47px;
  441. background: #8F6726;
  442. border-radius: 9px 9px 9px 9px;
  443. margin-left: 16px;
  444. font-family: Microsoft YaHei, Microsoft YaHei;
  445. font-weight: 400;
  446. font-size: 18px;
  447. color: #FFFFFF;
  448. text-align: center;
  449. image{
  450. width: 24px;
  451. height: 24px;
  452. margin-right:10px ;
  453. }
  454. }
  455. }
  456. .center-box{
  457. width: 100%;
  458. display: flex;
  459. align-items: center;
  460. justify-content: center;
  461. &.flex-box{
  462. flex-direction: column;
  463. .bg-item:last-child{
  464. margin-left: 0px;
  465. margin-top: 40px;
  466. }
  467. }
  468. .bg-item{
  469. width: 504px;
  470. height: 267px;
  471. padding: 41px;
  472. border-radius: 16px;
  473. background-image:url(/static/image/device/tzbs_bg.png);
  474. background-repeat: no-repeat;
  475. background-size: 100% 100%;
  476. &:last-child{
  477. margin-left: 40px;
  478. background-image:url(/static/image/device/khgl_bg.png);
  479. }
  480. .title{
  481. font-family: Source Han Serif CN, Source Han Serif CN;
  482. font-weight: bold;
  483. font-size: 39px;
  484. color: #FFFFFF;
  485. text-align: left;
  486. }
  487. .more{
  488. margin-top: 15px;
  489. width: 89px;
  490. height: 30px;
  491. background: #FFFFFF;
  492. border-radius: 6px 6px 6px 6px;
  493. display: flex;
  494. align-items: center;
  495. justify-content: center;
  496. background: #FFFFFF;
  497. text-align: center;
  498. text{
  499. font-family: PingFang SC, PingFang SC;
  500. font-weight: 400;
  501. font-size: 16px;
  502. color: #A14212;
  503. }
  504. }
  505. }
  506. }
  507. .footer{
  508. width: 100%;
  509. display: flex;
  510. align-items: center;
  511. justify-content: center;
  512. // position: absolute;
  513. padding-bottom:50px;
  514. view{
  515. font-family: PingFang SC, PingFang SC;
  516. font-weight: 400;
  517. font-size: 20px;
  518. color: #8F6726;
  519. text-align: center;
  520. &:last-child{
  521. margin-left: 40px;
  522. }
  523. }
  524. }
  525. }
  526. .checkbox {
  527. // margin: 20px;
  528. margin-top: 20px;
  529. display: flex;
  530. // flex-direction: row;
  531. align-items: center;
  532. // justify-content: flex-start;
  533. font-family: PingFang SC, PingFang SC;
  534. font-weight: 400;
  535. font-size: 18px;
  536. color: #999999;
  537. // line-height: 38px;
  538. text-align: left;
  539. flex-direction: column;
  540. .uni-label-pointer{
  541. display: flex;
  542. // flex-direction: row;
  543. align-items: center;
  544. }
  545. text {
  546. color: #3BABAF;
  547. }
  548. &-icon {
  549. flex-shrink: 0;
  550. image {
  551. height: 24px;
  552. width: 24px;
  553. margin-right: 10px;
  554. }
  555. }
  556. &-text{
  557. font-family: PingFang SC, PingFang SC;
  558. font-weight: 400;
  559. font-size: 22px;
  560. color: #333333;
  561. }
  562. .btn{
  563. display: flex;
  564. align-items: center;
  565. justify-content: center;
  566. width: 535px;
  567. height: 95px;
  568. background: #37C3A0;
  569. border-radius: 158px 158px 158px 158px;
  570. font-family: PingFang SC, PingFang SC;
  571. font-weight: 600;
  572. font-size: 40px;
  573. color: #FFFFFF;
  574. margin-bottom: 40px;
  575. }
  576. }
  577. // @media screen and (max-width: 1149px) and (min-aspect-ratio: 1/1) {
  578. // .bg-item{
  579. // margin-left: 0 !important;
  580. // transform: scale(0.85);
  581. // }
  582. // .content .logo{
  583. // transform: scale(0.9);
  584. // }
  585. // }
  586. </style>