Ver Fonte

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

xuqiang há 4 anos atrás
pai
commit
c60fbbbaf9

+ 38 - 3
src/main/nine-space/src/main.js

@@ -15,9 +15,44 @@ import Driver from './components/Driver.vue';
 import common from './mixins/common';
 import VueClipboard from 'vue-clipboard2';
 import queryString from 'query-string';
-import VConsole from 'vconsole';
-const vConsole = new VConsole();
-
+// import VConsole from 'vconsole';
+// const vConsole = new VConsole();
+store.commit('setFirstUrl', location.href);
+http.http
+    .get('/wx/jsapiSign', { url: location.href })
+    .then(res => {
+        wx.config({
+            debug: false,
+            appId: res.appId,
+            timestamp: res.timestamp,
+            nonceStr: res.nonceStr,
+            signature: res.signature,
+            jsApiList: [
+                'chooseWXPay',
+                'updateAppMessageShareData',
+                'updateTimelineShareData',
+                'hideAllNonBaseMenuItem',
+                'scanQRCode'
+            ]
+        });
+        wx.error(function (res) {
+            console.log(res);
+        });
+        wx.ready(function () {
+            wx.updateAppMessageShareData({
+                title: '第九空间',
+                desc: '全球首个基于区块链的游戏资产集换中心',
+                link: location.origin + '/9th',
+                imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+            });
+            wx.updateTimelineShareData({
+                title: '第九空间-全球首个基于区块链的游戏资产集换中心',
+                link: location.origin + '/9th',
+                imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+            });
+        });
+    })
+    .catch(e => {});
 createApp(App)
     .use(Vant)
     .use(http)

+ 38 - 30
src/main/nine-space/src/router/index.js

@@ -4,39 +4,47 @@ import { Page } from './Page';
 import { Dialog } from 'vant';
 import http from '../plugins/http';
 
-console.log(http);
 function jsapiSign() {
-    if (/micromessenger/i.test(navigator.userAgent)) {
-        http.http
-            .get('/wx/jsapiSign', { url: location.origin + location.pathname })
-            .then(res => {
-                res.debug = false;
-                res.jsApiList = [
-                    'chooseWXPay',
-                    'updateAppMessageShareData',
-                    'updateTimelineShareData',
-                    'hideAllNonBaseMenuItem',
-                    'scanQRCode'
-                ];
-                wx.config(res);
-                wx.ready(function () {
-                    wx.updateAppMessageShareData({
-                        title: '第九空间',
-                        desc: '全球首个基于区块链的游戏资产集换中心',
-                        link: location.origin + '/9th',
-                        imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg',
-                        success: function () {}
+    setTimeout(() => {
+        if (/micromessenger/i.test(navigator.userAgent)) {
+            let isIOS = /iphone|ipad/i.test(navigator.userAgent);
+            http.http
+                .get('/wx/jsapiSign', { url: isIOS ? store.state.firstUrl : location.origin + location.href })
+                .then(res => {
+                    wx.config({
+                        debug: false,
+                        appId: res.appId,
+                        timestamp: res.timestamp,
+                        nonceStr: res.nonceStr,
+                        signature: res.signature,
+                        jsApiList: [
+                            'chooseWXPay',
+                            'updateAppMessageShareData',
+                            'updateTimelineShareData',
+                            'hideAllNonBaseMenuItem',
+                            'scanQRCode'
+                        ]
                     });
-                    wx.updateTimelineShareData({
-                        title: '第九空间-全球首个基于区块链的游戏资产集换中心',
-                        link: location.origin + '/9th',
-                        imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg',
-                        success: function () {}
+                    wx.error(function (res) {
+                        console.log(res);
                     });
-                });
-            })
-            .catch(e => {});
-    }
+                    wx.ready(function () {
+                        wx.updateAppMessageShareData({
+                            title: '第九空间',
+                            desc: '全球首个基于区块链的游戏资产集换中心',
+                            link: location.origin + '/9th',
+                            imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+                        });
+                        wx.updateTimelineShareData({
+                            title: '第九空间-全球首个基于区块链的游戏资产集换中心',
+                            link: location.origin + '/9th',
+                            imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+                        });
+                    });
+                })
+                .catch(e => {});
+        }
+    }, 200);
 }
 jsapiSign();
 const routes = [

+ 5 - 1
src/main/nine-space/src/store/index.js

@@ -4,7 +4,8 @@ import http from '../plugins/http';
 export default createStore({
     state: {
         finished: false,
-        userInfo: null
+        userInfo: null,
+        firstUrl: ''
     },
     mutations: {
         setFinished(state, finished) {
@@ -12,6 +13,9 @@ export default createStore({
         },
         setUserInfo(state, userInfo) {
             state.userInfo = userInfo;
+        },
+        setFirstUrl(state, url) {
+            state.firstUrl = url;
         }
     },
     actions: {

+ 1 - 1
src/main/nine-space/src/views/account/Setting.vue

@@ -92,7 +92,7 @@ export default {
                 message: '加载中...',
                 forbidClick: true
             });
-            this.updateFile(e, 1000).then(img => {
+            this.updateFile(e, 2000).then(img => {
                 this.updateUser({ bg: img }).then(res => {
                     this.$toast.clear();
                 });

+ 4 - 3
src/main/pc-space/src/components/LoginInfo.vue

@@ -126,7 +126,7 @@ export default {
         },
         init() {
             this.isShow = false;
-            this.Show = true;
+            this.Show = false;
             this.phoneLogin = false;
         },
         handleClose() {
@@ -145,7 +145,7 @@ export default {
         },
         // 密码登录
         check() {
-            this.$http
+            return this.$http
                 .post('/auth/phonePwdLogin', {
                     phone: this.form.phone,
                     password: this.form.password
@@ -163,7 +163,7 @@ export default {
         },
         Login() {
             this.check().then(() => {
-                this.$toast.success('登录成功');
+                this.$message.success('登录成功');
                 this.Show = false;
                 this.$EventBus.$emit('loginSuccess');
             });
@@ -301,6 +301,7 @@ export default {
             font-size: 13px;
             color: #fff;
             text-align: center;
+            cursor: pointer;
         }
         .el-button {
             font-size: 12px;

+ 180 - 21
src/main/pc-space/src/components/PageHeader.vue

@@ -6,7 +6,7 @@
             /></router-link>
 
             <div class="content">
-                <div class="tabs">
+                <!-- <div class="tabs">
                     <div
                         class="tab"
                         :class="{ active: active === item }"
@@ -17,7 +17,16 @@
                         {{ item }}
                         <div class="slip" :class="{ active: item === active }"></div>
                     </div>
-                </div>
+                </div> -->
+
+                <el-tabs v-model="activeName" class="menus" @tab-click="change">
+                    <el-tab-pane
+                        v-for="(item, index) in menus"
+                        :key="index"
+                        :label="item.label"
+                        :name="item.value"
+                    ></el-tab-pane>
+                </el-tabs>
                 <div class="btn-list" v-if="isLogin">
                     <el-dropdown @command="onCommand" style="margin-left: 20px">
                         <span class="el-dropdown-link">
@@ -35,7 +44,9 @@
                         </el-dropdown-menu>
                     </el-dropdown>
                 </div>
-                <div v-else class="login" @click="show = true">[登录]</div>
+                <!-- <div v-else class="login" @click="show = true">[登录]</div> -->
+                <el-button v-else class="login" plain @click="show = true">[登录]</el-button>
+
                 <!-- <div class="login login1">中文</div> -->
             </div>
         </div>
@@ -47,11 +58,39 @@ import LoginInfo from '../components/LoginInfo.vue';
 import { mapState, mapMutations } from 'vuex';
 export default {
     components: { LoginInfo },
+    watch: {
+        $route() {
+            this.getActive();
+        }
+    },
     data() {
         return {
             tabs: ['铸造者', '收藏探索', '数字盲盒', '我的NFT', '了解更多'],
             active: '',
-            show: false
+            show: false,
+            activeName: '',
+            menus: [
+                {
+                    label: '铸造者',
+                    value: '/casting'
+                },
+                {
+                    label: '收藏探索',
+                    value: '/collection'
+                },
+                {
+                    label: '数字盲盒',
+                    value: '/collection?type=BLIND_BOX'
+                },
+                {
+                    label: '我的NFT',
+                    value: '/my'
+                },
+                {
+                    label: '了解更多',
+                    value: 'wait'
+                }
+            ]
         };
     },
     computed: {
@@ -69,6 +108,7 @@ export default {
         this.$EventBus.$on('login', () => {
             this.show = true;
         });
+        this.getActive();
     },
     methods: {
         ...mapMutations(['updateUserInfo']),
@@ -111,28 +151,143 @@ export default {
                     this.$router.push('/authentication');
                 }
             }
+        },
+        getActive() {
+            let menus = [...this.menus];
+            menus.forEach(item => {
+                let _route = this.parsePath(item.value);
+                if (this.$route.path == _route.path && Object.keys(_route.query).length === 0) {
+                    this.activeName = item.value;
+                } else if (this.$route.path == _route.path) {
+                    Object.keys(_route.query).forEach(key => {
+                        if (_route.query[key] === this.$route.query[key]) {
+                            this.activeName = item.value;
+                        }
+                    });
+                }
+            });
+        },
+        change(info) {
+            if (info.paneName !== 'wait') {
+                this.$router.push(info.paneName);
+            } else {
+                this.wait();
+            }
+        },
+        parsePath(path = '') {
+            let hash = '';
+            let query = {};
+
+            let hashIndex = path.indexOf('#');
+            if (hashIndex >= 0) {
+                hash = path.slice(hashIndex);
+                path = path.slice(0, hashIndex);
+            }
+
+            let queryIndex = path.indexOf('?');
+            if (queryIndex >= 0) {
+                query = this.parseQuery(path.slice(queryIndex + 1));
+                path = path.slice(0, queryIndex);
+            }
+
+            return {
+                path,
+                query,
+                hash
+            };
+        },
+        parseQuery(query) {
+            const res = {};
+
+            query = query.trim().replace(/^(\?|#|&)/, '');
+
+            if (!query) {
+                return res;
+            }
+
+            query.split('&').forEach(param => {
+                const parts = param.replace(/\+/g, ' ').split('=');
+                const key = decode(parts.shift());
+                const val = parts.length > 0 ? decode(parts.join('=')) : null;
+
+                if (res[key] === undefined) {
+                    res[key] = val;
+                } else if (Array.isArray(res[key])) {
+                    res[key].push(val);
+                } else {
+                    res[key] = [res[key], val];
+                }
+            });
+
+            function decode(str = '') {
+                try {
+                    return decodeURIComponent(str);
+                } catch (err) {
+                    if (process.env.NODE_ENV !== 'production') {
+                        //   warn(false, `Error decoding "${str}". Leaving it intact.`)
+                    }
+                }
+                return str;
+            }
+
+            return res;
         }
     }
 };
 </script>
 <style lang="less" scoped>
-/deep/ .el-dropdown-menu__item {
-    font-weight: bold;
-    text-align: center;
+/deep/.btn-list {
+    .el-dropdown-menu__item {
+        font-weight: bold;
+        text-align: center;
+    }
+    .el-tabs__nav-scroll {
+        padding-left: 13px;
+    }
+    .el-tabs__item {
+        font-weight: bold;
+        font-size: 14px;
+        width: 300px;
+    }
+}
+
+/deep/.menus {
+    padding: 15px 25px 0;
+    .el-tabs__item {
+        padding: 0 25px;
+        color: #939599;
+        font-size: 18px;
+        &.is-active {
+            color: #fff;
+            font-weight: bold;
+        }
+    }
+
+    .el-tabs__nav-wrap {
+        &::after {
+            background-color: transparent;
+        }
+    }
+    .el-tabs__active-bar {
+        background-color: transparent;
+        &::after {
+            content: '';
+            position: absolute;
+            left: 30%;
+            right: 30%;
+            background-color: #fff;
+            top: 0;
+            bottom: 0;
+        }
+    }
 }
+
 .border {
     margin: 6px 16px;
     height: 1px;
     background: #f2f3f5;
 }
-/deep/ .el-tabs__nav-scroll {
-    padding-left: 13px;
-}
-/deep/ .el-tabs__item {
-    font-weight: bold;
-    font-size: 14px;
-    width: 300px;
-}
+
 .container {
     height: 90px;
     background: #0f1111;
@@ -195,14 +350,18 @@ export default {
 
             .login {
                 width: 83px;
-                height: 30px;
-                border-radius: 4px;
-                border: 1px solid;
-                // border-image: linear-gradient(135deg, rgba(0, 255, 203, 1), rgba(0, 110, 255, 1)) 1 1;
-                line-height: 30px;
-                text-align: center;
                 color: @prim;
                 font-size: 16px;
+                margin: 0 30px;
+                height: 30px;
+                line-height: 0px;
+                background-color: transparent;
+                .line(@radius:4px);
+                border-width: 0;
+                /deep/span {
+                    position: relative;
+                    z-index: 3;
+                }
                 // .line();
             }
         }

+ 1 - 1
src/main/pc-space/src/mixins/common.js

@@ -102,7 +102,7 @@ export default {
             this.$toast.clear();
         },
         wait() {
-            this.$toast('敬请期待');
+            this.$message.warning('敬请期待');
         }
     }
 };

+ 1 - 1
src/main/pc-space/src/mixins/phone.js

@@ -20,7 +20,7 @@ export default {
                 })
                 .then(res => {
                     this.msgCode = res;
-                    this.$message.warning('发送成功');
+                    this.$message.success('发送成功');
                 })
                 .catch(e => {
                     if (e) {

+ 2 - 2
src/main/pc-space/src/router/index.js

@@ -257,12 +257,12 @@ router.beforeEach((to, from, next) => {
             })
             .catch(() => {
                 if (to.meta.checkLogin) {
-                    MessageBox('用户未登录,是否立即登录', '提示', {
+                    MessageBox.confirm('用户未登录,是否立即登录', '提示', {
                         confirmButtonText: '立即登录'
                     }).then(() => {
                         eventBus.$emit('login');
                     });
-                    next('/');
+                    next(false);
                 } else {
                     next();
                 }

+ 1 - 5
src/main/pc-space/src/views/AssetDetail.vue

@@ -31,9 +31,6 @@
                 <div class="title">
                     <div class="title1">{{ info.name }}</div>
                     <div class="text">
-                        <like-button size="large" :isLike="info.liked" @like="likeProduct">
-                            {{ info.likes }}
-                        </like-button>
                         <div class="text1">
                             <img class="img1" src="../assets/img/fenxiang-icon@3x.png" alt="" />
                             <div class="text2">分享</div>
@@ -171,12 +168,11 @@
 import { Swiper, SwiperSlide } from 'vue-awesome-swiper';
 import product from '../mixins/product';
 import 'swiper/css/swiper.css';
-import LikeButton from '../components/LikeButton.vue';
 import CollectionInfo from '../components/CollectionInfo.vue';
 import Submit from './Submit.vue';
 import { mapState } from 'vuex';
 export default {
-    components: { Swiper, SwiperSlide, LikeButton, CollectionInfo, Submit },
+    components: { Swiper, SwiperSlide, CollectionInfo, Submit },
     mixins: [product],
     data() {
         return {

+ 9 - 2
src/main/pc-space/src/views/Collection.vue

@@ -104,6 +104,9 @@ export default {
     mixins: [pageableTable],
     watch: {
         select() {
+            if (this.type === 'BLIND_BOX') {
+                return;
+            }
             switch (this.select) {
                 case '0':
                     this.type = 'DEFAULT,AUCTION';
@@ -143,13 +146,14 @@ export default {
         }
     },
     mounted() {
-        this.init();
+        this.$nextTick(() => {
+            this.init();
+        });
     },
     methods: {
         init() {
             this.type = 'DEFAULT,AUCTION';
             this.search = '';
-            this.select = '0';
             this.sortStr = 'createdAt,desc';
             this.page = 1;
             if (this.$route.query.sort) {
@@ -158,6 +162,7 @@ export default {
             if (this.$route.query.type) {
                 this.type = this.$route.query.type;
             }
+            this.select = '0';
             if (this.type === 'DEFAULT') {
                 this.select = '1';
             }
@@ -167,6 +172,8 @@ export default {
             if (this.$route.query.canResale) {
                 this.canResale = true;
                 this.select = '2';
+            } else {
+                this.canResale = '';
             }
             this.isFirst = true;
             this.getData();

+ 7 - 2
src/main/pc-space/src/views/CollectionDetail.vue

@@ -91,7 +91,9 @@
                         {{ info.appointment ? '已预约' : '一键预约' }}
                     </el-button>
 
-                    <el-button class="buy" v-else-if="isBuy" type="primary" size="default">立即购买</el-button>
+                    <el-button class="buy" @click="submit" v-else-if="isBuy" type="primary" size="default"
+                        >立即购买</el-button
+                    >
                 </div>
                 <div v-if="properties.length > 0">
                     <div class="time">
@@ -164,7 +166,7 @@
             </collection-info>
         </div>
 
-        <submit></submit>
+        <submit ref="sub"></submit>
     </div>
 </template>
 <script>
@@ -296,6 +298,9 @@ export default {
                         this.$message.warning(e.error);
                     }
                 });
+        },
+        submit() {
+            this.$refs.sub.init(this.info);
         }
     }
 };

+ 1 - 1
src/main/pc-space/src/views/Home.vue

@@ -186,7 +186,7 @@ export default {
             if (!this.initChange) {
                 return;
             }
-            this.showCreator = (this.showCreator + 1) % 4;
+            this.showCreator = (this.showCreator + 1) % this.creators.length;
             this.timer = setTimeout(this.autoChange, 3000);
         },
         getProduct(type = 'DEFAULT') {

+ 24 - 2
src/main/pc-space/src/views/Submit.vue

@@ -49,11 +49,33 @@ export default {
                     name: '微信',
                     type: 'WEIXIN'
                 }
-            ]
+            ],
+            loading: true,
+            orderInfo: {}
         };
     },
     methods: {
-        submit() {}
+        submit() {},
+        init(info) {
+            this.checkLogin()
+                .then(() => {
+                    this.show = true;
+                    this.loading = true;
+                    return this.$http.post('/order/create?collectionId=' + info.id + '&qty=1');
+                })
+                .then(res => {
+                    return this.$http.post('/order/get/' + res.id);
+                })
+                .then(res => {
+                    this.orderInfo = res;
+                    this.loading = false;
+                })
+                .catch(e => {
+                    if (e) {
+                        this.$message.warning(e.error);
+                    }
+                });
+        }
     }
 };
 </script>