e-link.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. <template>
  2. <view>
  3. <view class="linksList">
  4. <view class="title" v-if="linksList[0].title">{{linksList[0].title}}</view>
  5. <view v-if="linksList[0].types == 11">
  6. <view class="list_11">
  7. <view class="item" v-for="item in linksList" :key="item.id" @click="go_page(item)">
  8. <view class="left">
  9. <view class="icon">
  10. <view class="img"
  11. v-if="item.imageUrl == '../../static/images/link.png' || item.imageUrl == ''">
  12. <uni-icons type="paperclip" size="30"></uni-icons>
  13. </view>
  14. <view class="img" v-else>
  15. <image :src="item.imageUrl" mode=""></image>
  16. </view>
  17. </view>
  18. <view class="name">{{item.linkName}}</view>
  19. </view>
  20. <view class="right">
  21. <uni-icons type="arrowright" size="20"></uni-icons>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view v-if="linksList[0].types == 12">
  27. <view class="list_12">
  28. <view class="item" v-for="item in linksList" :key="item.id" @click="go_page(item)">
  29. <view class="icon">
  30. <view class="img"
  31. v-if="item.imageUrl == '../../static/images/link.png' || item.imageUrl == ''">
  32. <uni-icons type="paperclip" size="30"></uni-icons>
  33. </view>
  34. <view class="img" v-else>
  35. <image :src="item.imageUrl" mode=""></image>
  36. </view>
  37. </view>
  38. <view class="name">{{item.linkName}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view v-if="linksList[0].types == 13">
  43. <view class="list_13">
  44. <view class="item" v-for="item in linksList" :key="item.id" @click="go_page(item)">
  45. <view class="icon">
  46. <view class="img"
  47. v-if="item.imageUrl == '../../static/images/link.png' || item.imageUrl == ''">
  48. <uni-icons type="paperclip" size="30"></uni-icons>
  49. </view>
  50. <view class="img" v-else>
  51. <image :src="item.imageUrl" mode=""></image>
  52. </view>
  53. </view>
  54. <view class="name">{{item.linkName}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. <view v-if="linksList[0].types == 14">
  59. <view class="list_14">
  60. <view class="item" v-for="item in linksList" :key="item.id" @click="go_page(item)">
  61. <view class="icon">
  62. <view class="img"
  63. v-if="item.imageUrl == '../../static/images/link.png' || item.imageUrl == ''">
  64. <uni-icons type="paperclip" size="30"></uni-icons>
  65. </view>
  66. <view class="img" v-else>
  67. <image :src="item.imageUrl" mode=""></image>
  68. </view>
  69. </view>
  70. <view class="name">{{item.linkName}}</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 宁煤信息平台登录框 -->
  76. <uni-popup ref="popup" type="center" @maskClick="maskClick">
  77. <view class="login_box">
  78. <view class="input_box">
  79. <view class="label">工号:</view>
  80. <view class="box">
  81. {{staff_num}}
  82. </view>
  83. </view>
  84. <view class="input_box">
  85. <view class="label">登录密码(宁煤信息平台):</view>
  86. <view class="box">
  87. <input type="password" v-model="password" />
  88. </view>
  89. </view>
  90. <view class="btn" @click="login()">确认</view>
  91. </view>
  92. </uni-popup>
  93. </view>
  94. </template>
  95. <script>
  96. import {
  97. set_base_url
  98. } from '@/common/set_base_url.js'
  99. import time from "@/common/time.js"
  100. import {
  101. diffTime
  102. } from "@/common/time.js"
  103. import {
  104. goToLink
  105. } from "@/common/common.js"
  106. export default {
  107. props: [
  108. "linksList",
  109. "mine_code"
  110. ],
  111. data() {
  112. return {
  113. staff_num: "",
  114. password: "",
  115. url: "",
  116. app_id: "",
  117. gps: "",
  118. deviceID: "",
  119. phoneType: ""
  120. };
  121. },
  122. mounted() {
  123. this.staff_num = uni.getStorageSync('user').staff_num
  124. },
  125. methods: {
  126. maskClick() {
  127. this.password = ""
  128. },
  129. login() {
  130. // #ifdef APP-PLUS
  131. if (this.password == '') {
  132. uni.showToast({
  133. icon: "none",
  134. title: "密码不能为空!"
  135. })
  136. return
  137. }
  138. this.$refs.popup.close()
  139. // 获取gps
  140. uni.getLocation({
  141. type: 'wgs84',
  142. success: (res) => {
  143. console.log('当前位置的经度:' + res.longitude);
  144. console.log('当前位置的纬度:' + res.latitude);
  145. this.gps = res.longitude + ',' + res.latitude
  146. // 获取设备信息
  147. plus.device.getInfo({
  148. success: (e) => {
  149. console.log(JSON.stringify(e.uuid));
  150. console.log(plus.device.model)
  151. this.deviceID = JSON.stringify(e.uuid)
  152. this.phoneType = plus.device.model
  153. uni.request({
  154. method: "POST",
  155. url: "http://mtyyxs.shnxmyjt.com:33300/api/OAuth/Login",
  156. header: {
  157. 'Content-Type': 'application/json;charset=UTF-8',
  158. 'caller': 'UnifiedPortal'
  159. },
  160. data: {
  161. phoneType: this.phoneType,
  162. password: this.password,
  163. gps: this.gps,
  164. userID: this.staff_num,
  165. resolvingPower: "851*393",
  166. deviceID: this.deviceID,
  167. ip: "112312313"
  168. },
  169. success: (res) => {
  170. console.log(this.password)
  171. console.log(res)
  172. if (res.data.code = '11002') {
  173. uni.showToast({
  174. icon: "none",
  175. title: res.data.msg
  176. })
  177. if (res.data.data.length > 20) {
  178. uni.setStorageSync('ningmei_token', res
  179. .data.data)
  180. uni.setStorageSync(
  181. 'ningmei_token_time',
  182. new Date().format("yyyy-MM-dd")
  183. )
  184. uni.navigateTo({
  185. url: "../../index/ningMeiXinXiPingTai/ningMeiXinXiPingTai",
  186. success: (res) => {
  187. // 通过eventChannel向被打开页面传送数据
  188. res.eventChannel
  189. .emit(
  190. 'acceptDataFromOpenerPage', {
  191. data: this
  192. .url
  193. })
  194. }
  195. })
  196. }
  197. }
  198. }
  199. })
  200. }
  201. });
  202. }
  203. })
  204. // #endif
  205. },
  206. go_page(item){
  207. // console.log(item)
  208. let link = item.linkUrl
  209. // console.log(link)
  210. // OA系统
  211. if(link.indexOf("oa_system.nxmy.com") != -1 ){
  212. uni.navigateTo({
  213. url:"../../origanization/OA/h5/h5",
  214. success: (res) =>{
  215. // 通过eventChannel向被打开页面传送数据
  216. res.eventChannel.emit('acceptDataFromOpenerPage', {
  217. url: link,
  218. title: item.title
  219. })
  220. }
  221. })
  222. return
  223. }
  224. if (link.indexOf("nativeApp://") != -1) {
  225. let app_name = link.match(/nativeApp:\/\/(\S*)\?/)[1]
  226. let app_down_link = link.split('?')[1]
  227. // #ifdef APP
  228. if (plus.os.name == 'Android') {
  229. plus.runtime.launchApplication({
  230. pname: app_name
  231. }, (e) => {
  232. console.log('Open system default browser failed: ' + e.message)
  233. uni.showModal({
  234. title: app_name,
  235. content: '未安装此应用、是否下载?',
  236. success: (res) => {
  237. if (res.confirm) {
  238. console.log('用户点击确定');
  239. uni.navigateTo({
  240. url: "../../index/h5/h5?url=" + app_down_link
  241. })
  242. } else if (res.cancel) {
  243. console.log('用户点击取消');
  244. }
  245. }
  246. });
  247. })
  248. }
  249. return
  250. // #endif
  251. }
  252. if (link.indexOf("http://mtyyxs.shnxmyjt.com") != -1) {
  253. console.log("信息平台")
  254. this.url = item
  255. // 有登录记录
  256. let token = uni.getStorageSync('ningmei_token')
  257. let time = uni.getStorageSync('ningmei_token_time')
  258. // 30天刷新一次
  259. let diffTimeShow = diffTime(time, new Date().format("yyyy-MM-dd")).split(' ')[0];
  260. console.log(diffTimeShow)
  261. if (token.length > 20 && diffTimeShow < 30) {
  262. uni.navigateTo({
  263. url: "../../index/ningMeiXinXiPingTai/ningMeiXinXiPingTai",
  264. success: (res) => {
  265. // 通过eventChannel向被打开页面传送数据
  266. res.eventChannel.emit('acceptDataFromOpenerPage', {
  267. data: this.url
  268. })
  269. }
  270. })
  271. } else {
  272. this.$refs.popup.open()
  273. }
  274. return
  275. }
  276. // 二维码
  277. if(link.indexOf("pageId") != -1 && link.indexOf("app:") == -1){
  278. let pageId = ""
  279. function GetQueryString(name) {
  280. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  281. var r = link.match(reg);
  282. if (r != null) return unescape(r[2]);
  283. return null;
  284. }
  285. console.log(GetQueryString("pageId"))
  286. if (GetQueryString("pageId")) {
  287. pageId = GetQueryString("pageId")
  288. } else {
  289. pageId = link.split('=')[1]
  290. }
  291. uni.navigateTo({
  292. url:"../../index/record/record?pageId=" + pageId + "&mine_code=" + this.mine_code,
  293. })
  294. }
  295. // h5
  296. if(link.indexOf("pageId") == -1 && link.indexOf("app:") == -1){
  297. if(link.indexOf("huiyiList") != -1){
  298. uni.navigateTo({
  299. url:"../../workbench/meeting_arrangements/meeting_arrangements"
  300. })
  301. }else{
  302. uni.navigateTo({
  303. url: "../../index/record/h5/h5?url=" + link
  304. })
  305. }
  306. }
  307. // 原生
  308. if(link.indexOf("pageId") == -1 && link.indexOf("app:") != -1){
  309. // console.log("原生")
  310. if (link.indexOf("/production/production") != -1) {
  311. uni.switchTab({
  312. url: "../../tabbar/production/production"
  313. })
  314. }
  315. if (link.indexOf("app_url") != -1) {
  316. // console.log(link.split('app_url=')[1] + "&title=" + item.linkName + "&mine_code=" + this.mine_code)
  317. uni.navigateTo({
  318. url:link.split('app_url=')[1] + "&title=" + item.linkName + "&mine_code=" + this.mine_code
  319. })
  320. }
  321. if (link.indexOf("nativeApp://") != -1) {
  322. let app_name = link.match(/nativeApp:\/\/(\S*)\?/)[1]
  323. let app_down_link = link.split('?')[1]
  324. console.log(app_name,app_down_link)
  325. // #ifdef APP
  326. if (plus.os.name == 'Android') {
  327. plus.runtime.launchApplication({
  328. pname: app_name
  329. }, (e) => {
  330. console.log('Open system default browser failed: ' + e.message)
  331. uni.showModal({
  332. title: app_name,
  333. content: '未安装此应用、是否下载?',
  334. success: (res) => {
  335. if (res.confirm) {
  336. console.log('用户点击确定');
  337. uni.navigateTo({
  338. url: "../../index/h5/h5?url=" + app_down_link
  339. })
  340. } else if (res.cancel) {
  341. console.log('用户点击取消');
  342. }
  343. }
  344. });
  345. })
  346. }
  347. // #endif
  348. }
  349. }
  350. }
  351. }
  352. }
  353. </script>
  354. <style lang="scss">
  355. .linksList {
  356. .title {
  357. line-height: 30px;
  358. border-left: 4px solid #009FE8;
  359. border-radius: 4px;
  360. padding-left: 10px;
  361. margin-bottom: 10px;
  362. }
  363. // 一行一项
  364. .list_11 {
  365. .item {
  366. display: flex;
  367. justify-content: space-between;
  368. align-items: center;
  369. padding: 10px 0;
  370. border-bottom: 1px solid #f4f4f4;
  371. .left {
  372. display: flex;
  373. align-items: center;
  374. .icon {
  375. width: 60px;
  376. line-height: 80rpx;
  377. margin-right: 10rpx;
  378. .img {
  379. width: 60px;
  380. height: 80rpx;
  381. line-height: 80rpx;
  382. text-align: center;
  383. image {
  384. width: 80rpx;
  385. height: 80rpx;
  386. }
  387. }
  388. }
  389. .name {
  390. width: 500rpx;
  391. white-space: nowrap;
  392. overflow: hidden;
  393. text-overflow: ellipsis;
  394. }
  395. }
  396. .right {}
  397. }
  398. }
  399. // 一行两项
  400. .list_12 {
  401. display: flex;
  402. flex-wrap: wrap;
  403. .item {
  404. width: 320rpx;
  405. display: flex;
  406. align-items: center;
  407. margin-left: 10rpx;
  408. // border-right: 1px solid #f4f4f4;
  409. padding-right: 10rpx;
  410. margin-bottom: 10px;
  411. .icon {
  412. margin-right: 30rpx;
  413. .img {
  414. image {
  415. width: 90rpx;
  416. height: 90rpx;
  417. }
  418. }
  419. }
  420. .name {
  421. white-space: nowrap;
  422. overflow: hidden;
  423. text-overflow: ellipsis;
  424. }
  425. }
  426. .item:nth-child(2n) {
  427. border-right: none;
  428. }
  429. }
  430. // 一行三项
  431. .list_13 {
  432. overflow: hidden;
  433. .item {
  434. float: left;
  435. width: 210rpx;
  436. text-align: center;
  437. margin-bottom: 10px;
  438. margin-right: 35rpx;
  439. .icon {
  440. width: 210rpx;
  441. .img {
  442. width: 210rpx;
  443. line-height: 30px;
  444. text-align: center;
  445. image {
  446. width: 90rpx;
  447. height: 90rpx;
  448. }
  449. }
  450. }
  451. .name {
  452. margin-top: 10rpx;
  453. white-space: nowrap;
  454. overflow: hidden;
  455. text-overflow: ellipsis;
  456. }
  457. }
  458. .item:nth-child(3n) {
  459. margin-right: 0;
  460. }
  461. }
  462. // 一行四项
  463. .list_14 {
  464. overflow: hidden;
  465. .item {
  466. float: left;
  467. width: 175rpx;
  468. text-align: center;
  469. margin-bottom: 10px;
  470. .icon {
  471. width: 175rpx;
  472. .img {
  473. width: 175rpx;
  474. line-height: 30px;
  475. text-align: center;
  476. image {
  477. width: 50px;
  478. height: 50px;
  479. }
  480. }
  481. }
  482. .name {
  483. margin-top: 10rpx;
  484. white-space: nowrap;
  485. overflow: hidden;
  486. text-overflow: ellipsis;
  487. }
  488. }
  489. }
  490. }
  491. .login_box {
  492. width: 500rpx;
  493. padding: 30rpx 50rpx;
  494. border-radius: 20rpx;
  495. margin: 0 auto;
  496. background-color: #FFFFFF;
  497. .input_box {
  498. margin-bottom: 30rpx;
  499. .label {
  500. color: #6C6F74;
  501. margin-bottom: 20rpx;
  502. }
  503. .box {
  504. background: #FFFFFF;
  505. border-radius: 8rpx;
  506. border: 2rpx solid #E9EBF2;
  507. box-sizing: border-box;
  508. padding: 20rpx 25rpx;
  509. }
  510. }
  511. .btn {
  512. width: 500rpx;
  513. margin: 0 auto;
  514. border-radius: 8rpx;
  515. background-color: #009FE8;
  516. line-height: 90rpx;
  517. color: #FFFFFF;
  518. text-align: center;
  519. }
  520. }
  521. </style>