123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- <template>
- <view class="content">
- <view class="nav">
- <view class="item" v-for="(item,index) in iceList" :key="index" @click="go_link(item)">
- <view class="icon">
- <image :src="item.thumb" mode=""></image>
- </view>
- <view class="name">{{item.title}}</view>
- </view>
- </view>
- <!-- 宁煤信息平台登录框 -->
- <uni-popup ref="popup" type="center" @maskClick="maskClick">
- <view class="login_box">
- <view class="input_box">
- <view class="label">工号:</view>
- <view class="box">
- {{staff_num}}
- </view>
- </view>
- <view class="input_box">
- <view class="label">登录密码(宁煤信息平台):</view>
- <view class="box">
- <input type="password" v-model="password" />
- </view>
- </view>
- <view class="btn" @click="login()">确认</view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import time from "@/common/time.js"
- import {diffTime} from "@/common/time.js"
- import {goToLink} from "@/common/common.js"
-
- export default {
- name: "t-i-ice",
- props: [
- "iceList",
- "mine_code"
- ],
- data() {
- return {
- staff_num: "",
- password: "",
- url: "",
- app_id: "",
- gps: "",
- deviceID: "",
- phoneType: ""
- };
- },
- mounted() {
- this.staff_num = uni.getStorageSync('user').staff_num
- },
- methods: {
- maskClick() {
- this.password = ""
- },
- // 宁煤信息平台
- go_link(item) {
- let link = item.link
- if (link.indexOf("nativeApp://") != -1) {
- let app_name = link.match(/nativeApp:\/\/(\S*)\?/)[1]
- let app_down_link = link.split('?')[1]
- // #ifdef APP
- if (plus.os.name == 'Android') {
- plus.runtime.launchApplication({
- pname: app_name
- }, (e) => {
- console.log('Open system default browser failed: ' + e.message)
- uni.showModal({
- title: app_name,
- content: '未安装此应用、是否下载?',
- success: (res)=> {
- if (res.confirm) {
- console.log('用户点击确定');
-
- uni.navigateTo({
- url:"../../index/h5/h5?url="+app_down_link
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- })
- }
- // #endif
- } else if (link.indexOf("http://mtyyxs.shnxmyjt.com") != -1) {
- console.log("信息平台")
- this.url = item
- // 有登录记录
- let token = uni.getStorageSync('ningmei_token')
- let time = uni.getStorageSync('ningmei_token_time')
- // 30天刷新一次
- let diffTimeShow = diffTime(time,new Date().format("yyyy-MM-dd")).split(' ')[0];
- console.log(diffTimeShow)
- if (token.length > 20 && diffTimeShow < 30) {
- uni.navigateTo({
- url: "../../index/ningMeiXinXiPingTai/ningMeiXinXiPingTai",
- success: (res) => {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- data: this.url
- })
- }
- })
- } else {
- this.$refs.popup.open()
- }
- }else{
- goToLink(item,this.mine_code)
- }
-
-
- },
- login() {
- // #ifdef APP-PLUS
- if (this.password == '') {
- uni.showToast({
- icon: "none",
- title: "密码不能为空!"
- })
- return
- }
- this.$refs.popup.close()
- // 获取gps
- uni.getLocation({
- type: 'wgs84',
- success: (res) => {
- console.log('当前位置的经度:' + res.longitude);
- console.log('当前位置的纬度:' + res.latitude);
- this.gps = res.longitude + ',' + res.latitude
- // 获取设备信息
- plus.device.getInfo({
- success: (e) => {
- console.log(JSON.stringify(e.uuid));
- console.log(plus.device.model)
- this.deviceID = JSON.stringify(e.uuid)
- this.phoneType = plus.device.model
- uni.request({
- method: "POST",
- url: "http://mtyyxs.shnxmyjt.com:33300/api/OAuth/Login",
- header: {
- 'Content-Type': 'application/json;charset=UTF-8',
- 'caller': 'UnifiedPortal'
- },
- data: {
- phoneType: this.phoneType,
- password: this.password,
- gps: this.gps,
- userID: this.staff_num,
- resolvingPower: "851*393",
- deviceID: this.deviceID,
- ip: "112312313"
- },
- success: (res) => {
- console.log(this.password)
- console.log(res)
- if (res.data.code = '11002') {
- uni.showToast({
- icon: "none",
- title: res.data.msg
- })
- if (res.data.data.length > 20) {
- uni.setStorageSync('ningmei_token', res.data.data)
- uni.setStorageSync('ningmei_token_time', new Date().format("yyyy-MM-dd"))
- uni.navigateTo({
- url: "../../index/ningMeiXinXiPingTai/ningMeiXinXiPingTai",
- success: (res) => {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel
- .emit(
- 'acceptDataFromOpenerPage', {
- data: this
- .url
- })
- }
- })
- }
- }
- }
- })
- }
- });
- }
- })
- // #endif
- }
- }
- }
- </script>
- <style lang="scss">
- .content {
- margin-bottom: 20rpx;
- background-color: #FFFFFF;
- box-sizing: border-box;
- padding: 50rpx 25rpx 15rpx;
- }
- .nav {
- overflow: hidden;
- .item {
- float: left;
- width: 120rpx;
- margin-right: 25rpx;
- margin-bottom: 30rpx;
- .icon {
- width: 120rpx;
- text-align: center;
- image {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- }
- }
- .name {
- width: 120rpx;
- text-align: center;
- font-size: 30rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
- .item:nth-child(5n) {
- margin-right: 0;
- }
- }
- .login_box {
- width: 500rpx;
- padding: 30rpx 50rpx;
- border-radius: 20rpx;
- margin: 0 auto;
- background-color: #FFFFFF;
- .input_box {
- margin-bottom: 30rpx;
- .label {
- color: #6C6F74;
- margin-bottom: 20rpx;
- }
- .box {
- background: #FFFFFF;
- border-radius: 8rpx;
- border: 2rpx solid #E9EBF2;
- box-sizing: border-box;
- padding: 20rpx 25rpx;
- }
- }
- .btn {
- width: 500rpx;
- margin: 0 auto;
- border-radius: 8rpx;
- background-color: #009FE8;
- line-height: 90rpx;
- color: #FFFFFF;
- text-align: center;
- }
- }
- </style>
|