panhui 2 years ago
parent
commit
3cb707bc9e
2 changed files with 169 additions and 11 deletions
  1. 38 1
      src/views/domain/BindingWeb.vue
  2. 131 10
      src/views/domain/SuperLinkType.vue

+ 38 - 1
src/views/domain/BindingWeb.vue

@@ -6,13 +6,34 @@
                 <div class="text2">您可以绑定您的电商网页或知乎链接等</div>
             </div>
         </div>
+        <div class="input">
+            <van-field
+                type="text"
+                :border="false"
+                right-icon="guide-o"
+                v-model="address"
+                placeholder="请输入指定的链接进行绑定"
+            />
+        </div>
 
         <div class="btns">
             <van-button type="default" @click="$router.back()" round>返回</van-button>
-            <van-button type="primary" round>确认</van-button>
+            <van-button type="primary" round @click="sure">确认</van-button>
         </div>
     </div>
 </template>
+<script>
+export default {
+    data() {
+        return {
+            address: ''
+        };
+    },
+    methods: {
+        sure(){}
+    }
+};
+</script>
 
 <style lang="less" scoped>
 .page {
@@ -68,4 +89,20 @@
         color: #fff;
     }
 }
+
+.input {
+    padding: 20px;
+    /deep/ .van-cell {
+        background: #ffffff;
+        border-radius: 19px;
+        --van-cell-vertical-padding: 7px;
+        --van-cell-horizontal-padding: 12px;
+        --van-field-placeholder-text-color: rgba(0, 0, 0, 0.3);
+        --van-field-right-icon-color: #000;
+
+        .van-field__control {
+            font-size: 14px;
+        }
+    }
+}
 </style>

+ 131 - 10
src/views/domain/SuperLinkType.vue

@@ -4,7 +4,7 @@
         <div class="title">选择你要启用的超链类型</div>
 
         <div class="select-list">
-            <div class="select" v-for="(item, index) in typeList" :key="index">
+            <div class="select" v-for="(item, index) in typeList" :key="index" @click="chooseType(item)">
                 <img :src="item.icon" alt="" class="img" />
                 <div class="select-info">
                     <div class="text1">{{ item.name }}</div>
@@ -17,49 +17,170 @@
 </template>
 
 <script setup>
+import { Dialog, Toast } from 'vant';
+import http from '@/plugins/http';
+import { ref, onMounted } from 'vue';
+import { useRoute, useRouter } from 'vue-router';
+import { useStore } from 'vuex';
+
 const typeList = [
     {
         icon: require('@/assets/icon_mingcheng.png'),
         name: '绑定RID元域名作为用户名',
-        sub: '将元域名作为您的昵称'
+        sub: '将元域名作为您的昵称',
+        type: 'RID_CLOUD_DOMAIN_NAME'
     },
     {
         icon: require('@/assets/icon_zhuye.png'),
         name: '绑定个人主页',
-        sub: '增加主页曝光度,获得更多粉丝'
+        sub: '增加主页曝光度,获得更多粉丝',
+        type: 'HOMEPAGE'
     },
     {
         icon: require('@/assets/icon_cangpin.png'),
         name: '绑定指定藏品',
-        sub: '一键触达指定数字藏品'
+        sub: '一键触达指定数字藏品',
+        type: 'COLLECTION'
     },
     {
         icon: require('@/assets/icon_web2.0.png'),
         name: '绑定指定web2.0浏览页面',
-        sub: '您可以绑定您的电商网页或知乎链接等'
+        sub: '您可以绑定您的电商网页或知乎链接等',
+        type: 'EXTERNALLINK'
     },
     {
         icon: require('@/assets/icon_mingpian.png'),
         name: '绑定个人名片',
-        sub: '您可以绑定微信/微博二维码'
+        sub: '您可以绑定微信/微博二维码',
+        type: 'PERSONAL_BUSINESS_CARD'
     },
     {
         icon: require('@/assets/icon_douyin.png'),
         name: '绑定抖音视频',
-        sub: '绑定抖音视频,让更多人看到你的精彩!'
+        sub: '绑定抖音视频,让更多人看到你的精彩!',
+        type: 'VIBRATO_VIDEO'
     },
     {
         icon: require('@/assets/icon_OASISMETA.png'),
         name: '关联OASISMETA绿洲元宇宙',
-        sub: '关联个人土地空间'
+        sub: '关联个人土地空间',
+        type: 'OASISMETA'
     }
 ];
+
+const assetId = ref(0);
+const assetInfo = ref({});
+const route = useRoute();
+const router = useRouter();
+onMounted(() => {
+    if (route.query.id) {
+        assetId.value = route.query.id;
+        http.http.get('/asset/get/' + assetId.value).then(res => {
+            assetInfo.value = res;
+        });
+    }
+});
+
+const store = useStore();
+function chooseType(info) {
+    switch (info.type) {
+        case 'RID_CLOUD_DOMAIN_NAME':
+            Dialog.confirm({
+                title: '提示',
+                message: '确认要将元域名作为您的昵称吗?'
+            })
+                .then(res => {
+                    Toast.loading({
+                        message: '加载中...',
+                        forbidClick: true
+                    });
+                    return http.http.post('/user/update', {
+                        ...store.state.userInfo,
+                        nickname: assetInfo.value.name
+                    });
+                })
+                .then(res => {
+                    Toast.success('设置成功');
+                })
+                .catch(e => {
+                    Toast.clear();
+                    if (e && e.error) {
+                        Toast(e.error);
+                    }
+                });
+            break;
+        case 'HOMEPAGE':
+            Dialog.confirm({
+                title: '提示',
+                message: '确认要绑定个人主页吗?'
+            })
+                .then(() => {
+                    Toast.loading({
+                        message: '加载中...',
+                        forbidClick: true
+                    });
+                    return addHyperLink(info.type, `creatorDetail?id=${store.state.userInfo.id}&type=DEFAULT`);
+                })
+                .then(() => {
+                    Toast.success('设置成功');
+                    router.back();
+                })
+                .catch(e => {
+                    Toast.clear();
+                    if (e && e.error) {
+                        Toast(e.error);
+                    }
+                });
+            break;
+        case 'COLLECTION':
+            router.push({
+                name: 'domainProductChoose',
+                query: {
+                    assetId: assetId.value
+                }
+            });
+            break;
+        case 'EXTERNALLINK':
+            router.push({
+                name: 'bindingWeb',
+                query: {
+                    assetId: assetId.value
+                }
+            });
+            break;
+        case 'PERSONAL_BUSINESS_CARD':
+            router.push({
+                name: 'bindingImage',
+                query: {
+                    assetId: assetId.value
+                }
+            });
+            break;
+        case 'VIBRATO_VIDEO':
+            router.push({
+                name: 'bindingWeb',
+                query: {
+                    assetId: assetId.value
+                }
+            });
+            break;
+    }
+}
+
+function addHyperLink(hyperLinkType, address) {
+    return http.post('/domainOrder/addHyperLink', {
+        assetId: assetInfo.value.id,
+        openHyperLink: true,
+        hyperLinkType: hyperLinkType,
+        address: address
+    });
+}
 </script>
 
 <style lang="less" scoped>
 .page {
     min-height: var(--app-height) !important;
-    background-color: #23042e;
+    background-color: #0f1014;
     color: #fff;
     background-size: 100% auto;
     background-repeat: no-repeat;
@@ -83,7 +204,7 @@ const typeList = [
 .select-list {
     padding: 40px 20px;
     .select + .select {
-        margin-top: 10px;
+        margin-top: 16px;
     }
 }