1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <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.shopId){
- uni.reLaunch ({
- url:'../login/empower?shopId='+opt.shopId
- })
- }else{
- //var shopId='1F12DB68-D8E8-4B76-9E20-287ACB72889F'
- uni.reLaunch ({
- url:'../login/empower'
- })
- }
- },
- methods: {
- 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>
|