123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <template>
- <view class="content">
- <!-- <image @click="scan" class="img" mode="widthFix" src="../../static/img/lQDPDhs0QZY4xBXNAtDNAZWw7dBth6OpB2gCJkosywCAAA_405_720.jpg" ></image> -->
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- url: '',
- shopid:'',
- }
- },
- onLoad(opt) {
- if(opt.scene){
- var num=opt.scene;
- //var num = 'AFA7C75619124C70802A19437DDD80A7'
- var shopId=this.insertStr(num,8,"-");
- shopId=this.insertStr(shopId,13,"-");
- shopId=this.insertStr(shopId,18,"-");
- shopId=this.insertStr(shopId,23,"-");
- console.log(shopId)
- uni.reLaunch ({
- url:'../login/empower?shopId='+shopId
- })
- }else{
- //var shopId='1F12DB68-D8E8-4B76-9E20-287ACB72889F'
- uni.reLaunch ({
- url:'../login/empower'
- })
- }
- },
- methods: {
- insertStr(soure, start, newStr){
- return soure.slice(0, start) + newStr + soure.slice(start);
- },
- scan(){
- var that=this;
- uni.scanCode({
- success: function (res) {
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- that.url=res.result;
- that.shopId=that.getHashQuery('shopId')
- if(that.shopId){
- that.gologin()
- }else{
- uni.showToast({
- title: '请扫码正确的二维码',
- icon: 'none',
- duration: 3000
- });
- }
- console.log(that.shopId)
-
- }
- });
- },
- gologin(){
- uni.navigateTo({
- url:'../login/login?shopId='+this.shopId
- })
- },
- getHashQuery (query) {
- if (this.url.indexOf(query) > -1) {
- let cur = this.url.slice(this.url.indexOf(query) + query.length + 1, this.url.length)
- if (cur.indexOf('&') > -1) {
- return cur.slice(0, cur.indexOf('&'))
- } else {
- return cur
- }
- } else {
- return false
- }
- }
- }
- }
- </script>
- <style scoped>
-
- </style>
|