| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <template>
- <view class="content">
- <view>请在PC浏览器输入后台登录网址:</view>
- <view>https://ng.xazhima.com/ ;</view>
- <view>使用下方“扫一扫”功能扫码登录</view>
-
- <view class="options">
- <view v-for="(item, idx) in list" :key="idx" class="options-item" @click="goDetailFn(idx, item.url)" v-if="item.isShow">
- <view class="img-box">
- <img :src="item.icon" alt="" class="options-item-img" />
- </view>
- <view class="options-item-name">
- {{ item.name }}
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import md5 from "@/common/md5.js";
- export default {
- components: {
- },
- data() {
- return {
- isAuth: true,
- userHeadImg: "",
- userNickName: "",
- userscanCode:"",
- list: [
- {
- icon: "/static/scan.png",
- name: "扫一扫" ,
- // url: "/pages/index/scanCode/index",
- isShow:true,
- },
- ],
- };
- },
- onLoad() {
- },
- onShow() {
- },
- methods: {
- codeReg(strs){
- let reg = /\[(.*?)\]/gi;
- let str = strs;
- let tmp = str.match(reg) , result = '';
- if (tmp) {
- for (let i = 0; i < tmp.length; i++) {
- result = tmp[i].replace(reg, "$1")
- }
- } else {
- console.log("no match.");
- }
- console.log(result)
- this.getScanCode(result)
- },
- getScanCode(codeRes) {
- let md5Sign = md5(
- "method=" +
- "user" +
- "×tamp=" +
- getApp().globalData.globalTimestamp +
- "&secret=" +
- getApp().globalData.secret
- );
- let url =
- getApp().globalData.shareUrl +
- "api/api.php" +
- "?method=user&action=qrcode_login×tamp=" +
- getApp().globalData.globalTimestamp +
- "&sign=" +
- md5Sign;
- uni.request({
- url: url,
- method: "POST",
- header: {
- "content-type": "application/x-www-form-urlencoded",
- },
- data: {
- openid:getApp().globalData.open_id,
- qrcode:codeRes
- },
- success: (res) => {
- if (res.data.code === 200) {
- uni.showToast({
- title:res.data.msg,
- icon:'none'
- })
- } else {
- uni.showToast({
- title:res.data.msg,
- icon:'none'
- })
- }
- },
- fail: () => {
- console.log("连接失败");
- },
- });
- },
- goDetailFn(index, url) {
- let that = this;
- uni.scanCode({
- success: function (res) {
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- that.codeReg(res.result)
- }
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .content {
- display: flex;
- flex-direction: column;
- padding: 40rpx;
- color: #444;
- font-size: 30rpx;
- .options {
- margin-top: 15%;
- .options-item {
- background-color: #fff;
- display: flex;
- box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
- border-radius: 10rpx;
- height: 120rpx;
- align-items: center;
- .img-box {
- margin-left: 40rpx;
- .options-item-img {
- width: 56rpx;
- height: 56rpx;
- }
- }
- .options-item-name {
- margin-left: 40rpx;
- font-weight: 600;
- font-size: 30rpx;
- margin-bottom: 10rpx;
- }
- }
- }
- }
- .fontGrey {
- color: $uni-text-color-grey;
- }
- </style>
|