|  | @@ -68,12 +68,13 @@ var blockLibObj = {
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |      },
 |  |      },
 | 
												
													
														
															|  |      cloneType: null,
 |  |      cloneType: null,
 | 
												
													
														
															|  | 
 |  | +    initialShareTip: '',
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |      buildSheet: async function () {
 |  |      buildSheet: async function () {
 | 
												
													
														
															|  |          $.bootstrapLoading.start();
 |  |          $.bootstrapLoading.start();
 | 
												
													
														
															|  |          let me = this;
 |  |          let me = this;
 | 
												
													
														
															|  |          let namesAndLib = await ajaxPost('/blockLib/getLibNamesAndFirstLib',
 |  |          let namesAndLib = await ajaxPost('/blockLib/getLibNamesAndFirstLib',
 | 
												
													
														
															|  | -            {userID: userID, userName: $("#link_userName").text(), compilationID: projectObj.project.projectInfo.compilation});
 |  | 
 | 
												
													
														
															|  | 
 |  | +            {userID: userID, compilationID: projectObj.project.projectInfo.compilation});
 | 
												
													
														
															|  |          function getLibNamesHtml(libsArr) {
 |  |          function getLibNamesHtml(libsArr) {
 | 
												
													
														
															|  |              let result = '';
 |  |              let result = '';
 | 
												
													
														
															|  |              for (let lib of libsArr) {
 |  |              for (let lib of libsArr) {
 | 
												
											
												
													
														
															|  | @@ -83,6 +84,10 @@ var blockLibObj = {
 | 
												
													
														
															|  |          };
 |  |          };
 | 
												
													
														
															|  |          let html = getLibNamesHtml(namesAndLib.libNames);
 |  |          let html = getLibNamesHtml(namesAndLib.libNames);
 | 
												
													
														
															|  |          $("#select_block_lib_names").html(html);
 |  |          $("#select_block_lib_names").html(html);
 | 
												
													
														
															|  | 
 |  | +        this.initialShareTip = namesAndLib.shareList && namesAndLib.shareList.length
 | 
												
													
														
															|  | 
 |  | +            ? namesAndLib.shareList.reduce((acc, user) => acc += ` ${user.real_name}`, '已分享给')
 | 
												
													
														
															|  | 
 |  | +            : '';
 | 
												
													
														
															|  | 
 |  | +        $('#btn_block_share').attr('data-original-title', this.initialShareTip);
 | 
												
													
														
															|  |          await me.loadLib(namesAndLib.firstLib);
 |  |          await me.loadLib(namesAndLib.firstLib);
 | 
												
													
														
															|  |          $.bootstrapLoading.end();
 |  |          $.bootstrapLoading.end();
 | 
												
													
														
															|  |      },
 |  |      },
 | 
												
											
												
													
														
															|  | @@ -541,7 +546,7 @@ var blockLibObj = {
 | 
												
													
														
															|  |                      name: '删除',
 |  |                      name: '删除',
 | 
												
													
														
															|  |                      icon: "delete",
 |  |                      icon: "delete",
 | 
												
													
														
															|  |                      disabled: function () {
 |  |                      disabled: function () {
 | 
												
													
														
															|  | -
 |  | 
 | 
												
													
														
															|  | 
 |  | +                        return $("#select_block_lib_names option:selected").prop("index") !== 0;
 | 
												
													
														
															|  |                      },
 |  |                      },
 | 
												
													
														
															|  |                      visible: function(key, opt){
 |  |                      visible: function(key, opt){
 | 
												
													
														
															|  |                          return true;
 |  |                          return true;
 | 
												
											
												
													
														
															|  | @@ -660,13 +665,31 @@ $(document).ready(function(){    // 这里不需要处理异步:因为不需
 | 
												
													
														
															|  |      });
 |  |      });
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |      $("#select_block_lib_names").change(function() {
 |  |      $("#select_block_lib_names").change(function() {
 | 
												
													
														
															|  | 
 |  | +        const index = $("#select_block_lib_names option:selected").prop("index");
 | 
												
													
														
															|  | 
 |  | +        if (index !== 0) {
 | 
												
													
														
															|  | 
 |  | +            // 只读
 | 
												
													
														
															|  | 
 |  | +            $('#btn_block_newFolder').hide();
 | 
												
													
														
															|  | 
 |  | +            $('#btn_block_reName').hide();
 | 
												
													
														
															|  | 
 |  | +            $('#btn_block_share').prop('disabled', true);
 | 
												
													
														
															|  | 
 |  | +        } else {
 | 
												
													
														
															|  | 
 |  | +            $('#btn_block_newFolder').show();
 | 
												
													
														
															|  | 
 |  | +            $('#btn_block_reName').show();
 | 
												
													
														
															|  | 
 |  | +            $('#btn_block_share').prop('disabled', false);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  |          async function getLib(){
 |  |          async function getLib(){
 | 
												
													
														
															|  |              let libID = $("#select_block_lib_names").val();
 |  |              let libID = $("#select_block_lib_names").val();
 | 
												
													
														
															|  |              let lib = await ajaxPost('/blockLib/getLib', {libID: libID});
 |  |              let lib = await ajaxPost('/blockLib/getLib', {libID: libID});
 | 
												
													
														
															|  |              blockLibObj.loadLib(lib);
 |  |              blockLibObj.loadLib(lib);
 | 
												
													
														
															|  | 
 |  | +            if (userID === lib.userID) {
 | 
												
													
														
															|  | 
 |  | +                $('#btn_block_share').attr('data-original-title', blockLibObj.initialShareTip);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  |          };
 |  |          };
 | 
												
													
														
															|  |          $.bootstrapLoading.start();
 |  |          $.bootstrapLoading.start();
 | 
												
													
														
															|  |          getLib();
 |  |          getLib();
 | 
												
													
														
															|  |          $.bootstrapLoading.end();
 |  |          $.bootstrapLoading.end();
 | 
												
													
														
															|  |      });
 |  |      });
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    $('#btn_block_share').click(function () {
 | 
												
													
														
															|  | 
 |  | +        SHARE_TO.initModal(SHARE_TO.Mode.BLOCK_LIB);
 | 
												
													
														
															|  | 
 |  | +    })
 | 
												
													
														
															|  |  });
 |  |  });
 |